branch_name
stringclasses
149 values
text
stringlengths
23
89.3M
directory_id
stringlengths
40
40
languages
listlengths
1
19
num_files
int64
1
11.8k
repo_language
stringclasses
38 values
repo_name
stringlengths
6
114
revision_id
stringlengths
40
40
snapshot_id
stringlengths
40
40
refs/heads/master
<repo_name>ECEEmbedded/PicRouter2-master<file_sep>/src/Color.h #ifndef __Color_H_ #define __Color_H_ typedef struct DRIVERColorMEMBERS { unsigned char id; unsigned char class; unsigned char a; } DriverColorMembers; typedef struct DRIVERColorDATA { unsigned char input; } DriverColorData; void DriverColorInit(Driver_t *driver) { DriverColorMembers *self = (DriverColorMembers *)driver; self->a = 0xE; DebugPrint(self->a); } void DriverColorRespond(Driver_t *driver, unsigned char *rcvData) { DriverColorData *data = (DriverColorData *)rcvData; DriverColorMembers *self = (DriverColorMembers *)driver; start_UART_send(8, data); } void DriverColorPoll(Driver_t *driver) { DriverColorMembers *self = (DriverColorMembers *)driver; //DebugPrint(self->id); i2c_master_recv(self->id, 8); } void DriverColorAdd(unsigned char id) { Driver_t *context = (Driver_t *)driverMalloc(sizeof(Driver_t)); context->id = id; context->class = 0x20; DriverTable[NumberOfDrivers].context = context; DriverTable[NumberOfDrivers].respond = DriverColorRespond; DriverTable[NumberOfDrivers].poll = DriverColorPoll; ++NumberOfDrivers; DriverColorInit(context); } #endif __Color_H_ <file_sep>/src/drivers.h #ifndef DRIVER_H_ #define DRIVER_H_ #include "debug.h" #include "i2cMaster.h" #include "my_uart.h" #define MAX_DRIVERS 10 unsigned char DriverHeap[MAX_DRIVERS*40]; unsigned char *heapPointer = DriverHeap; unsigned char *driverMalloc(int size) { unsigned char *temp = heapPointer; heapPointer += size; return temp; } //Driver dispatch table //Id -> Driver Function? typedef struct DRIVER_T { unsigned char id; //1 Byte unsigned char class; //1 Byte unsigned char data[10]; //Do whatever } Driver_t; typedef struct RRPACKET_T { unsigned char id; //1 Byte unsigned char class; //1 Byte unsigned char data[4]; //Payload } RRPacket_t; //Device ID Dispatch table (Convert a device ID to it's driver functions) typedef struct DRIVER_TABLE_ENT_T { unsigned char id; Driver_t *context; void (*respond)(Driver_t *, unsigned char *); void (*poll)(Driver_t *); } Driver_Table_Ent_t; Driver_Table_Ent_t DriverTable[MAX_DRIVERS]; unsigned char NumberOfDrivers = 0; //Current number of drivers #include "Color.h" #include "IR.h" #endif DRIVER_H_ <file_sep>/src/Motor.h #ifndef __Motor_H_ #define __Motor_H_ typedef struct DRIVERMotorMEMBERS { unsigned char id; unsigned char class; unsigned char a; } DriverMotorMembers; void DriverMotorInit(Driver_t *driver) { DriverMotorMembers *self = (DriverMotorMembers *)driver; self->a = 0xE; DebugPrint(self->a); } void DriverMotorRespond(Driver_t *driver, unsigned char *rcvData) { DriverMotorMembers *self = (DriverMotorMembers *)driver; } void DriverMotorPoll(Driver_t *driver) { DriverMotorMembers *self = (DriverMotorMembers *)driver; //DebugPrint(self->id); LATAbits.LATA2 = !LATAbits.LATA2; } void DriverMotorAdd(unsigned char id) { Driver_t *context = (Driver_t *)driverMalloc(sizeof(Driver_t)); context->id = id; context->class = 0x4F; DriverTable[NumberOfDrivers].context = context; DriverTable[NumberOfDrivers].respond = DriverMotorRespond; DriverTable[NumberOfDrivers].poll = DriverMotorPoll; ++NumberOfDrivers; DriverMotorInit(context); } #endif __Motor_H_ <file_sep>/src/ColorSensor.h /* * File: ColorSensor.h * Author: Dhiraj * * */ #ifndef COLORSENSOR_H #define COLORSENSOR_H //#define Clock_8MHz //#define Baud_9600 // // //#define STATUS_LED PORTB.3 // // //#define WRITE_sda() TRISB = TRISB & 0b10111111 //SDA must be output when writing //#define READ_sda() TRISB = TRISB | 0b01000000 //SDA must be input when reading - don't forget the resistor on SDA!! // //#define SCL PORTB.7 //#define SDA PORTB.6 // //#define I2C_DELAY 1 // //#define ACK 1 //#define NO_ACK 0 //#define DEVICE_WRITE 0x74 //Default ADJD-S371 I2C address - write //#define DEVICE_READ 0xE9 //Default ADJD-S371 I2C address - read #define CAP_RED 0x06 #define CAP_GREEN 0x07 #define CAP_BLUE 0x08 #define CAP_CLEAR 0x09 #define INT_RED_LO 0x0A #define INT_RED_HI 0x0B #define INT_GREEN_LO 0x0C #define INT_GREEN_HI 0x0D #define INT_BLUE_LO 0x0E #define INT_BLUE_HI 0x0F #define INT_CLEAR_LO 0x10 #define INT_CLEAR_HI 0x11 #define DATA_RED_LO 0x40 #define DATA_RED_HI 0x41 #define DATA_GREEN_LO 0x42 #define DATA_GREEN_HI 0x43 #define DATA_BLUE_LO 0x44 #define DATA_BLUE_HI 0x45 #define DATA_CLEAR_LO 0x46 #define DATA_CLEAR_HI 0x47 void boot_up(void); void Color_init(void); void ack_polling(unsigned char device_address); void write_register(unsigned char register_name, unsigned char register_value); void read_register(unsigned char register_name); void color_read(unsigned char *msg, unsigned char len); #endif /* COLORSENSOR_H */ <file_sep>/DriverStack/build.rb puts "Building drivers..." #Write a line to file buffer def out text @fileBuffer << text << "\n" end #Get all drivers driverFiles = [] driverPath = "#{Dir.pwd}/../src/Drivers/" Dir.entries(driverPath).each do |file| if file.include? ".rb" and !file.include? ".sw" driverFiles << { :name => file.gsub(/\..*/, ""), :fullPath => driverPath + file, } end end driverHeaderFileNames = [] #Compile each driver driverFiles.each do |driver| @name = "#{driver[:name]}" @fileName = "#{driver[:name]}.h" driverHeaderFileNames << @fileName puts "" puts "##################################" driverHeaderFileName = "#{Dir.pwd}/../src/#{@fileName}" print "Compiling #{@name}" print "#{driverHeaderFileName}" puts "" @fileBuffer = "" #Compile driver########### #Header out "#ifndef __#{@name}_H_" out "#define __#{@name}_H_" load driver[:fullPath] #Helpers########## putSelf = lambda do out "Driver#{@name}Members *self = (Driver#{@name}Members *)driver;" end ################## #Members########## out %{ typedef struct DRIVER#{@name}MEMBERS \{ unsigned char id; unsigned char class; } out @members out "} Driver#{@name}Members;" ################### #Data########## out %{ typedef struct DRIVER#{@name}DATA \{ } out @data out "} Driver#{@name}Data;" ################### #Init########## out "void Driver#{@name}Init(Driver_t *driver) {" putSelf.call out @init out "}" ################### #Respond########## out "void Driver#{@name}Respond(Driver_t *driver, unsigned char *rcvData) {" out "Driver#{@name}Data *data = (Driver#{@name}Data *)rcvData;" putSelf.call out @respond out "}" ################## #Poll########## out "void Driver#{@name}Poll(Driver_t *driver) {" putSelf.call out @poll out "}" ################## #AddDevice out %{ void Driver#{@name}Add(unsigned char id) \{ Driver_t *context = (Driver_t *)driverMalloc(sizeof(Driver_t)); context->id = id; context->class = 0x#{@class}; DriverTable[NumberOfDrivers].context = context; DriverTable[NumberOfDrivers].respond = Driver#{@name}Respond; DriverTable[NumberOfDrivers].poll = Driver#{@name}Poll; ++NumberOfDrivers; Driver#{@name}Init(context); \} } #Footer out "#endif __#{@name}_H_" #Write to file @file = File.open(driverHeaderFileName, "w+") @file << @fileBuffer @file.close() puts "##################################" puts "" end puts "Writing includes to drivers.h..." File.open("#{Dir.pwd}/../src/drivers.h", "w+") do |file| file << "#ifndef DRIVER_H_\n" file << "#define DRIVER_H_\n" file << %{ #include "debug.h" #include "i2cMaster.h" #include "my_uart.h" #define MAX_DRIVERS 10 unsigned char DriverHeap[MAX_DRIVERS*40]; unsigned char *heapPointer = DriverHeap; unsigned char *driverMalloc(int size) { unsigned char *temp = heapPointer; heapPointer += size; return temp; } //Driver dispatch table //Id -> Driver Function? typedef struct DRIVER_T { unsigned char id; //1 Byte unsigned char class; //1 Byte unsigned char data[10]; //Do whatever } Driver_t; typedef struct RRPACKET_T { unsigned char id; //1 Byte unsigned char class; //1 Byte unsigned char data[4]; //Payload } RRPacket_t; //Device ID Dispatch table (Convert a device ID to it's driver functions) typedef struct DRIVER_TABLE_ENT_T { unsigned char id; Driver_t *context; void (*respond)(Driver_t *, unsigned char *); void (*poll)(Driver_t *); } Driver_Table_Ent_t; Driver_Table_Ent_t DriverTable[MAX_DRIVERS]; unsigned char NumberOfDrivers = 0; //Current number of drivers } driverHeaderFileNames.each do |fn| file << "#include \"#{fn}\"\n" end file << "#endif DRIVER_H_\n" file.close() end <file_sep>/src/i2cMaster.c #include "i2cMaster.h" #include "messages.h" #include "my_i2c.h" #include "debug.h" enum { I2C_FREE, I2C_SENDING, I2C_REQUESTING, I2C_RECEIVING, I2C_RECEIVE_NEXT_BYTE, I2C_RECEIVED, I2C_REQUESTING_REG, I2C_ACKSTAT }; typedef struct __i2c_master_comm { unsigned char buffer[MSGLEN]; signed char buflen; unsigned char buffind; unsigned char event_count; unsigned char status; unsigned char error_code; unsigned char error_count; } i2c_master_comm; static i2c_master_comm i2c_p; void i2c_master_start_next_in_Q(void); // Sending in I2C Master mode [slave write] // returns -1 if the i2c bus is busy // return 0 otherwise // Will start the sending of an i2c message -- interrupt handler will take care of // completing the message send. When the i2c message is sent (or the send has failed) // the interrupt handler will send an internal_message of type MSGT_MASTER_SEND_COMPLETE if // the send was successful and an internal_message of type MSGT_MASTER_SEND_FAILED if the // send failed (e.g., if the slave did not acknowledge). Both of these internal_messages // will have a length of 0. // The subroutine must copy the msg to be sent from the "msg" parameter below into // the structure to which ic_ptr points [there is already a suitable buffer there]. unsigned char i2c_master_send(unsigned char adr, unsigned char length, unsigned char *msg) { unsigned char msgbuf[MSGLEN]; msgbuf[0] = (adr << 1); int i; for (i = 0; i < length; ++i) { msgbuf[i+1] = msg[i]; } FromMainHigh_sendmsg(length+1, MSGT_I2C_MASTER_SEND, msgbuf); i2c_master_start_next_in_Q(); return 0; } // Receiving in I2C Master mode [slave read] // returns 1 if the i2c bus is busy // return 0 otherwise // Will start the receiving of an i2c message -- interrupt handler will take care of // completing the i2c message receive. When the receive is complete (or has failed) // the interrupt handler will send an internal_message of type MSGT_MASTER_RECV_COMPLETE if // the receive was successful and an internal_message of type MSGT_MASTER_RECV_FAILED if the // receive failed (e.g., if the slave did not acknowledge). In the failure case // the internal_message will be of length 0. In the successful case, the // internal_message will contain the message that was received [where the length // is determined by the parameter passed to i2c_master_recv()]. // The interrupt handler will be responsible for copying the message received into unsigned char i2c_master_recv(unsigned char ID, char length) { unsigned char buf[2]; buf[0] = (ID << 1) | 0x01; buf[1] = length+1; // +1 is so there is room for the i2c address FromMainHigh_sendmsg(2,MSGT_I2C_MASTER_RECV,buf); i2c_master_start_next_in_Q(); return(0); } unsigned char i2c_master_request_reg(unsigned char ID, unsigned char adr, unsigned char length) { unsigned char buf[3]; buf[0] = (ID << 1) | 0x01; buf[1] = adr; buf[2] = length; FromMainHigh_sendmsg(3,MSGT_I2C_MASTER_REQUEST_REG,buf); i2c_master_start_next_in_Q(); return(0); } // private function void i2c_master_start_next_in_Q() { if (i2c_p.status != I2C_FREE) { return; } unsigned char msgType; i2c_p.buflen = FromMainHigh_recvmsg(MSGLEN, &msgType, i2c_p.buffer); if (i2c_p.buflen == MSGQUEUE_EMPTY) { return; } if (msgType == MSGT_I2C_MASTER_SEND) { i2c_p.buffind = 0; i2c_p.status = I2C_SENDING; SEN = 1; } else if (msgType == MSGT_I2C_MASTER_RECV) { i2c_p.buffind = 0; i2c_p.buflen = i2c_p.buffer[1]; i2c_p.status = I2C_REQUESTING; SEN = 1; } else if (msgType == MSGT_I2C_MASTER_REQUEST_REG) { i2c_p.buffind = 0; i2c_p.buflen = i2c_p.buffer[2]; i2c_p.status = I2C_REQUESTING_REG; SEN = 1; } } void i2c_master_int_handler() { switch (i2c_p.status) { case I2C_FREE: { i2c_master_start_next_in_Q(); break; } case I2C_SENDING: { if (i2c_p.buffind < i2c_p.buflen/* && !SSPCON2bits.ACKSTAT*/) { SSPBUF = i2c_p.buffer[i2c_p.buffind]; i2c_p.buffind++; } else { // we have nothing left to send i2c_p.status = I2C_FREE; PEN = 1; //i2c_master_start_next_in_Q(); } break; } case I2C_REQUESTING: { SSPBUF = i2c_p.buffer[i2c_p.buffind]; ++i2c_p.buffind; i2c_p.status = I2C_ACKSTAT; break; } case I2C_RECEIVING: { i2c_p.buffer[i2c_p.buffind] = SSPBUF; ++i2c_p.buffind; if (i2c_p.buffind < i2c_p.buflen) { i2c_p.status = I2C_RECEIVE_NEXT_BYTE; ACKDT = 0; } else { // we have nothing left to send i2c_p.status = I2C_RECEIVED; ACKDT = 1; } ACKEN = 1; break; } case I2C_RECEIVE_NEXT_BYTE: { i2c_p.status = I2C_RECEIVING; RCEN = 1; break; } case I2C_REQUESTING_REG: { if (i2c_p.buffind >= 2) { SSPBUF = i2c_p.buffer[i2c_p.buffind++]; } else { i2c_p.buffind = 0; i2c_p.buffer[0] = i2c_p.buffer[0] & 0xFE; i2c_p.status = I2C_REQUESTING; RSEN = 1; } break; } case I2C_ACKSTAT: { if (SSPCON2bits.ACKSTAT) { // 1 if no acknowledge i2c_p.status = I2C_FREE; PEN = 1; } else { i2c_p.status = I2C_RECEIVING; RCEN = 1; } break; } case I2C_RECEIVED: { i2c_p.status = I2C_FREE; ToMainHigh_sendmsg(i2c_p.buflen, MSGT_I2C_DATA, i2c_p.buffer); PEN = 1; } } } /* Function: I2CInit Return: Arguments: Description: Initialize I2C in master mode, Sets the required baudrate */ void I2CInit(void){ TRISC3 = 1; /* SDA and SCL as input pin */ TRISC4 = 1; /* these pins can be configured either i/p or o/p */ SSPSTAT |= 0x80; /* Slew rate disabled */ SSPCON1 = 0x28; /* SSPEN = 1, I2C Master mode, clock = FOSC/(4 * (SSPADD + 1)) */ SSPADD = 0x28; /* 100Khz @ 4Mhz Fosc */ i2c_p.status = I2C_FREE; } <file_sep>/src/i2cMaster.h #ifndef I2C_MASTER_H_ #define I2C_MASTER_H_ #include "maindefs.h" #include <stdio.h> #ifndef __XC8 #include <usart.h> #include <i2c.h> #include <timers.h> #else #include <plib/usart.h> #include <plib/i2c.h> #include <plib/timers.h> #endif //Setup I2C void I2CInit(void); void I2CReadRequest(unsigned char id, unsigned char registerAddress, unsigned char *data, int N); void I2CWriteRequest(unsigned char id, unsigned char registerAddress, unsigned char *data, int N); void i2c_configure_master(unsigned char); unsigned char i2c_master_send(unsigned char adr, unsigned char,unsigned char *); unsigned char i2c_master_recv(unsigned char ID, unsigned char); unsigned char i2c_master_request_reg(unsigned char ID, unsigned char adr, unsigned char length); void i2c_master_int_handler(); #endif <file_sep>/src/Drivers/Color.rb @class = "20" @desc = "Color sensing driver" @members = %{ unsigned char a; } @data = %{ unsigned char input; } @init = %{ self->a = 0xE; DebugPrint(self->a); } @respond = %{ start_UART_send(8, data); } @poll = %{ //DebugPrint(self->id); i2c_master_recv(self->id, 0x10, 8); }<file_sep>/src/Drivers/IR.rb @class = "3A" @desc = "Infrared Detection" @members = %{ unsigned char a; } @data = %{ unsigned char input; } @init = %{ self->a = 0xE; DebugPrint(self->a); } @respond = %{ } @poll = %{ //DebugPrint(self->id); }<file_sep>/src/IR.h #ifndef __IR_H_ #define __IR_H_ typedef struct DRIVERIRMEMBERS { unsigned char id; unsigned char class; unsigned char a; } DriverIRMembers; typedef struct DRIVERIRDATA { unsigned char input; } DriverIRData; void DriverIRInit(Driver_t *driver) { DriverIRMembers *self = (DriverIRMembers *)driver; self->a = 0xE; DebugPrint(self->a); } void DriverIRRespond(Driver_t *driver, unsigned char *rcvData) { DriverIRData *data = (DriverIRData *)rcvData; DriverIRMembers *self = (DriverIRMembers *)driver; } void DriverIRPoll(Driver_t *driver) { DriverIRMembers *self = (DriverIRMembers *)driver; //DebugPrint(self->id); } void DriverIRAdd(unsigned char id) { Driver_t *context = (Driver_t *)driverMalloc(sizeof(Driver_t)); context->id = id; context->class = 0x3A; DriverTable[NumberOfDrivers].context = context; DriverTable[NumberOfDrivers].respond = DriverIRRespond; DriverTable[NumberOfDrivers].poll = DriverIRPoll; ++NumberOfDrivers; DriverIRInit(context); } #endif __IR_H_ <file_sep>/src/ColorSensor.c #include "maindefs.h" #include "ColorSensor.h" #include "i2cMaster.h" #include "messages.h" unsigned char temp_buffer[4]; void boot_up(void) // What is UART for with color sensor? { // //OSCCON = 0b.0111.0000; //Setup internal oscillator for 8MHz // //while(OSCCON.2 == 0); //Wait for frequency to stabilize // // //Setup Ports // //ANSEL = 0b.0000.0000; //Turn off A/D // // PORTA = 0b00000000; // TRISA = 0b00000000; // // PORTB = 0b00010000; // TRISB = 0b00000100; //0 = Output, 1 = Input RX on RB2 // // //Setup the hardware UART module // //============================================================= // SPBRG = 51; //8MHz for 9600 inital communication baud rate // // TXSTA = 0b00100100; //8-bit asych mode, high speed uart enabled // RCSTA = 0b10010000; //Serial port enable, 8-bit asych continous receive mode // //============================================================= } void Color_init(void) { // Only 4 mesages can be in the i2c queue at a time. // This makes this function hard and requires being split up to send 2 at once write_register(CAP_RED, 0x05); write_register(CAP_GREEN, 0x05); write_register(CAP_BLUE, 0x05); write_register(CAP_CLEAR, 0x05); write_register(INT_RED_LO, 0xC4); write_register(INT_RED_HI, 0x09); write_register(INT_GREEN_LO, 0xC4); write_register(INT_GREEN_HI, 0x09); write_register(INT_BLUE_LO, 0xC4); write_register(INT_BLUE_HI, 0x09); write_register(INT_CLEAR_LO, 0xC4); write_register(INT_CLEAR_HI, 0x09); } void write_register(unsigned char register_name, unsigned char register_value) { temp_buffer[0] = register_name; temp_buffer[1] = register_value; i2c_master_send(MSGT_I2C_DATA, 2, temp_buffer); //Return nothing } void read_register(unsigned char register_name) { i2c_master_request_reg(I2C_COLOR_ADDRESS, register_name, 1); } void color_read(unsigned char *msg, unsigned char len) { switch (msg[1]) { case DATA_RED_HI: { //RedH = msg[2]; break; } case DATA_RED_LO: { //RedL = msg[2]; break; } // ect } // When all colers are received, find most dominant color and send that to ARM }
6711f9c4eccd594665f5eb0f433c4e60d682d949
[ "C", "Ruby" ]
11
C
ECEEmbedded/PicRouter2-master
f756a73e3950f2fcf0af67a4858dfeb5ea2bb28a
ff17390bc29dea70870a06567988c86d31f80b7e
refs/heads/master
<file_sep>using System; using System.Collections.Generic; using System.Data; using System.Data.SqlClient; using System.Linq; using System.Web; using System.Web.Configuration; using System.Web.UI; using System.Web.UI.WebControls; public partial class showevent : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { if (Session["ID"] == null) Response.Redirect("Default.aspx"); string connetionString; SqlConnection cnn; connetionString = WebConfigurationManager.ConnectionStrings["constr"].ConnectionString; cnn = new SqlConnection(connetionString); cnn.Open(); SqlDataAdapter da = new SqlDataAdapter("select * from Advertisement ", cnn); DataTable dtb = new DataTable(); da.Fill(dtb); gvshowads.DataSource = dtb; gvshowads.DataBind(); cnn.Close(); } protected void Button1_Click(object sender, EventArgs e) { Response.Redirect("ContributorProfile.aspx"); } } <file_sep>using System; using System.Collections.Generic; using System.Data; using System.Data.SqlClient; using System.Linq; using System.Web; using System.Web.Configuration; using System.Web.UI; using System.Web.UI.WebControls; public partial class Part4 : System.Web.UI.Page { protected void Button1_Click(object sender, EventArgs e) { Response.Redirect("StaffProfile.aspx"); } }
365fb09a8c0dc78e473c1d4b78b00829d22ba3f5
[ "C#" ]
2
C#
ZeyadKhattab/IEgypt
d4909de9843581a114801dff7524e525e3a92a15
4bd6cc16cc52a385a9d70bb13cbe13696a202e32
refs/heads/main
<file_sep>import React from 'react'; import { Link } from 'react-router-dom'; import '../Header/Header.css'; import Home from '../Home/Home'; import Rides from '../Rides/Rides'; const Header = () => { return ( <div> <nav class="navbar navbar-expand-lg navbar-light"> <div class="container"> <a class="navbar-brand" href="#">Urban Riders</a> <button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarNavAltMarkup" aria-controls="navbarNavAltMarkup" aria-expanded="false" aria-label="Toggle navigation"> <span class="navbar-toggler-icon"></span> </button> <div class="collapse navbar-collapse" id="navbarNavAltMarkup"> <div class="navbar-nav ml-auto"> <Link to="/home" class="nav-link active" aria-current="page" href="#">Home</Link> <Link to="/destination" class="nav-link active" href="#">Destination</Link> <Link to="/blog" class="nav-link active" href="#">Blog</Link> <Link to="/contact" class="nav-link active" href="#">Contact</Link> <Link to="/login"><button class="btn btn-outline-success me-2" type="button">Login</button> </Link> </div> </div> </div> </nav> </div> ); }; export default Header;<file_sep>import React from 'react'; import './RideCostExpand.css' const RideCostExpand = (props) => { console.log(props); const {rideName , image , capacity ,cost} = props.costs; return ( <div className="col-md-12 mb-3"> <div className="bg-light p-3"> <img className="d-inline-block vehicle-img" src={image} alt=""/> <h4 className="d-inline-block mx-5">{rideName}</h4> <p className="d-inline-block mx-2">{capacity}</p> <p className="d-inline-block mx-2">{cost}</p> </div> </div> ); }; export default RideCostExpand;<file_sep>Urban Rider Web App . Main features are 1.Home component. 2.Destination . 3.Login Components. Main Interesting feature is , When you choose any Rides.. It does not go destination page.. --- when you login or if you new user must sign up.. --- Or login using google account .. --- or login using Facebook account .. When you go destination page you want to where you go .. Then you show map .. and Finally Show riders number and also amount................ ----------Thank You------------------------------- # react-auth-Fahadul101 <file_sep>import React from 'react'; import Header from '../Header/Header'; import Home from '../Home/Home'; const Destination = () => { return ( <div className="container"> <Header></Header> <hr></hr> <h1 className="text-center text-info">First Select Ride</h1> <Home/> </div> ); }; export default Destination;<file_sep>import React from 'react'; import Header from '../Header/Header'; import Map from '../../images/Map.png' import { useState } from 'react'; import { useEffect } from 'react'; import fakeData from '../../Data/Data.json'; import RideCostExpand from '../RideCostExpand/RideCostExpand'; import { FontAwesomeIcon } from '@fortawesome/react-fontawesome' import { faRoute } from '@fortawesome/free-solid-svg-icons' const RideCost = () => { const [cost, setCost] = useState([]); useEffect(() => { setCost(fakeData); }, []) return ( <div className="container"> <Header /> <div className="row"> <div className="col-md-6"> <div className="col-md-12 p-4"> <div className="d-flex justify-content-center bg-primary"> <div className="col-md-6 p-2 text-center "> <FontAwesomeIcon className="fa-3x" icon={faRoute}/> </div> <div className="col-md-6 text-left"> <h4>Mirpur</h4> <h4>Gulisthan</h4> </div> </div> </div> <div className="col-md-12"> { cost.map(costs => <RideCostExpand costs={costs}></RideCostExpand>) } </div> </div> <div className="col-md-6"> <img src={Map} alt="" /> </div> </div> </div> ); }; export default RideCost;<file_sep>import React from 'react'; import { useState } from 'react'; import { useEffect } from 'react'; import { useParams } from 'react-router'; import fakeData from '../../Data/Data.json'; import Header from '../Header/Header'; import Map from '../../images/Map.png' import { Link } from 'react-router-dom'; const RideDetails = () => { return ( <div className="container"> <Header /> <div className="row"> <div className="col-md-4 bg-light"> <div className="mb-3 mt-3"> <p>Pick From</p> <input type="text" name="" id="" /> </div> <div className="mb-3"> <p>Pick To</p> <input type="text" name="" id="" /> </div> <div className="mb-3"> <form> <p>Choose Date</p> <input type="date" id="birthday" name="birthday"></input> </form> </div> <div class="ml-5 mb-3"> <Link to="/rideCost"> <button type="button" class="btn btn-primary btn-lg">Search</button></Link> </div> </div> <div className="col-md-6"> <img src={Map} alt=""/> </div> </div> </div> ); }; export default RideDetails;
8680f9ed5d5aa553057658dd088a8ad4ca963827
[ "JavaScript", "Markdown" ]
6
JavaScript
IslamFahadul/Urban-Riders
a74013a3bf79e3bac485b8b5ba5a3c6811f21faa
4089b29a44e1c3e2477e351cf6488ac3d464739b
refs/heads/master
<repo_name>jwd83/QuadBlox<file_sep>/README.md # QuadBlox A homebrew tetris game written in C using raylib <file_sep>/quadblox.c // includes #include "raylib.h" #include "string.h" #include "stdbool.h" #include "stdlib.h" #include "stdio.h" // macros #define BOARD_HEIGHT 28 #define BOARD_WIDTH 10 // constants const int boardHeight = BOARD_HEIGHT; const int boardWidth = BOARD_WIDTH; const int boardXOffset = 10; const int boardYOffset = 10; const int screenWidth = 500; const int screenHeight = 550; const int fontSizeTitle = 40; const int fontSizeGame = 20; const int tileSize = 18; const int tileOutlineSize = 1; double lastTick = 0; double tickRate = 0.75; Color colorTable[9] = { BLACK, PURPLE, DARKPURPLE, GREEN, WHITE, YELLOW, RED, MAROON, ORANGE}; int state = 0; int score = 0; int lines = 0; int board[BOARD_WIDTH][BOARD_HEIGHT]; // Function prototypes Color randomColor(); bool Tick(); bool detectSwapPieceCollision(); int randomColorIndex(); void addLine(); void clearBoard(); void clearLines(); void drawLines(); void drawScore(); void drawTile(int x, int y, Color c); void generatePiece(); void placePiece(); void positionPiece(); void rotatePiece(); void sceneBoard(); void sceneTitle(); void startGame(); // structs struct GamePiece { int blocks[4][4]; int x; int y; } piece, swapPiece; // it's game time! int main(void) { InitWindow(screenWidth, screenHeight, "QuadBlox"); SetTargetFPS(60); // Set our game to run at 60 frames-per-second //-------------------------------------------------------------------------------------- // Main game loop while(!WindowShouldClose()) // Detect window close button or ESC key { switch(state) { case 0: // start off at the title screen sceneTitle(); break; case 1: sceneBoard(); break; // an unknown state was found revert to title default: state = 0; break; } } // De-Initialization //-------------------------------------------------------------------------------------- CloseWindow(); // Close window and OpenGL context //-------------------------------------------------------------------------------------- return 0; } void sceneTitle() { if(IsKeyDown(KEY_ENTER)) { startGame(); state += 1; } BeginDrawing(); ClearBackground(BLUE); DrawText("Welcome to QuadBlox", 50, 200, fontSizeTitle, LIGHTGRAY); DrawText("Press[ENTER]", 100, 250, fontSizeTitle, LIGHTGRAY); EndDrawing(); } void sceneBoard() { BeginDrawing(); ClearBackground(BLUE); drawScore(); drawLines(); if(IsKeyPressed(KEY_UP)) { rotatePiece(); } if(IsKeyPressed(KEY_LEFT)) { swapPiece = piece; swapPiece.x -= 1; if(!detectSwapPieceCollision()) { piece = swapPiece; } } if(IsKeyPressed(KEY_RIGHT)) { swapPiece = piece; swapPiece.x += 1; if(!detectSwapPieceCollision()) { piece = swapPiece; } } if(Tick() || IsKeyPressed(KEY_DOWN)) { swapPiece = piece; swapPiece.y += 1; if(detectSwapPieceCollision()) { placePiece(); generatePiece(); } else { piece = swapPiece; } } // draw board outline for(int y = 0; y < boardHeight; y++) { // Draw outline drawTile(-1, y, LIGHTGRAY); drawTile(boardWidth, y, LIGHTGRAY); } for(int x = -1; x <= boardWidth; x++) { drawTile(x, boardHeight, LIGHTGRAY); } // draw board for(int x = 0; x < boardWidth; x++) { for(int y = 0; y < boardHeight; y++) { if(board[x][y]) drawTile(x, y, colorTable[board[x][y]]); } } // draw piece for(int x = 0; x < 4; x++) { for(int y = 0; y < 4; y++) { if(piece.blocks[x][y]) { drawTile(piece.x + x, piece.y + y, colorTable[piece.blocks[x][y]]); } } } EndDrawing(); } void drawTile(int x, int y, Color c) { int dx = boardXOffset + tileSize + x * tileSize; int dy = boardYOffset + y * tileSize; // draw black bacground of the tile allowing for an outline of varying width DrawRectangle(dx, dy, tileSize, tileSize, BLACK); // fill the rectangle with our desired color inside the black background DrawRectangle(dx + tileOutlineSize, dy + tileOutlineSize, tileSize - tileOutlineSize * 2, tileSize - tileOutlineSize * 2, c); } void clearBoard() { memset(board, 0, sizeof board); for(int y = 1; y <= 5; y++) { addLine(); } // board[4][4] = randomColorIndex(); // board[5][5] = randomColorIndex(); } void generatePiece() { memset(piece.blocks, 0, sizeof piece.blocks); int blockColorIndex = randomColorIndex(); piece.x = 5; piece.y = 0; switch(GetRandomValue(1, 7)) { case 1: // straight line piece.blocks[1][0] = blockColorIndex; piece.blocks[1][1] = blockColorIndex; piece.blocks[1][2] = blockColorIndex; piece.blocks[1][3] = blockColorIndex; break; case 2: // square piece.blocks[1][1] = blockColorIndex; piece.blocks[1][2] = blockColorIndex; piece.blocks[2][1] = blockColorIndex; piece.blocks[2][2] = blockColorIndex; break; case 3: // T piece.blocks[1][1] = blockColorIndex; piece.blocks[2][1] = blockColorIndex; piece.blocks[3][1] = blockColorIndex; piece.blocks[2][2] = blockColorIndex; break; case 4: // s piece.blocks[2][0] = blockColorIndex; piece.blocks[3][0] = blockColorIndex; piece.blocks[1][1] = blockColorIndex; piece.blocks[2][1] = blockColorIndex; break; case 5: // backwards s piece.blocks[1][0] = blockColorIndex; piece.blocks[2][0] = blockColorIndex; piece.blocks[2][1] = blockColorIndex; piece.blocks[3][1] = blockColorIndex; break; case 6: // L piece.blocks[1][1] = blockColorIndex; piece.blocks[1][2] = blockColorIndex; piece.blocks[1][3] = blockColorIndex; piece.blocks[2][3] = blockColorIndex; break; case 7: // backwards L piece.blocks[1][1] = blockColorIndex; piece.blocks[1][2] = blockColorIndex; piece.blocks[1][3] = blockColorIndex; piece.blocks[2][1] = blockColorIndex; break; } positionPiece(); } void positionPiece() { // left shift the piece while(!piece.blocks[0][0] && !piece.blocks[0][1] && !piece.blocks[0][2] && !piece.blocks[0][3]) { for(int i = 1; i < 4; i++) { piece.blocks[i - 1][0] = piece.blocks[i][0]; piece.blocks[i - 1][1] = piece.blocks[i][1]; piece.blocks[i - 1][2] = piece.blocks[i][2]; piece.blocks[i - 1][3] = piece.blocks[i][3]; } piece.blocks[3][0] = 0; piece.blocks[3][1] = 0; piece.blocks[3][2] = 0; piece.blocks[3][3] = 0; } // up shift the piece while(!piece.blocks[0][0] && !piece.blocks[1][0] && !piece.blocks[2][0] && !piece.blocks[3][0]) { for(int i = 1; i < 4; i++) { piece.blocks[0][i - 1] = piece.blocks[0][i]; piece.blocks[1][i - 1] = piece.blocks[1][i]; piece.blocks[2][i - 1] = piece.blocks[2][i]; piece.blocks[3][i - 1] = piece.blocks[3][i]; } piece.blocks[0][3] = 0; piece.blocks[1][3] = 0; piece.blocks[2][3] = 0; piece.blocks[3][3] = 0; } } void rotatePiece() { struct GamePiece backup = piece; swapPiece.x = piece.x; swapPiece.y = piece.y; for(int x = 0; x < 4; x++) { for(int y = 0; y < 4; y++) { swapPiece.blocks[3 - x][y] = piece.blocks[y][x]; } } piece = swapPiece; positionPiece(); swapPiece = piece; if(detectSwapPieceCollision()) { piece = backup; } } bool detectSwapPieceCollision() { for(int x = 0; x < 4; x++) { for(int y = 0; y < 4; y++) { if(swapPiece.blocks[x][y]) { int tx = swapPiece.x + x; int ty = swapPiece.y + y; // check for piece on board collision if(board[tx][ty]) return true; // check for boundry collision if(tx >= boardWidth) return true; if(tx < 0) return true; if(ty >= boardHeight) return true; } } } return false; } void placePiece() { for(int x = 0; x < 4; x++) { for(int y = 0; y < 4; y++) { if(piece.blocks[x][y]) { int tx = piece.x + x; int ty = piece.y + y; // check for piece on board collision board[tx][ty] = piece.blocks[x][y]; } } } clearLines(); } void startGame() { clearBoard(); generatePiece(); lastTick = GetTime(); } Color randomColor() { return colorTable[randomColorIndex()]; } int randomColorIndex() { return GetRandomValue(1, 8); } void addLine() { for(int y = 1; y < boardHeight; y++) { for(int x = 0; x < boardWidth; x++) { board[x][y - 1] = board[x][y]; } } int xSkip = GetRandomValue(0, boardWidth - 1); int y = boardHeight - 1; for(int x = 0; x < boardWidth; x++) { if(x != xSkip) { board[x][y] = randomColorIndex(); } else { board[x][y] = 0; } } } bool Tick() { if(GetTime() - lastTick >= tickRate) { lastTick = GetTime(); return true; } else { return false; } } void clearLines() { int linesCleared = 0; bool clearLine; for(int y = boardHeight - 1; y > 0; y--) { clearLine = true; for(int x = 0; x < boardWidth; x++) { if(!board[x][y]) clearLine = false; } if(clearLine) { linesCleared++; for(int ys = y; ys > 1; ys--) { for(int xs = 0; xs < boardWidth; xs++) { board[xs][ys] = board[xs][ys - 1]; } } y++; // check this line again as we shifted the board down } } if(linesCleared == 1) score += 1; if(linesCleared == 2) score += 3; if(linesCleared == 3) score += 6; if(linesCleared == 4) score += 12; lines += linesCleared; } void drawScore() { DrawText("Score", boardXOffset + tileSize * (boardWidth + 3), boardYOffset, fontSizeGame, LIGHTGRAY); int length = snprintf( NULL, 0, "%d", score ); char* str = malloc( length + 1 ); snprintf( str, length + 1, "%d", score ); DrawText(str, boardXOffset + tileSize * (boardWidth + 3), boardYOffset + tileSize * 2, fontSizeGame, WHITE); free(str); } void drawLines() { DrawText("Lines", boardXOffset + tileSize * (boardWidth + 3), boardYOffset + tileSize * 5, fontSizeGame, LIGHTGRAY); int length = snprintf( NULL, 0, "%d", lines ); char* str = malloc( length + 1 ); snprintf( str, length + 1, "%d", lines ); DrawText(str, boardXOffset + tileSize * (boardWidth + 3), boardYOffset + tileSize * 7, fontSizeGame, WHITE); free(str); }
73326daecc87be8971b91f3a9f42962f2b04f106
[ "Markdown", "C" ]
2
Markdown
jwd83/QuadBlox
fc6f09e2a3f988838d040acf9ae67b31e29e7777
9b09bb4a1ee3df69c96aa6c19b91cc7ae5f9f75b
refs/heads/master
<file_sep>package utils import ( "fmt" "testing" "time" ) func TestGetCurrentDateTime(t *testing.T) { str := GetCurrentDateTime() if str != time.Now().Format(FORMAT_DATETIME) { t.Error("获取日期时间错误", str) } fmt.Println("当前日期时间为:", str) } func TestGetCurrentDate(t *testing.T) { str := GetCurrentDate() if str != time.Now().Format(FORMAT_DATE) { t.Error("获取日期错误:", str) } fmt.Println("当前日期为:", str) } func TestGetFirstValue(t *testing.T) { str := getFirstValue("123", "456") if str != "456" { t.Error("获取值错误:", str) } fmt.Println("获取的值为:", str, "没有使用默认值") str = getFirstValue("789", "", "456") if str != "789" { t.Error("获取值错误:", str) } fmt.Println("获取的值为:", str, "使用默认值") str = getFirstValue("789") if str != "789" { t.Error("获取值错误:", str) } fmt.Println("获取的值为:", str, "使用默认值") } <file_sep>/* Navicat Premium Data Transfer Source Server : 我的本地连接 Source Server Type : MySQL Source Server Version : 50721 Source Host : localhost:3306 Source Schema : short-url Target Server Type : MySQL Target Server Version : 50721 File Encoding : 65001 Date: 17/12/2019 18:33:53 */ SET NAMES utf8mb4; SET FOREIGN_KEY_CHECKS = 0; -- ---------------------------- -- Table structure for app -- ---------------------------- DROP TABLE IF EXISTS `app`; CREATE TABLE `app` ( `app_id` int(11) NOT NULL AUTO_INCREMENT, `app_name` varchar(32) NOT NULL COMMENT '应用名称', `app_key` varchar(100) NOT NULL COMMENT '应用KEY', `status` int(11) NOT NULL DEFAULT '1' COMMENT '状态 1 启用 2 禁用', `created_at` datetime NOT NULL COMMENT '创建时间', `updated_at` datetime NOT NULL COMMENT '修改时间', PRIMARY KEY (`app_id`), UNIQUE KEY `app_key` (`app_key`) ) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8 COMMENT='应用信息'; -- ---------------------------- -- Table structure for app_url -- ---------------------------- DROP TABLE IF EXISTS `app_url`; CREATE TABLE `app_url` ( `id` int(11) NOT NULL AUTO_INCREMENT, `app_id` int(11) NOT NULL COMMENT '关联应用', `short_id` varchar(100) NOT NULL DEFAULT '' COMMENT '短ID', `url` varchar(255) NOT NULL COMMENT '地址信息', `created_at` datetime NOT NULL, `updated_at` datetime NOT NULL, PRIMARY KEY (`id`), UNIQUE KEY `app_url` (`app_id`,`url`) COMMENT '应用url唯一', UNIQUE KEY `short_id` (`short_id`) USING BTREE COMMENT '短ID必须唯一' ) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=utf8 COMMENT='应用url'; SET FOREIGN_KEY_CHECKS = 1; <file_sep>package config import ( "fmt" "testing" ) func TestGet(t *testing.T) { if dbUser := Get("DB_USERNAME"); dbUser != "root" { t.Error("get db_username error", dbUser) } else { fmt.Println("db_user := ", dbUser) } } func TestRead(t *testing.T) { Read("/usr/local/goproject/my-short-url/.env") fmt.Println(Config) if Get("DB_PASSWORD") != "<PASSWORD>" { t.Error("读取文件失败") } } func TestGetValue(t *testing.T) { Read("/usr/local/goproject/my-short-url/.env") value := GetValue("LINE/int", 10000) fmt.Println(value, value.(int)) value = GetValue("LINE/int64", int64(1)) fmt.Println(value, value.(int64)) } <file_sep>package utils import ( "encoding/base32" "math/rand" "strconv" "time" ) const BASE = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ" // 将字符串解析为int64 func DecodeInt64(uri string) (id int64, err error) { var strId []byte strId, err = base32.StdEncoding.DecodeString(uri) if err != nil { return } return strconv.ParseInt(string(strId), 10, 64) } // 将int64转为string func EncodeInt64(id int64) string { str := strconv.FormatInt(id, 10) return base32.StdEncoding.EncodeToString([]byte(str)) } func Base62(id int64) string { if id <= 0 { return "" } var str = []byte{} for id > 0 { str = append(str, BASE[id%62]) id = id / 62 } i := rand.New(rand.NewSource(time.Now().UnixNano())).Intn(51) str = append(str, BASE[i+10]) return string(str) } <file_sep>package handle import ( "app/config" "app/models" "app/utils" "net/http" "strings" ) type createResponse struct { Url string `json:"url"` ShortUrl string `json:"short_url"` ShortId string `json:"short_id"` CreatedAt string `json:"created_at"` } func Create(w http.ResponseWriter, r *http.Request) error { r.ParseForm() // 获取信息 key := r.PostForm.Get("app_key") url := r.PostForm.Get("url") if key == "" || url == "" { return responseError(w, 501, "请求参数存在问题") } // 验证url if !strings.HasPrefix(url, "https://") && !strings.HasPrefix(url, "http://") { return responseError(w, 501, "url地址无效") } // 查询数据是否存在 app, err := models.FindAppByAppKey(key) if err != nil { return responseError(w, 502, "没有查询到应用") } // 验证应用状态 if app.Status != 1 { return responseError(w, 502, "该应用已经被停用") } // 响应数据 currentTime := utils.GetCurrentDateTime() var appUrl = models.AppUrl{ AppId: app.Id, Url: url, CreatedAt: currentTime, UpdatedAt: currentTime, } // 不存在、那么新增数据 if !appUrl.FindOne() { appUrl.Id, err = appUrl.Create() if err != nil { return err } } // 修改数据库 if appUrl.ShortId == "" { // 需要处理ID appUrl.ShortId = utils.Base62(appUrl.Id) if appUrl.ShortId == "" { return responseError(w, 502, "生成短网址失败") } if _, err = appUrl.UpdateShortId(); err != nil { return nil } } return responseSuccess(w, createResponse{ Url: url, ShortUrl: config.Get("APP_URL") + "/" + appUrl.ShortId, ShortId: appUrl.ShortId, CreatedAt: appUrl.CreatedAt, }) } <file_sep>package models import ( "app/config" "app/utils" "database/sql" "errors" ) type AppUrl struct { Id int64 `db:"id"` AppId int64 `db:"app_id"` ShortId string `db:"short_id"` Url string `db:"url"` CreatedAt string `db:"created_at"` UpdatedAt string `db:"updated_at"` } // 新增数据 func (u *AppUrl) Create() (lastId int64, err error) { var ( smt *sql.Stmt result sql.Result querySql = "INSERT INTO `app_url` (`app_id`, `url`, `created_at`, `updated_at`) VALUES (?, ?, ?, ?)" ) smt, err = config.DB.Prepare(querySql) if err != nil { return } result, err = smt.Exec(u.AppId, u.Url, u.CreatedAt, u.UpdatedAt) if err != nil { err = errors.New("新增数据失败") return } return result.LastInsertId() } func (u *AppUrl) UpdateShortId() (lastId int64, err error) { var ( smt *sql.Stmt result sql.Result querySql = "UPDATE `app_url` SET `short_id` = ? , `updated_at` = ? WHERE `id` = ?" ) smt, err = config.DB.Prepare(querySql) if err != nil { return } result, err = smt.Exec(u.ShortId, utils.GetCurrentDateTime(), u.Id) if err != nil { err = errors.New("修改数据失败") return } return result.RowsAffected() } // 判断是否存在 func (u *AppUrl) FindOne() bool { existsSql := "SELECT `id`, `app_id`, `short_id`, `url`, `created_at`, `updated_at` FROM `app_url` WHERE `app_id` = ? AND `url` = ?" _ = config.DB.QueryRow(existsSql, u.AppId, u.Url).Scan(&u.Id, &u.AppId, &u.ShortId, &u.Url, &u.CreatedAt, &u.UpdatedAt) return u.Id > 0 } // 查询数据 func FindUrlById(id int64) (url string, err error) { // 查询数据 querySql := "SELECT `url` FROM `app_url` WHERE `id` = ? LIMIT 1" err = config.DB.QueryRow(querySql, id).Scan(&url) if err == sql.ErrNoRows { err = errors.New("没有对应短网址") } return } // 查询通过short_id func FindUrlByShortId(shortId string) (url string, err error) { querySql := "SELECT `url` FROM `app_url` WHERE `short_id` = ? LIMIT 1" err = config.DB.QueryRow(querySql, shortId).Scan(&url) if err == sql.ErrNoRows { err = errors.New("没有对应短网址") } return } <file_sep>package utils import ( "fmt" "testing" "time" ) func TestDecodeInt64(t *testing.T) { id, err := DecodeInt64("GI======") if err != nil { t.Error("解析错误", err) return } if id != 2 { t.Error("解析失败:", id) return } fmt.Println(id) } func TestEncodeInt64(t *testing.T) { str := EncodeInt64(2) if str != "GI======" { t.Error("加密失败", str) return } fmt.Println(str) } func TestBase62(t *testing.T) { str := Base62(1) fmt.Println(str, Base62(2), Base62(23), Base62(32), Base62(63), Base62(time.Now().Unix())) } <file_sep># 系统配置 APP_URL=http://localhost:8080 APP_PORT=:8080 # 数据库配置 DB_DRIVER=mysql DB_HOST=127.0.0.1 DB_PORT=3306 DB_USERNAME=root DB_PASSWORD= DB_CHARSET=utf8 DB_NAME=short-url<file_sep>package handle import ( "fmt" "net/http" ) func Handle(f func(w http.ResponseWriter, r *http.Request) error) func(w http.ResponseWriter, r *http.Request) { return func(w http.ResponseWriter, r *http.Request) { defer func() { // 存在错误、响应处理 if e := recover(); e != nil { fmt.Println("服务器错误:", e) responseError(w, 505, "服务器繁忙,请稍后再试...") } }() if err := f(w, r); err != nil { responseError(w, 505, err.Error()) } } } <file_sep>package config import ( "bufio" "fmt" "io" "os" "strconv" "strings" ) // 所有配置信息 var Config = map[string]string{ // 应用配置 "APP_URL": "http://localhost", "APP_PORT": ":80", // 数据库配置 "DB_DRIVER": "mysql", "DB_HOST": "127.0.0.1", "DB_PORT": "3306", "DB_USERNAME": "root", "DB_PASSWORD": "", "DB_CHARSET": "utf8", "DB_NAME": "short-url", } func Read(filename string) { file, err := os.Open(filename) if err != nil { fmt.Println("读取配置文件错误", err.Error()) return } defer file.Close() r := bufio.NewReader(file) for { b, _, err := r.ReadLine() // 读取一行存在错误 if err != nil { if err == io.EOF { break } return } // 去掉两边的空格 str := strings.TrimSpace(string(b)) if str == "" { continue } // 查询是否存在= index := strings.Index(str, "=") if index < 0 { continue } // 存在KEY key := strings.TrimSpace(str[:index]) value := strings.TrimSpace(str[index+1:]) if len(key) == 0 || len(value) == 0 { continue } // 设置值 Config[key] = value } } // 获取配置项 func Get(key string, defaultValue ...string) string { str, ok := Config[key] // 存在不为空的值,直接返回 if ok && str != "" { return str } if len(defaultValue) > 0 { return defaultValue[0] } return "" } func GetValue(key string, defaultValue ...interface{}) interface{} { arr := strings.Split(key, "/") key = arr[0] var typeName string if len(arr) > 1 { typeName = arr[1] } else { typeName = "string" } // 获取到值 value := Get(key) // 转int if typeName == "int" { intValue, err := strconv.Atoi(value) if (intValue == 0 || err != nil) && len(defaultValue) > 0 { intValue, _ = defaultValue[0].(int) } return intValue } // 转int64 if typeName == "int64" { int64Value, err := strconv.ParseInt(value, 10, 64) if (int64Value == 0 || err != nil) && len(defaultValue) > 0 { int64Value, _ = defaultValue[0].(int64) } return int64Value } if value == "" && len(defaultValue) > 0 { value, _ = defaultValue[0].(string) } return value } <file_sep>package handle import ( "app/models" "app/utils" "net/http" "strings" "time" ) type homeResponse struct { Uri string `json:"uri"` DateTime string `json:"date"` Time int64 `json:"time"` } func Home(w http.ResponseWriter, r *http.Request) error { // 获取请求地址 uri := strings.TrimLeft(r.RequestURI, "/") if uri == "" { return responseSuccess(w, homeResponse{ Uri: uri, DateTime: utils.GetCurrentDateTime(), Time: time.Now().Unix(), }) } // 拿到ID查询数据库 url, err := models.FindUrlByShortId(uri) if err != nil { return err } // 执行跳转 http.Redirect(w, r, url, http.StatusFound) return nil } <file_sep>package handle import ( "encoding/json" "net/http" ) // 响应json数据 type Response struct { Code int `json:"code"` Msg string `json:"msg"` Data interface{} `json:"data"` } type indexResponse struct { Date string `json:"date"` Time int64 `json:"time"` Uri string `json:"uri"` } // 响应错误信息 func responseError(w http.ResponseWriter, code int, msg string) error { if msg == "" { msg = "fail" } return responseJson(w, code, msg, nil) } func responseSuccess(w http.ResponseWriter, data interface{}, params ...string) error { var message string if len(params) == 0 || params[0] == "" { message = "success" } else { message = params[0] } responseJson(w, 200, message, data) return nil } func responseJson(w http.ResponseWriter, code int, message string, data interface{}) error { w.Header().Add("Content-Type", "application/json") str, _ := json.Marshal(Response{ Code: code, Msg: message, Data: data, }) w.Write(str) return nil } <file_sep>package utils import "time" const ( FORMAT_DATETIME = "2006-01-02 15:04:05" FORMAT_DATE = "2006-01-02" ) func getFirstValue(defaultValue string, format ...string) string { if len(format) > 0 && format[0] != "" { defaultValue = format[0] } return defaultValue } // 获取当前日期时间 func GetCurrentDateTime(format ...string) string { return time.Now().Format(getFirstValue(FORMAT_DATETIME)) } // 获取当前日期 func GetCurrentDate(format ...string) string { return time.Now().Format(getFirstValue(FORMAT_DATE)) } <file_sep>package models import ( "app/config" "database/sql" "errors" ) type App struct { Id int64 `db:"app_id"` AppName string `db:"app_name"` AppKey string `db:"app_key"` Status int `db:"status"` CreatedAt string `db:"created_at"` UpdatedAt string `db:"updated_at"` } func FindAppByAppKey(appKey string) (App, error) { var ( app App err error ) // 查询数据 err = config.DB.QueryRow("SELECT * FROM `app` WHERE `app_key` = ? LIMIT 1", appKey).Scan( &app.Id, &app.AppName, &app.AppKey, &app.Status, &app.CreatedAt, &app.UpdatedAt, ) if err == sql.ErrNoRows { err = errors.New("没有对应的应用") } return app, err } <file_sep># short url 使用go编写的短网址项目 ## 接口列表 ### 1. 创建短网址 #### 1.1 请求地址 需要POST请求 ``` /create ``` #### 1.2 请求参数 |参数名称|类型|是否必填|说明| |:------|:--------|:---|:---| |app_key|string|Y|应用秘钥| |url|string|Y|需要生成的网址| #### 1.3 响应信息 |参数名称|类型|说明| |:------|:--------|:---| |code|int|响应状态**200为正常**| |msg|string|响应提示信息| |data|object|响应内容| | └ data.url|string|生成的网址| | └ data.short_url|string|短网址| | └ data.short_id|string|短网址ID| | └ data.created_at|string|创建时间| ### 2. 返回短网址<file_sep>package config import ( "database/sql" "fmt" _ "github.com/go-sql-driver/mysql" ) var DB *sql.DB func RegisterDB() { // 连接数据库 dsn := fmt.Sprintf( "%s:%s@tcp(%s:%s)/%s?charset=%s", Get("DB_USERNAME", "root"), Get("DB_PASSWORD"), Get("DB_HOST"), Get("DB_PORT"), Get("DB_NAME"), Get("DB_CHARSET"), ) var err error DB, err = sql.Open(Get("DB_DRIVER", "mysql"), dsn) if err != nil { panic(err) } } <file_sep>package main import ( "app/config" "app/handle" "fmt" "net/http" ) func main() { // 读取配置文件,并且配置DB config.Read("./.env") config.RegisterDB() // 配置路由 http.HandleFunc("/", handle.Handle(handle.Home)) http.HandleFunc("/create", handle.Handle(handle.Create)) // 开启Http服务 fmt.Println("Listen Port:", config.Get("APP_PORT")) http.ListenAndServe(config.Get("APP_PORT", ":80"), nil) }
8b664c6d634bf190d097e7e8ea2aa374e506ccd3
[ "Markdown", "SQL", "Go", "Shell" ]
17
Go
myloveGy/short-url
bd229dceb96eded17cbc68053bddc93167a52fea
cd7c245e4a8711f56654221612764e2411e854f5
refs/heads/master
<file_sep><?php require("validation.php"); ?> <!DOCTYPE HTML> <html> <head> <title>Harjutus</title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <link rel="stylesheet" type"text/css" href="style.css"> <style type="text/css"> .form-error{color: red;} .form-notice{color: green;} </style> </head> <body> <pre><?php print_r($_POST); ?></pre> <form action="index.php" method="post"> <div class="form-field"> <?php if ($isSubmitted) {echo $usernameMessage;} ?> <label for="username">Kasutajanimi: </label> <input id="username" type="text" name="username"> </div> <div class="form-field"> <?php if ($isSubmitted) {echo $ageMessage;} ?> <label for="age">Vanus: </label> <input id="age" type="text" name="age"> </div> <div class="form-field"> <?php if ($isSubmitted) {echo $groupMessage;} ?> <label for="group">Nimi ryhmast: </label> <input id="group" type="text" name="group"> </div> <div class="form-field"> <input type="submit" name="submit" value="saada"> </div> </form> </body> </html><file_sep><?php $isSubmitted = isset($_POST["submit"]); if ($isSubmitted) { $username = $_POST["username"]; (int)$age = $_POST["age"]; $group = strtolower($_POST["group"]); } $min = 5; $max = 20; // Olemasolu ja miinimum ning maksimimv22rtuste korntoll if (!isset($username) || $username == "") { $usernameMessage = '<div class="form-message form-error">Kasutajanimi ei tohi olla tyhi</div>'; } elseif (strlen($username) < $min) { $usernameMessage = '<div class="form-message form-error">Kasutajanimi peab olema v2hemalt '.$min." t2hem2rki</div>"; } elseif (strlen($username) > $max) { $usernameMessage = '<div class="form-message form-error">Kasutajanimi ei tohi olla rohkem kui '.$max." t2hem2rki</div>"; } else { $usernameMessage = '<div class="form-message form-notice">Kasutajanimi sobis</div>'; } // Vanuse andmetyybi kontroll if (isset($age) and !is_numeric($age)) { $ageMessage = '<div class="form-message form-error">Vanuse peab olema numbriline v22rtus</div>'; } else { $ageMessage = '<div class="form-message form-notice">Vanus sobis</div>'; } // Ryhma kuuluvuse kontroll $names = array("kaspar", "ants", "kaido"); if (isset($group) and in_array($group, $names)) { $groupMessage = '<div class="form-message form-notice">Kasutaja kuulub ryhma</div>'; } else { $groupMessage = '<div class="form-message form-notice">Kasutaja ei kuulu ryhma</div>'; } ?>
c85bf8bd225f2ff8e0dd430c77d6f382f79b5ccc
[ "PHP" ]
2
PHP
Anneliloo/2periood6praktikum
9d85dddeadebf210fa732469a1d432e43ff38db6
ab2c0f156be0cb59108161a231896057a292f9a0
refs/heads/master
<repo_name>vinodivy/MyGCD<file_sep>/commons/src/main/java/com/gcd/common/bean/GCD.java package com.gcd.common.bean; import java.io.Serializable; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; import javax.validation.constraints.Digits; import javax.validation.constraints.NotNull; import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import com.fasterxml.jackson.annotation.JsonProperty; /** * Model for the GCD table. * @author Vinod * */ @Entity @JsonIgnoreProperties(ignoreUnknown = true) public class GCD implements Serializable { private static final long serialVersionUID = 1L; @Id @GeneratedValue(strategy = GenerationType.IDENTITY) private Long id; @Column(name="userkey") private String userkey; @NotNull @Digits(fraction = 0, integer = 12) @Column(name = "gcd") private int gcd; @JsonCreator public GCD(@JsonProperty("id") Long id, @JsonProperty("gcd") int gcd) { this.id = id; this.gcd = gcd; } public GCD(){} public Long getId() { return id; } public void setId(Long id) { this.id = id; } public int getGcd() { return gcd; } public void setGcd(int gcd) { this.gcd = gcd; } public String getUserKey() { return userkey; } public void setKey(String userkey) { this.userkey = userkey; } @Override public String toString() { StringBuilder str = new StringBuilder(); str.append(" ID " + getId()); str.append(" GCD " + getGcd()); str.append(" userkey " + getUserKey()); return str.toString(); } } <file_sep>/gcdsoap/src/main/java/com/gcd/soap/dao/GCDDao.java package com.gcd.soap.dao; import java.util.List; import javax.persistence.EntityManager; import javax.persistence.PersistenceContext; import org.springframework.stereotype.Component; import org.springframework.transaction.annotation.Transactional; import com.gcd.common.bean.GCD; @Component public class GCDDao { @PersistenceContext private EntityManager em; @Transactional public void insertGCD(GCD gcd) { em.persist(gcd); } @Transactional public List<Integer> gcdList() { List<Integer> gcdList = em.createQuery("SELECT gcd from GCD").getResultList(); if (gcdList.isEmpty()) { gcdList.add(0); } return gcdList; } } <file_sep>/commons/src/main/java/com/gcd/common/messaging/MessageSender.java package com.gcd.common.messaging; import javax.jms.JMSException; import javax.jms.Message; import javax.jms.Session; import org.apache.log4j.Logger; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.jms.core.JmsTemplate; import org.springframework.jms.core.MessageCreator; import org.springframework.stereotype.Component; import com.gcd.common.bean.InputNumber; @Component("producer") public class MessageSender { @Autowired JmsTemplate jmsTemplate; private static final Logger logger = Logger.getLogger(MessageSender.class); public void send(final InputNumber number, String queueName) { logger.debug("Sending the message from producer class.."); jmsTemplate.send(queueName,new MessageCreator() { public Message createMessage(Session session) throws JMSException { return session.createObjectMessage(number); } }); } }<file_sep>/README.md # MyGCD # Deployment methods: Download the zip package from git and unzip. After unzipping, you should be able to view four projects • commons • gcdrest • gcdsoap • gcdear ## Database setup Download MySQL 5.x and log in as a root user. Modify the database schema/username/password in the commons project -> src/resource/jdbc.properties Create the following tables using the DDL commands. CREATE TABLE `gcd`.`gcd` ( `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT, `userkey` varchar(52) DEFAULT NULL, `gcd` int(12) DEFAULT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB AUTO_INCREMENT=39 DEFAULT CHARSET=utf8; CREATE TABLE `gcd`.`inputnumber` ( `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT, `userkey` varchar(52) DEFAULT NULL, `number1` int(11) DEFAULT NULL, `number2` int(11) DEFAULT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB AUTO_INCREMENT=191 DEFAULT CHARSET=utf8; The userkey column in each database will hold the user's generated session key. This key will be used in the application's session to check the number of concurrent users in the system. ## jUnit - Junit is written in common project to prove the 20 concurrent users. The test will create 30 users, but will only grant sessions to first 20 users. After remaining inactive for a minute, other users will be granted sessions. ## ActiveMQ setup Download ActiveMQ from http://activemq.apache.org/activemq-5152-release.html Extract the folder and goto bin folder type "activemq start" The project code will create a queue called "GCDQueue" for storing and retrieving data. ## Install JBOSS AS 7, MySQL 5.x, ActiveMQ 5.15.2 1) Goto MyGCD-master folder and run from cmd prompt "mvn clean install -DskipTests=true". 2) .ear file will be generated in gcdear project's target folder. 3) Install JBOSS AS 7 into any folder of your machine. Let that folder be your jboss_home folder. 4) Place the .ear file in jboss_server_home/standalone/deployments folder. 5) Start the server by going to jboss_home/bin and type standalone.bat ## Services The project exposes two APIS - one is a restful webservice and the other is SOAP webservice. Restful webservice exposes two apis - • push- which returns the status of the request to the caller as a String. The two parameters will be added to a JMS queue. • list- which returns a list of all the elements ever added to the queue from a database in the order added as a JSON structure. SOAP webservice exposes three apis • gcd- which returns the greatest common divisor* of the two integers at the head of the queue. These two elements will subsequently be discarded from the queue and the head replaced by the next two in line. • gcdList- which returns a list of all the computed greatest common divisors from a database. • gcdSum- which returns the sum of all computed greatest common divisors from a database. and type the following URL For local deployment: ### Rest services http://localhost:8080/gcdrest/rest//list http://localhost:8080/gcdrest/rest/push (POST request with "key:"anystring" passed as a header. This is unique for each user) (Example: http://localhost:8080/gcdrest/rest/push?i1=20&i2=16 (request header key:abcdefg. This is optional, in which case each POST will be considered as a new user request) ### Soap Services http://localhost:8080/gcdsoap/webservices/gcdService.wsdl The GCD soapservice returns a zero when there are no more elements in queue to be consumed. <file_sep>/pom.xml <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>com.gcd</groupId> <artifactId>parent</artifactId> <version>1.0</version> <packaging>pom</packaging> <modules> <module>gcdrest</module> <module>gcdsoap</module> <module>gcdear</module> <module>commons</module> </modules> <dependencies> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-core</artifactId> <version>${spring.version}</version> </dependency> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-web</artifactId> <version>${spring.version}</version> </dependency> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-webmvc</artifactId> <version>${spring.version}</version> </dependency> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-context</artifactId> <version>${spring.version}</version> </dependency> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-orm</artifactId> <version>${spring.version}</version> </dependency> <dependency> <groupId>org.hibernate</groupId> <artifactId>hibernate-entitymanager</artifactId> <version>${hibernate.version}</version> </dependency> <dependency> <groupId>com.fasterxml.jackson.core</groupId> <artifactId>jackson-databind</artifactId> <version>2.4.1</version> </dependency> <dependency> <groupId>mysql</groupId> <artifactId>mysql-connector-java</artifactId> <version>5.1.9</version> </dependency> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-jdbc</artifactId> <version>${spring.version}</version> </dependency> <dependency> <groupId>commons-dbcp</groupId> <artifactId>commons-dbcp</artifactId> <version>1.2.2</version> </dependency> <!-- https://mvnrepository.com/artifact/javax.persistence/persistence-api --> <dependency> <groupId>javax.persistence</groupId> <artifactId>persistence-api</artifactId> <version>1.0.2</version> </dependency> <dependency> <groupId>javax.validation</groupId> <artifactId>validation-api</artifactId> <version>1.1.0.Final</version> </dependency> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-jms</artifactId> <version>${spring.version}</version> </dependency> <dependency> <groupId>org.apache.activemq</groupId> <artifactId>activemq-spring</artifactId> <version>5.15.2</version> </dependency> <dependency> <groupId>log4j</groupId> <artifactId>log4j</artifactId> <version>1.2.17</version> </dependency> <dependency> <groupId>wsdl4j</groupId> <artifactId>wsdl4j</artifactId> <version>1.6.1</version> </dependency> <dependency> <groupId>javax.xml.bind</groupId> <artifactId>jaxb-api</artifactId> <version>2.2.12</version> </dependency> <!-- https://mvnrepository.com/artifact/org.springframework.ws/spring-ws-core --> <dependency> <groupId>org.springframework.ws</groupId> <artifactId>spring-ws-core</artifactId> <version>2.0.0.RELEASE</version> </dependency> <!-- https://mvnrepository.com/artifact/javax.servlet/javax.servlet-api --> <dependency> <groupId>javax.servlet</groupId> <artifactId>javax.servlet-api</artifactId> <version>3.1.0</version> <scope>provided</scope> </dependency> <dependency> <groupId>org.apache.ws.commons.schema</groupId> <artifactId>XmlSchema</artifactId> <version>1.4.3</version> </dependency> <dependency> <groupId>commons-collections</groupId> <artifactId>commons-collections</artifactId> <version>3.2</version> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-ws</artifactId> <version>1.2.0.RELEASE</version> </dependency> <dependency> <groupId>org.apache.tomcat.embed</groupId> <artifactId>tomcat-embed-websocket</artifactId> <version>9.0.2</version> <scope>provided</scope> </dependency> </dependencies> <properties> <spring.version>4.1.4.RELEASE</spring.version> <hibernate.version>4.1.9.Final</hibernate.version> </properties> </project><file_sep>/commons/src/main/java/com/gcd/common/util/SessionController.java package com.gcd.common.util; import java.util.HashMap; import java.util.Iterator; import java.util.Map; import java.util.Map.Entry; import java.util.Timer; import java.util.TimerTask; import java.util.concurrent.Semaphore; import java.util.concurrent.TimeUnit; import org.apache.log4j.Logger; import org.springframework.context.annotation.Scope; import org.springframework.stereotype.Component; @Component @Scope("singleton") public class SessionController { private static final long DURATION = TimeUnit.MINUTES.toMillis(1); private static final Semaphore semaphore = new Semaphore(20); private static Map<String, Long> userSession = new HashMap<String, Long>(); private static final Logger log = Logger.getLogger(SessionController.class); /* * Stores user key and the current time in usersession map. A timer runs in the background, * which will release a user session if its inactive after 3 mins. * * Every user is identified with a key. * */ public void watchUserSession(String key) { log.debug("key is "+key); synchronized (userSession) { for (Iterator<Map.Entry<String, Long>> it = userSession.entrySet().iterator(); it.hasNext();) { Entry<String, Long> entry = it.next(); if (entry.getKey().equals(key)) { userSession.put(key, System.currentTimeMillis()); return; } } } // hold on until you get the lock try { log.debug("Fetching lock..."); semaphore.acquire(); log.debug("Lock acquired..."); } catch (InterruptedException e) { log.error("No of concurrent users has exceeded 20.."); } synchronized (userSession) { userSession.put(key, System.currentTimeMillis()); } Timer time = new Timer(); ReleaseLockTask st = new ReleaseLockTask(); time.schedule(st, 0, 5000); } static class ReleaseLockTask extends TimerTask { public void run() { synchronized (userSession) { for (Iterator<Map.Entry<String, Long>> it = userSession.entrySet().iterator(); it.hasNext();) { Entry<String, Long> entry = it.next(); if ((System.currentTimeMillis() - entry.getValue()) > DURATION) { it.remove(); semaphore.release(); } } } } } } <file_sep>/gcdrest/src/main/java/com/gcd/controller/NumberController.java package com.gcd.controller; import java.util.List; import org.apache.log4j.Logger; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.HttpHeaders; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.RequestHeader; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RestController; import com.gcd.common.bean.InputNumber; import com.gcd.service.NumberService; @RestController public class NumberController { @Autowired private NumberService numberService; private static final Logger log = Logger.getLogger(NumberController.class); @RequestMapping(value = "/list", method = RequestMethod.GET, headers = "Accept=application/json") public ResponseEntity<List<InputNumber>> list(@RequestHeader(value="key" , required=false) String key) { log.debug("Invoking rest method push.."); HttpHeaders headers = new HttpHeaders(); List<InputNumber> numberList = numberService.list(key); if (numberList == null) { log.debug("There were no numbers found in the database.."); return new ResponseEntity<List<InputNumber>>(HttpStatus.NOT_FOUND); } headers.add("Number Of Records Found", String.valueOf(numberList.size())); return new ResponseEntity<List<InputNumber>>(numberList, headers, HttpStatus.OK); } @RequestMapping(value = "/push", method = RequestMethod.POST, headers = "Accept=application/json") public ResponseEntity<String> push(@RequestParam Integer i1, @RequestParam Integer i2, @RequestHeader(value="key" , required=false) String key) { log.debug("Invoking the push method..."); HttpHeaders headers = new HttpHeaders(); if (i1==0||i2==0) { log.debug("Numbers cannot be zero.."); return new ResponseEntity<String>(HttpStatus.BAD_REQUEST); } numberService.push(i1, i2, key); return new ResponseEntity<String>("Success", headers, HttpStatus.CREATED); } }<file_sep>/gcdear/pom.xml <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <parent> <groupId>com.gcd</groupId> <artifactId>parent</artifactId> <version>1.0</version> </parent> <artifactId>gcdear</artifactId> <packaging>ear</packaging> <name>GCD EAR Packaging Module</name> <dependencies> <dependency> <groupId>com.gcd</groupId> <artifactId>gcdrest</artifactId> <version>1.0</version> <type>war</type> </dependency> <dependency> <groupId>com.gcd</groupId> <artifactId>gcdsoap</artifactId> <version>1.0</version> <type>war</type> </dependency> <dependency> <groupId>com.gcd</groupId> <artifactId>commons</artifactId> <version>1.0</version> </dependency> </dependencies> </project><file_sep>/commons/src/test/java/com/gcd/common/ConcurrencyTest.java package com.gcd.common; import org.apache.log4j.Logger; import org.junit.Test; import com.gcd.common.util.SessionController; public class ConcurrencyTest { private static Logger logger = Logger.getLogger(SessionController.class); @Test public void testTwentyConcurrentUsers() { SessionController sessionController = new SessionController(); for (int i = 1; i < 30; i++) { sessionController.watchUserSession("User " + i); logger.info("User " + i); } } }
c8a60e9642d7b1f4e5ecaeb5551023eb4acdbf31
[ "Markdown", "Java", "Maven POM" ]
9
Java
vinodivy/MyGCD
0c5c5a261e9c9c51cde770a87394cf97d63d0619
657f8a32eb6a9f905e24a8acef350d860c9d978d
refs/heads/master
<file_sep>$(document).ready(function() { var navbar = $(".navbar") var navbarOffset = navbar.offset() var noActivity; function setActivity() { noActivity = setTimeout(function() { alert("Kamu sudah tidak aktif selama 30 detik!"); }, 30 * 1000) } function resetActivity() { clearTimeout(noActivity); setActivity(); } $(document).mouseover(resetActivity) $(window).scroll(function() { if (window.pageYOffset >= navbarOffset.top) { navbar.addClass("sticky") } else { navbar.removeClass("sticky") } if ($(this).scrollTop() >= 50) { $('#return-to-top').fadeIn(200) } else { $('#return-to-top').fadeOut(200) } }) $("#return-to-top").on({ click: function() { $("body,html").animate({ scrollTop: 0 }, 500); } }) // Dropdown $(".navbar > li > .dropdown").hover(() => { $(".navbar > li > .dropdown .dropdown-content").css("display", "block"); }, () => { $(".navbar > li > .dropdown .dropdown-content").css("display", "none"); }); $("#new-comment").click(function(e) { e.preventDefault() $(this).hide(function() { $(".new-comment-block").slideDown("slow"); }) }) $("#form-komentar").submit(function(e) { e.preventDefault(); let name = $("#name").val(); let email = $("#email").val(); var komentar = $("#komentar")[0].value; var passed = true; if (passed === true && name.length < 5) passed = 'Masukkan nama minimal 5 karakter!'; if (passed === true && komentar.length < 20) passed = 'Masukkan minimal 20 karakter untuk komentar!'; if (passed === true && /^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(email) == false) passed = 'Masukkan email yang valid!'; if (passed === true) { var d = new Date(); var o = {year:'numeric', month:'2-digit', day:'2-digit', hour:'2-digit', minute:'2-digit', second:'2-digit'}; var e = d.toLocaleDateString('en-US', o); $(".comment-list").append('<div class="comment-item"><div class="comment-box"><div class="comment-content"><div class="comment-author"><span style="font-weight: bold;">'+name+'</span><div class="time"><span class="help-text">'+email+' - '+e+'</span></div></div><div class="comment-body"><p>'+komentar+'</p><a href="#" class="button right"><i class="fas fa-reply"></i> Balas</a></div></div></div></div>'); $("#name").val(''); $("#email").val('') $("#komentar").val(''); } else { alert(passed); return false; } }) })<file_sep>### Pemrograman Web Merupakan sebuah repository yang saya gunakan untuk menyimpan semua tugas dan latihan dari Mata Kuliah Pemrograman Web UNS th. 2019. #### Clone This Repository `$ git clone https://github.com/kom3/Pemrograman-Web.git` Anda tidak diberikan akses untuk mengubah sesuatu disini! >**<NAME>** - M0517018
84c272bd71157b3d2fea0f37f3662c1d0cffdeba
[ "JavaScript", "Markdown" ]
2
JavaScript
wildanazmi/Pemrograman-Web
a8427dcfe513e9d310d6f54bab2abbc92b6f121f
14d3a88a4dd017fd3df7ed42e72c6615c857858e
refs/heads/master
<repo_name>irfansha/knights_tour<file_sep>/unsat_finding/islands_operations.py def reset(islands): temp = sorted(islands) for i in range(len(temp)): if temp[i] != -1 : new_i = islands.index(temp[i]) islands[new_i] = i def island_add(temp_islands,cur_move): for nr in k_li[cur_move]: temp = n_check(nr) min_temp = max(temp_islands) if temp == [] : temp_islands[nr] = max(temp_islands) + 1 else: for i in temp: if islands[i] < min_temp : min_temp = temp_islands[i] for i in temp: temp_islands[i] = min_temp def island_del(temp_islands,cur_move): temp_islands[cur_move] = -1 <file_sep>/backtracking/knights_tour.cpp //this is a simple backtraking algorithm to find number of knight's open tour. //can be improved by giving the moves in early. improved tp knights_tour_sep_rec.cpp which is faster. #include <iostream> #include <vector> #include <bitset> std::vector<bool> knight; int count = 0, N; int depth; # define M_moves 8 //the knight that can go. int moves[M_moves][2] = {{1, 2}, {1, -2}, {-1, 2}, {-1, -2}, {2, 1}, {2, -1}, {-2, 1}, {-2, -1}}; void knight_backtracking(int x, int y, int size) { //std::cout << int (bitset_vect[(x-1) * N + y]) << "\n"; if (size == depth) ++count; else if (size < depth){ int n_x , n_y; for (int i = 0 ; i < M_moves ; ++i) { n_x = x + moves[i][0]; n_y = y + moves[i][1]; if (n_x > 0 and n_y > 0 and n_x <= N and n_y <= N and knight[(n_x-1) * N + n_y] == 0) { knight[(x-1) * N + y] = 1; knight_backtracking(n_x,n_y,size+1); knight[(x-1) * N + y] = 0; } } } } int main(const int argc, const char* const argv[]) { if (argc != 2) { std::cout << "Usage[qcount]: N\n"; return 0; } const unsigned long arg1 = std::stoul(argv[1]); N = arg1; depth = N*N; knight.resize(N*N+1); for (int i = 1 ; i <= N ; ++i) for (int j = 1 ; j <= N ; ++j) { count = 0; std::cout << i << " " << j << "\n" ; knight[(i-1) * N + j] = 1; knight_backtracking(i,j,1); knight[(i-1) * N + j] = 0; std::cout << count << "\n"; } } <file_sep>/disjoint_hamiltonian_path/knight's_tour.cpp //this is for taking advantage of disjointness of knights path. #include <iostream> #include <vector> #include <bitset> std::vector<bool> knight; int count = 0, N; int depth; typedef std::uint_fast64_t knight_t; //for knight problem N <= 8. change it for bigger problems # define M_moves 8 std::vector<knight_t> bitset_vect; //the knight that can go. int moves[M_moves][2] = {{1, 2}, {1, -2}, {-1, 2}, {-1, -2}, {2, 1}, {2, -1}, {-2, 1}, {-2, -1}}; void bitset_init() { knight_t val = knight_t(1); for ( int i = 1 ; i <= N*N ; ++i ) { bitset_vect.push_back(val); val <<= 1; } } void zero() { std::fill(knight.begin(), knight.end(), 0); } void knight_backtracking(int x, int y, int size, knight_t path) { path |= bitset_vect[(x-1) * N + y]; //std::cout << int (bitset_vect[(x-1) * N + y]) << "\n"; if (size == depth) ++count; else if (size < depth){ int n_x , n_y; for (int i = 0 ; i < M_moves ; ++i) { n_x = x + moves[i][0]; n_y = y + moves[i][1]; if (n_x > 0 and n_y > 0 and n_x <= N and n_y <= N and knight[(n_x-1) * N + n_y] == 0) { knight[(x-1) * N + y] = 1; knight_backtracking(n_x,n_y,size+1,path); knight[(x-1) * N + y] = 0; } } } } int main(const int argc, const char* const argv[]) { if (argc != 2) { std::cout << "Usage[qcount]: N\n"; return 0; } const unsigned long arg1 = std::stoul(argv[1]); N = arg1; depth = N; knight_t path = 0; knight.resize(N*N+1); bitset_init(); for (int i = 1 ; i <= N ; ++i) for (int j = 1 ; j <= N ; ++j) { //zero(); std::cout << i << " " << j << "\n" ; knight_backtracking(i,j,1,path);} std::cout << count << "\n"; //for (auto i : bitset_vect) std::cout << std::bitset<25> {i} << "\n"; } <file_sep>/graph_network/knight_moves.py #append the value in the desired list or creates new one in the dictonary #Generates a list of legal moves for the knight knight_moves = [[]] def generate_legal_moves(x,y,N): possible_pos = [] move_offsets = [(1, 2), (1, -2), (-1, 2), (-1, -2), (2, 1), (2, -1), (-2, 1), (-2, -1)] for move in move_offsets: new_x = x + move[0] new_y = y + move[1] if (new_x >= N): continue elif (new_x < 0): continue elif (new_y >= N): continue elif (new_y < 0): continue else: possible_pos.append(N*new_x + new_y+1) possible_pos.sort() return possible_pos def gen_knight_moves(N): for i in range(N): for j in range(N): knight_moves.append(generate_legal_moves(i,j,N)) return knight_moves <file_sep>/unsat_finding/unsat_disjoint_knights.py # Step 1 : Check if dictionary/lists are good for these operations. # Step 2 : Print all the unvisited but neighbour vertices. # Step 3 : Next connect them if they are neighbour vertices. # Step 4 : Check the unsatisfiabity i.e. if they are disjoint from the graph. # Step 5 : After getting this work, now add merging of different parts. # Step 6 : Now check the correctness of the approach # Step 7 : If everything works out find now check if there is any speed up, this should be the last one. import sys import knight_moves N = int(sys.argv[1]) visited = [0]*(N*N+1) # maintains if the vertex is visited islands = [-1]*(N*N+1) move_count = 0 # keeps track of number of moves made total_moves = N*N k_li = knight_moves.gen_knight_moves(N) def place(visited,cur_move): visited[cur_move] = 1 def remove(visited,cur_move): visited[cur_move] = 0 def recur(cur_move,move_count,tour_count): if tour_count < 1000: place(visited,cur_move) if move_count < total_moves: for move in k_li[cur_move]: if visited[move] == 0: tour_count = recur(move,move_count+1,tour_count) elif move_count == total_moves: tour_count = tour_count + 1 print (tour_count) remove(visited,cur_move) return tour_count for i in range(1,2): tour_count = recur(i,1,0) print (tour_count) <file_sep>/graph_network/knights_graph.py import knight_moves import sys import pylab as p import networkx as nx N = int(sys.argv[1]) k_moves = knight_moves.gen_knight_moves(N) visited = [0]*(N*N+1) # maintains if the vertex is visited move_count = 0 # keeps track of number of moves made total_moves = N*N #print (k_moves) G = nx.Graph() for i in range(1,len(k_moves)): for nr in k_moves[i]: G.add_edge(i,nr) cur_G = G.copy() def place(visited,cur_move): visited[cur_move] = 1 def remove(visited,cur_move): visited[cur_move] = 0 def edge_remove(cur_G,cur_move,temp): for nr in temp: if (cur_G.has_edge(cur_move,nr) and visited[nr] != 1): cur_G.remove_edge(cur_move,nr) def edge_add(cur_G,cur_move,temp): for nr in temp: cur_G.add_edge(cur_move,nr) def recur(cur_G,cur_move,move_count,tour_count): #check if the graph is disconnected if (tour_count < 1000): place(visited,cur_move) if move_count < total_moves: for move in G[cur_move]: if visited[move] == 0: if(move_count < 1): temp = G.neighbors(cur_move) temp.remove(move) #print (cur_G.edges()) edge_remove(cur_G,cur_move,temp) #print (cur_G.edges(),cur_move,temp) #print ("\n") if (nx.algorithms.is_connected(cur_G)): tour_count = recur(cur_G,move,move_count+1,tour_count) edge_add(cur_G,cur_move,temp) else: tour_count = recur(cur_G,move,move_count+1,tour_count) elif move_count == total_moves: tour_count = tour_count + 1 print (tour_count) remove(visited,cur_move) return tour_count for i in range(1,2): tour_count = recur(cur_G,i,1,0) print (tour_count)
5f1a0064dd7614728a8c6bbff1d80d60db2d780e
[ "Python", "C++" ]
6
Python
irfansha/knights_tour
4fa09b37db3bab7eb671976e8e7609a99d10d181
db9b42a407fed2e381501ccfa9c33a370379b147
refs/heads/master
<file_sep>using System; using Microsoft.Extensions.Logging; namespace weather.core.Models { public class LogContext { public Guid UserId {get;private set;} public LogContext() { UserId = Guid.NewGuid(); } } }<file_sep>// Numbering scheme // 5 digits - ABCDE // // A == one of the following // 0 == Trace. Logs that contain the most detailed messages.These messages may contain sensitive application data.These messages are disabled by default and should never be enabled in a production environment. // 1 == Debug. Logs that are used for interactive investigation during development. These logs should primarily contain information useful for debugging and have no long-term value. // 2 == Information. Logs that track the general flow of the application.These logs should have long-term value. // 3 == Warning. Logs that highlight an abnormal or unexpected event in the application flow, but do not otherwise cause the application execution to stop. // 4 == Error. Logs that highlight when the current flow of execution is stopped due to a failure.These should indicate a failure in the current activity, not an application-wide failure. // 5 == Critical. Logs that describe an unrecoverable application or system crash, or a catastrophic failure that requires immediate attention. // // BC == Subsystem. // 00 == App level, mid tier, config etc // 01 == Weather // // DE are up to the discrtion of the subsystem, usually incrementing from 00. using Microsoft.Extensions.Logging; namespace weather2.core { public static class LogEventIds { // App public static EventId AppLoggerParsingError = new EventId(40000, "ERROR: Logging object parsing failed."); // Weather public static EventId WeatherForecast2ControllerGetEnterInformation = new EventId(20100, "INFORMATION: Logging WeatherForecastController GET enter."); public static EventId WeatherForecast2ControllerGetExitInformation = new EventId(20101, "INFORMATION: Logging WeatherForecastController GET exit."); } }<file_sep>using System; namespace weather2.core.Models { public class LogContext { public Guid UserId {get;private set;} public LogContext() { UserId = Guid.NewGuid(); } } }<file_sep>using Microsoft.Extensions.Logging; using Newtonsoft.Json; using Newtonsoft.Json.Linq; using System; using System.Collections.Generic; using System.Linq; using weather2.core.Interfaces; using weather2.core; namespace weather2.core.services { public class ObjectLogger<T> : IObjectLogger<T> { private readonly ILogger<T> _logger; public ObjectLogger(ILogger<T> log) { _logger = log; } public void LogInformation(EventId eventId, string message, params object[] args) { _logger.LogInformation(eventId, message, args); } public void LogInformation(EventId eventId, Exception ex, string message, params object[] args) { _logger.LogInformation(eventId, ex, message, args); } public void LogInformationObject(EventId eventId, Object o) { using (_logger.BeginScope(ConvertToDictionary(o))) { _logger.LogInformation(eventId, eventId.Name); } } public void LogInformationObject(EventId eventId, Exception ex, Object o) { using (_logger.BeginScope(ConvertToDictionary(o))) { _logger.LogInformation(eventId, ex, eventId.Name); } } public void LogWarning(EventId eventId, string message, params object[] args) { _logger.LogWarning(eventId, message, args); } public void LogWarning(EventId eventId, Exception ex, string message, params object[] args) { _logger.LogWarning(eventId, ex, message, args); } public void LogWarningObject(EventId eventId, Object o) { using (_logger.BeginScope(ConvertToDictionary(o))) { _logger.LogWarning(eventId, eventId.Name); } } public void LogWarningObject(EventId eventId, Exception ex, Object o) { using (_logger.BeginScope(ConvertToDictionary(o))) { _logger.LogWarning(eventId, ex, eventId.Name); } } public void LogError(EventId eventId, string message, params object[] args) { _logger.LogError(eventId, message, args); } public void LogError(EventId eventId, Exception ex, string message, params object[] args) { _logger.LogError(eventId, ex, message, args); } public void LogErrorObject(EventId eventId, Object o) { using (_logger.BeginScope(ConvertToDictionary(o))) { _logger.LogError(eventId, eventId.Name); } } public void LogErrorObject(EventId eventId, Exception ex, Object o) { using (_logger.BeginScope(ConvertToDictionary(o))) { _logger.LogError(eventId, ex, eventId.Name); } } public void LogCritical(EventId eventId, string message, params object[] args) { _logger.LogCritical(eventId, message, args); } public void LogCritical(EventId eventId, Exception ex, string message, params object[] args) { _logger.LogCritical(eventId, ex, message, args); } public void LogCriticalObject(EventId eventId, Object o) { using (_logger.BeginScope(ConvertToDictionary(o))) { _logger.LogCritical(eventId, eventId.Name); } } public void LogCriticalObject(EventId eventId, Exception ex, Object o) { using (_logger.BeginScope(ConvertToDictionary(o))) { _logger.LogCritical(eventId, ex, eventId.Name); } } // This routine convert objects into dictionary of type Dictionary<string, object> // so that the log will put the key / value pairs into the log private Dictionary<string, object> ConvertToDictionary(object o) { try { JObject jsonObject; if (o is string) { return new Dictionary<string, object> { { "Message", o } }; } if (o.GetType().IsArray) { var Array = o; var no = new { Array }; jsonObject = JObject.FromObject(no); } else { jsonObject = JObject.FromObject(o); } IEnumerable<JToken> jTokens = jsonObject.Descendants().Where(p => p.Count() == 0); Dictionary<string, object> results = jTokens.Aggregate(new Dictionary<string, object>(), (properties, jToken) => { properties.Add(jToken.Path, jToken.ToString()); return properties; }); return results ?? new Dictionary<string, object> { { "Logger Error", "Null Object" } }; } catch (JsonReaderException hre) { _logger.LogCritical(LogEventIds.AppLoggerParsingError, $"JSonReaderException Error in logging parser: {hre.Message}"); return null; } catch (Exception e) { _logger.LogCritical(LogEventIds.AppLoggerParsingError, $"Unknown Error in logging parser: {e.Message}"); return null; } } } }<file_sep>using System; using Microsoft.Extensions.Logging; namespace weather2.core.Interfaces { /// <summary> /// All the methods here echo the functionality of the ILogger extension found here: /// https://docs.microsoft.com/en-us/dotnet/api/microsoft.extensions.logging.loggerextensions?view=aspnetcore-2.2 /// We force the use the EventIds here, so that all events have proper Ids going into application insights. /// The LogXYZObject methods provide a simplified wrapper to allow for easy logging of entire objects to /// Application Insights via the BeginScope method. /// </summary> /// <typeparam name="T"></typeparam> public interface IObjectLogger<T> { void LogInformation(EventId eventId, string message, params object[] args); void LogInformation(EventId eventId, Exception ex, string message, params object[] args); void LogInformationObject(EventId eventId, object o); void LogInformationObject(EventId eventId, Exception ex, object o); void LogWarning(EventId eventId, string message, params object[] args); void LogWarning(EventId eventId, Exception ex, string message, params object[] args); void LogWarningObject(EventId eventId, object o); void LogWarningObject(EventId eventId, Exception ex, object o); void LogError(EventId eventId, string message, params object[] args); void LogError(EventId eventId, Exception ex, string message, params object[] args); void LogErrorObject(EventId eventId, object o); void LogErrorObject(EventId eventId, Exception ex, object o); void LogCritical(EventId eventId, string message, params object[] args); void LogCritical(EventId eventId, Exception ex, string message, params object[] args); void LogCriticalObject(EventId eventId, object o); void LogCriticalObject(EventId eventId, Exception ex, object o); } }
8d8620a82743b2a5a349e3573edb92bbe4108d10
[ "C#" ]
5
C#
michaeldeongreen/weather
60e4b053d436d703cd32135d980a728753642aa1
a950e444a4f96ca8e07d2ce22d3b83ad72ff6a6b
refs/heads/master
<repo_name>danielleos/ST340-Assignment-1<file_sep>/README.md # ST340-Assignment-1 Rough Solutions for ST340 Assignment 1 (2016/17) <file_sep>/merge.py def merge(a1,a2): outArr = [] #initialise the output array outLen = len(a1) + len(a2) #set length of output array a1small = False #initialise a flag if (len(a1) <= len(a2)): #check which array has the fewest elements a1small = True #if a1 is the smallest array, set the flag to true for k in range(outLen): #start a loop that iterates a maximum of outLen times if (len(a1) != 0) & (len(a2) != 0): #check the lengths of the arrays are not 0 if (a1[0] <= a2[0]): #compare the first elements of each array outArr.append(a1[0]) #add element to output array a1.remove(a1[0]) #remove that element from its original array #print("Element from a1 added: " + str(outArr)) elif (a2[0] < a1[0]): outArr.append(a2[0]) a2.remove(a2[0]) #print("Element from a2 added: " + str(outArr)) else: #check if either of the arrays are of length 0 break #break out of loop if (a1small == True): #if a1 is the smallest array outArr.extend(a2) #add the rest of a2 to the output array #print("List a2 had elements leftover.") else: #otherwise if a2 is the smallest array outArr.extend(a1) #add the rest of a1 to the output array #print("List a1 had elements leftover.") return(outArr) #return complete array
94b5aa2c0c0b1b0cb54a00bcbda2c0894bad0d87
[ "Markdown", "Python" ]
2
Markdown
danielleos/ST340-Assignment-1
9f717e60d82ebd85e021d58303be0ab35f8b6f32
01cdbbd38d46f09eee3d9f1483a444256ff85827
refs/heads/master
<file_sep>package ActivosFijos; import org.apache.struts.action.ActionForm; import org.apache.struts.action.ActionErrors; import org.apache.struts.action.ActionError; import org.apache.struts.action.ActionMapping; import javax.servlet.http.HttpServletRequest; public class RubrosDetalleForm extends ActionForm { String codigo; String descripcion; int vidaut; double porcen; String codpar; String ctadep; String ctadac; String descripcion_codpar; /** * Reset all properties to their default values. * @param mapping The ActionMapping used to select this instance. * @param request The HTTP Request we are processing. */ public void reset(ActionMapping mapping, HttpServletRequest request) { super.reset(mapping, request); } /** * Validate all properties to their default values. * @param mapping The ActionMapping used to select this instance. * @param request The HTTP Request we are processing. * @return ActionErrors A list of all errors found. */ public ActionErrors validate(ActionMapping mapping, HttpServletRequest request) { return super.validate(mapping, request); } public String getCodigo() { return codigo; } public void setCodigo(String newCodigo) { codigo = newCodigo; } public String getDescripcion() { return descripcion; } public void setDescripcion(String newDescripcion) { descripcion = newDescripcion; } public int getVidaut() { return vidaut; } public void setVidaut(int newVidaut) { vidaut = newVidaut; } public double getPorcen() { return porcen; } public void setPorcen(double newPorcen) { porcen = newPorcen; } public String getCodpar() { return codpar; } public void setCodpar(String newCodpar) { codpar = newCodpar; } public String getCtadep() { return ctadep; } public void setCtadep(String newCtadep) { ctadep = newCtadep; } public String getCtadac() { return ctadac; } public void setCtadac(String newCtadac) { ctadac = newCtadac; } public String getDescripcion_codpar() { return descripcion_codpar; } public void setDescripcion_codpar(String newDescripcion_codpar) { descripcion_codpar = newDescripcion_codpar; } }<file_sep> /*@lineinfo:filename=/InsertarFinanciadores.jsp*/ /*@lineinfo:generated-code*/ import oracle.jsp.runtime.*; import javax.servlet.*; import javax.servlet.http.*; import javax.servlet.jsp.*; import java.util.Vector; import ActivosFijos.*; public class _InsertarFinanciadores extends oracle.jsp.runtime.HttpJsp { public final String _globalsClassName = null; // ** Begin Declarations // ** End Declarations public void _jspService(HttpServletRequest request, HttpServletResponse response) throws java.io.IOException, ServletException { response.setContentType( "text/html;charset=windows-1252"); /* set up the intrinsic variables using the pageContext goober: ** session = HttpSession ** application = ServletContext ** out = JspWriter ** page = this ** config = ServletConfig ** all session/app beans declared in globals.jsa */ PageContext pageContext = JspFactory.getDefaultFactory().getPageContext( this, request, response, null, true, JspWriter.DEFAULT_BUFFER, true); // Note: this is not emitted if the session directive == false HttpSession session = pageContext.getSession(); if (pageContext.getAttribute(OracleJspRuntime.JSP_REQUEST_REDIRECTED, PageContext.REQUEST_SCOPE) != null) { pageContext.setAttribute(OracleJspRuntime.JSP_PAGE_DONTNOTIFY, "true", PageContext.PAGE_SCOPE); JspFactory.getDefaultFactory().releasePageContext(pageContext); return; } int __jsp_tag_starteval; ServletContext application = pageContext.getServletContext(); JspWriter out = pageContext.getOut(); _InsertarFinanciadores page = this; ServletConfig config = pageContext.getServletConfig(); try { // global beans // end global beans out.write(__jsp_StaticText.text[0]); out.write(__jsp_StaticText.text[1]); out.write(__jsp_StaticText.text[2]); out.write(__jsp_StaticText.text[3]); out.write(__jsp_StaticText.text[4]); /*@lineinfo:translated-code*//*@lineinfo:15^1*/ { org.apache.struts.taglib.html.FormTag __jsp_taghandler_1=(org.apache.struts.taglib.html.FormTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.FormTag.class,"org.apache.struts.taglib.html.FormTag action onsubmit"); __jsp_taghandler_1.setParent(null); __jsp_taghandler_1.setAction("/financiadoresAction"); __jsp_taghandler_1.setOnsubmit("return validaform(this);"); __jsp_tag_starteval=__jsp_taghandler_1.doStartTag(); if (OracleJspRuntime.checkStartTagEval(__jsp_tag_starteval)) { do { /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[5]); /*@lineinfo:translated-code*//*@lineinfo:16^1*/ { org.apache.struts.taglib.html.HiddenTag __jsp_taghandler_2=(org.apache.struts.taglib.html.HiddenTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.HiddenTag.class,"org.apache.struts.taglib.html.HiddenTag property"); __jsp_taghandler_2.setParent(__jsp_taghandler_1); __jsp_taghandler_2.setProperty("estado"); __jsp_tag_starteval=__jsp_taghandler_2.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_2,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_2.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_2.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_2); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[6]); /*@lineinfo:translated-code*//*@lineinfo:17^1*/ { org.apache.struts.taglib.html.HiddenTag __jsp_taghandler_3=(org.apache.struts.taglib.html.HiddenTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.HiddenTag.class,"org.apache.struts.taglib.html.HiddenTag property"); __jsp_taghandler_3.setParent(__jsp_taghandler_1); __jsp_taghandler_3.setProperty("operacion"); __jsp_tag_starteval=__jsp_taghandler_3.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_3,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_3.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_3.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_3); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[7]); /*@lineinfo:translated-code*//*@lineinfo:21^34*/ { org.apache.struts.taglib.bean.MessageTag __jsp_taghandler_4=(org.apache.struts.taglib.bean.MessageTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.bean.MessageTag.class,"org.apache.struts.taglib.bean.MessageTag key"); __jsp_taghandler_4.setParent(__jsp_taghandler_1); __jsp_taghandler_4.setKey("financiadores.codigo"); __jsp_tag_starteval=__jsp_taghandler_4.doStartTag(); if (OracleJspRuntime.checkStartTagEval(__jsp_tag_starteval)) { do { } while (__jsp_taghandler_4.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); } if (__jsp_taghandler_4.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_4); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[8]); /*@lineinfo:translated-code*//*@lineinfo:22^21*/ { org.apache.struts.taglib.html.TextTag __jsp_taghandler_5=(org.apache.struts.taglib.html.TextTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.TextTag.class,"org.apache.struts.taglib.html.TextTag maxlength name property size"); __jsp_taghandler_5.setParent(__jsp_taghandler_1); __jsp_taghandler_5.setMaxlength("10"); __jsp_taghandler_5.setName("FinanciadoresForm"); __jsp_taghandler_5.setProperty("fin_codigo"); __jsp_taghandler_5.setSize("10"); __jsp_tag_starteval=__jsp_taghandler_5.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_5,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_5.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_5.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_5); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[9]); /*@lineinfo:translated-code*//*@lineinfo:25^34*/ { org.apache.struts.taglib.bean.MessageTag __jsp_taghandler_6=(org.apache.struts.taglib.bean.MessageTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.bean.MessageTag.class,"org.apache.struts.taglib.bean.MessageTag key"); __jsp_taghandler_6.setParent(__jsp_taghandler_1); __jsp_taghandler_6.setKey("financiadores.descripcion"); __jsp_tag_starteval=__jsp_taghandler_6.doStartTag(); if (OracleJspRuntime.checkStartTagEval(__jsp_tag_starteval)) { do { } while (__jsp_taghandler_6.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); } if (__jsp_taghandler_6.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_6); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[10]); /*@lineinfo:translated-code*//*@lineinfo:26^21*/ { org.apache.struts.taglib.html.TextTag __jsp_taghandler_7=(org.apache.struts.taglib.html.TextTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.TextTag.class,"org.apache.struts.taglib.html.TextTag maxlength name property size"); __jsp_taghandler_7.setParent(__jsp_taghandler_1); __jsp_taghandler_7.setMaxlength("50"); __jsp_taghandler_7.setName("FinanciadoresForm"); __jsp_taghandler_7.setProperty("fin_descripcion"); __jsp_taghandler_7.setSize("50"); __jsp_tag_starteval=__jsp_taghandler_7.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_7,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_7.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_7.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_7); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[11]); /*@lineinfo:translated-code*//*@lineinfo:30^34*/ { org.apache.struts.taglib.html.SubmitTag __jsp_taghandler_8=(org.apache.struts.taglib.html.SubmitTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.SubmitTag.class,"org.apache.struts.taglib.html.SubmitTag property styleClass value"); __jsp_taghandler_8.setParent(__jsp_taghandler_1); __jsp_taghandler_8.setProperty("boton"); __jsp_taghandler_8.setStyleClass("boton1"); __jsp_taghandler_8.setValue("Grabar"); __jsp_tag_starteval=__jsp_taghandler_8.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_8,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_8.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_8.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_8); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[12]); /*@lineinfo:translated-code*//*@lineinfo:38^1*/ { org.apache.struts.taglib.logic.IterateTag __jsp_taghandler_9=(org.apache.struts.taglib.logic.IterateTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.logic.IterateTag.class,"org.apache.struts.taglib.logic.IterateTag id name"); __jsp_taghandler_9.setParent(__jsp_taghandler_1); __jsp_taghandler_9.setId("lista"); __jsp_taghandler_9.setName("FinanciadoresLista"); java.lang.Object lista = null; __jsp_tag_starteval=__jsp_taghandler_9.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_9,__jsp_tag_starteval,out); do { lista = (java.lang.Object) pageContext.findAttribute("lista"); /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[13]); /*@lineinfo:translated-code*//*@lineinfo:40^10*/ { org.apache.struts.taglib.bean.WriteTag __jsp_taghandler_10=(org.apache.struts.taglib.bean.WriteTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.bean.WriteTag.class,"org.apache.struts.taglib.bean.WriteTag name property"); __jsp_taghandler_10.setParent(__jsp_taghandler_9); __jsp_taghandler_10.setName("lista"); __jsp_taghandler_10.setProperty("codigo"); __jsp_tag_starteval=__jsp_taghandler_10.doStartTag(); if (OracleJspRuntime.checkStartTagEval(__jsp_tag_starteval)) { do { } while (__jsp_taghandler_10.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); } if (__jsp_taghandler_10.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_10); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[14]); /*@lineinfo:translated-code*//*@lineinfo:41^10*/ { org.apache.struts.taglib.bean.WriteTag __jsp_taghandler_11=(org.apache.struts.taglib.bean.WriteTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.bean.WriteTag.class,"org.apache.struts.taglib.bean.WriteTag name property"); __jsp_taghandler_11.setParent(__jsp_taghandler_9); __jsp_taghandler_11.setName("lista"); __jsp_taghandler_11.setProperty("descripcion"); __jsp_tag_starteval=__jsp_taghandler_11.doStartTag(); if (OracleJspRuntime.checkStartTagEval(__jsp_tag_starteval)) { do { } while (__jsp_taghandler_11.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); } if (__jsp_taghandler_11.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_11); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[15]); /*@lineinfo:translated-code*//*@lineinfo:42^10*/ { org.apache.struts.taglib.html.SubmitTag __jsp_taghandler_12=(org.apache.struts.taglib.html.SubmitTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.SubmitTag.class,"org.apache.struts.taglib.html.SubmitTag indexed property styleClass value"); __jsp_taghandler_12.setParent(__jsp_taghandler_9); __jsp_taghandler_12.setIndexed(true); __jsp_taghandler_12.setProperty("boton"); __jsp_taghandler_12.setStyleClass("boton1"); __jsp_taghandler_12.setValue("Borrar"); __jsp_tag_starteval=__jsp_taghandler_12.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_12,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_12.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_12.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_12); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[16]); /*@lineinfo:translated-code*//*@lineinfo:43^6*/ { org.apache.struts.taglib.html.SubmitTag __jsp_taghandler_13=(org.apache.struts.taglib.html.SubmitTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.SubmitTag.class,"org.apache.struts.taglib.html.SubmitTag indexed property styleClass value"); __jsp_taghandler_13.setParent(__jsp_taghandler_9); __jsp_taghandler_13.setIndexed(true); __jsp_taghandler_13.setProperty("boton"); __jsp_taghandler_13.setStyleClass("boton1"); __jsp_taghandler_13.setValue("Modificar"); __jsp_tag_starteval=__jsp_taghandler_13.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_13,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_13.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_13.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_13); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[17]); /*@lineinfo:translated-code*//*@lineinfo:43^91*/ } while (__jsp_taghandler_9.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_9.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_9); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[18]); /*@lineinfo:translated-code*//*@lineinfo:45^17*/ } while (__jsp_taghandler_1.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); } if (__jsp_taghandler_1.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_1); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[19]); } catch( Throwable e) { try { if (out != null) out.clear(); } catch( Exception clearException) { } pageContext.handlePageException( e); } finally { OracleJspRuntime.extraHandlePCFinally(pageContext,true); JspFactory.getDefaultFactory().releasePageContext(pageContext); } } private static class __jsp_StaticText { private static final char text[][]=new char[20][]; static { try { text[0] = "\n".toCharArray(); text[1] = "\n".toCharArray(); text[2] = "\n".toCharArray(); text[3] = "\n".toCharArray(); text[4] = "\n<html>\n<head>\n <meta http-equiv=\"Content-Type\" content=\"text/html; charset=windows-1252\">\n <meta http-equiv=\"Expires\" content=\"-1\">\n <link href=\"Estilos.css\" rel=\"stylesheet\" type=\"text/css\">\n</head>\n<script language=\"JavaScript\" type=\"text/JavaScript\" src=\"Validaciones.js\"></script>\n\n<body>\n".toCharArray(); text[5] = "\n".toCharArray(); text[6] = "\n".toCharArray(); text[7] = "\n<table width=\"100%\" border=\"0\" class=\"soloborde\" bgcolor=\"#C1C1FF\">\n<caption>Financiadores</caption>\n<tr>\n <td colspan=\"1\" class=\"S10d\">".toCharArray(); text[8] = "</td>\n <td colspan=\"2\">".toCharArray(); text[9] = "</td>\n</tr>\n<tr>\n <td colspan=\"1\" class=\"S10d\">".toCharArray(); text[10] = "</td>\n <td colspan=\"2\">".toCharArray(); text[11] = "</td>\n</tr>\n<tr>\n <td></td>\n <td align=\"left\" colspan=\"2\">".toCharArray(); text[12] = "\n</td>\n</tr>\n<tr class=\"FondoAzul\">\n <td class=\"S10c\">Codigo</td>\n <td class=\"S10c\">Descripcion</td>\n </tr>\n\n".toCharArray(); text[13] = "\n <tr class=\"T8a\">\n <td>".toCharArray(); text[14] = "</td>\n <td>".toCharArray(); text[15] = "</td>\n <td>".toCharArray(); text[16] = "&nbsp;&nbsp;\n ".toCharArray(); text[17] = "</td>\n </tr>\n".toCharArray(); text[18] = "\n\n</table>\n".toCharArray(); text[19] = "\n</body>\n</html>\n".toCharArray(); } catch (Throwable th) { System.err.println(th); } } } } <file_sep> /*@lineinfo:filename=/Activos4.jsp*/ /*@lineinfo:generated-code*/ import oracle.jsp.runtime.*; import javax.servlet.*; import javax.servlet.http.*; import javax.servlet.jsp.*; import java.util.Vector; import ActivosFijos.*; public class _Activos4 extends oracle.jsp.runtime.HttpJsp { public final String _globalsClassName = null; // ** Begin Declarations // ** End Declarations public void _jspService(HttpServletRequest request, HttpServletResponse response) throws java.io.IOException, ServletException { response.setContentType( "text/html;charset=windows-1252"); /* set up the intrinsic variables using the pageContext goober: ** session = HttpSession ** application = ServletContext ** out = JspWriter ** page = this ** config = ServletConfig ** all session/app beans declared in globals.jsa */ PageContext pageContext = JspFactory.getDefaultFactory().getPageContext( this, request, response, null, true, JspWriter.DEFAULT_BUFFER, true); // Note: this is not emitted if the session directive == false HttpSession session = pageContext.getSession(); if (pageContext.getAttribute(OracleJspRuntime.JSP_REQUEST_REDIRECTED, PageContext.REQUEST_SCOPE) != null) { pageContext.setAttribute(OracleJspRuntime.JSP_PAGE_DONTNOTIFY, "true", PageContext.PAGE_SCOPE); JspFactory.getDefaultFactory().releasePageContext(pageContext); return; } int __jsp_tag_starteval; ServletContext application = pageContext.getServletContext(); JspWriter out = pageContext.getOut(); _Activos4 page = this; ServletConfig config = pageContext.getServletConfig(); try { // global beans // end global beans out.write(__jsp_StaticText.text[0]); out.write(__jsp_StaticText.text[1]); out.write(__jsp_StaticText.text[2]); out.write(__jsp_StaticText.text[3]); out.write(__jsp_StaticText.text[4]); /*@lineinfo:translated-code*//*@lineinfo:25^1*/ { org.apache.struts.taglib.html.FormTag __jsp_taghandler_1=(org.apache.struts.taglib.html.FormTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.FormTag.class,"org.apache.struts.taglib.html.FormTag action onsubmit"); __jsp_taghandler_1.setParent(null); __jsp_taghandler_1.setAction("/activosAction"); __jsp_taghandler_1.setOnsubmit("return validar4(this)"); __jsp_tag_starteval=__jsp_taghandler_1.doStartTag(); if (OracleJspRuntime.checkStartTagEval(__jsp_tag_starteval)) { do { /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[5]); /*@lineinfo:translated-code*//*@lineinfo:26^1*/ { org.apache.struts.taglib.html.HiddenTag __jsp_taghandler_2=(org.apache.struts.taglib.html.HiddenTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.HiddenTag.class,"org.apache.struts.taglib.html.HiddenTag property"); __jsp_taghandler_2.setParent(__jsp_taghandler_1); __jsp_taghandler_2.setProperty("operacion"); __jsp_tag_starteval=__jsp_taghandler_2.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_2,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_2.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_2.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_2); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[6]); /*@lineinfo:translated-code*//*@lineinfo:27^1*/ { org.apache.struts.taglib.html.HiddenTag __jsp_taghandler_3=(org.apache.struts.taglib.html.HiddenTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.HiddenTag.class,"org.apache.struts.taglib.html.HiddenTag property"); __jsp_taghandler_3.setParent(__jsp_taghandler_1); __jsp_taghandler_3.setProperty("opcion"); __jsp_tag_starteval=__jsp_taghandler_3.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_3,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_3.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_3.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_3); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[7]); /*@lineinfo:translated-code*//*@lineinfo:28^1*/ { org.apache.struts.taglib.logic.EqualTag __jsp_taghandler_4=(org.apache.struts.taglib.logic.EqualTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.logic.EqualTag.class,"org.apache.struts.taglib.logic.EqualTag name property value"); __jsp_taghandler_4.setParent(__jsp_taghandler_1); __jsp_taghandler_4.setName("ActivosForm"); __jsp_taghandler_4.setProperty("operacion"); __jsp_taghandler_4.setValue("1"); __jsp_tag_starteval=__jsp_taghandler_4.doStartTag(); if (OracleJspRuntime.checkStartTagEval(__jsp_tag_starteval)) { do { /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[8]); /*@lineinfo:translated-code*//*@lineinfo:29^4*/ { org.apache.struts.taglib.html.HiddenTag __jsp_taghandler_5=(org.apache.struts.taglib.html.HiddenTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.HiddenTag.class,"org.apache.struts.taglib.html.HiddenTag name property"); __jsp_taghandler_5.setParent(__jsp_taghandler_4); __jsp_taghandler_5.setName("ActivosForm"); __jsp_taghandler_5.setProperty("act_codpar"); __jsp_tag_starteval=__jsp_taghandler_5.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_5,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_5.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_5.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_5); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[9]); /*@lineinfo:translated-code*//*@lineinfo:30^4*/ { org.apache.struts.taglib.html.HiddenTag __jsp_taghandler_6=(org.apache.struts.taglib.html.HiddenTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.HiddenTag.class,"org.apache.struts.taglib.html.HiddenTag name property"); __jsp_taghandler_6.setParent(__jsp_taghandler_4); __jsp_taghandler_6.setName("ActivosForm"); __jsp_taghandler_6.setProperty("act_codofi"); __jsp_tag_starteval=__jsp_taghandler_6.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_6,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_6.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_6.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_6); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[10]); /*@lineinfo:translated-code*//*@lineinfo:31^4*/ { org.apache.struts.taglib.html.HiddenTag __jsp_taghandler_7=(org.apache.struts.taglib.html.HiddenTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.HiddenTag.class,"org.apache.struts.taglib.html.HiddenTag name property"); __jsp_taghandler_7.setParent(__jsp_taghandler_4); __jsp_taghandler_7.setName("ActivosForm"); __jsp_taghandler_7.setProperty("act_codfun"); __jsp_tag_starteval=__jsp_taghandler_7.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_7,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_7.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_7.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_7); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[11]); /*@lineinfo:translated-code*//*@lineinfo:32^4*/ { org.apache.struts.taglib.html.HiddenTag __jsp_taghandler_8=(org.apache.struts.taglib.html.HiddenTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.HiddenTag.class,"org.apache.struts.taglib.html.HiddenTag name property"); __jsp_taghandler_8.setParent(__jsp_taghandler_4); __jsp_taghandler_8.setName("ActivosForm"); __jsp_taghandler_8.setProperty("act_codfin"); __jsp_tag_starteval=__jsp_taghandler_8.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_8,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_8.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_8.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_8); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[12]); /*@lineinfo:translated-code*//*@lineinfo:33^4*/ { org.apache.struts.taglib.html.HiddenTag __jsp_taghandler_9=(org.apache.struts.taglib.html.HiddenTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.HiddenTag.class,"org.apache.struts.taglib.html.HiddenTag name property"); __jsp_taghandler_9.setParent(__jsp_taghandler_4); __jsp_taghandler_9.setName("ActivosForm"); __jsp_taghandler_9.setProperty("act_codmot"); __jsp_tag_starteval=__jsp_taghandler_9.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_9,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_9.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_9.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_9); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[13]); /*@lineinfo:translated-code*//*@lineinfo:34^4*/ { org.apache.struts.taglib.html.HiddenTag __jsp_taghandler_10=(org.apache.struts.taglib.html.HiddenTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.HiddenTag.class,"org.apache.struts.taglib.html.HiddenTag name property"); __jsp_taghandler_10.setParent(__jsp_taghandler_4); __jsp_taghandler_10.setName("ActivosForm"); __jsp_taghandler_10.setProperty("act_tipcam"); __jsp_tag_starteval=__jsp_taghandler_10.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_10,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_10.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_10.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_10); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[14]); /*@lineinfo:translated-code*//*@lineinfo:35^4*/ { org.apache.struts.taglib.html.HiddenTag __jsp_taghandler_11=(org.apache.struts.taglib.html.HiddenTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.HiddenTag.class,"org.apache.struts.taglib.html.HiddenTag name property"); __jsp_taghandler_11.setParent(__jsp_taghandler_4); __jsp_taghandler_11.setName("ActivosForm"); __jsp_taghandler_11.setProperty("act_tipufv"); __jsp_tag_starteval=__jsp_taghandler_11.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_11,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_11.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_11.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_11); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[15]); /*@lineinfo:translated-code*//*@lineinfo:36^4*/ { org.apache.struts.taglib.html.HiddenTag __jsp_taghandler_12=(org.apache.struts.taglib.html.HiddenTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.HiddenTag.class,"org.apache.struts.taglib.html.HiddenTag name property"); __jsp_taghandler_12.setParent(__jsp_taghandler_4); __jsp_taghandler_12.setName("ActivosForm"); __jsp_taghandler_12.setProperty("act_accesorios"); __jsp_tag_starteval=__jsp_taghandler_12.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_12,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_12.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_12.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_12); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[16]); /*@lineinfo:translated-code*//*@lineinfo:37^4*/ { org.apache.struts.taglib.html.HiddenTag __jsp_taghandler_13=(org.apache.struts.taglib.html.HiddenTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.HiddenTag.class,"org.apache.struts.taglib.html.HiddenTag name property"); __jsp_taghandler_13.setParent(__jsp_taghandler_4); __jsp_taghandler_13.setName("ActivosForm"); __jsp_taghandler_13.setProperty("act_modelo"); __jsp_tag_starteval=__jsp_taghandler_13.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_13,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_13.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_13.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_13); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[17]); /*@lineinfo:translated-code*//*@lineinfo:38^4*/ { org.apache.struts.taglib.html.HiddenTag __jsp_taghandler_14=(org.apache.struts.taglib.html.HiddenTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.HiddenTag.class,"org.apache.struts.taglib.html.HiddenTag name property"); __jsp_taghandler_14.setParent(__jsp_taghandler_4); __jsp_taghandler_14.setName("ActivosForm"); __jsp_taghandler_14.setProperty("act_serie1"); __jsp_tag_starteval=__jsp_taghandler_14.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_14,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_14.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_14.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_14); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[18]); /*@lineinfo:translated-code*//*@lineinfo:39^4*/ { org.apache.struts.taglib.html.HiddenTag __jsp_taghandler_15=(org.apache.struts.taglib.html.HiddenTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.HiddenTag.class,"org.apache.struts.taglib.html.HiddenTag name property"); __jsp_taghandler_15.setParent(__jsp_taghandler_4); __jsp_taghandler_15.setName("ActivosForm"); __jsp_taghandler_15.setProperty("act_serie2"); __jsp_tag_starteval=__jsp_taghandler_15.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_15,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_15.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_15.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_15); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[19]); /*@lineinfo:translated-code*//*@lineinfo:40^4*/ { org.apache.struts.taglib.html.HiddenTag __jsp_taghandler_16=(org.apache.struts.taglib.html.HiddenTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.HiddenTag.class,"org.apache.struts.taglib.html.HiddenTag name property"); __jsp_taghandler_16.setParent(__jsp_taghandler_4); __jsp_taghandler_16.setName("ActivosForm"); __jsp_taghandler_16.setProperty("act_docreferencia"); __jsp_tag_starteval=__jsp_taghandler_16.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_16,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_16.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_16.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_16); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[20]); /*@lineinfo:translated-code*//*@lineinfo:41^4*/ { org.apache.struts.taglib.html.HiddenTag __jsp_taghandler_17=(org.apache.struts.taglib.html.HiddenTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.HiddenTag.class,"org.apache.struts.taglib.html.HiddenTag name property"); __jsp_taghandler_17.setParent(__jsp_taghandler_4); __jsp_taghandler_17.setName("ActivosForm"); __jsp_taghandler_17.setProperty("act_fecreferencia"); __jsp_tag_starteval=__jsp_taghandler_17.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_17,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_17.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_17.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_17); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[21]); /*@lineinfo:translated-code*//*@lineinfo:42^4*/ { org.apache.struts.taglib.html.HiddenTag __jsp_taghandler_18=(org.apache.struts.taglib.html.HiddenTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.HiddenTag.class,"org.apache.struts.taglib.html.HiddenTag name property"); __jsp_taghandler_18.setParent(__jsp_taghandler_4); __jsp_taghandler_18.setName("ActivosForm"); __jsp_taghandler_18.setProperty("act_docrefotro"); __jsp_tag_starteval=__jsp_taghandler_18.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_18,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_18.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_18.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_18); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[22]); /*@lineinfo:translated-code*//*@lineinfo:43^4*/ { org.apache.struts.taglib.html.HiddenTag __jsp_taghandler_19=(org.apache.struts.taglib.html.HiddenTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.HiddenTag.class,"org.apache.struts.taglib.html.HiddenTag name property"); __jsp_taghandler_19.setParent(__jsp_taghandler_4); __jsp_taghandler_19.setName("ActivosForm"); __jsp_taghandler_19.setProperty("act_placa"); __jsp_tag_starteval=__jsp_taghandler_19.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_19,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_19.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_19.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_19); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[23]); /*@lineinfo:translated-code*//*@lineinfo:44^4*/ { org.apache.struts.taglib.html.HiddenTag __jsp_taghandler_20=(org.apache.struts.taglib.html.HiddenTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.HiddenTag.class,"org.apache.struts.taglib.html.HiddenTag name property"); __jsp_taghandler_20.setParent(__jsp_taghandler_4); __jsp_taghandler_20.setName("ActivosForm"); __jsp_taghandler_20.setProperty("act_aniofabricacion"); __jsp_tag_starteval=__jsp_taghandler_20.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_20,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_20.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_20.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_20); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[24]); /*@lineinfo:translated-code*//*@lineinfo:45^4*/ { org.apache.struts.taglib.html.HiddenTag __jsp_taghandler_21=(org.apache.struts.taglib.html.HiddenTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.HiddenTag.class,"org.apache.struts.taglib.html.HiddenTag name property"); __jsp_taghandler_21.setParent(__jsp_taghandler_4); __jsp_taghandler_21.setName("ActivosForm"); __jsp_taghandler_21.setProperty("act_valcodol"); __jsp_tag_starteval=__jsp_taghandler_21.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_21,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_21.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_21.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_21); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[25]); /*@lineinfo:translated-code*//*@lineinfo:46^4*/ { org.apache.struts.taglib.html.HiddenTag __jsp_taghandler_22=(org.apache.struts.taglib.html.HiddenTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.HiddenTag.class,"org.apache.struts.taglib.html.HiddenTag name property"); __jsp_taghandler_22.setParent(__jsp_taghandler_4); __jsp_taghandler_22.setName("ActivosForm"); __jsp_taghandler_22.setProperty("act_valcoufv"); __jsp_tag_starteval=__jsp_taghandler_22.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_22,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_22.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_22.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_22); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[26]); /*@lineinfo:translated-code*//*@lineinfo:47^4*/ { org.apache.struts.taglib.html.HiddenTag __jsp_taghandler_23=(org.apache.struts.taglib.html.HiddenTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.HiddenTag.class,"org.apache.struts.taglib.html.HiddenTag name property"); __jsp_taghandler_23.setParent(__jsp_taghandler_4); __jsp_taghandler_23.setName("ActivosForm"); __jsp_taghandler_23.setProperty("act_fecbaja"); __jsp_tag_starteval=__jsp_taghandler_23.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_23,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_23.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_23.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_23); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[27]); /*@lineinfo:translated-code*//*@lineinfo:48^4*/ { org.apache.struts.taglib.html.HiddenTag __jsp_taghandler_24=(org.apache.struts.taglib.html.HiddenTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.HiddenTag.class,"org.apache.struts.taglib.html.HiddenTag name property"); __jsp_taghandler_24.setParent(__jsp_taghandler_4); __jsp_taghandler_24.setName("ActivosForm"); __jsp_taghandler_24.setProperty("act_indetiqueta"); __jsp_tag_starteval=__jsp_taghandler_24.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_24,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_24.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_24.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_24); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[28]); /*@lineinfo:translated-code*//*@lineinfo:49^4*/ { org.apache.struts.taglib.logic.EqualTag __jsp_taghandler_25=(org.apache.struts.taglib.logic.EqualTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.logic.EqualTag.class,"org.apache.struts.taglib.logic.EqualTag name property value"); __jsp_taghandler_25.setParent(__jsp_taghandler_4); __jsp_taghandler_25.setName("ActivosForm"); __jsp_taghandler_25.setProperty("opcion"); __jsp_taghandler_25.setValue("1"); __jsp_tag_starteval=__jsp_taghandler_25.doStartTag(); if (OracleJspRuntime.checkStartTagEval(__jsp_tag_starteval)) { do { /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[29]); /*@lineinfo:translated-code*//*@lineinfo:52^27*/ { org.apache.struts.taglib.bean.MessageTag __jsp_taghandler_26=(org.apache.struts.taglib.bean.MessageTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.bean.MessageTag.class,"org.apache.struts.taglib.bean.MessageTag key"); __jsp_taghandler_26.setParent(__jsp_taghandler_25); __jsp_taghandler_26.setKey("activos4.codrub"); __jsp_tag_starteval=__jsp_taghandler_26.doStartTag(); if (OracleJspRuntime.checkStartTagEval(__jsp_tag_starteval)) { do { } while (__jsp_taghandler_26.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); } if (__jsp_taghandler_26.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_26); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[30]); /*@lineinfo:translated-code*//*@lineinfo:53^26*/ { org.apache.struts.taglib.html.TextTag __jsp_taghandler_27=(org.apache.struts.taglib.html.TextTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.TextTag.class,"org.apache.struts.taglib.html.TextTag maxlength name property readonly size"); __jsp_taghandler_27.setParent(__jsp_taghandler_25); __jsp_taghandler_27.setMaxlength("10"); __jsp_taghandler_27.setName("ActivosForm"); __jsp_taghandler_27.setProperty("act_codrub"); __jsp_taghandler_27.setReadonly(true); __jsp_taghandler_27.setSize("10"); __jsp_tag_starteval=__jsp_taghandler_27.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_27,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_27.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_27.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_27); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[31]); /*@lineinfo:translated-code*//*@lineinfo:54^10*/ { org.apache.struts.taglib.html.TextTag __jsp_taghandler_28=(org.apache.struts.taglib.html.TextTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.TextTag.class,"org.apache.struts.taglib.html.TextTag maxlength name property readonly size"); __jsp_taghandler_28.setParent(__jsp_taghandler_25); __jsp_taghandler_28.setMaxlength("60"); __jsp_taghandler_28.setName("ActivosForm"); __jsp_taghandler_28.setProperty("act_rubdescripcion"); __jsp_taghandler_28.setReadonly(true); __jsp_taghandler_28.setSize("60"); __jsp_tag_starteval=__jsp_taghandler_28.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_28,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_28.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_28.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_28); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[32]); /*@lineinfo:translated-code*//*@lineinfo:57^27*/ { org.apache.struts.taglib.bean.MessageTag __jsp_taghandler_29=(org.apache.struts.taglib.bean.MessageTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.bean.MessageTag.class,"org.apache.struts.taglib.bean.MessageTag key"); __jsp_taghandler_29.setParent(__jsp_taghandler_25); __jsp_taghandler_29.setKey("activos4.codreg"); __jsp_tag_starteval=__jsp_taghandler_29.doStartTag(); if (OracleJspRuntime.checkStartTagEval(__jsp_tag_starteval)) { do { } while (__jsp_taghandler_29.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); } if (__jsp_taghandler_29.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_29); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[33]); /*@lineinfo:translated-code*//*@lineinfo:58^26*/ { org.apache.struts.taglib.html.TextTag __jsp_taghandler_30=(org.apache.struts.taglib.html.TextTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.TextTag.class,"org.apache.struts.taglib.html.TextTag maxlength name property readonly size"); __jsp_taghandler_30.setParent(__jsp_taghandler_25); __jsp_taghandler_30.setMaxlength("10"); __jsp_taghandler_30.setName("ActivosForm"); __jsp_taghandler_30.setProperty("act_codreg"); __jsp_taghandler_30.setReadonly(true); __jsp_taghandler_30.setSize("10"); __jsp_tag_starteval=__jsp_taghandler_30.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_30,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_30.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_30.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_30); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[34]); /*@lineinfo:translated-code*//*@lineinfo:59^10*/ { org.apache.struts.taglib.html.TextTag __jsp_taghandler_31=(org.apache.struts.taglib.html.TextTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.TextTag.class,"org.apache.struts.taglib.html.TextTag maxlength name property readonly size"); __jsp_taghandler_31.setParent(__jsp_taghandler_25); __jsp_taghandler_31.setMaxlength("60"); __jsp_taghandler_31.setName("ActivosForm"); __jsp_taghandler_31.setProperty("act_regdescripcion"); __jsp_taghandler_31.setReadonly(true); __jsp_taghandler_31.setSize("60"); __jsp_tag_starteval=__jsp_taghandler_31.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_31,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_31.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_31.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_31); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[35]); /*@lineinfo:translated-code*//*@lineinfo:62^27*/ { org.apache.struts.taglib.bean.MessageTag __jsp_taghandler_32=(org.apache.struts.taglib.bean.MessageTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.bean.MessageTag.class,"org.apache.struts.taglib.bean.MessageTag key"); __jsp_taghandler_32.setParent(__jsp_taghandler_25); __jsp_taghandler_32.setKey("activos4.codigo"); __jsp_tag_starteval=__jsp_taghandler_32.doStartTag(); if (OracleJspRuntime.checkStartTagEval(__jsp_tag_starteval)) { do { } while (__jsp_taghandler_32.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); } if (__jsp_taghandler_32.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_32); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[36]); /*@lineinfo:translated-code*//*@lineinfo:63^26*/ { org.apache.struts.taglib.html.TextTag __jsp_taghandler_33=(org.apache.struts.taglib.html.TextTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.TextTag.class,"org.apache.struts.taglib.html.TextTag maxlength name property readonly size"); __jsp_taghandler_33.setParent(__jsp_taghandler_25); __jsp_taghandler_33.setMaxlength("5"); __jsp_taghandler_33.setName("ActivosForm"); __jsp_taghandler_33.setProperty("act_codigo"); __jsp_taghandler_33.setReadonly(true); __jsp_taghandler_33.setSize("5"); __jsp_tag_starteval=__jsp_taghandler_33.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_33,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_33.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_33.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_33); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[37]); /*@lineinfo:translated-code*//*@lineinfo:64^10*/ { org.apache.struts.taglib.html.TextTag __jsp_taghandler_34=(org.apache.struts.taglib.html.TextTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.TextTag.class,"org.apache.struts.taglib.html.TextTag maxlength name property readonly size"); __jsp_taghandler_34.setParent(__jsp_taghandler_25); __jsp_taghandler_34.setMaxlength("10"); __jsp_taghandler_34.setName("ActivosForm"); __jsp_taghandler_34.setProperty("act_codbarra"); __jsp_taghandler_34.setReadonly(true); __jsp_taghandler_34.setSize("10"); __jsp_tag_starteval=__jsp_taghandler_34.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_34,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_34.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_34.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_34); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[38]); /*@lineinfo:translated-code*//*@lineinfo:67^27*/ { org.apache.struts.taglib.bean.MessageTag __jsp_taghandler_35=(org.apache.struts.taglib.bean.MessageTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.bean.MessageTag.class,"org.apache.struts.taglib.bean.MessageTag key"); __jsp_taghandler_35.setParent(__jsp_taghandler_25); __jsp_taghandler_35.setKey("activos4.codgrp"); __jsp_tag_starteval=__jsp_taghandler_35.doStartTag(); if (OracleJspRuntime.checkStartTagEval(__jsp_tag_starteval)) { do { } while (__jsp_taghandler_35.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); } if (__jsp_taghandler_35.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_35); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[39]); /*@lineinfo:translated-code*//*@lineinfo:68^14*/ { org.apache.struts.taglib.html.SelectTag __jsp_taghandler_36=(org.apache.struts.taglib.html.SelectTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.SelectTag.class,"org.apache.struts.taglib.html.SelectTag disabled name property"); __jsp_taghandler_36.setParent(__jsp_taghandler_25); __jsp_taghandler_36.setDisabled(false); __jsp_taghandler_36.setName("ActivosForm"); __jsp_taghandler_36.setProperty("act_codgrp"); __jsp_tag_starteval=__jsp_taghandler_36.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_36,__jsp_tag_starteval,out); do { /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[40]); /*@lineinfo:translated-code*//*@lineinfo:69^15*/ { org.apache.struts.taglib.html.OptionsTag __jsp_taghandler_37=(org.apache.struts.taglib.html.OptionsTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.OptionsTag.class,"org.apache.struts.taglib.html.OptionsTag collection labelProperty property"); __jsp_taghandler_37.setParent(__jsp_taghandler_36); __jsp_taghandler_37.setCollection("GruposLista"); __jsp_taghandler_37.setLabelProperty("descripcion"); __jsp_taghandler_37.setProperty("codigo"); __jsp_tag_starteval=__jsp_taghandler_37.doStartTag(); if (OracleJspRuntime.checkStartTagEval(__jsp_tag_starteval)) { do { } while (__jsp_taghandler_37.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); } if (__jsp_taghandler_37.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_37); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[41]); /*@lineinfo:translated-code*//*@lineinfo:69^101*/ } while (__jsp_taghandler_36.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_36.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_36); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[42]); /*@lineinfo:translated-code*//*@lineinfo:71^27*/ { org.apache.struts.taglib.bean.MessageTag __jsp_taghandler_38=(org.apache.struts.taglib.bean.MessageTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.bean.MessageTag.class,"org.apache.struts.taglib.bean.MessageTag key"); __jsp_taghandler_38.setParent(__jsp_taghandler_25); __jsp_taghandler_38.setKey("activos4.codpar"); __jsp_tag_starteval=__jsp_taghandler_38.doStartTag(); if (OracleJspRuntime.checkStartTagEval(__jsp_tag_starteval)) { do { } while (__jsp_taghandler_38.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); } if (__jsp_taghandler_38.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_38); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[43]); /*@lineinfo:translated-code*//*@lineinfo:73^15*/ { org.apache.struts.taglib.html.TextTag __jsp_taghandler_39=(org.apache.struts.taglib.html.TextTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.TextTag.class,"org.apache.struts.taglib.html.TextTag maxlength name property readonly size"); __jsp_taghandler_39.setParent(__jsp_taghandler_25); __jsp_taghandler_39.setMaxlength("40"); __jsp_taghandler_39.setName("ActivosForm"); __jsp_taghandler_39.setProperty("act_pardescripcion"); __jsp_taghandler_39.setReadonly(true); __jsp_taghandler_39.setSize("40"); __jsp_tag_starteval=__jsp_taghandler_39.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_39,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_39.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_39.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_39); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[44]); /*@lineinfo:translated-code*//*@lineinfo:77^27*/ { org.apache.struts.taglib.bean.MessageTag __jsp_taghandler_40=(org.apache.struts.taglib.bean.MessageTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.bean.MessageTag.class,"org.apache.struts.taglib.bean.MessageTag key"); __jsp_taghandler_40.setParent(__jsp_taghandler_25); __jsp_taghandler_40.setKey("activos4.codofi"); __jsp_tag_starteval=__jsp_taghandler_40.doStartTag(); if (OracleJspRuntime.checkStartTagEval(__jsp_tag_starteval)) { do { } while (__jsp_taghandler_40.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); } if (__jsp_taghandler_40.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_40); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[45]); /*@lineinfo:translated-code*//*@lineinfo:79^10*/ { org.apache.struts.taglib.html.TextTag __jsp_taghandler_41=(org.apache.struts.taglib.html.TextTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.TextTag.class,"org.apache.struts.taglib.html.TextTag maxlength name property readonly size"); __jsp_taghandler_41.setParent(__jsp_taghandler_25); __jsp_taghandler_41.setMaxlength("40"); __jsp_taghandler_41.setName("ActivosForm"); __jsp_taghandler_41.setProperty("act_ofidescripcion"); __jsp_taghandler_41.setReadonly(true); __jsp_taghandler_41.setSize("40"); __jsp_tag_starteval=__jsp_taghandler_41.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_41,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_41.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_41.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_41); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[46]); /*@lineinfo:translated-code*//*@lineinfo:81^27*/ { org.apache.struts.taglib.bean.MessageTag __jsp_taghandler_42=(org.apache.struts.taglib.bean.MessageTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.bean.MessageTag.class,"org.apache.struts.taglib.bean.MessageTag key"); __jsp_taghandler_42.setParent(__jsp_taghandler_25); __jsp_taghandler_42.setKey("activos4.codfun"); __jsp_tag_starteval=__jsp_taghandler_42.doStartTag(); if (OracleJspRuntime.checkStartTagEval(__jsp_tag_starteval)) { do { } while (__jsp_taghandler_42.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); } if (__jsp_taghandler_42.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_42); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[47]); /*@lineinfo:translated-code*//*@lineinfo:83^10*/ { org.apache.struts.taglib.html.TextTag __jsp_taghandler_43=(org.apache.struts.taglib.html.TextTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.TextTag.class,"org.apache.struts.taglib.html.TextTag maxlength name property readonly size"); __jsp_taghandler_43.setParent(__jsp_taghandler_25); __jsp_taghandler_43.setMaxlength("40"); __jsp_taghandler_43.setName("ActivosForm"); __jsp_taghandler_43.setProperty("act_fundescripcion"); __jsp_taghandler_43.setReadonly(true); __jsp_taghandler_43.setSize("40"); __jsp_tag_starteval=__jsp_taghandler_43.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_43,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_43.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_43.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_43); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[48]); /*@lineinfo:translated-code*//*@lineinfo:87^27*/ { org.apache.struts.taglib.bean.MessageTag __jsp_taghandler_44=(org.apache.struts.taglib.bean.MessageTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.bean.MessageTag.class,"org.apache.struts.taglib.bean.MessageTag key"); __jsp_taghandler_44.setParent(__jsp_taghandler_25); __jsp_taghandler_44.setKey("activos4.codubi"); __jsp_tag_starteval=__jsp_taghandler_44.doStartTag(); if (OracleJspRuntime.checkStartTagEval(__jsp_tag_starteval)) { do { } while (__jsp_taghandler_44.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); } if (__jsp_taghandler_44.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_44); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[49]); /*@lineinfo:translated-code*//*@lineinfo:88^14*/ { org.apache.struts.taglib.html.SelectTag __jsp_taghandler_45=(org.apache.struts.taglib.html.SelectTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.SelectTag.class,"org.apache.struts.taglib.html.SelectTag disabled name property"); __jsp_taghandler_45.setParent(__jsp_taghandler_25); __jsp_taghandler_45.setDisabled(false); __jsp_taghandler_45.setName("ActivosForm"); __jsp_taghandler_45.setProperty("act_codubi"); __jsp_tag_starteval=__jsp_taghandler_45.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_45,__jsp_tag_starteval,out); do { /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[50]); /*@lineinfo:translated-code*//*@lineinfo:89^15*/ { org.apache.struts.taglib.html.OptionsTag __jsp_taghandler_46=(org.apache.struts.taglib.html.OptionsTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.OptionsTag.class,"org.apache.struts.taglib.html.OptionsTag collection labelProperty property"); __jsp_taghandler_46.setParent(__jsp_taghandler_45); __jsp_taghandler_46.setCollection("UbicacionesLista"); __jsp_taghandler_46.setLabelProperty("descripcion"); __jsp_taghandler_46.setProperty("codigo"); __jsp_tag_starteval=__jsp_taghandler_46.doStartTag(); if (OracleJspRuntime.checkStartTagEval(__jsp_tag_starteval)) { do { } while (__jsp_taghandler_46.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); } if (__jsp_taghandler_46.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_46); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[51]); /*@lineinfo:translated-code*//*@lineinfo:89^106*/ } while (__jsp_taghandler_45.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_45.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_45); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[52]); /*@lineinfo:translated-code*//*@lineinfo:91^27*/ { org.apache.struts.taglib.bean.MessageTag __jsp_taghandler_47=(org.apache.struts.taglib.bean.MessageTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.bean.MessageTag.class,"org.apache.struts.taglib.bean.MessageTag key"); __jsp_taghandler_47.setParent(__jsp_taghandler_25); __jsp_taghandler_47.setKey("activos4.codpry"); __jsp_tag_starteval=__jsp_taghandler_47.doStartTag(); if (OracleJspRuntime.checkStartTagEval(__jsp_tag_starteval)) { do { } while (__jsp_taghandler_47.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); } if (__jsp_taghandler_47.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_47); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[53]); /*@lineinfo:translated-code*//*@lineinfo:92^14*/ { org.apache.struts.taglib.html.SelectTag __jsp_taghandler_48=(org.apache.struts.taglib.html.SelectTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.SelectTag.class,"org.apache.struts.taglib.html.SelectTag disabled name property"); __jsp_taghandler_48.setParent(__jsp_taghandler_25); __jsp_taghandler_48.setDisabled(false); __jsp_taghandler_48.setName("ActivosForm"); __jsp_taghandler_48.setProperty("act_codpry"); __jsp_tag_starteval=__jsp_taghandler_48.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_48,__jsp_tag_starteval,out); do { /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[54]); /*@lineinfo:translated-code*//*@lineinfo:93^15*/ { org.apache.struts.taglib.html.OptionsTag __jsp_taghandler_49=(org.apache.struts.taglib.html.OptionsTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.OptionsTag.class,"org.apache.struts.taglib.html.OptionsTag collection labelProperty property"); __jsp_taghandler_49.setParent(__jsp_taghandler_48); __jsp_taghandler_49.setCollection("ProyectosLista"); __jsp_taghandler_49.setLabelProperty("descripcion"); __jsp_taghandler_49.setProperty("codigo"); __jsp_tag_starteval=__jsp_taghandler_49.doStartTag(); if (OracleJspRuntime.checkStartTagEval(__jsp_tag_starteval)) { do { } while (__jsp_taghandler_49.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); } if (__jsp_taghandler_49.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_49); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[55]); /*@lineinfo:translated-code*//*@lineinfo:93^104*/ } while (__jsp_taghandler_48.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_48.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_48); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[56]); /*@lineinfo:translated-code*//*@lineinfo:97^27*/ { org.apache.struts.taglib.bean.MessageTag __jsp_taghandler_50=(org.apache.struts.taglib.bean.MessageTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.bean.MessageTag.class,"org.apache.struts.taglib.bean.MessageTag key"); __jsp_taghandler_50.setParent(__jsp_taghandler_25); __jsp_taghandler_50.setKey("activos4.codfin"); __jsp_tag_starteval=__jsp_taghandler_50.doStartTag(); if (OracleJspRuntime.checkStartTagEval(__jsp_tag_starteval)) { do { } while (__jsp_taghandler_50.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); } if (__jsp_taghandler_50.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_50); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[57]); /*@lineinfo:translated-code*//*@lineinfo:98^14*/ { org.apache.struts.taglib.html.TextTag __jsp_taghandler_51=(org.apache.struts.taglib.html.TextTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.TextTag.class,"org.apache.struts.taglib.html.TextTag maxlength name property readonly size"); __jsp_taghandler_51.setParent(__jsp_taghandler_25); __jsp_taghandler_51.setMaxlength("40"); __jsp_taghandler_51.setName("ActivosForm"); __jsp_taghandler_51.setProperty("act_findescripcion"); __jsp_taghandler_51.setReadonly(true); __jsp_taghandler_51.setSize("40"); __jsp_tag_starteval=__jsp_taghandler_51.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_51,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_51.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_51.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_51); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[58]); /*@lineinfo:translated-code*//*@lineinfo:101^27*/ { org.apache.struts.taglib.bean.MessageTag __jsp_taghandler_52=(org.apache.struts.taglib.bean.MessageTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.bean.MessageTag.class,"org.apache.struts.taglib.bean.MessageTag key"); __jsp_taghandler_52.setParent(__jsp_taghandler_25); __jsp_taghandler_52.setKey("activos4.feccompra"); __jsp_tag_starteval=__jsp_taghandler_52.doStartTag(); if (OracleJspRuntime.checkStartTagEval(__jsp_tag_starteval)) { do { } while (__jsp_taghandler_52.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); } if (__jsp_taghandler_52.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_52); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[59]); /*@lineinfo:translated-code*//*@lineinfo:102^14*/ { org.apache.struts.taglib.html.TextTag __jsp_taghandler_53=(org.apache.struts.taglib.html.TextTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.TextTag.class,"org.apache.struts.taglib.html.TextTag maxlength name property size"); __jsp_taghandler_53.setParent(__jsp_taghandler_25); __jsp_taghandler_53.setMaxlength("10"); __jsp_taghandler_53.setName("ActivosForm"); __jsp_taghandler_53.setProperty("act_feccompra"); __jsp_taghandler_53.setSize("10"); __jsp_tag_starteval=__jsp_taghandler_53.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_53,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_53.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_53.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_53); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[60]); /*@lineinfo:translated-code*//*@lineinfo:103^27*/ { org.apache.struts.taglib.bean.MessageTag __jsp_taghandler_54=(org.apache.struts.taglib.bean.MessageTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.bean.MessageTag.class,"org.apache.struts.taglib.bean.MessageTag key"); __jsp_taghandler_54.setParent(__jsp_taghandler_25); __jsp_taghandler_54.setKey("activos4.umanejo"); __jsp_tag_starteval=__jsp_taghandler_54.doStartTag(); if (OracleJspRuntime.checkStartTagEval(__jsp_tag_starteval)) { do { } while (__jsp_taghandler_54.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); } if (__jsp_taghandler_54.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_54); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[61]); /*@lineinfo:translated-code*//*@lineinfo:104^14*/ { org.apache.struts.taglib.html.TextTag __jsp_taghandler_55=(org.apache.struts.taglib.html.TextTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.TextTag.class,"org.apache.struts.taglib.html.TextTag maxlength name onchange property size"); __jsp_taghandler_55.setParent(__jsp_taghandler_25); __jsp_taghandler_55.setMaxlength("20"); __jsp_taghandler_55.setName("ActivosForm"); __jsp_taghandler_55.setOnchange("javascript:this.value=this.value.toUpperCase();"); __jsp_taghandler_55.setProperty("act_umanejo"); __jsp_taghandler_55.setSize("20"); __jsp_tag_starteval=__jsp_taghandler_55.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_55,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_55.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_55.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_55); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[62]); /*@lineinfo:translated-code*//*@lineinfo:109^27*/ { org.apache.struts.taglib.bean.MessageTag __jsp_taghandler_56=(org.apache.struts.taglib.bean.MessageTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.bean.MessageTag.class,"org.apache.struts.taglib.bean.MessageTag key"); __jsp_taghandler_56.setParent(__jsp_taghandler_25); __jsp_taghandler_56.setKey("activos4.descripcion"); __jsp_tag_starteval=__jsp_taghandler_56.doStartTag(); if (OracleJspRuntime.checkStartTagEval(__jsp_tag_starteval)) { do { } while (__jsp_taghandler_56.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); } if (__jsp_taghandler_56.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_56); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[63]); /*@lineinfo:translated-code*//*@lineinfo:110^14*/ { org.apache.struts.taglib.html.TextTag __jsp_taghandler_57=(org.apache.struts.taglib.html.TextTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.TextTag.class,"org.apache.struts.taglib.html.TextTag maxlength name onchange property size"); __jsp_taghandler_57.setParent(__jsp_taghandler_25); __jsp_taghandler_57.setMaxlength("120"); __jsp_taghandler_57.setName("ActivosForm"); __jsp_taghandler_57.setOnchange("javascript:this.value=this.value.toUpperCase();"); __jsp_taghandler_57.setProperty("act_descripcion"); __jsp_taghandler_57.setSize("60"); __jsp_tag_starteval=__jsp_taghandler_57.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_57,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_57.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_57.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_57); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[64]); /*@lineinfo:translated-code*//*@lineinfo:113^27*/ { org.apache.struts.taglib.bean.MessageTag __jsp_taghandler_58=(org.apache.struts.taglib.bean.MessageTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.bean.MessageTag.class,"org.apache.struts.taglib.bean.MessageTag key"); __jsp_taghandler_58.setParent(__jsp_taghandler_25); __jsp_taghandler_58.setKey("activos4.desadicional"); __jsp_tag_starteval=__jsp_taghandler_58.doStartTag(); if (OracleJspRuntime.checkStartTagEval(__jsp_tag_starteval)) { do { } while (__jsp_taghandler_58.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); } if (__jsp_taghandler_58.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_58); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[65]); /*@lineinfo:translated-code*//*@lineinfo:114^14*/ { org.apache.struts.taglib.html.TextTag __jsp_taghandler_59=(org.apache.struts.taglib.html.TextTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.TextTag.class,"org.apache.struts.taglib.html.TextTag maxlength name onchange property size"); __jsp_taghandler_59.setParent(__jsp_taghandler_25); __jsp_taghandler_59.setMaxlength("240"); __jsp_taghandler_59.setName("ActivosForm"); __jsp_taghandler_59.setOnchange("javascript:this.value=this.value.toUpperCase();"); __jsp_taghandler_59.setProperty("act_desadicional"); __jsp_taghandler_59.setSize("60"); __jsp_tag_starteval=__jsp_taghandler_59.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_59,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_59.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_59.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_59); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[66]); /*@lineinfo:translated-code*//*@lineinfo:118^13*/ { org.apache.struts.taglib.bean.MessageTag __jsp_taghandler_60=(org.apache.struts.taglib.bean.MessageTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.bean.MessageTag.class,"org.apache.struts.taglib.bean.MessageTag key"); __jsp_taghandler_60.setParent(__jsp_taghandler_25); __jsp_taghandler_60.setKey("activos.proveedor"); __jsp_tag_starteval=__jsp_taghandler_60.doStartTag(); if (OracleJspRuntime.checkStartTagEval(__jsp_tag_starteval)) { do { } while (__jsp_taghandler_60.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); } if (__jsp_taghandler_60.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_60); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[67]); /*@lineinfo:translated-code*//*@lineinfo:121^13*/ { org.apache.struts.taglib.html.TextTag __jsp_taghandler_61=(org.apache.struts.taglib.html.TextTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.TextTag.class,"org.apache.struts.taglib.html.TextTag maxlength name onchange property size"); __jsp_taghandler_61.setParent(__jsp_taghandler_25); __jsp_taghandler_61.setMaxlength("50"); __jsp_taghandler_61.setName("ActivosForm"); __jsp_taghandler_61.setOnchange("javascript:this.value=this.value.toUpperCase();"); __jsp_taghandler_61.setProperty("act_proveedor"); __jsp_taghandler_61.setSize("50"); __jsp_tag_starteval=__jsp_taghandler_61.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_61,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_61.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_61.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_61); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[68]); /*@lineinfo:translated-code*//*@lineinfo:127^27*/ { org.apache.struts.taglib.logic.EqualTag __jsp_taghandler_62=(org.apache.struts.taglib.logic.EqualTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.logic.EqualTag.class,"org.apache.struts.taglib.logic.EqualTag name property value"); __jsp_taghandler_62.setParent(__jsp_taghandler_25); __jsp_taghandler_62.setName("ActivosForm"); __jsp_taghandler_62.setProperty("act_codrub"); __jsp_taghandler_62.setValue("08"); __jsp_tag_starteval=__jsp_taghandler_62.doStartTag(); if (OracleJspRuntime.checkStartTagEval(__jsp_tag_starteval)) { do { /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[69]); /*@lineinfo:translated-code*//*@lineinfo:127^92*/ } while (__jsp_taghandler_62.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); } if (__jsp_taghandler_62.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_62); } /*@lineinfo:127^107*/ { org.apache.struts.taglib.bean.MessageTag __jsp_taghandler_63=(org.apache.struts.taglib.bean.MessageTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.bean.MessageTag.class,"org.apache.struts.taglib.bean.MessageTag key"); __jsp_taghandler_63.setParent(__jsp_taghandler_25); __jsp_taghandler_63.setKey("activos4.marca"); __jsp_tag_starteval=__jsp_taghandler_63.doStartTag(); if (OracleJspRuntime.checkStartTagEval(__jsp_tag_starteval)) { do { } while (__jsp_taghandler_63.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); } if (__jsp_taghandler_63.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_63); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[70]); /*@lineinfo:translated-code*//*@lineinfo:128^14*/ { org.apache.struts.taglib.html.TextTag __jsp_taghandler_64=(org.apache.struts.taglib.html.TextTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.TextTag.class,"org.apache.struts.taglib.html.TextTag maxlength name onchange property size"); __jsp_taghandler_64.setParent(__jsp_taghandler_25); __jsp_taghandler_64.setMaxlength("30"); __jsp_taghandler_64.setName("ActivosForm"); __jsp_taghandler_64.setOnchange("javascript:this.value=this.value.toUpperCase();"); __jsp_taghandler_64.setProperty("act_marca"); __jsp_taghandler_64.setSize("30"); __jsp_tag_starteval=__jsp_taghandler_64.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_64,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_64.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_64.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_64); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[71]); /*@lineinfo:translated-code*//*@lineinfo:129^27*/ { org.apache.struts.taglib.bean.MessageTag __jsp_taghandler_65=(org.apache.struts.taglib.bean.MessageTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.bean.MessageTag.class,"org.apache.struts.taglib.bean.MessageTag key"); __jsp_taghandler_65.setParent(__jsp_taghandler_25); __jsp_taghandler_65.setKey("activos4.color"); __jsp_tag_starteval=__jsp_taghandler_65.doStartTag(); if (OracleJspRuntime.checkStartTagEval(__jsp_tag_starteval)) { do { } while (__jsp_taghandler_65.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); } if (__jsp_taghandler_65.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_65); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[72]); /*@lineinfo:translated-code*//*@lineinfo:130^14*/ { org.apache.struts.taglib.html.TextTag __jsp_taghandler_66=(org.apache.struts.taglib.html.TextTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.TextTag.class,"org.apache.struts.taglib.html.TextTag maxlength name onchange property size"); __jsp_taghandler_66.setParent(__jsp_taghandler_25); __jsp_taghandler_66.setMaxlength("30"); __jsp_taghandler_66.setName("ActivosForm"); __jsp_taghandler_66.setOnchange("javascript:this.value=this.value.toUpperCase();"); __jsp_taghandler_66.setProperty("act_color"); __jsp_taghandler_66.setSize("30"); __jsp_tag_starteval=__jsp_taghandler_66.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_66,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_66.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_66.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_66); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[73]); /*@lineinfo:translated-code*//*@lineinfo:133^27*/ { org.apache.struts.taglib.bean.MessageTag __jsp_taghandler_67=(org.apache.struts.taglib.bean.MessageTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.bean.MessageTag.class,"org.apache.struts.taglib.bean.MessageTag key"); __jsp_taghandler_67.setParent(__jsp_taghandler_25); __jsp_taghandler_67.setKey("activos4.procedencia"); __jsp_tag_starteval=__jsp_taghandler_67.doStartTag(); if (OracleJspRuntime.checkStartTagEval(__jsp_tag_starteval)) { do { } while (__jsp_taghandler_67.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); } if (__jsp_taghandler_67.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_67); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[74]); /*@lineinfo:translated-code*//*@lineinfo:134^14*/ { org.apache.struts.taglib.html.TextTag __jsp_taghandler_68=(org.apache.struts.taglib.html.TextTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.TextTag.class,"org.apache.struts.taglib.html.TextTag maxlength name onchange property size"); __jsp_taghandler_68.setParent(__jsp_taghandler_25); __jsp_taghandler_68.setMaxlength("30"); __jsp_taghandler_68.setName("ActivosForm"); __jsp_taghandler_68.setOnchange("javascript:this.value=this.value.toUpperCase();"); __jsp_taghandler_68.setProperty("act_procedencia"); __jsp_taghandler_68.setSize("30"); __jsp_tag_starteval=__jsp_taghandler_68.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_68,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_68.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_68.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_68); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[75]); /*@lineinfo:translated-code*//*@lineinfo:135^27*/ { org.apache.struts.taglib.bean.MessageTag __jsp_taghandler_69=(org.apache.struts.taglib.bean.MessageTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.bean.MessageTag.class,"org.apache.struts.taglib.bean.MessageTag key"); __jsp_taghandler_69.setParent(__jsp_taghandler_25); __jsp_taghandler_69.setKey("activos4.gobmunicipal"); __jsp_tag_starteval=__jsp_taghandler_69.doStartTag(); if (OracleJspRuntime.checkStartTagEval(__jsp_tag_starteval)) { do { } while (__jsp_taghandler_69.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); } if (__jsp_taghandler_69.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_69); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[76]); /*@lineinfo:translated-code*//*@lineinfo:136^14*/ { org.apache.struts.taglib.html.TextTag __jsp_taghandler_70=(org.apache.struts.taglib.html.TextTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.TextTag.class,"org.apache.struts.taglib.html.TextTag maxlength name onchange property size"); __jsp_taghandler_70.setParent(__jsp_taghandler_25); __jsp_taghandler_70.setMaxlength("60"); __jsp_taghandler_70.setName("ActivosForm"); __jsp_taghandler_70.setOnchange("javascript:this.value=this.value.toUpperCase();"); __jsp_taghandler_70.setProperty("act_gobmunicipal"); __jsp_taghandler_70.setSize("30"); __jsp_tag_starteval=__jsp_taghandler_70.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_70,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_70.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_70.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_70); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[77]); /*@lineinfo:translated-code*//*@lineinfo:139^27*/ { org.apache.struts.taglib.bean.MessageTag __jsp_taghandler_71=(org.apache.struts.taglib.bean.MessageTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.bean.MessageTag.class,"org.apache.struts.taglib.bean.MessageTag key"); __jsp_taghandler_71.setParent(__jsp_taghandler_25); __jsp_taghandler_71.setKey("activos4.valcobol"); __jsp_tag_starteval=__jsp_taghandler_71.doStartTag(); if (OracleJspRuntime.checkStartTagEval(__jsp_tag_starteval)) { do { } while (__jsp_taghandler_71.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); } if (__jsp_taghandler_71.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_71); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[78]); /*@lineinfo:translated-code*//*@lineinfo:140^14*/ { org.apache.struts.taglib.html.TextTag __jsp_taghandler_72=(org.apache.struts.taglib.html.TextTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.TextTag.class,"org.apache.struts.taglib.html.TextTag maxlength name property size"); __jsp_taghandler_72.setParent(__jsp_taghandler_25); __jsp_taghandler_72.setMaxlength("13"); __jsp_taghandler_72.setName("ActivosForm"); __jsp_taghandler_72.setProperty("act_valcobol"); __jsp_taghandler_72.setSize("13"); __jsp_tag_starteval=__jsp_taghandler_72.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_72,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_72.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_72.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_72); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[79]); /*@lineinfo:translated-code*//*@lineinfo:141^27*/ { org.apache.struts.taglib.bean.MessageTag __jsp_taghandler_73=(org.apache.struts.taglib.bean.MessageTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.bean.MessageTag.class,"org.apache.struts.taglib.bean.MessageTag key"); __jsp_taghandler_73.setParent(__jsp_taghandler_25); __jsp_taghandler_73.setKey("activos4.ordencompra"); __jsp_tag_starteval=__jsp_taghandler_73.doStartTag(); if (OracleJspRuntime.checkStartTagEval(__jsp_tag_starteval)) { do { } while (__jsp_taghandler_73.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); } if (__jsp_taghandler_73.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_73); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[80]); /*@lineinfo:translated-code*//*@lineinfo:142^14*/ { org.apache.struts.taglib.html.TextTag __jsp_taghandler_74=(org.apache.struts.taglib.html.TextTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.TextTag.class,"org.apache.struts.taglib.html.TextTag maxlength name property size"); __jsp_taghandler_74.setParent(__jsp_taghandler_25); __jsp_taghandler_74.setMaxlength("20"); __jsp_taghandler_74.setName("ActivosForm"); __jsp_taghandler_74.setProperty("act_ordencompra"); __jsp_taghandler_74.setSize("20"); __jsp_tag_starteval=__jsp_taghandler_74.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_74,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_74.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_74.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_74); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[81]); /*@lineinfo:translated-code*//*@lineinfo:145^27*/ { org.apache.struts.taglib.bean.MessageTag __jsp_taghandler_75=(org.apache.struts.taglib.bean.MessageTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.bean.MessageTag.class,"org.apache.struts.taglib.bean.MessageTag key"); __jsp_taghandler_75.setParent(__jsp_taghandler_25); __jsp_taghandler_75.setKey("activos4.numfactura"); __jsp_tag_starteval=__jsp_taghandler_75.doStartTag(); if (OracleJspRuntime.checkStartTagEval(__jsp_tag_starteval)) { do { } while (__jsp_taghandler_75.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); } if (__jsp_taghandler_75.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_75); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[82]); /*@lineinfo:translated-code*//*@lineinfo:146^14*/ { org.apache.struts.taglib.html.TextTag __jsp_taghandler_76=(org.apache.struts.taglib.html.TextTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.TextTag.class,"org.apache.struts.taglib.html.TextTag maxlength name property size"); __jsp_taghandler_76.setParent(__jsp_taghandler_25); __jsp_taghandler_76.setMaxlength("12"); __jsp_taghandler_76.setName("ActivosForm"); __jsp_taghandler_76.setProperty("act_numfactura"); __jsp_taghandler_76.setSize("12"); __jsp_tag_starteval=__jsp_taghandler_76.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_76,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_76.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_76.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_76); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[83]); /*@lineinfo:translated-code*//*@lineinfo:147^27*/ { org.apache.struts.taglib.bean.MessageTag __jsp_taghandler_77=(org.apache.struts.taglib.bean.MessageTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.bean.MessageTag.class,"org.apache.struts.taglib.bean.MessageTag key"); __jsp_taghandler_77.setParent(__jsp_taghandler_25); __jsp_taghandler_77.setKey("activos4.numcomprobante"); __jsp_tag_starteval=__jsp_taghandler_77.doStartTag(); if (OracleJspRuntime.checkStartTagEval(__jsp_tag_starteval)) { do { } while (__jsp_taghandler_77.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); } if (__jsp_taghandler_77.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_77); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[84]); /*@lineinfo:translated-code*//*@lineinfo:148^14*/ { org.apache.struts.taglib.html.TextTag __jsp_taghandler_78=(org.apache.struts.taglib.html.TextTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.TextTag.class,"org.apache.struts.taglib.html.TextTag maxlength name property size"); __jsp_taghandler_78.setParent(__jsp_taghandler_25); __jsp_taghandler_78.setMaxlength("20"); __jsp_taghandler_78.setName("ActivosForm"); __jsp_taghandler_78.setProperty("act_numcomprobante"); __jsp_taghandler_78.setSize("20"); __jsp_tag_starteval=__jsp_taghandler_78.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_78,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_78.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_78.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_78); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[85]); /*@lineinfo:translated-code*//*@lineinfo:151^27*/ { org.apache.struts.taglib.bean.MessageTag __jsp_taghandler_79=(org.apache.struts.taglib.bean.MessageTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.bean.MessageTag.class,"org.apache.struts.taglib.bean.MessageTag key"); __jsp_taghandler_79.setParent(__jsp_taghandler_25); __jsp_taghandler_79.setKey("activos4.codanterior"); __jsp_tag_starteval=__jsp_taghandler_79.doStartTag(); if (OracleJspRuntime.checkStartTagEval(__jsp_tag_starteval)) { do { } while (__jsp_taghandler_79.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); } if (__jsp_taghandler_79.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_79); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[86]); /*@lineinfo:translated-code*//*@lineinfo:152^14*/ { org.apache.struts.taglib.html.TextTag __jsp_taghandler_80=(org.apache.struts.taglib.html.TextTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.TextTag.class,"org.apache.struts.taglib.html.TextTag maxlength name onchange property size"); __jsp_taghandler_80.setParent(__jsp_taghandler_25); __jsp_taghandler_80.setMaxlength("20"); __jsp_taghandler_80.setName("ActivosForm"); __jsp_taghandler_80.setOnchange("javascript:this.value=this.value.toUpperCase();"); __jsp_taghandler_80.setProperty("act_codanterior"); __jsp_taghandler_80.setSize("20"); __jsp_tag_starteval=__jsp_taghandler_80.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_80,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_80.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_80.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_80); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[87]); /*@lineinfo:translated-code*//*@lineinfo:153^27*/ { org.apache.struts.taglib.bean.MessageTag __jsp_taghandler_81=(org.apache.struts.taglib.bean.MessageTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.bean.MessageTag.class,"org.apache.struts.taglib.bean.MessageTag key"); __jsp_taghandler_81.setParent(__jsp_taghandler_25); __jsp_taghandler_81.setKey("activos4.fecha"); __jsp_tag_starteval=__jsp_taghandler_81.doStartTag(); if (OracleJspRuntime.checkStartTagEval(__jsp_tag_starteval)) { do { } while (__jsp_taghandler_81.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); } if (__jsp_taghandler_81.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_81); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[88]); /*@lineinfo:translated-code*//*@lineinfo:154^14*/ { org.apache.struts.taglib.html.TextTag __jsp_taghandler_82=(org.apache.struts.taglib.html.TextTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.TextTag.class,"org.apache.struts.taglib.html.TextTag maxlength name property size"); __jsp_taghandler_82.setParent(__jsp_taghandler_25); __jsp_taghandler_82.setMaxlength("10"); __jsp_taghandler_82.setName("ActivosForm"); __jsp_taghandler_82.setProperty("rev_fecha"); __jsp_taghandler_82.setSize("10"); __jsp_tag_starteval=__jsp_taghandler_82.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_82,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_82.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_82.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_82); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[89]); /*@lineinfo:translated-code*//*@lineinfo:157^27*/ { org.apache.struts.taglib.bean.MessageTag __jsp_taghandler_83=(org.apache.struts.taglib.bean.MessageTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.bean.MessageTag.class,"org.apache.struts.taglib.bean.MessageTag key"); __jsp_taghandler_83.setParent(__jsp_taghandler_25); __jsp_taghandler_83.setKey("activos4.vidaut"); __jsp_tag_starteval=__jsp_taghandler_83.doStartTag(); if (OracleJspRuntime.checkStartTagEval(__jsp_tag_starteval)) { do { } while (__jsp_taghandler_83.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); } if (__jsp_taghandler_83.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_83); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[90]); /*@lineinfo:translated-code*//*@lineinfo:158^14*/ { org.apache.struts.taglib.html.TextTag __jsp_taghandler_84=(org.apache.struts.taglib.html.TextTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.TextTag.class,"org.apache.struts.taglib.html.TextTag maxlength name property readonly size"); __jsp_taghandler_84.setParent(__jsp_taghandler_25); __jsp_taghandler_84.setMaxlength("4"); __jsp_taghandler_84.setName("ActivosForm"); __jsp_taghandler_84.setProperty("rev_vidaut"); __jsp_taghandler_84.setReadonly(true); __jsp_taghandler_84.setSize("4"); __jsp_tag_starteval=__jsp_taghandler_84.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_84,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_84.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_84.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_84); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[91]); /*@lineinfo:translated-code*//*@lineinfo:159^27*/ { org.apache.struts.taglib.bean.MessageTag __jsp_taghandler_85=(org.apache.struts.taglib.bean.MessageTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.bean.MessageTag.class,"org.apache.struts.taglib.bean.MessageTag key"); __jsp_taghandler_85.setParent(__jsp_taghandler_25); __jsp_taghandler_85.setKey("activos4.estadoactivo"); __jsp_tag_starteval=__jsp_taghandler_85.doStartTag(); if (OracleJspRuntime.checkStartTagEval(__jsp_tag_starteval)) { do { } while (__jsp_taghandler_85.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); } if (__jsp_taghandler_85.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_85); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[92]); /*@lineinfo:translated-code*//*@lineinfo:160^14*/ { org.apache.struts.taglib.html.SelectTag __jsp_taghandler_86=(org.apache.struts.taglib.html.SelectTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.SelectTag.class,"org.apache.struts.taglib.html.SelectTag disabled name property"); __jsp_taghandler_86.setParent(__jsp_taghandler_25); __jsp_taghandler_86.setDisabled(false); __jsp_taghandler_86.setName("ActivosForm"); __jsp_taghandler_86.setProperty("rev_estadoactivo"); __jsp_tag_starteval=__jsp_taghandler_86.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_86,__jsp_tag_starteval,out); do { /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[93]); /*@lineinfo:translated-code*//*@lineinfo:161^14*/ { org.apache.struts.taglib.html.OptionsTag __jsp_taghandler_87=(org.apache.struts.taglib.html.OptionsTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.OptionsTag.class,"org.apache.struts.taglib.html.OptionsTag collection labelProperty property"); __jsp_taghandler_87.setParent(__jsp_taghandler_86); __jsp_taghandler_87.setCollection("EstadosLista"); __jsp_taghandler_87.setLabelProperty("desestado"); __jsp_taghandler_87.setProperty("estado"); __jsp_tag_starteval=__jsp_taghandler_87.doStartTag(); if (OracleJspRuntime.checkStartTagEval(__jsp_tag_starteval)) { do { } while (__jsp_taghandler_87.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); } if (__jsp_taghandler_87.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_87); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[94]); /*@lineinfo:translated-code*//*@lineinfo:161^99*/ } while (__jsp_taghandler_86.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_86.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_86); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[95]); /*@lineinfo:translated-code*//*@lineinfo:166^27*/ { org.apache.struts.taglib.bean.MessageTag __jsp_taghandler_88=(org.apache.struts.taglib.bean.MessageTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.bean.MessageTag.class,"org.apache.struts.taglib.bean.MessageTag key"); __jsp_taghandler_88.setParent(__jsp_taghandler_25); __jsp_taghandler_88.setKey("activos4.desestado"); __jsp_tag_starteval=__jsp_taghandler_88.doStartTag(); if (OracleJspRuntime.checkStartTagEval(__jsp_tag_starteval)) { do { } while (__jsp_taghandler_88.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); } if (__jsp_taghandler_88.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_88); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[96]); /*@lineinfo:translated-code*//*@lineinfo:167^14*/ { org.apache.struts.taglib.html.TextTag __jsp_taghandler_89=(org.apache.struts.taglib.html.TextTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.TextTag.class,"org.apache.struts.taglib.html.TextTag maxlength name onchange property size"); __jsp_taghandler_89.setParent(__jsp_taghandler_25); __jsp_taghandler_89.setMaxlength("60"); __jsp_taghandler_89.setName("ActivosForm"); __jsp_taghandler_89.setOnchange("javascript:this.value=this.value.toUpperCase();"); __jsp_taghandler_89.setProperty("rev_desestado"); __jsp_taghandler_89.setSize("60"); __jsp_tag_starteval=__jsp_taghandler_89.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_89,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_89.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_89.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_89); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[97]); /*@lineinfo:translated-code*//*@lineinfo:170^24*/ { org.apache.struts.taglib.html.SubmitTag __jsp_taghandler_90=(org.apache.struts.taglib.html.SubmitTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.SubmitTag.class,"org.apache.struts.taglib.html.SubmitTag onclick property styleClass value"); __jsp_taghandler_90.setParent(__jsp_taghandler_25); __jsp_taghandler_90.setOnclick("operacion.value=2;opcion.value=1"); __jsp_taghandler_90.setProperty("boton"); __jsp_taghandler_90.setStyleClass("boton1"); __jsp_taghandler_90.setValue("Insertar"); __jsp_tag_starteval=__jsp_taghandler_90.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_90,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_90.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_90.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_90); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[98]); /*@lineinfo:translated-code*//*@lineinfo:175^12*/ { org.apache.struts.taglib.html.LinkTag __jsp_taghandler_91=(org.apache.struts.taglib.html.LinkTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.LinkTag.class,"org.apache.struts.taglib.html.LinkTag href"); __jsp_taghandler_91.setParent(__jsp_taghandler_25); __jsp_taghandler_91.setHref("javascript:pantallaCompleta('tipocambio.do');"); __jsp_tag_starteval=__jsp_taghandler_91.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_91,__jsp_tag_starteval,out); do { /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[99]); /*@lineinfo:translated-code*//*@lineinfo:175^76*/ } while (__jsp_taghandler_91.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_91.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_91); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[100]); /*@lineinfo:translated-code*//*@lineinfo:177^24*/ } while (__jsp_taghandler_25.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); } if (__jsp_taghandler_25.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_25); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[101]); /*@lineinfo:translated-code*//*@lineinfo:183^4*/ { org.apache.struts.taglib.logic.EqualTag __jsp_taghandler_92=(org.apache.struts.taglib.logic.EqualTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.logic.EqualTag.class,"org.apache.struts.taglib.logic.EqualTag name property value"); __jsp_taghandler_92.setParent(__jsp_taghandler_4); __jsp_taghandler_92.setName("ActivosForm"); __jsp_taghandler_92.setProperty("opcion"); __jsp_taghandler_92.setValue("2"); __jsp_tag_starteval=__jsp_taghandler_92.doStartTag(); if (OracleJspRuntime.checkStartTagEval(__jsp_tag_starteval)) { do { /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[102]); /*@lineinfo:translated-code*//*@lineinfo:186^27*/ { org.apache.struts.taglib.bean.MessageTag __jsp_taghandler_93=(org.apache.struts.taglib.bean.MessageTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.bean.MessageTag.class,"org.apache.struts.taglib.bean.MessageTag key"); __jsp_taghandler_93.setParent(__jsp_taghandler_92); __jsp_taghandler_93.setKey("activos4.codrub"); __jsp_tag_starteval=__jsp_taghandler_93.doStartTag(); if (OracleJspRuntime.checkStartTagEval(__jsp_tag_starteval)) { do { } while (__jsp_taghandler_93.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); } if (__jsp_taghandler_93.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_93); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[103]); /*@lineinfo:translated-code*//*@lineinfo:187^26*/ { org.apache.struts.taglib.html.TextTag __jsp_taghandler_94=(org.apache.struts.taglib.html.TextTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.TextTag.class,"org.apache.struts.taglib.html.TextTag maxlength name property readonly size"); __jsp_taghandler_94.setParent(__jsp_taghandler_92); __jsp_taghandler_94.setMaxlength("10"); __jsp_taghandler_94.setName("ActivosForm"); __jsp_taghandler_94.setProperty("act_codrub"); __jsp_taghandler_94.setReadonly(true); __jsp_taghandler_94.setSize("10"); __jsp_tag_starteval=__jsp_taghandler_94.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_94,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_94.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_94.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_94); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[104]); /*@lineinfo:translated-code*//*@lineinfo:188^10*/ { org.apache.struts.taglib.html.TextTag __jsp_taghandler_95=(org.apache.struts.taglib.html.TextTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.TextTag.class,"org.apache.struts.taglib.html.TextTag maxlength name property readonly size"); __jsp_taghandler_95.setParent(__jsp_taghandler_92); __jsp_taghandler_95.setMaxlength("60"); __jsp_taghandler_95.setName("ActivosForm"); __jsp_taghandler_95.setProperty("act_rubdescripcion"); __jsp_taghandler_95.setReadonly(true); __jsp_taghandler_95.setSize("60"); __jsp_tag_starteval=__jsp_taghandler_95.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_95,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_95.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_95.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_95); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[105]); /*@lineinfo:translated-code*//*@lineinfo:191^27*/ { org.apache.struts.taglib.bean.MessageTag __jsp_taghandler_96=(org.apache.struts.taglib.bean.MessageTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.bean.MessageTag.class,"org.apache.struts.taglib.bean.MessageTag key"); __jsp_taghandler_96.setParent(__jsp_taghandler_92); __jsp_taghandler_96.setKey("activos4.codreg"); __jsp_tag_starteval=__jsp_taghandler_96.doStartTag(); if (OracleJspRuntime.checkStartTagEval(__jsp_tag_starteval)) { do { } while (__jsp_taghandler_96.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); } if (__jsp_taghandler_96.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_96); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[106]); /*@lineinfo:translated-code*//*@lineinfo:192^26*/ { org.apache.struts.taglib.html.TextTag __jsp_taghandler_97=(org.apache.struts.taglib.html.TextTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.TextTag.class,"org.apache.struts.taglib.html.TextTag maxlength name property readonly size"); __jsp_taghandler_97.setParent(__jsp_taghandler_92); __jsp_taghandler_97.setMaxlength("10"); __jsp_taghandler_97.setName("ActivosForm"); __jsp_taghandler_97.setProperty("act_codreg"); __jsp_taghandler_97.setReadonly(true); __jsp_taghandler_97.setSize("10"); __jsp_tag_starteval=__jsp_taghandler_97.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_97,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_97.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_97.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_97); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[107]); /*@lineinfo:translated-code*//*@lineinfo:193^10*/ { org.apache.struts.taglib.html.TextTag __jsp_taghandler_98=(org.apache.struts.taglib.html.TextTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.TextTag.class,"org.apache.struts.taglib.html.TextTag maxlength name property readonly size"); __jsp_taghandler_98.setParent(__jsp_taghandler_92); __jsp_taghandler_98.setMaxlength("60"); __jsp_taghandler_98.setName("ActivosForm"); __jsp_taghandler_98.setProperty("act_regdescripcion"); __jsp_taghandler_98.setReadonly(true); __jsp_taghandler_98.setSize("60"); __jsp_tag_starteval=__jsp_taghandler_98.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_98,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_98.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_98.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_98); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[108]); /*@lineinfo:translated-code*//*@lineinfo:196^27*/ { org.apache.struts.taglib.bean.MessageTag __jsp_taghandler_99=(org.apache.struts.taglib.bean.MessageTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.bean.MessageTag.class,"org.apache.struts.taglib.bean.MessageTag key"); __jsp_taghandler_99.setParent(__jsp_taghandler_92); __jsp_taghandler_99.setKey("activos4.codigo"); __jsp_tag_starteval=__jsp_taghandler_99.doStartTag(); if (OracleJspRuntime.checkStartTagEval(__jsp_tag_starteval)) { do { } while (__jsp_taghandler_99.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); } if (__jsp_taghandler_99.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_99); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[109]); /*@lineinfo:translated-code*//*@lineinfo:197^26*/ { org.apache.struts.taglib.html.TextTag __jsp_taghandler_100=(org.apache.struts.taglib.html.TextTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.TextTag.class,"org.apache.struts.taglib.html.TextTag maxlength name property readonly size"); __jsp_taghandler_100.setParent(__jsp_taghandler_92); __jsp_taghandler_100.setMaxlength("5"); __jsp_taghandler_100.setName("ActivosForm"); __jsp_taghandler_100.setProperty("act_codigo"); __jsp_taghandler_100.setReadonly(true); __jsp_taghandler_100.setSize("5"); __jsp_tag_starteval=__jsp_taghandler_100.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_100,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_100.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_100.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_100); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[110]); /*@lineinfo:translated-code*//*@lineinfo:198^10*/ { org.apache.struts.taglib.html.TextTag __jsp_taghandler_101=(org.apache.struts.taglib.html.TextTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.TextTag.class,"org.apache.struts.taglib.html.TextTag maxlength name property readonly size"); __jsp_taghandler_101.setParent(__jsp_taghandler_92); __jsp_taghandler_101.setMaxlength("10"); __jsp_taghandler_101.setName("ActivosForm"); __jsp_taghandler_101.setProperty("act_codbarra"); __jsp_taghandler_101.setReadonly(true); __jsp_taghandler_101.setSize("10"); __jsp_tag_starteval=__jsp_taghandler_101.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_101,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_101.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_101.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_101); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[111]); /*@lineinfo:translated-code*//*@lineinfo:201^27*/ { org.apache.struts.taglib.bean.MessageTag __jsp_taghandler_102=(org.apache.struts.taglib.bean.MessageTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.bean.MessageTag.class,"org.apache.struts.taglib.bean.MessageTag key"); __jsp_taghandler_102.setParent(__jsp_taghandler_92); __jsp_taghandler_102.setKey("activos4.codgrp"); __jsp_tag_starteval=__jsp_taghandler_102.doStartTag(); if (OracleJspRuntime.checkStartTagEval(__jsp_tag_starteval)) { do { } while (__jsp_taghandler_102.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); } if (__jsp_taghandler_102.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_102); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[112]); /*@lineinfo:translated-code*//*@lineinfo:203^13*/ { org.apache.struts.taglib.html.SelectTag __jsp_taghandler_103=(org.apache.struts.taglib.html.SelectTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.SelectTag.class,"org.apache.struts.taglib.html.SelectTag disabled name onkeypress property"); __jsp_taghandler_103.setParent(__jsp_taghandler_92); __jsp_taghandler_103.setDisabled(false); __jsp_taghandler_103.setName("ActivosForm"); __jsp_taghandler_103.setOnkeypress("return handleEnter(this, event)"); __jsp_taghandler_103.setProperty("act_codgrp"); __jsp_tag_starteval=__jsp_taghandler_103.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_103,__jsp_tag_starteval,out); do { /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[113]); /*@lineinfo:translated-code*//*@lineinfo:204^16*/ { org.apache.struts.taglib.html.OptionsTag __jsp_taghandler_104=(org.apache.struts.taglib.html.OptionsTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.OptionsTag.class,"org.apache.struts.taglib.html.OptionsTag collection labelProperty property"); __jsp_taghandler_104.setParent(__jsp_taghandler_103); __jsp_taghandler_104.setCollection("GruposLista"); __jsp_taghandler_104.setLabelProperty("descripcion"); __jsp_taghandler_104.setProperty("codigo"); __jsp_tag_starteval=__jsp_taghandler_104.doStartTag(); if (OracleJspRuntime.checkStartTagEval(__jsp_tag_starteval)) { do { } while (__jsp_taghandler_104.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); } if (__jsp_taghandler_104.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_104); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[114]); /*@lineinfo:translated-code*//*@lineinfo:204^102*/ } while (__jsp_taghandler_103.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_103.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_103); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[115]); /*@lineinfo:translated-code*//*@lineinfo:207^27*/ { org.apache.struts.taglib.bean.MessageTag __jsp_taghandler_105=(org.apache.struts.taglib.bean.MessageTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.bean.MessageTag.class,"org.apache.struts.taglib.bean.MessageTag key"); __jsp_taghandler_105.setParent(__jsp_taghandler_92); __jsp_taghandler_105.setKey("activos4.codpar"); __jsp_tag_starteval=__jsp_taghandler_105.doStartTag(); if (OracleJspRuntime.checkStartTagEval(__jsp_tag_starteval)) { do { } while (__jsp_taghandler_105.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); } if (__jsp_taghandler_105.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_105); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[116]); /*@lineinfo:translated-code*//*@lineinfo:209^15*/ { org.apache.struts.taglib.html.TextTag __jsp_taghandler_106=(org.apache.struts.taglib.html.TextTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.TextTag.class,"org.apache.struts.taglib.html.TextTag maxlength name property readonly size"); __jsp_taghandler_106.setParent(__jsp_taghandler_92); __jsp_taghandler_106.setMaxlength("40"); __jsp_taghandler_106.setName("ActivosForm"); __jsp_taghandler_106.setProperty("act_pardescripcion"); __jsp_taghandler_106.setReadonly(true); __jsp_taghandler_106.setSize("40"); __jsp_tag_starteval=__jsp_taghandler_106.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_106,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_106.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_106.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_106); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[117]); /*@lineinfo:translated-code*//*@lineinfo:213^27*/ { org.apache.struts.taglib.bean.MessageTag __jsp_taghandler_107=(org.apache.struts.taglib.bean.MessageTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.bean.MessageTag.class,"org.apache.struts.taglib.bean.MessageTag key"); __jsp_taghandler_107.setParent(__jsp_taghandler_92); __jsp_taghandler_107.setKey("activos4.codofi"); __jsp_tag_starteval=__jsp_taghandler_107.doStartTag(); if (OracleJspRuntime.checkStartTagEval(__jsp_tag_starteval)) { do { } while (__jsp_taghandler_107.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); } if (__jsp_taghandler_107.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_107); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[118]); /*@lineinfo:translated-code*//*@lineinfo:215^10*/ { org.apache.struts.taglib.html.TextTag __jsp_taghandler_108=(org.apache.struts.taglib.html.TextTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.TextTag.class,"org.apache.struts.taglib.html.TextTag maxlength name property readonly size"); __jsp_taghandler_108.setParent(__jsp_taghandler_92); __jsp_taghandler_108.setMaxlength("40"); __jsp_taghandler_108.setName("ActivosForm"); __jsp_taghandler_108.setProperty("act_ofidescripcion"); __jsp_taghandler_108.setReadonly(true); __jsp_taghandler_108.setSize("40"); __jsp_tag_starteval=__jsp_taghandler_108.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_108,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_108.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_108.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_108); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[119]); /*@lineinfo:translated-code*//*@lineinfo:217^27*/ { org.apache.struts.taglib.bean.MessageTag __jsp_taghandler_109=(org.apache.struts.taglib.bean.MessageTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.bean.MessageTag.class,"org.apache.struts.taglib.bean.MessageTag key"); __jsp_taghandler_109.setParent(__jsp_taghandler_92); __jsp_taghandler_109.setKey("activos4.codfun"); __jsp_tag_starteval=__jsp_taghandler_109.doStartTag(); if (OracleJspRuntime.checkStartTagEval(__jsp_tag_starteval)) { do { } while (__jsp_taghandler_109.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); } if (__jsp_taghandler_109.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_109); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[120]); /*@lineinfo:translated-code*//*@lineinfo:219^10*/ { org.apache.struts.taglib.html.TextTag __jsp_taghandler_110=(org.apache.struts.taglib.html.TextTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.TextTag.class,"org.apache.struts.taglib.html.TextTag maxlength name property readonly size"); __jsp_taghandler_110.setParent(__jsp_taghandler_92); __jsp_taghandler_110.setMaxlength("40"); __jsp_taghandler_110.setName("ActivosForm"); __jsp_taghandler_110.setProperty("act_fundescripcion"); __jsp_taghandler_110.setReadonly(true); __jsp_taghandler_110.setSize("40"); __jsp_tag_starteval=__jsp_taghandler_110.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_110,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_110.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_110.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_110); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[121]); /*@lineinfo:translated-code*//*@lineinfo:223^27*/ { org.apache.struts.taglib.bean.MessageTag __jsp_taghandler_111=(org.apache.struts.taglib.bean.MessageTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.bean.MessageTag.class,"org.apache.struts.taglib.bean.MessageTag key"); __jsp_taghandler_111.setParent(__jsp_taghandler_92); __jsp_taghandler_111.setKey("activos4.codubi"); __jsp_tag_starteval=__jsp_taghandler_111.doStartTag(); if (OracleJspRuntime.checkStartTagEval(__jsp_tag_starteval)) { do { } while (__jsp_taghandler_111.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); } if (__jsp_taghandler_111.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_111); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[122]); /*@lineinfo:translated-code*//*@lineinfo:225^15*/ { org.apache.struts.taglib.html.TextTag __jsp_taghandler_112=(org.apache.struts.taglib.html.TextTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.TextTag.class,"org.apache.struts.taglib.html.TextTag maxlength name property readonly size"); __jsp_taghandler_112.setParent(__jsp_taghandler_92); __jsp_taghandler_112.setMaxlength("40"); __jsp_taghandler_112.setName("ActivosForm"); __jsp_taghandler_112.setProperty("act_ubidescripcion"); __jsp_taghandler_112.setReadonly(true); __jsp_taghandler_112.setSize("40"); __jsp_tag_starteval=__jsp_taghandler_112.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_112,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_112.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_112.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_112); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[123]); /*@lineinfo:translated-code*//*@lineinfo:227^27*/ { org.apache.struts.taglib.bean.MessageTag __jsp_taghandler_113=(org.apache.struts.taglib.bean.MessageTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.bean.MessageTag.class,"org.apache.struts.taglib.bean.MessageTag key"); __jsp_taghandler_113.setParent(__jsp_taghandler_92); __jsp_taghandler_113.setKey("activos4.codpry"); __jsp_tag_starteval=__jsp_taghandler_113.doStartTag(); if (OracleJspRuntime.checkStartTagEval(__jsp_tag_starteval)) { do { } while (__jsp_taghandler_113.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); } if (__jsp_taghandler_113.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_113); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[124]); /*@lineinfo:translated-code*//*@lineinfo:228^14*/ { org.apache.struts.taglib.html.SelectTag __jsp_taghandler_114=(org.apache.struts.taglib.html.SelectTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.SelectTag.class,"org.apache.struts.taglib.html.SelectTag disabled name property"); __jsp_taghandler_114.setParent(__jsp_taghandler_92); __jsp_taghandler_114.setDisabled(false); __jsp_taghandler_114.setName("ActivosForm"); __jsp_taghandler_114.setProperty("act_codpry"); __jsp_tag_starteval=__jsp_taghandler_114.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_114,__jsp_tag_starteval,out); do { /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[125]); /*@lineinfo:translated-code*//*@lineinfo:229^15*/ { org.apache.struts.taglib.html.OptionsTag __jsp_taghandler_115=(org.apache.struts.taglib.html.OptionsTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.OptionsTag.class,"org.apache.struts.taglib.html.OptionsTag collection labelProperty property"); __jsp_taghandler_115.setParent(__jsp_taghandler_114); __jsp_taghandler_115.setCollection("ProyectosLista"); __jsp_taghandler_115.setLabelProperty("descripcion"); __jsp_taghandler_115.setProperty("codigo"); __jsp_tag_starteval=__jsp_taghandler_115.doStartTag(); if (OracleJspRuntime.checkStartTagEval(__jsp_tag_starteval)) { do { } while (__jsp_taghandler_115.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); } if (__jsp_taghandler_115.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_115); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[126]); /*@lineinfo:translated-code*//*@lineinfo:229^104*/ } while (__jsp_taghandler_114.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_114.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_114); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[127]); /*@lineinfo:translated-code*//*@lineinfo:234^27*/ { org.apache.struts.taglib.bean.MessageTag __jsp_taghandler_116=(org.apache.struts.taglib.bean.MessageTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.bean.MessageTag.class,"org.apache.struts.taglib.bean.MessageTag key"); __jsp_taghandler_116.setParent(__jsp_taghandler_92); __jsp_taghandler_116.setKey("activos4.codfin"); __jsp_tag_starteval=__jsp_taghandler_116.doStartTag(); if (OracleJspRuntime.checkStartTagEval(__jsp_tag_starteval)) { do { } while (__jsp_taghandler_116.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); } if (__jsp_taghandler_116.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_116); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[128]); /*@lineinfo:translated-code*//*@lineinfo:236^15*/ { org.apache.struts.taglib.html.TextTag __jsp_taghandler_117=(org.apache.struts.taglib.html.TextTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.TextTag.class,"org.apache.struts.taglib.html.TextTag maxlength name property readonly size"); __jsp_taghandler_117.setParent(__jsp_taghandler_92); __jsp_taghandler_117.setMaxlength("40"); __jsp_taghandler_117.setName("ActivosForm"); __jsp_taghandler_117.setProperty("act_findescripcion"); __jsp_taghandler_117.setReadonly(true); __jsp_taghandler_117.setSize("40"); __jsp_tag_starteval=__jsp_taghandler_117.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_117,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_117.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_117.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_117); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[129]); /*@lineinfo:translated-code*//*@lineinfo:240^27*/ { org.apache.struts.taglib.bean.MessageTag __jsp_taghandler_118=(org.apache.struts.taglib.bean.MessageTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.bean.MessageTag.class,"org.apache.struts.taglib.bean.MessageTag key"); __jsp_taghandler_118.setParent(__jsp_taghandler_92); __jsp_taghandler_118.setKey("activos4.feccompra"); __jsp_tag_starteval=__jsp_taghandler_118.doStartTag(); if (OracleJspRuntime.checkStartTagEval(__jsp_tag_starteval)) { do { } while (__jsp_taghandler_118.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); } if (__jsp_taghandler_118.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_118); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[130]); /*@lineinfo:translated-code*//*@lineinfo:241^14*/ { org.apache.struts.taglib.html.TextTag __jsp_taghandler_119=(org.apache.struts.taglib.html.TextTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.TextTag.class,"org.apache.struts.taglib.html.TextTag maxlength name property size"); __jsp_taghandler_119.setParent(__jsp_taghandler_92); __jsp_taghandler_119.setMaxlength("10"); __jsp_taghandler_119.setName("ActivosForm"); __jsp_taghandler_119.setProperty("act_feccompra"); __jsp_taghandler_119.setSize("10"); __jsp_tag_starteval=__jsp_taghandler_119.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_119,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_119.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_119.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_119); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[131]); /*@lineinfo:translated-code*//*@lineinfo:242^27*/ { org.apache.struts.taglib.bean.MessageTag __jsp_taghandler_120=(org.apache.struts.taglib.bean.MessageTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.bean.MessageTag.class,"org.apache.struts.taglib.bean.MessageTag key"); __jsp_taghandler_120.setParent(__jsp_taghandler_92); __jsp_taghandler_120.setKey("activos4.umanejo"); __jsp_tag_starteval=__jsp_taghandler_120.doStartTag(); if (OracleJspRuntime.checkStartTagEval(__jsp_tag_starteval)) { do { } while (__jsp_taghandler_120.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); } if (__jsp_taghandler_120.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_120); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[132]); /*@lineinfo:translated-code*//*@lineinfo:243^14*/ { org.apache.struts.taglib.html.TextTag __jsp_taghandler_121=(org.apache.struts.taglib.html.TextTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.TextTag.class,"org.apache.struts.taglib.html.TextTag maxlength name onchange property size"); __jsp_taghandler_121.setParent(__jsp_taghandler_92); __jsp_taghandler_121.setMaxlength("20"); __jsp_taghandler_121.setName("ActivosForm"); __jsp_taghandler_121.setOnchange("javascript:this.value=this.value.toUpperCase();"); __jsp_taghandler_121.setProperty("act_umanejo"); __jsp_taghandler_121.setSize("20"); __jsp_tag_starteval=__jsp_taghandler_121.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_121,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_121.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_121.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_121); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[133]); /*@lineinfo:translated-code*//*@lineinfo:248^27*/ { org.apache.struts.taglib.bean.MessageTag __jsp_taghandler_122=(org.apache.struts.taglib.bean.MessageTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.bean.MessageTag.class,"org.apache.struts.taglib.bean.MessageTag key"); __jsp_taghandler_122.setParent(__jsp_taghandler_92); __jsp_taghandler_122.setKey("activos4.descripcion"); __jsp_tag_starteval=__jsp_taghandler_122.doStartTag(); if (OracleJspRuntime.checkStartTagEval(__jsp_tag_starteval)) { do { } while (__jsp_taghandler_122.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); } if (__jsp_taghandler_122.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_122); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[134]); /*@lineinfo:translated-code*//*@lineinfo:249^14*/ { org.apache.struts.taglib.html.TextTag __jsp_taghandler_123=(org.apache.struts.taglib.html.TextTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.TextTag.class,"org.apache.struts.taglib.html.TextTag maxlength name onchange property size"); __jsp_taghandler_123.setParent(__jsp_taghandler_92); __jsp_taghandler_123.setMaxlength("120"); __jsp_taghandler_123.setName("ActivosForm"); __jsp_taghandler_123.setOnchange("javascript:this.value=this.value.toUpperCase();"); __jsp_taghandler_123.setProperty("act_descripcion"); __jsp_taghandler_123.setSize("60"); __jsp_tag_starteval=__jsp_taghandler_123.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_123,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_123.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_123.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_123); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[135]); /*@lineinfo:translated-code*//*@lineinfo:252^27*/ { org.apache.struts.taglib.bean.MessageTag __jsp_taghandler_124=(org.apache.struts.taglib.bean.MessageTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.bean.MessageTag.class,"org.apache.struts.taglib.bean.MessageTag key"); __jsp_taghandler_124.setParent(__jsp_taghandler_92); __jsp_taghandler_124.setKey("activos4.desadicional"); __jsp_tag_starteval=__jsp_taghandler_124.doStartTag(); if (OracleJspRuntime.checkStartTagEval(__jsp_tag_starteval)) { do { } while (__jsp_taghandler_124.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); } if (__jsp_taghandler_124.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_124); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[136]); /*@lineinfo:translated-code*//*@lineinfo:253^14*/ { org.apache.struts.taglib.html.TextTag __jsp_taghandler_125=(org.apache.struts.taglib.html.TextTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.TextTag.class,"org.apache.struts.taglib.html.TextTag maxlength name onchange property size"); __jsp_taghandler_125.setParent(__jsp_taghandler_92); __jsp_taghandler_125.setMaxlength("240"); __jsp_taghandler_125.setName("ActivosForm"); __jsp_taghandler_125.setOnchange("javascript:this.value=this.value.toUpperCase();"); __jsp_taghandler_125.setProperty("act_desadicional"); __jsp_taghandler_125.setSize("60"); __jsp_tag_starteval=__jsp_taghandler_125.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_125,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_125.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_125.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_125); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[137]); /*@lineinfo:translated-code*//*@lineinfo:257^13*/ { org.apache.struts.taglib.bean.MessageTag __jsp_taghandler_126=(org.apache.struts.taglib.bean.MessageTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.bean.MessageTag.class,"org.apache.struts.taglib.bean.MessageTag key"); __jsp_taghandler_126.setParent(__jsp_taghandler_92); __jsp_taghandler_126.setKey("activos.proveedor"); __jsp_tag_starteval=__jsp_taghandler_126.doStartTag(); if (OracleJspRuntime.checkStartTagEval(__jsp_tag_starteval)) { do { } while (__jsp_taghandler_126.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); } if (__jsp_taghandler_126.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_126); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[138]); /*@lineinfo:translated-code*//*@lineinfo:260^13*/ { org.apache.struts.taglib.html.TextTag __jsp_taghandler_127=(org.apache.struts.taglib.html.TextTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.TextTag.class,"org.apache.struts.taglib.html.TextTag maxlength name onchange property size"); __jsp_taghandler_127.setParent(__jsp_taghandler_92); __jsp_taghandler_127.setMaxlength("50"); __jsp_taghandler_127.setName("ActivosForm"); __jsp_taghandler_127.setOnchange("javascript:this.value=this.value.toUpperCase();"); __jsp_taghandler_127.setProperty("act_proveedor"); __jsp_taghandler_127.setSize("50"); __jsp_tag_starteval=__jsp_taghandler_127.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_127,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_127.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_127.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_127); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[139]); /*@lineinfo:translated-code*//*@lineinfo:266^27*/ { org.apache.struts.taglib.logic.EqualTag __jsp_taghandler_128=(org.apache.struts.taglib.logic.EqualTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.logic.EqualTag.class,"org.apache.struts.taglib.logic.EqualTag name property value"); __jsp_taghandler_128.setParent(__jsp_taghandler_92); __jsp_taghandler_128.setName("ActivosForm"); __jsp_taghandler_128.setProperty("act_codrub"); __jsp_taghandler_128.setValue("08"); __jsp_tag_starteval=__jsp_taghandler_128.doStartTag(); if (OracleJspRuntime.checkStartTagEval(__jsp_tag_starteval)) { do { /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[140]); /*@lineinfo:translated-code*//*@lineinfo:266^92*/ } while (__jsp_taghandler_128.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); } if (__jsp_taghandler_128.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_128); } /*@lineinfo:266^107*/ { org.apache.struts.taglib.bean.MessageTag __jsp_taghandler_129=(org.apache.struts.taglib.bean.MessageTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.bean.MessageTag.class,"org.apache.struts.taglib.bean.MessageTag key"); __jsp_taghandler_129.setParent(__jsp_taghandler_92); __jsp_taghandler_129.setKey("activos4.marca"); __jsp_tag_starteval=__jsp_taghandler_129.doStartTag(); if (OracleJspRuntime.checkStartTagEval(__jsp_tag_starteval)) { do { } while (__jsp_taghandler_129.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); } if (__jsp_taghandler_129.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_129); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[141]); /*@lineinfo:translated-code*//*@lineinfo:267^14*/ { org.apache.struts.taglib.html.TextTag __jsp_taghandler_130=(org.apache.struts.taglib.html.TextTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.TextTag.class,"org.apache.struts.taglib.html.TextTag maxlength name onchange property size"); __jsp_taghandler_130.setParent(__jsp_taghandler_92); __jsp_taghandler_130.setMaxlength("30"); __jsp_taghandler_130.setName("ActivosForm"); __jsp_taghandler_130.setOnchange("javascript:this.value=this.value.toUpperCase();"); __jsp_taghandler_130.setProperty("act_marca"); __jsp_taghandler_130.setSize("30"); __jsp_tag_starteval=__jsp_taghandler_130.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_130,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_130.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_130.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_130); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[142]); /*@lineinfo:translated-code*//*@lineinfo:268^27*/ { org.apache.struts.taglib.bean.MessageTag __jsp_taghandler_131=(org.apache.struts.taglib.bean.MessageTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.bean.MessageTag.class,"org.apache.struts.taglib.bean.MessageTag key"); __jsp_taghandler_131.setParent(__jsp_taghandler_92); __jsp_taghandler_131.setKey("activos4.color"); __jsp_tag_starteval=__jsp_taghandler_131.doStartTag(); if (OracleJspRuntime.checkStartTagEval(__jsp_tag_starteval)) { do { } while (__jsp_taghandler_131.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); } if (__jsp_taghandler_131.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_131); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[143]); /*@lineinfo:translated-code*//*@lineinfo:269^14*/ { org.apache.struts.taglib.html.TextTag __jsp_taghandler_132=(org.apache.struts.taglib.html.TextTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.TextTag.class,"org.apache.struts.taglib.html.TextTag maxlength name onchange property size"); __jsp_taghandler_132.setParent(__jsp_taghandler_92); __jsp_taghandler_132.setMaxlength("30"); __jsp_taghandler_132.setName("ActivosForm"); __jsp_taghandler_132.setOnchange("javascript:this.value=this.value.toUpperCase();"); __jsp_taghandler_132.setProperty("act_color"); __jsp_taghandler_132.setSize("30"); __jsp_tag_starteval=__jsp_taghandler_132.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_132,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_132.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_132.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_132); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[144]); /*@lineinfo:translated-code*//*@lineinfo:272^27*/ { org.apache.struts.taglib.bean.MessageTag __jsp_taghandler_133=(org.apache.struts.taglib.bean.MessageTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.bean.MessageTag.class,"org.apache.struts.taglib.bean.MessageTag key"); __jsp_taghandler_133.setParent(__jsp_taghandler_92); __jsp_taghandler_133.setKey("activos4.procedencia"); __jsp_tag_starteval=__jsp_taghandler_133.doStartTag(); if (OracleJspRuntime.checkStartTagEval(__jsp_tag_starteval)) { do { } while (__jsp_taghandler_133.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); } if (__jsp_taghandler_133.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_133); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[145]); /*@lineinfo:translated-code*//*@lineinfo:273^14*/ { org.apache.struts.taglib.html.TextTag __jsp_taghandler_134=(org.apache.struts.taglib.html.TextTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.TextTag.class,"org.apache.struts.taglib.html.TextTag maxlength name onchange property size"); __jsp_taghandler_134.setParent(__jsp_taghandler_92); __jsp_taghandler_134.setMaxlength("30"); __jsp_taghandler_134.setName("ActivosForm"); __jsp_taghandler_134.setOnchange("javascript:this.value=this.value.toUpperCase();"); __jsp_taghandler_134.setProperty("act_procedencia"); __jsp_taghandler_134.setSize("30"); __jsp_tag_starteval=__jsp_taghandler_134.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_134,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_134.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_134.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_134); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[146]); /*@lineinfo:translated-code*//*@lineinfo:274^27*/ { org.apache.struts.taglib.bean.MessageTag __jsp_taghandler_135=(org.apache.struts.taglib.bean.MessageTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.bean.MessageTag.class,"org.apache.struts.taglib.bean.MessageTag key"); __jsp_taghandler_135.setParent(__jsp_taghandler_92); __jsp_taghandler_135.setKey("activos4.gobmunicipal"); __jsp_tag_starteval=__jsp_taghandler_135.doStartTag(); if (OracleJspRuntime.checkStartTagEval(__jsp_tag_starteval)) { do { } while (__jsp_taghandler_135.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); } if (__jsp_taghandler_135.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_135); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[147]); /*@lineinfo:translated-code*//*@lineinfo:275^14*/ { org.apache.struts.taglib.html.TextTag __jsp_taghandler_136=(org.apache.struts.taglib.html.TextTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.TextTag.class,"org.apache.struts.taglib.html.TextTag maxlength name onchange property size"); __jsp_taghandler_136.setParent(__jsp_taghandler_92); __jsp_taghandler_136.setMaxlength("60"); __jsp_taghandler_136.setName("ActivosForm"); __jsp_taghandler_136.setOnchange("javascript:this.value=this.value.toUpperCase();"); __jsp_taghandler_136.setProperty("act_gobmunicipal"); __jsp_taghandler_136.setSize("30"); __jsp_tag_starteval=__jsp_taghandler_136.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_136,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_136.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_136.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_136); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[148]); /*@lineinfo:translated-code*//*@lineinfo:278^27*/ { org.apache.struts.taglib.bean.MessageTag __jsp_taghandler_137=(org.apache.struts.taglib.bean.MessageTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.bean.MessageTag.class,"org.apache.struts.taglib.bean.MessageTag key"); __jsp_taghandler_137.setParent(__jsp_taghandler_92); __jsp_taghandler_137.setKey("activos4.valcobol"); __jsp_tag_starteval=__jsp_taghandler_137.doStartTag(); if (OracleJspRuntime.checkStartTagEval(__jsp_tag_starteval)) { do { } while (__jsp_taghandler_137.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); } if (__jsp_taghandler_137.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_137); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[149]); /*@lineinfo:translated-code*//*@lineinfo:279^14*/ { org.apache.struts.taglib.html.TextTag __jsp_taghandler_138=(org.apache.struts.taglib.html.TextTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.TextTag.class,"org.apache.struts.taglib.html.TextTag maxlength name property size"); __jsp_taghandler_138.setParent(__jsp_taghandler_92); __jsp_taghandler_138.setMaxlength("15"); __jsp_taghandler_138.setName("ActivosForm"); __jsp_taghandler_138.setProperty("act_valcobol"); __jsp_taghandler_138.setSize("15"); __jsp_tag_starteval=__jsp_taghandler_138.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_138,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_138.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_138.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_138); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[150]); /*@lineinfo:translated-code*//*@lineinfo:280^27*/ { org.apache.struts.taglib.bean.MessageTag __jsp_taghandler_139=(org.apache.struts.taglib.bean.MessageTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.bean.MessageTag.class,"org.apache.struts.taglib.bean.MessageTag key"); __jsp_taghandler_139.setParent(__jsp_taghandler_92); __jsp_taghandler_139.setKey("activos4.ordencompra"); __jsp_tag_starteval=__jsp_taghandler_139.doStartTag(); if (OracleJspRuntime.checkStartTagEval(__jsp_tag_starteval)) { do { } while (__jsp_taghandler_139.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); } if (__jsp_taghandler_139.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_139); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[151]); /*@lineinfo:translated-code*//*@lineinfo:281^14*/ { org.apache.struts.taglib.html.TextTag __jsp_taghandler_140=(org.apache.struts.taglib.html.TextTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.TextTag.class,"org.apache.struts.taglib.html.TextTag maxlength name property size"); __jsp_taghandler_140.setParent(__jsp_taghandler_92); __jsp_taghandler_140.setMaxlength("20"); __jsp_taghandler_140.setName("ActivosForm"); __jsp_taghandler_140.setProperty("act_ordencompra"); __jsp_taghandler_140.setSize("20"); __jsp_tag_starteval=__jsp_taghandler_140.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_140,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_140.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_140.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_140); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[152]); /*@lineinfo:translated-code*//*@lineinfo:284^27*/ { org.apache.struts.taglib.bean.MessageTag __jsp_taghandler_141=(org.apache.struts.taglib.bean.MessageTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.bean.MessageTag.class,"org.apache.struts.taglib.bean.MessageTag key"); __jsp_taghandler_141.setParent(__jsp_taghandler_92); __jsp_taghandler_141.setKey("activos4.numfactura"); __jsp_tag_starteval=__jsp_taghandler_141.doStartTag(); if (OracleJspRuntime.checkStartTagEval(__jsp_tag_starteval)) { do { } while (__jsp_taghandler_141.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); } if (__jsp_taghandler_141.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_141); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[153]); /*@lineinfo:translated-code*//*@lineinfo:285^14*/ { org.apache.struts.taglib.html.TextTag __jsp_taghandler_142=(org.apache.struts.taglib.html.TextTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.TextTag.class,"org.apache.struts.taglib.html.TextTag maxlength name property size"); __jsp_taghandler_142.setParent(__jsp_taghandler_92); __jsp_taghandler_142.setMaxlength("12"); __jsp_taghandler_142.setName("ActivosForm"); __jsp_taghandler_142.setProperty("act_numfactura"); __jsp_taghandler_142.setSize("12"); __jsp_tag_starteval=__jsp_taghandler_142.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_142,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_142.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_142.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_142); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[154]); /*@lineinfo:translated-code*//*@lineinfo:286^27*/ { org.apache.struts.taglib.bean.MessageTag __jsp_taghandler_143=(org.apache.struts.taglib.bean.MessageTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.bean.MessageTag.class,"org.apache.struts.taglib.bean.MessageTag key"); __jsp_taghandler_143.setParent(__jsp_taghandler_92); __jsp_taghandler_143.setKey("activos4.numcomprobante"); __jsp_tag_starteval=__jsp_taghandler_143.doStartTag(); if (OracleJspRuntime.checkStartTagEval(__jsp_tag_starteval)) { do { } while (__jsp_taghandler_143.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); } if (__jsp_taghandler_143.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_143); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[155]); /*@lineinfo:translated-code*//*@lineinfo:287^14*/ { org.apache.struts.taglib.html.TextTag __jsp_taghandler_144=(org.apache.struts.taglib.html.TextTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.TextTag.class,"org.apache.struts.taglib.html.TextTag maxlength name property size"); __jsp_taghandler_144.setParent(__jsp_taghandler_92); __jsp_taghandler_144.setMaxlength("20"); __jsp_taghandler_144.setName("ActivosForm"); __jsp_taghandler_144.setProperty("act_numcomprobante"); __jsp_taghandler_144.setSize("20"); __jsp_tag_starteval=__jsp_taghandler_144.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_144,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_144.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_144.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_144); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[156]); /*@lineinfo:translated-code*//*@lineinfo:290^27*/ { org.apache.struts.taglib.bean.MessageTag __jsp_taghandler_145=(org.apache.struts.taglib.bean.MessageTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.bean.MessageTag.class,"org.apache.struts.taglib.bean.MessageTag key"); __jsp_taghandler_145.setParent(__jsp_taghandler_92); __jsp_taghandler_145.setKey("activos4.codanterior"); __jsp_tag_starteval=__jsp_taghandler_145.doStartTag(); if (OracleJspRuntime.checkStartTagEval(__jsp_tag_starteval)) { do { } while (__jsp_taghandler_145.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); } if (__jsp_taghandler_145.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_145); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[157]); /*@lineinfo:translated-code*//*@lineinfo:291^14*/ { org.apache.struts.taglib.html.TextTag __jsp_taghandler_146=(org.apache.struts.taglib.html.TextTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.TextTag.class,"org.apache.struts.taglib.html.TextTag maxlength name onchange property size"); __jsp_taghandler_146.setParent(__jsp_taghandler_92); __jsp_taghandler_146.setMaxlength("20"); __jsp_taghandler_146.setName("ActivosForm"); __jsp_taghandler_146.setOnchange("javascript:this.value=this.value.toUpperCase();"); __jsp_taghandler_146.setProperty("act_codanterior"); __jsp_taghandler_146.setSize("20"); __jsp_tag_starteval=__jsp_taghandler_146.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_146,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_146.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_146.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_146); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[158]); /*@lineinfo:translated-code*//*@lineinfo:292^27*/ { org.apache.struts.taglib.bean.MessageTag __jsp_taghandler_147=(org.apache.struts.taglib.bean.MessageTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.bean.MessageTag.class,"org.apache.struts.taglib.bean.MessageTag key"); __jsp_taghandler_147.setParent(__jsp_taghandler_92); __jsp_taghandler_147.setKey("activos4.fecha"); __jsp_tag_starteval=__jsp_taghandler_147.doStartTag(); if (OracleJspRuntime.checkStartTagEval(__jsp_tag_starteval)) { do { } while (__jsp_taghandler_147.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); } if (__jsp_taghandler_147.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_147); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[159]); /*@lineinfo:translated-code*//*@lineinfo:293^14*/ { org.apache.struts.taglib.html.TextTag __jsp_taghandler_148=(org.apache.struts.taglib.html.TextTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.TextTag.class,"org.apache.struts.taglib.html.TextTag maxlength name property size"); __jsp_taghandler_148.setParent(__jsp_taghandler_92); __jsp_taghandler_148.setMaxlength("10"); __jsp_taghandler_148.setName("ActivosForm"); __jsp_taghandler_148.setProperty("rev_fecha"); __jsp_taghandler_148.setSize("10"); __jsp_tag_starteval=__jsp_taghandler_148.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_148,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_148.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_148.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_148); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[160]); /*@lineinfo:translated-code*//*@lineinfo:296^27*/ { org.apache.struts.taglib.bean.MessageTag __jsp_taghandler_149=(org.apache.struts.taglib.bean.MessageTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.bean.MessageTag.class,"org.apache.struts.taglib.bean.MessageTag key"); __jsp_taghandler_149.setParent(__jsp_taghandler_92); __jsp_taghandler_149.setKey("activos4.vidaut"); __jsp_tag_starteval=__jsp_taghandler_149.doStartTag(); if (OracleJspRuntime.checkStartTagEval(__jsp_tag_starteval)) { do { } while (__jsp_taghandler_149.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); } if (__jsp_taghandler_149.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_149); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[161]); /*@lineinfo:translated-code*//*@lineinfo:297^14*/ { org.apache.struts.taglib.html.TextTag __jsp_taghandler_150=(org.apache.struts.taglib.html.TextTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.TextTag.class,"org.apache.struts.taglib.html.TextTag maxlength name property readonly size"); __jsp_taghandler_150.setParent(__jsp_taghandler_92); __jsp_taghandler_150.setMaxlength("4"); __jsp_taghandler_150.setName("ActivosForm"); __jsp_taghandler_150.setProperty("rev_vidaut"); __jsp_taghandler_150.setReadonly(true); __jsp_taghandler_150.setSize("4"); __jsp_tag_starteval=__jsp_taghandler_150.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_150,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_150.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_150.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_150); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[162]); /*@lineinfo:translated-code*//*@lineinfo:298^27*/ { org.apache.struts.taglib.bean.MessageTag __jsp_taghandler_151=(org.apache.struts.taglib.bean.MessageTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.bean.MessageTag.class,"org.apache.struts.taglib.bean.MessageTag key"); __jsp_taghandler_151.setParent(__jsp_taghandler_92); __jsp_taghandler_151.setKey("activos4.estadoactivo"); __jsp_tag_starteval=__jsp_taghandler_151.doStartTag(); if (OracleJspRuntime.checkStartTagEval(__jsp_tag_starteval)) { do { } while (__jsp_taghandler_151.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); } if (__jsp_taghandler_151.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_151); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[163]); /*@lineinfo:translated-code*//*@lineinfo:299^14*/ { org.apache.struts.taglib.html.SelectTag __jsp_taghandler_152=(org.apache.struts.taglib.html.SelectTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.SelectTag.class,"org.apache.struts.taglib.html.SelectTag disabled name property"); __jsp_taghandler_152.setParent(__jsp_taghandler_92); __jsp_taghandler_152.setDisabled(false); __jsp_taghandler_152.setName("ActivosForm"); __jsp_taghandler_152.setProperty("rev_estadoactivo"); __jsp_tag_starteval=__jsp_taghandler_152.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_152,__jsp_tag_starteval,out); do { /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[164]); /*@lineinfo:translated-code*//*@lineinfo:300^14*/ { org.apache.struts.taglib.html.OptionsTag __jsp_taghandler_153=(org.apache.struts.taglib.html.OptionsTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.OptionsTag.class,"org.apache.struts.taglib.html.OptionsTag collection labelProperty property"); __jsp_taghandler_153.setParent(__jsp_taghandler_152); __jsp_taghandler_153.setCollection("EstadosLista"); __jsp_taghandler_153.setLabelProperty("desestado"); __jsp_taghandler_153.setProperty("estado"); __jsp_tag_starteval=__jsp_taghandler_153.doStartTag(); if (OracleJspRuntime.checkStartTagEval(__jsp_tag_starteval)) { do { } while (__jsp_taghandler_153.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); } if (__jsp_taghandler_153.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_153); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[165]); /*@lineinfo:translated-code*//*@lineinfo:300^99*/ } while (__jsp_taghandler_152.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_152.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_152); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[166]); /*@lineinfo:translated-code*//*@lineinfo:306^27*/ { org.apache.struts.taglib.bean.MessageTag __jsp_taghandler_154=(org.apache.struts.taglib.bean.MessageTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.bean.MessageTag.class,"org.apache.struts.taglib.bean.MessageTag key"); __jsp_taghandler_154.setParent(__jsp_taghandler_92); __jsp_taghandler_154.setKey("activos4.desestado"); __jsp_tag_starteval=__jsp_taghandler_154.doStartTag(); if (OracleJspRuntime.checkStartTagEval(__jsp_tag_starteval)) { do { } while (__jsp_taghandler_154.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); } if (__jsp_taghandler_154.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_154); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[167]); /*@lineinfo:translated-code*//*@lineinfo:307^14*/ { org.apache.struts.taglib.html.TextTag __jsp_taghandler_155=(org.apache.struts.taglib.html.TextTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.TextTag.class,"org.apache.struts.taglib.html.TextTag maxlength name onchange property size"); __jsp_taghandler_155.setParent(__jsp_taghandler_92); __jsp_taghandler_155.setMaxlength("60"); __jsp_taghandler_155.setName("ActivosForm"); __jsp_taghandler_155.setOnchange("javascript:this.value=this.value.toUpperCase();"); __jsp_taghandler_155.setProperty("rev_desestado"); __jsp_taghandler_155.setSize("60"); __jsp_tag_starteval=__jsp_taghandler_155.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_155,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_155.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_155.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_155); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[168]); /*@lineinfo:translated-code*//*@lineinfo:310^24*/ { org.apache.struts.taglib.html.SubmitTag __jsp_taghandler_156=(org.apache.struts.taglib.html.SubmitTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.SubmitTag.class,"org.apache.struts.taglib.html.SubmitTag onclick property styleClass value"); __jsp_taghandler_156.setParent(__jsp_taghandler_92); __jsp_taghandler_156.setOnclick("operacion.value=2;opcion.value=2"); __jsp_taghandler_156.setProperty("boton"); __jsp_taghandler_156.setStyleClass("boton1"); __jsp_taghandler_156.setValue("Modificar"); __jsp_tag_starteval=__jsp_taghandler_156.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_156,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_156.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_156.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_156); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[169]); /*@lineinfo:translated-code*//*@lineinfo:310^137*/ } while (__jsp_taghandler_92.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); } if (__jsp_taghandler_92.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_92); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[170]); /*@lineinfo:translated-code*//*@lineinfo:314^4*/ { org.apache.struts.taglib.logic.EqualTag __jsp_taghandler_157=(org.apache.struts.taglib.logic.EqualTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.logic.EqualTag.class,"org.apache.struts.taglib.logic.EqualTag name property value"); __jsp_taghandler_157.setParent(__jsp_taghandler_4); __jsp_taghandler_157.setName("ActivosForm"); __jsp_taghandler_157.setProperty("opcion"); __jsp_taghandler_157.setValue("3"); __jsp_tag_starteval=__jsp_taghandler_157.doStartTag(); if (OracleJspRuntime.checkStartTagEval(__jsp_tag_starteval)) { do { /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[171]); /*@lineinfo:translated-code*//*@lineinfo:317^27*/ { org.apache.struts.taglib.bean.MessageTag __jsp_taghandler_158=(org.apache.struts.taglib.bean.MessageTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.bean.MessageTag.class,"org.apache.struts.taglib.bean.MessageTag key"); __jsp_taghandler_158.setParent(__jsp_taghandler_157); __jsp_taghandler_158.setKey("activos4.codrub"); __jsp_tag_starteval=__jsp_taghandler_158.doStartTag(); if (OracleJspRuntime.checkStartTagEval(__jsp_tag_starteval)) { do { } while (__jsp_taghandler_158.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); } if (__jsp_taghandler_158.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_158); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[172]); /*@lineinfo:translated-code*//*@lineinfo:318^26*/ { org.apache.struts.taglib.html.TextTag __jsp_taghandler_159=(org.apache.struts.taglib.html.TextTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.TextTag.class,"org.apache.struts.taglib.html.TextTag maxlength name property readonly size"); __jsp_taghandler_159.setParent(__jsp_taghandler_157); __jsp_taghandler_159.setMaxlength("10"); __jsp_taghandler_159.setName("ActivosForm"); __jsp_taghandler_159.setProperty("act_codrub"); __jsp_taghandler_159.setReadonly(true); __jsp_taghandler_159.setSize("10"); __jsp_tag_starteval=__jsp_taghandler_159.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_159,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_159.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_159.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_159); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[173]); /*@lineinfo:translated-code*//*@lineinfo:319^10*/ { org.apache.struts.taglib.html.TextTag __jsp_taghandler_160=(org.apache.struts.taglib.html.TextTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.TextTag.class,"org.apache.struts.taglib.html.TextTag maxlength name property readonly size"); __jsp_taghandler_160.setParent(__jsp_taghandler_157); __jsp_taghandler_160.setMaxlength("60"); __jsp_taghandler_160.setName("ActivosForm"); __jsp_taghandler_160.setProperty("act_rubdescripcion"); __jsp_taghandler_160.setReadonly(true); __jsp_taghandler_160.setSize("60"); __jsp_tag_starteval=__jsp_taghandler_160.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_160,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_160.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_160.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_160); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[174]); /*@lineinfo:translated-code*//*@lineinfo:322^27*/ { org.apache.struts.taglib.bean.MessageTag __jsp_taghandler_161=(org.apache.struts.taglib.bean.MessageTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.bean.MessageTag.class,"org.apache.struts.taglib.bean.MessageTag key"); __jsp_taghandler_161.setParent(__jsp_taghandler_157); __jsp_taghandler_161.setKey("activos4.codreg"); __jsp_tag_starteval=__jsp_taghandler_161.doStartTag(); if (OracleJspRuntime.checkStartTagEval(__jsp_tag_starteval)) { do { } while (__jsp_taghandler_161.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); } if (__jsp_taghandler_161.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_161); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[175]); /*@lineinfo:translated-code*//*@lineinfo:323^26*/ { org.apache.struts.taglib.html.TextTag __jsp_taghandler_162=(org.apache.struts.taglib.html.TextTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.TextTag.class,"org.apache.struts.taglib.html.TextTag maxlength name property readonly size"); __jsp_taghandler_162.setParent(__jsp_taghandler_157); __jsp_taghandler_162.setMaxlength("10"); __jsp_taghandler_162.setName("ActivosForm"); __jsp_taghandler_162.setProperty("act_codreg"); __jsp_taghandler_162.setReadonly(true); __jsp_taghandler_162.setSize("10"); __jsp_tag_starteval=__jsp_taghandler_162.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_162,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_162.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_162.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_162); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[176]); /*@lineinfo:translated-code*//*@lineinfo:324^10*/ { org.apache.struts.taglib.html.TextTag __jsp_taghandler_163=(org.apache.struts.taglib.html.TextTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.TextTag.class,"org.apache.struts.taglib.html.TextTag maxlength name property readonly size"); __jsp_taghandler_163.setParent(__jsp_taghandler_157); __jsp_taghandler_163.setMaxlength("60"); __jsp_taghandler_163.setName("ActivosForm"); __jsp_taghandler_163.setProperty("act_regdescripcion"); __jsp_taghandler_163.setReadonly(true); __jsp_taghandler_163.setSize("60"); __jsp_tag_starteval=__jsp_taghandler_163.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_163,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_163.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_163.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_163); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[177]); /*@lineinfo:translated-code*//*@lineinfo:327^27*/ { org.apache.struts.taglib.bean.MessageTag __jsp_taghandler_164=(org.apache.struts.taglib.bean.MessageTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.bean.MessageTag.class,"org.apache.struts.taglib.bean.MessageTag key"); __jsp_taghandler_164.setParent(__jsp_taghandler_157); __jsp_taghandler_164.setKey("activos4.codigo"); __jsp_tag_starteval=__jsp_taghandler_164.doStartTag(); if (OracleJspRuntime.checkStartTagEval(__jsp_tag_starteval)) { do { } while (__jsp_taghandler_164.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); } if (__jsp_taghandler_164.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_164); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[178]); /*@lineinfo:translated-code*//*@lineinfo:328^26*/ { org.apache.struts.taglib.html.TextTag __jsp_taghandler_165=(org.apache.struts.taglib.html.TextTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.TextTag.class,"org.apache.struts.taglib.html.TextTag maxlength name property readonly size"); __jsp_taghandler_165.setParent(__jsp_taghandler_157); __jsp_taghandler_165.setMaxlength("5"); __jsp_taghandler_165.setName("ActivosForm"); __jsp_taghandler_165.setProperty("act_codigo"); __jsp_taghandler_165.setReadonly(true); __jsp_taghandler_165.setSize("5"); __jsp_tag_starteval=__jsp_taghandler_165.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_165,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_165.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_165.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_165); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[179]); /*@lineinfo:translated-code*//*@lineinfo:329^10*/ { org.apache.struts.taglib.html.TextTag __jsp_taghandler_166=(org.apache.struts.taglib.html.TextTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.TextTag.class,"org.apache.struts.taglib.html.TextTag maxlength name property readonly size"); __jsp_taghandler_166.setParent(__jsp_taghandler_157); __jsp_taghandler_166.setMaxlength("10"); __jsp_taghandler_166.setName("ActivosForm"); __jsp_taghandler_166.setProperty("act_codbarra"); __jsp_taghandler_166.setReadonly(true); __jsp_taghandler_166.setSize("10"); __jsp_tag_starteval=__jsp_taghandler_166.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_166,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_166.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_166.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_166); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[180]); /*@lineinfo:translated-code*//*@lineinfo:332^27*/ { org.apache.struts.taglib.bean.MessageTag __jsp_taghandler_167=(org.apache.struts.taglib.bean.MessageTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.bean.MessageTag.class,"org.apache.struts.taglib.bean.MessageTag key"); __jsp_taghandler_167.setParent(__jsp_taghandler_157); __jsp_taghandler_167.setKey("activos4.codgrp"); __jsp_tag_starteval=__jsp_taghandler_167.doStartTag(); if (OracleJspRuntime.checkStartTagEval(__jsp_tag_starteval)) { do { } while (__jsp_taghandler_167.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); } if (__jsp_taghandler_167.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_167); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[181]); /*@lineinfo:translated-code*//*@lineinfo:334^14*/ { org.apache.struts.taglib.html.TextTag __jsp_taghandler_168=(org.apache.struts.taglib.html.TextTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.TextTag.class,"org.apache.struts.taglib.html.TextTag maxlength name property readonly size"); __jsp_taghandler_168.setParent(__jsp_taghandler_157); __jsp_taghandler_168.setMaxlength("40"); __jsp_taghandler_168.setName("ActivosForm"); __jsp_taghandler_168.setProperty("act_grpdescripcion"); __jsp_taghandler_168.setReadonly(true); __jsp_taghandler_168.setSize("40"); __jsp_tag_starteval=__jsp_taghandler_168.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_168,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_168.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_168.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_168); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[182]); /*@lineinfo:translated-code*//*@lineinfo:336^27*/ { org.apache.struts.taglib.bean.MessageTag __jsp_taghandler_169=(org.apache.struts.taglib.bean.MessageTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.bean.MessageTag.class,"org.apache.struts.taglib.bean.MessageTag key"); __jsp_taghandler_169.setParent(__jsp_taghandler_157); __jsp_taghandler_169.setKey("activos4.codpar"); __jsp_tag_starteval=__jsp_taghandler_169.doStartTag(); if (OracleJspRuntime.checkStartTagEval(__jsp_tag_starteval)) { do { } while (__jsp_taghandler_169.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); } if (__jsp_taghandler_169.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_169); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[183]); /*@lineinfo:translated-code*//*@lineinfo:338^15*/ { org.apache.struts.taglib.html.TextTag __jsp_taghandler_170=(org.apache.struts.taglib.html.TextTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.TextTag.class,"org.apache.struts.taglib.html.TextTag maxlength name property readonly size"); __jsp_taghandler_170.setParent(__jsp_taghandler_157); __jsp_taghandler_170.setMaxlength("40"); __jsp_taghandler_170.setName("ActivosForm"); __jsp_taghandler_170.setProperty("act_pardescripcion"); __jsp_taghandler_170.setReadonly(true); __jsp_taghandler_170.setSize("40"); __jsp_tag_starteval=__jsp_taghandler_170.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_170,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_170.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_170.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_170); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[184]); /*@lineinfo:translated-code*//*@lineinfo:342^27*/ { org.apache.struts.taglib.bean.MessageTag __jsp_taghandler_171=(org.apache.struts.taglib.bean.MessageTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.bean.MessageTag.class,"org.apache.struts.taglib.bean.MessageTag key"); __jsp_taghandler_171.setParent(__jsp_taghandler_157); __jsp_taghandler_171.setKey("activos4.codofi"); __jsp_tag_starteval=__jsp_taghandler_171.doStartTag(); if (OracleJspRuntime.checkStartTagEval(__jsp_tag_starteval)) { do { } while (__jsp_taghandler_171.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); } if (__jsp_taghandler_171.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_171); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[185]); /*@lineinfo:translated-code*//*@lineinfo:344^10*/ { org.apache.struts.taglib.html.TextTag __jsp_taghandler_172=(org.apache.struts.taglib.html.TextTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.TextTag.class,"org.apache.struts.taglib.html.TextTag maxlength name property readonly size"); __jsp_taghandler_172.setParent(__jsp_taghandler_157); __jsp_taghandler_172.setMaxlength("40"); __jsp_taghandler_172.setName("ActivosForm"); __jsp_taghandler_172.setProperty("act_ofidescripcion"); __jsp_taghandler_172.setReadonly(true); __jsp_taghandler_172.setSize("40"); __jsp_tag_starteval=__jsp_taghandler_172.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_172,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_172.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_172.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_172); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[186]); /*@lineinfo:translated-code*//*@lineinfo:346^27*/ { org.apache.struts.taglib.bean.MessageTag __jsp_taghandler_173=(org.apache.struts.taglib.bean.MessageTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.bean.MessageTag.class,"org.apache.struts.taglib.bean.MessageTag key"); __jsp_taghandler_173.setParent(__jsp_taghandler_157); __jsp_taghandler_173.setKey("activos4.codfun"); __jsp_tag_starteval=__jsp_taghandler_173.doStartTag(); if (OracleJspRuntime.checkStartTagEval(__jsp_tag_starteval)) { do { } while (__jsp_taghandler_173.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); } if (__jsp_taghandler_173.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_173); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[187]); /*@lineinfo:translated-code*//*@lineinfo:348^10*/ { org.apache.struts.taglib.html.TextTag __jsp_taghandler_174=(org.apache.struts.taglib.html.TextTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.TextTag.class,"org.apache.struts.taglib.html.TextTag maxlength name property readonly size"); __jsp_taghandler_174.setParent(__jsp_taghandler_157); __jsp_taghandler_174.setMaxlength("40"); __jsp_taghandler_174.setName("ActivosForm"); __jsp_taghandler_174.setProperty("act_fundescripcion"); __jsp_taghandler_174.setReadonly(true); __jsp_taghandler_174.setSize("40"); __jsp_tag_starteval=__jsp_taghandler_174.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_174,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_174.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_174.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_174); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[188]); /*@lineinfo:translated-code*//*@lineinfo:352^27*/ { org.apache.struts.taglib.bean.MessageTag __jsp_taghandler_175=(org.apache.struts.taglib.bean.MessageTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.bean.MessageTag.class,"org.apache.struts.taglib.bean.MessageTag key"); __jsp_taghandler_175.setParent(__jsp_taghandler_157); __jsp_taghandler_175.setKey("activos4.codubi"); __jsp_tag_starteval=__jsp_taghandler_175.doStartTag(); if (OracleJspRuntime.checkStartTagEval(__jsp_tag_starteval)) { do { } while (__jsp_taghandler_175.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); } if (__jsp_taghandler_175.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_175); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[189]); /*@lineinfo:translated-code*//*@lineinfo:354^15*/ { org.apache.struts.taglib.html.TextTag __jsp_taghandler_176=(org.apache.struts.taglib.html.TextTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.TextTag.class,"org.apache.struts.taglib.html.TextTag maxlength name property readonly size"); __jsp_taghandler_176.setParent(__jsp_taghandler_157); __jsp_taghandler_176.setMaxlength("40"); __jsp_taghandler_176.setName("ActivosForm"); __jsp_taghandler_176.setProperty("act_ubidescripcion"); __jsp_taghandler_176.setReadonly(true); __jsp_taghandler_176.setSize("40"); __jsp_tag_starteval=__jsp_taghandler_176.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_176,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_176.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_176.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_176); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[190]); /*@lineinfo:translated-code*//*@lineinfo:356^27*/ { org.apache.struts.taglib.bean.MessageTag __jsp_taghandler_177=(org.apache.struts.taglib.bean.MessageTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.bean.MessageTag.class,"org.apache.struts.taglib.bean.MessageTag key"); __jsp_taghandler_177.setParent(__jsp_taghandler_157); __jsp_taghandler_177.setKey("activos4.codpry"); __jsp_tag_starteval=__jsp_taghandler_177.doStartTag(); if (OracleJspRuntime.checkStartTagEval(__jsp_tag_starteval)) { do { } while (__jsp_taghandler_177.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); } if (__jsp_taghandler_177.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_177); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[191]); /*@lineinfo:translated-code*//*@lineinfo:358^15*/ { org.apache.struts.taglib.html.TextTag __jsp_taghandler_178=(org.apache.struts.taglib.html.TextTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.TextTag.class,"org.apache.struts.taglib.html.TextTag maxlength name property readonly size"); __jsp_taghandler_178.setParent(__jsp_taghandler_157); __jsp_taghandler_178.setMaxlength("40"); __jsp_taghandler_178.setName("ActivosForm"); __jsp_taghandler_178.setProperty("act_prydescripcion"); __jsp_taghandler_178.setReadonly(true); __jsp_taghandler_178.setSize("40"); __jsp_tag_starteval=__jsp_taghandler_178.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_178,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_178.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_178.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_178); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[192]); /*@lineinfo:translated-code*//*@lineinfo:362^27*/ { org.apache.struts.taglib.bean.MessageTag __jsp_taghandler_179=(org.apache.struts.taglib.bean.MessageTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.bean.MessageTag.class,"org.apache.struts.taglib.bean.MessageTag key"); __jsp_taghandler_179.setParent(__jsp_taghandler_157); __jsp_taghandler_179.setKey("activos4.codfin"); __jsp_tag_starteval=__jsp_taghandler_179.doStartTag(); if (OracleJspRuntime.checkStartTagEval(__jsp_tag_starteval)) { do { } while (__jsp_taghandler_179.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); } if (__jsp_taghandler_179.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_179); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[193]); /*@lineinfo:translated-code*//*@lineinfo:364^15*/ { org.apache.struts.taglib.html.TextTag __jsp_taghandler_180=(org.apache.struts.taglib.html.TextTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.TextTag.class,"org.apache.struts.taglib.html.TextTag maxlength name property readonly size"); __jsp_taghandler_180.setParent(__jsp_taghandler_157); __jsp_taghandler_180.setMaxlength("40"); __jsp_taghandler_180.setName("ActivosForm"); __jsp_taghandler_180.setProperty("act_findescripcion"); __jsp_taghandler_180.setReadonly(true); __jsp_taghandler_180.setSize("40"); __jsp_tag_starteval=__jsp_taghandler_180.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_180,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_180.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_180.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_180); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[194]); /*@lineinfo:translated-code*//*@lineinfo:368^27*/ { org.apache.struts.taglib.bean.MessageTag __jsp_taghandler_181=(org.apache.struts.taglib.bean.MessageTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.bean.MessageTag.class,"org.apache.struts.taglib.bean.MessageTag key"); __jsp_taghandler_181.setParent(__jsp_taghandler_157); __jsp_taghandler_181.setKey("activos4.feccompra"); __jsp_tag_starteval=__jsp_taghandler_181.doStartTag(); if (OracleJspRuntime.checkStartTagEval(__jsp_tag_starteval)) { do { } while (__jsp_taghandler_181.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); } if (__jsp_taghandler_181.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_181); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[195]); /*@lineinfo:translated-code*//*@lineinfo:369^14*/ { org.apache.struts.taglib.html.TextTag __jsp_taghandler_182=(org.apache.struts.taglib.html.TextTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.TextTag.class,"org.apache.struts.taglib.html.TextTag maxlength name property readonly size"); __jsp_taghandler_182.setParent(__jsp_taghandler_157); __jsp_taghandler_182.setMaxlength("10"); __jsp_taghandler_182.setName("ActivosForm"); __jsp_taghandler_182.setProperty("act_feccompra"); __jsp_taghandler_182.setReadonly(true); __jsp_taghandler_182.setSize("10"); __jsp_tag_starteval=__jsp_taghandler_182.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_182,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_182.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_182.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_182); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[196]); /*@lineinfo:translated-code*//*@lineinfo:370^27*/ { org.apache.struts.taglib.bean.MessageTag __jsp_taghandler_183=(org.apache.struts.taglib.bean.MessageTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.bean.MessageTag.class,"org.apache.struts.taglib.bean.MessageTag key"); __jsp_taghandler_183.setParent(__jsp_taghandler_157); __jsp_taghandler_183.setKey("activos4.umanejo"); __jsp_tag_starteval=__jsp_taghandler_183.doStartTag(); if (OracleJspRuntime.checkStartTagEval(__jsp_tag_starteval)) { do { } while (__jsp_taghandler_183.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); } if (__jsp_taghandler_183.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_183); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[197]); /*@lineinfo:translated-code*//*@lineinfo:371^14*/ { org.apache.struts.taglib.html.TextTag __jsp_taghandler_184=(org.apache.struts.taglib.html.TextTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.TextTag.class,"org.apache.struts.taglib.html.TextTag maxlength name property readonly size"); __jsp_taghandler_184.setParent(__jsp_taghandler_157); __jsp_taghandler_184.setMaxlength("20"); __jsp_taghandler_184.setName("ActivosForm"); __jsp_taghandler_184.setProperty("act_umanejo"); __jsp_taghandler_184.setReadonly(true); __jsp_taghandler_184.setSize("20"); __jsp_tag_starteval=__jsp_taghandler_184.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_184,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_184.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_184.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_184); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[198]); /*@lineinfo:translated-code*//*@lineinfo:374^24*/ { org.apache.struts.taglib.html.SubmitTag __jsp_taghandler_185=(org.apache.struts.taglib.html.SubmitTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.SubmitTag.class,"org.apache.struts.taglib.html.SubmitTag onclick property styleClass value"); __jsp_taghandler_185.setParent(__jsp_taghandler_157); __jsp_taghandler_185.setOnclick("operacion.value=2;opcion.value=3"); __jsp_taghandler_185.setProperty("boton"); __jsp_taghandler_185.setStyleClass("boton1"); __jsp_taghandler_185.setValue("Eliminar"); __jsp_tag_starteval=__jsp_taghandler_185.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_185,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_185.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_185.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_185); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[199]); /*@lineinfo:translated-code*//*@lineinfo:374^136*/ } while (__jsp_taghandler_157.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); } if (__jsp_taghandler_157.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_157); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[200]); /*@lineinfo:translated-code*//*@lineinfo:377^18*/ } while (__jsp_taghandler_4.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); } if (__jsp_taghandler_4.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_4); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[201]); /*@lineinfo:translated-code*//*@lineinfo:379^1*/ { org.apache.struts.taglib.logic.EqualTag __jsp_taghandler_186=(org.apache.struts.taglib.logic.EqualTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.logic.EqualTag.class,"org.apache.struts.taglib.logic.EqualTag name property value"); __jsp_taghandler_186.setParent(__jsp_taghandler_1); __jsp_taghandler_186.setName("ActivosForm"); __jsp_taghandler_186.setProperty("operacion"); __jsp_taghandler_186.setValue("2"); __jsp_tag_starteval=__jsp_taghandler_186.doStartTag(); if (OracleJspRuntime.checkStartTagEval(__jsp_tag_starteval)) { do { /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[202]); /*@lineinfo:translated-code*//*@lineinfo:383^6*/ { org.apache.struts.taglib.logic.EqualTag __jsp_taghandler_187=(org.apache.struts.taglib.logic.EqualTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.logic.EqualTag.class,"org.apache.struts.taglib.logic.EqualTag name property value"); __jsp_taghandler_187.setParent(__jsp_taghandler_186); __jsp_taghandler_187.setName("ActivosForm"); __jsp_taghandler_187.setProperty("opcion"); __jsp_taghandler_187.setValue("3"); __jsp_tag_starteval=__jsp_taghandler_187.doStartTag(); if (OracleJspRuntime.checkStartTagEval(__jsp_tag_starteval)) { do { /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[203]); /*@lineinfo:translated-code*//*@lineinfo:385^29*/ { org.apache.struts.taglib.bean.MessageTag __jsp_taghandler_188=(org.apache.struts.taglib.bean.MessageTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.bean.MessageTag.class,"org.apache.struts.taglib.bean.MessageTag key"); __jsp_taghandler_188.setParent(__jsp_taghandler_187); __jsp_taghandler_188.setKey("activos4.codrub"); __jsp_tag_starteval=__jsp_taghandler_188.doStartTag(); if (OracleJspRuntime.checkStartTagEval(__jsp_tag_starteval)) { do { } while (__jsp_taghandler_188.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); } if (__jsp_taghandler_188.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_188); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[204]); /*@lineinfo:translated-code*//*@lineinfo:386^16*/ { org.apache.struts.taglib.html.SelectTag __jsp_taghandler_189=(org.apache.struts.taglib.html.SelectTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.SelectTag.class,"org.apache.struts.taglib.html.SelectTag disabled name property"); __jsp_taghandler_189.setParent(__jsp_taghandler_187); __jsp_taghandler_189.setDisabled(false); __jsp_taghandler_189.setName("ActivosForm"); __jsp_taghandler_189.setProperty("act_codrub"); __jsp_tag_starteval=__jsp_taghandler_189.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_189,__jsp_tag_starteval,out); do { /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[205]); /*@lineinfo:translated-code*//*@lineinfo:387^16*/ { org.apache.struts.taglib.html.OptionsTag __jsp_taghandler_190=(org.apache.struts.taglib.html.OptionsTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.OptionsTag.class,"org.apache.struts.taglib.html.OptionsTag collection labelProperty property"); __jsp_taghandler_190.setParent(__jsp_taghandler_189); __jsp_taghandler_190.setCollection("RubrosLista"); __jsp_taghandler_190.setLabelProperty("descripcion"); __jsp_taghandler_190.setProperty("codigo"); __jsp_tag_starteval=__jsp_taghandler_190.doStartTag(); if (OracleJspRuntime.checkStartTagEval(__jsp_tag_starteval)) { do { } while (__jsp_taghandler_190.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); } if (__jsp_taghandler_190.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_190); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[206]); /*@lineinfo:translated-code*//*@lineinfo:387^102*/ } while (__jsp_taghandler_189.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_189.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_189); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[207]); /*@lineinfo:translated-code*//*@lineinfo:391^30*/ { org.apache.struts.taglib.bean.MessageTag __jsp_taghandler_191=(org.apache.struts.taglib.bean.MessageTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.bean.MessageTag.class,"org.apache.struts.taglib.bean.MessageTag key"); __jsp_taghandler_191.setParent(__jsp_taghandler_187); __jsp_taghandler_191.setKey("activos4.codreg"); __jsp_tag_starteval=__jsp_taghandler_191.doStartTag(); if (OracleJspRuntime.checkStartTagEval(__jsp_tag_starteval)) { do { } while (__jsp_taghandler_191.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); } if (__jsp_taghandler_191.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_191); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[208]); /*@lineinfo:translated-code*//*@lineinfo:392^17*/ { org.apache.struts.taglib.html.HiddenTag __jsp_taghandler_192=(org.apache.struts.taglib.html.HiddenTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.HiddenTag.class,"org.apache.struts.taglib.html.HiddenTag name property"); __jsp_taghandler_192.setParent(__jsp_taghandler_187); __jsp_taghandler_192.setName("ActivosForm"); __jsp_taghandler_192.setProperty("act_codreg"); __jsp_tag_starteval=__jsp_taghandler_192.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_192,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_192.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_192.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_192); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[209]); /*@lineinfo:translated-code*//*@lineinfo:393^13*/ { org.apache.struts.taglib.html.TextTag __jsp_taghandler_193=(org.apache.struts.taglib.html.TextTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.TextTag.class,"org.apache.struts.taglib.html.TextTag maxlength name property readonly size"); __jsp_taghandler_193.setParent(__jsp_taghandler_187); __jsp_taghandler_193.setMaxlength("30"); __jsp_taghandler_193.setName("ActivosForm"); __jsp_taghandler_193.setProperty("act_regdescripcion"); __jsp_taghandler_193.setReadonly(true); __jsp_taghandler_193.setSize("30"); __jsp_tag_starteval=__jsp_taghandler_193.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_193,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_193.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_193.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_193); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[210]); /*@lineinfo:translated-code*//*@lineinfo:396^30*/ { org.apache.struts.taglib.bean.MessageTag __jsp_taghandler_194=(org.apache.struts.taglib.bean.MessageTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.bean.MessageTag.class,"org.apache.struts.taglib.bean.MessageTag key"); __jsp_taghandler_194.setParent(__jsp_taghandler_187); __jsp_taghandler_194.setKey("activos4.codfin"); __jsp_tag_starteval=__jsp_taghandler_194.doStartTag(); if (OracleJspRuntime.checkStartTagEval(__jsp_tag_starteval)) { do { } while (__jsp_taghandler_194.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); } if (__jsp_taghandler_194.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_194); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[211]); /*@lineinfo:translated-code*//*@lineinfo:397^17*/ { org.apache.struts.taglib.html.HiddenTag __jsp_taghandler_195=(org.apache.struts.taglib.html.HiddenTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.HiddenTag.class,"org.apache.struts.taglib.html.HiddenTag name property"); __jsp_taghandler_195.setParent(__jsp_taghandler_187); __jsp_taghandler_195.setName("ActivosForm"); __jsp_taghandler_195.setProperty("act_codfin"); __jsp_tag_starteval=__jsp_taghandler_195.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_195,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_195.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_195.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_195); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[212]); /*@lineinfo:translated-code*//*@lineinfo:398^13*/ { org.apache.struts.taglib.html.TextTag __jsp_taghandler_196=(org.apache.struts.taglib.html.TextTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.TextTag.class,"org.apache.struts.taglib.html.TextTag maxlength name property readonly size"); __jsp_taghandler_196.setParent(__jsp_taghandler_187); __jsp_taghandler_196.setMaxlength("30"); __jsp_taghandler_196.setName("ActivosForm"); __jsp_taghandler_196.setProperty("act_findescripcion"); __jsp_taghandler_196.setReadonly(true); __jsp_taghandler_196.setSize("30"); __jsp_tag_starteval=__jsp_taghandler_196.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_196,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_196.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_196.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_196); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[213]); /*@lineinfo:translated-code*//*@lineinfo:401^29*/ { org.apache.struts.taglib.bean.MessageTag __jsp_taghandler_197=(org.apache.struts.taglib.bean.MessageTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.bean.MessageTag.class,"org.apache.struts.taglib.bean.MessageTag key"); __jsp_taghandler_197.setParent(__jsp_taghandler_187); __jsp_taghandler_197.setKey("activos4.descripcion"); __jsp_tag_starteval=__jsp_taghandler_197.doStartTag(); if (OracleJspRuntime.checkStartTagEval(__jsp_tag_starteval)) { do { } while (__jsp_taghandler_197.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); } if (__jsp_taghandler_197.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_197); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[214]); /*@lineinfo:translated-code*//*@lineinfo:402^16*/ { org.apache.struts.taglib.html.TextTag __jsp_taghandler_198=(org.apache.struts.taglib.html.TextTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.TextTag.class,"org.apache.struts.taglib.html.TextTag maxlength name onchange property size value"); __jsp_taghandler_198.setParent(__jsp_taghandler_187); __jsp_taghandler_198.setMaxlength("120"); __jsp_taghandler_198.setName("ActivosForm"); __jsp_taghandler_198.setOnchange("javascript:this.value=this.value.toUpperCase();"); __jsp_taghandler_198.setProperty("act_descripcion"); __jsp_taghandler_198.setSize("60"); __jsp_taghandler_198.setValue("%"); __jsp_tag_starteval=__jsp_taghandler_198.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_198,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_198.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_198.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_198); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[215]); /*@lineinfo:translated-code*//*@lineinfo:407^12*/ { org.apache.struts.taglib.html.SubmitTag __jsp_taghandler_199=(org.apache.struts.taglib.html.SubmitTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.SubmitTag.class,"org.apache.struts.taglib.html.SubmitTag onclick property styleClass value"); __jsp_taghandler_199.setParent(__jsp_taghandler_187); __jsp_taghandler_199.setOnclick("operacion.value=3;opcion.value=3"); __jsp_taghandler_199.setProperty("boton"); __jsp_taghandler_199.setStyleClass("boton1"); __jsp_taghandler_199.setValue("Eliminar"); __jsp_tag_starteval=__jsp_taghandler_199.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_199,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_199.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_199.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_199); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[216]); /*@lineinfo:translated-code*//*@lineinfo:407^123*/ } while (__jsp_taghandler_187.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); } if (__jsp_taghandler_187.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_187); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[217]); /*@lineinfo:translated-code*//*@lineinfo:411^6*/ { org.apache.struts.taglib.logic.EqualTag __jsp_taghandler_200=(org.apache.struts.taglib.logic.EqualTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.logic.EqualTag.class,"org.apache.struts.taglib.logic.EqualTag name property value"); __jsp_taghandler_200.setParent(__jsp_taghandler_186); __jsp_taghandler_200.setName("ActivosForm"); __jsp_taghandler_200.setProperty("opcion"); __jsp_taghandler_200.setValue("2"); __jsp_tag_starteval=__jsp_taghandler_200.doStartTag(); if (OracleJspRuntime.checkStartTagEval(__jsp_tag_starteval)) { do { /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[218]); /*@lineinfo:translated-code*//*@lineinfo:413^29*/ { org.apache.struts.taglib.bean.MessageTag __jsp_taghandler_201=(org.apache.struts.taglib.bean.MessageTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.bean.MessageTag.class,"org.apache.struts.taglib.bean.MessageTag key"); __jsp_taghandler_201.setParent(__jsp_taghandler_200); __jsp_taghandler_201.setKey("activos4.codrub"); __jsp_tag_starteval=__jsp_taghandler_201.doStartTag(); if (OracleJspRuntime.checkStartTagEval(__jsp_tag_starteval)) { do { } while (__jsp_taghandler_201.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); } if (__jsp_taghandler_201.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_201); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[219]); /*@lineinfo:translated-code*//*@lineinfo:414^16*/ { org.apache.struts.taglib.html.SelectTag __jsp_taghandler_202=(org.apache.struts.taglib.html.SelectTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.SelectTag.class,"org.apache.struts.taglib.html.SelectTag disabled name property"); __jsp_taghandler_202.setParent(__jsp_taghandler_200); __jsp_taghandler_202.setDisabled(false); __jsp_taghandler_202.setName("ActivosForm"); __jsp_taghandler_202.setProperty("act_codrub"); __jsp_tag_starteval=__jsp_taghandler_202.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_202,__jsp_tag_starteval,out); do { /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[220]); /*@lineinfo:translated-code*//*@lineinfo:415^16*/ { org.apache.struts.taglib.html.OptionsTag __jsp_taghandler_203=(org.apache.struts.taglib.html.OptionsTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.OptionsTag.class,"org.apache.struts.taglib.html.OptionsTag collection labelProperty property"); __jsp_taghandler_203.setParent(__jsp_taghandler_202); __jsp_taghandler_203.setCollection("RubrosLista"); __jsp_taghandler_203.setLabelProperty("descripcion"); __jsp_taghandler_203.setProperty("codigo"); __jsp_tag_starteval=__jsp_taghandler_203.doStartTag(); if (OracleJspRuntime.checkStartTagEval(__jsp_tag_starteval)) { do { } while (__jsp_taghandler_203.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); } if (__jsp_taghandler_203.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_203); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[221]); /*@lineinfo:translated-code*//*@lineinfo:415^102*/ } while (__jsp_taghandler_202.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_202.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_202); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[222]); /*@lineinfo:translated-code*//*@lineinfo:419^30*/ { org.apache.struts.taglib.bean.MessageTag __jsp_taghandler_204=(org.apache.struts.taglib.bean.MessageTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.bean.MessageTag.class,"org.apache.struts.taglib.bean.MessageTag key"); __jsp_taghandler_204.setParent(__jsp_taghandler_200); __jsp_taghandler_204.setKey("activos4.codreg"); __jsp_tag_starteval=__jsp_taghandler_204.doStartTag(); if (OracleJspRuntime.checkStartTagEval(__jsp_tag_starteval)) { do { } while (__jsp_taghandler_204.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); } if (__jsp_taghandler_204.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_204); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[223]); /*@lineinfo:translated-code*//*@lineinfo:420^17*/ { org.apache.struts.taglib.html.HiddenTag __jsp_taghandler_205=(org.apache.struts.taglib.html.HiddenTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.HiddenTag.class,"org.apache.struts.taglib.html.HiddenTag name property"); __jsp_taghandler_205.setParent(__jsp_taghandler_200); __jsp_taghandler_205.setName("ActivosForm"); __jsp_taghandler_205.setProperty("act_codreg"); __jsp_tag_starteval=__jsp_taghandler_205.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_205,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_205.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_205.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_205); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[224]); /*@lineinfo:translated-code*//*@lineinfo:421^13*/ { org.apache.struts.taglib.html.TextTag __jsp_taghandler_206=(org.apache.struts.taglib.html.TextTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.TextTag.class,"org.apache.struts.taglib.html.TextTag maxlength name property readonly size"); __jsp_taghandler_206.setParent(__jsp_taghandler_200); __jsp_taghandler_206.setMaxlength("30"); __jsp_taghandler_206.setName("ActivosForm"); __jsp_taghandler_206.setProperty("act_regdescripcion"); __jsp_taghandler_206.setReadonly(true); __jsp_taghandler_206.setSize("30"); __jsp_tag_starteval=__jsp_taghandler_206.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_206,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_206.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_206.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_206); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[225]); /*@lineinfo:translated-code*//*@lineinfo:424^30*/ { org.apache.struts.taglib.bean.MessageTag __jsp_taghandler_207=(org.apache.struts.taglib.bean.MessageTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.bean.MessageTag.class,"org.apache.struts.taglib.bean.MessageTag key"); __jsp_taghandler_207.setParent(__jsp_taghandler_200); __jsp_taghandler_207.setKey("activos4.codfin"); __jsp_tag_starteval=__jsp_taghandler_207.doStartTag(); if (OracleJspRuntime.checkStartTagEval(__jsp_tag_starteval)) { do { } while (__jsp_taghandler_207.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); } if (__jsp_taghandler_207.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_207); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[226]); /*@lineinfo:translated-code*//*@lineinfo:425^17*/ { org.apache.struts.taglib.html.HiddenTag __jsp_taghandler_208=(org.apache.struts.taglib.html.HiddenTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.HiddenTag.class,"org.apache.struts.taglib.html.HiddenTag name property"); __jsp_taghandler_208.setParent(__jsp_taghandler_200); __jsp_taghandler_208.setName("ActivosForm"); __jsp_taghandler_208.setProperty("act_codfin"); __jsp_tag_starteval=__jsp_taghandler_208.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_208,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_208.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_208.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_208); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[227]); /*@lineinfo:translated-code*//*@lineinfo:426^13*/ { org.apache.struts.taglib.html.TextTag __jsp_taghandler_209=(org.apache.struts.taglib.html.TextTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.TextTag.class,"org.apache.struts.taglib.html.TextTag maxlength name property readonly size"); __jsp_taghandler_209.setParent(__jsp_taghandler_200); __jsp_taghandler_209.setMaxlength("30"); __jsp_taghandler_209.setName("ActivosForm"); __jsp_taghandler_209.setProperty("act_findescripcion"); __jsp_taghandler_209.setReadonly(true); __jsp_taghandler_209.setSize("30"); __jsp_tag_starteval=__jsp_taghandler_209.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_209,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_209.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_209.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_209); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[228]); /*@lineinfo:translated-code*//*@lineinfo:429^29*/ { org.apache.struts.taglib.bean.MessageTag __jsp_taghandler_210=(org.apache.struts.taglib.bean.MessageTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.bean.MessageTag.class,"org.apache.struts.taglib.bean.MessageTag key"); __jsp_taghandler_210.setParent(__jsp_taghandler_200); __jsp_taghandler_210.setKey("activos4.descripcion"); __jsp_tag_starteval=__jsp_taghandler_210.doStartTag(); if (OracleJspRuntime.checkStartTagEval(__jsp_tag_starteval)) { do { } while (__jsp_taghandler_210.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); } if (__jsp_taghandler_210.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_210); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[229]); /*@lineinfo:translated-code*//*@lineinfo:430^16*/ { org.apache.struts.taglib.html.TextTag __jsp_taghandler_211=(org.apache.struts.taglib.html.TextTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.TextTag.class,"org.apache.struts.taglib.html.TextTag maxlength name onchange property size"); __jsp_taghandler_211.setParent(__jsp_taghandler_200); __jsp_taghandler_211.setMaxlength("120"); __jsp_taghandler_211.setName("ActivosForm"); __jsp_taghandler_211.setOnchange("javascript:this.value=this.value.toUpperCase();"); __jsp_taghandler_211.setProperty("act_descripcion"); __jsp_taghandler_211.setSize("60"); __jsp_tag_starteval=__jsp_taghandler_211.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_211,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_211.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_211.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_211); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[230]); /*@lineinfo:translated-code*//*@lineinfo:435^12*/ { org.apache.struts.taglib.html.SubmitTag __jsp_taghandler_212=(org.apache.struts.taglib.html.SubmitTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.SubmitTag.class,"org.apache.struts.taglib.html.SubmitTag onclick property styleClass value"); __jsp_taghandler_212.setParent(__jsp_taghandler_200); __jsp_taghandler_212.setOnclick("operacion.value=3;opcion.value=2"); __jsp_taghandler_212.setProperty("boton"); __jsp_taghandler_212.setStyleClass("boton1"); __jsp_taghandler_212.setValue("Modificar"); __jsp_tag_starteval=__jsp_taghandler_212.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_212,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_212.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_212.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_212); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[231]); /*@lineinfo:translated-code*//*@lineinfo:435^124*/ } while (__jsp_taghandler_200.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); } if (__jsp_taghandler_200.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_200); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[232]); /*@lineinfo:translated-code*//*@lineinfo:439^6*/ { org.apache.struts.taglib.logic.EqualTag __jsp_taghandler_213=(org.apache.struts.taglib.logic.EqualTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.logic.EqualTag.class,"org.apache.struts.taglib.logic.EqualTag name property value"); __jsp_taghandler_213.setParent(__jsp_taghandler_186); __jsp_taghandler_213.setName("ActivosForm"); __jsp_taghandler_213.setProperty("opcion"); __jsp_taghandler_213.setValue("1"); __jsp_tag_starteval=__jsp_taghandler_213.doStartTag(); if (OracleJspRuntime.checkStartTagEval(__jsp_tag_starteval)) { do { /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[233]); /*@lineinfo:translated-code*//*@lineinfo:441^29*/ { org.apache.struts.taglib.bean.MessageTag __jsp_taghandler_214=(org.apache.struts.taglib.bean.MessageTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.bean.MessageTag.class,"org.apache.struts.taglib.bean.MessageTag key"); __jsp_taghandler_214.setParent(__jsp_taghandler_213); __jsp_taghandler_214.setKey("activos4.codrub"); __jsp_tag_starteval=__jsp_taghandler_214.doStartTag(); if (OracleJspRuntime.checkStartTagEval(__jsp_tag_starteval)) { do { } while (__jsp_taghandler_214.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); } if (__jsp_taghandler_214.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_214); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[234]); /*@lineinfo:translated-code*//*@lineinfo:442^16*/ { org.apache.struts.taglib.html.SelectTag __jsp_taghandler_215=(org.apache.struts.taglib.html.SelectTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.SelectTag.class,"org.apache.struts.taglib.html.SelectTag disabled name property"); __jsp_taghandler_215.setParent(__jsp_taghandler_213); __jsp_taghandler_215.setDisabled(false); __jsp_taghandler_215.setName("ActivosForm"); __jsp_taghandler_215.setProperty("act_codrub"); __jsp_tag_starteval=__jsp_taghandler_215.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_215,__jsp_tag_starteval,out); do { /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[235]); /*@lineinfo:translated-code*//*@lineinfo:443^16*/ { org.apache.struts.taglib.html.OptionsTag __jsp_taghandler_216=(org.apache.struts.taglib.html.OptionsTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.OptionsTag.class,"org.apache.struts.taglib.html.OptionsTag collection labelProperty property"); __jsp_taghandler_216.setParent(__jsp_taghandler_215); __jsp_taghandler_216.setCollection("RubrosLista"); __jsp_taghandler_216.setLabelProperty("descripcion"); __jsp_taghandler_216.setProperty("codigo"); __jsp_tag_starteval=__jsp_taghandler_216.doStartTag(); if (OracleJspRuntime.checkStartTagEval(__jsp_tag_starteval)) { do { } while (__jsp_taghandler_216.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); } if (__jsp_taghandler_216.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_216); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[236]); /*@lineinfo:translated-code*//*@lineinfo:443^102*/ } while (__jsp_taghandler_215.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_215.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_215); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[237]); /*@lineinfo:translated-code*//*@lineinfo:447^30*/ { org.apache.struts.taglib.bean.MessageTag __jsp_taghandler_217=(org.apache.struts.taglib.bean.MessageTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.bean.MessageTag.class,"org.apache.struts.taglib.bean.MessageTag key"); __jsp_taghandler_217.setParent(__jsp_taghandler_213); __jsp_taghandler_217.setKey("activos4.codreg"); __jsp_tag_starteval=__jsp_taghandler_217.doStartTag(); if (OracleJspRuntime.checkStartTagEval(__jsp_tag_starteval)) { do { } while (__jsp_taghandler_217.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); } if (__jsp_taghandler_217.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_217); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[238]); /*@lineinfo:translated-code*//*@lineinfo:448^17*/ { org.apache.struts.taglib.html.HiddenTag __jsp_taghandler_218=(org.apache.struts.taglib.html.HiddenTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.HiddenTag.class,"org.apache.struts.taglib.html.HiddenTag name property"); __jsp_taghandler_218.setParent(__jsp_taghandler_213); __jsp_taghandler_218.setName("ActivosForm"); __jsp_taghandler_218.setProperty("act_codreg"); __jsp_tag_starteval=__jsp_taghandler_218.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_218,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_218.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_218.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_218); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[239]); /*@lineinfo:translated-code*//*@lineinfo:449^13*/ { org.apache.struts.taglib.html.TextTag __jsp_taghandler_219=(org.apache.struts.taglib.html.TextTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.TextTag.class,"org.apache.struts.taglib.html.TextTag maxlength name property readonly size"); __jsp_taghandler_219.setParent(__jsp_taghandler_213); __jsp_taghandler_219.setMaxlength("30"); __jsp_taghandler_219.setName("ActivosForm"); __jsp_taghandler_219.setProperty("act_regdescripcion"); __jsp_taghandler_219.setReadonly(true); __jsp_taghandler_219.setSize("30"); __jsp_tag_starteval=__jsp_taghandler_219.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_219,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_219.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_219.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_219); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[240]); /*@lineinfo:translated-code*//*@lineinfo:452^30*/ { org.apache.struts.taglib.bean.MessageTag __jsp_taghandler_220=(org.apache.struts.taglib.bean.MessageTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.bean.MessageTag.class,"org.apache.struts.taglib.bean.MessageTag key"); __jsp_taghandler_220.setParent(__jsp_taghandler_213); __jsp_taghandler_220.setKey("activos4.codfin"); __jsp_tag_starteval=__jsp_taghandler_220.doStartTag(); if (OracleJspRuntime.checkStartTagEval(__jsp_tag_starteval)) { do { } while (__jsp_taghandler_220.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); } if (__jsp_taghandler_220.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_220); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[241]); /*@lineinfo:translated-code*//*@lineinfo:453^17*/ { org.apache.struts.taglib.html.HiddenTag __jsp_taghandler_221=(org.apache.struts.taglib.html.HiddenTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.HiddenTag.class,"org.apache.struts.taglib.html.HiddenTag name property"); __jsp_taghandler_221.setParent(__jsp_taghandler_213); __jsp_taghandler_221.setName("ActivosForm"); __jsp_taghandler_221.setProperty("act_codfin"); __jsp_tag_starteval=__jsp_taghandler_221.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_221,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_221.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_221.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_221); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[242]); /*@lineinfo:translated-code*//*@lineinfo:454^13*/ { org.apache.struts.taglib.html.TextTag __jsp_taghandler_222=(org.apache.struts.taglib.html.TextTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.TextTag.class,"org.apache.struts.taglib.html.TextTag maxlength name property readonly size"); __jsp_taghandler_222.setParent(__jsp_taghandler_213); __jsp_taghandler_222.setMaxlength("30"); __jsp_taghandler_222.setName("ActivosForm"); __jsp_taghandler_222.setProperty("act_findescripcion"); __jsp_taghandler_222.setReadonly(true); __jsp_taghandler_222.setSize("30"); __jsp_tag_starteval=__jsp_taghandler_222.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_222,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_222.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_222.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_222); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[243]); /*@lineinfo:translated-code*//*@lineinfo:459^12*/ { org.apache.struts.taglib.html.SubmitTag __jsp_taghandler_223=(org.apache.struts.taglib.html.SubmitTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.SubmitTag.class,"org.apache.struts.taglib.html.SubmitTag onclick property styleClass value"); __jsp_taghandler_223.setParent(__jsp_taghandler_213); __jsp_taghandler_223.setOnclick("operacion.value=1;opcion.value=1"); __jsp_taghandler_223.setProperty("boton"); __jsp_taghandler_223.setStyleClass("boton1"); __jsp_taghandler_223.setValue("Insertar"); __jsp_tag_starteval=__jsp_taghandler_223.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_223,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_223.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_223.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_223); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[244]); /*@lineinfo:translated-code*//*@lineinfo:459^123*/ } while (__jsp_taghandler_213.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); } if (__jsp_taghandler_213.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_213); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[245]); /*@lineinfo:translated-code*//*@lineinfo:462^20*/ } while (__jsp_taghandler_186.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); } if (__jsp_taghandler_186.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_186); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[246]); /*@lineinfo:translated-code*//*@lineinfo:467^1*/ { org.apache.struts.taglib.logic.EqualTag __jsp_taghandler_224=(org.apache.struts.taglib.logic.EqualTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.logic.EqualTag.class,"org.apache.struts.taglib.logic.EqualTag name property value"); __jsp_taghandler_224.setParent(__jsp_taghandler_1); __jsp_taghandler_224.setName("ActivosForm"); __jsp_taghandler_224.setProperty("operacion"); __jsp_taghandler_224.setValue("3"); __jsp_tag_starteval=__jsp_taghandler_224.doStartTag(); if (OracleJspRuntime.checkStartTagEval(__jsp_tag_starteval)) { do { /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[247]); /*@lineinfo:translated-code*//*@lineinfo:473^6*/ { org.apache.struts.taglib.html.HiddenTag __jsp_taghandler_225=(org.apache.struts.taglib.html.HiddenTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.HiddenTag.class,"org.apache.struts.taglib.html.HiddenTag name property"); __jsp_taghandler_225.setParent(__jsp_taghandler_224); __jsp_taghandler_225.setName("ActivosForm"); __jsp_taghandler_225.setProperty("act_codrub"); __jsp_tag_starteval=__jsp_taghandler_225.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_225,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_225.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_225.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_225); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[248]); /*@lineinfo:translated-code*//*@lineinfo:474^6*/ { org.apache.struts.taglib.html.HiddenTag __jsp_taghandler_226=(org.apache.struts.taglib.html.HiddenTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.HiddenTag.class,"org.apache.struts.taglib.html.HiddenTag name property"); __jsp_taghandler_226.setParent(__jsp_taghandler_224); __jsp_taghandler_226.setName("ActivosForm"); __jsp_taghandler_226.setProperty("act_codreg"); __jsp_tag_starteval=__jsp_taghandler_226.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_226,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_226.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_226.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_226); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[249]); /*@lineinfo:translated-code*//*@lineinfo:475^6*/ { org.apache.struts.taglib.html.HiddenTag __jsp_taghandler_227=(org.apache.struts.taglib.html.HiddenTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.HiddenTag.class,"org.apache.struts.taglib.html.HiddenTag name property"); __jsp_taghandler_227.setParent(__jsp_taghandler_224); __jsp_taghandler_227.setName("ActivosForm"); __jsp_taghandler_227.setProperty("act_codgrp"); __jsp_tag_starteval=__jsp_taghandler_227.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_227,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_227.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_227.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_227); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[250]); /*@lineinfo:translated-code*//*@lineinfo:476^6*/ { org.apache.struts.taglib.html.HiddenTag __jsp_taghandler_228=(org.apache.struts.taglib.html.HiddenTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.HiddenTag.class,"org.apache.struts.taglib.html.HiddenTag name property"); __jsp_taghandler_228.setParent(__jsp_taghandler_224); __jsp_taghandler_228.setName("ActivosForm"); __jsp_taghandler_228.setProperty("act_codfin"); __jsp_tag_starteval=__jsp_taghandler_228.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_228,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_228.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_228.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_228); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[251]); /*@lineinfo:translated-code*//*@lineinfo:477^6*/ { org.apache.struts.taglib.html.HiddenTag __jsp_taghandler_229=(org.apache.struts.taglib.html.HiddenTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.HiddenTag.class,"org.apache.struts.taglib.html.HiddenTag name property"); __jsp_taghandler_229.setParent(__jsp_taghandler_224); __jsp_taghandler_229.setName("ActivosForm"); __jsp_taghandler_229.setProperty("act_descripcion"); __jsp_tag_starteval=__jsp_taghandler_229.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_229,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_229.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_229.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_229); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[252]); /*@lineinfo:user-code*//*@lineinfo:485^7*/ int pnum=0; /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[253]); /*@lineinfo:translated-code*//*@lineinfo:486^7*/ { org.apache.struts.taglib.logic.IterateTag __jsp_taghandler_230=(org.apache.struts.taglib.logic.IterateTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.logic.IterateTag.class,"org.apache.struts.taglib.logic.IterateTag id name"); __jsp_taghandler_230.setParent(__jsp_taghandler_224); __jsp_taghandler_230.setId("lista"); __jsp_taghandler_230.setName("Activos3Lista"); java.lang.Object lista = null; __jsp_tag_starteval=__jsp_taghandler_230.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_230,__jsp_tag_starteval,out); do { lista = (java.lang.Object) pageContext.findAttribute("lista"); /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[254]); /*@lineinfo:user-code*//*@lineinfo:487^9*/ if (pnum==1) { /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[255]); /*@lineinfo:user-code*//*@lineinfo:489^9*/ } else { /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[256]); /*@lineinfo:user-code*//*@lineinfo:491^9*/ } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[257]); /*@lineinfo:translated-code*//*@lineinfo:492^16*/ { org.apache.struts.taglib.bean.WriteTag __jsp_taghandler_231=(org.apache.struts.taglib.bean.WriteTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.bean.WriteTag.class,"org.apache.struts.taglib.bean.WriteTag name property"); __jsp_taghandler_231.setParent(__jsp_taghandler_230); __jsp_taghandler_231.setName("lista"); __jsp_taghandler_231.setProperty("codrub"); __jsp_tag_starteval=__jsp_taghandler_231.doStartTag(); if (OracleJspRuntime.checkStartTagEval(__jsp_tag_starteval)) { do { } while (__jsp_taghandler_231.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); } if (__jsp_taghandler_231.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_231); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[258]); /*@lineinfo:translated-code*//*@lineinfo:492^62*/ { org.apache.struts.taglib.bean.WriteTag __jsp_taghandler_232=(org.apache.struts.taglib.bean.WriteTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.bean.WriteTag.class,"org.apache.struts.taglib.bean.WriteTag name property"); __jsp_taghandler_232.setParent(__jsp_taghandler_230); __jsp_taghandler_232.setName("lista"); __jsp_taghandler_232.setProperty("codreg"); __jsp_tag_starteval=__jsp_taghandler_232.doStartTag(); if (OracleJspRuntime.checkStartTagEval(__jsp_tag_starteval)) { do { } while (__jsp_taghandler_232.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); } if (__jsp_taghandler_232.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_232); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[259]); /*@lineinfo:translated-code*//*@lineinfo:492^108*/ { org.apache.struts.taglib.bean.WriteTag __jsp_taghandler_233=(org.apache.struts.taglib.bean.WriteTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.bean.WriteTag.class,"org.apache.struts.taglib.bean.WriteTag name property"); __jsp_taghandler_233.setParent(__jsp_taghandler_230); __jsp_taghandler_233.setName("lista"); __jsp_taghandler_233.setProperty("ceros"); __jsp_tag_starteval=__jsp_taghandler_233.doStartTag(); if (OracleJspRuntime.checkStartTagEval(__jsp_tag_starteval)) { do { } while (__jsp_taghandler_233.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); } if (__jsp_taghandler_233.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_233); } /*@lineinfo:492^152*/ { org.apache.struts.taglib.bean.WriteTag __jsp_taghandler_234=(org.apache.struts.taglib.bean.WriteTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.bean.WriteTag.class,"org.apache.struts.taglib.bean.WriteTag name property"); __jsp_taghandler_234.setParent(__jsp_taghandler_230); __jsp_taghandler_234.setName("lista"); __jsp_taghandler_234.setProperty("codigo"); __jsp_tag_starteval=__jsp_taghandler_234.doStartTag(); if (OracleJspRuntime.checkStartTagEval(__jsp_tag_starteval)) { do { } while (__jsp_taghandler_234.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); } if (__jsp_taghandler_234.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_234); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[260]); /*@lineinfo:translated-code*//*@lineinfo:493^16*/ { org.apache.struts.taglib.bean.WriteTag __jsp_taghandler_235=(org.apache.struts.taglib.bean.WriteTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.bean.WriteTag.class,"org.apache.struts.taglib.bean.WriteTag name property"); __jsp_taghandler_235.setParent(__jsp_taghandler_230); __jsp_taghandler_235.setName("lista"); __jsp_taghandler_235.setProperty("descodgrp"); __jsp_tag_starteval=__jsp_taghandler_235.doStartTag(); if (OracleJspRuntime.checkStartTagEval(__jsp_tag_starteval)) { do { } while (__jsp_taghandler_235.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); } if (__jsp_taghandler_235.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_235); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[261]); /*@lineinfo:translated-code*//*@lineinfo:494^16*/ { org.apache.struts.taglib.bean.WriteTag __jsp_taghandler_236=(org.apache.struts.taglib.bean.WriteTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.bean.WriteTag.class,"org.apache.struts.taglib.bean.WriteTag name property"); __jsp_taghandler_236.setParent(__jsp_taghandler_230); __jsp_taghandler_236.setName("lista"); __jsp_taghandler_236.setProperty("descripcion"); __jsp_tag_starteval=__jsp_taghandler_236.doStartTag(); if (OracleJspRuntime.checkStartTagEval(__jsp_tag_starteval)) { do { } while (__jsp_taghandler_236.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); } if (__jsp_taghandler_236.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_236); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[262]); /*@lineinfo:translated-code*//*@lineinfo:495^12*/ { org.apache.struts.taglib.logic.EqualTag __jsp_taghandler_237=(org.apache.struts.taglib.logic.EqualTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.logic.EqualTag.class,"org.apache.struts.taglib.logic.EqualTag name property value"); __jsp_taghandler_237.setParent(__jsp_taghandler_230); __jsp_taghandler_237.setName("ActivosForm"); __jsp_taghandler_237.setProperty("opcion"); __jsp_taghandler_237.setValue("5"); __jsp_tag_starteval=__jsp_taghandler_237.doStartTag(); if (OracleJspRuntime.checkStartTagEval(__jsp_tag_starteval)) { do { /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[263]); /*@lineinfo:translated-code*//*@lineinfo:496^33*/ { org.apache.struts.taglib.html.SubmitTag __jsp_taghandler_238=(org.apache.struts.taglib.html.SubmitTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.SubmitTag.class,"org.apache.struts.taglib.html.SubmitTag indexed onclick property styleClass value"); __jsp_taghandler_238.setParent(__jsp_taghandler_237); __jsp_taghandler_238.setIndexed(true); __jsp_taghandler_238.setOnclick("operacion.value=1;opcion.value=5"); __jsp_taghandler_238.setProperty("boton"); __jsp_taghandler_238.setStyleClass("boton1"); __jsp_taghandler_238.setValue("Reportar"); __jsp_tag_starteval=__jsp_taghandler_238.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_238,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_238.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_238.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_238); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[264]); /*@lineinfo:translated-code*//*@lineinfo:496^159*/ } while (__jsp_taghandler_237.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); } if (__jsp_taghandler_237.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_237); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[265]); /*@lineinfo:translated-code*//*@lineinfo:498^12*/ { org.apache.struts.taglib.logic.EqualTag __jsp_taghandler_239=(org.apache.struts.taglib.logic.EqualTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.logic.EqualTag.class,"org.apache.struts.taglib.logic.EqualTag name property value"); __jsp_taghandler_239.setParent(__jsp_taghandler_230); __jsp_taghandler_239.setName("ActivosForm"); __jsp_taghandler_239.setProperty("opcion"); __jsp_taghandler_239.setValue("3"); __jsp_tag_starteval=__jsp_taghandler_239.doStartTag(); if (OracleJspRuntime.checkStartTagEval(__jsp_tag_starteval)) { do { /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[266]); /*@lineinfo:translated-code*//*@lineinfo:499^33*/ { org.apache.struts.taglib.html.SubmitTag __jsp_taghandler_240=(org.apache.struts.taglib.html.SubmitTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.SubmitTag.class,"org.apache.struts.taglib.html.SubmitTag indexed onclick property styleClass value"); __jsp_taghandler_240.setParent(__jsp_taghandler_239); __jsp_taghandler_240.setIndexed(true); __jsp_taghandler_240.setOnclick("operacion.value=1;opcion.value=3"); __jsp_taghandler_240.setProperty("boton"); __jsp_taghandler_240.setStyleClass("boton1"); __jsp_taghandler_240.setValue("Eliminar"); __jsp_tag_starteval=__jsp_taghandler_240.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_240,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_240.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_240.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_240); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[267]); /*@lineinfo:translated-code*//*@lineinfo:499^159*/ } while (__jsp_taghandler_239.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); } if (__jsp_taghandler_239.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_239); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[268]); /*@lineinfo:translated-code*//*@lineinfo:501^12*/ { org.apache.struts.taglib.logic.EqualTag __jsp_taghandler_241=(org.apache.struts.taglib.logic.EqualTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.logic.EqualTag.class,"org.apache.struts.taglib.logic.EqualTag name property value"); __jsp_taghandler_241.setParent(__jsp_taghandler_230); __jsp_taghandler_241.setName("ActivosForm"); __jsp_taghandler_241.setProperty("opcion"); __jsp_taghandler_241.setValue("2"); __jsp_tag_starteval=__jsp_taghandler_241.doStartTag(); if (OracleJspRuntime.checkStartTagEval(__jsp_tag_starteval)) { do { /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[269]); /*@lineinfo:translated-code*//*@lineinfo:502^33*/ { org.apache.struts.taglib.html.SubmitTag __jsp_taghandler_242=(org.apache.struts.taglib.html.SubmitTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.SubmitTag.class,"org.apache.struts.taglib.html.SubmitTag indexed onclick property styleClass value"); __jsp_taghandler_242.setParent(__jsp_taghandler_241); __jsp_taghandler_242.setIndexed(true); __jsp_taghandler_242.setOnclick("operacion.value=1;opcion.value=2"); __jsp_taghandler_242.setProperty("boton"); __jsp_taghandler_242.setStyleClass("boton1"); __jsp_taghandler_242.setValue("Modificar"); __jsp_tag_starteval=__jsp_taghandler_242.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_242,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_242.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_242.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_242); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[270]); /*@lineinfo:translated-code*//*@lineinfo:502^160*/ } while (__jsp_taghandler_241.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); } if (__jsp_taghandler_241.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_241); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[271]); /*@lineinfo:user-code*//*@lineinfo:505^10*/ if (pnum==0) pnum=1; else pnum=0; /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[272]); /*@lineinfo:translated-code*//*@lineinfo:505^49*/ } while (__jsp_taghandler_230.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_230.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_230); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[273]); /*@lineinfo:translated-code*//*@lineinfo:506^23*/ } while (__jsp_taghandler_224.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); } if (__jsp_taghandler_224.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_224); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[274]); /*@lineinfo:translated-code*//*@lineinfo:513^15*/ } while (__jsp_taghandler_1.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); } if (__jsp_taghandler_1.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_1); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[275]); } catch( Throwable e) { try { if (out != null) out.clear(); } catch( Exception clearException) { } pageContext.handlePageException( e); } finally { OracleJspRuntime.extraHandlePCFinally(pageContext,true); JspFactory.getDefaultFactory().releasePageContext(pageContext); } } private static class __jsp_StaticText { private static final char text[][]=new char[276][]; static { try { text[0] = "\n".toCharArray(); text[1] = "\n".toCharArray(); text[2] = "\n".toCharArray(); text[3] = "\n".toCharArray(); text[4] = "\n<html>\n<head>\n <meta http-equiv=\"Content-Type\" content=\"text/html; charset=windows-125\">\n <meta http-equiv=\"Expires\" content=\"-1\">\n <link href=\"Estilos.css\" rel=\"stylesheet\" type=\"text/css\">\n</head>\n<script language=\"JavaScript\" type=\"text/JavaScript\" src=\"Validaciones2.js?1.3\"></script>\n<script language=\"JavaScript\" type=\"text/JavaScript\">\n function pantallaCompleta(pagina) {\n var ancho = window.screen.availWidth - 50;\n var alto = window.screen.availHeight - 150;\n var omenu = window.open(pagina, \"_blank\", \"width=\"+ancho+\", height=\"+alto+\",left=20,top=20,status=yes,resizable=yes,titlebar=yes,scrollbars=yes,dependent=yes\");\n omenu.focus();\n }\n</script>\n<body>\n<table border=\"1\" width=\"100%\" align=\"center\" class=\"soloborde\" bgcolor=\"#C1C1FF\">\n<caption>Activos</caption>\n<tr><td>\n".toCharArray(); text[5] = "\n".toCharArray(); text[6] = "\n".toCharArray(); text[7] = "\n".toCharArray(); text[8] = "\n ".toCharArray(); text[9] = "\n ".toCharArray(); text[10] = "\n ".toCharArray(); text[11] = "\n ".toCharArray(); text[12] = "\n ".toCharArray(); text[13] = "\n ".toCharArray(); text[14] = "\n ".toCharArray(); text[15] = "\n ".toCharArray(); text[16] = "\n ".toCharArray(); text[17] = "\n ".toCharArray(); text[18] = "\n ".toCharArray(); text[19] = "\n ".toCharArray(); text[20] = "\n ".toCharArray(); text[21] = "\n ".toCharArray(); text[22] = "\n ".toCharArray(); text[23] = "\n ".toCharArray(); text[24] = "\n ".toCharArray(); text[25] = "\n ".toCharArray(); text[26] = "\n ".toCharArray(); text[27] = "\n ".toCharArray(); text[28] = "\n ".toCharArray(); text[29] = "\n <table width=\"100%\" align=\"center\" class=\"soloborde\" bgcolor=\"#C1C1FF\" border=\"1\">\n <tr>\n <td class=\"S10d\">".toCharArray(); text[30] = "</td>\n <td colspan=\"3\">".toCharArray(); text[31] = "\n ".toCharArray(); text[32] = "</td>\n </tr>\n <tr>\n <td class=\"S10d\">".toCharArray(); text[33] = "</td>\n <td colspan=\"3\">".toCharArray(); text[34] = "\n ".toCharArray(); text[35] = "</td>\n </tr>\n <tr>\n <td class=\"S10d\">".toCharArray(); text[36] = "</td>\n <td colspan=\"3\">".toCharArray(); text[37] = "\n ".toCharArray(); text[38] = "</td>\n </tr>\n <tr>\n <td class=\"S10d\">".toCharArray(); text[39] = "</td>\n <td>".toCharArray(); text[40] = "\n ".toCharArray(); text[41] = "\n ".toCharArray(); text[42] = "</td>\n <td class=\"S10d\">".toCharArray(); text[43] = "</td>\n <td>\n ".toCharArray(); text[44] = " \n </td>\n </tr>\n <tr>\n <td class=\"S10d\">".toCharArray(); text[45] = "</td>\n <td>\n ".toCharArray(); text[46] = " \n </td>\n <td class=\"S10d\">".toCharArray(); text[47] = "</td>\n <td>\n ".toCharArray(); text[48] = " \n </td>\n </tr>\n <tr>\n <td class=\"S10d\">".toCharArray(); text[49] = "</td>\n <td>".toCharArray(); text[50] = "\n ".toCharArray(); text[51] = "\n ".toCharArray(); text[52] = "</td>\n <td class=\"S10d\">".toCharArray(); text[53] = "</td>\n <td>".toCharArray(); text[54] = "\n ".toCharArray(); text[55] = "\n ".toCharArray(); text[56] = "</td>\n </tr>\n <tr>\n <td class=\"S10d\">".toCharArray(); text[57] = "</td>\n <td>".toCharArray(); text[58] = "</td>\n </tr>\n <tr>\n <td class=\"S10d\">".toCharArray(); text[59] = "</td>\n <td>".toCharArray(); text[60] = "</td>\n <td class=\"S10d\">".toCharArray(); text[61] = "</td>\n <td>".toCharArray(); text[62] = "</td>\n </tr>\n </table>\n <table width=\"100%\" align=\"center\" class=\"soloborde\" bgcolor=\"#C1C1FF\" border=\"1\">\n <tr>\n <td class=\"S10d\">".toCharArray(); text[63] = "</td>\n <td>".toCharArray(); text[64] = "</td>\n </tr>\n <tr>\n <td class=\"S10d\">".toCharArray(); text[65] = "</td>\n <td>".toCharArray(); text[66] = "</td>\n </tr>\n <tr>\n <td class=\"S10d\">*\n ".toCharArray(); text[67] = "\n </td>\n <td>\n ".toCharArray(); text[68] = "\n </td>\n </tr> \n </table>\n <table width=\"100%\" align=\"center\" class=\"soloborde\" bgcolor=\"#C1C1FF\" border=\"1\"> \n <tr>\n <td class=\"S10d\">".toCharArray(); text[69] = "*".toCharArray(); text[70] = "</td>\n <td>".toCharArray(); text[71] = "</td>\n <td class=\"S10d\">".toCharArray(); text[72] = "</td>\n <td>".toCharArray(); text[73] = "</td>\n </tr>\n <tr>\n <td class=\"S10d\">".toCharArray(); text[74] = "</td>\n <td>".toCharArray(); text[75] = "</td>\n <td class=\"S10d\">".toCharArray(); text[76] = "</td>\n <td>".toCharArray(); text[77] = "</td>\n </tr>\n <tr>\n <td class=\"S10d\">".toCharArray(); text[78] = "</td>\n <td>".toCharArray(); text[79] = "</td>\n <td class=\"S10d\">".toCharArray(); text[80] = "</td>\n <td>".toCharArray(); text[81] = "</td>\n </tr>\n <tr>\n <td class=\"S10d\">".toCharArray(); text[82] = "</td>\n <td>".toCharArray(); text[83] = "</td>\n <td class=\"S10d\">".toCharArray(); text[84] = "</td>\n <td>".toCharArray(); text[85] = "</td>\n </tr>\n <tr>\n <td class=\"S10d\">".toCharArray(); text[86] = "</td>\n <td>".toCharArray(); text[87] = "</td>\n <td class=\"S10d\">".toCharArray(); text[88] = "</td>\n <td>".toCharArray(); text[89] = "</td>\n </tr>\n <tr>\n <td class=\"S10d\">".toCharArray(); text[90] = "</td>\n <td>".toCharArray(); text[91] = "</td>\n <td class=\"S10d\">".toCharArray(); text[92] = "</td>\n <td>".toCharArray(); text[93] = "\n ".toCharArray(); text[94] = "\n ".toCharArray(); text[95] = "\n </td>\n </tr>\n <tr>\n <td class=\"S10d\">".toCharArray(); text[96] = "</td>\n <td>".toCharArray(); text[97] = "</td>\n </tr>\n <tr>\n <td colspan=2>".toCharArray(); text[98] = "</td>\n </tr> \n <tr>\n <td colspan=\"4\">\n <FONT color=\"#FF0000\" face=\"Arial, Helvetica, san-serif\" size=2> \n ".toCharArray(); text[99] = "\n No se olvide verificar la existencia del tipo de cambio para la fecha de compra y la fecha de activación\n ".toCharArray(); text[100] = "\n </FONT>\n </td>\n </tr> \n </table>\n ".toCharArray(); text[101] = "\n ".toCharArray(); text[102] = "\n <table width=\"100%\" align=\"center\" class=\"soloborde\" bgcolor=\"#C1C1FF\" border=\"1\">\n <tr>\n <td class=\"S10d\">".toCharArray(); text[103] = "</td>\n <td colspan=\"3\">".toCharArray(); text[104] = "\n ".toCharArray(); text[105] = "</td>\n </tr>\n <tr>\n <td class=\"S10d\">".toCharArray(); text[106] = "</td>\n <td colspan=\"3\">".toCharArray(); text[107] = "\n ".toCharArray(); text[108] = "</td>\n </tr>\n <tr>\n <td class=\"S10d\">".toCharArray(); text[109] = "</td>\n <td colspan=\"3\">".toCharArray(); text[110] = "\n ".toCharArray(); text[111] = "</td>\n </tr>\n <tr>\n <td class=\"S10d\">".toCharArray(); text[112] = "</td>\n <td>\n ".toCharArray(); text[113] = "\n ".toCharArray(); text[114] = "\n ".toCharArray(); text[115] = "\n </td>\n <td class=\"S10d\">".toCharArray(); text[116] = "</td>\n <td>\n ".toCharArray(); text[117] = " \n </td>\n </tr>\n <tr>\n <td class=\"S10d\">".toCharArray(); text[118] = "</td>\n <td>\n ".toCharArray(); text[119] = " \n </td>\n <td class=\"S10d\">".toCharArray(); text[120] = "</td>\n <td>\n ".toCharArray(); text[121] = " \n </td>\n </tr>\n <tr>\n <td class=\"S10d\">".toCharArray(); text[122] = "</td>\n <td>\n ".toCharArray(); text[123] = " \n </td>\n <td class=\"S10d\">".toCharArray(); text[124] = "</td>\n <td>".toCharArray(); text[125] = "\n ".toCharArray(); text[126] = "\n ".toCharArray(); text[127] = "\n </td> \n </tr>\n <tr>\n <td class=\"S10d\">".toCharArray(); text[128] = "</td>\n <td>\n ".toCharArray(); text[129] = " \n </td>\n </tr>\n <tr>\n <td class=\"S10d\">".toCharArray(); text[130] = "</td>\n <td>".toCharArray(); text[131] = "</td>\n <td class=\"S10d\">".toCharArray(); text[132] = "</td>\n <td>".toCharArray(); text[133] = "</td>\n </tr> \n </table>\n <table width=\"100%\" align=\"center\" class=\"soloborde\" bgcolor=\"#C1C1FF\" border=\"1\">\n <tr>\n <td class=\"S10d\">".toCharArray(); text[134] = "</td>\n <td>".toCharArray(); text[135] = "</td>\n </tr>\n <tr>\n <td class=\"S10d\">".toCharArray(); text[136] = "</td>\n <td>".toCharArray(); text[137] = "</td>\n </tr>\n <tr>\n <td class=\"S10d\">*\n ".toCharArray(); text[138] = "\n </td>\n <td>\n ".toCharArray(); text[139] = "\n </td>\n </tr> \n </table>\n <table width=\"100%\" align=\"center\" class=\"soloborde\" bgcolor=\"#C1C1FF\" border=\"1\"> \n <tr>\n <td class=\"S10d\">".toCharArray(); text[140] = "*".toCharArray(); text[141] = "</td>\n <td>".toCharArray(); text[142] = "</td>\n <td class=\"S10d\">".toCharArray(); text[143] = "</td>\n <td>".toCharArray(); text[144] = "</td>\n </tr>\n <tr>\n <td class=\"S10d\">".toCharArray(); text[145] = "</td>\n <td>".toCharArray(); text[146] = "</td>\n <td class=\"S10d\">".toCharArray(); text[147] = "</td>\n <td>".toCharArray(); text[148] = "</td>\n </tr>\n <tr>\n <td class=\"S10d\">".toCharArray(); text[149] = "</td>\n <td>".toCharArray(); text[150] = "</td>\n <td class=\"S10d\">".toCharArray(); text[151] = "</td>\n <td>".toCharArray(); text[152] = "</td>\n </tr>\n <tr>\n <td class=\"S10d\">".toCharArray(); text[153] = "</td>\n <td>".toCharArray(); text[154] = "</td>\n <td class=\"S10d\">".toCharArray(); text[155] = "</td>\n <td>".toCharArray(); text[156] = "</td>\n </tr>\n <tr>\n <td class=\"S10d\">".toCharArray(); text[157] = "</td>\n <td>".toCharArray(); text[158] = "</td>\n <td class=\"S10d\">".toCharArray(); text[159] = "</td>\n <td>".toCharArray(); text[160] = "</td>\n </tr>\n <tr>\n <td class=\"S10d\">".toCharArray(); text[161] = "</td>\n <td>".toCharArray(); text[162] = "</td>\n <td class=\"S10d\">".toCharArray(); text[163] = "</td>\n <td>".toCharArray(); text[164] = "\n ".toCharArray(); text[165] = "\n ".toCharArray(); text[166] = "\n </td>\n </tr>\n \n <tr>\n <td class=\"S10d\">".toCharArray(); text[167] = "</td>\n <td>".toCharArray(); text[168] = "</td>\n </tr>\n <tr>\n <td colspan=2>".toCharArray(); text[169] = "</td>\n </tr> \n </table> \n ".toCharArray(); text[170] = " \n ".toCharArray(); text[171] = "\n <table width=\"100%\" align=\"center\" class=\"soloborde\" bgcolor=\"#C1C1FF\" border=\"1\">\n <tr>\n <td class=\"S10d\">".toCharArray(); text[172] = "</td>\n <td colspan=\"3\">".toCharArray(); text[173] = "\n ".toCharArray(); text[174] = "</td>\n </tr>\n <tr>\n <td class=\"S10d\">".toCharArray(); text[175] = "</td>\n <td colspan=\"3\">".toCharArray(); text[176] = "\n ".toCharArray(); text[177] = "</td>\n </tr>\n <tr>\n <td class=\"S10d\">".toCharArray(); text[178] = "</td>\n <td colspan=\"3\">".toCharArray(); text[179] = "\n ".toCharArray(); text[180] = "</td>\n </tr>\n <tr>\n <td class=\"S10d\">".toCharArray(); text[181] = "</td>\n <td>\n ".toCharArray(); text[182] = " \n </td>\n <td class=\"S10d\">".toCharArray(); text[183] = "</td>\n <td>\n ".toCharArray(); text[184] = " \n </td>\n </tr>\n <tr>\n <td class=\"S10d\">".toCharArray(); text[185] = "</td>\n <td>\n ".toCharArray(); text[186] = " \n </td>\n <td class=\"S10d\">".toCharArray(); text[187] = "</td>\n <td>\n ".toCharArray(); text[188] = " \n </td>\n </tr>\n <tr>\n <td class=\"S10d\">".toCharArray(); text[189] = "</td>\n <td>\n ".toCharArray(); text[190] = " \n </td>\n <td class=\"S10d\">".toCharArray(); text[191] = "</td>\n <td>\n ".toCharArray(); text[192] = " \n </td>\n </tr>\n <tr>\n <td class=\"S10d\">".toCharArray(); text[193] = "</td>\n <td>\n ".toCharArray(); text[194] = " \n </td>\n </tr>\n <tr>\n <td class=\"S10d\">".toCharArray(); text[195] = "</td>\n <td>".toCharArray(); text[196] = "</td>\n <td class=\"S10d\">".toCharArray(); text[197] = "</td>\n <td>".toCharArray(); text[198] = "</td>\n </tr> \n <tr>\n <td colspan=2>".toCharArray(); text[199] = "</td>\n </tr> \n </table>\n ".toCharArray(); text[200] = "\n".toCharArray(); text[201] = "\n".toCharArray(); text[202] = "\n <table width=\"100%\" align=\"center\" class=\"soloborde\" bgcolor=\"#C1C1FF\">\n <tr class=\"T8a\">\n <td>\n ".toCharArray(); text[203] = "\n <tr>\n <td class=\"S10d\">".toCharArray(); text[204] = "</td>\n <td>".toCharArray(); text[205] = "\n ".toCharArray(); text[206] = "\n ".toCharArray(); text[207] = "</td> \n </tr>\n <tr>\n <td class=\"S10d\">".toCharArray(); text[208] = "</td>\n <td>".toCharArray(); text[209] = "\n ".toCharArray(); text[210] = "</td>\n </tr> \n <tr>\n <td class=\"S10d\">".toCharArray(); text[211] = "</td>\n <td>".toCharArray(); text[212] = "\n ".toCharArray(); text[213] = "</td>\n </tr> \n <tr>\n <td class=\"S10d\">".toCharArray(); text[214] = " % = Comodin</td>\n <td>".toCharArray(); text[215] = "</td>\n </tr>\n <tr>\n <td></td>\n <td align=\"left\">\n ".toCharArray(); text[216] = "\n </td>\n </tr>\n ".toCharArray(); text[217] = "\n ".toCharArray(); text[218] = "\n <tr>\n <td class=\"S10d\">".toCharArray(); text[219] = "</td>\n <td>".toCharArray(); text[220] = "\n ".toCharArray(); text[221] = "\n ".toCharArray(); text[222] = "</td> \n </tr>\n <tr>\n <td class=\"S10d\">".toCharArray(); text[223] = "</td>\n <td>".toCharArray(); text[224] = "\n ".toCharArray(); text[225] = "</td>\n </tr> \n <tr>\n <td class=\"S10d\">".toCharArray(); text[226] = "</td>\n <td>".toCharArray(); text[227] = "\n ".toCharArray(); text[228] = "</td>\n </tr> \n <tr>\n <td class=\"S10d\">".toCharArray(); text[229] = " % = Comodin</td>\n <td>".toCharArray(); text[230] = "</td>\n </tr>\n <tr>\n <td></td>\n <td align=\"left\">\n ".toCharArray(); text[231] = "\n </td>\n </tr>\n ".toCharArray(); text[232] = "\n ".toCharArray(); text[233] = "\n <tr>\n <td class=\"S10d\">".toCharArray(); text[234] = "</td>\n <td>".toCharArray(); text[235] = "\n ".toCharArray(); text[236] = "\n ".toCharArray(); text[237] = "</td> \n </tr>\n <tr>\n <td class=\"S10d\">".toCharArray(); text[238] = "</td>\n <td>".toCharArray(); text[239] = "\n ".toCharArray(); text[240] = "</td>\n </tr> \n <tr>\n <td class=\"S10d\">".toCharArray(); text[241] = "</td>\n <td>".toCharArray(); text[242] = "\n ".toCharArray(); text[243] = "</td>\n </tr> \n <tr>\n <td></td>\n <td align=\"left\">\n ".toCharArray(); text[244] = "\n </td>\n </tr>\n ".toCharArray(); text[245] = "\n </td>\n </tr>\n </table>\n".toCharArray(); text[246] = "\n".toCharArray(); text[247] = "\n<table width=\"100%\" align=\"center\" class=\"soloborde\" bgcolor=\"#C1C1FF\" border=\"1\">\n <tr class=\"T8a\">\n <td>\n <table width=\"100%\" align=\"center\" class=\"soloborde\" bgcolor=\"#C1C1FF\" border=\"1\">\n <tr><td>\n ".toCharArray(); text[248] = "\n ".toCharArray(); text[249] = "\n ".toCharArray(); text[250] = "\n ".toCharArray(); text[251] = " \n ".toCharArray(); text[252] = " \n <table width=\"100%\" class=\"soloborde\" bgcolor=\"#C1C1FF\">\n <tr class=\"FondoAzul\">\n <td width=\"60\" scope=\"col\" class=\"S10c\">Código</td>\n <td width=\"60\" scope=\"col\" class=\"S10c\">Grupo</td> \n <td width=\"160\" scope=\"col\" class=\"S10c\">Descripción</td>\n <td></td>\n </tr>\n ".toCharArray(); text[253] = "\n ".toCharArray(); text[254] = "\n ".toCharArray(); text[255] = "\n <tr class=\"T8b\">\n ".toCharArray(); text[256] = "\n <tr class=\"T8a\">\n ".toCharArray(); text[257] = "\n <td>".toCharArray(); text[258] = "-".toCharArray(); text[259] = "-".toCharArray(); text[260] = "</td>\n <td>".toCharArray(); text[261] = "</td>\n <td>".toCharArray(); text[262] = "</td>\n ".toCharArray(); text[263] = "\n <td align=\"right\">".toCharArray(); text[264] = "</td>\n ".toCharArray(); text[265] = "\n ".toCharArray(); text[266] = "\n <td align=\"right\">".toCharArray(); text[267] = "</td>\n ".toCharArray(); text[268] = " \n ".toCharArray(); text[269] = "\n <td align=\"right\">".toCharArray(); text[270] = "</td>\n ".toCharArray(); text[271] = " \n </tr>\n ".toCharArray(); text[272] = "\n ".toCharArray(); text[273] = "\n </table>\n </td></tr> \n </table>\n </td>\n </tr>\n</table> \n".toCharArray(); text[274] = "\n".toCharArray(); text[275] = "\n</td></tr>\n<tr><td align=\"center\" colspan=\"2\" class=\"S10d\">(*) Campos Obligatorios</td></tr>\n</table>\n</body>\n</html>".toCharArray(); } catch (Throwable th) { System.err.println(th); } } } } <file_sep>package ActivosFijos; import org.apache.struts.action.ActionForm; import org.apache.struts.action.ActionErrors; import org.apache.struts.action.ActionError; import org.apache.struts.action.ActionMapping; import javax.servlet.http.HttpServletRequest; public class FuncionariosDetalleForm extends ActionForm { String codigo; String descripcion; String cargo; String codofi; String codreg; String codfin; String descripcion_codofi; String descripcion_codreg; String descripcion_codfin; String correo; String estado; /** * Reset all properties to their default values. * @param mapping The ActionMapping used to select this instance. * @param request The HTTP Request we are processing. */ public void reset(ActionMapping mapping, HttpServletRequest request) { super.reset(mapping, request); } /** * Validate all properties to their default values. * @param mapping The ActionMapping used to select this instance. * @param request The HTTP Request we are processing. * @return ActionErrors A list of all errors found. */ public ActionErrors validate(ActionMapping mapping, HttpServletRequest request) { return super.validate(mapping, request); } public String getCodigo() { return codigo; } public void setCodigo(String newCodigo) { codigo = newCodigo; } public String getDescripcion() { return descripcion; } public void setDescripcion(String newDescripcion) { descripcion = newDescripcion; } public String getCargo() { return cargo; } public void setCargo(String newCargo) { cargo = newCargo; } public String getCodofi() { return codofi; } public void setCodofi(String newCodofi) { codofi = newCodofi; } public String getCodreg() { return codreg; } public void setCodreg(String newCodreg) { codreg = newCodreg; } public String getCodfin() { return codfin; } public void setCodfin(String newCodfin) { codfin = newCodfin; } public String getDescripcion_codofi() { return descripcion_codofi; } public void setDescripcion_codofi(String newDescripcion_codofi) { descripcion_codofi = newDescripcion_codofi; } public String getDescripcion_codreg() { return descripcion_codreg; } public void setDescripcion_codreg(String newDescripcion_codreg) { descripcion_codreg = newDescripcion_codreg; } public String getDescripcion_codfin() { return descripcion_codfin; } public void setDescripcion_codfin(String newDescripcion_codfin) { descripcion_codfin = newDescripcion_codfin; } public String getCorreo() { return correo; } public void setCorreo(String newCorreo) { correo = newCorreo; } public String getEstado() { return estado; } public void setEstado(String newEstado) { estado = newEstado; } }<file_sep>package ActivosFijos; import org.apache.struts.action.ActionForm; import org.apache.struts.action.ActionErrors; import org.apache.struts.action.ActionError; import org.apache.struts.action.ActionMapping; import javax.servlet.http.HttpServletRequest; public class InventariosForm extends ActionForm { String inv_codbarra; String inv_fecha; String inv_codofi; String inv_codfun; String inv_codubi; String inv_codfin; String inv_codpry; String inv_codreg; private String boton; private int fila; private int operacion; private int opcion; String Inv_regdescripcion; String Inv_findescripcion; String inv_estado; String inv_mod; String inv_codbarrad; String inv_codfindes; String inv_codfundes; String inv_codofides; String inv_codprydes; String inv_codregdes; String inv_codubides; String inv_estadodes; String actas; /** * Reset all properties to their default values. * @param mapping The ActionMapping used to select this instance. * @param request The HTTP Request we are processing. */ public void reset(ActionMapping mapping, HttpServletRequest request) { super.reset(mapping, request); } /** * Validate all properties to their default values. * @param mapping The ActionMapping used to select this instance. * @param request The HTTP Request we are processing. * @return ActionErrors A list of all errors found. */ public ActionErrors validate(ActionMapping mapping, HttpServletRequest request) { return super.validate(mapping, request); } public String getInv_codbarra() { return inv_codbarra; } public void setInv_codbarra(String newInv_codbarra) { inv_codbarra = newInv_codbarra; } public String getInv_fecha() { return inv_fecha; } public void setInv_fecha(String newInv_fecha) { inv_fecha = newInv_fecha; } public String getInv_codofi() { return inv_codofi; } public void setInv_codofi(String newInv_codofi) { inv_codofi = newInv_codofi; } public String getInv_codfun() { return inv_codfun; } public void setInv_codfun(String newInv_codfun) { inv_codfun = newInv_codfun; } public String getInv_codubi() { return inv_codubi; } public void setInv_codubi(String newInv_codubi) { inv_codubi = newInv_codubi; } public String getInv_codfin() { return inv_codfin; } public void setInv_codfin(String newInv_codfin) { inv_codfin = newInv_codfin; } public String getInv_codpry() { return inv_codpry; } public void setInv_codpry(String newInv_codpry) { inv_codpry = newInv_codpry; } public String getInv_codreg() { return inv_codreg; } public void setInv_codreg(String newInv_codreg) { inv_codreg = newInv_codreg; } public String getBoton() { return boton; } public void setBoton(String newBoton) { boton = newBoton; } public String getBoton(int index) { return boton; } public void setBoton(int index, String newBoton) { boton = newBoton; fila = index; } public int getFila() { return fila; } public void setFila(int newFila) { fila = newFila; } public int getOperacion() { return operacion; } public void setOperacion(int newOperacion) { operacion = newOperacion; } public int getOpcion() { return opcion; } public void setOpcion(int newOpcion) { opcion = newOpcion; } public String getInv_regdescripcion() { return Inv_regdescripcion; } public void setInv_regdescripcion(String newInv_regdescripcion) { Inv_regdescripcion = newInv_regdescripcion; } public String getInv_findescripcion() { return Inv_findescripcion; } public void setInv_findescripcion(String newInv_findescripcion) { Inv_findescripcion = newInv_findescripcion; } public String getInv_estado() { return inv_estado; } public void setInv_estado(String newInv_estado) { inv_estado = newInv_estado; } public String getInv_mod() { return inv_mod; } public void setInv_mod(String newInv_mod) { inv_mod = newInv_mod; } public String getInv_codbarrad() { return inv_codbarrad; } public void setInv_codbarrad(String newInv_codbarrad) { inv_codbarrad = newInv_codbarrad; } public String getInv_codfindes() { return inv_codfindes; } public void setInv_codfindes(String newInv_codfindes) { inv_codfindes = newInv_codfindes; } public String getInv_codfundes() { return inv_codfundes; } public void setInv_codfundes(String newInv_codfundes) { inv_codfundes = newInv_codfundes; } public String getInv_codofides() { return inv_codofides; } public void setInv_codofides(String newInv_codofides) { inv_codofides = newInv_codofides; } public String getInv_codprydes() { return inv_codprydes; } public void setInv_codprydes(String newInv_codprydes) { inv_codprydes = newInv_codprydes; } public String getInv_codregdes() { return inv_codregdes; } public void setInv_codregdes(String newInv_codregdes) { inv_codregdes = newInv_codregdes; } public String getInv_codubides() { return inv_codubides; } public void setInv_codubides(String newInv_codubides) { inv_codubides = newInv_codubides; } public String getInv_estadodes() { return inv_estadodes; } public void setInv_estadodes(String newInv_estadodes) { inv_estadodes = newInv_estadodes; } public String getActas() { return actas; } public void setActas(String newActas) { actas = newActas; } } <file_sep> /*@lineinfo:filename=/reporteporreferencia.jsp*/ /*@lineinfo:generated-code*/ import oracle.jsp.runtime.*; import javax.servlet.*; import javax.servlet.http.*; import javax.servlet.jsp.*; import java.sql.*; import oracle.jdbc.driver.*; import java.util.*; import ActivosFijos.*; import java.text.*; public class _reporteporreferencia extends oracle.jsp.runtime.HttpJsp { public final String _globalsClassName = null; // ** Begin Declarations // ** End Declarations public void _jspService(HttpServletRequest request, HttpServletResponse response) throws java.io.IOException, ServletException { response.setContentType( "text/html;charset=windows-1252"); /* set up the intrinsic variables using the pageContext goober: ** session = HttpSession ** application = ServletContext ** out = JspWriter ** page = this ** config = ServletConfig ** all session/app beans declared in globals.jsa */ PageContext pageContext = JspFactory.getDefaultFactory().getPageContext( this, request, response, null, true, JspWriter.DEFAULT_BUFFER, true); // Note: this is not emitted if the session directive == false HttpSession session = pageContext.getSession(); if (pageContext.getAttribute(OracleJspRuntime.JSP_REQUEST_REDIRECTED, PageContext.REQUEST_SCOPE) != null) { pageContext.setAttribute(OracleJspRuntime.JSP_PAGE_DONTNOTIFY, "true", PageContext.PAGE_SCOPE); JspFactory.getDefaultFactory().releasePageContext(pageContext); return; } int __jsp_tag_starteval; ServletContext application = pageContext.getServletContext(); JspWriter out = pageContext.getOut(); _reporteporreferencia page = this; ServletConfig config = pageContext.getServletConfig(); try { // global beans // end global beans out.write(__jsp_StaticText.text[0]); out.write(__jsp_StaticText.text[1]); out.write(__jsp_StaticText.text[2]); out.write(__jsp_StaticText.text[3]); out.write(__jsp_StaticText.text[4]); /*@lineinfo:user-code*//*@lineinfo:7^1*/ BDConection dc = new BDConection(); Connection cn = null; ResultSet rs = null; CallableStatement call = null; try { NumberFormat formatter = new DecimalFormat("###,###,##0.00"); cn = dc.getConexion(); call = cn.prepareCall("{? = call pg_activos.reporteactivos(1) }"); call.registerOutParameter(1, oracle.jdbc.OracleTypes.CURSOR); call.execute(); rs = (ResultSet) call.getObject(1); /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[5]); /*@lineinfo:translated-code*//*@lineinfo:27^1*/ { org.apache.struts.taglib.html.LinkTag __jsp_taghandler_1=(org.apache.struts.taglib.html.LinkTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.LinkTag.class,"org.apache.struts.taglib.html.LinkTag href"); __jsp_taghandler_1.setParent(null); __jsp_taghandler_1.setHref("paginamenu.do"); __jsp_tag_starteval=__jsp_taghandler_1.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_1,__jsp_tag_starteval,out); do { /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[6]); /*@lineinfo:translated-code*//*@lineinfo:27^33*/ } while (__jsp_taghandler_1.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_1.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_1); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[7]); /*@lineinfo:user-code*//*@lineinfo:40^1*/ int pnum=0; while (rs.next()){ if (pnum==1) { /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[8]); /*@lineinfo:user-code*//*@lineinfo:45^3*/ } else { /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[9]); /*@lineinfo:user-code*//*@lineinfo:47^3*/ } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[10]); /*@lineinfo:user-code*//*@lineinfo:48^20*/ out.print( rs.getString("act_codigo") ); /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[11]); /*@lineinfo:user-code*//*@lineinfo:49^20*/ out.print( rs.getString("act_codanterior") ); /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[12]); /*@lineinfo:user-code*//*@lineinfo:50^20*/ out.print( rs.getString("grp_descripcion") ); /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[13]); /*@lineinfo:user-code*//*@lineinfo:51^20*/ out.print( rs.getString("act_descripcion") ); /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[14]); /*@lineinfo:user-code*//*@lineinfo:52^22*/ out.print( rs.getString("act_estado") ); /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[15]); /*@lineinfo:user-code*//*@lineinfo:53^22*/ out.print( rs.getString("ubi_descripcion") ); /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[16]); /*@lineinfo:user-code*//*@lineinfo:54^20*/ out.print( rs.getString("fun_descripcion") ); /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[17]); /*@lineinfo:user-code*//*@lineinfo:56^3*/ if (pnum==0) pnum=1; else pnum=0; } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[18]); /*@lineinfo:user-code*//*@lineinfo:61^3*/ } catch (SQLException e) { e.printStackTrace(); } finally { try { if (rs != null) { rs.close(); rs = null; } if (call != null) { call.close(); call = null; } if (cn != null) { cn.close(); cn = null; } } catch (Exception ex) { ; } } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[19]); } catch( Throwable e) { try { if (out != null) out.clear(); } catch( Exception clearException) { } pageContext.handlePageException( e); } finally { OracleJspRuntime.extraHandlePCFinally(pageContext,true); JspFactory.getDefaultFactory().releasePageContext(pageContext); } } private static class __jsp_StaticText { private static final char text[][]=new char[20][]; static { try { text[0] = "\n".toCharArray(); text[1] = "\n".toCharArray(); text[2] = "\n".toCharArray(); text[3] = "\n\n".toCharArray(); text[4] = "\n".toCharArray(); text[5] = "\n<html>\n<head>\n <meta http-equiv=\"Content-Type\" content=\"text/html; charset=windows-1252\">\n <meta http-equiv=\"Expires\" content=\"-1\">\n <link href=\"Estilos.css\" rel=\"stylesheet\" type=\"text/css\">\n</head>\n<body>\n".toCharArray(); text[6] = "\nVolver\n".toCharArray(); text[7] = "\n<center><h2>Listado de Activos Fijos por Referencia</h2></center>\n<table width=\"90%\" border=\"1\" cellpadding=\"0\" cellspacing=\"0\" style=\"font-size:10px\">\n <tr class=\"FondoAzul10\">\n <td align=\"center\">Código</td>\n <td align=\"center\">Código Anterior</td>\n <td colspan=\"2\" align=\"center\">Descripción</td>\n <td align=\"center\">Estado</td>\n <td align=\"center\">Ubi. Fisica</td>\n <td align=\"center\">Responsable</td>\n </tr>\n".toCharArray(); text[8] = "\n <tr class=\"suave\">\n ".toCharArray(); text[9] = "\n <tr>\n ".toCharArray(); text[10] = "\n <td align=\"left\">".toCharArray(); text[11] = "</td>\n <td align=\"left\">".toCharArray(); text[12] = "</td>\n <td align=\"left\">".toCharArray(); text[13] = "</td>\n <td align=\"left\">".toCharArray(); text[14] = "</td>\n <td align=\"center\">".toCharArray(); text[15] = "</td>\n <td align=\"center\">".toCharArray(); text[16] = "</td>\n <td align=\"left\">".toCharArray(); text[17] = "</td>\n </tr>\n ".toCharArray(); text[18] = "\n</table>\n</body>\n</html>\n ".toCharArray(); text[19] = "\n\n".toCharArray(); } catch (Throwable th) { System.err.println(th); } } } } <file_sep>package ActivosFijos; import org.apache.struts.action.Action; import org.apache.struts.action.ActionForm; import org.apache.struts.action.ActionForward; import org.apache.struts.action.ActionMapping; import org.apache.struts.action.ActionError; import org.apache.struts.action.ActionErrors; import java.io.IOException; import javax.servlet.ServletException; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.apache.struts.action.ActionMessage; import org.apache.struts.action.ActionMessages; import java.util.ArrayList; public class Activos extends Action { /** * This is the main action called from the Struts framework. * @param mapping The ActionMapping used to select this instance. * @param form The optional ActionForm bean for this request. * @param request The HTTP Request we are processing. * @param response The HTTP Response we are processing. */ public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException { ActionMessages error = new ActionMessages(); ActivosForm opform = (ActivosForm) form; InicioForm fInicio = (InicioForm) request.getSession().getAttribute("InicioForm"); opform.setCodregor(opform.getAct_codreg()); opform.setAct_codreg(fInicio.getCod_reg()); opform.setAct_regdescripcion(fInicio.getRegional()); opform.setAct_codfin(fInicio.getCod_fin()); opform.setAct_findescripcion(fInicio.getFinanciador()); BDConection bdc = new BDConection(); if (!(fInicio.getNombreUsuario().equals("SALIO"))) { try { MesAnioDetalleForm mesanio = bdc.listarMesAnio(); opform.setMes(mesanio.getMes()); opform.setAnio(mesanio.getAnio()); opform.setOperacion(0); ArrayList aCalm = bdc.listarRubros(0); request.setAttribute("RubrosLista", aCalm); ArrayList aCalm2 = bdc.listarRegionales(0); request.setAttribute("RegionalesLista", aCalm2); ArrayList aCalm3 = bdc.listarGrupos(0,opform.getAct_codrub()); request.setAttribute("GruposLista", aCalm3); ArrayList aCalm4 = bdc.listarPartidas(0); request.setAttribute("PartidasLista", aCalm4); ArrayList aCalm5 = bdc.listarOficinas(0,fInicio.getCod_reg()); request.setAttribute("OficinasLista", aCalm5); ArrayList aCalm6 = bdc.listarFuncionarios(0,fInicio.getCod_reg()); request.setAttribute("FuncionariosLista", aCalm6); ArrayList aCalm7 = bdc.listarUbicaciones(0,fInicio.getCod_reg()); request.setAttribute("UbicacionesLista", aCalm7); ArrayList aCalm8 = bdc.listarFinanciadores(0); request.setAttribute("FinanciadoresLista", aCalm8); ArrayList aCalm9 = bdc.listarProyectos(0); request.setAttribute("ProyectosLista", aCalm9); ArrayList aCalm10 = bdc.listarTiposbaja(0); request.setAttribute("TiposBajaLista", aCalm10); if (mapping.getParameter().equals("ins")) { opform.setOpcion(1); opform.setOperacion(2); } if (mapping.getParameter().equals("mod")) { opform.setOpcion(2); opform.setOperacion(2); } if (mapping.getParameter().equals("eli")) { opform.setOpcion(3); opform.setOperacion(2); } if (mapping.getParameter().equals("con")) { opform.setOpcion(5); opform.setOperacion(2); } } catch (Exception e) { error.add("error", new ActionMessage("errordb", "No se pudo iniciar Activos")); error.add("error", new ActionMessage("errordb", e.toString() )); e.printStackTrace(); saveErrors( request, error ); } } if (opform.getOpcion()==1) { return mapping.findForward("activos"); } else { return mapping.findForward("activos10"); } } }<file_sep>package ActivosFijos; import java.io.File; import java.io.IOException; import java.sql.*; import oracle.jdbc.driver.*; import java.util.*; import java.text.*; import java.util.ArrayList; import java.util.HashMap; import java.util.Map; import java.util.Properties; import java.sql.Connection; import java.sql.SQLException; import javax.servlet.ServletException; import javax.servlet.ServletOutputStream; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import net.sf.jasperreports.engine.JasperRunManager; import org.apache.struts.action.Action; import org.apache.struts.action.ActionError; import org.apache.struts.action.ActionErrors; import org.apache.struts.action.ActionForm; import org.apache.struts.action.ActionForward; import org.apache.struts.action.ActionMapping; import org.apache.struts.action.ActionMessage; import org.apache.struts.action.ActionMessages; import javax.mail.Message; import javax.mail.MessagingException; import javax.mail.SendFailedException; import javax.mail.Session; import javax.mail.Transport; import javax.mail.internet.AddressException; import javax.mail.internet.InternetAddress; import javax.mail.internet.MimeMessage; import javax.mail.BodyPart; import javax.mail.internet.MimeBodyPart; import javax.mail.internet.MimeMultipart; public class DocumentosAction extends Action { /** * This is the main action called from the Struts framework. * @param mapping The ActionMapping used to select this instance. * @param form The optional ActionForm bean for this request. * @param request The HTTP Request we are processing. * @param response The HTTP Response we are processing. */ public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException { ActionMessages error = new ActionMessages(); DocumentosForm finform = (DocumentosForm)form; InicioForm fInicio = (InicioForm) request.getSession().getAttribute("InicioForm"); finform.setDoc_codreg(fInicio.getCod_reg()); finform.setDoc_codfin(fInicio.getCod_fin()); finform.setDoc_regdescripcion(fInicio.getRegional()); finform.setDoc_findescripcion(fInicio.getFinanciador()); String usuario = fInicio.getNombreUsuario(); BDConection bdc = new BDConection(); ArrayList aCalm; ArrayList aCalm2; ArrayList aCalm3; ArrayList aCalm7; ArrayList aCalm8; ArrayList aCalm9; ArrayList aCalm10; ArrayList aCalm11; //ArrayList aCalm12; int num; String codfun; String feccierre; String mensaje=null; String msgsql; String pathjasper; String subreportjasper; File reportfile; String numero; String gestion; String correo=""; String de_quien=""; String a_quien=""; String desac; Connection l_connection = null; aCalm=null; aCalm2=null; aCalm3=null; aCalm7=null; aCalm8=null; aCalm9=null; aCalm10=null; aCalm11=null; //aCalm12=null; if (!(fInicio.getNombreUsuario().equals("SALIO"))) { int it = 0; try { l_connection = bdc.getConexion(); MesAnioDetalleForm mesanio = bdc.listarMesAnio(); finform.setMes(mesanio.getMes()); finform.setAnio(mesanio.getAnio()); ParametrosForm aCalm18 = bdc.listarParametros(); /*finform.setGestionant(aCalm18.getCte_gestion());*/ finform.setCte_tipdocbaja(aCalm18.getCte_tipdocbaja()); finform.setCte_tipdocdevolucion(aCalm18.getCte_tipdocdevolucion()); finform.setCte_tipdocentrega(aCalm18.getCte_tipdocentrega()); finform.setCte_tipdoctransferencia(aCalm18.getCte_tipdoctransferencia()); if (finform.getOperacion()==3){ if ((finform.getOpcion()==1)||(finform.getOpcion()==10)||(finform.getOpcion()==11)){/*Insertar*/ msgsql=null; msgsql = bdc.insertardocumentos(finform.getDoc_codreg(),finform.getDoc_tipdoc(), finform.getDoc_numero(),finform.getDoc_fecha(),finform.getDoc_codofiorigen(), finform.getDoc_codfunorigen(),finform.getDoc_codubiorigen(), finform.getDoc_codfin(),finform.getDoc_codfinorigen(), finform.getDoc_codpryorigen(),finform.getDoc_codregdestino(), finform.getDoc_codofidestino(),finform.getDoc_codfundestino(), finform.getDoc_codubidestino(),finform.getDoc_codfindestino(), finform.getDoc_codprydestino(),finform.getDoc_observacion(), finform.getDoc_inconfirma(),fInicio.getTxt_usu(),finform.getOpcion(),finform.getDoc_devolucion()); if (!msgsql.equals("0")) { aCalm7 = bdc.listarTiposdoc(0,1,fInicio.getCod_fin(),fInicio.getCod_reg()); request.setAttribute("TiposDocumentosLista", aCalm7); error.add("error", new ActionMessage("error", msgsql)); saveErrors( request, error ); finform.setOperacion(5); finform.setOpcion(1); } else { finform.setDoc_funorinombre(bdc.nombrefuncionario(finform.getDoc_codfunorigen())); finform.setDoc_fundesnombre(bdc.nombrefuncionario(finform.getDoc_codfundestino())); aCalm8 = bdc.listarDetDocumentos(finform.getDoc_codfin(),finform.getDoc_codreg(),finform.getDoc_tipdoc(),finform.getDoc_numero()); request.setAttribute("DetDocumentosLista", aCalm8); aCalm9 = bdc.listarTiposbaja(0); request.setAttribute("TiposBajaLista", aCalm9); //Modificado <NAME> 15/09/2016 aCalm11 = bdc.listarOficinas(0,fInicio.getCod_reg()); //aCalm11 = bdc.listarOficinas2(0,fInicio.getCod_reg()); request.setAttribute("OficinasLista", aCalm11); //aCalm12 = bdc.listarRubros(0); //request.setAttribute("RubrosLista", aCalm12); //aCalm10 = bdc.listarActivos2(0,finform.getDoc_codfin(),finform.getDoc_codreg(),finform.getDoc_tipdoc(),finform.getDoc_numero(),finform.getDoc_codfunorigen(),finform.getDoc_fecha(),finform.getDdo_codrubactual(),finform.getDdo_codigo(),finform.getDdo_codigo()); //request.setAttribute("Activos2Lista", aCalm10); finform.setDesactivo(bdc.DescripcionActivo(finform.getDoc_codfin(),finform.getDoc_codreg(),finform.getDoc_tipdoc(),finform.getDoc_numero(),finform.getDoc_codfunorigen(),finform.getDoc_fecha(),finform.getDdo_codrubactual(),finform.getDdo_codigo())); finform.setDesbaja(bdc.nombretipobaja(finform.getDdo_codmot())); finform.setDesofi(bdc.nombreoficina(finform.getDdo_codofiactual(),finform.getDoc_codreg())); num = bdc.maximoDetDocumentos(finform.getDoc_codfin(),finform.getDoc_codreg(),finform.getDoc_tipdoc(),finform.getDoc_numero()); finform.setDdo_item(num); } } if (finform.getOpcion()==2){/*Modificar*/ msgsql=null; msgsql = bdc.insertardocumentos(finform.getDoc_codreg(),finform.getDoc_tipdoc(), finform.getDoc_numero(),finform.getDoc_fecha(),finform.getDoc_codofiorigen(), finform.getDoc_codfunorigen(),finform.getDoc_codubiorigen(), finform.getDoc_codfin(),finform.getDoc_codfinorigen(), finform.getDoc_codpryorigen(),finform.getDoc_codregdestino(), finform.getDoc_codofidestino(),finform.getDoc_codfundestino(), finform.getDoc_codubidestino(),finform.getDoc_codfindestino(), finform.getDoc_codprydestino(),finform.getDoc_observacion(), finform.getDoc_inconfirma(),fInicio.getTxt_usu(),finform.getOpcion(),0); if (!msgsql.equals("0")) { aCalm7 = bdc.listarTiposdoc(0,1,fInicio.getCod_fin(),fInicio.getCod_reg()); request.setAttribute("TiposDocumentosLista", aCalm7); error.add("error", new ActionMessage("error", msgsql)); saveErrors( request, error ); } else { finform.setDoc_funorinombre(bdc.nombrefuncionario(finform.getDoc_codfunorigen())); finform.setDoc_fundesnombre(bdc.nombrefuncionario(finform.getDoc_codfundestino())); aCalm8 = bdc.listarDetDocumentos(finform.getDoc_codfin(),finform.getDoc_codreg(),finform.getDoc_tipdoc(),finform.getDoc_numero()); request.setAttribute("DetDocumentosLista", aCalm8); aCalm9 = bdc.listarTiposbaja(0); request.setAttribute("TiposBajaLista", aCalm9); aCalm11 = bdc.listarOficinas(0,fInicio.getCod_reg()); request.setAttribute("OficinasLista", aCalm11); //aCalm12 = bdc.listarRubros(0); //request.setAttribute("RubrosLista", aCalm12); //aCalm10 = bdc.listarActivos2(0,finform.getDoc_codfin(),finform.getDoc_codreg(),finform.getDoc_tipdoc(),finform.getDoc_numero(),finform.getDoc_codfunorigen(),finform.getDoc_fecha(),finform.getDdo_codrubactual(),finform.getDdo_codigo(),finform.getDdo_codigo()); //request.setAttribute("Activos2Lista", aCalm10); finform.setDesactivo(bdc.DescripcionActivo(finform.getDoc_codfin(),finform.getDoc_codreg(),finform.getDoc_tipdoc(),finform.getDoc_numero(),finform.getDoc_codfunorigen(),finform.getDoc_fecha(),finform.getDdo_codrubactual(),finform.getDdo_codigo())); finform.setDesbaja(bdc.nombretipobaja(finform.getDdo_codmot())); finform.setDesofi(bdc.nombreoficina(finform.getDdo_codofiactual(),finform.getDoc_codreg())); num = bdc.maximoDetDocumentos(finform.getDoc_codfin(),finform.getDoc_codreg(),finform.getDoc_tipdoc(),finform.getDoc_numero()); finform.setDdo_item(num); } } if (finform.getOpcion()==3){/*Eliminar*/ aCalm = bdc.listarActas(1,0,fInicio.getCod_fin(),fInicio.getCod_reg(),finform.getDoc_tipdoc(),finform.getInicio(),finform.getFin(),finform.getOpcion(),finform.getConfirmados(),finform.getGestionant()); it = finform.getFila(); request.setAttribute("DocumentosLista", aCalm); ArrayList datos = (ArrayList) request.getAttribute("DocumentosLista"); DocumentosDetalleForm d = new DocumentosDetalleForm(); d = (DocumentosDetalleForm) datos.get(it); finform.setDoc_codreg(d.getcodreg()); finform.setDoc_tipdoc(d.gettipdoc()); finform.setDoc_numero(d.getnumero()); finform.setDoc_fecha(d.getfecha()); finform.setDoc_codfunorigen(d.getcodfunorigen()); finform.setDoc_codfundestino(d.getcodfundestino()); finform.setDoc_observacion(d.getobservacion()); finform.setDoc_funorinombre(bdc.nombrefuncionario(finform.getDoc_codfunorigen())); finform.setDoc_fundesnombre(bdc.nombrefuncionario(finform.getDoc_codfundestino())); finform.setDoc_ofiorinombre(bdc.nombreoficina(finform.getDoc_codofiorigen(),finform.getDoc_codreg())); finform.setDoc_ofidesnombre(bdc.nombreoficina(finform.getDoc_codofidestino(),finform.getDoc_codreg())); finform.setDoc_carorinombre(bdc.nombrecargo(finform.getDoc_codfunorigen())); finform.setDoc_cardesnombre(bdc.nombrecargo(finform.getDoc_codfundestino())); aCalm8 = bdc.listarDetDocumentos(finform.getDoc_codfin(),finform.getDoc_codreg(),finform.getDoc_tipdoc(),finform.getDoc_numero()); request.setAttribute("DetDocumentosLista", aCalm8); aCalm9 = bdc.listarTiposbaja(0); request.setAttribute("TiposBajaLista", aCalm9); aCalm11 = bdc.listarOficinas(0,fInicio.getCod_reg()); request.setAttribute("OficinasLista", aCalm11); //aCalm12 = bdc.listarRubros(0); //request.setAttribute("RubrosLista", aCalm12); //aCalm10 = bdc.listarActivos2(0,finform.getDoc_codfin(),finform.getDoc_codreg(),finform.getDoc_tipdoc(),finform.getDoc_numero(),finform.getDoc_codfunorigen(),finform.getDoc_fecha(),finform.getDdo_codrubactual(),finform.getDdo_codigo(),finform.getDdo_codigo()); //request.setAttribute("Activos2Lista", aCalm10); finform.setDesactivo(bdc.DescripcionActivo(finform.getDoc_codfin(),finform.getDoc_codreg(),finform.getDoc_tipdoc(),finform.getDoc_numero(),finform.getDoc_codfunorigen(),finform.getDoc_fecha(),finform.getDdo_codrubactual(),finform.getDdo_codigo())); finform.setDesbaja(bdc.nombretipobaja(finform.getDdo_codmot())); finform.setDesofi(bdc.nombreoficina(finform.getDdo_codofiactual(),finform.getDoc_codreg())); num = bdc.maximoDetDocumentos(finform.getDoc_codfin(),finform.getDoc_codreg(),finform.getDoc_tipdoc(),finform.getDoc_numero()); finform.setDdo_item(num); } if (finform.getOpcion()==4){/*Confirmar*/ aCalm = bdc.listarActas(1,0,fInicio.getCod_fin(),fInicio.getCod_reg(),finform.getDoc_tipdoc(),finform.getInicio(),finform.getFin(),finform.getOpcion(),finform.getConfirmados(),finform.getGestionant()); it = finform.getFila(); request.setAttribute("DocumentosLista", aCalm); ArrayList datos = (ArrayList) request.getAttribute("DocumentosLista"); DocumentosDetalleForm d = new DocumentosDetalleForm(); d = (DocumentosDetalleForm) datos.get(it); finform.setDoc_codreg(d.getcodreg()); finform.setDoc_tipdoc(d.gettipdoc()); finform.setDoc_numero(d.getnumero()); finform.setDoc_fecha(d.getfecha()); finform.setDoc_codfunorigen(d.getcodfunorigen()); finform.setDoc_codfundestino(d.getcodfundestino()); finform.setDoc_observacion(d.getobservacion()); finform.setDoc_funorinombre(bdc.nombrefuncionario(finform.getDoc_codfunorigen())); finform.setDoc_fundesnombre(bdc.nombrefuncionario(finform.getDoc_codfundestino())); finform.setDoc_ofiorinombre(bdc.nombreoficina(finform.getDoc_codofiorigen(),finform.getDoc_codreg())); finform.setDoc_ofidesnombre(bdc.nombreoficina(finform.getDoc_codofidestino(),finform.getDoc_codreg())); finform.setDoc_carorinombre(bdc.nombrecargo(finform.getDoc_codfunorigen())); finform.setDoc_cardesnombre(bdc.nombrecargo(finform.getDoc_codfundestino())); aCalm8 = bdc.listarDetDocumentos(finform.getDoc_codfin(),finform.getDoc_codreg(),finform.getDoc_tipdoc(),finform.getDoc_numero()); request.setAttribute("DetDocumentosLista", aCalm8); aCalm9 = bdc.listarTiposbaja(0); request.setAttribute("TiposBajaLista", aCalm9); aCalm11 = bdc.listarOficinas(0,fInicio.getCod_reg()); request.setAttribute("OficinasLista", aCalm11); //aCalm12 = bdc.listarRubros(0); //request.setAttribute("RubrosLista", aCalm12); //aCalm10 = bdc.listarActivos2(0,finform.getDoc_codfin(),finform.getDoc_codreg(),finform.getDoc_tipdoc(),finform.getDoc_numero(),finform.getDoc_codfunorigen(),finform.getDoc_fecha(),finform.getDdo_codrubactual(),finform.getDdo_codigo(),finform.getDdo_codigo()); //request.setAttribute("Activos2Lista", aCalm10); finform.setDesactivo(bdc.DescripcionActivo(finform.getDoc_codfin(),finform.getDoc_codreg(),finform.getDoc_tipdoc(),finform.getDoc_numero(),finform.getDoc_codfunorigen(),finform.getDoc_fecha(),finform.getDdo_codrubactual(),finform.getDdo_codigo())); finform.setDesbaja(bdc.nombretipobaja(finform.getDdo_codmot())); finform.setDesofi(bdc.nombreoficina(finform.getDdo_codofiactual(),finform.getDoc_codreg())); num = bdc.maximoDetDocumentos(finform.getDoc_codfin(),finform.getDoc_codreg(),finform.getDoc_tipdoc(),finform.getDoc_numero()); finform.setDdo_item(num); } if (finform.getOpcion()==5){/*Reportar*/ aCalm = bdc.listarActas(1,0,fInicio.getCod_fin(),fInicio.getCod_reg(),finform.getDoc_tipdoc(),finform.getInicio(),finform.getFin(),finform.getOpcion(),finform.getConfirmados(),finform.getGestionant()); it = finform.getFila(); request.setAttribute("DocumentosLista", aCalm); ArrayList datos = (ArrayList) request.getAttribute("DocumentosLista"); DocumentosDetalleForm d = new DocumentosDetalleForm(); d = (DocumentosDetalleForm) datos.get(it); finform.setDoc_codreg(d.getcodreg()); finform.setDoc_tipdoc(d.gettipdoc()); finform.setDoc_numero(d.getnumero()); gestion=bdc.Gestion(); numero=String.valueOf(finform.getDoc_numero()); if (finform.getDoc_tipdoc().equals("E")) { try { pathjasper = this.getServlet().getServletContext().getRealPath("/reportes/acta01.jasper"); subreportjasper = this.getServlet().getServletContext().getRealPath("/reportes/"); reportfile = new File(pathjasper); if (reportfile.exists()) { Map parameters = new HashMap(); parameters.put("par_usuario", fInicio.getTxt_usu()); parameters.put("ddo_codreg", finform.getDoc_codreg()); parameters.put("ddo_codfin", fInicio.getCod_fin()); parameters.put("ddo_tipdoc", finform.getDoc_tipdoc()); parameters.put("ddo_gestion", finform.getGestionant()); parameters.put("ddo_numero", numero); byte[] bytes = JasperRunManager.runReportToPdf(reportfile.getPath(), parameters, l_connection); response.setContentType("application/pdf"); response.setContentLength(bytes.length); ServletOutputStream ouputStream = response.getOutputStream(); ouputStream.write(bytes, 0, bytes.length); ouputStream.flush(); ouputStream.close(); } else { error.add("error", new ActionMessage("error", "No se puede abrir el reporte.")); saveErrors( request, error ); } } catch (Exception e){ error.add("error", new ActionMessage("error", e.getMessage())); saveErrors( request, error ); } } else if (finform.getDoc_tipdoc().equals("U")) { pathjasper = this.getServlet().getServletContext().getRealPath("/reportes/acta05.jasper"); subreportjasper = this.getServlet().getServletContext().getRealPath("/reportes/"); reportfile = new File(pathjasper); if (reportfile.exists()) { Map parameters = new HashMap(); parameters.put("par_usuario", fInicio.getTxt_usu()); parameters.put("ddo_codreg", finform.getDoc_codreg()); parameters.put("ddo_codfin", fInicio.getCod_fin()); parameters.put("ddo_tipdoc", "U"); parameters.put("ddo_gestion", finform.getGestionant()); parameters.put("ddo_numero", numero); byte[] bytes = JasperRunManager.runReportToPdf(reportfile.getPath(), parameters, l_connection); response.setContentType("application/pdf"); response.setContentLength(bytes.length); ServletOutputStream ouputStream = response.getOutputStream(); ouputStream.write(bytes, 0, bytes.length); ouputStream.flush(); ouputStream.close(); } else { error.add("error", new ActionMessage("error", "No se puede abrir el reporte.")); saveErrors( request, error ); } } else if (finform.getDoc_tipdoc().equals("V")) { pathjasper = this.getServlet().getServletContext().getRealPath("/reportes/acta06.jasper"); subreportjasper = this.getServlet().getServletContext().getRealPath("/reportes/"); reportfile = new File(pathjasper); if (reportfile.exists()) { Map parameters = new HashMap(); parameters.put("par_usuario", fInicio.getTxt_usu()); parameters.put("ddo_codreg", finform.getDoc_codreg()); parameters.put("ddo_codfin", fInicio.getCod_fin()); parameters.put("ddo_tipdoc", "V"); parameters.put("ddo_gestion", finform.getGestionant()); parameters.put("ddo_numero", numero); byte[] bytes = JasperRunManager.runReportToPdf(reportfile.getPath(), parameters, l_connection); response.setContentType("application/pdf"); response.setContentLength(bytes.length); ServletOutputStream ouputStream = response.getOutputStream(); ouputStream.write(bytes, 0, bytes.length); ouputStream.flush(); ouputStream.close(); } else { error.add("error", new ActionMessage("error", "No se puede abrir el reporte.")); saveErrors( request, error ); } } else if (finform.getDoc_tipdoc().equals("T")) { pathjasper = this.getServlet().getServletContext().getRealPath("/reportes/acta02.jasper"); subreportjasper = this.getServlet().getServletContext().getRealPath("/reportes/"); reportfile = new File(pathjasper); if (reportfile.exists()) { Map parameters = new HashMap(); parameters.put("par_usuario", fInicio.getTxt_usu()); parameters.put("ddo_codreg", finform.getDoc_codreg()); parameters.put("ddo_codfin", fInicio.getCod_fin()); parameters.put("ddo_tipdoc", finform.getDoc_tipdoc()); parameters.put("ddo_gestion", finform.getGestionant()); parameters.put("ddo_numero", numero); byte[] bytes = JasperRunManager.runReportToPdf(reportfile.getPath(), parameters, l_connection); response.setContentType("application/pdf"); response.setContentLength(bytes.length); ServletOutputStream ouputStream = response.getOutputStream(); ouputStream.write(bytes, 0, bytes.length); ouputStream.flush(); ouputStream.close(); } else { error.add("error", new ActionMessage("error", "No se puede abrir el reporte.")); saveErrors( request, error ); } } else if (finform.getDoc_tipdoc().equals("B")) { pathjasper = this.getServlet().getServletContext().getRealPath("/reportes/acta03.jasper"); subreportjasper = this.getServlet().getServletContext().getRealPath("/reportes/"); reportfile = new File(pathjasper); if (reportfile.exists()) { Map parameters = new HashMap(); parameters.put("par_usuario", fInicio.getTxt_usu()); parameters.put("ddo_codreg", finform.getDoc_codreg()); parameters.put("ddo_codfin", fInicio.getCod_fin()); parameters.put("ddo_tipdoc", finform.getDoc_tipdoc()); parameters.put("ddo_gestion", finform.getGestionant()); parameters.put("ddo_numero", numero); byte[] bytes = JasperRunManager.runReportToPdf(reportfile.getPath(), parameters, l_connection); response.setContentType("application/pdf"); response.setContentLength(bytes.length); ServletOutputStream ouputStream = response.getOutputStream(); ouputStream.write(bytes, 0, bytes.length); ouputStream.flush(); ouputStream.close(); } else { error.add("error", new ActionMessage("error", "No se puede abrir el reporte.")); saveErrors( request, error ); } } else if (finform.getDoc_tipdoc().equals("D")) { pathjasper = this.getServlet().getServletContext().getRealPath("/reportes/acta04.jasper"); subreportjasper = this.getServlet().getServletContext().getRealPath("/reportes/"); reportfile = new File(pathjasper); if (reportfile.exists()) { Map parameters = new HashMap(); parameters.put("par_usuario", fInicio.getTxt_usu()); parameters.put("ddo_codreg", finform.getDoc_codreg()); parameters.put("ddo_codfin", fInicio.getCod_fin()); parameters.put("ddo_tipdoc", finform.getDoc_tipdoc()); parameters.put("ddo_gestion", finform.getGestionant()); parameters.put("ddo_numero", numero); byte[] bytes = JasperRunManager.runReportToPdf(reportfile.getPath(), parameters, l_connection); response.setContentType("application/pdf"); response.setContentLength(bytes.length); ServletOutputStream ouputStream = response.getOutputStream(); ouputStream.write(bytes, 0, bytes.length); ouputStream.flush(); ouputStream.close(); } else { error.add("error", new ActionMessage("error", "No se puede abrir el reporte.")); saveErrors( request, error ); } } /*aCalm = bdc.listarActas(1,0,fInicio.getCod_fin(),fInicio.getCod_reg(),finform.getDoc_tipdoc(),finform.getInicio(),finform.getFin(),finform.getOpcion(),finform.getConfirmados(),finform.getGestionant()); it = finform.getFila(); request.setAttribute("DocumentosLista", aCalm); ArrayList datos = (ArrayList) request.getAttribute("DocumentosLista"); DocumentosDetalleForm d = new DocumentosDetalleForm(); d = (DocumentosDetalleForm) datos.get(it); finform.setDoc_glosa(d.getGlosa()); finform.setDoc_codreg(d.getcodreg()); finform.setDoc_tipdoc(d.gettipdoc()); finform.setDoc_numero(d.getnumero()); finform.setDoc_fecha(d.getfecha()); finform.setDoc_codfunorigen(d.getcodfunorigen()); finform.setDoc_codfundestino(d.getcodfundestino()); finform.setDoc_observacion(d.getobservacion()); finform.setDoc_funorinombre(bdc.nombrefuncionario(finform.getDoc_codfunorigen())); finform.setDoc_fundesnombre(bdc.nombrefuncionario(finform.getDoc_codfundestino())); finform.setDoc_ofiorinombre(bdc.nombreoficina(d.getcodofiorigen(),finform.getDoc_codreg())); finform.setDoc_ofidesnombre(bdc.nombreoficina(d.getcodofidestino(),finform.getDoc_codreg())); finform.setDoc_carorinombre(bdc.nombrecargo(finform.getDoc_codfunorigen())); finform.setDoc_cardesnombre(bdc.nombrecargo(finform.getDoc_codfundestino())); aCalm8 = bdc.listarDetDocumentos2(finform.getDoc_codfin(),finform.getDoc_codreg(),finform.getDoc_tipdoc(),finform.getDoc_numero()); request.setAttribute("DetDocumentosLista", aCalm8); aCalm9 = bdc.listarTiposbaja(0); request.setAttribute("TiposBajaLista", aCalm9); aCalm11 = bdc.listarOficinas(0,fInicio.getCod_reg()); request.setAttribute("OficinasLista", aCalm11); aCalm12 = bdc.listarRubros(0); request.setAttribute("RubrosLista", aCalm12); aCalm10 = bdc.listarActivos2(0,finform.getDoc_codfin(),finform.getDoc_codreg(),finform.getDoc_tipdoc(),finform.getDoc_numero(),finform.getDoc_codfunorigen(),finform.getDoc_fecha(),finform.getDdo_codrubactual(),finform.getDdo_codigo(),finform.getDdo_codigo()); request.setAttribute("Activos2Lista", aCalm10); num = bdc.maximoDetDocumentos(finform.getDoc_codfin(),finform.getDoc_codreg(),finform.getDoc_tipdoc(),finform.getDoc_numero()); finform.setDdo_item(num);*/ } } if (finform.getOperacion()==7){ if ((finform.getOpcion()==1)||(finform.getOpcion()==10)||(finform.getOpcion()==11)||(finform.getOpcion()==2)){/*Eliminar*/ aCalm8 = bdc.listarDetDocumentos(finform.getDoc_codfin(),finform.getDoc_codreg(),finform.getDoc_tipdoc(),finform.getDoc_numero()); it = finform.getFila(); request.setAttribute("DetDocumentosLista", aCalm8); ArrayList datos = (ArrayList) request.getAttribute("DetDocumentosLista"); DetDocumentosDetalleForm d = new DetDocumentosDetalleForm(); d = (DetDocumentosDetalleForm) datos.get(it); finform.setDdo_item(d.getitem()); msgsql = bdc.insertardetdocumentos(finform.getDoc_codfin(),finform.getDoc_codreg(),finform.getDoc_tipdoc(), finform.getDoc_numero(),finform.getDoc_fecha(),finform.getDoc_codfunorigen(),finform.getDdo_item(),finform.getDdo_codrubactual(),finform.getDdo_codregactual(),finform.getDdo_codigo(),finform.getDdo_codmot(), fInicio.getTxt_usu(),finform.getDdo_codofiactual(),finform.getDdo_codubiactual(),3); finform.setDdo_item(0); finform.setDdo_codrubactual(""); finform.setDdo_codregactual(""); finform.setDdo_codigo(0); finform.setDdo_codmot(""); finform.setDdo_codofiactual(""); finform.setDdo_codubiactual(""); aCalm8 = bdc.listarDetDocumentos(finform.getDoc_codfin(),finform.getDoc_codreg(),finform.getDoc_tipdoc(),finform.getDoc_numero()); request.setAttribute("DetDocumentosLista", aCalm8); aCalm9 = bdc.listarTiposbaja(0); request.setAttribute("TiposBajaLista", aCalm9); aCalm11 = bdc.listarOficinas(0,fInicio.getCod_reg()); request.setAttribute("OficinasLista", aCalm11); //aCalm12 = bdc.listarRubros(0); //request.setAttribute("RubrosLista", aCalm12); //aCalm10 = bdc.listarActivos2(0,finform.getDoc_codfin(),finform.getDoc_codreg(),finform.getDoc_tipdoc(),finform.getDoc_numero(),finform.getDoc_codfunorigen(),finform.getDoc_fecha(),finform.getDdo_codrubactual(),finform.getDdo_codigo(),finform.getDdo_codigo()); //request.setAttribute("Activos2Lista", aCalm10); finform.setDesactivo(bdc.DescripcionActivo(finform.getDoc_codfin(),finform.getDoc_codreg(),finform.getDoc_tipdoc(),finform.getDoc_numero(),finform.getDoc_codfunorigen(),finform.getDoc_fecha(),finform.getDdo_codrubactual(),finform.getDdo_codigo())); finform.setDesbaja(bdc.nombretipobaja(finform.getDdo_codmot())); finform.setDesofi(bdc.nombreoficina(finform.getDdo_codofiactual(),finform.getDoc_codreg())); num = bdc.maximoDetDocumentos(finform.getDoc_codfin(),finform.getDoc_codreg(),finform.getDoc_tipdoc(),finform.getDoc_numero()); finform.setDdo_item(num); finform.setOperacion(3); if (!msgsql.equals("0")) { error.add("error", new ActionMessage("error", msgsql)); saveErrors( request, error ); } } } if (finform.getOperacion()==2){ aCalm7 = bdc.listarTiposdoc(0,1,fInicio.getCod_fin(),fInicio.getCod_reg()); request.setAttribute("TiposDocumentosLista", aCalm7); if (finform.getOpcion()==1){/*Insertar*/ } if (finform.getOpcion()==2){/*Modificar*/ } if (finform.getOpcion()==4){/*Confirmar*/ } if (finform.getOpcion()==5){/*Reportar*/ } } if (finform.getOperacion()==1){ if (finform.getOpcion()==6){/*Validar*/ finform.setOperacion(3); desac=null; desac = bdc.DescripcionActivo(finform.getDoc_codfin(),finform.getDoc_codreg(),finform.getDoc_tipdoc(),finform.getDoc_numero(),finform.getDoc_codfunorigen(),finform.getDoc_fecha(),finform.getDdo_codrubactual(),finform.getDdo_codigo()); aCalm8 = bdc.listarDetDocumentos(finform.getDoc_codfin(),finform.getDoc_codreg(),finform.getDoc_tipdoc(),finform.getDoc_numero()); request.setAttribute("DetDocumentosLista", aCalm8); aCalm9 = bdc.listarTiposbaja(0); request.setAttribute("TiposBajaLista", aCalm9); aCalm11 = bdc.listarOficinas(0,fInicio.getCod_reg()); request.setAttribute("OficinasLista", aCalm11); finform.setDesactivo(desac); finform.setDesbaja(bdc.nombretipobaja(finform.getDdo_codmot())); finform.setDesofi(bdc.nombreoficina(finform.getDdo_codofiactual(),finform.getDoc_codreg())); if (desac.equals("NO Existe Activo")) { error.add("error", new ActionMessage("error", "No Existe el Activo o está Registrado en un Acta sin Confirmar")); saveErrors( request, error ); finform.setOpcion(1); } else { error.add("error", new ActionMessage("error", "La Validación fue realizada correctamente")); saveErrors( request, error ); } } else { if (finform.getOpcion()==1){/*Insertar*/ finform.setOperacion(3); msgsql = bdc.insertardetdocumentos(finform.getDoc_codfin(),finform.getDoc_codreg(),finform.getDoc_tipdoc(), finform.getDoc_numero(),finform.getDoc_fecha(),finform.getDoc_codfunorigen(),finform.getDdo_item(),finform.getDdo_codrubactual(),finform.getDdo_codregactual(),finform.getDdo_codigo(),finform.getDdo_codmot(), fInicio.getTxt_usu(),finform.getDdo_codofiactual(),finform.getDdo_codubiactual(),finform.getOpcion()); finform.setDdo_item(0); finform.setDesactivo(""); finform.setDesbaja(""); finform.setDdo_codrubactual(""); finform.setDdo_codregactual(""); finform.setDdo_codigo(0); finform.setDdo_codmot(""); if(finform.getDdo_codofiactual() == null){ finform.setDdo_codofiactual(""); } finform.setDdo_codubiactual(""); aCalm8 = bdc.listarDetDocumentos(finform.getDoc_codfin(),finform.getDoc_codreg(),finform.getDoc_tipdoc(),finform.getDoc_numero()); request.setAttribute("DetDocumentosLista", aCalm8); aCalm9 = bdc.listarTiposbaja(0); request.setAttribute("TiposBajaLista", aCalm9); aCalm11 = bdc.listarOficinas2(0,fInicio.getCod_reg(),finform.getDdo_codofiactual()); request.setAttribute("OficinasLista", aCalm11); //aCalm12 = bdc.listarRubros(0); //request.setAttribute("RubrosLista", aCalm12); //aCalm10 = bdc.listarActivos2(0,finform.getDoc_codfin(),finform.getDoc_codreg(),finform.getDoc_tipdoc(),finform.getDoc_numero(),finform.getDoc_codfunorigen(),finform.getDoc_fecha(),finform.getDdo_codrubactual(),finform.getDdo_codigo(),finform.getDdo_codigo()); //request.setAttribute("Activos2Lista", aCalm10); finform.setDesactivo(bdc.DescripcionActivo(finform.getDoc_codfin(),finform.getDoc_codreg(),finform.getDoc_tipdoc(),finform.getDoc_numero(),finform.getDoc_codfunorigen(),finform.getDoc_fecha(),finform.getDdo_codrubactual(),finform.getDdo_codigo())); finform.setDesbaja(bdc.nombretipobaja(finform.getDdo_codmot())); finform.setDesofi(bdc.nombreoficina(finform.getDdo_codofiactual(),finform.getDoc_codreg())); num = bdc.maximoDetDocumentos(finform.getDoc_codfin(),finform.getDoc_codreg(),finform.getDoc_tipdoc(),finform.getDoc_numero()); finform.setDdo_item(num); if (!msgsql.equals("0")) { error.add("error", new ActionMessage("error", msgsql)); saveErrors( request, error ); } else { error.add("error", new ActionMessage("error", "La inserción fue realizada correctamente")); saveErrors( request, error ); } } } if (finform.getOpcion()==2){/*Modificar*/ finform.setOperacion(3); msgsql = bdc.insertardetdocumentos(finform.getDoc_codfin(),finform.getDoc_codreg(),finform.getDoc_tipdoc(), finform.getDoc_numero(),finform.getDoc_fecha(),finform.getDoc_codfunorigen(),finform.getDdo_item(),finform.getDdo_codrubactual(),finform.getDdo_codregactual(),finform.getDdo_codigo(),finform.getDdo_codmot(), fInicio.getTxt_usu(),finform.getDdo_codofiactual(),finform.getDdo_codubiactual(),finform.getOpcion()); finform.setDdo_item(0); finform.setDesactivo(""); finform.setDesbaja(""); finform.setDdo_codrubactual(""); finform.setDdo_codregactual(""); finform.setDdo_codigo(0); finform.setDdo_codmot(""); finform.setDdo_codofiactual(""); finform.setDdo_codubiactual(""); aCalm8 = bdc.listarDetDocumentos(finform.getDoc_codfin(),finform.getDoc_codreg(),finform.getDoc_tipdoc(),finform.getDoc_numero()); request.setAttribute("DetDocumentosLista", aCalm8); aCalm9 = bdc.listarTiposbaja(0); request.setAttribute("TiposBajaLista", aCalm9); aCalm11 = bdc.listarOficinas(0,fInicio.getCod_reg()); request.setAttribute("OficinasLista", aCalm11); //aCalm12 = bdc.listarRubros(0); //request.setAttribute("RubrosLista", aCalm12); //aCalm10 = bdc.listarActivos2(0,finform.getDoc_codfin(),finform.getDoc_codreg(),finform.getDoc_tipdoc(),finform.getDoc_numero(),finform.getDoc_codfunorigen(),finform.getDoc_fecha(),finform.getDdo_codrubactual(),finform.getDdo_codigo(),finform.getDdo_codigo()); //request.setAttribute("Activos2Lista", aCalm10); finform.setDesactivo(bdc.DescripcionActivo(finform.getDoc_codfin(),finform.getDoc_codreg(),finform.getDoc_tipdoc(),finform.getDoc_numero(),finform.getDoc_codfunorigen(),finform.getDoc_fecha(),finform.getDdo_codrubactual(),finform.getDdo_codigo())); finform.setDesbaja(bdc.nombretipobaja(finform.getDdo_codmot())); finform.setDesofi(bdc.nombreoficina(finform.getDdo_codofiactual(),finform.getDoc_codreg())); num = bdc.maximoDetDocumentos(finform.getDoc_codfin(),finform.getDoc_codreg(),finform.getDoc_tipdoc(),finform.getDoc_numero()); finform.setDdo_item(num); if (!msgsql.equals("0")) { error.add("error", new ActionMessage("error", msgsql)); saveErrors( request, error ); } else { error.add("error", new ActionMessage("error", "La modificación fue realizada correctamente")); saveErrors( request, error ); } } if (finform.getOpcion()==3){/*Eliminar*/ finform.setOperacion(2); msgsql=null; msgsql = bdc.insertardocumentos(finform.getDoc_codreg(),finform.getDoc_tipdoc(), finform.getDoc_numero(),finform.getDoc_fecha(),finform.getDoc_codofiorigen(), finform.getDoc_codfunorigen(),finform.getDoc_codubiorigen(), finform.getDoc_codfin(),finform.getDoc_codfinorigen(), finform.getDoc_codpryorigen(),finform.getDoc_codregdestino(), finform.getDoc_codofidestino(),finform.getDoc_codfundestino(), finform.getDoc_codubidestino(),finform.getDoc_codfindestino(), finform.getDoc_codprydestino(),finform.getDoc_observacion(), finform.getDoc_inconfirma(),fInicio.getTxt_usu(),finform.getOpcion(),0); finform.setDoc_codreg(""); finform.setDoc_tipdoc(""); finform.setDoc_numero(0); aCalm7 = bdc.listarTiposdoc(0,1,fInicio.getCod_fin(),fInicio.getCod_reg()); request.setAttribute("TiposDocumentosLista", aCalm7); if (!msgsql.equals("0")) { error.add("error", new ActionMessage("error", msgsql)); saveErrors( request, error ); } else { error.add("error", new ActionMessage("error", "La eliminación fue realizada correctamente")); saveErrors( request, error ); aCalm = bdc.listarActas2(1,0,fInicio.getCod_fin(),fInicio.getCod_reg(),finform.getDoc_tipdoc(),finform.getInicio(),finform.getFin(),finform.getOpcion(),finform.getConfirmados(),finform.getGestionant()); request.setAttribute("DocumentosLista", aCalm); } } if (finform.getOpcion()==4){/*Confirmar*/ if (finform.getDoc_tipdoc().equals("U")) { String StrSql=""; String status; Connection cn = null; ResultSet rs = null; CallableStatement call = null; try { Properties props = new Properties(); props.setProperty("mail.transport.protocol", "smtp"); props.setProperty("mail.host", "anbdm"); props.setProperty("mail.user", "<EMAIL>"); Session mailSession = Session.getDefaultInstance(props, null); Transport transport = mailSession.getTransport(); MimeMessage message = new MimeMessage(mailSession); message.setSubject("Transferencia de Bienes de Activo Fijo"); message.setFrom(new InternetAddress("<EMAIL>")); correo=bdc.Obtener_correo(finform.getDoc_codfundestino()); de_quien=bdc.nombrefuncionario(finform.getDoc_codfunorigen()); a_quien=bdc.nombrefuncionario(finform.getDoc_codfundestino()); String tel_mov = null; message.addRecipient(Message.RecipientType.BCC,new InternetAddress(correo)); MimeMultipart multipart = new MimeMultipart("related"); String htmlText = null; // Contenido (the html) BodyPart messageBodyPart = new MimeBodyPart(); cn = bdc.getConexion(); call = cn.prepareCall("{? = call pg_activos.listardetdocumentos2(?,?,?,?) }"); call.registerOutParameter(1, oracle.jdbc.OracleTypes.CURSOR); call.setString(2,finform.getDoc_codfin()); call.setString(3,finform.getDoc_codreg()); call.setString(4,finform.getDoc_tipdoc()); call.setInt(5,finform.getDoc_numero()); call.execute(); rs = (ResultSet) call.getObject(1); htmlText = "<b>Funcionario: " + a_quien + " se le ha transferido los siguientes bienes de Activo Fijo del Funcionario: "+de_quien+"</b><br><br>"; while (rs.next()){ htmlText = htmlText + rs.getString(6) + " " + rs.getString(8) + "<BR>"; } messageBodyPart.setContent(htmlText, "text/html"); // adiciona aqui multipart.addBodyPart(messageBodyPart); message.setContent(multipart); transport.connect(); transport.sendMessage(message, message.getRecipients(Message.RecipientType.BCC)); transport.close(); } catch(AddressException e) { status="Existe error en la dirección"; } catch(SendFailedException e) { status="Existe error al enviar la información"; } catch(MessagingException e) { status="Error inesperado."; } catch (SQLException e) { e.printStackTrace(); } finally { try { if (rs != null) { rs.close(); rs = null; } if (call != null) { call.close(); call = null; } if (cn != null) { cn.close(); cn = null; } } catch (Exception ex) { ; } } /*correo=bdc.Obtener_correo(finform.getDoc_codfundestino()); String Msg = ""; String smtpHost = "anbdm"; String status; String StrSql=""; Connection cn = null; ResultSet rs = null; CallableStatement call = null; try { Properties properties = System.getProperties(); Session session = Session.getInstance(properties,null); MimeMessage message = new MimeMessage(session); message.setContent( StrSql, "text/plain"); message.setFrom(new InternetAddress( "<EMAIL>" )); message.addRecipient( Message.RecipientType.TO, new InternetAddress(correo) ); message.setSubject( "Se le han transferido bienes de activos fijos" ); cn = bdc.getConexion(); call = cn.prepareCall("{? = call pg_activos.listardetdocumentos2(?,?,?,?) }"); call.registerOutParameter(1, oracle.jdbc.OracleTypes.CURSOR); call.setString(2,finform.getDoc_codfin()); call.setString(3,finform.getDoc_codreg()); call.setString(4,finform.getDoc_tipdoc()); call.setInt(5,finform.getDoc_numero()); call.execute(); rs = (ResultSet) call.getObject(1); Msg = "<b>Se le ha transferido los siguientes bienes de activos fijos</b>"; while (rs.next()){ Msg = Msg + rs.getString(6) + " " + rs.getString(8) + "<BR>"; } message.setText( Msg ); message.saveChanges(); Transport transport = session.getTransport("smtp"); transport.connect( smtpHost, "", "" ); transport.sendMessage( message, message.getAllRecipients()); transport.close(); } catch(AddressException e) { status="Existe error en la dirección"; } catch(SendFailedException e) { status="Existe error al enviar la información"; } catch(MessagingException e) { status="Error inesperado."; } catch (SQLException e) { e.printStackTrace(); } finally { try { if (rs != null) { rs.close(); rs = null; } if (call != null) { call.close(); call = null; } if (cn != null) { cn.close(); cn = null; } } catch (Exception ex) { ; } }*/ } finform.setOperacion(2); msgsql=null; msgsql = bdc.confirmardocumentos(finform.getDoc_codfin(),finform.getDoc_codreg(),finform.getDoc_tipdoc(), finform.getDoc_numero(),fInicio.getTxt_usu(),finform.getOpcion()); //finform.setDoc_codreg(""); //finform.setDoc_tipdoc(""); //finform.setDoc_numero(0); aCalm7 = bdc.listarTiposdoc(0,1,fInicio.getCod_fin(),fInicio.getCod_reg()); request.setAttribute("TiposDocumentosLista", aCalm7); if (!msgsql.equals("0")) { error.add("error", new ActionMessage("error", msgsql)); saveErrors( request, error ); } else { error.add("error", new ActionMessage("error", "La confirmación fue realizada correctamente")); saveErrors( request, error ); aCalm = bdc.listarActas2(1,0,fInicio.getCod_fin(),fInicio.getCod_reg(),finform.getDoc_tipdoc(),finform.getInicio(),finform.getFin(),finform.getOpcion(),finform.getConfirmados(),finform.getGestionant()); request.setAttribute("DocumentosLista", aCalm); finform.setOperacion(40); finform.setOpcion(40); } } if (finform.getOpcion()==5){/*Reportar*/ } } if (finform.getOperacion()==4){ if (finform.getOpcion()==1){/*Insertar*/ } if (finform.getOpcion()==2){/*Modificar*/ aCalm = bdc.listarActas2(1,0,fInicio.getCod_fin(),fInicio.getCod_reg(),finform.getDoc_tipdoc(),finform.getInicio(),finform.getFin(),finform.getOpcion(),finform.getConfirmados(),finform.getGestionant()); if (aCalm.size()!=0) { request.setAttribute("DocumentosLista", aCalm); } else { mensaje="No existe Acta con esta caracteristica(1)"; finform.setOperacion(9); } } if (finform.getOpcion()==3){/*Eliminar*/ aCalm = bdc.listarActas2(1,0,fInicio.getCod_fin(),fInicio.getCod_reg(),finform.getDoc_tipdoc(),finform.getInicio(),finform.getFin(),finform.getOpcion(),finform.getConfirmados(),finform.getGestionant()); if (aCalm.size()!=0) { request.setAttribute("DocumentosLista", aCalm); } else { mensaje="No existe Acta con esta caracteristica(2)"; finform.setOperacion(9); } } if (finform.getOpcion()==4){/*Confirmar*/ aCalm = bdc.listarActas2(1,0,fInicio.getCod_fin(),fInicio.getCod_reg(),finform.getDoc_tipdoc(),finform.getInicio(),finform.getFin(),finform.getOpcion(),finform.getConfirmados(),finform.getGestionant()); if (aCalm.size()!=0) { request.setAttribute("DocumentosLista", aCalm); } else { mensaje="No existe Acta con esta caracteristica(3)"; finform.setOperacion(9); } } if (finform.getOpcion()==5){/*Reportar*/ aCalm = bdc.listarActas2(1,0,fInicio.getCod_fin(),fInicio.getCod_reg(),finform.getDoc_tipdoc(),finform.getInicio(),finform.getFin(),finform.getOpcion(),finform.getConfirmados(),finform.getGestionant()); if (aCalm.size()!=0) { request.setAttribute("DocumentosLista", aCalm); } else { mensaje="No existe Acta con esta caracteristica(4)"; finform.setOperacion(9); } } } if (finform.getOperacion()==5){ if (finform.getOpcion()==1){/*Insertar*/ num = bdc.maximoTiposdoc(finform.getDoc_codfin(),finform.getDoc_codreg(),finform.getDoc_tipdoc()); finform.setDoc_numero(num); feccierre = bdc.FeccierreTiposdoc(finform.getDoc_tipdoc()); finform.setDoc_feccierre(feccierre); if (finform.getDoc_tipdoc().equals("B")) { codfun = bdc.FuncionarioActivos(finform.getDoc_codreg(),"01"); } else { codfun = bdc.FuncionarioActivos(finform.getDoc_codreg(),fInicio.getCod_fin()); } if ((finform.getDoc_tipdoc().equals("E"))||(finform.getDoc_tipdoc().equals("B"))){ finform.setDoc_codfunorigen(codfun); finform.setDoc_funorinombre(bdc.nombrefuncionario(finform.getDoc_codfunorigen())); if (finform.getDoc_tipdoc().equals("E")){ aCalm2 = bdc.listarFuncionariosa(0,fInicio.getCod_reg(),fInicio.getCod_fin()); } } if (finform.getDoc_tipdoc().equals("D")){ aCalm3 = bdc.listarFuncionarios3(0,fInicio.getCod_reg(),fInicio.getCod_fin(),fInicio.getAux1()); finform.setDoc_codfundestino(codfun); finform.setDoc_fundesnombre(bdc.nombrefuncionario(finform.getDoc_codfundestino())); } if (finform.getDoc_tipdoc().equals("T")){ aCalm3 = bdc.listarFuncionarios3(0,fInicio.getCod_reg(),fInicio.getCod_fin(),fInicio.getAux1()); /*aCalm2 = bdc.listarFuncionarios2(0,fInicio.getCod_reg(),fInicio.getAux1());*/ aCalm2 = bdc.listarFuncionariosa(0,fInicio.getCod_reg(),fInicio.getCod_fin()); } if (finform.getDoc_tipdoc().equals("U")){ aCalm3 = bdc.listarFuncionariosR(0,fInicio.getCod_reg(),fInicio.getCod_fin()); finform.setDoc_codfunorigen(codfun); finform.setDoc_funorinombre(bdc.nombrefuncionario(finform.getDoc_codfunorigen())); aCalm2 = bdc.listarFuncionariosR1(0,fInicio.getCod_reg(),fInicio.getCod_fin()); } if (finform.getDoc_tipdoc().equals("V")){ aCalm3 = bdc.listarFuncionariosR(0,fInicio.getCod_reg(),fInicio.getCod_fin()); finform.setDoc_codfunorigen(codfun); finform.setDoc_funorinombre(bdc.nombrefuncionario(finform.getDoc_codfunorigen())); aCalm2 = bdc.listarFuncionariosR2(0,fInicio.getCod_reg(),fInicio.getCod_fin()); } request.setAttribute("FuncionariosLista2", aCalm3); request.setAttribute("FuncionariosLista", aCalm2); if (num==0){ mensaje="No está definido correlativo (Correlativo de Actas)"; finform.setOperacion(9); } } if (finform.getOpcion()==2){/*Modificar*/ if (finform.getDoc_tipdoc().equals("B")) { codfun = bdc.FuncionarioActivos(finform.getDoc_codreg(),"01"); } else { codfun = bdc.FuncionarioActivos(finform.getDoc_codreg(),fInicio.getCod_fin()); } if ((finform.getDoc_tipdoc().equals("E"))||(finform.getDoc_tipdoc().equals("B"))){ finform.setDoc_codfunorigen(codfun); finform.setDoc_funorinombre(bdc.nombrefuncionario(finform.getDoc_codfunorigen())); if (finform.getDoc_tipdoc().equals("E")){ aCalm2 = bdc.listarFuncionariosa(0,fInicio.getCod_reg(),fInicio.getCod_fin()); } } if (finform.getDoc_tipdoc().equals("D")){ aCalm3 = bdc.listarFuncionarios3(0,fInicio.getCod_reg(),fInicio.getCod_fin(),fInicio.getAux1()); finform.setDoc_codfundestino(codfun); finform.setDoc_fundesnombre(bdc.nombrefuncionario(finform.getDoc_codfundestino())); } if (finform.getDoc_tipdoc().equals("T")){ aCalm3 = bdc.listarFuncionarios3(0,fInicio.getCod_reg(),fInicio.getCod_fin(),fInicio.getAux1()); /*aCalm2 = bdc.listarFuncionarios2(0,fInicio.getCod_reg(),fInicio.getAux1());*/ aCalm2 = bdc.listarFuncionariosa(0,fInicio.getCod_reg(),fInicio.getCod_fin()); } if (finform.getDoc_tipdoc().equals("U")){ aCalm3 = bdc.listarFuncionariosR(0,fInicio.getCod_reg(),fInicio.getCod_fin()); finform.setDoc_codfunorigen(codfun); finform.setDoc_funorinombre(bdc.nombrefuncionario(finform.getDoc_codfunorigen())); aCalm2 = bdc.listarFuncionariosR1(0,fInicio.getCod_reg(),fInicio.getCod_fin()); } if (finform.getDoc_tipdoc().equals("V")){ aCalm3 = bdc.listarFuncionariosR(0,fInicio.getCod_reg(),fInicio.getCod_fin()); finform.setDoc_codfunorigen(codfun); finform.setDoc_funorinombre(bdc.nombrefuncionario(finform.getDoc_codfunorigen())); aCalm2 = bdc.listarFuncionariosR2(0,fInicio.getCod_reg(),fInicio.getCod_fin()); } request.setAttribute("FuncionariosLista", aCalm2); request.setAttribute("FuncionariosLista2", aCalm3); aCalm = bdc.listarActas(1,0,fInicio.getCod_fin(),fInicio.getCod_reg(),finform.getDoc_tipdoc(),finform.getInicio(),finform.getFin(),finform.getOpcion(),finform.getConfirmados(),finform.getGestionant()); it = finform.getFila(); request.setAttribute("DocumentosLista", aCalm); ArrayList datos = (ArrayList) request.getAttribute("DocumentosLista"); DocumentosDetalleForm d = new DocumentosDetalleForm(); d = (DocumentosDetalleForm) datos.get(it); finform.setDoc_codreg(d.getcodreg()); finform.setDoc_tipdoc(d.gettipdoc()); finform.setDoc_numero(d.getnumero()); finform.setDoc_fecha(d.getfecha()); finform.setDoc_codfunorigen(d.getcodfunorigen()); finform.setDoc_codfundestino(d.getcodfundestino()); finform.setDoc_observacion(d.getobservacion()); finform.setDoc_funorinombre(bdc.nombrefuncionario(finform.getDoc_codfunorigen())); finform.setDoc_fundesnombre(bdc.nombrefuncionario(finform.getDoc_codfundestino())); finform.setDoc_ofiorinombre(bdc.nombreoficina(finform.getDoc_codofiorigen(),finform.getDoc_codreg())); finform.setDoc_ofidesnombre(bdc.nombreoficina(finform.getDoc_codofidestino(),finform.getDoc_codreg())); finform.setDoc_carorinombre(bdc.nombrecargo(finform.getDoc_codfunorigen())); finform.setDoc_cardesnombre(bdc.nombrecargo(finform.getDoc_codfundestino())); /*aCalm8 = bdc.listarDetDocumentos(finform.getDoc_codfin(),finform.getDoc_codreg(),finform.getDoc_tipdoc(),finform.getDoc_numero()); request.setAttribute("DetDocumentosLista", aCalm8); aCalm9 = bdc.listarTiposbaja(0); request.setAttribute("TiposBajaLista", aCalm9); aCalm11 = bdc.listarOficinas(0,fInicio.getCod_reg()); request.setAttribute("OficinasLista", aCalm11); aCalm12 = bdc.listarRubros(0); request.setAttribute("RubrosLista", aCalm12); aCalm10 = bdc.listarActivos2(0,finform.getDoc_codfin(),finform.getDoc_codreg(),finform.getDoc_tipdoc(),finform.getDoc_numero(),finform.getDoc_codfunorigen(),finform.getDoc_fecha(),finform.getDdo_codrubactual(),finform.getDdo_codigo(),finform.getDdo_codigo()); request.setAttribute("Activos2Lista", aCalm10); num = bdc.maximoDetDocumentos(finform.getDoc_codfin(),finform.getDoc_codreg(),finform.getDoc_tipdoc(),finform.getDoc_numero()); finform.setDdo_item(num);*/ } if (finform.getOpcion()==3){/*Eliminar*/ } if (finform.getOpcion()==4){ } if (finform.getOpcion()==5){ } } if (finform.getOperacion()!=9) { if ((finform.getOperacion()==3)&&(finform.getOpcion()==5)) return mapping.findForward("reportar"); else if ((finform.getOperacion()==40)&&(finform.getOpcion()==40)) { finform.setOperacion(4); finform.setOpcion(4); } return mapping.findForward("volver"); } else { finform.setOperacion(1); finform.setOpcion(1); error.add("error", new ActionMessage("error", mensaje)); saveErrors( request, error ); return mapping.findForward("volver"); } } catch (Exception e) { error.add("error", new ActionMessage("errordb", "No se pudo iniciar Activos")); error.add("error", new ActionMessage("errordb", e.toString() )); e.printStackTrace(); saveErrors( request, error ); return mapping.findForward("volver"); } finally { try { if( l_connection != null ) l_connection.close(); } catch (Exception e) { String StrSql = "Error al cerrar la conexión a la Base de Datos " + e.getMessage(); return mapping.findForward("volver");; } } } return mapping.findForward("volver"); } } <file_sep>package ActivosFijos; import org.apache.struts.action.Action; import org.apache.struts.action.ActionForm; import org.apache.struts.action.ActionForward; import org.apache.struts.action.ActionMapping; import org.apache.struts.action.ActionMessage; import org.apache.struts.action.ActionMessages; import org.apache.struts.action.ActionError; import org.apache.struts.action.ActionErrors; import java.io.IOException; import javax.servlet.ServletException; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import java.util.ArrayList; public class OficinasAction extends Action { /** * This is the main action called from the Struts framework. * @param mapping The ActionMapping used to select this instance. * @param form The optional ActionForm bean for this request. * @param request The HTTP Request we are processing. * @param response The HTTP Response we are processing. */ public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException { ActionMessages error = new ActionMessages(); OficinasForm finform = (OficinasForm)form; InicioForm fInicio = (InicioForm) request.getSession().getAttribute("InicioForm"); finform.setOfi_codreg(fInicio.getCod_reg()); finform.setDescripcion_codreg(fInicio.getRegional()); String usuario = fInicio.getNombreUsuario(); BDConection bdc = new BDConection(); ArrayList aCalm; ArrayList aCalm2; ArrayList aCalm3; if (!(fInicio.getNombreUsuario().equals("SALIO"))) { int it = finform.getFila(); try { aCalm = bdc.listarOficinas(1,fInicio.getCod_reg()); request.setAttribute("OficinasLista", aCalm); aCalm2 = bdc.listarRegionales(0); request.setAttribute("RegionalesLista", aCalm2); aCalm3 = bdc.listarUbicaciones(0,fInicio.getCod_reg()); request.setAttribute("UbicacionesLista", aCalm3); ArrayList datos = (ArrayList) request.getAttribute("OficinasLista"); if (finform.getOperacion()==1) { OficinasDetalleForm d = new OficinasDetalleForm(); d = (OficinasDetalleForm) datos.get(it); finform.setOfi_codigo(d.getCodigo()); finform.setOfi_descripcion(d.getDescripcion()); finform.setOfi_codreg(d.getCodreg()); finform.setOfi_codubi(d.getCodubi()); finform.setDescripcion_codubi(d.getDescripcion_codubi()); } if (finform.getOperacion()==2) { try { if (!finform.getBoton().equals("Cancelar")) { String msgsql=null; msgsql = bdc.insertaroficinas(finform.getOfi_codigo(),finform.getOfi_descripcion(),finform.getOfi_codreg(),finform.getOfi_codubi(),fInicio.getTxt_usu(),finform.getOpcion()); finform.setOfi_codigo(""); finform.setOfi_descripcion(""); finform.setOfi_codreg(""); finform.setOfi_codubi(""); if (!msgsql.equals("0")) { error.add("error", new ActionMessage("error", msgsql)); saveErrors( request, error ); } else { error.add("error", new ActionMessage("error", "La transacción fue realizada correctamente")); saveErrors( request, error ); } } else { finform.setOfi_codigo(""); finform.setOfi_descripcion(""); finform.setOfi_codreg(""); finform.setOfi_codubi(""); } try { aCalm = bdc.listarOficinas(1,fInicio.getCod_reg()); request.setAttribute("OficinasLista", aCalm); aCalm2 = bdc.listarRegionales(0); request.setAttribute("RegionalesLista", aCalm2); aCalm3 = bdc.listarUbicaciones(0,fInicio.getCod_reg()); request.setAttribute("UbicacionesLista", aCalm3); } catch (Exception e) { error.add("error", new ActionMessage("errordb", "No se pudo iniciar Oficinas")); error.add("error", new ActionMessage("errordb", e.toString() )); e.printStackTrace(); saveErrors( request, error ); } } catch (Exception e) { error.add("error", new ActionMessage("errordb", "No se pudo realizar la transaccion.")); error.add("error", new ActionMessage("errordb", e.toString() )); e.printStackTrace(); saveErrors( request, error ); } } } catch (Exception e) { error.add("error", new ActionMessage("errordb", "No se pudo iniciar Oficinass")); error.add("error", new ActionMessage("errordb", e.toString() )); e.printStackTrace(); saveErrors( request, error ); } } return mapping.findForward("volver"); } }<file_sep> /*@lineinfo:filename=/Activos_a.jsp*/ /*@lineinfo:generated-code*/ import oracle.jsp.runtime.*; import javax.servlet.*; import javax.servlet.http.*; import javax.servlet.jsp.*; import java.util.Vector; import ActivosFijos.*; public class _Activos__a extends oracle.jsp.runtime.HttpJsp { public final String _globalsClassName = null; // ** Begin Declarations // ** End Declarations public void _jspService(HttpServletRequest request, HttpServletResponse response) throws java.io.IOException, ServletException { response.setContentType( "text/html;charset=windows-1252"); /* set up the intrinsic variables using the pageContext goober: ** session = HttpSession ** application = ServletContext ** out = JspWriter ** page = this ** config = ServletConfig ** all session/app beans declared in globals.jsa */ PageContext pageContext = JspFactory.getDefaultFactory().getPageContext( this, request, response, null, true, JspWriter.DEFAULT_BUFFER, true); // Note: this is not emitted if the session directive == false HttpSession session = pageContext.getSession(); if (pageContext.getAttribute(OracleJspRuntime.JSP_REQUEST_REDIRECTED, PageContext.REQUEST_SCOPE) != null) { pageContext.setAttribute(OracleJspRuntime.JSP_PAGE_DONTNOTIFY, "true", PageContext.PAGE_SCOPE); JspFactory.getDefaultFactory().releasePageContext(pageContext); return; } int __jsp_tag_starteval; ServletContext application = pageContext.getServletContext(); JspWriter out = pageContext.getOut(); _Activos__a page = this; ServletConfig config = pageContext.getServletConfig(); try { // global beans // end global beans out.write(__jsp_StaticText.text[0]); out.write(__jsp_StaticText.text[1]); out.write(__jsp_StaticText.text[2]); out.write(__jsp_StaticText.text[3]); out.write(__jsp_StaticText.text[4]); /*@lineinfo:translated-code*//*@lineinfo:18^10*/ { org.apache.struts.taglib.html.FormTag __jsp_taghandler_1=(org.apache.struts.taglib.html.FormTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.FormTag.class,"org.apache.struts.taglib.html.FormTag action"); __jsp_taghandler_1.setParent(null); __jsp_taghandler_1.setAction("/activosAction"); __jsp_tag_starteval=__jsp_taghandler_1.doStartTag(); if (OracleJspRuntime.checkStartTagEval(__jsp_tag_starteval)) { do { /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[5]); /*@lineinfo:translated-code*//*@lineinfo:19^10*/ { org.apache.struts.taglib.html.HiddenTag __jsp_taghandler_2=(org.apache.struts.taglib.html.HiddenTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.HiddenTag.class,"org.apache.struts.taglib.html.HiddenTag property"); __jsp_taghandler_2.setParent(__jsp_taghandler_1); __jsp_taghandler_2.setProperty("operacion"); __jsp_tag_starteval=__jsp_taghandler_2.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_2,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_2.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_2.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_2); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[6]); /*@lineinfo:translated-code*//*@lineinfo:20^10*/ { org.apache.struts.taglib.html.HiddenTag __jsp_taghandler_3=(org.apache.struts.taglib.html.HiddenTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.HiddenTag.class,"org.apache.struts.taglib.html.HiddenTag property"); __jsp_taghandler_3.setParent(__jsp_taghandler_1); __jsp_taghandler_3.setProperty("opcion"); __jsp_tag_starteval=__jsp_taghandler_3.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_3,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_3.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_3.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_3); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[7]); /*@lineinfo:translated-code*//*@lineinfo:21^10*/ { org.apache.struts.taglib.logic.EqualTag __jsp_taghandler_4=(org.apache.struts.taglib.logic.EqualTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.logic.EqualTag.class,"org.apache.struts.taglib.logic.EqualTag name property value"); __jsp_taghandler_4.setParent(__jsp_taghandler_1); __jsp_taghandler_4.setName("ActivosForm"); __jsp_taghandler_4.setProperty("operacion"); __jsp_taghandler_4.setValue("1"); __jsp_tag_starteval=__jsp_taghandler_4.doStartTag(); if (OracleJspRuntime.checkStartTagEval(__jsp_tag_starteval)) { do { /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[8]); /*@lineinfo:translated-code*//*@lineinfo:22^13*/ { org.apache.struts.taglib.logic.EqualTag __jsp_taghandler_5=(org.apache.struts.taglib.logic.EqualTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.logic.EqualTag.class,"org.apache.struts.taglib.logic.EqualTag name property value"); __jsp_taghandler_5.setParent(__jsp_taghandler_4); __jsp_taghandler_5.setName("ActivosForm"); __jsp_taghandler_5.setProperty("opcion"); __jsp_taghandler_5.setValue("4"); __jsp_tag_starteval=__jsp_taghandler_5.doStartTag(); if (OracleJspRuntime.checkStartTagEval(__jsp_tag_starteval)) { do { /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[9]); /*@lineinfo:translated-code*//*@lineinfo:26^21*/ { org.apache.struts.taglib.bean.MessageTag __jsp_taghandler_6=(org.apache.struts.taglib.bean.MessageTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.bean.MessageTag.class,"org.apache.struts.taglib.bean.MessageTag key"); __jsp_taghandler_6.setParent(__jsp_taghandler_5); __jsp_taghandler_6.setKey("activos.codrub"); __jsp_tag_starteval=__jsp_taghandler_6.doStartTag(); if (OracleJspRuntime.checkStartTagEval(__jsp_tag_starteval)) { do { } while (__jsp_taghandler_6.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); } if (__jsp_taghandler_6.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_6); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[10]); /*@lineinfo:translated-code*//*@lineinfo:29^21*/ { org.apache.struts.taglib.html.TextTag __jsp_taghandler_7=(org.apache.struts.taglib.html.TextTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.TextTag.class,"org.apache.struts.taglib.html.TextTag maxlength name property readonly size"); __jsp_taghandler_7.setParent(__jsp_taghandler_5); __jsp_taghandler_7.setMaxlength("10"); __jsp_taghandler_7.setName("ActivosForm"); __jsp_taghandler_7.setProperty("act_codrub"); __jsp_taghandler_7.setReadonly(true); __jsp_taghandler_7.setSize("10"); __jsp_tag_starteval=__jsp_taghandler_7.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_7,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_7.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_7.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_7); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[11]); /*@lineinfo:translated-code*//*@lineinfo:30^25*/ { org.apache.struts.taglib.html.TextTag __jsp_taghandler_8=(org.apache.struts.taglib.html.TextTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.TextTag.class,"org.apache.struts.taglib.html.TextTag maxlength name property readonly size"); __jsp_taghandler_8.setParent(__jsp_taghandler_5); __jsp_taghandler_8.setMaxlength("60"); __jsp_taghandler_8.setName("ActivosForm"); __jsp_taghandler_8.setProperty("act_rubdescripcion"); __jsp_taghandler_8.setReadonly(true); __jsp_taghandler_8.setSize("60"); __jsp_tag_starteval=__jsp_taghandler_8.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_8,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_8.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_8.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_8); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[12]); /*@lineinfo:translated-code*//*@lineinfo:35^21*/ { org.apache.struts.taglib.bean.MessageTag __jsp_taghandler_9=(org.apache.struts.taglib.bean.MessageTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.bean.MessageTag.class,"org.apache.struts.taglib.bean.MessageTag key"); __jsp_taghandler_9.setParent(__jsp_taghandler_5); __jsp_taghandler_9.setKey("activos.codreg"); __jsp_tag_starteval=__jsp_taghandler_9.doStartTag(); if (OracleJspRuntime.checkStartTagEval(__jsp_tag_starteval)) { do { } while (__jsp_taghandler_9.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); } if (__jsp_taghandler_9.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_9); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[13]); /*@lineinfo:translated-code*//*@lineinfo:38^21*/ { org.apache.struts.taglib.html.TextTag __jsp_taghandler_10=(org.apache.struts.taglib.html.TextTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.TextTag.class,"org.apache.struts.taglib.html.TextTag maxlength name property readonly size"); __jsp_taghandler_10.setParent(__jsp_taghandler_5); __jsp_taghandler_10.setMaxlength("10"); __jsp_taghandler_10.setName("ActivosForm"); __jsp_taghandler_10.setProperty("act_codreg"); __jsp_taghandler_10.setReadonly(true); __jsp_taghandler_10.setSize("10"); __jsp_tag_starteval=__jsp_taghandler_10.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_10,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_10.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_10.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_10); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[14]); /*@lineinfo:translated-code*//*@lineinfo:39^25*/ { org.apache.struts.taglib.html.TextTag __jsp_taghandler_11=(org.apache.struts.taglib.html.TextTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.TextTag.class,"org.apache.struts.taglib.html.TextTag maxlength name property readonly size"); __jsp_taghandler_11.setParent(__jsp_taghandler_5); __jsp_taghandler_11.setMaxlength("60"); __jsp_taghandler_11.setName("ActivosForm"); __jsp_taghandler_11.setProperty("act_regdescripcion"); __jsp_taghandler_11.setReadonly(true); __jsp_taghandler_11.setSize("60"); __jsp_tag_starteval=__jsp_taghandler_11.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_11,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_11.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_11.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_11); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[15]); /*@lineinfo:translated-code*//*@lineinfo:44^21*/ { org.apache.struts.taglib.bean.MessageTag __jsp_taghandler_12=(org.apache.struts.taglib.bean.MessageTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.bean.MessageTag.class,"org.apache.struts.taglib.bean.MessageTag key"); __jsp_taghandler_12.setParent(__jsp_taghandler_5); __jsp_taghandler_12.setKey("activos.codigo"); __jsp_tag_starteval=__jsp_taghandler_12.doStartTag(); if (OracleJspRuntime.checkStartTagEval(__jsp_tag_starteval)) { do { } while (__jsp_taghandler_12.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); } if (__jsp_taghandler_12.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_12); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[16]); /*@lineinfo:translated-code*//*@lineinfo:47^21*/ { org.apache.struts.taglib.html.TextTag __jsp_taghandler_13=(org.apache.struts.taglib.html.TextTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.TextTag.class,"org.apache.struts.taglib.html.TextTag maxlength name property readonly size"); __jsp_taghandler_13.setParent(__jsp_taghandler_5); __jsp_taghandler_13.setMaxlength("5"); __jsp_taghandler_13.setName("ActivosForm"); __jsp_taghandler_13.setProperty("act_codigo"); __jsp_taghandler_13.setReadonly(true); __jsp_taghandler_13.setSize("5"); __jsp_tag_starteval=__jsp_taghandler_13.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_13,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_13.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_13.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_13); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[17]); /*@lineinfo:translated-code*//*@lineinfo:48^25*/ { org.apache.struts.taglib.html.TextTag __jsp_taghandler_14=(org.apache.struts.taglib.html.TextTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.TextTag.class,"org.apache.struts.taglib.html.TextTag maxlength name property readonly size"); __jsp_taghandler_14.setParent(__jsp_taghandler_5); __jsp_taghandler_14.setMaxlength("10"); __jsp_taghandler_14.setName("ActivosForm"); __jsp_taghandler_14.setProperty("act_codbarra"); __jsp_taghandler_14.setReadonly(true); __jsp_taghandler_14.setSize("10"); __jsp_tag_starteval=__jsp_taghandler_14.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_14,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_14.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_14.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_14); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[18]); /*@lineinfo:translated-code*//*@lineinfo:53^21*/ { org.apache.struts.taglib.bean.MessageTag __jsp_taghandler_15=(org.apache.struts.taglib.bean.MessageTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.bean.MessageTag.class,"org.apache.struts.taglib.bean.MessageTag key"); __jsp_taghandler_15.setParent(__jsp_taghandler_5); __jsp_taghandler_15.setKey("activos.codgrp"); __jsp_tag_starteval=__jsp_taghandler_15.doStartTag(); if (OracleJspRuntime.checkStartTagEval(__jsp_tag_starteval)) { do { } while (__jsp_taghandler_15.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); } if (__jsp_taghandler_15.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_15); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[19]); /*@lineinfo:translated-code*//*@lineinfo:56^25*/ { org.apache.struts.taglib.html.TextTag __jsp_taghandler_16=(org.apache.struts.taglib.html.TextTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.TextTag.class,"org.apache.struts.taglib.html.TextTag maxlength name property readonly size"); __jsp_taghandler_16.setParent(__jsp_taghandler_5); __jsp_taghandler_16.setMaxlength("40"); __jsp_taghandler_16.setName("ActivosForm"); __jsp_taghandler_16.setProperty("act_grpdescripcion"); __jsp_taghandler_16.setReadonly(true); __jsp_taghandler_16.setSize("40"); __jsp_tag_starteval=__jsp_taghandler_16.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_16,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_16.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_16.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_16); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[20]); /*@lineinfo:translated-code*//*@lineinfo:57^25*/ { org.apache.struts.taglib.html.HiddenTag __jsp_taghandler_17=(org.apache.struts.taglib.html.HiddenTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.HiddenTag.class,"org.apache.struts.taglib.html.HiddenTag name property"); __jsp_taghandler_17.setParent(__jsp_taghandler_5); __jsp_taghandler_17.setName("ActivosForm"); __jsp_taghandler_17.setProperty("act_codgrp"); __jsp_tag_starteval=__jsp_taghandler_17.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_17,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_17.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_17.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_17); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[21]); /*@lineinfo:translated-code*//*@lineinfo:60^21*/ { org.apache.struts.taglib.bean.MessageTag __jsp_taghandler_18=(org.apache.struts.taglib.bean.MessageTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.bean.MessageTag.class,"org.apache.struts.taglib.bean.MessageTag key"); __jsp_taghandler_18.setParent(__jsp_taghandler_5); __jsp_taghandler_18.setKey("activos.codpar"); __jsp_tag_starteval=__jsp_taghandler_18.doStartTag(); if (OracleJspRuntime.checkStartTagEval(__jsp_tag_starteval)) { do { } while (__jsp_taghandler_18.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); } if (__jsp_taghandler_18.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_18); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[22]); /*@lineinfo:translated-code*//*@lineinfo:63^25*/ { org.apache.struts.taglib.html.TextTag __jsp_taghandler_19=(org.apache.struts.taglib.html.TextTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.TextTag.class,"org.apache.struts.taglib.html.TextTag maxlength name property readonly size"); __jsp_taghandler_19.setParent(__jsp_taghandler_5); __jsp_taghandler_19.setMaxlength("40"); __jsp_taghandler_19.setName("ActivosForm"); __jsp_taghandler_19.setProperty("act_pardescripcion"); __jsp_taghandler_19.setReadonly(true); __jsp_taghandler_19.setSize("40"); __jsp_tag_starteval=__jsp_taghandler_19.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_19,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_19.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_19.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_19); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[23]); /*@lineinfo:translated-code*//*@lineinfo:64^25*/ { org.apache.struts.taglib.html.HiddenTag __jsp_taghandler_20=(org.apache.struts.taglib.html.HiddenTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.HiddenTag.class,"org.apache.struts.taglib.html.HiddenTag name property"); __jsp_taghandler_20.setParent(__jsp_taghandler_5); __jsp_taghandler_20.setName("ActivosForm"); __jsp_taghandler_20.setProperty("act_codpar"); __jsp_tag_starteval=__jsp_taghandler_20.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_20,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_20.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_20.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_20); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[24]); /*@lineinfo:translated-code*//*@lineinfo:69^21*/ { org.apache.struts.taglib.bean.MessageTag __jsp_taghandler_21=(org.apache.struts.taglib.bean.MessageTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.bean.MessageTag.class,"org.apache.struts.taglib.bean.MessageTag key"); __jsp_taghandler_21.setParent(__jsp_taghandler_5); __jsp_taghandler_21.setKey("activos.codofi"); __jsp_tag_starteval=__jsp_taghandler_21.doStartTag(); if (OracleJspRuntime.checkStartTagEval(__jsp_tag_starteval)) { do { } while (__jsp_taghandler_21.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); } if (__jsp_taghandler_21.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_21); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[25]); /*@lineinfo:translated-code*//*@lineinfo:72^25*/ { org.apache.struts.taglib.html.TextTag __jsp_taghandler_22=(org.apache.struts.taglib.html.TextTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.TextTag.class,"org.apache.struts.taglib.html.TextTag maxlength name property readonly size"); __jsp_taghandler_22.setParent(__jsp_taghandler_5); __jsp_taghandler_22.setMaxlength("40"); __jsp_taghandler_22.setName("ActivosForm"); __jsp_taghandler_22.setProperty("act_ofidescripcion"); __jsp_taghandler_22.setReadonly(true); __jsp_taghandler_22.setSize("40"); __jsp_tag_starteval=__jsp_taghandler_22.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_22,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_22.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_22.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_22); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[26]); /*@lineinfo:translated-code*//*@lineinfo:73^25*/ { org.apache.struts.taglib.html.HiddenTag __jsp_taghandler_23=(org.apache.struts.taglib.html.HiddenTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.HiddenTag.class,"org.apache.struts.taglib.html.HiddenTag name property"); __jsp_taghandler_23.setParent(__jsp_taghandler_5); __jsp_taghandler_23.setName("ActivosForm"); __jsp_taghandler_23.setProperty("act_codofi"); __jsp_tag_starteval=__jsp_taghandler_23.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_23,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_23.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_23.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_23); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[27]); /*@lineinfo:translated-code*//*@lineinfo:76^21*/ { org.apache.struts.taglib.bean.MessageTag __jsp_taghandler_24=(org.apache.struts.taglib.bean.MessageTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.bean.MessageTag.class,"org.apache.struts.taglib.bean.MessageTag key"); __jsp_taghandler_24.setParent(__jsp_taghandler_5); __jsp_taghandler_24.setKey("activos.codfun"); __jsp_tag_starteval=__jsp_taghandler_24.doStartTag(); if (OracleJspRuntime.checkStartTagEval(__jsp_tag_starteval)) { do { } while (__jsp_taghandler_24.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); } if (__jsp_taghandler_24.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_24); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[28]); /*@lineinfo:translated-code*//*@lineinfo:79^25*/ { org.apache.struts.taglib.html.TextTag __jsp_taghandler_25=(org.apache.struts.taglib.html.TextTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.TextTag.class,"org.apache.struts.taglib.html.TextTag maxlength name property readonly size"); __jsp_taghandler_25.setParent(__jsp_taghandler_5); __jsp_taghandler_25.setMaxlength("40"); __jsp_taghandler_25.setName("ActivosForm"); __jsp_taghandler_25.setProperty("act_fundescripcion"); __jsp_taghandler_25.setReadonly(true); __jsp_taghandler_25.setSize("40"); __jsp_tag_starteval=__jsp_taghandler_25.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_25,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_25.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_25.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_25); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[29]); /*@lineinfo:translated-code*//*@lineinfo:80^25*/ { org.apache.struts.taglib.html.HiddenTag __jsp_taghandler_26=(org.apache.struts.taglib.html.HiddenTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.HiddenTag.class,"org.apache.struts.taglib.html.HiddenTag name property"); __jsp_taghandler_26.setParent(__jsp_taghandler_5); __jsp_taghandler_26.setName("ActivosForm"); __jsp_taghandler_26.setProperty("act_codfun"); __jsp_tag_starteval=__jsp_taghandler_26.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_26,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_26.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_26.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_26); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[30]); /*@lineinfo:translated-code*//*@lineinfo:85^21*/ { org.apache.struts.taglib.bean.MessageTag __jsp_taghandler_27=(org.apache.struts.taglib.bean.MessageTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.bean.MessageTag.class,"org.apache.struts.taglib.bean.MessageTag key"); __jsp_taghandler_27.setParent(__jsp_taghandler_5); __jsp_taghandler_27.setKey("activos.codubi"); __jsp_tag_starteval=__jsp_taghandler_27.doStartTag(); if (OracleJspRuntime.checkStartTagEval(__jsp_tag_starteval)) { do { } while (__jsp_taghandler_27.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); } if (__jsp_taghandler_27.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_27); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[31]); /*@lineinfo:translated-code*//*@lineinfo:88^25*/ { org.apache.struts.taglib.html.TextTag __jsp_taghandler_28=(org.apache.struts.taglib.html.TextTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.TextTag.class,"org.apache.struts.taglib.html.TextTag maxlength name property readonly size"); __jsp_taghandler_28.setParent(__jsp_taghandler_5); __jsp_taghandler_28.setMaxlength("40"); __jsp_taghandler_28.setName("ActivosForm"); __jsp_taghandler_28.setProperty("act_ubidescripcion"); __jsp_taghandler_28.setReadonly(true); __jsp_taghandler_28.setSize("40"); __jsp_tag_starteval=__jsp_taghandler_28.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_28,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_28.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_28.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_28); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[32]); /*@lineinfo:translated-code*//*@lineinfo:89^25*/ { org.apache.struts.taglib.html.HiddenTag __jsp_taghandler_29=(org.apache.struts.taglib.html.HiddenTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.HiddenTag.class,"org.apache.struts.taglib.html.HiddenTag name property"); __jsp_taghandler_29.setParent(__jsp_taghandler_5); __jsp_taghandler_29.setName("ActivosForm"); __jsp_taghandler_29.setProperty("act_codubi"); __jsp_tag_starteval=__jsp_taghandler_29.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_29,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_29.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_29.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_29); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[33]); /*@lineinfo:translated-code*//*@lineinfo:92^21*/ { org.apache.struts.taglib.bean.MessageTag __jsp_taghandler_30=(org.apache.struts.taglib.bean.MessageTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.bean.MessageTag.class,"org.apache.struts.taglib.bean.MessageTag key"); __jsp_taghandler_30.setParent(__jsp_taghandler_5); __jsp_taghandler_30.setKey("activos.codpry"); __jsp_tag_starteval=__jsp_taghandler_30.doStartTag(); if (OracleJspRuntime.checkStartTagEval(__jsp_tag_starteval)) { do { } while (__jsp_taghandler_30.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); } if (__jsp_taghandler_30.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_30); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[34]); /*@lineinfo:translated-code*//*@lineinfo:95^25*/ { org.apache.struts.taglib.html.TextTag __jsp_taghandler_31=(org.apache.struts.taglib.html.TextTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.TextTag.class,"org.apache.struts.taglib.html.TextTag maxlength name property readonly size"); __jsp_taghandler_31.setParent(__jsp_taghandler_5); __jsp_taghandler_31.setMaxlength("40"); __jsp_taghandler_31.setName("ActivosForm"); __jsp_taghandler_31.setProperty("act_prydescripcion"); __jsp_taghandler_31.setReadonly(true); __jsp_taghandler_31.setSize("40"); __jsp_tag_starteval=__jsp_taghandler_31.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_31,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_31.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_31.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_31); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[35]); /*@lineinfo:translated-code*//*@lineinfo:96^25*/ { org.apache.struts.taglib.html.HiddenTag __jsp_taghandler_32=(org.apache.struts.taglib.html.HiddenTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.HiddenTag.class,"org.apache.struts.taglib.html.HiddenTag name property"); __jsp_taghandler_32.setParent(__jsp_taghandler_5); __jsp_taghandler_32.setName("ActivosForm"); __jsp_taghandler_32.setProperty("act_codpry"); __jsp_tag_starteval=__jsp_taghandler_32.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_32,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_32.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_32.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_32); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[36]); /*@lineinfo:translated-code*//*@lineinfo:101^21*/ { org.apache.struts.taglib.bean.MessageTag __jsp_taghandler_33=(org.apache.struts.taglib.bean.MessageTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.bean.MessageTag.class,"org.apache.struts.taglib.bean.MessageTag key"); __jsp_taghandler_33.setParent(__jsp_taghandler_5); __jsp_taghandler_33.setKey("activos.codfin"); __jsp_tag_starteval=__jsp_taghandler_33.doStartTag(); if (OracleJspRuntime.checkStartTagEval(__jsp_tag_starteval)) { do { } while (__jsp_taghandler_33.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); } if (__jsp_taghandler_33.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_33); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[37]); /*@lineinfo:translated-code*//*@lineinfo:104^25*/ { org.apache.struts.taglib.html.TextTag __jsp_taghandler_34=(org.apache.struts.taglib.html.TextTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.TextTag.class,"org.apache.struts.taglib.html.TextTag maxlength name property readonly size"); __jsp_taghandler_34.setParent(__jsp_taghandler_5); __jsp_taghandler_34.setMaxlength("40"); __jsp_taghandler_34.setName("ActivosForm"); __jsp_taghandler_34.setProperty("act_findescripcion"); __jsp_taghandler_34.setReadonly(true); __jsp_taghandler_34.setSize("40"); __jsp_tag_starteval=__jsp_taghandler_34.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_34,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_34.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_34.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_34); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[38]); /*@lineinfo:translated-code*//*@lineinfo:105^25*/ { org.apache.struts.taglib.html.HiddenTag __jsp_taghandler_35=(org.apache.struts.taglib.html.HiddenTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.HiddenTag.class,"org.apache.struts.taglib.html.HiddenTag name property"); __jsp_taghandler_35.setParent(__jsp_taghandler_5); __jsp_taghandler_35.setName("ActivosForm"); __jsp_taghandler_35.setProperty("act_codfin"); __jsp_tag_starteval=__jsp_taghandler_35.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_35,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_35.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_35.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_35); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[39]); /*@lineinfo:translated-code*//*@lineinfo:110^21*/ { org.apache.struts.taglib.bean.MessageTag __jsp_taghandler_36=(org.apache.struts.taglib.bean.MessageTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.bean.MessageTag.class,"org.apache.struts.taglib.bean.MessageTag key"); __jsp_taghandler_36.setParent(__jsp_taghandler_5); __jsp_taghandler_36.setKey("activos.feccompra"); __jsp_tag_starteval=__jsp_taghandler_36.doStartTag(); if (OracleJspRuntime.checkStartTagEval(__jsp_tag_starteval)) { do { } while (__jsp_taghandler_36.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); } if (__jsp_taghandler_36.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_36); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[40]); /*@lineinfo:translated-code*//*@lineinfo:113^21*/ { org.apache.struts.taglib.html.TextTag __jsp_taghandler_37=(org.apache.struts.taglib.html.TextTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.TextTag.class,"org.apache.struts.taglib.html.TextTag maxlength name property size"); __jsp_taghandler_37.setParent(__jsp_taghandler_5); __jsp_taghandler_37.setMaxlength("10"); __jsp_taghandler_37.setName("ActivosForm"); __jsp_taghandler_37.setProperty("act_feccompra"); __jsp_taghandler_37.setSize("10"); __jsp_tag_starteval=__jsp_taghandler_37.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_37,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_37.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_37.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_37); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[41]); /*@lineinfo:translated-code*//*@lineinfo:116^21*/ { org.apache.struts.taglib.bean.MessageTag __jsp_taghandler_38=(org.apache.struts.taglib.bean.MessageTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.bean.MessageTag.class,"org.apache.struts.taglib.bean.MessageTag key"); __jsp_taghandler_38.setParent(__jsp_taghandler_5); __jsp_taghandler_38.setKey("activos.tipcam"); __jsp_tag_starteval=__jsp_taghandler_38.doStartTag(); if (OracleJspRuntime.checkStartTagEval(__jsp_tag_starteval)) { do { } while (__jsp_taghandler_38.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); } if (__jsp_taghandler_38.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_38); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[42]); /*@lineinfo:translated-code*//*@lineinfo:119^21*/ { org.apache.struts.taglib.html.TextTag __jsp_taghandler_39=(org.apache.struts.taglib.html.TextTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.TextTag.class,"org.apache.struts.taglib.html.TextTag maxlength name property size"); __jsp_taghandler_39.setParent(__jsp_taghandler_5); __jsp_taghandler_39.setMaxlength("11"); __jsp_taghandler_39.setName("ActivosForm"); __jsp_taghandler_39.setProperty("act_tipcam"); __jsp_taghandler_39.setSize("11"); __jsp_tag_starteval=__jsp_taghandler_39.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_39,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_39.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_39.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_39); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[43]); /*@lineinfo:translated-code*//*@lineinfo:124^21*/ { org.apache.struts.taglib.bean.MessageTag __jsp_taghandler_40=(org.apache.struts.taglib.bean.MessageTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.bean.MessageTag.class,"org.apache.struts.taglib.bean.MessageTag key"); __jsp_taghandler_40.setParent(__jsp_taghandler_5); __jsp_taghandler_40.setKey("activos.tipufv"); __jsp_tag_starteval=__jsp_taghandler_40.doStartTag(); if (OracleJspRuntime.checkStartTagEval(__jsp_tag_starteval)) { do { } while (__jsp_taghandler_40.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); } if (__jsp_taghandler_40.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_40); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[44]); /*@lineinfo:translated-code*//*@lineinfo:127^21*/ { org.apache.struts.taglib.html.TextTag __jsp_taghandler_41=(org.apache.struts.taglib.html.TextTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.TextTag.class,"org.apache.struts.taglib.html.TextTag maxlength name property size"); __jsp_taghandler_41.setParent(__jsp_taghandler_5); __jsp_taghandler_41.setMaxlength("11"); __jsp_taghandler_41.setName("ActivosForm"); __jsp_taghandler_41.setProperty("act_tipufv"); __jsp_taghandler_41.setSize("11"); __jsp_tag_starteval=__jsp_taghandler_41.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_41,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_41.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_41.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_41); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[45]); /*@lineinfo:translated-code*//*@lineinfo:130^21*/ { org.apache.struts.taglib.bean.MessageTag __jsp_taghandler_42=(org.apache.struts.taglib.bean.MessageTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.bean.MessageTag.class,"org.apache.struts.taglib.bean.MessageTag key"); __jsp_taghandler_42.setParent(__jsp_taghandler_5); __jsp_taghandler_42.setKey("activos.umanejo"); __jsp_tag_starteval=__jsp_taghandler_42.doStartTag(); if (OracleJspRuntime.checkStartTagEval(__jsp_tag_starteval)) { do { } while (__jsp_taghandler_42.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); } if (__jsp_taghandler_42.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_42); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[46]); /*@lineinfo:translated-code*//*@lineinfo:133^21*/ { org.apache.struts.taglib.html.TextTag __jsp_taghandler_43=(org.apache.struts.taglib.html.TextTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.TextTag.class,"org.apache.struts.taglib.html.TextTag maxlength name property size"); __jsp_taghandler_43.setParent(__jsp_taghandler_5); __jsp_taghandler_43.setMaxlength("20"); __jsp_taghandler_43.setName("ActivosForm"); __jsp_taghandler_43.setProperty("act_umanejo"); __jsp_taghandler_43.setSize("20"); __jsp_tag_starteval=__jsp_taghandler_43.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_43,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_43.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_43.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_43); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[47]); /*@lineinfo:translated-code*//*@lineinfo:140^21*/ { org.apache.struts.taglib.bean.MessageTag __jsp_taghandler_44=(org.apache.struts.taglib.bean.MessageTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.bean.MessageTag.class,"org.apache.struts.taglib.bean.MessageTag key"); __jsp_taghandler_44.setParent(__jsp_taghandler_5); __jsp_taghandler_44.setKey("activos.descripcion"); __jsp_tag_starteval=__jsp_taghandler_44.doStartTag(); if (OracleJspRuntime.checkStartTagEval(__jsp_tag_starteval)) { do { } while (__jsp_taghandler_44.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); } if (__jsp_taghandler_44.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_44); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[48]); /*@lineinfo:translated-code*//*@lineinfo:143^21*/ { org.apache.struts.taglib.html.TextTag __jsp_taghandler_45=(org.apache.struts.taglib.html.TextTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.TextTag.class,"org.apache.struts.taglib.html.TextTag maxlength name property readonly size"); __jsp_taghandler_45.setParent(__jsp_taghandler_5); __jsp_taghandler_45.setMaxlength("120"); __jsp_taghandler_45.setName("ActivosForm"); __jsp_taghandler_45.setProperty("act_descripcion"); __jsp_taghandler_45.setReadonly(true); __jsp_taghandler_45.setSize("60"); __jsp_tag_starteval=__jsp_taghandler_45.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_45,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_45.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_45.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_45); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[49]); /*@lineinfo:translated-code*//*@lineinfo:148^21*/ { org.apache.struts.taglib.bean.MessageTag __jsp_taghandler_46=(org.apache.struts.taglib.bean.MessageTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.bean.MessageTag.class,"org.apache.struts.taglib.bean.MessageTag key"); __jsp_taghandler_46.setParent(__jsp_taghandler_5); __jsp_taghandler_46.setKey("activos.desadicional"); __jsp_tag_starteval=__jsp_taghandler_46.doStartTag(); if (OracleJspRuntime.checkStartTagEval(__jsp_tag_starteval)) { do { } while (__jsp_taghandler_46.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); } if (__jsp_taghandler_46.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_46); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[50]); /*@lineinfo:translated-code*//*@lineinfo:151^21*/ { org.apache.struts.taglib.html.TextTag __jsp_taghandler_47=(org.apache.struts.taglib.html.TextTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.TextTag.class,"org.apache.struts.taglib.html.TextTag maxlength name property readonly size"); __jsp_taghandler_47.setParent(__jsp_taghandler_5); __jsp_taghandler_47.setMaxlength("240"); __jsp_taghandler_47.setName("ActivosForm"); __jsp_taghandler_47.setProperty("act_desadicional"); __jsp_taghandler_47.setReadonly(true); __jsp_taghandler_47.setSize("60"); __jsp_tag_starteval=__jsp_taghandler_47.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_47,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_47.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_47.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_47); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[51]); /*@lineinfo:translated-code*//*@lineinfo:158^21*/ { org.apache.struts.taglib.bean.MessageTag __jsp_taghandler_48=(org.apache.struts.taglib.bean.MessageTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.bean.MessageTag.class,"org.apache.struts.taglib.bean.MessageTag key"); __jsp_taghandler_48.setParent(__jsp_taghandler_5); __jsp_taghandler_48.setKey("activos.proveedor"); __jsp_tag_starteval=__jsp_taghandler_48.doStartTag(); if (OracleJspRuntime.checkStartTagEval(__jsp_tag_starteval)) { do { } while (__jsp_taghandler_48.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); } if (__jsp_taghandler_48.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_48); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[52]); /*@lineinfo:translated-code*//*@lineinfo:161^21*/ { org.apache.struts.taglib.html.TextTag __jsp_taghandler_49=(org.apache.struts.taglib.html.TextTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.TextTag.class,"org.apache.struts.taglib.html.TextTag maxlength name property readonly size"); __jsp_taghandler_49.setParent(__jsp_taghandler_5); __jsp_taghandler_49.setMaxlength("50"); __jsp_taghandler_49.setName("ActivosForm"); __jsp_taghandler_49.setProperty("act_proveedor"); __jsp_taghandler_49.setReadonly(true); __jsp_taghandler_49.setSize("50"); __jsp_tag_starteval=__jsp_taghandler_49.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_49,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_49.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_49.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_49); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[53]); /*@lineinfo:translated-code*//*@lineinfo:164^21*/ { org.apache.struts.taglib.bean.MessageTag __jsp_taghandler_50=(org.apache.struts.taglib.bean.MessageTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.bean.MessageTag.class,"org.apache.struts.taglib.bean.MessageTag key"); __jsp_taghandler_50.setParent(__jsp_taghandler_5); __jsp_taghandler_50.setKey("activos.marca"); __jsp_tag_starteval=__jsp_taghandler_50.doStartTag(); if (OracleJspRuntime.checkStartTagEval(__jsp_tag_starteval)) { do { } while (__jsp_taghandler_50.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); } if (__jsp_taghandler_50.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_50); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[54]); /*@lineinfo:translated-code*//*@lineinfo:167^21*/ { org.apache.struts.taglib.html.TextTag __jsp_taghandler_51=(org.apache.struts.taglib.html.TextTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.TextTag.class,"org.apache.struts.taglib.html.TextTag maxlength name property readonly size"); __jsp_taghandler_51.setParent(__jsp_taghandler_5); __jsp_taghandler_51.setMaxlength("30"); __jsp_taghandler_51.setName("ActivosForm"); __jsp_taghandler_51.setProperty("act_marca"); __jsp_taghandler_51.setReadonly(true); __jsp_taghandler_51.setSize("30"); __jsp_tag_starteval=__jsp_taghandler_51.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_51,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_51.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_51.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_51); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[55]); /*@lineinfo:translated-code*//*@lineinfo:172^21*/ { org.apache.struts.taglib.bean.MessageTag __jsp_taghandler_52=(org.apache.struts.taglib.bean.MessageTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.bean.MessageTag.class,"org.apache.struts.taglib.bean.MessageTag key"); __jsp_taghandler_52.setParent(__jsp_taghandler_5); __jsp_taghandler_52.setKey("activos.modelo"); __jsp_tag_starteval=__jsp_taghandler_52.doStartTag(); if (OracleJspRuntime.checkStartTagEval(__jsp_tag_starteval)) { do { } while (__jsp_taghandler_52.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); } if (__jsp_taghandler_52.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_52); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[56]); /*@lineinfo:translated-code*//*@lineinfo:175^21*/ { org.apache.struts.taglib.html.TextTag __jsp_taghandler_53=(org.apache.struts.taglib.html.TextTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.TextTag.class,"org.apache.struts.taglib.html.TextTag maxlength name property readonly size"); __jsp_taghandler_53.setParent(__jsp_taghandler_5); __jsp_taghandler_53.setMaxlength("30"); __jsp_taghandler_53.setName("ActivosForm"); __jsp_taghandler_53.setProperty("act_modelo"); __jsp_taghandler_53.setReadonly(true); __jsp_taghandler_53.setSize("30"); __jsp_tag_starteval=__jsp_taghandler_53.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_53,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_53.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_53.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_53); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[57]); /*@lineinfo:translated-code*//*@lineinfo:178^21*/ { org.apache.struts.taglib.bean.MessageTag __jsp_taghandler_54=(org.apache.struts.taglib.bean.MessageTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.bean.MessageTag.class,"org.apache.struts.taglib.bean.MessageTag key"); __jsp_taghandler_54.setParent(__jsp_taghandler_5); __jsp_taghandler_54.setKey("activos.serie1"); __jsp_tag_starteval=__jsp_taghandler_54.doStartTag(); if (OracleJspRuntime.checkStartTagEval(__jsp_tag_starteval)) { do { } while (__jsp_taghandler_54.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); } if (__jsp_taghandler_54.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_54); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[58]); /*@lineinfo:translated-code*//*@lineinfo:181^21*/ { org.apache.struts.taglib.html.TextTag __jsp_taghandler_55=(org.apache.struts.taglib.html.TextTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.TextTag.class,"org.apache.struts.taglib.html.TextTag maxlength name property readonly size"); __jsp_taghandler_55.setParent(__jsp_taghandler_5); __jsp_taghandler_55.setMaxlength("30"); __jsp_taghandler_55.setName("ActivosForm"); __jsp_taghandler_55.setProperty("act_serie1"); __jsp_taghandler_55.setReadonly(true); __jsp_taghandler_55.setSize("30"); __jsp_tag_starteval=__jsp_taghandler_55.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_55,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_55.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_55.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_55); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[59]); /*@lineinfo:translated-code*//*@lineinfo:186^21*/ { org.apache.struts.taglib.bean.MessageTag __jsp_taghandler_56=(org.apache.struts.taglib.bean.MessageTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.bean.MessageTag.class,"org.apache.struts.taglib.bean.MessageTag key"); __jsp_taghandler_56.setParent(__jsp_taghandler_5); __jsp_taghandler_56.setKey("activos.serie2"); __jsp_tag_starteval=__jsp_taghandler_56.doStartTag(); if (OracleJspRuntime.checkStartTagEval(__jsp_tag_starteval)) { do { } while (__jsp_taghandler_56.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); } if (__jsp_taghandler_56.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_56); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[60]); /*@lineinfo:translated-code*//*@lineinfo:189^21*/ { org.apache.struts.taglib.html.TextTag __jsp_taghandler_57=(org.apache.struts.taglib.html.TextTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.TextTag.class,"org.apache.struts.taglib.html.TextTag maxlength name property readonly size"); __jsp_taghandler_57.setParent(__jsp_taghandler_5); __jsp_taghandler_57.setMaxlength("30"); __jsp_taghandler_57.setName("ActivosForm"); __jsp_taghandler_57.setProperty("act_serie2"); __jsp_taghandler_57.setReadonly(true); __jsp_taghandler_57.setSize("30"); __jsp_tag_starteval=__jsp_taghandler_57.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_57,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_57.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_57.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_57); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[61]); /*@lineinfo:translated-code*//*@lineinfo:192^21*/ { org.apache.struts.taglib.bean.MessageTag __jsp_taghandler_58=(org.apache.struts.taglib.bean.MessageTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.bean.MessageTag.class,"org.apache.struts.taglib.bean.MessageTag key"); __jsp_taghandler_58.setParent(__jsp_taghandler_5); __jsp_taghandler_58.setKey("activos.docreferencia"); __jsp_tag_starteval=__jsp_taghandler_58.doStartTag(); if (OracleJspRuntime.checkStartTagEval(__jsp_tag_starteval)) { do { } while (__jsp_taghandler_58.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); } if (__jsp_taghandler_58.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_58); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[62]); /*@lineinfo:translated-code*//*@lineinfo:195^21*/ { org.apache.struts.taglib.html.TextTag __jsp_taghandler_59=(org.apache.struts.taglib.html.TextTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.TextTag.class,"org.apache.struts.taglib.html.TextTag maxlength name property readonly size"); __jsp_taghandler_59.setParent(__jsp_taghandler_5); __jsp_taghandler_59.setMaxlength("30"); __jsp_taghandler_59.setName("ActivosForm"); __jsp_taghandler_59.setProperty("act_docreferencia"); __jsp_taghandler_59.setReadonly(true); __jsp_taghandler_59.setSize("30"); __jsp_tag_starteval=__jsp_taghandler_59.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_59,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_59.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_59.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_59); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[63]); /*@lineinfo:translated-code*//*@lineinfo:200^21*/ { org.apache.struts.taglib.bean.MessageTag __jsp_taghandler_60=(org.apache.struts.taglib.bean.MessageTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.bean.MessageTag.class,"org.apache.struts.taglib.bean.MessageTag key"); __jsp_taghandler_60.setParent(__jsp_taghandler_5); __jsp_taghandler_60.setKey("activos.valcobol"); __jsp_tag_starteval=__jsp_taghandler_60.doStartTag(); if (OracleJspRuntime.checkStartTagEval(__jsp_tag_starteval)) { do { } while (__jsp_taghandler_60.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); } if (__jsp_taghandler_60.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_60); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[64]); /*@lineinfo:translated-code*//*@lineinfo:203^21*/ { org.apache.struts.taglib.html.TextTag __jsp_taghandler_61=(org.apache.struts.taglib.html.TextTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.TextTag.class,"org.apache.struts.taglib.html.TextTag maxlength name property readonly size"); __jsp_taghandler_61.setParent(__jsp_taghandler_5); __jsp_taghandler_61.setMaxlength("15"); __jsp_taghandler_61.setName("ActivosForm"); __jsp_taghandler_61.setProperty("act_valcobol"); __jsp_taghandler_61.setReadonly(true); __jsp_taghandler_61.setSize("15"); __jsp_tag_starteval=__jsp_taghandler_61.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_61,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_61.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_61.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_61); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[65]); /*@lineinfo:translated-code*//*@lineinfo:206^21*/ { org.apache.struts.taglib.bean.MessageTag __jsp_taghandler_62=(org.apache.struts.taglib.bean.MessageTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.bean.MessageTag.class,"org.apache.struts.taglib.bean.MessageTag key"); __jsp_taghandler_62.setParent(__jsp_taghandler_5); __jsp_taghandler_62.setKey("activos.ordencompra"); __jsp_tag_starteval=__jsp_taghandler_62.doStartTag(); if (OracleJspRuntime.checkStartTagEval(__jsp_tag_starteval)) { do { } while (__jsp_taghandler_62.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); } if (__jsp_taghandler_62.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_62); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[66]); /*@lineinfo:translated-code*//*@lineinfo:209^21*/ { org.apache.struts.taglib.html.TextTag __jsp_taghandler_63=(org.apache.struts.taglib.html.TextTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.TextTag.class,"org.apache.struts.taglib.html.TextTag maxlength name property readonly size"); __jsp_taghandler_63.setParent(__jsp_taghandler_5); __jsp_taghandler_63.setMaxlength("20"); __jsp_taghandler_63.setName("ActivosForm"); __jsp_taghandler_63.setProperty("act_ordencompra"); __jsp_taghandler_63.setReadonly(true); __jsp_taghandler_63.setSize("20"); __jsp_tag_starteval=__jsp_taghandler_63.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_63,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_63.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_63.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_63); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[67]); /*@lineinfo:translated-code*//*@lineinfo:214^21*/ { org.apache.struts.taglib.bean.MessageTag __jsp_taghandler_64=(org.apache.struts.taglib.bean.MessageTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.bean.MessageTag.class,"org.apache.struts.taglib.bean.MessageTag key"); __jsp_taghandler_64.setParent(__jsp_taghandler_5); __jsp_taghandler_64.setKey("activos.numfactura"); __jsp_tag_starteval=__jsp_taghandler_64.doStartTag(); if (OracleJspRuntime.checkStartTagEval(__jsp_tag_starteval)) { do { } while (__jsp_taghandler_64.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); } if (__jsp_taghandler_64.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_64); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[68]); /*@lineinfo:translated-code*//*@lineinfo:217^21*/ { org.apache.struts.taglib.html.TextTag __jsp_taghandler_65=(org.apache.struts.taglib.html.TextTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.TextTag.class,"org.apache.struts.taglib.html.TextTag maxlength name property readonly size"); __jsp_taghandler_65.setParent(__jsp_taghandler_5); __jsp_taghandler_65.setMaxlength("8"); __jsp_taghandler_65.setName("ActivosForm"); __jsp_taghandler_65.setProperty("act_numfactura"); __jsp_taghandler_65.setReadonly(true); __jsp_taghandler_65.setSize("8"); __jsp_tag_starteval=__jsp_taghandler_65.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_65,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_65.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_65.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_65); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[69]); /*@lineinfo:translated-code*//*@lineinfo:220^21*/ { org.apache.struts.taglib.bean.MessageTag __jsp_taghandler_66=(org.apache.struts.taglib.bean.MessageTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.bean.MessageTag.class,"org.apache.struts.taglib.bean.MessageTag key"); __jsp_taghandler_66.setParent(__jsp_taghandler_5); __jsp_taghandler_66.setKey("activos.numcomprobante"); __jsp_tag_starteval=__jsp_taghandler_66.doStartTag(); if (OracleJspRuntime.checkStartTagEval(__jsp_tag_starteval)) { do { } while (__jsp_taghandler_66.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); } if (__jsp_taghandler_66.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_66); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[70]); /*@lineinfo:translated-code*//*@lineinfo:223^21*/ { org.apache.struts.taglib.html.TextTag __jsp_taghandler_67=(org.apache.struts.taglib.html.TextTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.TextTag.class,"org.apache.struts.taglib.html.TextTag maxlength name property readonly size"); __jsp_taghandler_67.setParent(__jsp_taghandler_5); __jsp_taghandler_67.setMaxlength("20"); __jsp_taghandler_67.setName("ActivosForm"); __jsp_taghandler_67.setProperty("act_numcomprobante"); __jsp_taghandler_67.setReadonly(true); __jsp_taghandler_67.setSize("20"); __jsp_tag_starteval=__jsp_taghandler_67.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_67,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_67.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_67.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_67); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[71]); /*@lineinfo:translated-code*//*@lineinfo:228^21*/ { org.apache.struts.taglib.bean.MessageTag __jsp_taghandler_68=(org.apache.struts.taglib.bean.MessageTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.bean.MessageTag.class,"org.apache.struts.taglib.bean.MessageTag key"); __jsp_taghandler_68.setParent(__jsp_taghandler_5); __jsp_taghandler_68.setKey("activos.codanterior"); __jsp_tag_starteval=__jsp_taghandler_68.doStartTag(); if (OracleJspRuntime.checkStartTagEval(__jsp_tag_starteval)) { do { } while (__jsp_taghandler_68.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); } if (__jsp_taghandler_68.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_68); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[72]); /*@lineinfo:translated-code*//*@lineinfo:231^21*/ { org.apache.struts.taglib.html.TextTag __jsp_taghandler_69=(org.apache.struts.taglib.html.TextTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.TextTag.class,"org.apache.struts.taglib.html.TextTag maxlength name property readonly size"); __jsp_taghandler_69.setParent(__jsp_taghandler_5); __jsp_taghandler_69.setMaxlength("20"); __jsp_taghandler_69.setName("ActivosForm"); __jsp_taghandler_69.setProperty("act_codanterior"); __jsp_taghandler_69.setReadonly(true); __jsp_taghandler_69.setSize("20"); __jsp_tag_starteval=__jsp_taghandler_69.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_69,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_69.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_69.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_69); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[73]); /*@lineinfo:translated-code*//*@lineinfo:234^21*/ { org.apache.struts.taglib.bean.MessageTag __jsp_taghandler_70=(org.apache.struts.taglib.bean.MessageTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.bean.MessageTag.class,"org.apache.struts.taglib.bean.MessageTag key"); __jsp_taghandler_70.setParent(__jsp_taghandler_5); __jsp_taghandler_70.setKey("activos.fecha"); __jsp_tag_starteval=__jsp_taghandler_70.doStartTag(); if (OracleJspRuntime.checkStartTagEval(__jsp_tag_starteval)) { do { } while (__jsp_taghandler_70.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); } if (__jsp_taghandler_70.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_70); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[74]); /*@lineinfo:translated-code*//*@lineinfo:237^21*/ { org.apache.struts.taglib.html.TextTag __jsp_taghandler_71=(org.apache.struts.taglib.html.TextTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.TextTag.class,"org.apache.struts.taglib.html.TextTag maxlength name property readonly size"); __jsp_taghandler_71.setParent(__jsp_taghandler_5); __jsp_taghandler_71.setMaxlength("10"); __jsp_taghandler_71.setName("ActivosForm"); __jsp_taghandler_71.setProperty("rev_fecha"); __jsp_taghandler_71.setReadonly(true); __jsp_taghandler_71.setSize("10"); __jsp_tag_starteval=__jsp_taghandler_71.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_71,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_71.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_71.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_71); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[75]); /*@lineinfo:translated-code*//*@lineinfo:242^21*/ { org.apache.struts.taglib.bean.MessageTag __jsp_taghandler_72=(org.apache.struts.taglib.bean.MessageTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.bean.MessageTag.class,"org.apache.struts.taglib.bean.MessageTag key"); __jsp_taghandler_72.setParent(__jsp_taghandler_5); __jsp_taghandler_72.setKey("activos.vidaut"); __jsp_tag_starteval=__jsp_taghandler_72.doStartTag(); if (OracleJspRuntime.checkStartTagEval(__jsp_tag_starteval)) { do { } while (__jsp_taghandler_72.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); } if (__jsp_taghandler_72.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_72); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[76]); /*@lineinfo:translated-code*//*@lineinfo:245^21*/ { org.apache.struts.taglib.html.TextTag __jsp_taghandler_73=(org.apache.struts.taglib.html.TextTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.TextTag.class,"org.apache.struts.taglib.html.TextTag maxlength name property readonly size"); __jsp_taghandler_73.setParent(__jsp_taghandler_5); __jsp_taghandler_73.setMaxlength("4"); __jsp_taghandler_73.setName("ActivosForm"); __jsp_taghandler_73.setProperty("rev_vidaut"); __jsp_taghandler_73.setReadonly(true); __jsp_taghandler_73.setSize("4"); __jsp_tag_starteval=__jsp_taghandler_73.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_73,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_73.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_73.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_73); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[77]); /*@lineinfo:translated-code*//*@lineinfo:248^21*/ { org.apache.struts.taglib.bean.MessageTag __jsp_taghandler_74=(org.apache.struts.taglib.bean.MessageTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.bean.MessageTag.class,"org.apache.struts.taglib.bean.MessageTag key"); __jsp_taghandler_74.setParent(__jsp_taghandler_5); __jsp_taghandler_74.setKey("activos.estadoactivo"); __jsp_tag_starteval=__jsp_taghandler_74.doStartTag(); if (OracleJspRuntime.checkStartTagEval(__jsp_tag_starteval)) { do { } while (__jsp_taghandler_74.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); } if (__jsp_taghandler_74.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_74); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[78]); /*@lineinfo:translated-code*//*@lineinfo:251^21*/ { org.apache.struts.taglib.html.TextTag __jsp_taghandler_75=(org.apache.struts.taglib.html.TextTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.TextTag.class,"org.apache.struts.taglib.html.TextTag name property readonly size"); __jsp_taghandler_75.setParent(__jsp_taghandler_5); __jsp_taghandler_75.setName("ActivosForm"); __jsp_taghandler_75.setProperty("rev_estadoactivo"); __jsp_taghandler_75.setReadonly(true); __jsp_taghandler_75.setSize("10"); __jsp_tag_starteval=__jsp_taghandler_75.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_75,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_75.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_75.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_75); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[79]); /*@lineinfo:translated-code*//*@lineinfo:256^21*/ { org.apache.struts.taglib.bean.MessageTag __jsp_taghandler_76=(org.apache.struts.taglib.bean.MessageTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.bean.MessageTag.class,"org.apache.struts.taglib.bean.MessageTag key"); __jsp_taghandler_76.setParent(__jsp_taghandler_5); __jsp_taghandler_76.setKey("activos.desestado"); __jsp_tag_starteval=__jsp_taghandler_76.doStartTag(); if (OracleJspRuntime.checkStartTagEval(__jsp_tag_starteval)) { do { } while (__jsp_taghandler_76.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); } if (__jsp_taghandler_76.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_76); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[80]); /*@lineinfo:translated-code*//*@lineinfo:259^21*/ { org.apache.struts.taglib.html.TextTag __jsp_taghandler_77=(org.apache.struts.taglib.html.TextTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.TextTag.class,"org.apache.struts.taglib.html.TextTag maxlength name property readonly size"); __jsp_taghandler_77.setParent(__jsp_taghandler_5); __jsp_taghandler_77.setMaxlength("60"); __jsp_taghandler_77.setName("ActivosForm"); __jsp_taghandler_77.setProperty("rev_desestado"); __jsp_taghandler_77.setReadonly(true); __jsp_taghandler_77.setSize("60"); __jsp_tag_starteval=__jsp_taghandler_77.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_77,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_77.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_77.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_77); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[81]); /*@lineinfo:translated-code*//*@lineinfo:264^21*/ { org.apache.struts.taglib.html.SubmitTag __jsp_taghandler_78=(org.apache.struts.taglib.html.SubmitTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.SubmitTag.class,"org.apache.struts.taglib.html.SubmitTag onclick property styleClass value"); __jsp_taghandler_78.setParent(__jsp_taghandler_5); __jsp_taghandler_78.setOnclick("operacion.value=2;opcion.value=4"); __jsp_taghandler_78.setProperty("boton"); __jsp_taghandler_78.setStyleClass("boton1"); __jsp_taghandler_78.setValue("Consultar"); __jsp_tag_starteval=__jsp_taghandler_78.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_78,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_78.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_78.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_78); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[82]); /*@lineinfo:translated-code*//*@lineinfo:264^134*/ } while (__jsp_taghandler_5.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); } if (__jsp_taghandler_5.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_5); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[83]); /*@lineinfo:translated-code*//*@lineinfo:270^13*/ { org.apache.struts.taglib.logic.EqualTag __jsp_taghandler_79=(org.apache.struts.taglib.logic.EqualTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.logic.EqualTag.class,"org.apache.struts.taglib.logic.EqualTag name property value"); __jsp_taghandler_79.setParent(__jsp_taghandler_4); __jsp_taghandler_79.setName("ActivosForm"); __jsp_taghandler_79.setProperty("opcion"); __jsp_taghandler_79.setValue("5"); __jsp_tag_starteval=__jsp_taghandler_79.doStartTag(); if (OracleJspRuntime.checkStartTagEval(__jsp_tag_starteval)) { do { /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[84]); /*@lineinfo:translated-code*//*@lineinfo:274^21*/ { org.apache.struts.taglib.bean.MessageTag __jsp_taghandler_80=(org.apache.struts.taglib.bean.MessageTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.bean.MessageTag.class,"org.apache.struts.taglib.bean.MessageTag key"); __jsp_taghandler_80.setParent(__jsp_taghandler_79); __jsp_taghandler_80.setKey("activos.codrub"); __jsp_tag_starteval=__jsp_taghandler_80.doStartTag(); if (OracleJspRuntime.checkStartTagEval(__jsp_tag_starteval)) { do { } while (__jsp_taghandler_80.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); } if (__jsp_taghandler_80.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_80); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[85]); /*@lineinfo:translated-code*//*@lineinfo:277^21*/ { org.apache.struts.taglib.html.TextTag __jsp_taghandler_81=(org.apache.struts.taglib.html.TextTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.TextTag.class,"org.apache.struts.taglib.html.TextTag maxlength name property readonly size"); __jsp_taghandler_81.setParent(__jsp_taghandler_79); __jsp_taghandler_81.setMaxlength("10"); __jsp_taghandler_81.setName("ActivosForm"); __jsp_taghandler_81.setProperty("act_codrub"); __jsp_taghandler_81.setReadonly(true); __jsp_taghandler_81.setSize("10"); __jsp_tag_starteval=__jsp_taghandler_81.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_81,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_81.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_81.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_81); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[86]); /*@lineinfo:translated-code*//*@lineinfo:278^25*/ { org.apache.struts.taglib.html.TextTag __jsp_taghandler_82=(org.apache.struts.taglib.html.TextTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.TextTag.class,"org.apache.struts.taglib.html.TextTag maxlength name property readonly size"); __jsp_taghandler_82.setParent(__jsp_taghandler_79); __jsp_taghandler_82.setMaxlength("60"); __jsp_taghandler_82.setName("ActivosForm"); __jsp_taghandler_82.setProperty("act_rubdescripcion"); __jsp_taghandler_82.setReadonly(true); __jsp_taghandler_82.setSize("60"); __jsp_tag_starteval=__jsp_taghandler_82.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_82,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_82.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_82.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_82); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[87]); /*@lineinfo:translated-code*//*@lineinfo:283^21*/ { org.apache.struts.taglib.bean.MessageTag __jsp_taghandler_83=(org.apache.struts.taglib.bean.MessageTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.bean.MessageTag.class,"org.apache.struts.taglib.bean.MessageTag key"); __jsp_taghandler_83.setParent(__jsp_taghandler_79); __jsp_taghandler_83.setKey("activos.codreg"); __jsp_tag_starteval=__jsp_taghandler_83.doStartTag(); if (OracleJspRuntime.checkStartTagEval(__jsp_tag_starteval)) { do { } while (__jsp_taghandler_83.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); } if (__jsp_taghandler_83.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_83); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[88]); /*@lineinfo:translated-code*//*@lineinfo:286^21*/ { org.apache.struts.taglib.html.TextTag __jsp_taghandler_84=(org.apache.struts.taglib.html.TextTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.TextTag.class,"org.apache.struts.taglib.html.TextTag maxlength name property readonly size"); __jsp_taghandler_84.setParent(__jsp_taghandler_79); __jsp_taghandler_84.setMaxlength("10"); __jsp_taghandler_84.setName("ActivosForm"); __jsp_taghandler_84.setProperty("act_codreg"); __jsp_taghandler_84.setReadonly(true); __jsp_taghandler_84.setSize("10"); __jsp_tag_starteval=__jsp_taghandler_84.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_84,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_84.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_84.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_84); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[89]); /*@lineinfo:translated-code*//*@lineinfo:287^25*/ { org.apache.struts.taglib.html.TextTag __jsp_taghandler_85=(org.apache.struts.taglib.html.TextTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.TextTag.class,"org.apache.struts.taglib.html.TextTag maxlength name property readonly size"); __jsp_taghandler_85.setParent(__jsp_taghandler_79); __jsp_taghandler_85.setMaxlength("60"); __jsp_taghandler_85.setName("ActivosForm"); __jsp_taghandler_85.setProperty("act_regdescripcion"); __jsp_taghandler_85.setReadonly(true); __jsp_taghandler_85.setSize("60"); __jsp_tag_starteval=__jsp_taghandler_85.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_85,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_85.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_85.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_85); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[90]); /*@lineinfo:translated-code*//*@lineinfo:292^21*/ { org.apache.struts.taglib.bean.MessageTag __jsp_taghandler_86=(org.apache.struts.taglib.bean.MessageTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.bean.MessageTag.class,"org.apache.struts.taglib.bean.MessageTag key"); __jsp_taghandler_86.setParent(__jsp_taghandler_79); __jsp_taghandler_86.setKey("activos.codigo"); __jsp_tag_starteval=__jsp_taghandler_86.doStartTag(); if (OracleJspRuntime.checkStartTagEval(__jsp_tag_starteval)) { do { } while (__jsp_taghandler_86.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); } if (__jsp_taghandler_86.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_86); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[91]); /*@lineinfo:translated-code*//*@lineinfo:295^21*/ { org.apache.struts.taglib.html.TextTag __jsp_taghandler_87=(org.apache.struts.taglib.html.TextTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.TextTag.class,"org.apache.struts.taglib.html.TextTag maxlength name property readonly size"); __jsp_taghandler_87.setParent(__jsp_taghandler_79); __jsp_taghandler_87.setMaxlength("5"); __jsp_taghandler_87.setName("ActivosForm"); __jsp_taghandler_87.setProperty("act_codigo"); __jsp_taghandler_87.setReadonly(true); __jsp_taghandler_87.setSize("5"); __jsp_tag_starteval=__jsp_taghandler_87.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_87,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_87.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_87.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_87); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[92]); /*@lineinfo:translated-code*//*@lineinfo:296^25*/ { org.apache.struts.taglib.html.TextTag __jsp_taghandler_88=(org.apache.struts.taglib.html.TextTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.TextTag.class,"org.apache.struts.taglib.html.TextTag maxlength name property readonly size"); __jsp_taghandler_88.setParent(__jsp_taghandler_79); __jsp_taghandler_88.setMaxlength("10"); __jsp_taghandler_88.setName("ActivosForm"); __jsp_taghandler_88.setProperty("act_codbarra"); __jsp_taghandler_88.setReadonly(true); __jsp_taghandler_88.setSize("10"); __jsp_tag_starteval=__jsp_taghandler_88.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_88,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_88.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_88.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_88); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[93]); /*@lineinfo:translated-code*//*@lineinfo:301^21*/ { org.apache.struts.taglib.bean.MessageTag __jsp_taghandler_89=(org.apache.struts.taglib.bean.MessageTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.bean.MessageTag.class,"org.apache.struts.taglib.bean.MessageTag key"); __jsp_taghandler_89.setParent(__jsp_taghandler_79); __jsp_taghandler_89.setKey("activos.codgrp"); __jsp_tag_starteval=__jsp_taghandler_89.doStartTag(); if (OracleJspRuntime.checkStartTagEval(__jsp_tag_starteval)) { do { } while (__jsp_taghandler_89.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); } if (__jsp_taghandler_89.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_89); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[94]); /*@lineinfo:translated-code*//*@lineinfo:304^25*/ { org.apache.struts.taglib.html.TextTag __jsp_taghandler_90=(org.apache.struts.taglib.html.TextTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.TextTag.class,"org.apache.struts.taglib.html.TextTag maxlength name property readonly size"); __jsp_taghandler_90.setParent(__jsp_taghandler_79); __jsp_taghandler_90.setMaxlength("40"); __jsp_taghandler_90.setName("ActivosForm"); __jsp_taghandler_90.setProperty("act_grpdescripcion"); __jsp_taghandler_90.setReadonly(true); __jsp_taghandler_90.setSize("40"); __jsp_tag_starteval=__jsp_taghandler_90.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_90,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_90.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_90.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_90); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[95]); /*@lineinfo:translated-code*//*@lineinfo:305^25*/ { org.apache.struts.taglib.html.HiddenTag __jsp_taghandler_91=(org.apache.struts.taglib.html.HiddenTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.HiddenTag.class,"org.apache.struts.taglib.html.HiddenTag name property"); __jsp_taghandler_91.setParent(__jsp_taghandler_79); __jsp_taghandler_91.setName("ActivosForm"); __jsp_taghandler_91.setProperty("act_codgrp"); __jsp_tag_starteval=__jsp_taghandler_91.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_91,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_91.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_91.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_91); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[96]); /*@lineinfo:translated-code*//*@lineinfo:308^21*/ { org.apache.struts.taglib.bean.MessageTag __jsp_taghandler_92=(org.apache.struts.taglib.bean.MessageTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.bean.MessageTag.class,"org.apache.struts.taglib.bean.MessageTag key"); __jsp_taghandler_92.setParent(__jsp_taghandler_79); __jsp_taghandler_92.setKey("activos.codpar"); __jsp_tag_starteval=__jsp_taghandler_92.doStartTag(); if (OracleJspRuntime.checkStartTagEval(__jsp_tag_starteval)) { do { } while (__jsp_taghandler_92.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); } if (__jsp_taghandler_92.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_92); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[97]); /*@lineinfo:translated-code*//*@lineinfo:311^25*/ { org.apache.struts.taglib.html.TextTag __jsp_taghandler_93=(org.apache.struts.taglib.html.TextTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.TextTag.class,"org.apache.struts.taglib.html.TextTag maxlength name property readonly size"); __jsp_taghandler_93.setParent(__jsp_taghandler_79); __jsp_taghandler_93.setMaxlength("40"); __jsp_taghandler_93.setName("ActivosForm"); __jsp_taghandler_93.setProperty("act_pardescripcion"); __jsp_taghandler_93.setReadonly(true); __jsp_taghandler_93.setSize("40"); __jsp_tag_starteval=__jsp_taghandler_93.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_93,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_93.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_93.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_93); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[98]); /*@lineinfo:translated-code*//*@lineinfo:312^25*/ { org.apache.struts.taglib.html.HiddenTag __jsp_taghandler_94=(org.apache.struts.taglib.html.HiddenTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.HiddenTag.class,"org.apache.struts.taglib.html.HiddenTag name property"); __jsp_taghandler_94.setParent(__jsp_taghandler_79); __jsp_taghandler_94.setName("ActivosForm"); __jsp_taghandler_94.setProperty("act_codpar"); __jsp_tag_starteval=__jsp_taghandler_94.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_94,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_94.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_94.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_94); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[99]); /*@lineinfo:translated-code*//*@lineinfo:317^21*/ { org.apache.struts.taglib.bean.MessageTag __jsp_taghandler_95=(org.apache.struts.taglib.bean.MessageTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.bean.MessageTag.class,"org.apache.struts.taglib.bean.MessageTag key"); __jsp_taghandler_95.setParent(__jsp_taghandler_79); __jsp_taghandler_95.setKey("activos.codofi"); __jsp_tag_starteval=__jsp_taghandler_95.doStartTag(); if (OracleJspRuntime.checkStartTagEval(__jsp_tag_starteval)) { do { } while (__jsp_taghandler_95.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); } if (__jsp_taghandler_95.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_95); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[100]); /*@lineinfo:translated-code*//*@lineinfo:320^25*/ { org.apache.struts.taglib.html.TextTag __jsp_taghandler_96=(org.apache.struts.taglib.html.TextTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.TextTag.class,"org.apache.struts.taglib.html.TextTag maxlength name property readonly size"); __jsp_taghandler_96.setParent(__jsp_taghandler_79); __jsp_taghandler_96.setMaxlength("40"); __jsp_taghandler_96.setName("ActivosForm"); __jsp_taghandler_96.setProperty("act_ofidescripcion"); __jsp_taghandler_96.setReadonly(true); __jsp_taghandler_96.setSize("40"); __jsp_tag_starteval=__jsp_taghandler_96.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_96,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_96.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_96.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_96); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[101]); /*@lineinfo:translated-code*//*@lineinfo:321^25*/ { org.apache.struts.taglib.html.HiddenTag __jsp_taghandler_97=(org.apache.struts.taglib.html.HiddenTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.HiddenTag.class,"org.apache.struts.taglib.html.HiddenTag name property"); __jsp_taghandler_97.setParent(__jsp_taghandler_79); __jsp_taghandler_97.setName("ActivosForm"); __jsp_taghandler_97.setProperty("act_codofi"); __jsp_tag_starteval=__jsp_taghandler_97.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_97,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_97.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_97.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_97); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[102]); /*@lineinfo:translated-code*//*@lineinfo:324^21*/ { org.apache.struts.taglib.bean.MessageTag __jsp_taghandler_98=(org.apache.struts.taglib.bean.MessageTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.bean.MessageTag.class,"org.apache.struts.taglib.bean.MessageTag key"); __jsp_taghandler_98.setParent(__jsp_taghandler_79); __jsp_taghandler_98.setKey("activos.codfun"); __jsp_tag_starteval=__jsp_taghandler_98.doStartTag(); if (OracleJspRuntime.checkStartTagEval(__jsp_tag_starteval)) { do { } while (__jsp_taghandler_98.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); } if (__jsp_taghandler_98.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_98); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[103]); /*@lineinfo:translated-code*//*@lineinfo:327^25*/ { org.apache.struts.taglib.html.TextTag __jsp_taghandler_99=(org.apache.struts.taglib.html.TextTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.TextTag.class,"org.apache.struts.taglib.html.TextTag maxlength name property readonly size"); __jsp_taghandler_99.setParent(__jsp_taghandler_79); __jsp_taghandler_99.setMaxlength("40"); __jsp_taghandler_99.setName("ActivosForm"); __jsp_taghandler_99.setProperty("act_fundescripcion"); __jsp_taghandler_99.setReadonly(true); __jsp_taghandler_99.setSize("40"); __jsp_tag_starteval=__jsp_taghandler_99.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_99,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_99.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_99.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_99); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[104]); /*@lineinfo:translated-code*//*@lineinfo:328^25*/ { org.apache.struts.taglib.html.HiddenTag __jsp_taghandler_100=(org.apache.struts.taglib.html.HiddenTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.HiddenTag.class,"org.apache.struts.taglib.html.HiddenTag name property"); __jsp_taghandler_100.setParent(__jsp_taghandler_79); __jsp_taghandler_100.setName("ActivosForm"); __jsp_taghandler_100.setProperty("act_codfun"); __jsp_tag_starteval=__jsp_taghandler_100.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_100,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_100.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_100.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_100); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[105]); /*@lineinfo:translated-code*//*@lineinfo:333^21*/ { org.apache.struts.taglib.bean.MessageTag __jsp_taghandler_101=(org.apache.struts.taglib.bean.MessageTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.bean.MessageTag.class,"org.apache.struts.taglib.bean.MessageTag key"); __jsp_taghandler_101.setParent(__jsp_taghandler_79); __jsp_taghandler_101.setKey("activos.codubi"); __jsp_tag_starteval=__jsp_taghandler_101.doStartTag(); if (OracleJspRuntime.checkStartTagEval(__jsp_tag_starteval)) { do { } while (__jsp_taghandler_101.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); } if (__jsp_taghandler_101.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_101); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[106]); /*@lineinfo:translated-code*//*@lineinfo:336^25*/ { org.apache.struts.taglib.html.TextTag __jsp_taghandler_102=(org.apache.struts.taglib.html.TextTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.TextTag.class,"org.apache.struts.taglib.html.TextTag maxlength name property readonly size"); __jsp_taghandler_102.setParent(__jsp_taghandler_79); __jsp_taghandler_102.setMaxlength("40"); __jsp_taghandler_102.setName("ActivosForm"); __jsp_taghandler_102.setProperty("act_ubidescripcion"); __jsp_taghandler_102.setReadonly(true); __jsp_taghandler_102.setSize("40"); __jsp_tag_starteval=__jsp_taghandler_102.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_102,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_102.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_102.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_102); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[107]); /*@lineinfo:translated-code*//*@lineinfo:337^25*/ { org.apache.struts.taglib.html.HiddenTag __jsp_taghandler_103=(org.apache.struts.taglib.html.HiddenTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.HiddenTag.class,"org.apache.struts.taglib.html.HiddenTag name property"); __jsp_taghandler_103.setParent(__jsp_taghandler_79); __jsp_taghandler_103.setName("ActivosForm"); __jsp_taghandler_103.setProperty("act_codubi"); __jsp_tag_starteval=__jsp_taghandler_103.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_103,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_103.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_103.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_103); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[108]); /*@lineinfo:translated-code*//*@lineinfo:340^21*/ { org.apache.struts.taglib.bean.MessageTag __jsp_taghandler_104=(org.apache.struts.taglib.bean.MessageTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.bean.MessageTag.class,"org.apache.struts.taglib.bean.MessageTag key"); __jsp_taghandler_104.setParent(__jsp_taghandler_79); __jsp_taghandler_104.setKey("activos.codpry"); __jsp_tag_starteval=__jsp_taghandler_104.doStartTag(); if (OracleJspRuntime.checkStartTagEval(__jsp_tag_starteval)) { do { } while (__jsp_taghandler_104.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); } if (__jsp_taghandler_104.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_104); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[109]); /*@lineinfo:translated-code*//*@lineinfo:343^25*/ { org.apache.struts.taglib.html.TextTag __jsp_taghandler_105=(org.apache.struts.taglib.html.TextTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.TextTag.class,"org.apache.struts.taglib.html.TextTag maxlength name property readonly size"); __jsp_taghandler_105.setParent(__jsp_taghandler_79); __jsp_taghandler_105.setMaxlength("40"); __jsp_taghandler_105.setName("ActivosForm"); __jsp_taghandler_105.setProperty("act_prydescripcion"); __jsp_taghandler_105.setReadonly(true); __jsp_taghandler_105.setSize("40"); __jsp_tag_starteval=__jsp_taghandler_105.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_105,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_105.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_105.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_105); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[110]); /*@lineinfo:translated-code*//*@lineinfo:344^25*/ { org.apache.struts.taglib.html.HiddenTag __jsp_taghandler_106=(org.apache.struts.taglib.html.HiddenTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.HiddenTag.class,"org.apache.struts.taglib.html.HiddenTag name property"); __jsp_taghandler_106.setParent(__jsp_taghandler_79); __jsp_taghandler_106.setName("ActivosForm"); __jsp_taghandler_106.setProperty("act_codpry"); __jsp_tag_starteval=__jsp_taghandler_106.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_106,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_106.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_106.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_106); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[111]); /*@lineinfo:translated-code*//*@lineinfo:349^21*/ { org.apache.struts.taglib.bean.MessageTag __jsp_taghandler_107=(org.apache.struts.taglib.bean.MessageTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.bean.MessageTag.class,"org.apache.struts.taglib.bean.MessageTag key"); __jsp_taghandler_107.setParent(__jsp_taghandler_79); __jsp_taghandler_107.setKey("activos.codfin"); __jsp_tag_starteval=__jsp_taghandler_107.doStartTag(); if (OracleJspRuntime.checkStartTagEval(__jsp_tag_starteval)) { do { } while (__jsp_taghandler_107.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); } if (__jsp_taghandler_107.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_107); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[112]); /*@lineinfo:translated-code*//*@lineinfo:352^25*/ { org.apache.struts.taglib.html.TextTag __jsp_taghandler_108=(org.apache.struts.taglib.html.TextTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.TextTag.class,"org.apache.struts.taglib.html.TextTag maxlength name property readonly size"); __jsp_taghandler_108.setParent(__jsp_taghandler_79); __jsp_taghandler_108.setMaxlength("40"); __jsp_taghandler_108.setName("ActivosForm"); __jsp_taghandler_108.setProperty("act_findescripcion"); __jsp_taghandler_108.setReadonly(true); __jsp_taghandler_108.setSize("40"); __jsp_tag_starteval=__jsp_taghandler_108.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_108,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_108.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_108.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_108); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[113]); /*@lineinfo:translated-code*//*@lineinfo:353^25*/ { org.apache.struts.taglib.html.HiddenTag __jsp_taghandler_109=(org.apache.struts.taglib.html.HiddenTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.HiddenTag.class,"org.apache.struts.taglib.html.HiddenTag name property"); __jsp_taghandler_109.setParent(__jsp_taghandler_79); __jsp_taghandler_109.setName("ActivosForm"); __jsp_taghandler_109.setProperty("act_codfin"); __jsp_tag_starteval=__jsp_taghandler_109.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_109,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_109.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_109.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_109); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[114]); /*@lineinfo:translated-code*//*@lineinfo:358^21*/ { org.apache.struts.taglib.bean.MessageTag __jsp_taghandler_110=(org.apache.struts.taglib.bean.MessageTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.bean.MessageTag.class,"org.apache.struts.taglib.bean.MessageTag key"); __jsp_taghandler_110.setParent(__jsp_taghandler_79); __jsp_taghandler_110.setKey("activos.feccompra"); __jsp_tag_starteval=__jsp_taghandler_110.doStartTag(); if (OracleJspRuntime.checkStartTagEval(__jsp_tag_starteval)) { do { } while (__jsp_taghandler_110.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); } if (__jsp_taghandler_110.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_110); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[115]); /*@lineinfo:translated-code*//*@lineinfo:361^21*/ { org.apache.struts.taglib.html.TextTag __jsp_taghandler_111=(org.apache.struts.taglib.html.TextTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.TextTag.class,"org.apache.struts.taglib.html.TextTag maxlength name property size"); __jsp_taghandler_111.setParent(__jsp_taghandler_79); __jsp_taghandler_111.setMaxlength("10"); __jsp_taghandler_111.setName("ActivosForm"); __jsp_taghandler_111.setProperty("act_feccompra"); __jsp_taghandler_111.setSize("10"); __jsp_tag_starteval=__jsp_taghandler_111.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_111,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_111.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_111.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_111); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[116]); /*@lineinfo:translated-code*//*@lineinfo:364^21*/ { org.apache.struts.taglib.bean.MessageTag __jsp_taghandler_112=(org.apache.struts.taglib.bean.MessageTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.bean.MessageTag.class,"org.apache.struts.taglib.bean.MessageTag key"); __jsp_taghandler_112.setParent(__jsp_taghandler_79); __jsp_taghandler_112.setKey("activos.tipcam"); __jsp_tag_starteval=__jsp_taghandler_112.doStartTag(); if (OracleJspRuntime.checkStartTagEval(__jsp_tag_starteval)) { do { } while (__jsp_taghandler_112.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); } if (__jsp_taghandler_112.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_112); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[117]); /*@lineinfo:translated-code*//*@lineinfo:367^21*/ { org.apache.struts.taglib.html.TextTag __jsp_taghandler_113=(org.apache.struts.taglib.html.TextTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.TextTag.class,"org.apache.struts.taglib.html.TextTag maxlength name property size"); __jsp_taghandler_113.setParent(__jsp_taghandler_79); __jsp_taghandler_113.setMaxlength("11"); __jsp_taghandler_113.setName("ActivosForm"); __jsp_taghandler_113.setProperty("act_tipcam"); __jsp_taghandler_113.setSize("11"); __jsp_tag_starteval=__jsp_taghandler_113.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_113,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_113.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_113.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_113); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[118]); /*@lineinfo:translated-code*//*@lineinfo:372^21*/ { org.apache.struts.taglib.bean.MessageTag __jsp_taghandler_114=(org.apache.struts.taglib.bean.MessageTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.bean.MessageTag.class,"org.apache.struts.taglib.bean.MessageTag key"); __jsp_taghandler_114.setParent(__jsp_taghandler_79); __jsp_taghandler_114.setKey("activos.tipufv"); __jsp_tag_starteval=__jsp_taghandler_114.doStartTag(); if (OracleJspRuntime.checkStartTagEval(__jsp_tag_starteval)) { do { } while (__jsp_taghandler_114.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); } if (__jsp_taghandler_114.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_114); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[119]); /*@lineinfo:translated-code*//*@lineinfo:375^21*/ { org.apache.struts.taglib.html.TextTag __jsp_taghandler_115=(org.apache.struts.taglib.html.TextTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.TextTag.class,"org.apache.struts.taglib.html.TextTag maxlength name property size"); __jsp_taghandler_115.setParent(__jsp_taghandler_79); __jsp_taghandler_115.setMaxlength("11"); __jsp_taghandler_115.setName("ActivosForm"); __jsp_taghandler_115.setProperty("act_tipufv"); __jsp_taghandler_115.setSize("11"); __jsp_tag_starteval=__jsp_taghandler_115.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_115,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_115.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_115.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_115); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[120]); /*@lineinfo:translated-code*//*@lineinfo:378^21*/ { org.apache.struts.taglib.bean.MessageTag __jsp_taghandler_116=(org.apache.struts.taglib.bean.MessageTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.bean.MessageTag.class,"org.apache.struts.taglib.bean.MessageTag key"); __jsp_taghandler_116.setParent(__jsp_taghandler_79); __jsp_taghandler_116.setKey("activos.umanejo"); __jsp_tag_starteval=__jsp_taghandler_116.doStartTag(); if (OracleJspRuntime.checkStartTagEval(__jsp_tag_starteval)) { do { } while (__jsp_taghandler_116.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); } if (__jsp_taghandler_116.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_116); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[121]); /*@lineinfo:translated-code*//*@lineinfo:381^21*/ { org.apache.struts.taglib.html.TextTag __jsp_taghandler_117=(org.apache.struts.taglib.html.TextTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.TextTag.class,"org.apache.struts.taglib.html.TextTag maxlength name property size"); __jsp_taghandler_117.setParent(__jsp_taghandler_79); __jsp_taghandler_117.setMaxlength("20"); __jsp_taghandler_117.setName("ActivosForm"); __jsp_taghandler_117.setProperty("act_umanejo"); __jsp_taghandler_117.setSize("20"); __jsp_tag_starteval=__jsp_taghandler_117.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_117,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_117.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_117.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_117); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[122]); /*@lineinfo:translated-code*//*@lineinfo:388^21*/ { org.apache.struts.taglib.bean.MessageTag __jsp_taghandler_118=(org.apache.struts.taglib.bean.MessageTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.bean.MessageTag.class,"org.apache.struts.taglib.bean.MessageTag key"); __jsp_taghandler_118.setParent(__jsp_taghandler_79); __jsp_taghandler_118.setKey("activos.descripcion"); __jsp_tag_starteval=__jsp_taghandler_118.doStartTag(); if (OracleJspRuntime.checkStartTagEval(__jsp_tag_starteval)) { do { } while (__jsp_taghandler_118.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); } if (__jsp_taghandler_118.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_118); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[123]); /*@lineinfo:translated-code*//*@lineinfo:391^21*/ { org.apache.struts.taglib.html.TextTag __jsp_taghandler_119=(org.apache.struts.taglib.html.TextTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.TextTag.class,"org.apache.struts.taglib.html.TextTag maxlength name property readonly size"); __jsp_taghandler_119.setParent(__jsp_taghandler_79); __jsp_taghandler_119.setMaxlength("120"); __jsp_taghandler_119.setName("ActivosForm"); __jsp_taghandler_119.setProperty("act_descripcion"); __jsp_taghandler_119.setReadonly(true); __jsp_taghandler_119.setSize("60"); __jsp_tag_starteval=__jsp_taghandler_119.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_119,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_119.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_119.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_119); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[124]); /*@lineinfo:translated-code*//*@lineinfo:396^21*/ { org.apache.struts.taglib.bean.MessageTag __jsp_taghandler_120=(org.apache.struts.taglib.bean.MessageTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.bean.MessageTag.class,"org.apache.struts.taglib.bean.MessageTag key"); __jsp_taghandler_120.setParent(__jsp_taghandler_79); __jsp_taghandler_120.setKey("activos.desadicional"); __jsp_tag_starteval=__jsp_taghandler_120.doStartTag(); if (OracleJspRuntime.checkStartTagEval(__jsp_tag_starteval)) { do { } while (__jsp_taghandler_120.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); } if (__jsp_taghandler_120.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_120); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[125]); /*@lineinfo:translated-code*//*@lineinfo:399^21*/ { org.apache.struts.taglib.html.TextTag __jsp_taghandler_121=(org.apache.struts.taglib.html.TextTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.TextTag.class,"org.apache.struts.taglib.html.TextTag maxlength name property readonly size"); __jsp_taghandler_121.setParent(__jsp_taghandler_79); __jsp_taghandler_121.setMaxlength("240"); __jsp_taghandler_121.setName("ActivosForm"); __jsp_taghandler_121.setProperty("act_desadicional"); __jsp_taghandler_121.setReadonly(true); __jsp_taghandler_121.setSize("60"); __jsp_tag_starteval=__jsp_taghandler_121.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_121,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_121.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_121.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_121); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[126]); /*@lineinfo:translated-code*//*@lineinfo:406^21*/ { org.apache.struts.taglib.bean.MessageTag __jsp_taghandler_122=(org.apache.struts.taglib.bean.MessageTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.bean.MessageTag.class,"org.apache.struts.taglib.bean.MessageTag key"); __jsp_taghandler_122.setParent(__jsp_taghandler_79); __jsp_taghandler_122.setKey("activos.proveedor"); __jsp_tag_starteval=__jsp_taghandler_122.doStartTag(); if (OracleJspRuntime.checkStartTagEval(__jsp_tag_starteval)) { do { } while (__jsp_taghandler_122.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); } if (__jsp_taghandler_122.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_122); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[127]); /*@lineinfo:translated-code*//*@lineinfo:409^21*/ { org.apache.struts.taglib.html.TextTag __jsp_taghandler_123=(org.apache.struts.taglib.html.TextTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.TextTag.class,"org.apache.struts.taglib.html.TextTag maxlength name property readonly size"); __jsp_taghandler_123.setParent(__jsp_taghandler_79); __jsp_taghandler_123.setMaxlength("50"); __jsp_taghandler_123.setName("ActivosForm"); __jsp_taghandler_123.setProperty("act_proveedor"); __jsp_taghandler_123.setReadonly(true); __jsp_taghandler_123.setSize("50"); __jsp_tag_starteval=__jsp_taghandler_123.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_123,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_123.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_123.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_123); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[128]); /*@lineinfo:translated-code*//*@lineinfo:412^21*/ { org.apache.struts.taglib.bean.MessageTag __jsp_taghandler_124=(org.apache.struts.taglib.bean.MessageTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.bean.MessageTag.class,"org.apache.struts.taglib.bean.MessageTag key"); __jsp_taghandler_124.setParent(__jsp_taghandler_79); __jsp_taghandler_124.setKey("activos.marca"); __jsp_tag_starteval=__jsp_taghandler_124.doStartTag(); if (OracleJspRuntime.checkStartTagEval(__jsp_tag_starteval)) { do { } while (__jsp_taghandler_124.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); } if (__jsp_taghandler_124.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_124); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[129]); /*@lineinfo:translated-code*//*@lineinfo:415^21*/ { org.apache.struts.taglib.html.TextTag __jsp_taghandler_125=(org.apache.struts.taglib.html.TextTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.TextTag.class,"org.apache.struts.taglib.html.TextTag maxlength name property readonly size"); __jsp_taghandler_125.setParent(__jsp_taghandler_79); __jsp_taghandler_125.setMaxlength("30"); __jsp_taghandler_125.setName("ActivosForm"); __jsp_taghandler_125.setProperty("act_marca"); __jsp_taghandler_125.setReadonly(true); __jsp_taghandler_125.setSize("30"); __jsp_tag_starteval=__jsp_taghandler_125.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_125,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_125.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_125.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_125); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[130]); /*@lineinfo:translated-code*//*@lineinfo:420^21*/ { org.apache.struts.taglib.bean.MessageTag __jsp_taghandler_126=(org.apache.struts.taglib.bean.MessageTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.bean.MessageTag.class,"org.apache.struts.taglib.bean.MessageTag key"); __jsp_taghandler_126.setParent(__jsp_taghandler_79); __jsp_taghandler_126.setKey("activos.modelo"); __jsp_tag_starteval=__jsp_taghandler_126.doStartTag(); if (OracleJspRuntime.checkStartTagEval(__jsp_tag_starteval)) { do { } while (__jsp_taghandler_126.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); } if (__jsp_taghandler_126.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_126); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[131]); /*@lineinfo:translated-code*//*@lineinfo:423^21*/ { org.apache.struts.taglib.html.TextTag __jsp_taghandler_127=(org.apache.struts.taglib.html.TextTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.TextTag.class,"org.apache.struts.taglib.html.TextTag maxlength name property readonly size"); __jsp_taghandler_127.setParent(__jsp_taghandler_79); __jsp_taghandler_127.setMaxlength("30"); __jsp_taghandler_127.setName("ActivosForm"); __jsp_taghandler_127.setProperty("act_modelo"); __jsp_taghandler_127.setReadonly(true); __jsp_taghandler_127.setSize("30"); __jsp_tag_starteval=__jsp_taghandler_127.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_127,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_127.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_127.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_127); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[132]); /*@lineinfo:translated-code*//*@lineinfo:426^21*/ { org.apache.struts.taglib.bean.MessageTag __jsp_taghandler_128=(org.apache.struts.taglib.bean.MessageTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.bean.MessageTag.class,"org.apache.struts.taglib.bean.MessageTag key"); __jsp_taghandler_128.setParent(__jsp_taghandler_79); __jsp_taghandler_128.setKey("activos.serie1"); __jsp_tag_starteval=__jsp_taghandler_128.doStartTag(); if (OracleJspRuntime.checkStartTagEval(__jsp_tag_starteval)) { do { } while (__jsp_taghandler_128.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); } if (__jsp_taghandler_128.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_128); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[133]); /*@lineinfo:translated-code*//*@lineinfo:429^21*/ { org.apache.struts.taglib.html.TextTag __jsp_taghandler_129=(org.apache.struts.taglib.html.TextTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.TextTag.class,"org.apache.struts.taglib.html.TextTag maxlength name property readonly size"); __jsp_taghandler_129.setParent(__jsp_taghandler_79); __jsp_taghandler_129.setMaxlength("30"); __jsp_taghandler_129.setName("ActivosForm"); __jsp_taghandler_129.setProperty("act_serie1"); __jsp_taghandler_129.setReadonly(true); __jsp_taghandler_129.setSize("30"); __jsp_tag_starteval=__jsp_taghandler_129.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_129,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_129.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_129.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_129); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[134]); /*@lineinfo:translated-code*//*@lineinfo:434^21*/ { org.apache.struts.taglib.bean.MessageTag __jsp_taghandler_130=(org.apache.struts.taglib.bean.MessageTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.bean.MessageTag.class,"org.apache.struts.taglib.bean.MessageTag key"); __jsp_taghandler_130.setParent(__jsp_taghandler_79); __jsp_taghandler_130.setKey("activos.serie2"); __jsp_tag_starteval=__jsp_taghandler_130.doStartTag(); if (OracleJspRuntime.checkStartTagEval(__jsp_tag_starteval)) { do { } while (__jsp_taghandler_130.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); } if (__jsp_taghandler_130.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_130); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[135]); /*@lineinfo:translated-code*//*@lineinfo:437^21*/ { org.apache.struts.taglib.html.TextTag __jsp_taghandler_131=(org.apache.struts.taglib.html.TextTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.TextTag.class,"org.apache.struts.taglib.html.TextTag maxlength name property readonly size"); __jsp_taghandler_131.setParent(__jsp_taghandler_79); __jsp_taghandler_131.setMaxlength("30"); __jsp_taghandler_131.setName("ActivosForm"); __jsp_taghandler_131.setProperty("act_serie2"); __jsp_taghandler_131.setReadonly(true); __jsp_taghandler_131.setSize("30"); __jsp_tag_starteval=__jsp_taghandler_131.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_131,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_131.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_131.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_131); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[136]); /*@lineinfo:translated-code*//*@lineinfo:440^21*/ { org.apache.struts.taglib.bean.MessageTag __jsp_taghandler_132=(org.apache.struts.taglib.bean.MessageTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.bean.MessageTag.class,"org.apache.struts.taglib.bean.MessageTag key"); __jsp_taghandler_132.setParent(__jsp_taghandler_79); __jsp_taghandler_132.setKey("activos.docreferencia"); __jsp_tag_starteval=__jsp_taghandler_132.doStartTag(); if (OracleJspRuntime.checkStartTagEval(__jsp_tag_starteval)) { do { } while (__jsp_taghandler_132.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); } if (__jsp_taghandler_132.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_132); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[137]); /*@lineinfo:translated-code*//*@lineinfo:443^21*/ { org.apache.struts.taglib.html.TextTag __jsp_taghandler_133=(org.apache.struts.taglib.html.TextTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.TextTag.class,"org.apache.struts.taglib.html.TextTag maxlength name property readonly size"); __jsp_taghandler_133.setParent(__jsp_taghandler_79); __jsp_taghandler_133.setMaxlength("30"); __jsp_taghandler_133.setName("ActivosForm"); __jsp_taghandler_133.setProperty("act_docreferencia"); __jsp_taghandler_133.setReadonly(true); __jsp_taghandler_133.setSize("30"); __jsp_tag_starteval=__jsp_taghandler_133.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_133,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_133.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_133.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_133); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[138]); /*@lineinfo:translated-code*//*@lineinfo:448^21*/ { org.apache.struts.taglib.bean.MessageTag __jsp_taghandler_134=(org.apache.struts.taglib.bean.MessageTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.bean.MessageTag.class,"org.apache.struts.taglib.bean.MessageTag key"); __jsp_taghandler_134.setParent(__jsp_taghandler_79); __jsp_taghandler_134.setKey("activos.valcobol"); __jsp_tag_starteval=__jsp_taghandler_134.doStartTag(); if (OracleJspRuntime.checkStartTagEval(__jsp_tag_starteval)) { do { } while (__jsp_taghandler_134.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); } if (__jsp_taghandler_134.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_134); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[139]); /*@lineinfo:translated-code*//*@lineinfo:451^21*/ { org.apache.struts.taglib.html.TextTag __jsp_taghandler_135=(org.apache.struts.taglib.html.TextTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.TextTag.class,"org.apache.struts.taglib.html.TextTag maxlength name property readonly size"); __jsp_taghandler_135.setParent(__jsp_taghandler_79); __jsp_taghandler_135.setMaxlength("15"); __jsp_taghandler_135.setName("ActivosForm"); __jsp_taghandler_135.setProperty("act_valcobol"); __jsp_taghandler_135.setReadonly(true); __jsp_taghandler_135.setSize("15"); __jsp_tag_starteval=__jsp_taghandler_135.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_135,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_135.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_135.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_135); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[140]); /*@lineinfo:translated-code*//*@lineinfo:454^21*/ { org.apache.struts.taglib.bean.MessageTag __jsp_taghandler_136=(org.apache.struts.taglib.bean.MessageTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.bean.MessageTag.class,"org.apache.struts.taglib.bean.MessageTag key"); __jsp_taghandler_136.setParent(__jsp_taghandler_79); __jsp_taghandler_136.setKey("activos.ordencompra"); __jsp_tag_starteval=__jsp_taghandler_136.doStartTag(); if (OracleJspRuntime.checkStartTagEval(__jsp_tag_starteval)) { do { } while (__jsp_taghandler_136.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); } if (__jsp_taghandler_136.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_136); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[141]); /*@lineinfo:translated-code*//*@lineinfo:457^21*/ { org.apache.struts.taglib.html.TextTag __jsp_taghandler_137=(org.apache.struts.taglib.html.TextTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.TextTag.class,"org.apache.struts.taglib.html.TextTag maxlength name property readonly size"); __jsp_taghandler_137.setParent(__jsp_taghandler_79); __jsp_taghandler_137.setMaxlength("20"); __jsp_taghandler_137.setName("ActivosForm"); __jsp_taghandler_137.setProperty("act_ordencompra"); __jsp_taghandler_137.setReadonly(true); __jsp_taghandler_137.setSize("20"); __jsp_tag_starteval=__jsp_taghandler_137.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_137,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_137.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_137.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_137); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[142]); /*@lineinfo:translated-code*//*@lineinfo:462^21*/ { org.apache.struts.taglib.bean.MessageTag __jsp_taghandler_138=(org.apache.struts.taglib.bean.MessageTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.bean.MessageTag.class,"org.apache.struts.taglib.bean.MessageTag key"); __jsp_taghandler_138.setParent(__jsp_taghandler_79); __jsp_taghandler_138.setKey("activos.numfactura"); __jsp_tag_starteval=__jsp_taghandler_138.doStartTag(); if (OracleJspRuntime.checkStartTagEval(__jsp_tag_starteval)) { do { } while (__jsp_taghandler_138.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); } if (__jsp_taghandler_138.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_138); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[143]); /*@lineinfo:translated-code*//*@lineinfo:465^21*/ { org.apache.struts.taglib.html.TextTag __jsp_taghandler_139=(org.apache.struts.taglib.html.TextTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.TextTag.class,"org.apache.struts.taglib.html.TextTag maxlength name property readonly size"); __jsp_taghandler_139.setParent(__jsp_taghandler_79); __jsp_taghandler_139.setMaxlength("8"); __jsp_taghandler_139.setName("ActivosForm"); __jsp_taghandler_139.setProperty("act_numfactura"); __jsp_taghandler_139.setReadonly(true); __jsp_taghandler_139.setSize("8"); __jsp_tag_starteval=__jsp_taghandler_139.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_139,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_139.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_139.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_139); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[144]); /*@lineinfo:translated-code*//*@lineinfo:468^21*/ { org.apache.struts.taglib.bean.MessageTag __jsp_taghandler_140=(org.apache.struts.taglib.bean.MessageTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.bean.MessageTag.class,"org.apache.struts.taglib.bean.MessageTag key"); __jsp_taghandler_140.setParent(__jsp_taghandler_79); __jsp_taghandler_140.setKey("activos.numcomprobante"); __jsp_tag_starteval=__jsp_taghandler_140.doStartTag(); if (OracleJspRuntime.checkStartTagEval(__jsp_tag_starteval)) { do { } while (__jsp_taghandler_140.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); } if (__jsp_taghandler_140.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_140); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[145]); /*@lineinfo:translated-code*//*@lineinfo:471^21*/ { org.apache.struts.taglib.html.TextTag __jsp_taghandler_141=(org.apache.struts.taglib.html.TextTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.TextTag.class,"org.apache.struts.taglib.html.TextTag maxlength name property readonly size"); __jsp_taghandler_141.setParent(__jsp_taghandler_79); __jsp_taghandler_141.setMaxlength("20"); __jsp_taghandler_141.setName("ActivosForm"); __jsp_taghandler_141.setProperty("act_numcomprobante"); __jsp_taghandler_141.setReadonly(true); __jsp_taghandler_141.setSize("20"); __jsp_tag_starteval=__jsp_taghandler_141.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_141,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_141.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_141.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_141); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[146]); /*@lineinfo:translated-code*//*@lineinfo:476^21*/ { org.apache.struts.taglib.bean.MessageTag __jsp_taghandler_142=(org.apache.struts.taglib.bean.MessageTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.bean.MessageTag.class,"org.apache.struts.taglib.bean.MessageTag key"); __jsp_taghandler_142.setParent(__jsp_taghandler_79); __jsp_taghandler_142.setKey("activos.codanterior"); __jsp_tag_starteval=__jsp_taghandler_142.doStartTag(); if (OracleJspRuntime.checkStartTagEval(__jsp_tag_starteval)) { do { } while (__jsp_taghandler_142.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); } if (__jsp_taghandler_142.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_142); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[147]); /*@lineinfo:translated-code*//*@lineinfo:479^21*/ { org.apache.struts.taglib.html.TextTag __jsp_taghandler_143=(org.apache.struts.taglib.html.TextTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.TextTag.class,"org.apache.struts.taglib.html.TextTag maxlength name property readonly size"); __jsp_taghandler_143.setParent(__jsp_taghandler_79); __jsp_taghandler_143.setMaxlength("20"); __jsp_taghandler_143.setName("ActivosForm"); __jsp_taghandler_143.setProperty("act_codanterior"); __jsp_taghandler_143.setReadonly(true); __jsp_taghandler_143.setSize("20"); __jsp_tag_starteval=__jsp_taghandler_143.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_143,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_143.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_143.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_143); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[148]); /*@lineinfo:translated-code*//*@lineinfo:482^21*/ { org.apache.struts.taglib.bean.MessageTag __jsp_taghandler_144=(org.apache.struts.taglib.bean.MessageTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.bean.MessageTag.class,"org.apache.struts.taglib.bean.MessageTag key"); __jsp_taghandler_144.setParent(__jsp_taghandler_79); __jsp_taghandler_144.setKey("activos.fecha"); __jsp_tag_starteval=__jsp_taghandler_144.doStartTag(); if (OracleJspRuntime.checkStartTagEval(__jsp_tag_starteval)) { do { } while (__jsp_taghandler_144.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); } if (__jsp_taghandler_144.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_144); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[149]); /*@lineinfo:translated-code*//*@lineinfo:485^21*/ { org.apache.struts.taglib.html.TextTag __jsp_taghandler_145=(org.apache.struts.taglib.html.TextTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.TextTag.class,"org.apache.struts.taglib.html.TextTag maxlength name property readonly size"); __jsp_taghandler_145.setParent(__jsp_taghandler_79); __jsp_taghandler_145.setMaxlength("10"); __jsp_taghandler_145.setName("ActivosForm"); __jsp_taghandler_145.setProperty("rev_fecha"); __jsp_taghandler_145.setReadonly(true); __jsp_taghandler_145.setSize("10"); __jsp_tag_starteval=__jsp_taghandler_145.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_145,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_145.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_145.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_145); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[150]); /*@lineinfo:translated-code*//*@lineinfo:490^21*/ { org.apache.struts.taglib.bean.MessageTag __jsp_taghandler_146=(org.apache.struts.taglib.bean.MessageTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.bean.MessageTag.class,"org.apache.struts.taglib.bean.MessageTag key"); __jsp_taghandler_146.setParent(__jsp_taghandler_79); __jsp_taghandler_146.setKey("activos.vidaut"); __jsp_tag_starteval=__jsp_taghandler_146.doStartTag(); if (OracleJspRuntime.checkStartTagEval(__jsp_tag_starteval)) { do { } while (__jsp_taghandler_146.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); } if (__jsp_taghandler_146.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_146); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[151]); /*@lineinfo:translated-code*//*@lineinfo:493^21*/ { org.apache.struts.taglib.html.TextTag __jsp_taghandler_147=(org.apache.struts.taglib.html.TextTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.TextTag.class,"org.apache.struts.taglib.html.TextTag maxlength name property readonly size"); __jsp_taghandler_147.setParent(__jsp_taghandler_79); __jsp_taghandler_147.setMaxlength("4"); __jsp_taghandler_147.setName("ActivosForm"); __jsp_taghandler_147.setProperty("rev_vidaut"); __jsp_taghandler_147.setReadonly(true); __jsp_taghandler_147.setSize("4"); __jsp_tag_starteval=__jsp_taghandler_147.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_147,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_147.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_147.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_147); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[152]); /*@lineinfo:translated-code*//*@lineinfo:496^21*/ { org.apache.struts.taglib.bean.MessageTag __jsp_taghandler_148=(org.apache.struts.taglib.bean.MessageTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.bean.MessageTag.class,"org.apache.struts.taglib.bean.MessageTag key"); __jsp_taghandler_148.setParent(__jsp_taghandler_79); __jsp_taghandler_148.setKey("activos.estadoactivo"); __jsp_tag_starteval=__jsp_taghandler_148.doStartTag(); if (OracleJspRuntime.checkStartTagEval(__jsp_tag_starteval)) { do { } while (__jsp_taghandler_148.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); } if (__jsp_taghandler_148.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_148); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[153]); /*@lineinfo:translated-code*//*@lineinfo:499^21*/ { org.apache.struts.taglib.html.TextTag __jsp_taghandler_149=(org.apache.struts.taglib.html.TextTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.TextTag.class,"org.apache.struts.taglib.html.TextTag name property readonly size"); __jsp_taghandler_149.setParent(__jsp_taghandler_79); __jsp_taghandler_149.setName("ActivosForm"); __jsp_taghandler_149.setProperty("rev_estadoactivo"); __jsp_taghandler_149.setReadonly(true); __jsp_taghandler_149.setSize("10"); __jsp_tag_starteval=__jsp_taghandler_149.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_149,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_149.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_149.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_149); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[154]); /*@lineinfo:translated-code*//*@lineinfo:504^21*/ { org.apache.struts.taglib.bean.MessageTag __jsp_taghandler_150=(org.apache.struts.taglib.bean.MessageTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.bean.MessageTag.class,"org.apache.struts.taglib.bean.MessageTag key"); __jsp_taghandler_150.setParent(__jsp_taghandler_79); __jsp_taghandler_150.setKey("activos.desestado"); __jsp_tag_starteval=__jsp_taghandler_150.doStartTag(); if (OracleJspRuntime.checkStartTagEval(__jsp_tag_starteval)) { do { } while (__jsp_taghandler_150.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); } if (__jsp_taghandler_150.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_150); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[155]); /*@lineinfo:translated-code*//*@lineinfo:507^21*/ { org.apache.struts.taglib.html.TextTag __jsp_taghandler_151=(org.apache.struts.taglib.html.TextTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.TextTag.class,"org.apache.struts.taglib.html.TextTag maxlength name property readonly size"); __jsp_taghandler_151.setParent(__jsp_taghandler_79); __jsp_taghandler_151.setMaxlength("60"); __jsp_taghandler_151.setName("ActivosForm"); __jsp_taghandler_151.setProperty("rev_desestado"); __jsp_taghandler_151.setReadonly(true); __jsp_taghandler_151.setSize("60"); __jsp_tag_starteval=__jsp_taghandler_151.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_151,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_151.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_151.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_151); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[156]); /*@lineinfo:translated-code*//*@lineinfo:512^21*/ { org.apache.struts.taglib.html.SubmitTag __jsp_taghandler_152=(org.apache.struts.taglib.html.SubmitTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.SubmitTag.class,"org.apache.struts.taglib.html.SubmitTag onclick property styleClass value"); __jsp_taghandler_152.setParent(__jsp_taghandler_79); __jsp_taghandler_152.setOnclick("operacion.value=2;opcion.value=4"); __jsp_taghandler_152.setProperty("boton"); __jsp_taghandler_152.setStyleClass("boton1"); __jsp_taghandler_152.setValue("Reportar"); __jsp_tag_starteval=__jsp_taghandler_152.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_152,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_152.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_152.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_152); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[157]); /*@lineinfo:translated-code*//*@lineinfo:512^133*/ } while (__jsp_taghandler_79.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); } if (__jsp_taghandler_79.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_79); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[158]); /*@lineinfo:translated-code*//*@lineinfo:516^27*/ } while (__jsp_taghandler_4.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); } if (__jsp_taghandler_4.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_4); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[159]); /*@lineinfo:translated-code*//*@lineinfo:518^10*/ { org.apache.struts.taglib.logic.EqualTag __jsp_taghandler_153=(org.apache.struts.taglib.logic.EqualTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.logic.EqualTag.class,"org.apache.struts.taglib.logic.EqualTag name property value"); __jsp_taghandler_153.setParent(__jsp_taghandler_1); __jsp_taghandler_153.setName("ActivosForm"); __jsp_taghandler_153.setProperty("operacion"); __jsp_taghandler_153.setValue("2"); __jsp_tag_starteval=__jsp_taghandler_153.doStartTag(); if (OracleJspRuntime.checkStartTagEval(__jsp_tag_starteval)) { do { /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[160]); /*@lineinfo:translated-code*//*@lineinfo:522^22*/ { org.apache.struts.taglib.bean.MessageTag __jsp_taghandler_154=(org.apache.struts.taglib.bean.MessageTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.bean.MessageTag.class,"org.apache.struts.taglib.bean.MessageTag key"); __jsp_taghandler_154.setParent(__jsp_taghandler_153); __jsp_taghandler_154.setKey("activos.codrub"); __jsp_tag_starteval=__jsp_taghandler_154.doStartTag(); if (OracleJspRuntime.checkStartTagEval(__jsp_tag_starteval)) { do { } while (__jsp_taghandler_154.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); } if (__jsp_taghandler_154.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_154); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[161]); /*@lineinfo:translated-code*//*@lineinfo:525^19*/ { org.apache.struts.taglib.html.SelectTag __jsp_taghandler_155=(org.apache.struts.taglib.html.SelectTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.SelectTag.class,"org.apache.struts.taglib.html.SelectTag disabled name property"); __jsp_taghandler_155.setParent(__jsp_taghandler_153); __jsp_taghandler_155.setDisabled(false); __jsp_taghandler_155.setName("ActivosForm"); __jsp_taghandler_155.setProperty("act_codrub"); __jsp_tag_starteval=__jsp_taghandler_155.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_155,__jsp_tag_starteval,out); do { /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[162]); /*@lineinfo:translated-code*//*@lineinfo:526^25*/ { org.apache.struts.taglib.html.OptionsTag __jsp_taghandler_156=(org.apache.struts.taglib.html.OptionsTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.OptionsTag.class,"org.apache.struts.taglib.html.OptionsTag collection labelProperty property"); __jsp_taghandler_156.setParent(__jsp_taghandler_155); __jsp_taghandler_156.setCollection("RubrosLista"); __jsp_taghandler_156.setLabelProperty("descripcion"); __jsp_taghandler_156.setProperty("codigo"); __jsp_tag_starteval=__jsp_taghandler_156.doStartTag(); if (OracleJspRuntime.checkStartTagEval(__jsp_tag_starteval)) { do { } while (__jsp_taghandler_156.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); } if (__jsp_taghandler_156.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_156); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[163]); /*@lineinfo:translated-code*//*@lineinfo:526^111*/ } while (__jsp_taghandler_155.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_155.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_155); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[164]); /*@lineinfo:translated-code*//*@lineinfo:532^19*/ { org.apache.struts.taglib.bean.MessageTag __jsp_taghandler_157=(org.apache.struts.taglib.bean.MessageTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.bean.MessageTag.class,"org.apache.struts.taglib.bean.MessageTag key"); __jsp_taghandler_157.setParent(__jsp_taghandler_153); __jsp_taghandler_157.setKey("activos.codreg"); __jsp_tag_starteval=__jsp_taghandler_157.doStartTag(); if (OracleJspRuntime.checkStartTagEval(__jsp_tag_starteval)) { do { } while (__jsp_taghandler_157.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); } if (__jsp_taghandler_157.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_157); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[165]); /*@lineinfo:translated-code*//*@lineinfo:535^19*/ { org.apache.struts.taglib.html.HiddenTag __jsp_taghandler_158=(org.apache.struts.taglib.html.HiddenTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.HiddenTag.class,"org.apache.struts.taglib.html.HiddenTag name property"); __jsp_taghandler_158.setParent(__jsp_taghandler_153); __jsp_taghandler_158.setName("ActivosForm"); __jsp_taghandler_158.setProperty("act_codreg"); __jsp_tag_starteval=__jsp_taghandler_158.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_158,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_158.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_158.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_158); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[166]); /*@lineinfo:translated-code*//*@lineinfo:536^22*/ { org.apache.struts.taglib.html.TextTag __jsp_taghandler_159=(org.apache.struts.taglib.html.TextTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.TextTag.class,"org.apache.struts.taglib.html.TextTag maxlength name property readonly size"); __jsp_taghandler_159.setParent(__jsp_taghandler_153); __jsp_taghandler_159.setMaxlength("30"); __jsp_taghandler_159.setName("ActivosForm"); __jsp_taghandler_159.setProperty("act_regdescripcion"); __jsp_taghandler_159.setReadonly(true); __jsp_taghandler_159.setSize("30"); __jsp_tag_starteval=__jsp_taghandler_159.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_159,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_159.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_159.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_159); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[167]); /*@lineinfo:translated-code*//*@lineinfo:541^19*/ { org.apache.struts.taglib.bean.MessageTag __jsp_taghandler_160=(org.apache.struts.taglib.bean.MessageTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.bean.MessageTag.class,"org.apache.struts.taglib.bean.MessageTag key"); __jsp_taghandler_160.setParent(__jsp_taghandler_153); __jsp_taghandler_160.setKey("activos.codfin"); __jsp_tag_starteval=__jsp_taghandler_160.doStartTag(); if (OracleJspRuntime.checkStartTagEval(__jsp_tag_starteval)) { do { } while (__jsp_taghandler_160.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); } if (__jsp_taghandler_160.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_160); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[168]); /*@lineinfo:translated-code*//*@lineinfo:544^19*/ { org.apache.struts.taglib.html.HiddenTag __jsp_taghandler_161=(org.apache.struts.taglib.html.HiddenTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.HiddenTag.class,"org.apache.struts.taglib.html.HiddenTag name property"); __jsp_taghandler_161.setParent(__jsp_taghandler_153); __jsp_taghandler_161.setName("ActivosForm"); __jsp_taghandler_161.setProperty("act_codfin"); __jsp_tag_starteval=__jsp_taghandler_161.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_161,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_161.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_161.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_161); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[169]); /*@lineinfo:translated-code*//*@lineinfo:545^22*/ { org.apache.struts.taglib.html.TextTag __jsp_taghandler_162=(org.apache.struts.taglib.html.TextTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.TextTag.class,"org.apache.struts.taglib.html.TextTag maxlength name property readonly size"); __jsp_taghandler_162.setParent(__jsp_taghandler_153); __jsp_taghandler_162.setMaxlength("30"); __jsp_taghandler_162.setName("ActivosForm"); __jsp_taghandler_162.setProperty("act_findescripcion"); __jsp_taghandler_162.setReadonly(true); __jsp_taghandler_162.setSize("30"); __jsp_tag_starteval=__jsp_taghandler_162.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_162,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_162.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_162.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_162); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[170]); /*@lineinfo:translated-code*//*@lineinfo:548^16*/ { org.apache.struts.taglib.logic.EqualTag __jsp_taghandler_163=(org.apache.struts.taglib.logic.EqualTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.logic.EqualTag.class,"org.apache.struts.taglib.logic.EqualTag name property value"); __jsp_taghandler_163.setParent(__jsp_taghandler_153); __jsp_taghandler_163.setName("ActivosForm"); __jsp_taghandler_163.setProperty("opcion"); __jsp_taghandler_163.setValue("2"); __jsp_tag_starteval=__jsp_taghandler_163.doStartTag(); if (OracleJspRuntime.checkStartTagEval(__jsp_tag_starteval)) { do { /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[171]); /*@lineinfo:translated-code*//*@lineinfo:553^22*/ { org.apache.struts.taglib.html.SubmitTag __jsp_taghandler_164=(org.apache.struts.taglib.html.SubmitTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.SubmitTag.class,"org.apache.struts.taglib.html.SubmitTag onclick property styleClass value"); __jsp_taghandler_164.setParent(__jsp_taghandler_163); __jsp_taghandler_164.setOnclick("operacion.value=6;opcion.value=2"); __jsp_taghandler_164.setProperty("boton"); __jsp_taghandler_164.setStyleClass("boton1"); __jsp_taghandler_164.setValue("Modificar"); __jsp_tag_starteval=__jsp_taghandler_164.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_164,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_164.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_164.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_164); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[172]); /*@lineinfo:translated-code*//*@lineinfo:553^134*/ } while (__jsp_taghandler_163.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); } if (__jsp_taghandler_163.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_163); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[173]); /*@lineinfo:translated-code*//*@lineinfo:557^16*/ { org.apache.struts.taglib.logic.EqualTag __jsp_taghandler_165=(org.apache.struts.taglib.logic.EqualTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.logic.EqualTag.class,"org.apache.struts.taglib.logic.EqualTag name property value"); __jsp_taghandler_165.setParent(__jsp_taghandler_153); __jsp_taghandler_165.setName("ActivosForm"); __jsp_taghandler_165.setProperty("opcion"); __jsp_taghandler_165.setValue("3"); __jsp_tag_starteval=__jsp_taghandler_165.doStartTag(); if (OracleJspRuntime.checkStartTagEval(__jsp_tag_starteval)) { do { /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[174]); /*@lineinfo:translated-code*//*@lineinfo:562^22*/ { org.apache.struts.taglib.html.SubmitTag __jsp_taghandler_166=(org.apache.struts.taglib.html.SubmitTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.SubmitTag.class,"org.apache.struts.taglib.html.SubmitTag onclick property styleClass value"); __jsp_taghandler_166.setParent(__jsp_taghandler_165); __jsp_taghandler_166.setOnclick("operacion.value=6;opcion.value=3"); __jsp_taghandler_166.setProperty("boton"); __jsp_taghandler_166.setStyleClass("boton1"); __jsp_taghandler_166.setValue("Eliminar"); __jsp_tag_starteval=__jsp_taghandler_166.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_166,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_166.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_166.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_166); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[175]); /*@lineinfo:translated-code*//*@lineinfo:562^133*/ } while (__jsp_taghandler_165.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); } if (__jsp_taghandler_165.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_165); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[176]); /*@lineinfo:translated-code*//*@lineinfo:566^16*/ { org.apache.struts.taglib.logic.EqualTag __jsp_taghandler_167=(org.apache.struts.taglib.logic.EqualTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.logic.EqualTag.class,"org.apache.struts.taglib.logic.EqualTag name property value"); __jsp_taghandler_167.setParent(__jsp_taghandler_153); __jsp_taghandler_167.setName("ActivosForm"); __jsp_taghandler_167.setProperty("opcion"); __jsp_taghandler_167.setValue("5"); __jsp_tag_starteval=__jsp_taghandler_167.doStartTag(); if (OracleJspRuntime.checkStartTagEval(__jsp_tag_starteval)) { do { /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[177]); /*@lineinfo:translated-code*//*@lineinfo:571^22*/ { org.apache.struts.taglib.html.SubmitTag __jsp_taghandler_168=(org.apache.struts.taglib.html.SubmitTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.SubmitTag.class,"org.apache.struts.taglib.html.SubmitTag onclick property styleClass value"); __jsp_taghandler_168.setParent(__jsp_taghandler_167); __jsp_taghandler_168.setOnclick("operacion.value=6;opcion.value=4"); __jsp_taghandler_168.setProperty("boton"); __jsp_taghandler_168.setStyleClass("boton1"); __jsp_taghandler_168.setValue("Consultar"); __jsp_tag_starteval=__jsp_taghandler_168.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_168,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_168.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_168.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_168); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[178]); /*@lineinfo:translated-code*//*@lineinfo:571^134*/ } while (__jsp_taghandler_167.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); } if (__jsp_taghandler_167.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_167); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[179]); /*@lineinfo:translated-code*//*@lineinfo:574^30*/ } while (__jsp_taghandler_153.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); } if (__jsp_taghandler_153.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_153); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[180]); /*@lineinfo:translated-code*//*@lineinfo:577^10*/ { org.apache.struts.taglib.logic.EqualTag __jsp_taghandler_169=(org.apache.struts.taglib.logic.EqualTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.logic.EqualTag.class,"org.apache.struts.taglib.logic.EqualTag name property value"); __jsp_taghandler_169.setParent(__jsp_taghandler_1); __jsp_taghandler_169.setName("ActivosForm"); __jsp_taghandler_169.setProperty("operacion"); __jsp_taghandler_169.setValue("6"); __jsp_tag_starteval=__jsp_taghandler_169.doStartTag(); if (OracleJspRuntime.checkStartTagEval(__jsp_tag_starteval)) { do { /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[181]); /*@lineinfo:translated-code*//*@lineinfo:581^22*/ { org.apache.struts.taglib.bean.MessageTag __jsp_taghandler_170=(org.apache.struts.taglib.bean.MessageTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.bean.MessageTag.class,"org.apache.struts.taglib.bean.MessageTag key"); __jsp_taghandler_170.setParent(__jsp_taghandler_169); __jsp_taghandler_170.setKey("activos.codrub"); __jsp_tag_starteval=__jsp_taghandler_170.doStartTag(); if (OracleJspRuntime.checkStartTagEval(__jsp_tag_starteval)) { do { } while (__jsp_taghandler_170.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); } if (__jsp_taghandler_170.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_170); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[182]); /*@lineinfo:translated-code*//*@lineinfo:584^19*/ { org.apache.struts.taglib.html.HiddenTag __jsp_taghandler_171=(org.apache.struts.taglib.html.HiddenTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.HiddenTag.class,"org.apache.struts.taglib.html.HiddenTag name property"); __jsp_taghandler_171.setParent(__jsp_taghandler_169); __jsp_taghandler_171.setName("ActivosForm"); __jsp_taghandler_171.setProperty("act_codrub"); __jsp_tag_starteval=__jsp_taghandler_171.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_171,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_171.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_171.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_171); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[183]); /*@lineinfo:translated-code*//*@lineinfo:585^22*/ { org.apache.struts.taglib.html.TextTag __jsp_taghandler_172=(org.apache.struts.taglib.html.TextTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.TextTag.class,"org.apache.struts.taglib.html.TextTag maxlength name property readonly size"); __jsp_taghandler_172.setParent(__jsp_taghandler_169); __jsp_taghandler_172.setMaxlength("30"); __jsp_taghandler_172.setName("ActivosForm"); __jsp_taghandler_172.setProperty("act_rubdescripcion"); __jsp_taghandler_172.setReadonly(true); __jsp_taghandler_172.setSize("30"); __jsp_tag_starteval=__jsp_taghandler_172.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_172,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_172.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_172.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_172); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[184]); /*@lineinfo:translated-code*//*@lineinfo:590^19*/ { org.apache.struts.taglib.bean.MessageTag __jsp_taghandler_173=(org.apache.struts.taglib.bean.MessageTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.bean.MessageTag.class,"org.apache.struts.taglib.bean.MessageTag key"); __jsp_taghandler_173.setParent(__jsp_taghandler_169); __jsp_taghandler_173.setKey("activos.codreg"); __jsp_tag_starteval=__jsp_taghandler_173.doStartTag(); if (OracleJspRuntime.checkStartTagEval(__jsp_tag_starteval)) { do { } while (__jsp_taghandler_173.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); } if (__jsp_taghandler_173.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_173); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[185]); /*@lineinfo:translated-code*//*@lineinfo:593^19*/ { org.apache.struts.taglib.html.HiddenTag __jsp_taghandler_174=(org.apache.struts.taglib.html.HiddenTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.HiddenTag.class,"org.apache.struts.taglib.html.HiddenTag name property"); __jsp_taghandler_174.setParent(__jsp_taghandler_169); __jsp_taghandler_174.setName("ActivosForm"); __jsp_taghandler_174.setProperty("act_codreg"); __jsp_tag_starteval=__jsp_taghandler_174.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_174,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_174.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_174.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_174); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[186]); /*@lineinfo:translated-code*//*@lineinfo:594^22*/ { org.apache.struts.taglib.html.TextTag __jsp_taghandler_175=(org.apache.struts.taglib.html.TextTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.TextTag.class,"org.apache.struts.taglib.html.TextTag maxlength name property readonly size"); __jsp_taghandler_175.setParent(__jsp_taghandler_169); __jsp_taghandler_175.setMaxlength("30"); __jsp_taghandler_175.setName("ActivosForm"); __jsp_taghandler_175.setProperty("act_regdescripcion"); __jsp_taghandler_175.setReadonly(true); __jsp_taghandler_175.setSize("30"); __jsp_tag_starteval=__jsp_taghandler_175.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_175,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_175.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_175.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_175); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[187]); /*@lineinfo:translated-code*//*@lineinfo:599^19*/ { org.apache.struts.taglib.bean.MessageTag __jsp_taghandler_176=(org.apache.struts.taglib.bean.MessageTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.bean.MessageTag.class,"org.apache.struts.taglib.bean.MessageTag key"); __jsp_taghandler_176.setParent(__jsp_taghandler_169); __jsp_taghandler_176.setKey("activos.codfin"); __jsp_tag_starteval=__jsp_taghandler_176.doStartTag(); if (OracleJspRuntime.checkStartTagEval(__jsp_tag_starteval)) { do { } while (__jsp_taghandler_176.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); } if (__jsp_taghandler_176.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_176); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[188]); /*@lineinfo:translated-code*//*@lineinfo:602^19*/ { org.apache.struts.taglib.html.HiddenTag __jsp_taghandler_177=(org.apache.struts.taglib.html.HiddenTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.HiddenTag.class,"org.apache.struts.taglib.html.HiddenTag name property"); __jsp_taghandler_177.setParent(__jsp_taghandler_169); __jsp_taghandler_177.setName("ActivosForm"); __jsp_taghandler_177.setProperty("act_codfin"); __jsp_tag_starteval=__jsp_taghandler_177.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_177,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_177.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_177.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_177); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[189]); /*@lineinfo:translated-code*//*@lineinfo:603^22*/ { org.apache.struts.taglib.html.TextTag __jsp_taghandler_178=(org.apache.struts.taglib.html.TextTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.TextTag.class,"org.apache.struts.taglib.html.TextTag maxlength name property readonly size"); __jsp_taghandler_178.setParent(__jsp_taghandler_169); __jsp_taghandler_178.setMaxlength("30"); __jsp_taghandler_178.setName("ActivosForm"); __jsp_taghandler_178.setProperty("act_findescripcion"); __jsp_taghandler_178.setReadonly(true); __jsp_taghandler_178.setSize("30"); __jsp_tag_starteval=__jsp_taghandler_178.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_178,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_178.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_178.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_178); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[190]); /*@lineinfo:translated-code*//*@lineinfo:608^19*/ { org.apache.struts.taglib.bean.MessageTag __jsp_taghandler_179=(org.apache.struts.taglib.bean.MessageTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.bean.MessageTag.class,"org.apache.struts.taglib.bean.MessageTag key"); __jsp_taghandler_179.setParent(__jsp_taghandler_169); __jsp_taghandler_179.setKey("activos.codgrp"); __jsp_tag_starteval=__jsp_taghandler_179.doStartTag(); if (OracleJspRuntime.checkStartTagEval(__jsp_tag_starteval)) { do { } while (__jsp_taghandler_179.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); } if (__jsp_taghandler_179.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_179); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[191]); /*@lineinfo:translated-code*//*@lineinfo:611^22*/ { org.apache.struts.taglib.html.SelectTag __jsp_taghandler_180=(org.apache.struts.taglib.html.SelectTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.SelectTag.class,"org.apache.struts.taglib.html.SelectTag disabled name property"); __jsp_taghandler_180.setParent(__jsp_taghandler_169); __jsp_taghandler_180.setDisabled(false); __jsp_taghandler_180.setName("ActivosForm"); __jsp_taghandler_180.setProperty("act_codgrp"); __jsp_tag_starteval=__jsp_taghandler_180.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_180,__jsp_tag_starteval,out); do { /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[192]); /*@lineinfo:translated-code*//*@lineinfo:612^25*/ { org.apache.struts.taglib.html.OptionsTag __jsp_taghandler_181=(org.apache.struts.taglib.html.OptionsTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.OptionsTag.class,"org.apache.struts.taglib.html.OptionsTag collection labelProperty property"); __jsp_taghandler_181.setParent(__jsp_taghandler_180); __jsp_taghandler_181.setCollection("GruposLista"); __jsp_taghandler_181.setLabelProperty("descripcion"); __jsp_taghandler_181.setProperty("codigo"); __jsp_tag_starteval=__jsp_taghandler_181.doStartTag(); if (OracleJspRuntime.checkStartTagEval(__jsp_tag_starteval)) { do { } while (__jsp_taghandler_181.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); } if (__jsp_taghandler_181.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_181); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[193]); /*@lineinfo:translated-code*//*@lineinfo:612^111*/ } while (__jsp_taghandler_180.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_180.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_180); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[194]); /*@lineinfo:translated-code*//*@lineinfo:618^19*/ { org.apache.struts.taglib.bean.MessageTag __jsp_taghandler_182=(org.apache.struts.taglib.bean.MessageTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.bean.MessageTag.class,"org.apache.struts.taglib.bean.MessageTag key"); __jsp_taghandler_182.setParent(__jsp_taghandler_169); __jsp_taghandler_182.setKey("activos.descripcion"); __jsp_tag_starteval=__jsp_taghandler_182.doStartTag(); if (OracleJspRuntime.checkStartTagEval(__jsp_tag_starteval)) { do { } while (__jsp_taghandler_182.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); } if (__jsp_taghandler_182.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_182); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[195]); /*@lineinfo:translated-code*//*@lineinfo:621^19*/ { org.apache.struts.taglib.html.TextTag __jsp_taghandler_183=(org.apache.struts.taglib.html.TextTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.TextTag.class,"org.apache.struts.taglib.html.TextTag maxlength name onchange property size value"); __jsp_taghandler_183.setParent(__jsp_taghandler_169); __jsp_taghandler_183.setMaxlength("120"); __jsp_taghandler_183.setName("ActivosForm"); __jsp_taghandler_183.setOnchange("javascript:this.value=this.value.toUpperCase();"); __jsp_taghandler_183.setProperty("act_descripcion"); __jsp_taghandler_183.setSize("60"); __jsp_taghandler_183.setValue("%"); __jsp_tag_starteval=__jsp_taghandler_183.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_183,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_183.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_183.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_183); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[196]); /*@lineinfo:translated-code*//*@lineinfo:624^16*/ { org.apache.struts.taglib.logic.EqualTag __jsp_taghandler_184=(org.apache.struts.taglib.logic.EqualTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.logic.EqualTag.class,"org.apache.struts.taglib.logic.EqualTag name property value"); __jsp_taghandler_184.setParent(__jsp_taghandler_169); __jsp_taghandler_184.setName("ActivosForm"); __jsp_taghandler_184.setProperty("opcion"); __jsp_taghandler_184.setValue("2"); __jsp_tag_starteval=__jsp_taghandler_184.doStartTag(); if (OracleJspRuntime.checkStartTagEval(__jsp_tag_starteval)) { do { /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[197]); /*@lineinfo:translated-code*//*@lineinfo:629^25*/ { org.apache.struts.taglib.html.SubmitTag __jsp_taghandler_185=(org.apache.struts.taglib.html.SubmitTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.SubmitTag.class,"org.apache.struts.taglib.html.SubmitTag onclick property styleClass value"); __jsp_taghandler_185.setParent(__jsp_taghandler_184); __jsp_taghandler_185.setOnclick("operacion.value=3;opcion.value=2"); __jsp_taghandler_185.setProperty("boton"); __jsp_taghandler_185.setStyleClass("boton1"); __jsp_taghandler_185.setValue("Modificar"); __jsp_tag_starteval=__jsp_taghandler_185.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_185,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_185.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_185.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_185); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[198]); /*@lineinfo:translated-code*//*@lineinfo:629^137*/ } while (__jsp_taghandler_184.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); } if (__jsp_taghandler_184.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_184); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[199]); /*@lineinfo:translated-code*//*@lineinfo:633^16*/ { org.apache.struts.taglib.logic.EqualTag __jsp_taghandler_186=(org.apache.struts.taglib.logic.EqualTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.logic.EqualTag.class,"org.apache.struts.taglib.logic.EqualTag name property value"); __jsp_taghandler_186.setParent(__jsp_taghandler_169); __jsp_taghandler_186.setName("ActivosForm"); __jsp_taghandler_186.setProperty("opcion"); __jsp_taghandler_186.setValue("3"); __jsp_tag_starteval=__jsp_taghandler_186.doStartTag(); if (OracleJspRuntime.checkStartTagEval(__jsp_tag_starteval)) { do { /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[200]); /*@lineinfo:translated-code*//*@lineinfo:638^25*/ { org.apache.struts.taglib.html.SubmitTag __jsp_taghandler_187=(org.apache.struts.taglib.html.SubmitTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.SubmitTag.class,"org.apache.struts.taglib.html.SubmitTag onclick property styleClass value"); __jsp_taghandler_187.setParent(__jsp_taghandler_186); __jsp_taghandler_187.setOnclick("operacion.value=3;opcion.value=3"); __jsp_taghandler_187.setProperty("boton"); __jsp_taghandler_187.setStyleClass("boton1"); __jsp_taghandler_187.setValue("Eliminar"); __jsp_tag_starteval=__jsp_taghandler_187.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_187,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_187.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_187.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_187); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[201]); /*@lineinfo:translated-code*//*@lineinfo:638^136*/ } while (__jsp_taghandler_186.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); } if (__jsp_taghandler_186.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_186); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[202]); /*@lineinfo:translated-code*//*@lineinfo:642^16*/ { org.apache.struts.taglib.logic.EqualTag __jsp_taghandler_188=(org.apache.struts.taglib.logic.EqualTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.logic.EqualTag.class,"org.apache.struts.taglib.logic.EqualTag name property value"); __jsp_taghandler_188.setParent(__jsp_taghandler_169); __jsp_taghandler_188.setName("ActivosForm"); __jsp_taghandler_188.setProperty("opcion"); __jsp_taghandler_188.setValue("4"); __jsp_tag_starteval=__jsp_taghandler_188.doStartTag(); if (OracleJspRuntime.checkStartTagEval(__jsp_tag_starteval)) { do { /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[203]); /*@lineinfo:translated-code*//*@lineinfo:647^25*/ { org.apache.struts.taglib.html.SubmitTag __jsp_taghandler_189=(org.apache.struts.taglib.html.SubmitTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.SubmitTag.class,"org.apache.struts.taglib.html.SubmitTag onclick property styleClass value"); __jsp_taghandler_189.setParent(__jsp_taghandler_188); __jsp_taghandler_189.setOnclick("operacion.value=3;opcion.value=4"); __jsp_taghandler_189.setProperty("boton"); __jsp_taghandler_189.setStyleClass("boton1"); __jsp_taghandler_189.setValue("Consultar"); __jsp_tag_starteval=__jsp_taghandler_189.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_189,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_189.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_189.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_189); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[204]); /*@lineinfo:translated-code*//*@lineinfo:647^137*/ } while (__jsp_taghandler_188.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); } if (__jsp_taghandler_188.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_188); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[205]); /*@lineinfo:translated-code*//*@lineinfo:650^30*/ } while (__jsp_taghandler_169.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); } if (__jsp_taghandler_169.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_169); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[206]); /*@lineinfo:translated-code*//*@lineinfo:653^10*/ { org.apache.struts.taglib.logic.EqualTag __jsp_taghandler_190=(org.apache.struts.taglib.logic.EqualTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.logic.EqualTag.class,"org.apache.struts.taglib.logic.EqualTag name property value"); __jsp_taghandler_190.setParent(__jsp_taghandler_1); __jsp_taghandler_190.setName("ActivosForm"); __jsp_taghandler_190.setProperty("operacion"); __jsp_taghandler_190.setValue("3"); __jsp_tag_starteval=__jsp_taghandler_190.doStartTag(); if (OracleJspRuntime.checkStartTagEval(__jsp_tag_starteval)) { do { /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[207]); /*@lineinfo:translated-code*//*@lineinfo:660^28*/ { org.apache.struts.taglib.html.HiddenTag __jsp_taghandler_191=(org.apache.struts.taglib.html.HiddenTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.HiddenTag.class,"org.apache.struts.taglib.html.HiddenTag name property"); __jsp_taghandler_191.setParent(__jsp_taghandler_190); __jsp_taghandler_191.setName("ActivosForm"); __jsp_taghandler_191.setProperty("act_codrub"); __jsp_tag_starteval=__jsp_taghandler_191.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_191,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_191.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_191.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_191); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[208]); /*@lineinfo:translated-code*//*@lineinfo:661^28*/ { org.apache.struts.taglib.html.HiddenTag __jsp_taghandler_192=(org.apache.struts.taglib.html.HiddenTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.HiddenTag.class,"org.apache.struts.taglib.html.HiddenTag name property"); __jsp_taghandler_192.setParent(__jsp_taghandler_190); __jsp_taghandler_192.setName("ActivosForm"); __jsp_taghandler_192.setProperty("act_codreg"); __jsp_tag_starteval=__jsp_taghandler_192.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_192,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_192.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_192.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_192); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[209]); /*@lineinfo:translated-code*//*@lineinfo:662^28*/ { org.apache.struts.taglib.html.HiddenTag __jsp_taghandler_193=(org.apache.struts.taglib.html.HiddenTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.HiddenTag.class,"org.apache.struts.taglib.html.HiddenTag name property"); __jsp_taghandler_193.setParent(__jsp_taghandler_190); __jsp_taghandler_193.setName("ActivosForm"); __jsp_taghandler_193.setProperty("act_codgrp"); __jsp_tag_starteval=__jsp_taghandler_193.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_193,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_193.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_193.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_193); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[210]); /*@lineinfo:translated-code*//*@lineinfo:663^28*/ { org.apache.struts.taglib.html.HiddenTag __jsp_taghandler_194=(org.apache.struts.taglib.html.HiddenTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.HiddenTag.class,"org.apache.struts.taglib.html.HiddenTag name property"); __jsp_taghandler_194.setParent(__jsp_taghandler_190); __jsp_taghandler_194.setName("ActivosForm"); __jsp_taghandler_194.setProperty("act_codfin"); __jsp_tag_starteval=__jsp_taghandler_194.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_194,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_194.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_194.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_194); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[211]); /*@lineinfo:translated-code*//*@lineinfo:664^28*/ { org.apache.struts.taglib.html.HiddenTag __jsp_taghandler_195=(org.apache.struts.taglib.html.HiddenTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.HiddenTag.class,"org.apache.struts.taglib.html.HiddenTag name property"); __jsp_taghandler_195.setParent(__jsp_taghandler_190); __jsp_taghandler_195.setName("ActivosForm"); __jsp_taghandler_195.setProperty("act_descripcion"); __jsp_tag_starteval=__jsp_taghandler_195.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_195,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_195.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_195.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_195); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[212]); /*@lineinfo:user-code*//*@lineinfo:672^30*/ int pnum=0; /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[213]); /*@lineinfo:translated-code*//*@lineinfo:673^30*/ { org.apache.struts.taglib.logic.IterateTag __jsp_taghandler_196=(org.apache.struts.taglib.logic.IterateTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.logic.IterateTag.class,"org.apache.struts.taglib.logic.IterateTag id name"); __jsp_taghandler_196.setParent(__jsp_taghandler_190); __jsp_taghandler_196.setId("lista"); __jsp_taghandler_196.setName("Activos3Lista"); java.lang.Object lista = null; __jsp_tag_starteval=__jsp_taghandler_196.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_196,__jsp_tag_starteval,out); do { lista = (java.lang.Object) pageContext.findAttribute("lista"); /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[214]); /*@lineinfo:user-code*//*@lineinfo:674^30*/ if (pnum==1) { /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[215]); /*@lineinfo:user-code*//*@lineinfo:676^25*/ } else { /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[216]); /*@lineinfo:user-code*//*@lineinfo:678^25*/ } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[217]); /*@lineinfo:translated-code*//*@lineinfo:680^25*/ { org.apache.struts.taglib.bean.WriteTag __jsp_taghandler_197=(org.apache.struts.taglib.bean.WriteTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.bean.WriteTag.class,"org.apache.struts.taglib.bean.WriteTag name property"); __jsp_taghandler_197.setParent(__jsp_taghandler_196); __jsp_taghandler_197.setName("lista"); __jsp_taghandler_197.setProperty("codrub"); __jsp_tag_starteval=__jsp_taghandler_197.doStartTag(); if (OracleJspRuntime.checkStartTagEval(__jsp_tag_starteval)) { do { } while (__jsp_taghandler_197.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); } if (__jsp_taghandler_197.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_197); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[218]); /*@lineinfo:translated-code*//*@lineinfo:680^71*/ { org.apache.struts.taglib.bean.WriteTag __jsp_taghandler_198=(org.apache.struts.taglib.bean.WriteTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.bean.WriteTag.class,"org.apache.struts.taglib.bean.WriteTag name property"); __jsp_taghandler_198.setParent(__jsp_taghandler_196); __jsp_taghandler_198.setName("lista"); __jsp_taghandler_198.setProperty("codreg"); __jsp_tag_starteval=__jsp_taghandler_198.doStartTag(); if (OracleJspRuntime.checkStartTagEval(__jsp_tag_starteval)) { do { } while (__jsp_taghandler_198.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); } if (__jsp_taghandler_198.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_198); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[219]); /*@lineinfo:translated-code*//*@lineinfo:680^117*/ { org.apache.struts.taglib.bean.WriteTag __jsp_taghandler_199=(org.apache.struts.taglib.bean.WriteTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.bean.WriteTag.class,"org.apache.struts.taglib.bean.WriteTag name property"); __jsp_taghandler_199.setParent(__jsp_taghandler_196); __jsp_taghandler_199.setName("lista"); __jsp_taghandler_199.setProperty("ceros"); __jsp_tag_starteval=__jsp_taghandler_199.doStartTag(); if (OracleJspRuntime.checkStartTagEval(__jsp_tag_starteval)) { do { } while (__jsp_taghandler_199.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); } if (__jsp_taghandler_199.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_199); } /*@lineinfo:680^161*/ { org.apache.struts.taglib.bean.WriteTag __jsp_taghandler_200=(org.apache.struts.taglib.bean.WriteTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.bean.WriteTag.class,"org.apache.struts.taglib.bean.WriteTag name property"); __jsp_taghandler_200.setParent(__jsp_taghandler_196); __jsp_taghandler_200.setName("lista"); __jsp_taghandler_200.setProperty("codigo"); __jsp_tag_starteval=__jsp_taghandler_200.doStartTag(); if (OracleJspRuntime.checkStartTagEval(__jsp_tag_starteval)) { do { } while (__jsp_taghandler_200.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); } if (__jsp_taghandler_200.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_200); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[220]); /*@lineinfo:translated-code*//*@lineinfo:683^25*/ { org.apache.struts.taglib.bean.WriteTag __jsp_taghandler_201=(org.apache.struts.taglib.bean.WriteTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.bean.WriteTag.class,"org.apache.struts.taglib.bean.WriteTag name property"); __jsp_taghandler_201.setParent(__jsp_taghandler_196); __jsp_taghandler_201.setName("lista"); __jsp_taghandler_201.setProperty("descodgrp"); __jsp_tag_starteval=__jsp_taghandler_201.doStartTag(); if (OracleJspRuntime.checkStartTagEval(__jsp_tag_starteval)) { do { } while (__jsp_taghandler_201.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); } if (__jsp_taghandler_201.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_201); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[221]); /*@lineinfo:translated-code*//*@lineinfo:686^25*/ { org.apache.struts.taglib.bean.WriteTag __jsp_taghandler_202=(org.apache.struts.taglib.bean.WriteTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.bean.WriteTag.class,"org.apache.struts.taglib.bean.WriteTag name property"); __jsp_taghandler_202.setParent(__jsp_taghandler_196); __jsp_taghandler_202.setName("lista"); __jsp_taghandler_202.setProperty("descripcion"); __jsp_tag_starteval=__jsp_taghandler_202.doStartTag(); if (OracleJspRuntime.checkStartTagEval(__jsp_tag_starteval)) { do { } while (__jsp_taghandler_202.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); } if (__jsp_taghandler_202.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_202); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[222]); /*@lineinfo:translated-code*//*@lineinfo:688^28*/ { org.apache.struts.taglib.logic.EqualTag __jsp_taghandler_203=(org.apache.struts.taglib.logic.EqualTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.logic.EqualTag.class,"org.apache.struts.taglib.logic.EqualTag name property value"); __jsp_taghandler_203.setParent(__jsp_taghandler_196); __jsp_taghandler_203.setName("ActivosForm"); __jsp_taghandler_203.setProperty("opcion"); __jsp_taghandler_203.setValue("4"); __jsp_tag_starteval=__jsp_taghandler_203.doStartTag(); if (OracleJspRuntime.checkStartTagEval(__jsp_tag_starteval)) { do { /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[223]); /*@lineinfo:translated-code*//*@lineinfo:690^25*/ { org.apache.struts.taglib.html.SubmitTag __jsp_taghandler_204=(org.apache.struts.taglib.html.SubmitTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.SubmitTag.class,"org.apache.struts.taglib.html.SubmitTag indexed onclick property styleClass value"); __jsp_taghandler_204.setParent(__jsp_taghandler_203); __jsp_taghandler_204.setIndexed(true); __jsp_taghandler_204.setOnclick("operacion.value=1;opcion.value=4"); __jsp_taghandler_204.setProperty("boton"); __jsp_taghandler_204.setStyleClass("boton1"); __jsp_taghandler_204.setValue("Consultar"); __jsp_tag_starteval=__jsp_taghandler_204.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_204,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_204.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_204.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_204); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[224]); /*@lineinfo:translated-code*//*@lineinfo:690^152*/ } while (__jsp_taghandler_203.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); } if (__jsp_taghandler_203.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_203); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[225]); /*@lineinfo:user-code*//*@lineinfo:694^25*/ if (pnum==0) pnum=1; else pnum=0; /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[226]); /*@lineinfo:translated-code*//*@lineinfo:694^64*/ } while (__jsp_taghandler_196.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_196.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_196); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[227]); /*@lineinfo:translated-code*//*@lineinfo:695^41*/ } while (__jsp_taghandler_190.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); } if (__jsp_taghandler_190.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_190); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[228]); /*@lineinfo:translated-code*//*@lineinfo:703^24*/ } while (__jsp_taghandler_1.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); } if (__jsp_taghandler_1.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_1); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[229]); } catch( Throwable e) { try { if (out != null) out.clear(); } catch( Exception clearException) { } pageContext.handlePageException( e); } finally { OracleJspRuntime.extraHandlePCFinally(pageContext,true); JspFactory.getDefaultFactory().releasePageContext(pageContext); } } private static class __jsp_StaticText { private static final char text[][]=new char[230][]; static { try { text[0] = "\n".toCharArray(); text[1] = "\n".toCharArray(); text[2] = "\n".toCharArray(); text[3] = "\n".toCharArray(); text[4] = "\n<html>\n<head>\n <meta http-equiv=\"Content-Type\" content=\"text/html; charset=windows-125\">\n <meta http-equiv=\"Expires\" content=\"-1\">\n <link href=\"Estilos.css\" rel=\"stylesheet\" type=\"text/css\">\n</head>\n<script language=\"JavaScript\" type=\"text/JavaScript\" src=\"Validaciones2.js?1.3\"></script>\n<body>\n<table border=\"1\" width=\"100%\" align=\"center\" class=\"soloborde\" bgcolor=\"#C1C1FF\">\n <caption>Activos</caption>\n <tr>\n <td>\n ".toCharArray(); text[5] = "\n ".toCharArray(); text[6] = "\n ".toCharArray(); text[7] = "\n ".toCharArray(); text[8] = "\n ".toCharArray(); text[9] = "\n <table width=\"100%\" align=\"center\" class=\"soloborde\" bgcolor=\"#C1C1FF\" border=\"1\">\n <tr>\n <td class=\"S10d\">\n\t\t\t\t ".toCharArray(); text[10] = "\n\t\t\t\t </td>\n <td colspan=\"3\">\n\t\t\t\t ".toCharArray(); text[11] = "\n ".toCharArray(); text[12] = "\n\t\t\t\t </td>\n </tr>\n <tr>\n <td class=\"S10d\">\n\t\t\t\t ".toCharArray(); text[13] = "\n\t\t\t\t </td>\n <td colspan=\"3\">\n\t\t\t\t ".toCharArray(); text[14] = "\n ".toCharArray(); text[15] = "\n\t\t\t\t </td>\n </tr>\n <tr>\n <td class=\"S10d\">\n\t\t\t\t ".toCharArray(); text[16] = "\n\t\t\t\t </td>\n <td colspan=\"3\">\n\t\t\t\t ".toCharArray(); text[17] = "\n ".toCharArray(); text[18] = "\n\t\t\t\t </td>\n </tr>\n <tr>\n <td class=\"S10d\">\n\t\t\t\t ".toCharArray(); text[19] = "\n\t\t\t\t </td>\n <td>\n ".toCharArray(); text[20] = " \n ".toCharArray(); text[21] = "\n </td>\n <td class=\"S10d\">\n\t\t\t\t ".toCharArray(); text[22] = "\n\t\t\t\t </td>\n <td>\n ".toCharArray(); text[23] = "\n ".toCharArray(); text[24] = "\n </td>\n </tr>\n <tr>\n <td class=\"S10d\">\n\t\t\t\t ".toCharArray(); text[25] = "\n\t\t\t\t </td>\n <td>\n ".toCharArray(); text[26] = "\n ".toCharArray(); text[27] = "\n </td>\n <td class=\"S10d\">\n\t\t\t\t ".toCharArray(); text[28] = "\n\t\t\t\t </td>\n <td>\n ".toCharArray(); text[29] = "\n ".toCharArray(); text[30] = "\n </td>\n </tr>\n <tr>\n <td class=\"S10d\">\n\t\t\t\t ".toCharArray(); text[31] = "\n\t\t\t\t </td>\n <td>\n ".toCharArray(); text[32] = " \n ".toCharArray(); text[33] = "\n </td>\n <td class=\"S10d\">\n\t\t\t\t ".toCharArray(); text[34] = "\n\t\t\t\t </td>\n <td>\n ".toCharArray(); text[35] = " \n ".toCharArray(); text[36] = "\n </td>\n </tr>\n <tr>\n <td class=\"S10d\">\n\t\t\t\t ".toCharArray(); text[37] = "\n\t\t\t\t </td>\n <td>\n ".toCharArray(); text[38] = " \n ".toCharArray(); text[39] = "\n </td>\n </tr>\n <tr>\n <td class=\"S10d\">\n\t\t\t\t ".toCharArray(); text[40] = "\n\t\t\t\t </td>\n <td>\n\t\t\t\t ".toCharArray(); text[41] = "\n\t\t\t\t </td>\n <td class=\"S10d\">\n\t\t\t\t ".toCharArray(); text[42] = "\n\t\t\t\t </td>\n <td>\n\t\t\t\t ".toCharArray(); text[43] = "\n\t\t\t\t </td>\n </tr>\n <tr>\n <td class=\"S10d\">\n\t\t\t\t ".toCharArray(); text[44] = "\n\t\t\t\t </td>\n <td>\n\t\t\t\t ".toCharArray(); text[45] = "\n\t\t\t\t </td>\n <td class=\"S10d\">\n\t\t\t\t ".toCharArray(); text[46] = "\n\t\t\t\t </td>\n <td>\n\t\t\t\t ".toCharArray(); text[47] = "\n\t\t\t\t </td>\n </tr> \n </table>\n <table width=\"100%\" align=\"center\" class=\"soloborde\" bgcolor=\"#C1C1FF\" border=\"1\">\n <tr>\n <td class=\"S10d\">\n\t\t\t\t ".toCharArray(); text[48] = "\n\t\t\t\t </td>\n <td>\n\t\t\t\t ".toCharArray(); text[49] = "\n\t\t\t\t </td>\n </tr>\n <tr>\n <td class=\"S10d\">\n\t\t\t\t ".toCharArray(); text[50] = "\n\t\t\t\t </td>\n <td>\n\t\t\t\t ".toCharArray(); text[51] = "\n\t\t\t\t </td>\n </tr>\n </table>\n <table width=\"100%\" align=\"center\" class=\"soloborde\" bgcolor=\"#C1C1FF\" border=\"1\"> \n <tr>\n <td class=\"S10d\">\n\t\t\t\t ".toCharArray(); text[52] = "\n\t\t\t\t </td>\n <td>\n\t\t\t\t ".toCharArray(); text[53] = "\n\t\t\t\t </td>\n <td class=\"S10d\">\n\t\t\t\t ".toCharArray(); text[54] = "\n\t\t\t\t </td>\n <td>\n\t\t\t\t ".toCharArray(); text[55] = "\n\t\t\t\t </td>\n </tr>\n <tr>\n <td class=\"S10d\">\n\t\t\t\t ".toCharArray(); text[56] = "\n\t\t\t\t </td>\n <td>\n\t\t\t\t ".toCharArray(); text[57] = "\n\t\t\t\t </td>\n <td class=\"S10d\">\n\t\t\t\t ".toCharArray(); text[58] = "\n\t\t\t\t </td>\n <td>\n\t\t\t\t ".toCharArray(); text[59] = "\n\t\t\t\t </td>\n </tr>\n <tr>\n <td class=\"S10d\">\n\t\t\t\t ".toCharArray(); text[60] = "\n\t\t\t\t </td>\n <td>\n\t\t\t\t ".toCharArray(); text[61] = "\n\t\t\t\t </td>\n <td class=\"S10d\">\n\t\t\t\t ".toCharArray(); text[62] = "\n\t\t\t\t </td>\n <td>\n\t\t\t\t ".toCharArray(); text[63] = "\n\t\t\t\t </td>\n </tr>\n <tr>\n <td class=\"S10d\">\n\t\t\t\t ".toCharArray(); text[64] = "\n\t\t\t\t </td>\n <td>\n\t\t\t\t ".toCharArray(); text[65] = "\n\t\t\t\t </td>\n <td class=\"S10d\">\n\t\t\t\t ".toCharArray(); text[66] = "\n\t\t\t\t </td>\n <td>\n\t\t\t\t ".toCharArray(); text[67] = "\n\t\t\t\t </td>\n </tr>\n <tr>\n <td class=\"S10d\">\n\t\t\t\t ".toCharArray(); text[68] = "\n\t\t\t\t </td>\n <td>\n\t\t\t\t ".toCharArray(); text[69] = "\n\t\t\t\t </td>\n <td class=\"S10d\">\n\t\t\t\t ".toCharArray(); text[70] = "\n\t\t\t\t </td>\n <td>\n\t\t\t\t ".toCharArray(); text[71] = "\n\t\t\t\t </td>\n </tr>\n <tr>\n <td class=\"S10d\">\n\t\t\t\t ".toCharArray(); text[72] = "\n\t\t\t\t </td>\n <td>\n\t\t\t\t ".toCharArray(); text[73] = "\n\t\t\t\t </td>\n <td class=\"S10d\"> \n\t\t\t\t ".toCharArray(); text[74] = "\n\t\t\t\t </td>\n <td>\n\t\t\t\t ".toCharArray(); text[75] = "\n\t\t\t\t </td>\n </tr>\n <tr>\n <td class=\"S10d\">\n\t\t\t\t ".toCharArray(); text[76] = "\n\t\t\t\t </td>\n <td>\n\t\t\t\t ".toCharArray(); text[77] = "\n\t\t\t\t </td>\n <td class=\"S10d\">\n\t\t\t\t ".toCharArray(); text[78] = "\n\t\t\t\t </td>\n <td>\n\t\t\t\t ".toCharArray(); text[79] = "\n\t\t\t\t </td>\n </tr>\n <tr>\n <td class=\"S10d\">\n\t\t\t\t ".toCharArray(); text[80] = "\n\t\t\t\t </td>\n <td>\n\t\t\t\t ".toCharArray(); text[81] = "\n\t\t\t\t </td>\n </tr>\n <tr>\n <td colspan=2>\n\t\t\t\t ".toCharArray(); text[82] = "\n\t\t\t\t </td>\n </tr> \n </table> \n ".toCharArray(); text[83] = " \n\n ".toCharArray(); text[84] = "\n <table width=\"100%\" align=\"center\" class=\"soloborde\" bgcolor=\"#C1C1FF\" border=\"1\">\n <tr>\n <td class=\"S10d\">\n\t\t\t\t ".toCharArray(); text[85] = "\n\t\t\t\t </td>\n <td colspan=\"3\">\n\t\t\t\t ".toCharArray(); text[86] = "\n ".toCharArray(); text[87] = "\n\t\t\t\t </td>\n </tr>\n <tr>\n <td class=\"S10d\">\n\t\t\t\t ".toCharArray(); text[88] = "\n\t\t\t\t </td>\n <td colspan=\"3\">\n\t\t\t\t ".toCharArray(); text[89] = "\n ".toCharArray(); text[90] = "\n\t\t\t\t </td>\n </tr>\n <tr>\n <td class=\"S10d\">\n\t\t\t\t ".toCharArray(); text[91] = "\n\t\t\t\t </td>\n <td colspan=\"3\">\n\t\t\t\t ".toCharArray(); text[92] = "\n ".toCharArray(); text[93] = "\n\t\t\t\t </td>\n </tr>\n <tr>\n <td class=\"S10d\">\n\t\t\t\t ".toCharArray(); text[94] = "\n\t\t\t\t </td>\n <td>\n ".toCharArray(); text[95] = " \n ".toCharArray(); text[96] = "\n </td>\n <td class=\"S10d\">\n\t\t\t\t ".toCharArray(); text[97] = "\n\t\t\t\t </td>\n <td>\n ".toCharArray(); text[98] = "\n ".toCharArray(); text[99] = "\n </td>\n </tr>\n <tr>\n <td class=\"S10d\">\n\t\t\t\t ".toCharArray(); text[100] = "\n\t\t\t\t </td>\n <td>\n ".toCharArray(); text[101] = "\n ".toCharArray(); text[102] = "\n </td>\n <td class=\"S10d\">\n\t\t\t\t ".toCharArray(); text[103] = "\n\t\t\t\t </td>\n <td>\n ".toCharArray(); text[104] = "\n ".toCharArray(); text[105] = "\n </td>\n </tr>\n <tr>\n <td class=\"S10d\">\n\t\t\t\t ".toCharArray(); text[106] = "\n\t\t\t\t </td>\n <td>\n ".toCharArray(); text[107] = " \n ".toCharArray(); text[108] = "\n </td>\n <td class=\"S10d\">\n\t\t\t\t ".toCharArray(); text[109] = "\n\t\t\t\t </td>\n <td>\n ".toCharArray(); text[110] = " \n ".toCharArray(); text[111] = "\n </td>\n </tr>\n <tr>\n <td class=\"S10d\">\n\t\t\t\t ".toCharArray(); text[112] = "\n\t\t\t\t </td>\n <td>\n ".toCharArray(); text[113] = " \n ".toCharArray(); text[114] = "\n </td>\n </tr> \n <tr>\n <td class=\"S10d\">\n\t\t\t\t ".toCharArray(); text[115] = "\n\t\t\t\t </td>\n <td>\n\t\t\t\t ".toCharArray(); text[116] = "\n\t\t\t\t </td>\n <td class=\"S10d\">\n\t\t\t\t ".toCharArray(); text[117] = "\n\t\t\t\t </td>\n <td>\n\t\t\t\t ".toCharArray(); text[118] = "\n\t\t\t\t </td>\n </tr>\n <tr>\n <td class=\"S10d\">\n\t\t\t\t ".toCharArray(); text[119] = "\n\t\t\t\t </td>\n <td>\n\t\t\t\t ".toCharArray(); text[120] = "\n\t\t\t\t </td>\n <td class=\"S10d\">\n\t\t\t\t ".toCharArray(); text[121] = "\n\t\t\t\t </td>\n <td>\n\t\t\t\t ".toCharArray(); text[122] = "\n\t\t\t\t </td>\n </tr> \n </table>\n <table width=\"100%\" align=\"center\" class=\"soloborde\" bgcolor=\"#C1C1FF\" border=\"1\">\n <tr>\n <td class=\"S10d\">\n\t\t\t\t ".toCharArray(); text[123] = "\n\t\t\t\t </td>\n <td>\n\t\t\t\t ".toCharArray(); text[124] = "\n\t\t\t\t </td>\n </tr>\n <tr>\n <td class=\"S10d\">\n\t\t\t\t ".toCharArray(); text[125] = "\n\t\t\t\t </td>\n <td>\n\t\t\t\t ".toCharArray(); text[126] = "\n\t\t\t\t </td>\n </tr>\n </table>\n <table width=\"100%\" align=\"center\" class=\"soloborde\" bgcolor=\"#C1C1FF\" border=\"1\"> \n <tr>\n <td class=\"S10d\">\n\t\t\t\t ".toCharArray(); text[127] = "\n\t\t\t\t </td>\n <td>\n\t\t\t\t ".toCharArray(); text[128] = "\n\t\t\t\t </td>\n <td class=\"S10d\">\n\t\t\t\t ".toCharArray(); text[129] = "\n\t\t\t\t </td>\n <td>\n\t\t\t\t ".toCharArray(); text[130] = "\n\t\t\t\t </td>\n </tr>\n <tr>\n <td class=\"S10d\">\n\t\t\t\t ".toCharArray(); text[131] = "\n\t\t\t\t </td>\n <td>\n\t\t\t\t ".toCharArray(); text[132] = "\n\t\t\t\t </td>\n <td class=\"S10d\">\n\t\t\t\t ".toCharArray(); text[133] = "\n\t\t\t\t </td>\n <td>\n\t\t\t\t ".toCharArray(); text[134] = "\n\t\t\t\t </td>\n </tr>\n <tr>\n <td class=\"S10d\">\n\t\t\t\t ".toCharArray(); text[135] = "\n\t\t\t\t </td>\n <td>\n\t\t\t\t ".toCharArray(); text[136] = "\n\t\t\t\t </td>\n <td class=\"S10d\">\n\t\t\t\t ".toCharArray(); text[137] = "\n\t\t\t\t </td>\n <td>\n\t\t\t\t ".toCharArray(); text[138] = "\n\t\t\t\t </td>\n </tr>\n <tr>\n <td class=\"S10d\">\n\t\t\t\t ".toCharArray(); text[139] = "\n\t\t\t\t </td>\n <td>\n\t\t\t\t ".toCharArray(); text[140] = "\n\t\t\t\t </td>\n <td class=\"S10d\">\n\t\t\t\t ".toCharArray(); text[141] = "\n\t\t\t\t </td>\n <td>\n\t\t\t\t ".toCharArray(); text[142] = "\n\t\t\t\t </td>\n </tr>\n <tr>\n <td class=\"S10d\">\n\t\t\t\t ".toCharArray(); text[143] = "\n\t\t\t\t </td>\n <td>\n\t\t\t\t ".toCharArray(); text[144] = "\n\t\t\t\t </td>\n <td class=\"S10d\">\n\t\t\t\t ".toCharArray(); text[145] = "\n\t\t\t\t </td>\n <td>\n\t\t\t\t ".toCharArray(); text[146] = "\n\t\t\t\t </td>\n </tr>\n <tr>\n <td class=\"S10d\">\n\t\t\t\t ".toCharArray(); text[147] = "\n\t\t\t\t </td>\n <td>\n\t\t\t\t ".toCharArray(); text[148] = "\n\t\t\t\t </td>\n <td class=\"S10d\"> \n\t\t\t\t ".toCharArray(); text[149] = "\n\t\t\t\t </td>\n <td>\n\t\t\t\t ".toCharArray(); text[150] = "\n\t\t\t\t </td>\n </tr>\n <tr>\n <td class=\"S10d\">\n\t\t\t\t ".toCharArray(); text[151] = "\n\t\t\t\t </td>\n <td>\n\t\t\t\t ".toCharArray(); text[152] = "\n\t\t\t\t </td>\n <td class=\"S10d\">\n\t\t\t\t ".toCharArray(); text[153] = "\n\t\t\t\t </td>\n <td>\n\t\t\t\t ".toCharArray(); text[154] = "\n\t\t\t\t </td>\n </tr>\n <tr>\n <td class=\"S10d\">\n\t\t\t\t ".toCharArray(); text[155] = "\n\t\t\t\t </td>\n <td>\n\t\t\t\t ".toCharArray(); text[156] = "\n\t\t\t\t </td>\n </tr>\n <tr>\n <td colspan=2>\n\t\t\t\t ".toCharArray(); text[157] = "\n\t\t\t\t </td>\n </tr> \n </table> \n ".toCharArray(); text[158] = " \n ".toCharArray(); text[159] = "\n ".toCharArray(); text[160] = "\n <table width=\"100%\" align=\"center\" class=\"soloborde\" bgcolor=\"#C1C1FF\">\n <tr>\n <td class=\"S10d\">\n ".toCharArray(); text[161] = "\n </td>\n <td>\n\t\t\t ".toCharArray(); text[162] = "\n ".toCharArray(); text[163] = "\n ".toCharArray(); text[164] = "\n\t\t\t </td>\n </tr>\n <tr>\n <td class=\"S10d\">\n\t\t\t ".toCharArray(); text[165] = "\n\t\t\t </td>\n <td>\n\t\t\t ".toCharArray(); text[166] = "\n ".toCharArray(); text[167] = "\n\t\t\t </td>\n </tr> \n <tr>\n <td class=\"S10d\">\n\t\t\t ".toCharArray(); text[168] = "\n\t\t\t </td>\n <td>\n\t\t\t ".toCharArray(); text[169] = "\n ".toCharArray(); text[170] = "\n\t\t\t </td>\n </tr> \n ".toCharArray(); text[171] = "\n <tr>\n <td>\n\t\t\t </td>\n <td align=\"left\">\n ".toCharArray(); text[172] = "\n </td>\n </tr>\n ".toCharArray(); text[173] = " \n ".toCharArray(); text[174] = "\n <tr>\n <td>\n\t\t\t </td>\n <td align=\"left\">\n ".toCharArray(); text[175] = "\n </td>\n </tr>\n ".toCharArray(); text[176] = " \n ".toCharArray(); text[177] = "\n <tr>\n <td>\n\t\t\t </td>\n <td align=\"left\">\n ".toCharArray(); text[178] = "\n </td>\n </tr>\n ".toCharArray(); text[179] = " \n </table>\n ".toCharArray(); text[180] = " \n ".toCharArray(); text[181] = "\n <table width=\"100%\" align=\"center\" class=\"soloborde\" bgcolor=\"#C1C1FF\">\n <tr>\n <td class=\"S10d\">\n ".toCharArray(); text[182] = "\n </td>\n <td>\n\t\t\t ".toCharArray(); text[183] = "\n ".toCharArray(); text[184] = " \n </td>\n </tr>\n <tr>\n <td class=\"S10d\">\n\t\t\t ".toCharArray(); text[185] = "\n\t\t\t </td>\n <td>\n\t\t\t ".toCharArray(); text[186] = "\n ".toCharArray(); text[187] = "\n\t\t\t </td>\n </tr> \n <tr>\n <td class=\"S10d\">\n\t\t\t ".toCharArray(); text[188] = "\n\t\t\t </td>\n <td>\n\t\t\t ".toCharArray(); text[189] = "\n ".toCharArray(); text[190] = "\n\t\t\t </td>\n </tr> \n <tr>\n <td class=\"S10d\">\n\t\t\t ".toCharArray(); text[191] = "\n\t\t\t </td>\n <td>\n ".toCharArray(); text[192] = "\n ".toCharArray(); text[193] = "\n ".toCharArray(); text[194] = "\n </td>\n </tr> \n <tr>\n <td class=\"S10d\">\n\t\t\t ".toCharArray(); text[195] = " % = Comodin\n\t\t\t </td>\n <td>\n\t\t\t ".toCharArray(); text[196] = "\n\t\t\t </td>\n </tr> \n ".toCharArray(); text[197] = "\n <tr>\n <td>\n\t\t\t </td>\n <td align=\"left\">\n ".toCharArray(); text[198] = "\n </td>\n </tr>\n ".toCharArray(); text[199] = " \n ".toCharArray(); text[200] = "\n <tr>\n <td>\n\t\t\t </td>\n <td align=\"left\">\n ".toCharArray(); text[201] = "\n </td>\n </tr>\n ".toCharArray(); text[202] = " \n ".toCharArray(); text[203] = "\n <tr>\n <td>\n\t\t\t </td>\n <td align=\"left\">\n ".toCharArray(); text[204] = "\n </td>\n </tr>\n ".toCharArray(); text[205] = " \n </table>\n ".toCharArray(); text[206] = "\n ".toCharArray(); text[207] = "\n <table width=\"100%\" align=\"center\" class=\"soloborde\" bgcolor=\"#C1C1FF\" border=\"1\">\n <tr class=\"T8a\">\n <td>\n <table width=\"100%\" align=\"center\" class=\"soloborde\" bgcolor=\"#C1C1FF\" border=\"1\">\n <tr>\n\t\t\t <td>\n ".toCharArray(); text[208] = "\n ".toCharArray(); text[209] = "\n ".toCharArray(); text[210] = "\n ".toCharArray(); text[211] = " \n ".toCharArray(); text[212] = "\n <table width=\"100%\" class=\"soloborde\" bgcolor=\"#C1C1FF\">\n <tr class=\"FondoAzul\">\n <td width=\"60\" scope=\"col\" class=\"S10c\">Código</td>\n <td width=\"60\" scope=\"col\" class=\"S10c\">Grupo</td>\n <td width=\"160\" scope=\"col\" class=\"S10c\">Descripción</td>\n <td></td>\n </tr>\n ".toCharArray(); text[213] = "\n ".toCharArray(); text[214] = "\n ".toCharArray(); text[215] = "\n <tr class=\"T8b\">\n ".toCharArray(); text[216] = "\n <tr class=\"T8a\">\n ".toCharArray(); text[217] = "\n <td>\n\t\t\t\t\t\t ".toCharArray(); text[218] = "-".toCharArray(); text[219] = "-".toCharArray(); text[220] = "\n\t\t\t\t\t\t </td>\n <td>\n\t\t\t\t\t\t ".toCharArray(); text[221] = "\n\t\t\t\t\t\t </td>\n <td>\n\t\t\t\t\t\t ".toCharArray(); text[222] = "\n\t\t\t\t\t\t </td>\n ".toCharArray(); text[223] = "\n <td align=\"right\">\n\t\t\t\t\t\t ".toCharArray(); text[224] = "\n\t\t\t\t\t\t </td>\n ".toCharArray(); text[225] = " \n </tr>\n ".toCharArray(); text[226] = "\n ".toCharArray(); text[227] = "\n </table>\n </td>\n \t\t </tr> \n </table>\n </td>\n </tr>\n </table>\n ".toCharArray(); text[228] = "\n ".toCharArray(); text[229] = "\n </td>\n </tr>\n <tr>\n <td align=\"center\" colspan=\"2\" class=\"S10d\">\n (*) Campos Obligatorios\n </td>\n </tr>\n</table>\n</body>\n</html>".toCharArray(); } catch (Throwable th) { System.err.println(th); } } } } <file_sep>package ActivosFijos; import org.apache.struts.action.ActionForm; import org.apache.struts.action.ActionErrors; import org.apache.struts.action.ActionError; import org.apache.struts.action.ActionMapping; import javax.servlet.http.HttpServletRequest; public class ReporteDepreciacionesForm extends ActionForm { String dpr_codrub; String dpr_codreg; int dpr_codigo; int dpr_numrevaluo; int dpr_numdepreciacion; String dpr_fecha; double dpr_tipcam; double dpr_tipufv; double dpr_factorbol; double dpr_factordol; double dpr_factorufv; double dpr_actuvalbol; double dpr_actuvaldol; double dpr_actuvalufv; double dpr_actufacbol; double dpr_actufacdol; double dpr_actufacufv; private String boton; private int fila; private int operacion; private int opcion; /** * Reset all properties to their default values. * @param mapping The ActionMapping used to select this instance. * @param request The HTTP Request we are processing. */ public void reset(ActionMapping mapping, HttpServletRequest request) { super.reset(mapping, request); } /** * Validate all properties to their default values. * @param mapping The ActionMapping used to select this instance. * @param request The HTTP Request we are processing. * @return ActionErrors A list of all errors found. */ public ActionErrors validate(ActionMapping mapping, HttpServletRequest request) { return super.validate(mapping, request); } public String getDpr_codrub() { return dpr_codrub; } public void setDpr_codrub(String newDpr_codrub) { dpr_codrub = newDpr_codrub; } public String getDpr_codreg() { return dpr_codreg; } public void setDpr_codreg(String newDpr_codreg) { dpr_codreg = newDpr_codreg; } public int getDpr_codigo() { return dpr_codigo; } public void setDpr_codigo(int newDpr_codigo) { dpr_codigo = newDpr_codigo; } public int getDpr_numrevaluo() { return dpr_numrevaluo; } public void setDpr_numrevaluo(int newDpr_numrevaluo) { dpr_numrevaluo = newDpr_numrevaluo; } public int getDpr_numdepreciacion() { return dpr_numdepreciacion; } public void setDpr_numdepreciacion(int newDpr_numdepreciacion) { dpr_numdepreciacion = newDpr_numdepreciacion; } public String getDpr_fecha() { return dpr_fecha; } public void setDpr_fecha(String newDpr_fecha) { dpr_fecha = newDpr_fecha; } public double getDpr_tipcam() { return dpr_tipcam; } public void setDpr_tipcam(double newDpr_tipcam) { dpr_tipcam = newDpr_tipcam; } public double getDpr_tipufv() { return dpr_tipufv; } public void setDpr_tipufv(double newDpr_tipufv) { dpr_tipufv = newDpr_tipufv; } public double getDpr_factorbol() { return dpr_factorbol; } public void setDpr_factorbol(double newDpr_factorbol) { dpr_factorbol = newDpr_factorbol; } public double getDpr_factordol() { return dpr_factordol; } public void setDpr_factordol(double newDpr_factordol) { dpr_factordol = newDpr_factordol; } public double getDpr_factorufv() { return dpr_factorufv; } public void setDpr_factorufv(double newDpr_factorufv) { dpr_factorufv = newDpr_factorufv; } public double getDpr_actuvalbol() { return dpr_actuvalbol; } public void setDpr_actuvalbol(double newDpr_actuvalbol) { dpr_actuvalbol = newDpr_actuvalbol; } public double getDpr_actuvaldol() { return dpr_actuvaldol; } public void setDpr_actuvaldol(double newDpr_actuvaldol) { dpr_actuvaldol = newDpr_actuvaldol; } public double getDpr_actuvalufv() { return dpr_actuvalufv; } public void setDpr_actuvalufv(double newDpr_actuvalufv) { dpr_actuvalufv = newDpr_actuvalufv; } public double getDpr_actufacbol() { return dpr_actufacbol; } public void setDpr_actufacbol(double newDpr_actufacbol) { dpr_actufacbol = newDpr_actufacbol; } public double getDpr_actufacdol() { return dpr_actufacdol; } public void setDpr_actufacdol(double newDpr_actufacdol) { dpr_actufacdol = newDpr_actufacdol; } public double getDpr_actufacufv() { return dpr_actufacufv; } public void setDpr_actufacufv(double newDpr_actufacufv) { dpr_actufacufv = newDpr_actufacufv; } public void setBoton(String newBoton) { boton = newBoton; } public String getBoton(int index) { return boton; } public void setBoton(int index, String newBoton) { boton = newBoton; fila = index; } public int getFila() { return fila; } public void setFila(int newFila) { fila = newFila; } public int getOperacion() { return operacion; } public void setOperacion(int newOperacion) { operacion = newOperacion; } public int getOpcion() { return opcion; } public void setOpcion(int newOpcion) { opcion = newOpcion; } } <file_sep>package ActivosFijos; import org.apache.struts.action.ActionForm; import org.apache.struts.action.ActionErrors; import org.apache.struts.action.ActionError; import org.apache.struts.action.ActionMapping; import javax.servlet.http.HttpServletRequest; public class MejorasRebajasDetalleForm extends ActionForm { String codrub; String codreg; int codigo; String inmejreb; String fecha; double tipcam; double tipufv; String descripcion; String desadicional; String proveedor; String docreferencia; String fecreferencia; double valbol; double valdol; double valufv; int numfactura; String numcomprobante; int corel; String marca; String modelo; String serie; String ordencompra; String rfecha; int vidaut; String estadoactivo; String desestado; String numdocumento; String desactivo; /** * Reset all properties to their default values. * @param mapping The ActionMapping used to select this instance. * @param request The HTTP Request we are processing. */ public void reset(ActionMapping mapping, HttpServletRequest request) { super.reset(mapping, request); } /** * Validate all properties to their default values. * @param mapping The ActionMapping used to select this instance. * @param request The HTTP Request we are processing. * @return ActionErrors A list of all errors found. */ public ActionErrors validate(ActionMapping mapping, HttpServletRequest request) { return super.validate(mapping, request); } public String getcodrub() { return codrub; } public void setcodrub(String newcodrub) { codrub = newcodrub; } public String getcodreg() { return codreg; } public void setcodreg(String newcodreg) { codreg = newcodreg; } public int getcodigo() { return codigo; } public void setcodigo(int newcodigo) { codigo = newcodigo; } public String getinmejreb() { return inmejreb; } public void setinmejreb(String newinmejreb) { inmejreb = newinmejreb; } public String getfecha() { return fecha; } public void setfecha(String newfecha) { fecha = newfecha; } public double gettipcam() { return tipcam; } public void settipcam(double newtipcam) { tipcam = newtipcam; } public double gettipufv() { return tipufv; } public void settipufv(double newtipufv) { tipufv = newtipufv; } public String getdescripcion() { return descripcion; } public void setdescripcion(String newdescripcion) { descripcion = newdescripcion; } public String getdesadicional() { return desadicional; } public void setdesadicional(String newdesadicional) { desadicional = newdesadicional; } public String getproveedor() { return proveedor; } public void setproveedor(String newproveedor) { proveedor = newproveedor; } public String getdocreferencia() { return docreferencia; } public void setdocreferencia(String newdocreferencia) { docreferencia = newdocreferencia; } public String getfecreferencia() { return fecreferencia; } public void setfecreferencia(String newfecreferencia) { fecreferencia = newfecreferencia; } public double getvalbol() { return valbol; } public void setvalbol(double newvalbol) { valbol = newvalbol; } public double getvaldol() { return valdol; } public void setvaldol(double newvaldol) { valdol = newvaldol; } public double getvalufv() { return valufv; } public void setvalufv(double newvalufv) { valufv = newvalufv; } public int getnumfactura() { return numfactura; } public void setnumfactura(int newnumfactura) { numfactura = newnumfactura; } public String getnumcomprobante() { return numcomprobante; } public void setnumcomprobante(String newnumcomprobante) { numcomprobante = newnumcomprobante; } public int getcorel() { return corel; } public void setcorel(int newCorel) { corel = newCorel; } public String getmarca() { return marca; } public void setmarca(String newMarca) { marca = newMarca; } public String getmodelo() { return modelo; } public void setmodelo(String newModelo) { modelo = newModelo; } public String getserie() { return serie; } public void setserie(String newSerie) { serie = newSerie; } public String getordencompra() { return ordencompra; } public void setordencompra(String newOrdencompra) { ordencompra = newOrdencompra; } public String getRfecha() { return rfecha; } public void setRfecha(String newRfecha) { rfecha = newRfecha; } public int getVidaut() { return vidaut; } public void setVidaut(int newVidaut) { vidaut = newVidaut; } public String getEstadoactivo() { return estadoactivo; } public void setEstadoactivo(String newEstadoactivo) { estadoactivo = newEstadoactivo; } public String getDesestado() { return desestado; } public void setDesestado(String newDesestado) { desestado = newDesestado; } public String getNumdocumento() { return numdocumento; } public void setNumdocumento(String newNumdocumento) { numdocumento = newNumdocumento; } public String getDesactivo() { return desactivo; } public void setDesactivo(String newDesactivo) { desactivo = newDesactivo; } }<file_sep>package ActivosFijos; import org.apache.struts.action.ActionForm; import org.apache.struts.action.ActionErrors; import org.apache.struts.action.ActionError; import org.apache.struts.action.ActionMapping; import javax.servlet.http.HttpServletRequest; public class TipocambioForm extends ActionForm { String tca_fecha; double tca_tipcam; double tca_tipufv; private String boton; private int fila; private int operacion; private int opcion; /** * Reset all properties to their default values. * @param mapping The ActionMapping used to select this instance. * @param request The HTTP Request we are processing. */ public void reset(ActionMapping mapping, HttpServletRequest request) { super.reset(mapping, request); } /** * Validate all properties to their default values. * @param mapping The ActionMapping used to select this instance. * @param request The HTTP Request we are processing. * @return ActionErrors A list of all errors found. */ public ActionErrors validate(ActionMapping mapping, HttpServletRequest request) { return super.validate(mapping, request); } public String getTca_fecha() { return tca_fecha; } public void setTca_fecha(String newTca_fecha) { tca_fecha = newTca_fecha; } public double getTca_tipcam() { return tca_tipcam; } public void setTca_tipcam(double newTca_tipcam) { tca_tipcam = newTca_tipcam; } public double getTca_tipufv() { return tca_tipufv; } public void setTca_tipufv(double newTca_tipufv) { tca_tipufv = newTca_tipufv; } public String getBoton() { return boton; } public void setBoton(String newBoton) { boton = newBoton; } public String getBoton(int index) { return boton; } public void setBoton(int index, String newBoton) { boton = newBoton; fila = index; } public int getFila() { return fila; } public void setFila(int newFila) { fila = newFila; } public int getOperacion() { return operacion; } public void setOperacion(int newOperacion) { operacion = newOperacion; } public int getOpcion() { return opcion; } public void setOpcion(int newOpcion) { opcion = newOpcion; } }<file_sep>package ActivosFijos; import org.apache.struts.action.ActionForm; import org.apache.struts.action.ActionErrors; import org.apache.struts.action.ActionError; import org.apache.struts.action.ActionMapping; import javax.servlet.http.HttpServletRequest; public class DetDocumentosForm extends ActionForm { String ddo_codreg; String ddo_tipdoc; int ddo_numero; int ddo_item; String ddo_codrubactual; String ddo_codregactual; String ddo_codigo; /** * Reset all properties to their default values. * @param mapping The ActionMapping used to select this instance. * @param request The HTTP Request we are processing. */ public void reset(ActionMapping mapping, HttpServletRequest request) { super.reset(mapping, request); } /** * Validate all properties to their default values. * @param mapping The ActionMapping used to select this instance. * @param request The HTTP Request we are processing. * @return ActionErrors A list of all errors found. */ public ActionErrors validate(ActionMapping mapping, HttpServletRequest request) { return super.validate(mapping, request); } public String getDdo_codreg() { return ddo_codreg; } public void setDdo_codreg(String newCodreg) { ddo_codreg = newCodreg; } public String getDdo_tipdoc() { return ddo_tipdoc; } public void setDdo_tipdoc(String newTipdoc) { ddo_tipdoc = newTipdoc; } public int getDdo_numero() { return ddo_numero; } public void setDdo_numero(int newNumero) { ddo_numero = newNumero; } public int getDdo_item() { return ddo_item; } public void setDdo_item(int newItem) { ddo_item = newItem; } public String getDdo_codregactual() { return ddo_codregactual; } public void setDdo_codregactual(String newDdo_codregactual) { ddo_codregactual = newDdo_codregactual; } public String getDdo_codigo() { return ddo_codigo; } public void setDdo_codigo(String newCodigo) { ddo_codigo = newCodigo; } public String getDdo_codrubactual() { return ddo_codrubactual; } public void setDdo_codrubactual(String newDdo_codrubactual) { ddo_codrubactual = newDdo_codrubactual; } }<file_sep>package ActivosFijos; import org.apache.struts.action.ActionForm; import org.apache.struts.action.ActionErrors; import org.apache.struts.action.ActionError; import org.apache.struts.action.ActionMapping; import javax.servlet.http.HttpServletRequest; public class MesAnioDetalleForm extends ActionForm { String mes; String anio; /** * Reset all properties to their default values. * @param mapping The ActionMapping used to select this instance. * @param request The HTTP Request we are processing. */ public void reset(ActionMapping mapping, HttpServletRequest request) { super.reset(mapping, request); } /** * Validate all properties to their default values. * @param mapping The ActionMapping used to select this instance. * @param request The HTTP Request we are processing. * @return ActionErrors A list of all errors found. */ public ActionErrors validate(ActionMapping mapping, HttpServletRequest request) { return super.validate(mapping, request); } public String getMes() { return mes; } public void setMes(String newMes) { mes = newMes; } public String getAnio() { return anio; } public void setAnio(String newAnio) { anio = newAnio; } }<file_sep>package ActivosFijos; import org.apache.struts.action.ActionForm; import org.apache.struts.action.ActionErrors; import org.apache.struts.action.ActionError; import org.apache.struts.action.ActionMapping; import javax.servlet.http.HttpServletRequest; public class DepreciacionesForm extends ActionForm { String dpr_fecha; double dpr_tipcamini; double dpr_tipcamfin; double dpr_tipufvini; double dpr_tipufvfin; private String boton; private int fila; private int operacion; private int opcion; String mes; String anio; String dep_codrub; String dep_codreg; String cod_inicial; String cod_final; /** * Reset all properties to their default values. * @param mapping The ActionMapping used to select this instance. * @param request The HTTP Request we are processing. */ public void reset(ActionMapping mapping, HttpServletRequest request) { super.reset(mapping, request); } /** * Validate all properties to their default values. * @param mapping The ActionMapping used to select this instance. * @param request The HTTP Request we are processing. * @return ActionErrors A list of all errors found. */ public ActionErrors validate(ActionMapping mapping, HttpServletRequest request) { return super.validate(mapping, request); } public String getDpr_fecha() { return dpr_fecha; } public void setDpr_fecha(String newDpr_fecha) { dpr_fecha = newDpr_fecha; } public double getDpr_tipcamini() { return dpr_tipcamini; } public void setDpr_tipcamini(double newDpr_tipcamini) { dpr_tipcamini = newDpr_tipcamini; } public double getDpr_tipcamfin() { return dpr_tipcamfin; } public void setDpr_tipcamfin(double newDpr_tipcamfin) { dpr_tipcamfin = newDpr_tipcamfin; } public double getDpr_tipufvini() { return dpr_tipufvini; } public void setDpr_tipufvini(double newDpr_tipufvini) { dpr_tipufvini = newDpr_tipufvini; } public double getDpr_tipufvfin() { return dpr_tipufvfin; } public void setDpr_tipufvfin(double newDpr_tipufvfin) { dpr_tipufvfin = newDpr_tipufvfin; } public void setBoton(String newBoton) { boton = newBoton; } public String getBoton(int index) { return boton; } public void setBoton(int index, String newBoton) { boton = newBoton; fila = index; } public int getFila() { return fila; } public void setFila(int newFila) { fila = newFila; } public int getOperacion() { return operacion; } public void setOperacion(int newOperacion) { operacion = newOperacion; } public int getOpcion() { return opcion; } public void setOpcion(int newOpcion) { opcion = newOpcion; } public String getMes() { return mes; } public void setMes(String newMes) { mes = newMes; } public String getAnio() { return anio; } public void setAnio(String newAnio) { anio = newAnio; } public String getDep_codrub() { return dep_codrub; } public void setDep_codrub(String newDep_codrub) { dep_codrub = newDep_codrub; } public String getDep_codreg() { return dep_codreg; } public void setDep_codreg(String newDep_codreg) { dep_codreg = newDep_codreg; } public String getCod_inicial() { return cod_inicial; } public void setCod_inicial(String newCod_inicial) { cod_inicial = newCod_inicial; } public String getCod_final() { return cod_final; } public void setCod_final(String newCod_final) { cod_final = newCod_final; } } <file_sep>package ActivosFijos; import org.apache.struts.action.ActionForm; import org.apache.struts.action.ActionErrors; import org.apache.struts.action.ActionError; import org.apache.struts.action.ActionMapping; import javax.servlet.http.HttpServletRequest; public class ParametrosForm extends ActionForm { private String boton; private int fila; private int operacion; private int opcion; String cte_codinstitucion; String cte_codrubaccesorios; String cte_codrubmejoras; String cte_codrubrebajas; String cte_codrub1; String cte_codrub2; String cte_codrub3; String cte_codrub4; String cte_codrub5; String cte_codrub6; String cte_tipdocentrega; String cte_tipdocdevolucion; String cte_tipdoctransferencia; String cte_tipdocbaja; String cte_gestion; String cte_tipdoctraregionales; /** * Reset all properties to their default values. * @param mapping The ActionMapping used to select this instance. * @param request The HTTP Request we are processing. */ public void reset(ActionMapping mapping, HttpServletRequest request) { super.reset(mapping, request); } /** * Validate all properties to their default values. * @param mapping The ActionMapping used to select this instance. * @param request The HTTP Request we are processing. * @return ActionErrors A list of all errors found. */ public ActionErrors validate(ActionMapping mapping, HttpServletRequest request) { return super.validate(mapping, request); } public String getBoton() { return boton; } public void setBoton(String newBoton) { boton = newBoton; } public String getBoton(int index) { return boton; } public void setBoton(int index, String newBoton) { boton = newBoton; fila = index; } public int getFila() { return fila; } public void setFila(int newFila) { fila = newFila; } public int getOperacion() { return operacion; } public void setOperacion(int newOperacion) { operacion = newOperacion; } public int getOpcion() { return opcion; } public void setOpcion(int newOpcion) { opcion = newOpcion; } public String getCte_codinstitucion() { return cte_codinstitucion; } public void setCte_codinstitucion(String newCte_codinstitucion) { cte_codinstitucion = newCte_codinstitucion; } public String getCte_codrubaccesorios() { return cte_codrubaccesorios; } public void setCte_codrubaccesorios(String newCte_codrubaccesorios) { cte_codrubaccesorios = newCte_codrubaccesorios; } public String getCte_codrubmejoras() { return cte_codrubmejoras; } public void setCte_codrubmejoras(String newCte_codrubmejoras) { cte_codrubmejoras = newCte_codrubmejoras; } public String getCte_codrubrebajas() { return cte_codrubrebajas; } public void setCte_codrubrebajas(String newCte_codrubrebajas) { cte_codrubrebajas = newCte_codrubrebajas; } public String getCte_codrub1() { return cte_codrub1; } public void setCte_codrub1(String newCte_codrub1) { cte_codrub1 = newCte_codrub1; } public String getCte_codrub2() { return cte_codrub2; } public void setCte_codrub2(String newCte_codrub2) { cte_codrub2 = newCte_codrub2; } public String getCte_codrub3() { return cte_codrub3; } public void setCte_codrub3(String newCte_codrub3) { cte_codrub3 = newCte_codrub3; } public String getCte_codrub4() { return cte_codrub4; } public void setCte_codrub4(String newCte_codrub4) { cte_codrub4 = newCte_codrub4; } public String getCte_codrub5() { return cte_codrub5; } public void setCte_codrub5(String newCte_codrub5) { cte_codrub5 = newCte_codrub5; } public String getCte_codrub6() { return cte_codrub6; } public void setCte_codrub6(String newCte_codrub6) { cte_codrub6 = newCte_codrub6; } public String getCte_tipdocentrega() { return cte_tipdocentrega; } public void setCte_tipdocentrega(String newCte_tipdocentrega) { cte_tipdocentrega = newCte_tipdocentrega; } public String getCte_tipdocdevolucion() { return cte_tipdocdevolucion; } public void setCte_tipdocdevolucion(String newCte_tipdocdevolucion) { cte_tipdocdevolucion = newCte_tipdocdevolucion; } public String getCte_tipdoctransferencia() { return cte_tipdoctransferencia; } public void setCte_tipdoctransferencia(String newCte_tipdoctransferencia) { cte_tipdoctransferencia = newCte_tipdoctransferencia; } public String getCte_tipdoctraregionales() { return cte_tipdoctraregionales; } public void setCte_tipdoctraregionales(String newCte_tipdoctraregionales) { cte_tipdoctraregionales = newCte_tipdoctraregionales; } public String getCte_tipdocbaja() { return cte_tipdocbaja; } public void setCte_tipdocbaja(String newCte_tipdocbaja) { cte_tipdocbaja = newCte_tipdocbaja; } public String getCte_gestion() { return cte_gestion; } public void setCte_gestion(String newCte_gestion) { cte_gestion = newCte_gestion; } }<file_sep><!-- Original: <NAME> (<EMAIL>) --> <!-- Web Site: http://www.spiritwolfx.com --> <!-- This script and many more are available free online at --> <!-- The JavaScript Source!! http://javascript.internet.com --> <!-- Begin // Check browser version var isNav4 = false, isNav5 = false, isIE4 = false var strSeperator = "/"; // If you are using any Java validation on the back side you will want to use the / because // Java date validations do not recognize the dash as a valid date separator. var vDateType = 3; // Global value for type of date format // 1 = mm/dd/yyyy // 2 = yyyy/dd/mm (Unable to do date check at this time) // 3 = dd/mm/yyyy var vYearType = 4; //Set to 2 or 4 for number of digits in the year for Netscape var vYearLength = 2; // Set to 4 if you want to force the user to enter 4 digits for the year before validating. var err = 0; // Set the error code to a default of zero if(navigator.appName == "Netscape") { if (navigator.appVersion < "5") { isNav4 = true; isNav5 = false; } else if (navigator.appVersion > "4") { isNav4 = false; isNav5 = true; } } else { isIE4 = true; } function DateFormat(vDateName, vDateValue, e, dateCheck, dateType) { vDateType = dateType; // vDateName = object name // vDateValue = value in the field being checked // e = event // dateCheck // True = Verify that the vDateValue is a valid date // False = Format values being entered into vDateValue only // vDateType // 1 = mm/dd/yyyy // 2 = yyyy/mm/dd // 3 = dd/mm/yyyy //Enter a tilde sign for the first number and you can check the variable information. if (vDateValue == "~") { alert("AppVersion = "+navigator.appVersion+" \nNav. 4 Version = "+isNav4+" \nNav. 5 Version = "+isNav5+" \nIE Version = "+isIE4+" \nYear Type = "+vYearType+" \nDate Type = "+vDateType+" \nSeparator = "+strSeperator); vDateName.value = ""; vDateName.focus(); return true; } var whichCode = (window.Event) ? e.which : e.keyCode; // Check to see if a seperator is already present. // bypass the date if a seperator is present and the length greater than 8 if (vDateValue.length > 8 && isNav4) { if ((vDateValue.indexOf("-") >= 1) || (vDateValue.indexOf("/") >= 1)) return true; } //Eliminate all the ASCII codes that are not valid var alphaCheck = " abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ/-"; if (alphaCheck.indexOf(vDateValue) >= 1) { if (isNav4) { vDateName.value = ""; vDateName.focus(); vDateName.select(); return false; } else { vDateName.value = vDateName.value.substr(0, (vDateValue.length-1)); return false; } } if (whichCode == 8) //Ignore the Netscape value for backspace. IE has no value return false; else { //Create numeric string values for 0123456789/ //The codes provided include both keyboard and keypad values var strCheck = '13,47,48,49,50,51,52,53,54,55,56,57,58,59,95,96,97,98,99,100,101,102,103,104,105'; if (strCheck.indexOf(whichCode) != -1) { if (isNav4) { if (((vDateValue.length < 6 && dateCheck) || (vDateValue.length == 7 && dateCheck)) && (vDateValue.length >=1)) { alert("Fecha Invalida"); vDateName.value = ""; vDateName.focus(); vDateName.select(); return false; } if (vDateValue.length == 6 && dateCheck) { var mDay = vDateName.value.substr(2,2); var mMonth = vDateName.value.substr(0,2); var mYear = vDateName.value.substr(4,4) //Turn a two digit year into a 4 digit year if (mYear.length == 2 && vYearType == 4) { var mToday = new Date(); //If the year is greater than 30 years from now use 19, otherwise use 20 var checkYear = mToday.getFullYear() + 30; var mCheckYear = '20' + mYear; if (mCheckYear >= checkYear) mYear = '19' + mYear; else mYear = '20' + mYear; } var vDateValueCheck = mMonth+strSeperator+mDay+strSeperator+mYear; if (!dateValid(vDateValueCheck)) { alert("Fecha Invalida"); vDateName.value = ""; vDateName.focus(); vDateName.select(); return false; } return true; } else { // Reformat the date for validation and set date type to a 1 if (vDateValue.length >= 8 && dateCheck) { if (vDateType == 1) // mmddyyyy { var mDay = vDateName.value.substr(2,2); var mMonth = vDateName.value.substr(0,2); var mYear = vDateName.value.substr(4,4) vDateName.value = mMonth+strSeperator+mDay+strSeperator+mYear; } if (vDateType == 2) // yyyymmdd { var mYear = vDateName.value.substr(0,4) var mMonth = vDateName.value.substr(4,2); var mDay = vDateName.value.substr(6,2); vDateName.value = mYear+strSeperator+mMonth+strSeperator+mDay; } if (vDateType == 3) // ddmmyyyy { var mMonth = vDateName.value.substr(2,2); var mDay = vDateName.value.substr(0,2); var mYear = vDateName.value.substr(4,4) vDateName.value = mDay+strSeperator+mMonth+strSeperator+mYear; } //Create a temporary variable for storing the DateType and change //the DateType to a 1 for validation. var vDateTypeTemp = vDateType; vDateType = 1; var vDateValueCheck = mMonth+strSeperator+mDay+strSeperator+mYear; if (!dateValid(vDateValueCheck)) { alert("Fecha Invalida"); vDateType = vDateTypeTemp; vDateName.value = ""; vDateName.focus(); vDateName.select(); return false; } vDateType = vDateTypeTemp; return true; } else { if (((vDateValue.length < 8 && dateCheck) || (vDateValue.length == 9 && dateCheck)) && (vDateValue.length >=1)) { alert("Fecha Invalida"); vDateName.value = ""; vDateName.focus(); vDateName.select(); return false; } } } } else { // Non isNav Check if (((vDateValue.length < 8 && dateCheck) || (vDateValue.length == 9 && dateCheck)) && (vDateValue.length >=1)) { alert("Fecha Invalida"); vDateName.value = ""; vDateName.focus(); return true; } // Reformat date to format that can be validated. mm/dd/yyyy if (vDateValue.length >= 8 && dateCheck) { // Additional date formats can be entered here and parsed out to // a valid date format that the validation routine will recognize. if (vDateType == 1) // mm/dd/yyyy { var mMonth = vDateName.value.substr(0,2); var mDay = vDateName.value.substr(3,2); var mYear = vDateName.value.substr(6,4) } if (vDateType == 2) // yyyy/mm/dd { var mYear = vDateName.value.substr(0,4) var mMonth = vDateName.value.substr(5,2); var mDay = vDateName.value.substr(8,2); } if (vDateType == 3) // dd/mm/yyyy { var mDay = vDateName.value.substr(0,2); var mMonth = vDateName.value.substr(3,2); var mYear = vDateName.value.substr(6,4) } if (vYearLength == 4) { if (mYear.length < 4) { alert("Fecha Invalida"); vDateName.value = ""; vDateName.focus(); return true; } } // Create temp. variable for storing the current vDateType var vDateTypeTemp = vDateType; // Change vDateType to a 1 for standard date format for validation // Type will be changed back when validation is completed. vDateType = 1; // Store reformatted date to new variable for validation. var vDateValueCheck = mMonth+strSeperator+mDay+strSeperator+mYear; if (mYear.length == 2 && vYearType == 4 && dateCheck) { //Turn a two digit year into a 4 digit year var mToday = new Date(); //If the year is greater than 30 years from now use 19, otherwise use 20 var checkYear = mToday.getFullYear() + 30; var mCheckYear = '20' + mYear; if (mCheckYear >= checkYear) mYear = '19' + mYear; else mYear = '20' + mYear; vDateValueCheck = mMonth+strSeperator+mDay+strSeperator+mYear; // Store the new value back to the field. This function will // not work with date type of 2 since the year is entered first. if (vDateTypeTemp == 1) // mm/dd/yyyy vDateName.value = mMonth+strSeperator+mDay+strSeperator+mYear; if (vDateTypeTemp == 3) // dd/mm/yyyy vDateName.value = mDay+strSeperator+mMonth+strSeperator+mYear; } if (!dateValid(vDateValueCheck)) { alert("Fecha Invalida"); vDateType = vDateTypeTemp; vDateName.value = ""; vDateName.focus(); return true; } vDateType = vDateTypeTemp; return true; } else { if (vDateType == 1) { if (vDateValue.length == 2) { vDateName.value = vDateValue+strSeperator; } if (vDateValue.length == 5) { vDateName.value = vDateValue+strSeperator; } } if (vDateType == 2) { if (vDateValue.length == 4) { vDateName.value = vDateValue+strSeperator; } if (vDateValue.length == 7) { vDateName.value = vDateValue+strSeperator; } } if (vDateType == 3) { if (vDateValue.length == 2) { vDateName.value = vDateValue+strSeperator; } if (vDateValue.length == 5) { vDateName.value = vDateValue+strSeperator; } } return true; } } if (vDateValue.length == 10&& dateCheck) { if (!dateValid(vDateName)) { // Un-comment the next line of code for debugging the dateValid() function error messages //alert(err); alert("Fecha Invalida"); vDateName.focus(); vDateName.select(); } } return false; } else { // If the value is not in the string return the string minus the last // key entered. if (isNav4) { vDateName.value = ""; vDateName.focus(); vDateName.select(); return false; } else { vDateName.value = vDateName.value.substr(0, (vDateValue.length-1)); return false; } } } } function dateValid(objName) { var strDate; var strDateArray; var strDay; var strMonth; var strYear; var intday; var intMonth; var intYear; var booFound = false; var datefield = objName; var strSeparatorArray = new Array("-"," ","/","."); var intElementNr; // var err = 0; var strMonthArray = new Array(12); strMonthArray[0] = "Jan"; strMonthArray[1] = "Feb"; strMonthArray[2] = "Mar"; strMonthArray[3] = "Apr"; strMonthArray[4] = "May"; strMonthArray[5] = "Jun"; strMonthArray[6] = "Jul"; strMonthArray[7] = "Aug"; strMonthArray[8] = "Sep"; strMonthArray[9] = "Oct"; strMonthArray[10] = "Nov"; strMonthArray[11] = "Dec"; //strDate = datefield.value; strDate = objName; if (strDate.length < 1) { return true; } for (intElementNr = 0; intElementNr < strSeparatorArray.length; intElementNr++) { if (strDate.indexOf(strSeparatorArray[intElementNr]) != -1) { strDateArray = strDate.split(strSeparatorArray[intElementNr]); if (strDateArray.length != 3) { err = 1; return false; } else { strDay = strDateArray[0]; strMonth = strDateArray[1]; strYear = strDateArray[2]; } booFound = true; } } if (booFound == false) { if (strDate.length>5) { strDay = strDate.substr(0, 2); strMonth = strDate.substr(2, 2); strYear = strDate.substr(4); } } //Adjustment for short years entered if (strYear.length == 2) { strYear = '20' + strYear; } strTemp = strDay; strDay = strMonth; strMonth = strTemp; intday = parseInt(strDay, 10); if (isNaN(intday)) { err = 2; return false; } intMonth = parseInt(strMonth, 10); if (isNaN(intMonth)) { for (i = 0;i<12;i++) { if (strMonth.toUpperCase() == strMonthArray[i].toUpperCase()) { intMonth = i+1; strMonth = strMonthArray[i]; i = 12; } } if (isNaN(intMonth)) { err = 3; return false; } } intYear = parseInt(strYear, 10); if (isNaN(intYear)) { err = 4; return false; } if (intMonth>12 || intMonth<1) { err = 5; return false; } if ((intMonth == 1 || intMonth == 3 || intMonth == 5 || intMonth == 7 || intMonth == 8 || intMonth == 10 || intMonth == 12) && (intday > 31 || intday < 1)) { err = 6; return false; } if ((intMonth == 4 || intMonth == 6 || intMonth == 9 || intMonth == 11) && (intday > 30 || intday < 1)) { err = 7; return false; } if (intMonth == 2) { if (intday < 1) { err = 8; return false; } if (LeapYear(intYear) == true) { if (intday > 29) { err = 9; return false; } } else { if (intday > 28) { err = 10; return false; } } } return true; } function LeapYear(intYear) { if (intYear % 100 == 0) { if (intYear % 400 == 0) { return true; } } else { if ((intYear % 4) == 0) { return true; } } return false; } // End --> <!-- //Disable right mouse click Script //By Maximus (<EMAIL>) w/ mods by DynamicDrive //For full source code, visit http://www.dynamicdrive.com var message="Function Deshabilitada!"; /////////////////////////////////// function popup2(z,x,y) { var win = window.open('acecalendar_popup.htm?valor=' + z, 'popup_cal', 'left=' + x + ',top=' + y + ',resizable=no,status=no,titlebar=no,scrollbars=no,width=150,height=210'); win.focus(); } function Evalua() { f = document.forms[0]; var Mensaje = ""; if( bCancel == true ) return bCancel; if (f.op.value == 0) { if (!comboObligatorio(f.aduana.value)) Mensaje = Mensaje + 'Debe elegir una Aduana. \n'; if (!comboObligatorio(f.patron.value)) Mensaje = Mensaje + 'Debe elegir un patrón. \n'; } if (f.op.value == 4 ) { if( ! textoObligatorio( f.horas.value ) ) Mensaje = Mensaje + 'Ingrese el tiempo. \n'; if( ! textoObligatorio( f.fec_ini.value ) ) Mensaje = Mensaje + 'Ingrese fecha inicial. \n'; else { if( ! esFecha( f.fec_ini.value ) ) Mensaje = Mensaje + 'La fecha inicial es incorrecta. \n'; else if (! esHora(f.hr_ini.value)) Mensaje = Mensaje + 'La hora inicial es incorrecta. \n'; } if( textoObligatorio( f.fec_fin.value ) ) { if( ! esFecha( f.fec_fin.value ) ) Mensaje = Mensaje + 'La fecha final es incorrecta. \n'; else { if (! esHora(f.hr_fin.value)) Mensaje = Mensaje + 'La hora final es incorrecta. \n'; else { if (ComparaFechas(f.fec_fin.value, f.fec_ini.value) == 1 ) { Mensaje = Mensaje + 'El rango de fechas es incorrecto. \n'; } } } } } if ( f.op.value == 3) { if( ! textoObligatorio( f.horas.value ) ) Mensaje = Mensaje + 'Ingrese el tiempo. \n'; } if( Mensaje == "" ) return true; else { alert( Mensaje ); return false; } }; function EvaluaR() { f = document.forms[0]; var Mensaje = ""; if( bCancel == true ) return bCancel; if (!comboObligatorio(f.aduana.value)) Mensaje = Mensaje + 'Debe elegir una Aduana. \n'; if (!comboObligatorio(f.patron.value)) Mensaje = Mensaje + 'Debe elegir un patrón. \n'; if( Mensaje == "" ) return true; else { alert( Mensaje ); return false; } }; function esNumero() { key=window.event.keyCode; //codigo de tecla. if (key < 48 || key > 57)//si no es numero { if (key != 44) //no es coma { window.event.keyCode=0;} //anula la entrada de texto. } }; function esFecha(fecha) { borrar = fecha; if ((fecha.substr(2,1) == "/") && (fecha.substr(5,1) == "/")) { for (i=0; i<10; i++) { if (((fecha.substr(i,1)<"0") || (fecha.substr(i,1)>"9")) && (i != 2) && (i != 5)) { borrar = ''; break; } } if (borrar) { a = fecha.substr(6,4); m = fecha.substr(3,2); d = fecha.substr(0,2); if((a < 1900) || (a > 2050) || (m < 1) || (m > 12) || (d < 1) || (d > 31)) borrar = ''; else { if((a%4 != 0) && (m == 2) && (d > 28)) borrar = ''; // Año no viciesto y es febrero y el dia es mayor a 28 else { if ((((m == 4) || (m == 6) || (m == 9) || (m==11)) && (d>30)) || ((m==2) && (d>29))) borrar = ''; } // else } // fin else } // if (error) } // if ((caja.substr(2,1) == "/") && (caja.substr(5,1) == "/")) else borrar = ''; if (borrar == '') return false; else return true; }; function esHora(hora) { res = 0; if ((hora.substr(2,1) == ":") && (hora.substr(5,1) == ":")) { if (parseInt (hora.substr(0,2)) > 24) res = 1; else if (parseInt (hora.substr(3,2)) > 59) res = 1; else if (parseInt (hora.substr(5,2)) > 59) res = 1; } else res = 1; if (res == 0) return true; else return false; }; function ComparaFechas(fec0, fec1) { //true=fec1>fec0 var bRes = false; var sDia0 = fec0.substr(0, 2); var sMes0 = fec0.substr(3, 2); var sAno0 = fec0.substr(6, 4); var sDia1 = fec1.substr(0, 2); var sMes1 = fec1.substr(3, 2); var sAno1 = fec1.substr(6, 4); var fecha0=sAno0+sMes0+sDia0; var fecha1=sAno1+sMes1+sDia1; if (Number(fecha1) <= Number(fecha0)) bRes = true; return bRes; } function ValidaMail(sDir) { var pos1, pos2, bOk = true; pos1 = sDir.indexOf('@', 0); pos2 = sDir.indexOf('.', 0); bOk = bOk && (pos1 > 0); bOk = bOk && (pos2 != -1); bOk = bOk && (pos1 < pos2 - 1); bOk = bOk && (pos2 < sDir.length - 1); if (!bOk) return false; else return true; }; function blancos ( texto ) { if (texto.length) { while( '' + texto.charAt(0) == " " ) { texto = texto.substring( 1, texto.length); } } return texto; }; function textoObligatorio( texto ) { aux = blancos( texto ); if( aux == "" ) { return false;} else return true; }; function comboObligatorio( texto ) { if( texto == "0" ) { return false;} else return true; } function Mayusculas(texto) { texto.value = texto.value.toUpperCase(); } function solonumeros(checkStr) { var checkOK = "0123456789."; var allValid = true; var decPoints = 0; var allNum = ""; for (i = 0; i < checkStr.length; i++) { ch = checkStr.charAt(i); if (ch==",") decPoints=decPoints+1; for (j = 0; j < checkOK.length; j++) if (ch == checkOK.charAt(j)) break; if (j == checkOK.length) { allValid = false; break; } if (decPoints>1) allValid = false; allNum += ch; } if (!allValid) { return (false); } else { return (true); } } function solonumerosint(checkStr) { var checkOK = "0123456789"; var allValid = true; var decPoints = 0; var allNum = ""; for (i = 0; i < checkStr.length; i++) { ch = checkStr.charAt(i); for (j = 0; j < checkOK.length; j++) if (ch == checkOK.charAt(j)) break; if (j == checkOK.length) { allValid = false; break; } allNum += ch; } if (!allValid) { return (false); } else { return (true); } } function devuelvehoy() { var xdia; hoy=new Date(); var anio = hoy.getFullYear(); var mes = hoy.getMonth()+1; xmes=mes; if (mes<10) xmes="0"+mes; var dia = hoy.getUTCDate(); if (dia<10) xdia="0"+dia; else xdia=dia; hoydia=xdia+"/"+xmes+"/"+anio; return hoydia; } function sololetras(checkStr) { var checkOK = 'abcdefghijklmnñopqrstuvwxyzABCDEFGHIJKLMNÑOPQRSTUVWXYZ_0123456789/-*.,;:!#$%()=?¡<>áéíóúÁÉÍÓÚ`´Üü '; var allValid = true; var decPoints = 0; var allNum = ""; for (i = 0; i < checkStr.length; i++) { ch = checkStr.charAt(i); if (ch==".") decPoints=decPoints+1; for (j = 0; j < checkOK.length; j++) if (ch == checkOK.charAt(j)) break; if (j == checkOK.length) { allValid = false; break; } if (decPoints>1) allValid = false; allNum += ch; } if (!allValid) { return (false); } else { return (true); } } function handleEnter (field, event) { var keyCode = event.keyCode ? event.keyCode : event.which ? event.which : event.charCode; //alert(keyCode) if (keyCode == 13) { var i; for (i = 0; i < field.form.elements.length; i++) { //alert(field.form.elements[i].value+ " " +field.form.elements[i].type); if (field == field.form.elements[i]) break; } i = (i + 1) % field.form.elements.length; //alert(field.form.elements[i].value+ " //// " +field.form.elements[i].type + " " + i); if (field.form.elements[i].id=="noelement") { i = i + 1; } //alert(field.form.elements[i].value+ " //// " +field.form.elements[i].id + " " + field.form.elements[i].name + " " +i); field.form.elements[i].focus(); field.form.elements[i].select(); return false; } else return true; } function validar2(form) { hoy=devuelvehoy(); mensaje="" foco="" try { i=form.act_codrub.selectedIndex if (!comboObligatorio(form.act_codrub.options[i].value)) { mensaje=mensaje+"Debe introducir Rubro\n" if (foco.length==0) foco="form.act_codrub.focus()" } } catch (e) { xvar=0 } try { i=form.act_codreg.selectedIndex; if (!comboObligatorio(form.act_codreg.options[i].value)) { mensaje=mensaje+"Debe introducir Regional\n" if (foco.length==0) foco="form.act_codreg.focus()" } } catch (e) { xvar=0 } try { if (!textoObligatorio( form.act_codigo.value )) { mensaje=mensaje+"Debe introducir Código\n" if (foco.length==0) foco="form.act_codigo.focus()" } } catch (e) { xvar=0 } try { if (!comboObligatorio(form.act_codigo.value)) { mensaje=mensaje+"Debe introducir Código <> 0\n" if (foco.length==0) foco="form.act_codigo.focus()" } } catch (e) { xvar=0 } try { if (!solonumeros(form.act_codigo.value)){ mensaje=mensaje+"Debe introducir Números en Código\n" if (foco.length==0) foco="form.act_codigo.focus()" } } catch (e) { xvar=0 } try { if (form.operacion.value==2) if (!sololetras(form.act_descripcion.value)){ mensaje=mensaje+"Caracteres no permitidos \"\[\{\}\]&|+\'\n" if (foco.length==0) foco="form.act_descripcion.focus()" } } catch (e) { xvar=0 } try { if (form.operacion.value==2) if (!sololetras(form.act_marca.value)){ mensaje=mensaje+"Caracteres no permitidos \"\[\{\}\]&|+\'\n" if (foco.length==0) foco="form.act_marca.focus()" } } catch (e) { xvar=0 } try { if (form.operacion.value==2) if (!sololetras(form.act_modelo.value)){ mensaje=mensaje+"Caracteres no permitidos \"\[\{\}\]&|+\'\n" if (foco.length==0) foco="form.act_modelo.focus()" } } catch (e) { xvar=0 } try { if (form.operacion.value==2) if (!sololetras(form.act_serie1.value)){ mensaje=mensaje+"Caracteres no permitidos \"\[\{\}\]&|+\'\n" if (foco.length==0) foco="form.act_serie1.focus()" } } catch (e) { xvar=0 } try { if (form.operacion.value==2) if (!sololetras(form.act_serie2.value)){ mensaje=mensaje+"Caracteres no permitidos \"\[\{\}\]&|+\'\n" if (foco.length==0) foco="form.act_serie2.focus()" } } catch (e) { xvar=0 } try { if (form.operacion.value==2) if (!sololetras(form.act_placa.value)){ mensaje=mensaje+"Caracteres no permitidos \"\[\{\}\]&|+\'\n" if (foco.length==0) foco="form.act_placa.focus()" } } catch (e) { xvar=0 } try { if (form.operacion.value==2) if (!sololetras(form.act_color.value)){ mensaje=mensaje+"Caracteres no permitidos \"\[\{\}\]&|+\'\n" if (foco.length==0) foco="form.act_color.focus()" } } catch (e) { xvar=0 } try { if (form.operacion.value==2) if (!sololetras(form.act_procedencia.value)){ mensaje=mensaje+"Caracteres no permitidos \"\[\{\}\]&|+\'\n" if (foco.length==0) foco="form.act_procedencia.focus()" } } catch (e) { xvar=0 } try { if (form.operacion.value==2) if (!sololetras(form.act_gobmunicipal.value)){ mensaje=mensaje+"Caracteres no permitidos \"\[\{\}\]&|+\'\n" if (foco.length==0) foco="form.act_gobmunicipal.focus()" } } catch (e) { xvar=0 } try { i=form.act_codgrp.selectedIndex; if (!comboObligatorio(form.act_codgrp.options[i].value)) { mensaje=mensaje+"Debe introducir Grupo\n" if (foco.length==0) foco="form.act_codgrp.focus()" } } catch (e) { xvar=0 } try { i=form.act_codpar.selectedIndex; if (!comboObligatorio(form.act_codpar.options[i].value)) { mensaje=mensaje+"Debe introducir Partida\n" if (foco.length==0) foco="form.act_codpar.focus()" } } catch (e) { xvar=0 } try { i=form.act_codofi.selectedIndex; if (!comboObligatorio(form.act_codofi.options[i].value)) { mensaje=mensaje+"Debe introducir Oficina\n" if (foco.length==0) foco="form.act_codofi.focus()" } } catch (e) { xvar=0 } try { i=form.act_codfun.selectedIndex; if (!comboObligatorio(form.act_codfun.options[i].value)) { mensaje=mensaje+"Debe introducir Funcionario\n" if (foco.length==0) foco="form.act_codfun.focus()" } } catch (e) { xvar=0 } try { i=form.act_codubi.selectedIndex; if (!comboObligatorio(form.act_codubi.options[i].value)) { mensaje=mensaje+"Debe introducir Ubicación\n" if (foco.length==0) foco="form.act_codubi.focus()" } } catch (e) { xvar=0 } try { i=form.act_codpry.selectedIndex; if (!comboObligatorio(form.act_codpry.options[i].value)) { mensaje=mensaje+"Debe introducir Proyecto\n" if (foco.length==0) foco="form.act_codpry.focus()" } } catch (e) { xvar=0 } try { if (!esFecha(form.act_feccompra.value)){ mensaje=mensaje+"Debe introducir Fecha de Compra dd/mm/yyyy\n" if (foco.length==0) foco="form.act_feccompra.focus()" } } catch (e) { xvar=0 } try { if (!ComparaFechas(hoy, form.act_feccompra.value)){ mensaje=mensaje+"Debe introducir Fecha de Compra menor o igual a hoy\n" if (foco.length==0) foco="form.act_feccompra.focus()" } } catch (e) { xvar=0 } try { if (!ComparaFechas(form.rev_fecha.value, form.act_feccompra.value)){ mensaje=mensaje+"Debe introducir Fecha de Activación mayor igual a Fecha de Compra \n" if (foco.length==0) foco="form.rev_fecha.focus()" } } catch (e) { xvar=0 } try { if (!esFecha(form.act_fecreferencia.value)){ mensaje=mensaje+"Debe introducir Fecha de Registro dd/mm/yyyy\n" if (foco.length==0) foco="form.act_fecreferencia.focus()" } } catch (e) { xvar=0 } try { if (!ComparaFechas(hoy, form.act_fecreferencia.value)){ mensaje=mensaje+"Debe introducir Fecha de Registro menor o igual a hoy\n" if (foco.length==0) foco="form.act_fecreferencia.focus()" } } catch (e) { xvar=0 } try { if (!textoObligatorio(form.act_descripcion.value)){ mensaje=mensaje+"Debe introducir Descripción\n" if (foco.length==0) foco="form.act_descripcion.focus()" } } catch (e) { xvar=0 } try { if (!textoObligatorio(form.act_valcobol.value)){ mensaje=mensaje+"Debe introducir Valor de Compra Bolivianos\n" if (foco.length==0) foco="form.act_valcobol.focus()" } } catch (e) { xvar=0 } try { if (!textoObligatorio(form.act_valcobol.value)){ mensaje=mensaje+"Debe introducir Valor de Compra Bs\n" if (foco.length==0) foco="form.act_valcobol.focus()" } } catch (e) { xvar=0 } try { if (!solonumeros(form.act_valcobol.value)){ mensaje=mensaje+"Debe introducir Números en Valor de Compra Bs\n" if (foco.length==0) foco="form.act_valcobol.focus()" } } catch (e) { xvar=0 } try { if (Number(form.act_valcobol.value)<=0){ mensaje=mensaje+"Debe introducir Valor de Compra Bs\n" if (foco.length==0) foco="form.act_valcobol.focus()" } } catch (e) { xvar=0 } try { if (!solonumerosint(form.act_numfactura.value)){ mensaje=mensaje+"Debe introducir Números en Número de Factura\n" if (foco.length==0) foco="form.act_numfactura.focus()" } } catch (e) { xvar=0 } try { if (!textoObligatorio(form.act_umanejo.value)){ mensaje=mensaje+"Debe introducir Cilindrada\n" if (foco.length==0) foco="form.act_umanejo.focus()" } } catch (e) { xvar=0 } try { if (!textoObligatorio(form.act_proveedor.value)){ mensaje=mensaje+"Debe introducir Proveedor\n" if (foco.length==0) foco="form.act_proveedor.focus()" } } catch (e) { xvar=0 } try { if (!textoObligatorio(form.act_marca.value)){ mensaje=mensaje+"Debe introducir Marca\n" if (foco.length==0) foco="form.act_marca.focus()" } } catch (e) { xvar=0 } try { if (!textoObligatorio(form.act_modelo.value)){ mensaje=mensaje+"Debe introducir Tipo\n" if (foco.length==0) foco="form.act_modelo.focus()" } } catch (e) { xvar=0 } try { if (!textoObligatorio(form.act_serie1.value)){ mensaje=mensaje+"Debe introducir Chasis\n" if (foco.length==0) foco="form.act_serie1.focus()" } } catch (e) { xvar=0 } try { if (!textoObligatorio(form.act_serie2.value)){ mensaje=mensaje+"Debe introducir Motor\n" if (foco.length==0) foco="form.act_serie2.focus()" } } catch (e) { xvar=0 } try { if (!textoObligatorio(form.act_docreferencia.value)){ mensaje=mensaje+"Debe introducir Carnet de Propiedad\n" if (foco.length==0) foco="form.act_docreferencia.focus()" } } catch (e) { xvar=0 } try { if (!textoObligatorio(form.act_placa.value)){ mensaje=mensaje+"Debe introducir Placa\n" if (foco.length==0) foco="form.act_placa.focus()" } } catch (e) { xvar=0 } try { if (!textoObligatorio(form.act_aniofabricacion.value)){ mensaje=mensaje+"Debe introducir Año de Fabricación\n" if (foco.length==0) foco="form.act_aniofabricacion.focus()" } } catch (e) { xvar=0 } try { if (!solonumerosint(form.act_aniofabricacion.value)){ mensaje=mensaje+"Debe introducir Números en Año de Fabricación\n" if (foco.length==0) foco="form.act_aniofabricacion.focus()" } } catch (e) { xvar=0 } try { if (!textoObligatorio(form.act_color.value)){ mensaje=mensaje+"Debe introducir Color\n" if (foco.length==0) foco="form.act_color.focus()" } } catch (e) { xvar=0 } try { if (!textoObligatorio(form.act_procedencia.value)){ mensaje=mensaje+"Debe introducir Procedencia\n" if (foco.length==0) foco="form.act_procedencia.focus()" } } catch (e) { xvar=0 } try { if (!sololetras(form.act_procedencia.value)){ mensaje=mensaje+"Debe introducir Letras en Procedencia\n" if (foco.length==0) foco="form.act_procedencia.focus()" } } catch (e) { xvar=0 } try { if (!textoObligatorio(form.act_gobmunicipal.value)){ mensaje=mensaje+"Debe introducir Gobierno Municipal\n" if (foco.length==0) foco="form.act_gobmunicipal.focus()" } } catch (e) { xvar=0 } try { if (!esFecha(form.rev_fecha.value)){ mensaje=mensaje+"Debe introducir Fecha de Activación dd/mm/yyyy\n" if (foco.length==0) foco="form.rev_fecha.focus()" } } catch (e) { xvar=0 } try { var sMes0 = form.rev_fecha.value; var sAno0 = form.rev_fecha.value; if ((sMes0.substr(3,2)!=form.mes.value)||(sAno0.substr(6,4)!=form.anio.value)){ mensaje=mensaje+"Debe introducir Fecha de Activación igual al periodo "+form.anio.value+form.mes.value+" de proceso\n" if (foco.length==0) foco="form.rev_fecha.focus()" } } catch (e) { xvar=0 } try { i=form.rev_estadoactivo.selectedIndex if (!comboObligatorio(form.rev_estadoactivo.options[i].value)) { mensaje=mensaje+"Debe introducir Estado de Activo\n" if (foco.length==0) foco="form.rev_estadoactivo.focus()" } } catch (e) { xvar=0 } if (mensaje.length>0) { alert(mensaje) eval(foco) return false } } function validar0(form) { alert("validar0"); hoy=devuelvehoy(); mensaje="" foco="" try { i=form.act_codrub.selectedIndex if (!comboObligatorio(form.act_codrub.options[i].value)) { mensaje=mensaje+"Debe introducir Rubro\n" if (foco.length==0) foco="form.act_codrub.focus()" } } catch (e) { xvar=0 } try { i=form.act_codreg.selectedIndex; if (!comboObligatorio(form.act_codreg.options[i].value)) { mensaje=mensaje+"Debe introducir Regional\n" if (foco.length==0) foco="form.act_codreg.focus()" } } catch (e) { xvar=0 } try { if (!textoObligatorio( form.act_codigo.value )) { mensaje=mensaje+"Debe introducir Código\n" if (foco.length==0) foco="form.act_codigo.focus()" } } catch (e) { xvar=0 } try { if (!solonumeros(form.act_codigo.value)){ mensaje=mensaje+"Debe introducir Números en Código\n" if (foco.length==0) foco="form.act_codigo.focus()" } } catch (e) { xvar=0 } try { if (form.operacion.value==2) if (!sololetras(form.act_descripcion.value)){ mensaje=mensaje+"Caracteres no permitidos \"\[\{\}\]&|+\'\n" if (foco.length==0) foco="form.act_descripcion.focus()" } } catch (e) { xvar=0 } try { if (form.operacion.value==2) if (!sololetras(form.act_marca.value)){ mensaje=mensaje+"Caracteres no permitidos \"\[\{\}\]&|+\'\n" if (foco.length==0) foco="form.act_marca.focus()" } } catch (e) { xvar=0 } try { if (form.operacion.value==2) if (!sololetras(form.act_modelo.value)){ mensaje=mensaje+"Caracteres no permitidos \"\[\{\}\]&|+\'\n" if (foco.length==0) foco="form.act_modelo.focus()" } } catch (e) { xvar=0 } try { if (form.operacion.value==2) if (!sololetras(form.act_serie1.value)){ mensaje=mensaje+"Caracteres no permitidos \"\[\{\}\]&|+\'\n" if (foco.length==0) foco="form.act_serie1.focus()" } } catch (e) { xvar=0 } try { if (form.operacion.value==2) if (!sololetras(form.act_serie2.value)){ mensaje=mensaje+"Caracteres no permitidos \"\[\{\}\]&|+\'\n" if (foco.length==0) foco="form.act_serie2.focus()" } } catch (e) { xvar=0 } try { if (form.operacion.value==2) if (!sololetras(form.act_placa.value)){ mensaje=mensaje+"Caracteres no permitidos \"\[\{\}\]&|+\'\n" if (foco.length==0) foco="form.act_placa.focus()" } } catch (e) { xvar=0 } try { if (form.operacion.value==2) if (!sololetras(form.act_color.value)){ mensaje=mensaje+"Caracteres no permitidos \"\[\{\}\]&|+\'\n" if (foco.length==0) foco="form.act_color.focus()" } } catch (e) { xvar=0 } try { if (form.operacion.value==2) if (!sololetras(form.act_procedencia.value)){ mensaje=mensaje+"Caracteres no permitidos \"\[\{\}\]&|+\'\n" if (foco.length==0) foco="form.act_procedencia.focus()" } } catch (e) { xvar=0 } try { if (form.operacion.value==2) if (!sololetras(form.act_gobmunicipal.value)){ mensaje=mensaje+"Caracteres no permitidos \"\[\{\}\]&|+\'\n" if (foco.length==0) foco="form.act_gobmunicipal.focus()" } } catch (e) { xvar=0 } try { if (!comboObligatorio(form.act_codigo.value)) { mensaje=mensaje+"Debe introducir Código <> 0\n" if (foco.length==0) foco="form.act_codigo.focus()" } } catch (e) { xvar=0 } try { i=form.act_codgrp.selectedIndex; if (!comboObligatorio(form.act_codgrp.options[i].value)) { mensaje=mensaje+"Debe introducir Grupo\n" if (foco.length==0) foco="form.act_codgrp.focus()" } } catch (e) { xvar=0 } try { i=form.act_codpar.selectedIndex; if (!comboObligatorio(form.act_codpar.options[i].value)) { mensaje=mensaje+"Debe introducir Partida\n" if (foco.length==0) foco="form.act_codpar.focus()" } } catch (e) { xvar=0 } try { i=form.act_codofi.selectedIndex; if (!comboObligatorio(form.act_codofi.options[i].value)) { mensaje=mensaje+"Debe introducir Oficina\n" if (foco.length==0) foco="form.act_codofi.focus()" } } catch (e) { xvar=0 } try { i=form.act_codfun.selectedIndex; if (!comboObligatorio(form.act_codfun.options[i].value)) { mensaje=mensaje+"Debe introducir Funcionario\n" if (foco.length==0) foco="form.act_codfun.focus()" } } catch (e) { xvar=0 } try { i=form.act_codubi.selectedIndex; if (!comboObligatorio(form.act_codubi.options[i].value)) { mensaje=mensaje+"Debe introducir Ubicación\n" if (foco.length==0) foco="form.act_codubi.focus()" } } catch (e) { xvar=0 } try { i=form.act_codpry.selectedIndex; if (!comboObligatorio(form.act_codpry.options[i].value)) { mensaje=mensaje+"Debe introducir Proyecto\n" if (foco.length==0) foco="form.act_codpry.focus()" } } catch (e) { xvar=0 } try { if (!esFecha(form.act_feccompra.value)){ mensaje=mensaje+"Debe introducir Fecha de Compra dd/mm/yyyy\n" if (foco.length==0) foco="form.act_feccompra.focus()" } } catch (e) { xvar=0 } try { if (!textoObligatorio(form.act_proveedor.value)){ mensaje=mensaje+"Debe introducir Proveedor\n" if (foco.length==0) foco="form.act_proveedor.focus()" } } catch (e) { xvar=0 } try { if (form.act_codrub.value == "07") if (!textoObligatorio(form.act_marca.value)){ mensaje=mensaje+"Debe introducir Marca\n" if (foco.length==0) foco="form.act_marca.focus()" } } catch (e) { xvar=0 } try { if (!ComparaFechas(hoy, form.act_feccompra.value)){ mensaje=mensaje+"Debe introducir Fecha de Compra menor o igual a hoy\n" if (foco.length==0) foco="form.act_feccompra.focus()" } } catch (e) { xvar=0 } /*try { if (!ComparaFechas(form.rev_fecha.value,hoy)){ mensaje=mensaje+"Debe introducir Fecha de Activación mayor o igual a hoy\n" if (foco.length==0) foco="form.act_feccompra.focus()" } } catch (e) { xvar=0 }*/ try { if (!ComparaFechas(form.rev_fecha.value, form.act_feccompra.value)){ mensaje=mensaje+"Debe introducir Fecha de Activación mayor igual a Fecha de Compra \n" if (foco.length==0) foco="form.rev_fecha.focus()" } } catch (e) { xvar=0 } try { if (!textoObligatorio(form.act_descripcion.value)){ mensaje=mensaje+"Debe introducir Descripción\n" if (foco.length==0) foco="form.act_descripcion.focus()" } } catch (e) { xvar=0 } try { if (!textoObligatorio(form.act_valcobol.value)){ mensaje=mensaje+"Debe introducir Valor de Compra Bolivianos\n" if (foco.length==0) foco="form.act_valcobol.focus()" } } catch (e) { xvar=0 } try { if (!textoObligatorio(form.act_valcobol.value)){ mensaje=mensaje+"Debe introducir Valor de Compra Bs\n" if (foco.length==0) foco="form.act_valcobol.focus()" } } catch (e) { xvar=0 } try { if (!solonumeros(form.act_valcobol.value)){ mensaje=mensaje+"Debe introducir Números en Valor de Compra Bs\n" if (foco.length==0) foco="form.act_valcobol.focus()" } } catch (e) { xvar=0 } try { if (Number(form.act_valcobol.value)<=0){ mensaje=mensaje+"Debe introducir Valor de Compra Bs\n" if (foco.length==0) foco="form.act_valcobol.focus()" } } catch (e) { xvar=0 } try { if (!solonumerosint(form.act_numfactura.value)){ mensaje=mensaje+"Debe introducir Números en Número de Factura\n" if (foco.length==0) foco="form.act_numfactura.focus()" } } catch (e) { xvar=0 } try { if (!esFecha(form.rev_fecha.value)){ mensaje=mensaje+"Debe introducir Fecha de Activación dd/mm/yyyy\n" if (foco.length==0) foco="form.rev_fecha.focus()" } } catch (e) { xvar=0 } try { var sMes0 = form.rev_fecha.value; var sAno0 = form.rev_fecha.value; if ((sMes0.substr(3,2)!=form.mes.value)||(sAno0.substr(6,4)!=form.anio.value)){ mensaje=mensaje+"Debe introducir Fecha de Activación igual al periodo "+form.anio.value+form.mes.value+" de proceso\n" if (foco.length==0) foco="form.rev_fecha.focus()" } } catch (e) { xvar=0 } try { i=form.rev_estadoactivo.selectedIndex if (!comboObligatorio(form.rev_estadoactivo.options[i].value)) { mensaje=mensaje+"Debe introducir Estado de Activo\n" if (foco.length==0) foco="form.rev_estadoactivo.focus()" } } catch (e) { xvar=0 } if (mensaje.length>0) { alert(mensaje) eval(foco) return false } } function validar1(form) { hoy=devuelvehoy(); mensaje="" foco="" try { i=form.act_codrub.selectedIndex if (!comboObligatorio(form.act_codrub.options[i].value)) { mensaje=mensaje+"Debe introducir Rubro\n" if (foco.length==0) foco="form.act_codrub.focus()" } } catch (e) { xvar=0 } try { i=form.act_codreg.selectedIndex; if (!comboObligatorio(form.act_codreg.options[i].value)) { mensaje=mensaje+"Debe introducir Regional\n" if (foco.length==0) foco="form.act_codreg.focus()" } } catch (e) { xvar=0 } try { if (!textoObligatorio( form.act_codigo.value )) { mensaje=mensaje+"Debe introducir Código\n" if (foco.length==0) foco="form.act_codigo.focus()" } } catch (e) { xvar=0 } try { if (!comboObligatorio(form.act_codigo.value)) { mensaje=mensaje+"Debe introducir Código <> 0\n" if (foco.length==0) foco="form.act_codigo.focus()" } } catch (e) { xvar=0 } try { if (!solonumeros(form.act_codigo.value)){ mensaje=mensaje+"Debe introducir Números en Código\n" if (foco.length==0) foco="form.act_codigo.focus()" } } catch (e) { xvar=0 } try { if (form.operacion.value==2) if (!sololetras(form.act_descripcion.value)){ mensaje=mensaje+"Caracteres no permitidos \"\[\{\}\]&|+\'\n" if (foco.length==0) foco="form.act_descripcion.focus()" } } catch (e) { xvar=0 } try { if (form.operacion.value==2) if (!sololetras(form.act_marca.value)){ mensaje=mensaje+"Debe introducir Letras y Números\n" if (foco.length==0) foco="form.act_marca.focus()" } } catch (e) { xvar=0 } try { if (form.operacion.value==2) if (!sololetras(form.act_modelo.value)){ mensaje=mensaje+"Debe introducir Letras y Números\n" if (foco.length==0) foco="form.act_modelo.focus()" } } catch (e) { xvar=0 } try { if (form.operacion.value==2) if (!sololetras(form.act_serie1.value)){ mensaje=mensaje+"Debe introducir Letras y Números\n" if (foco.length==0) foco="form.act_serie1.focus()" } } catch (e) { xvar=0 } try { if (form.operacion.value==2) if (!sololetras(form.act_serie2.value)){ mensaje=mensaje+"Debe introducir Letras y Números\n" if (foco.length==0) foco="form.act_serie2.focus()" } } catch (e) { xvar=0 } try { if (form.operacion.value==2) if (!sololetras(form.act_placa.value)){ mensaje=mensaje+"Debe introducir Letras y Números\n" if (foco.length==0) foco="form.act_placa.focus()" } } catch (e) { xvar=0 } try { if (form.operacion.value==2) if (!sololetras(form.act_color.value)){ mensaje=mensaje+"Debe introducir Letras y Números\n" if (foco.length==0) foco="form.act_color.focus()" } } catch (e) { xvar=0 } try { if (form.operacion.value==2) if (!sololetras(form.act_procedencia.value)){ mensaje=mensaje+"Debe introducir Letras y Números\n" if (foco.length==0) foco="form.act_procedencia.focus()" } } catch (e) { xvar=0 } try { if (form.operacion.value==2) if (!sololetras(form.act_gobmunicipal.value)){ mensaje=mensaje+"Debe introducir Letras y Números\n" if (foco.length==0) foco="form.act_gobmunicipal.focus()" } } catch (e) { xvar=0 } try { i=form.act_codgrp.selectedIndex; if (!comboObligatorio(form.act_codgrp.options[i].value)) { mensaje=mensaje+"Debe introducir Grupo\n" if (foco.length==0) foco="form.act_codgrp.focus()" } } catch (e) { xvar=0 } try { i=form.act_codpar.selectedIndex; if (!comboObligatorio(form.act_codpar.options[i].value)) { mensaje=mensaje+"Debe introducir Partida\n" if (foco.length==0) foco="form.act_codpar.focus()" } } catch (e) { xvar=0 } try { i=form.act_codofi.selectedIndex; if (!comboObligatorio(form.act_codofi.options[i].value)) { mensaje=mensaje+"Debe introducir Oficina\n" if (foco.length==0) foco="form.act_codofi.focus()" } } catch (e) { xvar=0 } try { i=form.act_codfun.selectedIndex; if (!comboObligatorio(form.act_codfun.options[i].value)) { mensaje=mensaje+"Debe introducir Funcionario\n" if (foco.length==0) foco="form.act_codfun.focus()" } } catch (e) { xvar=0 } try { i=form.act_codubi.selectedIndex; if (!comboObligatorio(form.act_codubi.options[i].value)) { mensaje=mensaje+"Debe introducir Ubicación\n" if (foco.length==0) foco="form.act_codubi.focus()" } } catch (e) { xvar=0 } try { i=form.act_codpry.selectedIndex; if (!comboObligatorio(form.act_codpry.options[i].value)) { mensaje=mensaje+"Debe introducir Proyecto\n" if (foco.length==0) foco="form.act_codpry.focus()" } } catch (e) { xvar=0 } try { if (!esFecha(form.act_feccompra.value)){ mensaje=mensaje+"Debe introducir Fecha de Compra dd/mm/yyyy\n" if (foco.length==0) foco="form.act_feccompra.focus()" } } catch (e) { xvar=0 } try { if (!ComparaFechas(hoy, form.act_feccompra.value)){ mensaje=mensaje+"Debe introducir Fecha de Compra menor o igual a hoy\n" if (foco.length==0) foco="form.act_feccompra.focus()" } } catch (e) { xvar=0 } /*try { if (!ComparaFechas(form.rev_fecha.value,hoy)){ mensaje=mensaje+"Debe introducir Fecha de Activación mayor o igual a hoy\n" if (foco.length==0) foco="form.act_feccompra.focus()" } } catch (e) { xvar=0 }*/ try { if (!ComparaFechas(form.rev_fecha.value, form.act_feccompra.value)){ mensaje=mensaje+"Debe introducir Fecha de Activación mayor igual a Fecha de Compra \n" if (foco.length==0) foco="form.rev_fecha.focus()" } } catch (e) { xvar=0 } try { if (!textoObligatorio(form.act_umanejo.value)){ mensaje=mensaje+"Debe introducir Superficie Terreno\n" if (foco.length==0) foco="form.act_umanejo.focus()" } } catch (e) { xvar=0 } try { if (!textoObligatorio(form.act_descripcion.value)){ mensaje=mensaje+"Debe introducir Descripción del Inmueble\n" if (foco.length==0) foco="form.act_descripcion.focus()" } } catch (e) { xvar=0 } try { if (!textoObligatorio(form.act_accesorios.value)){ alert("Debe introducir Dirección Inmueble"); if (foco.length==0) foco="form.act_accesorios.focus()" } } catch (e) { xvar=0 } try { if (!textoObligatorio(form.act_serie1.value)){ mensaje=mensaje+"Debe introducir Testimonio No.\n" if (foco.length==0) foco="form.act_serie1.focus()" } } catch (e) { xvar=0 } try { if (!textoObligatorio(form.act_valcobol.value)){ mensaje=mensaje+"Debe introducir Valor de Compra Bolivianos\n" if (foco.length==0) foco="form.act_valcobol.focus()" } } catch (e) { xvar=0 } try { if (!solonumeros(form.act_valcobol.value)){ mensaje=mensaje+"Debe introducir Números en Valor de Compra Bs\n" if (foco.length==0) foco="form.act_valcobol.focus()" } } catch (e) { xvar=0 } try { if (Number(form.act_valcobol.value)<=0){ mensaje=mensaje+"Debe introducir Valor de Compra Bs\n" if (foco.length==0) foco="form.act_valcobol.focus()" } } catch (e) { xvar=0 } try { if (!solonumerosint(form.act_numfactura.value)){ mensaje=mensaje+"Debe introducir Números en Número de Factura\n" if (foco.length==0) foco="form.act_numfactura.focus()" } } catch (e) { xvar=0 } try { if (!textoObligatorio(form.act_docreferencia.value)){ mensaje=mensaje+"Debe introducir Folio No.\n" if (foco.length==0) foco="form.act_docreferencia.focus()" } } catch (e) { xvar=0 } try { if (!esFecha(form.act_fecreferencia.value)){ mensaje=mensaje+"Debe introducir Fecha de Registro dd/mm/yyyy\n" if (foco.length==0) foco="form.act_fecreferencia.focus()" } } catch (e) { xvar=0 } try { if (!ComparaFechas(hoy, form.act_fecreferencia.value)){ mensaje=mensaje+"Debe introducir Fecha de Registro menor o igual a hoy\n" if (foco.length==0) foco="form.act_fecreferencia.focus()" } } catch (e) { xvar=0 } try { if (!textoObligatorio(form.act_procedencia.value)){ mensaje=mensaje+"Debe introducir Departamento\n" if (foco.length==0) foco="form.act_procedencia.focus()" } } catch (e) { xvar=0 } try { if (!textoObligatorio(form.act_gobmunicipal.value)){ mensaje=mensaje+"Debe introducir Provincia\n" if (foco.length==0) foco="form.act_gobmunicipal.focus()" } } catch (e) { xvar=0 } try { if (!esFecha(form.rev_fecha.value)){ mensaje=mensaje+"Debe introducir Fecha de Activación dd/mm/yyyy\n" if (foco.length==0) foco="form.rev_fecha.focus()" } } catch (e) { xvar=0 } try { var sMes0 = form.rev_fecha.value; var sAno0 = form.rev_fecha.value; if ((sMes0.substr(3,2)!=form.mes.value)||(sAno0.substr(6,4)!=form.anio.value)){ mensaje=mensaje+"Debe introducir Fecha de Activación igual al periodo "+form.anio.value+form.mes.value+" de proceso\n" if (foco.length==0) foco="form.rev_fecha.focus()" } } catch (e) { xvar=0 } try { i=form.rev_estadoactivo.selectedIndex if (!comboObligatorio(form.rev_estadoactivo.options[i].value)) { mensaje=mensaje+"Debe introducir Estado de Activo\n" if (foco.length==0) foco="form.rev_estadoactivo.focus()" } } catch (e) { xvar=0 } try { if (!sololetras(form.act_procedencia.value)){ mensaje=mensaje+"Debe introducir Letras en Departamento\n" if (foco.length==0) foco="form.act_procedencia.focus()" } } catch (e) { xvar=0 } try { if (!sololetras(form.act_gobmunicipal.value)){ mensaje=mensaje+"Debe introducir Letras en Provincia\n" if (foco.length==0) foco="form.act_gobmunicipal.focus()" } } catch (e) { xvar=0 } if (mensaje.length>0) { alert(mensaje) eval(foco) return false } } function validar3(form) { hoy=devuelvehoy(); mensaje="" foco="" try { i=form.act_codrub.selectedIndex if (!comboObligatorio(form.act_codrub.options[i].value)) { mensaje=mensaje+"Debe introducir Rubro\n" if (foco.length==0) foco="form.act_codrub.focus()" } } catch (e) { xvar=0 } try { i=form.act_codreg.selectedIndex; if (!comboObligatorio(form.act_codreg.options[i].value)) { mensaje=mensaje+"Debe introducir Regional\n" if (foco.length==0) foco="form.act_codreg.focus()" } } catch (e) { xvar=0 } try { if (!textoObligatorio( form.act_codigo.value )) { mensaje=mensaje+"Debe introducir Código\n" if (foco.length==0) foco="form.act_codigo.focus()" } } catch (e) { xvar=0 } try { if (!comboObligatorio(form.act_codigo.value)) { mensaje=mensaje+"Debe introducir Código <> 0\n" if (foco.length==0) foco="form.act_codigo.focus()" } } catch (e) { xvar=0 } try { if (!solonumeros(form.act_codigo.value)){ mensaje=mensaje+"Debe introducir Números en Código\n" if (foco.length==0) foco="form.act_codigo.focus()" } } catch (e) { xvar=0 } try { if (form.operacion.value==2) if (!sololetras(form.act_descripcion.value)){ mensaje=mensaje+"Caracteres no permitidos \"\[\{\}\]&|+\'\n" if (foco.length==0) foco="form.act_descripcion.focus()" } } catch (e) { xvar=0 } try { if (form.operacion.value==2) if (!sololetras(form.act_marca.value)){ mensaje=mensaje+"Caracteres no permitidos \"\[\{\}\]&|+\'\n" if (foco.length==0) foco="form.act_marca.focus()" } } catch (e) { xvar=0 } try { if (form.operacion.value==2) if (!sololetras(form.act_modelo.value)){ mensaje=mensaje+"Caracteres no permitidos \"\[\{\}\]&|+\'\n" if (foco.length==0) foco="form.act_modelo.focus()" } } catch (e) { xvar=0 } try { if (form.operacion.value==2) if (!sololetras(form.act_serie1.value)){ mensaje=mensaje+"Caracteres no permitidos \"\[\{\}\]&|+\'\n" if (foco.length==0) foco="form.act_serie1.focus()" } } catch (e) { xvar=0 } try { if (form.operacion.value==2) if (!sololetras(form.act_serie2.value)){ mensaje=mensaje+"Caracteres no permitidos \"\[\{\}\]&|+\'\n" if (foco.length==0) foco="form.act_serie2.focus()" } } catch (e) { xvar=0 } try { if (form.operacion.value==2) if (!sololetras(form.act_placa.value)){ mensaje=mensaje+"Caracteres no permitidos \"\[\{\}\]&|+\'\n" if (foco.length==0) foco="form.act_placa.focus()" } } catch (e) { xvar=0 } try { if (form.operacion.value==2) if (!sololetras(form.act_color.value)){ mensaje=mensaje+"Caracteres no permitidos \"\[\{\}\]&|+\'\n" if (foco.length==0) foco="form.act_color.focus()" } } catch (e) { xvar=0 } try { if (form.operacion.value==2) if (!sololetras(form.act_procedencia.value)){ mensaje=mensaje+"Caracteres no permitidos \"\[\{\}\]&|+\'\n" if (foco.length==0) foco="form.act_procedencia.focus()" } } catch (e) { xvar=0 } try { if (form.operacion.value==2) if (!sololetras(form.act_gobmunicipal.value)){ mensaje=mensaje+"Caracteres no permitidos \"\[\{\}\]&|+\'\n" if (foco.length==0) foco="form.act_gobmunicipal.focus()" } } catch (e) { xvar=0 } try { i=form.act_codgrp.selectedIndex; if (!comboObligatorio(form.act_codgrp.options[i].value)) { mensaje=mensaje+"Debe introducir Grupo\n" if (foco.length==0) foco="form.act_codgrp.focus()" } } catch (e) { xvar=0 } try { i=form.act_codpar.selectedIndex; if (!comboObligatorio(form.act_codpar.options[i].value)) { mensaje=mensaje+"Debe introducir Partida\n" if (foco.length==0) foco="form.act_codpar.focus()" } } catch (e) { xvar=0 } try { i=form.act_codofi.selectedIndex; if (!comboObligatorio(form.act_codofi.options[i].value)) { mensaje=mensaje+"Debe introducir Oficina\n" if (foco.length==0) foco="form.act_codofi.focus()" } } catch (e) { xvar=0 } try { i=form.act_codfun.selectedIndex; if (!comboObligatorio(form.act_codfun.options[i].value)) { mensaje=mensaje+"Debe introducir Funcionario\n" if (foco.length==0) foco="form.act_codfun.focus()" } } catch (e) { xvar=0 } try { i=form.act_codubi.selectedIndex; if (!comboObligatorio(form.act_codubi.options[i].value)) { mensaje=mensaje+"Debe introducir Ubicación\n" if (foco.length==0) foco="form.act_codubi.focus()" } } catch (e) { xvar=0 } try { i=form.act_codpry.selectedIndex; if (!comboObligatorio(form.act_codpry.options[i].value)) { mensaje=mensaje+"Debe introducir Proyecto\n" if (foco.length==0) foco="form.act_codpry.focus()" } } catch (e) { xvar=0 } try { if (!esFecha(form.act_feccompra.value)){ mensaje=mensaje+"Debe introducir Fecha de Compra dd/mm/yyyy\n" if (foco.length==0) foco="form.act_feccompra.focus()" } } catch (e) { xvar=0 } try { if (!ComparaFechas(hoy, form.act_feccompra.value)){ mensaje=mensaje+"Debe introducir Fecha de Compra menor o igual a hoy\n" if (foco.length==0) foco="form.act_feccompra.focus()" } } catch (e) { xvar=0 } /*try { if (!ComparaFechas(form.rev_fecha.value,hoy)){ mensaje=mensaje+"Debe introducir Fecha de Activación mayor o igual a hoy\n" if (foco.length==0) foco="form.act_feccompra.focus()" } } catch (e) { xvar=0 }*/ try { if (!ComparaFechas(form.rev_fecha.value, form.act_feccompra.value)){ mensaje=mensaje+"Debe introducir Fecha de Activación mayor igual a Fecha de Compra \n" if (foco.length==0) foco="form.rev_fecha.focus()" } } catch (e) { xvar=0 } try { if (!textoObligatorio(form.act_umanejo.value)){ mensaje=mensaje+"Debe introducir Superficie Terreno\n" if (foco.length==0) foco="form.act_umanejo.focus()" } } catch (e) { xvar=0 } try { if (!textoObligatorio(form.act_descripcion.value)){ mensaje=mensaje+"Debe introducir Descripción\n" if (foco.length==0) foco="form.act_descripcion.focus()" } } catch (e) { xvar=0 } try { if (!textoObligatorio(form.act_valcobol.value)){ mensaje=mensaje+"Debe introducir Valor de Compra Bolivianos\n" if (foco.length==0) foco="form.act_valcobol.focus()" } } catch (e) { xvar=0 } try { if (!solonumeros(form.act_valcobol.value)){ mensaje=mensaje+"Debe introducir Números en Valor de Compra Bs\n" if (foco.length==0) foco="form.act_valcobol.focus()" } } catch (e) { xvar=0 } try { if (Number(form.act_valcobol.value)<=0){ mensaje=mensaje+"Debe introducir Valor de Compra Bs\n" if (foco.length==0) foco="form.act_valcobol.focus()" } } catch (e) { xvar=0 } try { if (!solonumerosint(form.act_numfactura.value)){ mensaje=mensaje+"Debe introducir Números en Número de Factura\n" if (foco.length==0) foco="form.act_numfactura.focus()" } } catch (e) { xvar=0 } try { if (!textoObligatorio(form.act_marca.value)){ mensaje=mensaje+"Debe introducir Marca\n" if (foco.length==0) foco="form.act_marca.focus()" } } catch (e) { xvar=0 } try { if (!textoObligatorio(form.act_modelo.value)){ mensaje=mensaje+"Debe introducir Modelo\n" if (foco.length==0) foco="form.act_modelo.focus()" } } catch (e) { xvar=0 } try { if (!esFecha(form.rev_fecha.value)){ mensaje=mensaje+"Debe introducir Fecha de Activación dd/mm/yyyy\n" if (foco.length==0) foco="form.rev_fecha.focus()" } } catch (e) { xvar=0 } try { if (!textoObligatorio(form.act_serie1.value)){ mensaje=mensaje+"Debe introducir Número de Serie\n" if (foco.length==0) foco="form.act_serie1.focus()" } } catch (e) { xvar=0 } try { var sMes0 = form.rev_fecha.value; var sAno0 = form.rev_fecha.value; if ((sMes0.substr(3,2)!=form.mes.value)||(sAno0.substr(6,4)!=form.anio.value)){ mensaje=mensaje+"Debe introducir Fecha de Activación igual al periodo "+form.anio.value+form.mes.value+" de proceso\n" if (foco.length==0) foco="form.rev_fecha.focus()" } } catch (e) { xvar=0 } try { i=form.rev_estadoactivo.selectedIndex if (!comboObligatorio(form.rev_estadoactivo.options[i].value)) { mensaje=mensaje+"Debe introducir Estado de Activo\n" if (foco.length==0) foco="form.rev_estadoactivo.focus()" } } catch (e) { xvar=0 } if (mensaje.length>0) { alert(mensaje) eval(foco) return false } } function validar4(form) { hoy=devuelvehoy(); mensaje="" foco="" try { i=form.act_codrub.selectedIndex if (!comboObligatorio(form.act_codrub.options[i].value)) { mensaje=mensaje+"Debe introducir Rubro\n" if (foco.length==0) foco="form.act_codrub.focus()" } } catch (e) { xvar=0 } try { i=form.act_codreg.selectedIndex; if (!comboObligatorio(form.act_codreg.options[i].value)) { mensaje=mensaje+"Debe introducir Regional\n" if (foco.length==0) foco="form.act_codreg.focus()" } } catch (e) { xvar=0 } try { if (!textoObligatorio( form.act_codigo.value )) { mensaje=mensaje+"Debe introducir Código\n" if (foco.length==0) foco="form.act_codigo.focus()" } } catch (e) { xvar=0 } try { if (!comboObligatorio(form.act_codigo.value)) { mensaje=mensaje+"Debe introducir Código <> 0\n" if (foco.length==0) foco="form.act_codigo.focus()" } } catch (e) { xvar=0 } try { if (!solonumeros(form.act_codigo.value)){ mensaje=mensaje+"Debe introducir Números en Código\n" if (foco.length==0) foco="form.act_codigo.focus()" } } catch (e) { xvar=0 } try { if (form.operacion.value==2) if (!sololetras(form.act_descripcion.value)){ mensaje=mensaje+"Caracteres no permitidos \"\[\{\}\]&|+\'\n" if (foco.length==0) foco="form.act_descripcion.focus()" } } catch (e) { xvar=0 } try { if (form.operacion.value==2) if (!sololetras(form.act_marca.value)){ mensaje=mensaje+"Caracteres no permitidos \"\[\{\}\]&|+\'\n" if (foco.length==0) foco="form.act_marca.focus()" } } catch (e) { xvar=0 } try { if (form.operacion.value==2) if (!sololetras(form.act_modelo.value)){ mensaje=mensaje+"Caracteres no permitidos \"\[\{\}\]&|+\'\n" if (foco.length==0) foco="form.act_modelo.focus()" } } catch (e) { xvar=0 } try { if (form.operacion.value==2) if (!sololetras(form.act_serie1.value)){ mensaje=mensaje+"Caracteres no permitidos \"\[\{\}\]&|+\'\n" if (foco.length==0) foco="form.act_serie1.focus()" } } catch (e) { xvar=0 } try { if (form.operacion.value==2) if (!sololetras(form.act_serie2.value)){ mensaje=mensaje+"Caracteres no permitidos \"\[\{\}\]&|+\'\n" if (foco.length==0) foco="form.act_serie2.focus()" } } catch (e) { xvar=0 } try { if (form.operacion.value==2) if (!sololetras(form.act_placa.value)){ mensaje=mensaje+"Caracteres no permitidos \"\[\{\}\]&|+\'\n" if (foco.length==0) foco="form.act_placa.focus()" } } catch (e) { xvar=0 } try { if (form.operacion.value==2) if (!sololetras(form.act_color.value)){ mensaje=mensaje+"Caracteres no permitidos \"\[\{\}\]&|+\'\n" if (foco.length==0) foco="form.act_color.focus()" } } catch (e) { xvar=0 } try { if (form.operacion.value==2) if (!sololetras(form.act_procedencia.value)){ mensaje=mensaje+"Caracteres no permitidos \"\[\{\}\]&|+\'\n" if (foco.length==0) foco="form.act_procedencia.focus()" } } catch (e) { xvar=0 } try { if (form.operacion.value==2) if (!sololetras(form.act_gobmunicipal.value)){ mensaje=mensaje+"Caracteres no permitidos \"\[\{\}\]&|+\'\n" if (foco.length==0) foco="form.act_gobmunicipal.focus()" } } catch (e) { xvar=0 } try { i=form.act_codgrp.selectedIndex; if (!comboObligatorio(form.act_codgrp.options[i].value)) { mensaje=mensaje+"Debe introducir Grupo\n" if (foco.length==0) foco="form.act_codgrp.focus()" } } catch (e) { xvar=0 } try { i=form.act_codpar.selectedIndex; if (!comboObligatorio(form.act_codpar.options[i].value)) { mensaje=mensaje+"Debe introducir Partida\n" if (foco.length==0) foco="form.act_codpar.focus()" } } catch (e) { xvar=0 } try { i=form.act_codofi.selectedIndex; if (!comboObligatorio(form.act_codofi.options[i].value)) { mensaje=mensaje+"Debe introducir Oficina\n" if (foco.length==0) foco="form.act_codofi.focus()" } } catch (e) { xvar=0 } try { i=form.act_codfun.selectedIndex; if (!comboObligatorio(form.act_codfun.options[i].value)) { mensaje=mensaje+"Debe introducir Funcionario\n" if (foco.length==0) foco="form.act_codfun.focus()" } } catch (e) { xvar=0 } try { i=form.act_codubi.selectedIndex; if (!comboObligatorio(form.act_codubi.options[i].value)) { mensaje=mensaje+"Debe introducir Ubicación\n" if (foco.length==0) foco="form.act_codubi.focus()" } } catch (e) { xvar=0 } try { i=form.act_codpry.selectedIndex; if (!comboObligatorio(form.act_codpry.options[i].value)) { mensaje=mensaje+"Debe introducir Proyecto\n" if (foco.length==0) foco="form.act_codpry.focus()" } } catch (e) { xvar=0 } try { if (!esFecha(form.act_feccompra.value)){ mensaje=mensaje+"Debe introducir Fecha de Compra dd/mm/yyyy\n" if (foco.length==0) foco="form.act_feccompra.focus()" } } catch (e) { xvar=0 } /*try { if (!ComparaFechas(form.rev_fecha.value,hoy)){ mensaje=mensaje+"Debe introducir Fecha de Activación mayor o igual a hoy\n" if (foco.length==0) foco="form.act_feccompra.focus()" } } catch (e) { xvar=0 }*/ try { if (!ComparaFechas(hoy, form.act_feccompra.value)){ mensaje=mensaje+"Debe introducir Fecha de Compra menor o igual a hoy\n" if (foco.length==0) foco="form.act_feccompra.focus()" } } catch (e) { xvar=0 } try { if (!textoObligatorio(form.act_umanejo.value)){ mensaje=mensaje+"Debe introducir Unidad de Manejo\n" if (foco.length==0) foco="form.act_umanejo.focus()" } } catch (e) { xvar=0 } try { if (!textoObligatorio(form.act_descripcion.value)){ mensaje=mensaje+"Debe introducir Descripción\n" if (foco.length==0) foco="form.act_descripcion.focus()" } } catch (e) { xvar=0 } try { if (!textoObligatorio(form.act_proveedor.value)){ mensaje=mensaje+"Debe introducir Proveedor\n" if (foco.length==0) foco="form.act_proveedor.focus()" } } catch (e) { xvar=0 } try { if (!textoObligatorio(form.act_procedencia.value)){ mensaje=mensaje+"Debe introducir Material\n" if (foco.length==0) foco="form.act_procedencia.focus()" } } catch (e) { xvar=0 } try { if (!textoObligatorio(form.act_gobmunicipal.value)){ mensaje=mensaje+"Debe introducir Dimensiones\n" if (foco.length==0) foco="form.act_gobmunicipal.focus()" } } catch (e) { xvar=0 } try { if (!textoObligatorio(form.act_valcobol.value)){ mensaje=mensaje+"Debe introducir Valor de Compra Bolivianos\n" if (foco.length==0) foco="form.act_valcobol.focus()" } } catch (e) { xvar=0 } try { if (!textoObligatorio(form.act_valcobol.value)){ mensaje=mensaje+"Debe introducir Valor de Compra Bs\n" if (foco.length==0) foco="form.act_valcobol.focus()" } } catch (e) { xvar=0 } try { if (!solonumeros(form.act_valcobol.value)){ mensaje=mensaje+"Debe introducir Números en Valor de Compra Bs\n" if (foco.length==0) foco="form.act_valcobol.focus()" } } catch (e) { xvar=0 } try { if (Number(form.act_valcobol.value)<=0){ mensaje=mensaje+"Debe introducir Valor de Compra Bs\n" if (foco.length==0) foco="form.act_valcobol.focus()" } } catch (e) { xvar=0 } try { if (!solonumerosint(form.act_numfactura.value)){ mensaje=mensaje+"Debe introducir Números en Número de Factura\n" if (foco.length==0) foco="form.act_numfactura.focus()" } } catch (e) { xvar=0 } try { if (!esFecha(form.rev_fecha.value)){ mensaje=mensaje+"Debe introducir Fecha de Activación dd/mm/yyyy\n" if (foco.length==0) foco="form.rev_fecha.focus()" } } catch (e) { xvar=0 } try { var sMes0 = form.rev_fecha.value; var sAno0 = form.rev_fecha.value; if ((sMes0.substr(3,2)!=form.mes.value)||(sAno0.substr(6,4)!=form.anio.value)){ mensaje=mensaje+"Debe introducir Fecha de Activación igual al periodo "+form.anio.value+form.mes.value+" de proceso\n" if (foco.length==0) foco="form.rev_fecha.focus()" } } catch (e) { xvar=0 } try { i=form.rev_estadoactivo.selectedIndex if (!comboObligatorio(form.rev_estadoactivo.options[i].value)) { mensaje=mensaje+"Debe introducir Estado de Activo\n" if (foco.length==0) foco="form.rev_estadoactivo.focus()" } } catch (e) { xvar=0 } if (mensaje.length>0) { alert(mensaje) eval(foco) return false } } function validar(form) { mensaje="" foco="" if (form.opcion.value==1) { try { if (!textoObligatorio( form.condicion1.value )) { mensaje=mensaje+"Debe introducir Descripciòn\n" if (foco.length==0) foco="form.condicion1.focus()" } } catch (e) { xvar=0 } } if (form.opcion.value==2) { try { i=form.condicion1.selectedIndex if (!comboObligatorio(form.condicion1.options[i].value)) { mensaje=mensaje+"Debe introducir Rubro\n" if (foco.length==0) foco="form.condicion1.focus()" } } catch (e) { xvar=0 } try { if (!textoObligatorio( form.condicion3.value )) { mensaje=mensaje+"Debe introducir Código Inicial\n" if (foco.length==0) foco="form.condicion3.focus()" } } catch (e) { xvar=0 } try { if (!textoObligatorio( form.condicion4.value )) { mensaje=mensaje+"Debe introducir Còdigo Final\n" if (foco.length==0) foco="form.condicion4.focus()" } } catch (e) { xvar=0 } try { if (!solonumeros( form.condicion3.value )) { mensaje=mensaje+"Debe introducir Números en Código Inicial\n" if (foco.length==0) foco="form.condicion3.focus()" } } catch (e) { xvar=0 } try { if (!solonumeros( form.condicion4.value )) { mensaje=mensaje+"Debe introducir Números en Còdigo Final\n" if (foco.length==0) foco="form.condicion4.focus()" } } catch (e) { xvar=0 } try { if ((Number(form.condicion3.value)<0)||(Number(form.condicion3.value)>99999)) { mensaje=mensaje+"Debe introducir Números en Código Inicial > 0 y < 99999\n" if (foco.length==0) foco="form.condicion3.focus()" } } catch (e) { xvar=0 } try { if ((Number(form.condicion4.value)<0)||(Number(form.condicion4.value)>99999)) { mensaje=mensaje+"Debe introducir Números en Código Final > 0 y < 99999\n" if (foco.length==0) foco="form.condicion4.focus()" } } catch (e) { xvar=0 } } if (form.opcion.value==3) { try { i=form.condicion1.selectedIndex if (!comboObligatorio(form.condicion1.options[i].value)) { mensaje=mensaje+"Debe introducir Rubro\n" if (foco.length==0) foco="form.condicion1.focus()" } } catch (e) { xvar=0 } try { i=form.condicion2.selectedIndex if (!comboObligatorio(form.condicion2.options[i].value)) { mensaje=mensaje+"Debe introducir Grupo\n" if (foco.length==0) foco="form.condicion2.focus()" } } catch (e) { xvar=0 } } if (form.opcion.value==4) { try { i=form.condicion1.selectedIndex if (!comboObligatorio(form.condicion1.options[i].value)) { mensaje=mensaje+"Debe introducir Ubicación\n" if (foco.length==0) foco="form.condicion1.focus()" } } catch (e) { xvar=0 } } if (form.opcion.value==5) { try { i=form.condicion3.selectedIndex if (!comboObligatorio(form.condicion3.options[i].value)) { mensaje=mensaje+"Debe introducir Funcionario\n" if (foco.length==0) foco="form.condicion3.focus()" } } catch (e) { xvar=0 } } if (form.opcion.value==6) { try { i=form.condicion1.selectedIndex if (!comboObligatorio(form.condicion1.options[i].value)) { mensaje=mensaje+"Debe introducir Proyecto\n" if (foco.length==0) foco="form.condicion1.focus()" } } catch (e) { xvar=0 } } if (form.opcion.value==7) { } if (form.opcion.value==8) { } if (form.opcion.value==9) { } if (form.opcion.value==10) { } if (form.opcion.value==11) { try { i=form.condicion1.selectedIndex if (!comboObligatorio(form.condicion1.options[i].value)) { mensaje=mensaje+"Debe introducir Oficina\n" if (foco.length==0) foco="form.condicion1.focus()" } } catch (e) { xvar=0 } } if (form.opcion.value==12) { try { i=form.condicion1.selectedIndex if (!comboObligatorio(form.condicion1.options[i].value)) { mensaje=mensaje+"Debe introducir Rubro\n" if (foco.length==0) foco="form.condicion1.focus()" } } catch (e) { xvar=0 } } if (form.opcion.value==13) { try { i=form.condicion1.selectedIndex if (!comboObligatorio(form.condicion1.options[i].value)) { mensaje=mensaje+"Debe introducir Rubro\n" if (foco.length==0) foco="form.condicion1.focus()" } } catch (e) { xvar=0 } try { if (!textoObligatorio( form.condicion4.value )) { mensaje=mensaje+"Debe introducir Fecha Inicial \n" if (foco.length==0) foco="form.condicion4.focus()" } } catch (e) { xvar=0 } try { if (!textoObligatorio( form.condicion5.value )) { mensaje=mensaje+"Debe introducir Fecha Final \n" if (foco.length==0) foco="form.condicion5.focus()" } } catch (e) { xvar=0 } try { if (!esFecha(form.condicion4.value)){ mensaje=mensaje+"Debe introducir Fecha Inicial dd/mm/yyyy\n" if (foco.length==0) foco="form.condicion4.focus()" } } catch (e) { xvar=0 } try { if (!esFecha(form.condicion5.value)){ mensaje=mensaje+"Debe introducir Fecha Final dd/mm/yyyy\n" if (foco.length==0) foco="form.condicion5.focus()" } } catch (e) { xvar=0 } try { if (!ComparaFechas(form.condicion5.value, form.condicion4.value)){ mensaje=mensaje+"Debe introducir Fecha Inicial menor o igual a Fecha Final\n" if (foco.length==0) foco="form.condicion4.focus()" } } catch (e) { xvar=0 } } if (form.opcion.value==14) { try { i=form.condicion1.selectedIndex if (!comboObligatorio(form.condicion1.options[i].value)) { mensaje=mensaje+"Debe introducir Rubro\n" if (foco.length==0) foco="form.condicion1.focus()" } } catch (e) { xvar=0 } try { if (!textoObligatorio( form.condicion4.value )) { mensaje=mensaje+"Debe introducir Fecha Inicial \n" if (foco.length==0) foco="form.condicion4.focus()" } } catch (e) { xvar=0 } try { if (!textoObligatorio( form.condicion5.value )) { mensaje=mensaje+"Debe introducir Fecha Final \n" if (foco.length==0) foco="form.condicion5.focus()" } } catch (e) { xvar=0 } try { if (!esFecha(form.condicion4.value)){ mensaje=mensaje+"Debe introducir Fecha Inicial dd/mm/yyyy\n" if (foco.length==0) foco="form.condicion4.focus()" } } catch (e) { xvar=0 } try { if (!esFecha(form.condicion5.value)){ mensaje=mensaje+"Debe introducir Fecha Final dd/mm/yyyy\n" if (foco.length==0) foco="form.condicion5.focus()" } } catch (e) { xvar=0 } try { if (!ComparaFechas(form.condicion5.value, form.condicion4.value)){ mensaje=mensaje+"Debe introducir Fecha Inicial menor o igual a Fecha Final\n" if (foco.length==0) foco="form.condicion4.focus()" } } catch (e) { xvar=0 } } if (form.opcion.value==15) { try { i=form.condicion1.selectedIndex if (!comboObligatorio(form.condicion1.options[i].value)) { mensaje=mensaje+"Debe introducir Rubro\n" if (foco.length==0) foco="form.condicion1.focus()" } } catch (e) { xvar=0 } try { if (!textoObligatorio( form.condicion5.value )) { mensaje=mensaje+"Debe introducir Fecha Final \n" if (foco.length==0) foco="form.condicion5.focus()" } } catch (e) { xvar=0 } try { if (!esFecha(form.condicion5.value)){ mensaje=mensaje+"Debe introducir Fecha Final dd/mm/yyyy\n" if (foco.length==0) foco="form.condicion5.focus()" } } catch (e) { xvar=0 } } if (form.opcion.value==16) { try { i=form.condicion1.selectedIndex if (!comboObligatorio(form.condicion1.options[i].value)) { mensaje=mensaje+"Debe introducir Rubro\n" if (foco.length==0) foco="form.condicion1.focus()" } } catch (e) { xvar=0 } try { if (!textoObligatorio( form.condicion5.value )) { mensaje=mensaje+"Debe introducir Fecha Final \n" if (foco.length==0) foco="form.condicion5.focus()" } } catch (e) { xvar=0 } try { if (!esFecha(form.condicion5.value)){ mensaje=mensaje+"Debe introducir Fecha Final dd/mm/yyyy\n" if (foco.length==0) foco="form.condicion5.focus()" } } catch (e) { xvar=0 } } if (form.opcion.value==17) { try { if (!textoObligatorio( form.condicion5.value )) { mensaje=mensaje+"Debe introducir Fecha Final \n" if (foco.length==0) foco="form.condicion5.focus()" } } catch (e) { xvar=0 } try { if (!esFecha(form.condicion5.value)){ mensaje=mensaje+"Debe introducir Fecha Final dd/mm/yyyy\n" if (foco.length==0) foco="form.condicion5.focus()" } } catch (e) { xvar=0 } } if (form.opcion.value==18) { try { if (!textoObligatorio( form.condicion5.value )) { mensaje=mensaje+"Debe introducir Fecha Final \n" if (foco.length==0) foco="form.condicion5.focus()" } } catch (e) { xvar=0 } try { if (!esFecha(form.condicion5.value)){ mensaje=mensaje+"Debe introducir Fecha Final dd/mm/yyyy\n" if (foco.length==0) foco="form.condicion5.focus()" } } catch (e) { xvar=0 } } if (form.opcion.value==19||form.opcion.value==31) { try { if (!textoObligatorio( form.condicion5.value )) { mensaje=mensaje+"Debe introducir Fecha Final \n" if (foco.length==0) foco="form.condicion5.focus()" } } catch (e) { xvar=0 } try { if (!esFecha(form.condicion5.value)){ mensaje=mensaje+"Debe introducir Fecha Final dd/mm/yyyy\n" if (foco.length==0) foco="form.condicion5.focus()" } } catch (e) { xvar=0 } } if (form.opcion.value==21) { try { if (!textoObligatorio( form.condicion5.value )) { mensaje=mensaje+"Debe introducir Fecha Final \n" if (foco.length==0) foco="form.condicion5.focus()" } } catch (e) { xvar=0 } try { if (!esFecha(form.condicion5.value)){ mensaje=mensaje+"Debe introducir Fecha Final dd/mm/yyyy\n" if (foco.length==0) foco="form.condicion5.focus()" } } catch (e) { xvar=0 } } if (form.opcion.value==22) { try { if (!textoObligatorio( form.condicion5.value )) { mensaje=mensaje+"Debe introducir Fecha Final \n" if (foco.length==0) foco="form.condicion5.focus()" } } catch (e) { xvar=0 } try { if (!esFecha(form.condicion5.value)){ mensaje=mensaje+"Debe introducir Fecha Final dd/mm/yyyy\n" if (foco.length==0) foco="form.condicion5.focus()" } } catch (e) { xvar=0 } } if (form.opcion.value==23) { try { if (!textoObligatorio( form.condicion5.value )) { mensaje=mensaje+"Debe introducir Fecha Final \n" if (foco.length==0) foco="form.condicion5.focus()" } } catch (e) { xvar=0 } try { if (!esFecha(form.condicion5.value)){ mensaje=mensaje+"Debe introducir Fecha Final dd/mm/yyyy\n" if (foco.length==0) foco="form.condicion5.focus()" } } catch (e) { xvar=0 } } if (form.opcion.value==24) { try { if (!textoObligatorio( form.condicion5.value )) { mensaje=mensaje+"Debe introducir Fecha Final \n" if (foco.length==0) foco="form.condicion5.focus()" } } catch (e) { xvar=0 } try { if (!esFecha(form.condicion5.value)){ mensaje=mensaje+"Debe introducir Fecha Final dd/mm/yyyy\n" if (foco.length==0) foco="form.condicion5.focus()" } } catch (e) { xvar=0 } try { i=form.condicion6.selectedIndex if (!comboObligatorio(form.condicion6.options[i].value)) { mensaje=mensaje+"Debe introducir Funcionario\n" if (foco.length==0) foco="form.condicion6.focus()" } } catch (e) { xvar=0 } } if (form.opcion.value==25) { try { if (!textoObligatorio( form.condicion5.value )) { mensaje=mensaje+"Debe introducir Fecha Final \n" if (foco.length==0) foco="form.condicion5.focus()" } } catch (e) { xvar=0 } try { if (!esFecha(form.condicion5.value)){ mensaje=mensaje+"Debe introducir Fecha Final dd/mm/yyyy\n" if (foco.length==0) foco="form.condicion5.focus()" } } catch (e) { xvar=0 } } if (form.opcion.value==28) { try { if (!textoObligatorio( form.condicion5.value )) { mensaje=mensaje+"Debe introducir Fecha Final \n" if (foco.length==0) foco="form.condicion5.focus()" } } catch (e) { xvar=0 } try { if (!esFecha(form.condicion5.value)){ mensaje=mensaje+"Debe introducir Fecha Final dd/mm/yyyy\n" if (foco.length==0) foco="form.condicion5.focus()" } } catch (e) { xvar=0 } } if (form.opcion.value==27) { try { i=form.condicion1.selectedIndex if (!comboObligatorio(form.condicion1.options[i].value)) { mensaje=mensaje+"Debe introducir Rubro\n" if (foco.length==0) foco="form.condicion1.focus()" } } catch (e) { xvar=0 } try { if (!textoObligatorio( form.condicion3.value )) { mensaje=mensaje+"Debe introducir Código Inicial\n" if (foco.length==0) foco="form.condicion3.focus()" } } catch (e) { xvar=0 } try { if (!textoObligatorio( form.condicion4.value )) { mensaje=mensaje+"Debe introducir Còdigo Final\n" if (foco.length==0) foco="form.condicion4.focus()" } } catch (e) { xvar=0 } try { if (!solonumeros( form.condicion3.value )) { mensaje=mensaje+"Debe introducir Números en Código Inicial\n" if (foco.length==0) foco="form.condicion3.focus()" } } catch (e) { xvar=0 } try { if (!solonumeros( form.condicion4.value )) { mensaje=mensaje+"Debe introducir Números en Còdigo Final\n" if (foco.length==0) foco="form.condicion4.focus()" } } catch (e) { xvar=0 } try { if ((Number(form.condicion3.value)<0)||(Number(form.condicion3.value)>99999)) { mensaje=mensaje+"Debe introducir Números en Código Inicial > 0 y < 99999\n" if (foco.length==0) foco="form.condicion3.focus()" } } catch (e) { xvar=0 } try { if ((Number(form.condicion4.value)<0)||(Number(form.condicion4.value)>99999)) { mensaje=mensaje+"Debe introducir Números en Código Final > 0 y < 99999\n" if (foco.length==0) foco="form.condicion4.focus()" } } catch (e) { xvar=0 } try { if (!textoObligatorio( form.condicion5.value )) { mensaje=mensaje+"Debe introducir Fecha Inicial \n" if (foco.length==0) foco="form.condicion5.focus()" } } catch (e) { xvar=0 } try { if (!textoObligatorio( form.condicion6.value )) { mensaje=mensaje+"Debe introducir Fecha Final \n" if (foco.length==0) foco="form.condicion6.focus()" } } catch (e) { xvar=0 } try { if (!esFecha(form.condicion5.value)){ mensaje=mensaje+"Debe introducir Fecha Inicial dd/mm/yyyy\n" if (foco.length==0) foco="form.condicion5.focus()" } } catch (e) { xvar=0 } try { if (!esFecha(form.condicion6.value)){ mensaje=mensaje+"Debe introducir Fecha Final dd/mm/yyyy\n" if (foco.length==0) foco="form.condicion6.focus()" } } catch (e) { xvar=0 } try { if (!ComparaFechas(form.condicion6.value, form.condicion5.value)){ mensaje=mensaje+"Debe introducir Fecha Inicial menor o igual a Fecha Final\n" if (foco.length==0) foco="form.condicion5.focus()" } } catch (e) { xvar=0 } } if (form.opcion.value==29) { try { i=form.condicion1.selectedIndex if (!comboObligatorio(form.condicion1.options[i].value)) { mensaje=mensaje+"Debe introducir Funcionario\n" if (foco.length==0) foco="form.condicion1.focus()" } } catch (e) { xvar=0 } try { if (!textoObligatorio( form.condicion5.value )) { mensaje=mensaje+"Debe introducir Fecha Inicial \n" if (foco.length==0) foco="form.condicion5.focus()" } } catch (e) { xvar=0 } try { if (!textoObligatorio( form.condicion6.value )) { mensaje=mensaje+"Debe introducir Fecha Final \n" if (foco.length==0) foco="form.condicion6.focus()" } } catch (e) { xvar=0 } try { if (!esFecha(form.condicion5.value)){ mensaje=mensaje+"Debe introducir Fecha Inicial dd/mm/yyyy\n" if (foco.length==0) foco="form.condicion5.focus()" } } catch (e) { xvar=0 } try { if (!esFecha(form.condicion6.value)){ mensaje=mensaje+"Debe introducir Fecha Final dd/mm/yyyy\n" if (foco.length==0) foco="form.condicion6.focus()" } } catch (e) { xvar=0 } try { if (!ComparaFechas(form.condicion6.value, form.condicion5.value)){ mensaje=mensaje+"Debe introducir Fecha Inicial menor o igual a Fecha Final\n" if (foco.length==0) foco="form.condicion5.focus()" } } catch (e) { xvar=0 } } if (form.opcion.value==30) { try { i=form.condicion1.selectedIndex if (!comboObligatorio(form.condicion1.options[i].value)) { mensaje=mensaje+"Debe introducir Ubicacio\n" if (foco.length==0) foco="form.condicion1.focus()" } } catch (e) { xvar=0 } try { if (!textoObligatorio( form.condicion5.value )) { mensaje=mensaje+"Debe introducir Fecha Final \n" if (foco.length==0) foco="form.condicion5.focus()" } } catch (e) { xvar=0 } try { if (!esFecha(form.condicion5.value)){ mensaje=mensaje+"Debe introducir Fecha Final dd/mm/yyyy\n" if (foco.length==0) foco="form.condicion5.focus()" } } catch (e) { xvar=0 } } if (mensaje.length>0) { alert(mensaje) eval(foco) return false } else { ftarget() return true } } <file_sep>package ActivosFijos; import org.apache.struts.action.ActionForm; import org.apache.struts.action.ActionErrors; import org.apache.struts.action.ActionError; import org.apache.struts.action.ActionMapping; import javax.servlet.http.HttpServletRequest; public class MejorasRebajasForm extends ActionForm { String mre_codrub; String mre_codreg; int mre_codigo; String mre_inmejreb; String mre_fecha; double mre_tipcam; double mre_tipufv; String mre_descripcion; String mre_desadicional; String mre_proveedor; String mre_docreferencia; String mre_fecreferencia; double mre_valbol; double mre_valdol; double mre_valufv; int mre_numfactura; String mre_numcomprobante; private String boton; private int fila; private int operacion; private int opcion; int mre_corel; String mre_marca; String mre_modelo; String mre_serie; String mre_ordencompra; String mre_regdescripcion; String mre_rubdescripcion; String mre_codbarra; String rev_fecha; int rev_vidaut; String rev_estadoactivo; String rev_desestado; String rev_numdocumento; String mes; String anio; String act_descripcion; /** * Reset all properties to their default values. * @param mapping The ActionMapping used to select this instance. * @param request The HTTP Request we are processing. */ public void reset(ActionMapping mapping, HttpServletRequest request) { super.reset(mapping, request); } /** * Validate all properties to their default values. * @param mapping The ActionMapping used to select this instance. * @param request The HTTP Request we are processing. * @return ActionErrors A list of all errors found. */ public ActionErrors validate(ActionMapping mapping, HttpServletRequest request) { return super.validate(mapping, request); } public String getMre_codrub() { return mre_codrub; } public void setMre_codrub(String newMre_codrub) { mre_codrub = newMre_codrub; } public String getMre_codreg() { return mre_codreg; } public void setMre_codreg(String newMre_codreg) { mre_codreg = newMre_codreg; } public int getMre_codigo() { return mre_codigo; } public void setMre_codigo(int newMre_codigo) { mre_codigo = newMre_codigo; } public String getMre_inmejreb() { return mre_inmejreb; } public void setMre_inmejreb(String newMre_inmejreb) { mre_inmejreb = newMre_inmejreb; } public String getMre_fecha() { return mre_fecha; } public void setMre_fecha(String newMre_fecha) { mre_fecha = newMre_fecha; } public double getMre_tipcam() { return mre_tipcam; } public void setMre_tipcam(double newMre_tipcam) { mre_tipcam = newMre_tipcam; } public double getMre_tipufv() { return mre_tipufv; } public void setMre_tipufv(double newMre_tipufv) { mre_tipufv = newMre_tipufv; } public String getMre_descripcion() { return mre_descripcion; } public void setMre_descripcion(String newMre_descripcion) { mre_descripcion = newMre_descripcion; } public String getMre_desadicional() { return mre_desadicional; } public void setMre_desadicional(String newMre_desadicional) { mre_desadicional = newMre_desadicional; } public String getMre_proveedor() { return mre_proveedor; } public void setMre_proveedor(String newMre_proveedor) { mre_proveedor = newMre_proveedor; } public String getMre_docreferencia() { return mre_docreferencia; } public void setMre_docreferencia(String newMre_docreferencia) { mre_docreferencia = newMre_docreferencia; } public String getMre_fecreferencia() { return mre_fecreferencia; } public void setMre_fecreferencia(String newMre_fecreferencia) { mre_fecreferencia = newMre_fecreferencia; } public double getMre_valbol() { return mre_valbol; } public void setMre_valbol(double newMre_valbol) { mre_valbol = newMre_valbol; } public double getMre_valdol() { return mre_valdol; } public void setMre_valdol(double newMre_valdol) { mre_valdol = newMre_valdol; } public double getMre_valufv() { return mre_valufv; } public void setMre_valufv(double newMre_valufv) { mre_valufv = newMre_valufv; } public int getMre_numfactura() { return mre_numfactura; } public void setMre_numfactura(int newMre_numfactura) { mre_numfactura = newMre_numfactura; } public String getMre_numcomprobante() { return mre_numcomprobante; } public void setMre_numcomprobante(String newMre_numcomprobante) { mre_numcomprobante = newMre_numcomprobante; } public String getBoton() { return boton; } public void setBoton(String newBoton) { boton = newBoton; } public String getBoton(int index) { return boton; } public void setBoton(int index, String newBoton) { boton = newBoton; fila = index; } public int getFila() { return fila; } public void setFila(int newFila) { fila = newFila; } public int getOperacion() { return operacion; } public void setOperacion(int newOperacion) { operacion = newOperacion; } public int getOpcion() { return opcion; } public void setOpcion(int newOpcion) { opcion = newOpcion; } public int getMre_corel() { return mre_corel; } public void setMre_corel(int newCorel) { mre_corel = newCorel; } public String getMre_marca() { return mre_marca; } public void setMre_marca(String newMarca) { mre_marca = newMarca; } public String getMre_modelo() { return mre_modelo; } public void setMre_modelo(String newModelo) { mre_modelo = newModelo; } public String getMre_serie() { return mre_serie; } public void setMre_serie(String newSerie) { mre_serie = newSerie; } public String getMre_ordencompra() { return mre_ordencompra; } public void setMre_ordencompra(String newOrdencompra) { mre_ordencompra = newOrdencompra; } public String getMre_regdescripcion() { return mre_regdescripcion; } public void setMre_regdescripcion(String newMre_regdescripcion) { mre_regdescripcion = newMre_regdescripcion; } public String getMre_rubdescripcion() { return mre_rubdescripcion; } public void setMre_rubdescripcion(String newMre_rubdescripcion) { mre_rubdescripcion = newMre_rubdescripcion; } public String getMre_codbarra() { return mre_codbarra; } public void setMre_codbarra(String newMre_codbarra) { mre_codbarra = newMre_codbarra; } public String getRev_fecha() { return rev_fecha; } public void setRev_fecha(String newRev_fecha) { rev_fecha = newRev_fecha; } public int getRev_vidaut() { return rev_vidaut; } public void setRev_vidaut(int newRev_vidaut) { rev_vidaut = newRev_vidaut; } public String getRev_estadoactivo() { return rev_estadoactivo; } public void setRev_estadoactivo(String newRev_estadoactivo) { rev_estadoactivo = newRev_estadoactivo; } public String getRev_desestado() { return rev_desestado; } public void setRev_desestado(String newRev_desestado) { rev_desestado = newRev_desestado; } public String getRev_numdocumento() { return rev_numdocumento; } public void setRev_numdocumento(String newRev_numdocumento) { rev_numdocumento = newRev_numdocumento; } public String getMes() { return mes; } public void setMes(String newMes) { mes = newMes; } public String getAnio() { return anio; } public void setAnio(String newAnio) { anio = newAnio; } public String getAct_descripcion() { return act_descripcion; } public void setAct_descripcion(String newAct_descripcion) { act_descripcion = newAct_descripcion; } }<file_sep>package ActivosFijos; import javax.mail.BodyPart; import javax.mail.Message; import javax.mail.Session; import javax.mail.Transport; import javax.mail.internet.InternetAddress; import javax.mail.internet.MimeBodyPart; import javax.mail.internet.MimeMessage; import javax.mail.internet.MimeMultipart; import java.util.Properties; public class EnviarCorreo { public EnviarCorreo() { Properties props = new Properties(); props.setProperty("mail.transport.protocol", "smtp"); props.setProperty("mail.host", "anbdm"); props.setProperty("mail.user", "<EMAIL>"); Session mailSession = Session.getDefaultInstance(props, null); Transport transport = mailSession.getTransport(); MimeMessage message = new MimeMessage(mailSession); message.setSubject("Alerta de Monitoreo de Servicios"); message.setFrom(new InternetAddress("<EMAIL>")); // BUSCA LA LISTA DE MAILS A ENVIAR //call1 = Con.prepareCall("{? = call pkg_monitor.lista_notificaciones(?) }"); call1.registerOutParameter(1, oracle.jdbc.OracleTypes.CURSOR); call1.setString(2, p_nom_ind); call1.execute(); rs = (ResultSet) call1.getObject(1); if( !(rs == null || !rs.next()) ) { do { String p_not_fun = rs.getString("not_fun"); String tel_mov = null; if (rs.getString("tip_not").equals("M")) message.addRecipient(Message.RecipientType.BCC,new InternetAddress(p_not_fun)); else { String cad_viva = "@viva-gsm.com"; String cad_entel = "@entelmovil.com.bo"; String cad_tigo = "@tigo.com.bo"; //String cad_telecel = "@telecel.com.bo"; if (Integer.parseInt(p_not_fun.substring(0,3))>=700 && Integer.parseInt(p_not_fun.substring(0,3))<=709) tel_mov = "591" + p_not_fun + cad_viva; if (Integer.parseInt(p_not_fun.substring(0,3))>=710 && Integer.parseInt(p_not_fun.substring(0,3))<=739) tel_mov = p_not_fun + cad_entel; if (Integer.parseInt(p_not_fun.substring(0,2)) == 76 || Integer.parseInt(p_not_fun.substring(0,2)) == 77) tel_mov = p_not_fun + cad_tigo; message.addRecipient(Message.RecipientType.BCC,new InternetAddress(tel_mov)); } } while (rs.next()); MimeMultipart multipart = new MimeMultipart("related"); htmlText = null; // Contenido (the html) BodyPart messageBodyPart = new MimeBodyPart(); htmlText = "Seņor: <br><BR> El Sistema ha detectado una alerta en : <br> Fecha y Hora : "+ p_fch_lec+" " + p_hor_lec + " <br> Servicio/Indicador/Estado/Valor : '" + p_nom_ser + "/"+p_nom_ind+"/"+ estado +"/"+p_val_lec+ "<br><br> Atentamente <br><br> <EMAIL>"; messageBodyPart.setContent(htmlText, "text/html"); // adiciona aqui multipart.addBodyPart(messageBodyPart); message.setContent(multipart); transport.connect(); transport.sendMessage(message, message.getRecipients(Message.RecipientType.BCC)); transport.close(); } } }<file_sep>package ActivosFijos; import java.io.IOException; import org.apache.struts.action.ActionForm; import org.apache.struts.action.ActionErrors; import org.apache.struts.action.ActionError; import org.apache.struts.action.ActionMapping; import org.apache.struts.action.ActionMessage; import org.apache.struts.action.ActionMessages; import javax.servlet.http.HttpServletRequest; import javax.*; public class FinanciadoresForm extends ActionForm { private String fin_codigo; private String fin_descripcion; private String boton; private int fila; private int operacion; private int opcion; /** * Reset all properties to their default values. * @param mapping The ActionMapping used to select this instance. * @param request The HTTP Request we are processing. */ public void reset(ActionMapping mapping, HttpServletRequest request) { super.reset(mapping, request); } /** * Validate all properties to their default values. * @param mapping The ActionMapping used to select this instance. * @param request The HTTP Request we are processing. * @return ActionErrors A list of all errors found. */ public ActionErrors validate(ActionMapping mapping, HttpServletRequest request) { /*System.out.println("Ingreso a Validate"); ActionErrors errors = new ActionErrors(); if (getFin_codigo()==null || getFin_codigo().length() < 1) { System.out.println("Ingreso a Validate Fin_codigo NULL"); errors.add("error",new ActionMessage("Debe introducir Codigo de Financiador")); } if (getFin_descripcion()==null || getFin_descripcion().length() < 1) { System.out.println("Ingreso a Validate Fin_descripcion NULL"); errors.add("error",new ActionMessage("Debe introducir Descripcion de Financiador")); } return errors;*/ return super.validate(mapping, request); } public String getFin_codigo() { return fin_codigo; } public void setFin_codigo(String newFin_codigo) { fin_codigo = newFin_codigo; } public String getFin_descripcion() { return fin_descripcion; } public void setFin_descripcion(String newFin_descripcion) { fin_descripcion = newFin_descripcion; } public String getBoton() { return boton; } public void setBoton(String newBoton) { boton = newBoton; } public String getBoton(int index) { return boton; } public void setBoton(int index, String newBoton) { boton = newBoton; fila = index; } public int getFila() { return fila; } public void setFila(int newFila) { fila = newFila; } public int getOperacion() { return operacion; } public void setOperacion(int newOperacion) { operacion = newOperacion; } public int getOpcion() { return opcion; } public void setOpcion(int newOpcion) { opcion = newOpcion; } }<file_sep>package aduana.app.struts.controller; import java.io.IOException; import javax.servlet.ServletException; import javax.servlet.http.*; import org.apache.struts.action.ActionMapping; import org.apache.struts.tiles.TilesRequestProcessor; import org.apache.struts.util.MessageResources; public class CustomController extends TilesRequestProcessor { public CustomController() { } protected boolean processRoles(HttpServletRequest request, HttpServletResponse response, ActionMapping mapping) throws ServletException, IOException { String[] roles = mapping.getRoleNames(); if ((roles == null) || (roles.length < 1)) { return true; } String rol = request.getSession().getAttribute("user.perfil").toString(); if (!(rol == null || rol.equals(""))) { for (int i = 0; i < roles.length; i++) { if (rol.equals(roles[i])) { return true; } } } response.sendError(400, getInternal() .getMessage("notAuthorized", mapping.getPath())); return false; } public void process(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { super.process(request, response); } }<file_sep>package ActivosFijos; import org.apache.struts.action.ActionForm; import org.apache.struts.action.ActionErrors; import org.apache.struts.action.ActionError; import org.apache.struts.action.ActionMapping; import javax.servlet.http.HttpServletRequest; import java.util.ArrayList; public class InicioForm extends ActionForm { private String txt_usu; private String txt_pas; private ArrayList opciones; private String nombreUsuario; private String regional; private String cod_reg; private String financiador; private String cod_fin; private String txt_npas; private String txt_cpas; private String aux1; private String aux2; /** * Reset all properties to their default values. * @param mapping The ActionMapping used to select this instance. * @param request The HTTP Request we are processing. */ public void reset(ActionMapping mapping, HttpServletRequest request) { super.reset(mapping, request); } /** * Validate all properties to their default values. * @param mapping The ActionMapping used to select this instance. * @param request The HTTP Request we are processing. * @return ActionErrors A list of all errors found. */ public ActionErrors validate(ActionMapping mapping, HttpServletRequest request) { return super.validate(mapping, request); } public String getTxt_usu() { return txt_usu; } public void setTxt_usu(String newTxt_usu) { txt_usu = newTxt_usu; } public String getTxt_pas() { return txt_pas; } public void setTxt_pas(String newTxt_pas) { txt_pas = newTxt_pas; } public ArrayList getOpciones() { return opciones; } public void setOpciones(ArrayList newOpciones) { opciones = newOpciones; } public String getNombreUsuario() { return nombreUsuario; } public void setNombreUsuario(String newNombreUsuario) { nombreUsuario = newNombreUsuario; } public String getRegional() { return regional; } public void setRegional(String newRegional) { regional = newRegional; } public String getCod_reg() { return cod_reg; } public void setCod_reg(String newCod_reg) { cod_reg = newCod_reg; } public String getFinanciador() { return financiador; } public void setFinanciador(String newFinanciador) { financiador = newFinanciador; } public String getCod_fin() { return cod_fin; } public void setCod_fin(String newCod_fin) { cod_fin = newCod_fin; } public String getTxt_npas() { return txt_npas; } public void setTxt_npas(String newTxt_npas) { txt_npas = newTxt_npas; } public String getTxt_cpas() { return txt_cpas; } public void setTxt_cpas(String newTxt_cpas) { txt_cpas = newTxt_cpas; } public String getAux1() { return aux1; } public void setAux1(String newAux1) { aux1 = newAux1; } public String getAux2() { return aux2; } public void setAux2(String newAux2) { aux2 = newAux2; } }<file_sep>package ActivosFijos; import org.apache.struts.action.Action; import org.apache.struts.action.ActionForm; import org.apache.struts.action.ActionForward; import org.apache.struts.action.ActionMapping; import org.apache.struts.action.ActionMessage; import org.apache.struts.action.ActionMessages; import org.apache.struts.action.ActionError; import org.apache.struts.action.ActionErrors; import java.io.IOException; import javax.servlet.ServletException; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import java.util.ArrayList; public class TipocambioAction extends Action { /** * This is the main action called from the Struts framework. * @param mapping The ActionMapping used to select this instance. * @param form The optional ActionForm bean for this request. * @param request The HTTP Request we are processing. * @param response The HTTP Response we are processing. */ public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException { ActionMessages error = new ActionMessages(); TipocambioForm finform = (TipocambioForm)form; InicioForm fInicio = (InicioForm) request.getSession().getAttribute("InicioForm"); String usuario = fInicio.getNombreUsuario(); BDConection bdc = new BDConection(); ArrayList aCalm; if (!(fInicio.getNombreUsuario().equals("SALIO"))) { int it = finform.getFila(); try { aCalm = bdc.listarTipocambio(1,finform.getOpcion()); request.setAttribute("TipocambioLista", aCalm); ArrayList datos = (ArrayList) request.getAttribute("TipocambioLista"); if (finform.getOperacion()==1) { TipoCambioDetalleForm d = new TipoCambioDetalleForm(); d = (TipoCambioDetalleForm) datos.get(it); finform.setTca_fecha(d.getFecha()); finform.setTca_tipcam(d.getTipcam()); finform.setTca_tipufv(d.getTipufv()); } if (finform.getOperacion()==2) { try { if (!finform.getBoton().equals("Cancelar")) { String msgsql=null; msgsql = bdc.insertartipocambio(finform.getTca_fecha(),finform.getTca_tipcam(),finform.getTca_tipufv(),fInicio.getTxt_usu(),finform.getOpcion()); finform.setTca_fecha(""); finform.setTca_tipcam(0); finform.setTca_tipufv(0); if (!msgsql.equals("0")) { error.add("error", new ActionMessage("error", msgsql)); saveErrors( request, error ); } else { error.add("error", new ActionMessage("error", "La transacción fue realizada correctamente")); saveErrors( request, error ); } } else { finform.setTca_fecha(""); finform.setTca_tipcam(0); finform.setTca_tipufv(0); } try { aCalm = bdc.listarTipocambio(1,finform.getOpcion()); request.setAttribute("TipocambioLista", aCalm); } catch (Exception e) { error.add("error", new ActionMessage("errordb", "No se pudo iniciar Tipo de CAmbio")); error.add("error", new ActionMessage("errordb", e.toString() )); e.printStackTrace(); saveErrors( request, error ); } } catch (Exception e) { error.add("error", new ActionMessage("errordb", "No se pudo realizar la transaccion.")); error.add("error", new ActionMessage("errordb", e.toString() )); e.printStackTrace(); saveErrors( request, error ); } } } catch (Exception e) { error.add("error", new ActionMessage("errordb", "No se pudo iniciar Tipo de Cambio")); error.add("error", new ActionMessage("errordb", e.toString() )); e.printStackTrace(); saveErrors( request, error ); } } return mapping.findForward("volver"); } }<file_sep>package ActivosFijos; import org.apache.struts.action.ActionForm; import org.apache.struts.action.ActionErrors; import org.apache.struts.action.ActionError; import org.apache.struts.action.ActionMapping; import javax.servlet.http.HttpServletRequest; public class ActivosForm extends ActionForm { String act_codrub; String act_codreg; int act_codigo; String act_codgrp; String act_codpar; String act_codofi; String act_codfun; String act_codubi; String act_codfin; String act_codpry; String act_codmot; String act_feccompra; double act_tipcam; double act_tipufv; String act_umanejo; String act_descripcion; String act_desadicional; String act_proveedor; String act_marca; String act_modelo; String act_serie1; String act_serie2; String act_docreferencia; String act_fecreferencia; String act_placa; String act_valcobol; String act_valcodol; String act_valcoufv; String act_fecbaja; String act_ordencompra; String act_numfactura; String act_numcomprobante; String act_codanterior; String act_indetiqueta; private String boton; private int fila; private int operacion; private int opcion; String rev_fecha; int rev_vidaut; String rev_estadoactivo; String desestado; String rev_desestado; String rev_indepreciacion; String rev_numdocumento; String act_rubdescripcion; String act_regdescripcion; String act_codbarra; String act_fundescripcion; String act_ofidescripcion; String act_pardescripcion; String act_accesorios; String act_docrefotro; String act_aniofabricacion; String act_color; String act_procedencia; String act_gobmunicipal; String mes; String anio; String act_grpdescripcion; String act_ubidescripcion; String act_prydescripcion; String act_findescripcion; String codregor; /** * Reset all properties to their default values. * @param mapping The ActionMapping used to select this instance. * @param request The HTTP Request we are processing. */ public void reset(ActionMapping mapping, HttpServletRequest request) { super.reset(mapping, request); } /** * Validate all properties to their default values. * @param mapping The ActionMapping used to select this instance. * @param request The HTTP Request we are processing. * @return ActionErrors A list of all errors found. */ public ActionErrors validate(ActionMapping mapping, HttpServletRequest request) { return super.validate(mapping, request); } public String getAct_codrub() { return act_codrub; } public void setAct_codrub(String newAct_codrub) { act_codrub = newAct_codrub; } public String getAct_codreg() { return act_codreg; } public void setAct_codreg(String newAct_codreg) { act_codreg = newAct_codreg; } public int getAct_codigo() { return act_codigo; } public void setAct_codigo(int newAct_codigo) { act_codigo = newAct_codigo; } public String getAct_codgrp() { return act_codgrp; } public void setAct_codgrp(String newAct_codgrp) { act_codgrp = newAct_codgrp; } public String getAct_codpar() { return act_codpar; } public void setAct_codpar(String newAct_codpar) { act_codpar = newAct_codpar; } public String getAct_codofi() { return act_codofi; } public void setAct_codofi(String newAct_codofi) { act_codofi = newAct_codofi; } public String getAct_codfun() { return act_codfun; } public void setAct_codfun(String newAct_codfun) { act_codfun = newAct_codfun; } public String getAct_codubi() { return act_codubi; } public void setAct_codubi(String newAct_codubi) { act_codubi = newAct_codubi; } public String getAct_codfin() { return act_codfin; } public void setAct_codfin(String newAct_codfin) { act_codfin = newAct_codfin; } public String getAct_codpry() { return act_codpry; } public void setAct_codpry(String newAct_codpry) { act_codpry = newAct_codpry; } public String getAct_codmot() { return act_codmot; } public void setAct_codmot(String newAct_codmot) { act_codmot = newAct_codmot; } public String getAct_feccompra() { return act_feccompra; } public void setAct_feccompra(String newAct_feccompra) { act_feccompra = newAct_feccompra; } public double getAct_tipcam() { return act_tipcam; } public void setAct_tipcam(double newAct_tipcam) { act_tipcam = newAct_tipcam; } public double getAct_tipufv() { return act_tipufv; } public void setAct_tipufv(double newAct_tipufv) { act_tipufv = newAct_tipufv; } public String getAct_umanejo() { return act_umanejo; } public void setAct_umanejo(String newAct_umanejo) { act_umanejo = newAct_umanejo; } public String getAct_descripcion() { return act_descripcion; } public void setAct_descripcion(String newAct_descripcion) { act_descripcion = newAct_descripcion; } public String getAct_desadicional() { return act_desadicional; } public void setAct_desadicional(String newAct_desadicional) { act_desadicional = newAct_desadicional; } public String getAct_proveedor() { return act_proveedor; } public void setAct_proveedor(String newAct_proveedor) { act_proveedor = newAct_proveedor; } public String getAct_marca() { return act_marca; } public void setAct_marca(String newAct_marca) { act_marca = newAct_marca; } public String getAct_modelo() { return act_modelo; } public void setAct_modelo(String newAct_modelo) { act_modelo = newAct_modelo; } public String getAct_serie1() { return act_serie1; } public void setAct_serie1(String newAct_serie1) { act_serie1 = newAct_serie1; } public String getAct_serie2() { return act_serie2; } public void setAct_serie2(String newAct_serie2) { act_serie2 = newAct_serie2; } public String getAct_docreferencia() { return act_docreferencia; } public void setAct_docreferencia(String newAct_docreferencia) { act_docreferencia = newAct_docreferencia; } public String getAct_fecreferencia() { return act_fecreferencia; } public void setAct_fecreferencia(String newAct_fecreferencia) { act_fecreferencia = newAct_fecreferencia; } public String getAct_placa() { return act_placa; } public void setAct_placa(String newAct_placa) { act_placa = newAct_placa; } public String getAct_valcobol() { return act_valcobol; } public void setAct_valcobol(String newAct_valcobol) { act_valcobol = newAct_valcobol; } public String getAct_valcodol() { return act_valcodol; } public void setAct_valcodol(String newAct_valcodol) { act_valcodol = newAct_valcodol; } public String getAct_valcoufv() { return act_valcoufv; } public void setAct_valcoufv(String newAct_valcoufv) { act_valcoufv = newAct_valcoufv; } public String getAct_fecbaja() { return act_fecbaja; } public void setAct_fecbaja(String newAct_fecbaja) { act_fecbaja = newAct_fecbaja; } public String getAct_ordencompra() { return act_ordencompra; } public void setAct_ordencompra(String newAct_ordencompra) { act_ordencompra = newAct_ordencompra; } public String getAct_numfactura() { return act_numfactura; } public void setAct_numfactura(String newAct_numfactura) { act_numfactura = newAct_numfactura; } public String getAct_numcomprobante() { return act_numcomprobante; } public void setAct_numcomprobante(String newAct_numcomprobante) { act_numcomprobante = newAct_numcomprobante; } public String getAct_codanterior() { return act_codanterior; } public void setAct_codanterior(String newAct_codanterior) { act_codanterior = newAct_codanterior; } public String getAct_indetiqueta() { return act_indetiqueta; } public void setAct_indetiqueta(String newAct_indetiqueta) { act_indetiqueta = newAct_indetiqueta; } public void setBoton(String newBoton) { boton = newBoton; } public String getBoton(int index) { return boton; } public void setBoton(int index, String newBoton) { boton = newBoton; fila = index; } public int getFila() { return fila; } public void setFila(int newFila) { fila = newFila; } public int getOperacion() { return operacion; } public void setOperacion(int newOperacion) { operacion = newOperacion; } public int getOpcion() { return opcion; } public void setOpcion(int newOpcion) { opcion = newOpcion; } public String getRev_fecha() { return rev_fecha; } public void setRev_fecha(String newRev_fecha) { rev_fecha = newRev_fecha; } public int getRev_vidaut() { return rev_vidaut; } public void setRev_vidaut(int newRev_vidaut) { rev_vidaut = newRev_vidaut; } public String getRev_estadoactivo() { return rev_estadoactivo; } public void setRev_estadoactivo(String newRev_estadoactivo) { rev_estadoactivo = newRev_estadoactivo; } public String getRev_desestado() { return rev_desestado; } public void setRev_desestado(String newRev_desestado) { rev_desestado = newRev_desestado; } public String getRev_indepreciacion() { return rev_indepreciacion; } public void setRev_indepreciacion(String newRev_indepreciacion) { rev_indepreciacion = newRev_indepreciacion; } public String getRev_numdocumento() { return rev_numdocumento; } public void setRev_numdocumento(String newRev_numdocumento) { rev_numdocumento = newRev_numdocumento; } public String getAct_rubdescripcion() { return act_rubdescripcion; } public void setAct_rubdescripcion(String newAct_rubdescripcion) { act_rubdescripcion = newAct_rubdescripcion; } public String getAct_regdescripcion() { return act_regdescripcion; } public void setAct_regdescripcion(String newAct_regdescripcion) { act_regdescripcion = newAct_regdescripcion; } public String getAct_codbarra() { return act_codbarra; } public void setAct_codbarra(String newAct_codbarra) { act_codbarra = newAct_codbarra; } public String getAct_fundescripcion() { return act_fundescripcion; } public void setAct_fundescripcion(String newAct_fundescripcion) { act_fundescripcion = newAct_fundescripcion; } public String getAct_ofidescripcion() { return act_ofidescripcion; } public void setAct_ofidescripcion(String newAct_ofidescripcion) { act_ofidescripcion = newAct_ofidescripcion; } public String getAct_pardescripcion() { return act_pardescripcion; } public void setAct_pardescripcion(String newAct_pardescripcion) { act_pardescripcion = newAct_pardescripcion; } public String getAct_accesorios() { return act_accesorios; } public void setAct_accesorios(String newAct_accesorios) { act_accesorios = newAct_accesorios; } public String getAct_docrefotro() { return act_docrefotro; } public void setAct_docrefotro(String newAct_docrefotro) { act_docrefotro = newAct_docrefotro; } public String getAct_aniofabricacion() { return act_aniofabricacion; } public void setAct_aniofabricacion(String newAct_aniofabricacion) { act_aniofabricacion = newAct_aniofabricacion; } public String getAct_color() { return act_color; } public void setAct_color(String newAct_color) { act_color = newAct_color; } public String getAct_procedencia() { return act_procedencia; } public void setAct_procedencia(String newAct_procedencia) { act_procedencia = newAct_procedencia; } public String getAct_gobmunicipal() { return act_gobmunicipal; } public void setAct_gobmunicipal(String newAct_gobmunicipal) { act_gobmunicipal = newAct_gobmunicipal; } public String getMes() { return mes; } public void setMes(String newMes) { mes = newMes; } public String getAnio() { return anio; } public void setAnio(String newAnio) { anio = newAnio; } public String getAct_grpdescripcion() { return act_grpdescripcion; } public void setAct_grpdescripcion(String newAct_grpdescripcion) { act_grpdescripcion = newAct_grpdescripcion; } public String getAct_ubidescripcion() { return act_ubidescripcion; } public void setAct_ubidescripcion(String newAct_ubidescripcion) { act_ubidescripcion = newAct_ubidescripcion; } public String getAct_prydescripcion() { return act_prydescripcion; } public void setAct_prydescripcion(String newAct_prydescripcion) { act_prydescripcion = newAct_prydescripcion; } public String getAct_findescripcion() { return act_findescripcion; } public void setAct_findescripcion(String newAct_findescripcion) { act_findescripcion = newAct_findescripcion; } public String getDesestado() { return desestado; } public void setDesestado(String newDesestado) { desestado = newDesestado; } public String getCodregor() { return codregor; } public void setCodregor(String newCodregor) { codregor = newCodregor; } }<file_sep>package ActivosFijos; import org.apache.struts.action.ActionForm; import org.apache.struts.action.ActionErrors; import org.apache.struts.action.ActionError; import org.apache.struts.action.ActionMapping; import javax.servlet.http.HttpServletRequest; public class FuncionariosForm extends ActionForm { String fun_codigo; String fun_descripcion; String fun_cargo; String fun_codofi; String fun_codreg; String fun_codfin; private String boton; private int fila; private int operacion; private int opcion; String descripcion_codreg; String descripcion_codfin; String descripcion_codofi; String fun_correo; String fun_estado; /** * Reset all properties to their default values. * @param mapping The ActionMapping used to select this instance. * @param request The HTTP Request we are processing. */ public void reset(ActionMapping mapping, HttpServletRequest request) { super.reset(mapping, request); } /** * Validate all properties to their default values. * @param mapping The ActionMapping used to select this instance. * @param request The HTTP Request we are processing. * @return ActionErrors A list of all errors found. */ public ActionErrors validate(ActionMapping mapping, HttpServletRequest request) { return super.validate(mapping, request); } public String getFun_codigo() { return fun_codigo; } public void setFun_codigo(String newFun_codigo) { fun_codigo = newFun_codigo; } public String getFun_descripcion() { return fun_descripcion; } public void setFun_descripcion(String newFun_descripcion) { fun_descripcion = newFun_descripcion; } public String getFun_cargo() { return fun_cargo; } public void setFun_cargo(String newFun_cargo) { fun_cargo = newFun_cargo; } public String getFun_codofi() { return fun_codofi; } public void setFun_codofi(String newFun_codofi) { fun_codofi = newFun_codofi; } public String getFun_codreg() { return fun_codreg; } public void setFun_codreg(String newFun_codreg) { fun_codreg = newFun_codreg; } public String getFun_codfin() { return fun_codfin; } public void setFun_codfin(String newFun_codfin) { fun_codfin = newFun_codfin; } public String getBoton() { return boton; } public void setBoton(String newBoton) { boton = newBoton; } public String getBoton(int index) { return boton; } public void setBoton(int index, String newBoton) { boton = newBoton; fila = index; } public int getFila() { return fila; } public void setFila(int newFila) { fila = newFila; } public int getOperacion() { return operacion; } public void setOperacion(int newOperacion) { operacion = newOperacion; } public int getOpcion() { return opcion; } public void setOpcion(int newOpcion) { opcion = newOpcion; } public String getDescripcion_codreg() { return descripcion_codreg; } public void setDescripcion_codreg(String newDescripcion_codreg) { descripcion_codreg = newDescripcion_codreg; } public String getDescripcion_codofi() { return descripcion_codofi; } public void setDescripcion_codofi(String newDescripcion_codofi) { descripcion_codofi = newDescripcion_codofi; } public String getDescripcion_codfin() { return descripcion_codfin; } public void setDescripcion_codfin(String newDescripcion_codfin) { descripcion_codfin = newDescripcion_codfin; } public String getFun_correo() { return fun_correo; } public void setFun_correo(String newFun_correo) { fun_correo = newFun_correo; } public String getFun_estado() { return fun_estado; } public void setFun_estado(String newFun_estado) { fun_estado = newFun_estado; } } <file_sep>package ActivosFijos; import org.apache.struts.action.ActionForm; import org.apache.struts.action.ActionErrors; import org.apache.struts.action.ActionError; import org.apache.struts.action.ActionMapping; import javax.servlet.http.HttpServletRequest; public class SecbarrasForm extends ActionForm { String bar_rubro; String bar_codreg; int bar_numero; private String boton; private int fila; private int operacion; private int opcion; String descripcion_codreg; String descripcion_codrub; /** * Reset all properties to their default values. * @param mapping The ActionMapping used to select this instance. * @param request The HTTP Request we are processing. */ public void reset(ActionMapping mapping, HttpServletRequest request) { super.reset(mapping, request); } /** * Validate all properties to their default values. * @param mapping The ActionMapping used to select this instance. * @param request The HTTP Request we are processing. * @return ActionErrors A list of all errors found. */ public ActionErrors validate(ActionMapping mapping, HttpServletRequest request) { return super.validate(mapping, request); } public String getBar_rubro() { return bar_rubro; } public void setBar_rubro(String newBar_rubro) { bar_rubro = newBar_rubro; } public String getBar_codreg() { return bar_codreg; } public void setBar_codreg(String newBar_codreg) { bar_codreg = newBar_codreg; } public int getBar_numero() { return bar_numero; } public void setBar_numero(int newBar_numero) { bar_numero = newBar_numero; } public String getBoton() { return boton; } public void setBoton(String newBoton) { boton = newBoton; } public String getBoton(int index) { return boton; } public void setBoton(int index, String newBoton) { boton = newBoton; fila = index; } public int getFila() { return fila; } public void setFila(int newFila) { fila = newFila; } public int getOperacion() { return operacion; } public void setOperacion(int newOperacion) { operacion = newOperacion; } public int getOpcion() { return opcion; } public void setOpcion(int newOpcion) { opcion = newOpcion; } public String getDescripcion_codreg() { return descripcion_codreg; } public void setDescripcion_codreg(String newDescripcion_codreg) { descripcion_codreg = newDescripcion_codreg; } public String getDescripcion_codrub() { return descripcion_codrub; } public void setDescripcion_codrub(String newDescripcion_codrub) { descripcion_codrub = newDescripcion_codrub; } }<file_sep> /*@lineinfo:filename=/Activos4_a.jsp*/ /*@lineinfo:generated-code*/ import oracle.jsp.runtime.*; import javax.servlet.*; import javax.servlet.http.*; import javax.servlet.jsp.*; import java.util.Vector; import ActivosFijos.*; public class _Activos4__a extends oracle.jsp.runtime.HttpJsp { public final String _globalsClassName = null; // ** Begin Declarations // ** End Declarations public void _jspService(HttpServletRequest request, HttpServletResponse response) throws java.io.IOException, ServletException { response.setContentType( "text/html;charset=windows-1252"); /* set up the intrinsic variables using the pageContext goober: ** session = HttpSession ** application = ServletContext ** out = JspWriter ** page = this ** config = ServletConfig ** all session/app beans declared in globals.jsa */ PageContext pageContext = JspFactory.getDefaultFactory().getPageContext( this, request, response, null, true, JspWriter.DEFAULT_BUFFER, true); // Note: this is not emitted if the session directive == false HttpSession session = pageContext.getSession(); if (pageContext.getAttribute(OracleJspRuntime.JSP_REQUEST_REDIRECTED, PageContext.REQUEST_SCOPE) != null) { pageContext.setAttribute(OracleJspRuntime.JSP_PAGE_DONTNOTIFY, "true", PageContext.PAGE_SCOPE); JspFactory.getDefaultFactory().releasePageContext(pageContext); return; } int __jsp_tag_starteval; ServletContext application = pageContext.getServletContext(); JspWriter out = pageContext.getOut(); _Activos4__a page = this; ServletConfig config = pageContext.getServletConfig(); try { // global beans // end global beans out.write(__jsp_StaticText.text[0]); out.write(__jsp_StaticText.text[1]); out.write(__jsp_StaticText.text[2]); out.write(__jsp_StaticText.text[3]); out.write(__jsp_StaticText.text[4]); /*@lineinfo:translated-code*//*@lineinfo:17^1*/ { org.apache.struts.taglib.html.FormTag __jsp_taghandler_1=(org.apache.struts.taglib.html.FormTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.FormTag.class,"org.apache.struts.taglib.html.FormTag action"); __jsp_taghandler_1.setParent(null); __jsp_taghandler_1.setAction("/activosAction"); __jsp_tag_starteval=__jsp_taghandler_1.doStartTag(); if (OracleJspRuntime.checkStartTagEval(__jsp_tag_starteval)) { do { /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[5]); /*@lineinfo:translated-code*//*@lineinfo:18^1*/ { org.apache.struts.taglib.html.HiddenTag __jsp_taghandler_2=(org.apache.struts.taglib.html.HiddenTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.HiddenTag.class,"org.apache.struts.taglib.html.HiddenTag property"); __jsp_taghandler_2.setParent(__jsp_taghandler_1); __jsp_taghandler_2.setProperty("operacion"); __jsp_tag_starteval=__jsp_taghandler_2.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_2,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_2.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_2.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_2); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[6]); /*@lineinfo:translated-code*//*@lineinfo:19^1*/ { org.apache.struts.taglib.html.HiddenTag __jsp_taghandler_3=(org.apache.struts.taglib.html.HiddenTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.HiddenTag.class,"org.apache.struts.taglib.html.HiddenTag property"); __jsp_taghandler_3.setParent(__jsp_taghandler_1); __jsp_taghandler_3.setProperty("opcion"); __jsp_tag_starteval=__jsp_taghandler_3.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_3,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_3.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_3.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_3); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[7]); /*@lineinfo:translated-code*//*@lineinfo:20^1*/ { org.apache.struts.taglib.logic.EqualTag __jsp_taghandler_4=(org.apache.struts.taglib.logic.EqualTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.logic.EqualTag.class,"org.apache.struts.taglib.logic.EqualTag name property value"); __jsp_taghandler_4.setParent(__jsp_taghandler_1); __jsp_taghandler_4.setName("ActivosForm"); __jsp_taghandler_4.setProperty("operacion"); __jsp_taghandler_4.setValue("1"); __jsp_tag_starteval=__jsp_taghandler_4.doStartTag(); if (OracleJspRuntime.checkStartTagEval(__jsp_tag_starteval)) { do { /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[8]); /*@lineinfo:translated-code*//*@lineinfo:21^4*/ { org.apache.struts.taglib.logic.EqualTag __jsp_taghandler_5=(org.apache.struts.taglib.logic.EqualTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.logic.EqualTag.class,"org.apache.struts.taglib.logic.EqualTag name property value"); __jsp_taghandler_5.setParent(__jsp_taghandler_4); __jsp_taghandler_5.setName("ActivosForm"); __jsp_taghandler_5.setProperty("opcion"); __jsp_taghandler_5.setValue("4"); __jsp_tag_starteval=__jsp_taghandler_5.doStartTag(); if (OracleJspRuntime.checkStartTagEval(__jsp_tag_starteval)) { do { /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[9]); /*@lineinfo:translated-code*//*@lineinfo:24^27*/ { org.apache.struts.taglib.bean.MessageTag __jsp_taghandler_6=(org.apache.struts.taglib.bean.MessageTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.bean.MessageTag.class,"org.apache.struts.taglib.bean.MessageTag key"); __jsp_taghandler_6.setParent(__jsp_taghandler_5); __jsp_taghandler_6.setKey("activos4.codrub"); __jsp_tag_starteval=__jsp_taghandler_6.doStartTag(); if (OracleJspRuntime.checkStartTagEval(__jsp_tag_starteval)) { do { } while (__jsp_taghandler_6.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); } if (__jsp_taghandler_6.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_6); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[10]); /*@lineinfo:translated-code*//*@lineinfo:25^26*/ { org.apache.struts.taglib.html.TextTag __jsp_taghandler_7=(org.apache.struts.taglib.html.TextTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.TextTag.class,"org.apache.struts.taglib.html.TextTag maxlength name property readonly size"); __jsp_taghandler_7.setParent(__jsp_taghandler_5); __jsp_taghandler_7.setMaxlength("10"); __jsp_taghandler_7.setName("ActivosForm"); __jsp_taghandler_7.setProperty("act_codrub"); __jsp_taghandler_7.setReadonly(true); __jsp_taghandler_7.setSize("10"); __jsp_tag_starteval=__jsp_taghandler_7.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_7,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_7.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_7.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_7); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[11]); /*@lineinfo:translated-code*//*@lineinfo:26^10*/ { org.apache.struts.taglib.html.TextTag __jsp_taghandler_8=(org.apache.struts.taglib.html.TextTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.TextTag.class,"org.apache.struts.taglib.html.TextTag maxlength name property readonly size"); __jsp_taghandler_8.setParent(__jsp_taghandler_5); __jsp_taghandler_8.setMaxlength("60"); __jsp_taghandler_8.setName("ActivosForm"); __jsp_taghandler_8.setProperty("act_rubdescripcion"); __jsp_taghandler_8.setReadonly(true); __jsp_taghandler_8.setSize("60"); __jsp_tag_starteval=__jsp_taghandler_8.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_8,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_8.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_8.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_8); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[12]); /*@lineinfo:translated-code*//*@lineinfo:29^27*/ { org.apache.struts.taglib.bean.MessageTag __jsp_taghandler_9=(org.apache.struts.taglib.bean.MessageTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.bean.MessageTag.class,"org.apache.struts.taglib.bean.MessageTag key"); __jsp_taghandler_9.setParent(__jsp_taghandler_5); __jsp_taghandler_9.setKey("activos4.codreg"); __jsp_tag_starteval=__jsp_taghandler_9.doStartTag(); if (OracleJspRuntime.checkStartTagEval(__jsp_tag_starteval)) { do { } while (__jsp_taghandler_9.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); } if (__jsp_taghandler_9.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_9); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[13]); /*@lineinfo:translated-code*//*@lineinfo:30^26*/ { org.apache.struts.taglib.html.TextTag __jsp_taghandler_10=(org.apache.struts.taglib.html.TextTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.TextTag.class,"org.apache.struts.taglib.html.TextTag maxlength name property readonly size"); __jsp_taghandler_10.setParent(__jsp_taghandler_5); __jsp_taghandler_10.setMaxlength("10"); __jsp_taghandler_10.setName("ActivosForm"); __jsp_taghandler_10.setProperty("act_codreg"); __jsp_taghandler_10.setReadonly(true); __jsp_taghandler_10.setSize("10"); __jsp_tag_starteval=__jsp_taghandler_10.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_10,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_10.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_10.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_10); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[14]); /*@lineinfo:translated-code*//*@lineinfo:31^10*/ { org.apache.struts.taglib.html.TextTag __jsp_taghandler_11=(org.apache.struts.taglib.html.TextTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.TextTag.class,"org.apache.struts.taglib.html.TextTag maxlength name property readonly size"); __jsp_taghandler_11.setParent(__jsp_taghandler_5); __jsp_taghandler_11.setMaxlength("60"); __jsp_taghandler_11.setName("ActivosForm"); __jsp_taghandler_11.setProperty("act_regdescripcion"); __jsp_taghandler_11.setReadonly(true); __jsp_taghandler_11.setSize("60"); __jsp_tag_starteval=__jsp_taghandler_11.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_11,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_11.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_11.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_11); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[15]); /*@lineinfo:translated-code*//*@lineinfo:34^27*/ { org.apache.struts.taglib.bean.MessageTag __jsp_taghandler_12=(org.apache.struts.taglib.bean.MessageTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.bean.MessageTag.class,"org.apache.struts.taglib.bean.MessageTag key"); __jsp_taghandler_12.setParent(__jsp_taghandler_5); __jsp_taghandler_12.setKey("activos4.codigo"); __jsp_tag_starteval=__jsp_taghandler_12.doStartTag(); if (OracleJspRuntime.checkStartTagEval(__jsp_tag_starteval)) { do { } while (__jsp_taghandler_12.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); } if (__jsp_taghandler_12.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_12); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[16]); /*@lineinfo:translated-code*//*@lineinfo:35^26*/ { org.apache.struts.taglib.html.TextTag __jsp_taghandler_13=(org.apache.struts.taglib.html.TextTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.TextTag.class,"org.apache.struts.taglib.html.TextTag maxlength name property readonly size"); __jsp_taghandler_13.setParent(__jsp_taghandler_5); __jsp_taghandler_13.setMaxlength("5"); __jsp_taghandler_13.setName("ActivosForm"); __jsp_taghandler_13.setProperty("act_codigo"); __jsp_taghandler_13.setReadonly(true); __jsp_taghandler_13.setSize("5"); __jsp_tag_starteval=__jsp_taghandler_13.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_13,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_13.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_13.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_13); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[17]); /*@lineinfo:translated-code*//*@lineinfo:36^10*/ { org.apache.struts.taglib.html.TextTag __jsp_taghandler_14=(org.apache.struts.taglib.html.TextTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.TextTag.class,"org.apache.struts.taglib.html.TextTag maxlength name property readonly size"); __jsp_taghandler_14.setParent(__jsp_taghandler_5); __jsp_taghandler_14.setMaxlength("10"); __jsp_taghandler_14.setName("ActivosForm"); __jsp_taghandler_14.setProperty("act_codbarra"); __jsp_taghandler_14.setReadonly(true); __jsp_taghandler_14.setSize("10"); __jsp_tag_starteval=__jsp_taghandler_14.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_14,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_14.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_14.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_14); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[18]); /*@lineinfo:translated-code*//*@lineinfo:39^27*/ { org.apache.struts.taglib.bean.MessageTag __jsp_taghandler_15=(org.apache.struts.taglib.bean.MessageTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.bean.MessageTag.class,"org.apache.struts.taglib.bean.MessageTag key"); __jsp_taghandler_15.setParent(__jsp_taghandler_5); __jsp_taghandler_15.setKey("activos4.codgrp"); __jsp_tag_starteval=__jsp_taghandler_15.doStartTag(); if (OracleJspRuntime.checkStartTagEval(__jsp_tag_starteval)) { do { } while (__jsp_taghandler_15.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); } if (__jsp_taghandler_15.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_15); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[19]); /*@lineinfo:translated-code*//*@lineinfo:41^14*/ { org.apache.struts.taglib.html.TextTag __jsp_taghandler_16=(org.apache.struts.taglib.html.TextTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.TextTag.class,"org.apache.struts.taglib.html.TextTag maxlength name property readonly size"); __jsp_taghandler_16.setParent(__jsp_taghandler_5); __jsp_taghandler_16.setMaxlength("40"); __jsp_taghandler_16.setName("ActivosForm"); __jsp_taghandler_16.setProperty("act_grpdescripcion"); __jsp_taghandler_16.setReadonly(true); __jsp_taghandler_16.setSize("40"); __jsp_tag_starteval=__jsp_taghandler_16.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_16,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_16.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_16.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_16); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[20]); /*@lineinfo:translated-code*//*@lineinfo:42^14*/ { org.apache.struts.taglib.html.HiddenTag __jsp_taghandler_17=(org.apache.struts.taglib.html.HiddenTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.HiddenTag.class,"org.apache.struts.taglib.html.HiddenTag name property"); __jsp_taghandler_17.setParent(__jsp_taghandler_5); __jsp_taghandler_17.setName("ActivosForm"); __jsp_taghandler_17.setProperty("act_codgrp"); __jsp_tag_starteval=__jsp_taghandler_17.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_17,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_17.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_17.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_17); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[21]); /*@lineinfo:translated-code*//*@lineinfo:44^27*/ { org.apache.struts.taglib.bean.MessageTag __jsp_taghandler_18=(org.apache.struts.taglib.bean.MessageTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.bean.MessageTag.class,"org.apache.struts.taglib.bean.MessageTag key"); __jsp_taghandler_18.setParent(__jsp_taghandler_5); __jsp_taghandler_18.setKey("activos4.codpar"); __jsp_tag_starteval=__jsp_taghandler_18.doStartTag(); if (OracleJspRuntime.checkStartTagEval(__jsp_tag_starteval)) { do { } while (__jsp_taghandler_18.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); } if (__jsp_taghandler_18.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_18); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[22]); /*@lineinfo:translated-code*//*@lineinfo:46^15*/ { org.apache.struts.taglib.html.TextTag __jsp_taghandler_19=(org.apache.struts.taglib.html.TextTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.TextTag.class,"org.apache.struts.taglib.html.TextTag maxlength name property readonly size"); __jsp_taghandler_19.setParent(__jsp_taghandler_5); __jsp_taghandler_19.setMaxlength("40"); __jsp_taghandler_19.setName("ActivosForm"); __jsp_taghandler_19.setProperty("act_pardescripcion"); __jsp_taghandler_19.setReadonly(true); __jsp_taghandler_19.setSize("40"); __jsp_tag_starteval=__jsp_taghandler_19.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_19,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_19.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_19.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_19); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[23]); /*@lineinfo:translated-code*//*@lineinfo:47^15*/ { org.apache.struts.taglib.html.HiddenTag __jsp_taghandler_20=(org.apache.struts.taglib.html.HiddenTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.HiddenTag.class,"org.apache.struts.taglib.html.HiddenTag name property"); __jsp_taghandler_20.setParent(__jsp_taghandler_5); __jsp_taghandler_20.setName("ActivosForm"); __jsp_taghandler_20.setProperty("act_codpar"); __jsp_tag_starteval=__jsp_taghandler_20.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_20,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_20.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_20.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_20); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[24]); /*@lineinfo:translated-code*//*@lineinfo:51^27*/ { org.apache.struts.taglib.bean.MessageTag __jsp_taghandler_21=(org.apache.struts.taglib.bean.MessageTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.bean.MessageTag.class,"org.apache.struts.taglib.bean.MessageTag key"); __jsp_taghandler_21.setParent(__jsp_taghandler_5); __jsp_taghandler_21.setKey("activos4.codofi"); __jsp_tag_starteval=__jsp_taghandler_21.doStartTag(); if (OracleJspRuntime.checkStartTagEval(__jsp_tag_starteval)) { do { } while (__jsp_taghandler_21.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); } if (__jsp_taghandler_21.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_21); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[25]); /*@lineinfo:translated-code*//*@lineinfo:53^10*/ { org.apache.struts.taglib.html.TextTag __jsp_taghandler_22=(org.apache.struts.taglib.html.TextTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.TextTag.class,"org.apache.struts.taglib.html.TextTag maxlength name property readonly size"); __jsp_taghandler_22.setParent(__jsp_taghandler_5); __jsp_taghandler_22.setMaxlength("40"); __jsp_taghandler_22.setName("ActivosForm"); __jsp_taghandler_22.setProperty("act_ofidescripcion"); __jsp_taghandler_22.setReadonly(true); __jsp_taghandler_22.setSize("40"); __jsp_tag_starteval=__jsp_taghandler_22.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_22,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_22.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_22.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_22); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[26]); /*@lineinfo:translated-code*//*@lineinfo:54^10*/ { org.apache.struts.taglib.html.HiddenTag __jsp_taghandler_23=(org.apache.struts.taglib.html.HiddenTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.HiddenTag.class,"org.apache.struts.taglib.html.HiddenTag name property"); __jsp_taghandler_23.setParent(__jsp_taghandler_5); __jsp_taghandler_23.setName("ActivosForm"); __jsp_taghandler_23.setProperty("act_codofi"); __jsp_tag_starteval=__jsp_taghandler_23.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_23,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_23.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_23.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_23); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[27]); /*@lineinfo:translated-code*//*@lineinfo:56^27*/ { org.apache.struts.taglib.bean.MessageTag __jsp_taghandler_24=(org.apache.struts.taglib.bean.MessageTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.bean.MessageTag.class,"org.apache.struts.taglib.bean.MessageTag key"); __jsp_taghandler_24.setParent(__jsp_taghandler_5); __jsp_taghandler_24.setKey("activos4.codfun"); __jsp_tag_starteval=__jsp_taghandler_24.doStartTag(); if (OracleJspRuntime.checkStartTagEval(__jsp_tag_starteval)) { do { } while (__jsp_taghandler_24.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); } if (__jsp_taghandler_24.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_24); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[28]); /*@lineinfo:translated-code*//*@lineinfo:58^10*/ { org.apache.struts.taglib.html.TextTag __jsp_taghandler_25=(org.apache.struts.taglib.html.TextTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.TextTag.class,"org.apache.struts.taglib.html.TextTag maxlength name property readonly size"); __jsp_taghandler_25.setParent(__jsp_taghandler_5); __jsp_taghandler_25.setMaxlength("40"); __jsp_taghandler_25.setName("ActivosForm"); __jsp_taghandler_25.setProperty("act_fundescripcion"); __jsp_taghandler_25.setReadonly(true); __jsp_taghandler_25.setSize("40"); __jsp_tag_starteval=__jsp_taghandler_25.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_25,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_25.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_25.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_25); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[29]); /*@lineinfo:translated-code*//*@lineinfo:59^10*/ { org.apache.struts.taglib.html.HiddenTag __jsp_taghandler_26=(org.apache.struts.taglib.html.HiddenTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.HiddenTag.class,"org.apache.struts.taglib.html.HiddenTag name property"); __jsp_taghandler_26.setParent(__jsp_taghandler_5); __jsp_taghandler_26.setName("ActivosForm"); __jsp_taghandler_26.setProperty("act_codfun"); __jsp_tag_starteval=__jsp_taghandler_26.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_26,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_26.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_26.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_26); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[30]); /*@lineinfo:translated-code*//*@lineinfo:63^27*/ { org.apache.struts.taglib.bean.MessageTag __jsp_taghandler_27=(org.apache.struts.taglib.bean.MessageTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.bean.MessageTag.class,"org.apache.struts.taglib.bean.MessageTag key"); __jsp_taghandler_27.setParent(__jsp_taghandler_5); __jsp_taghandler_27.setKey("activos4.codubi"); __jsp_tag_starteval=__jsp_taghandler_27.doStartTag(); if (OracleJspRuntime.checkStartTagEval(__jsp_tag_starteval)) { do { } while (__jsp_taghandler_27.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); } if (__jsp_taghandler_27.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_27); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[31]); /*@lineinfo:translated-code*//*@lineinfo:65^15*/ { org.apache.struts.taglib.html.TextTag __jsp_taghandler_28=(org.apache.struts.taglib.html.TextTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.TextTag.class,"org.apache.struts.taglib.html.TextTag maxlength name property readonly size"); __jsp_taghandler_28.setParent(__jsp_taghandler_5); __jsp_taghandler_28.setMaxlength("40"); __jsp_taghandler_28.setName("ActivosForm"); __jsp_taghandler_28.setProperty("act_ubidescripcion"); __jsp_taghandler_28.setReadonly(true); __jsp_taghandler_28.setSize("40"); __jsp_tag_starteval=__jsp_taghandler_28.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_28,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_28.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_28.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_28); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[32]); /*@lineinfo:translated-code*//*@lineinfo:66^15*/ { org.apache.struts.taglib.html.HiddenTag __jsp_taghandler_29=(org.apache.struts.taglib.html.HiddenTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.HiddenTag.class,"org.apache.struts.taglib.html.HiddenTag name property"); __jsp_taghandler_29.setParent(__jsp_taghandler_5); __jsp_taghandler_29.setName("ActivosForm"); __jsp_taghandler_29.setProperty("act_codubi"); __jsp_tag_starteval=__jsp_taghandler_29.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_29,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_29.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_29.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_29); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[33]); /*@lineinfo:translated-code*//*@lineinfo:68^27*/ { org.apache.struts.taglib.bean.MessageTag __jsp_taghandler_30=(org.apache.struts.taglib.bean.MessageTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.bean.MessageTag.class,"org.apache.struts.taglib.bean.MessageTag key"); __jsp_taghandler_30.setParent(__jsp_taghandler_5); __jsp_taghandler_30.setKey("activos4.codpry"); __jsp_tag_starteval=__jsp_taghandler_30.doStartTag(); if (OracleJspRuntime.checkStartTagEval(__jsp_tag_starteval)) { do { } while (__jsp_taghandler_30.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); } if (__jsp_taghandler_30.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_30); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[34]); /*@lineinfo:translated-code*//*@lineinfo:70^15*/ { org.apache.struts.taglib.html.TextTag __jsp_taghandler_31=(org.apache.struts.taglib.html.TextTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.TextTag.class,"org.apache.struts.taglib.html.TextTag maxlength name property readonly size"); __jsp_taghandler_31.setParent(__jsp_taghandler_5); __jsp_taghandler_31.setMaxlength("40"); __jsp_taghandler_31.setName("ActivosForm"); __jsp_taghandler_31.setProperty("act_prydescripcion"); __jsp_taghandler_31.setReadonly(true); __jsp_taghandler_31.setSize("40"); __jsp_tag_starteval=__jsp_taghandler_31.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_31,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_31.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_31.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_31); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[35]); /*@lineinfo:translated-code*//*@lineinfo:71^15*/ { org.apache.struts.taglib.html.HiddenTag __jsp_taghandler_32=(org.apache.struts.taglib.html.HiddenTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.HiddenTag.class,"org.apache.struts.taglib.html.HiddenTag name property"); __jsp_taghandler_32.setParent(__jsp_taghandler_5); __jsp_taghandler_32.setName("ActivosForm"); __jsp_taghandler_32.setProperty("act_codpry"); __jsp_tag_starteval=__jsp_taghandler_32.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_32,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_32.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_32.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_32); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[36]); /*@lineinfo:translated-code*//*@lineinfo:75^27*/ { org.apache.struts.taglib.bean.MessageTag __jsp_taghandler_33=(org.apache.struts.taglib.bean.MessageTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.bean.MessageTag.class,"org.apache.struts.taglib.bean.MessageTag key"); __jsp_taghandler_33.setParent(__jsp_taghandler_5); __jsp_taghandler_33.setKey("activos4.codfin"); __jsp_tag_starteval=__jsp_taghandler_33.doStartTag(); if (OracleJspRuntime.checkStartTagEval(__jsp_tag_starteval)) { do { } while (__jsp_taghandler_33.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); } if (__jsp_taghandler_33.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_33); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[37]); /*@lineinfo:translated-code*//*@lineinfo:77^15*/ { org.apache.struts.taglib.html.TextTag __jsp_taghandler_34=(org.apache.struts.taglib.html.TextTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.TextTag.class,"org.apache.struts.taglib.html.TextTag maxlength name property readonly size"); __jsp_taghandler_34.setParent(__jsp_taghandler_5); __jsp_taghandler_34.setMaxlength("40"); __jsp_taghandler_34.setName("ActivosForm"); __jsp_taghandler_34.setProperty("act_findescripcion"); __jsp_taghandler_34.setReadonly(true); __jsp_taghandler_34.setSize("40"); __jsp_tag_starteval=__jsp_taghandler_34.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_34,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_34.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_34.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_34); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[38]); /*@lineinfo:translated-code*//*@lineinfo:78^15*/ { org.apache.struts.taglib.html.HiddenTag __jsp_taghandler_35=(org.apache.struts.taglib.html.HiddenTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.HiddenTag.class,"org.apache.struts.taglib.html.HiddenTag name property"); __jsp_taghandler_35.setParent(__jsp_taghandler_5); __jsp_taghandler_35.setName("ActivosForm"); __jsp_taghandler_35.setProperty("act_codfin"); __jsp_tag_starteval=__jsp_taghandler_35.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_35,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_35.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_35.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_35); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[39]); /*@lineinfo:translated-code*//*@lineinfo:82^27*/ { org.apache.struts.taglib.bean.MessageTag __jsp_taghandler_36=(org.apache.struts.taglib.bean.MessageTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.bean.MessageTag.class,"org.apache.struts.taglib.bean.MessageTag key"); __jsp_taghandler_36.setParent(__jsp_taghandler_5); __jsp_taghandler_36.setKey("activos4.feccompra"); __jsp_tag_starteval=__jsp_taghandler_36.doStartTag(); if (OracleJspRuntime.checkStartTagEval(__jsp_tag_starteval)) { do { } while (__jsp_taghandler_36.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); } if (__jsp_taghandler_36.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_36); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[40]); /*@lineinfo:translated-code*//*@lineinfo:83^14*/ { org.apache.struts.taglib.html.TextTag __jsp_taghandler_37=(org.apache.struts.taglib.html.TextTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.TextTag.class,"org.apache.struts.taglib.html.TextTag maxlength name property readonly size"); __jsp_taghandler_37.setParent(__jsp_taghandler_5); __jsp_taghandler_37.setMaxlength("10"); __jsp_taghandler_37.setName("ActivosForm"); __jsp_taghandler_37.setProperty("act_feccompra"); __jsp_taghandler_37.setReadonly(true); __jsp_taghandler_37.setSize("10"); __jsp_tag_starteval=__jsp_taghandler_37.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_37,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_37.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_37.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_37); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[41]); /*@lineinfo:translated-code*//*@lineinfo:84^27*/ { org.apache.struts.taglib.bean.MessageTag __jsp_taghandler_38=(org.apache.struts.taglib.bean.MessageTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.bean.MessageTag.class,"org.apache.struts.taglib.bean.MessageTag key"); __jsp_taghandler_38.setParent(__jsp_taghandler_5); __jsp_taghandler_38.setKey("activos4.tipcam"); __jsp_tag_starteval=__jsp_taghandler_38.doStartTag(); if (OracleJspRuntime.checkStartTagEval(__jsp_tag_starteval)) { do { } while (__jsp_taghandler_38.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); } if (__jsp_taghandler_38.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_38); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[42]); /*@lineinfo:translated-code*//*@lineinfo:85^14*/ { org.apache.struts.taglib.html.TextTag __jsp_taghandler_39=(org.apache.struts.taglib.html.TextTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.TextTag.class,"org.apache.struts.taglib.html.TextTag maxlength name property readonly size"); __jsp_taghandler_39.setParent(__jsp_taghandler_5); __jsp_taghandler_39.setMaxlength("11"); __jsp_taghandler_39.setName("ActivosForm"); __jsp_taghandler_39.setProperty("act_tipcam"); __jsp_taghandler_39.setReadonly(true); __jsp_taghandler_39.setSize("11"); __jsp_tag_starteval=__jsp_taghandler_39.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_39,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_39.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_39.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_39); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[43]); /*@lineinfo:translated-code*//*@lineinfo:88^27*/ { org.apache.struts.taglib.bean.MessageTag __jsp_taghandler_40=(org.apache.struts.taglib.bean.MessageTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.bean.MessageTag.class,"org.apache.struts.taglib.bean.MessageTag key"); __jsp_taghandler_40.setParent(__jsp_taghandler_5); __jsp_taghandler_40.setKey("activos4.tipufv"); __jsp_tag_starteval=__jsp_taghandler_40.doStartTag(); if (OracleJspRuntime.checkStartTagEval(__jsp_tag_starteval)) { do { } while (__jsp_taghandler_40.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); } if (__jsp_taghandler_40.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_40); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[44]); /*@lineinfo:translated-code*//*@lineinfo:89^14*/ { org.apache.struts.taglib.html.TextTag __jsp_taghandler_41=(org.apache.struts.taglib.html.TextTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.TextTag.class,"org.apache.struts.taglib.html.TextTag maxlength name property readonly size"); __jsp_taghandler_41.setParent(__jsp_taghandler_5); __jsp_taghandler_41.setMaxlength("11"); __jsp_taghandler_41.setName("ActivosForm"); __jsp_taghandler_41.setProperty("act_tipufv"); __jsp_taghandler_41.setReadonly(true); __jsp_taghandler_41.setSize("11"); __jsp_tag_starteval=__jsp_taghandler_41.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_41,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_41.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_41.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_41); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[45]); /*@lineinfo:translated-code*//*@lineinfo:90^27*/ { org.apache.struts.taglib.bean.MessageTag __jsp_taghandler_42=(org.apache.struts.taglib.bean.MessageTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.bean.MessageTag.class,"org.apache.struts.taglib.bean.MessageTag key"); __jsp_taghandler_42.setParent(__jsp_taghandler_5); __jsp_taghandler_42.setKey("activos4.umanejo"); __jsp_tag_starteval=__jsp_taghandler_42.doStartTag(); if (OracleJspRuntime.checkStartTagEval(__jsp_tag_starteval)) { do { } while (__jsp_taghandler_42.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); } if (__jsp_taghandler_42.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_42); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[46]); /*@lineinfo:translated-code*//*@lineinfo:91^14*/ { org.apache.struts.taglib.html.TextTag __jsp_taghandler_43=(org.apache.struts.taglib.html.TextTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.TextTag.class,"org.apache.struts.taglib.html.TextTag maxlength name property readonly size"); __jsp_taghandler_43.setParent(__jsp_taghandler_5); __jsp_taghandler_43.setMaxlength("20"); __jsp_taghandler_43.setName("ActivosForm"); __jsp_taghandler_43.setProperty("act_umanejo"); __jsp_taghandler_43.setReadonly(true); __jsp_taghandler_43.setSize("20"); __jsp_tag_starteval=__jsp_taghandler_43.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_43,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_43.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_43.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_43); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[47]); /*@lineinfo:translated-code*//*@lineinfo:96^27*/ { org.apache.struts.taglib.bean.MessageTag __jsp_taghandler_44=(org.apache.struts.taglib.bean.MessageTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.bean.MessageTag.class,"org.apache.struts.taglib.bean.MessageTag key"); __jsp_taghandler_44.setParent(__jsp_taghandler_5); __jsp_taghandler_44.setKey("activos4.descripcion"); __jsp_tag_starteval=__jsp_taghandler_44.doStartTag(); if (OracleJspRuntime.checkStartTagEval(__jsp_tag_starteval)) { do { } while (__jsp_taghandler_44.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); } if (__jsp_taghandler_44.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_44); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[48]); /*@lineinfo:translated-code*//*@lineinfo:97^14*/ { org.apache.struts.taglib.html.TextTag __jsp_taghandler_45=(org.apache.struts.taglib.html.TextTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.TextTag.class,"org.apache.struts.taglib.html.TextTag maxlength name property readonly size"); __jsp_taghandler_45.setParent(__jsp_taghandler_5); __jsp_taghandler_45.setMaxlength("120"); __jsp_taghandler_45.setName("ActivosForm"); __jsp_taghandler_45.setProperty("act_descripcion"); __jsp_taghandler_45.setReadonly(true); __jsp_taghandler_45.setSize("60"); __jsp_tag_starteval=__jsp_taghandler_45.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_45,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_45.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_45.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_45); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[49]); /*@lineinfo:translated-code*//*@lineinfo:100^27*/ { org.apache.struts.taglib.bean.MessageTag __jsp_taghandler_46=(org.apache.struts.taglib.bean.MessageTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.bean.MessageTag.class,"org.apache.struts.taglib.bean.MessageTag key"); __jsp_taghandler_46.setParent(__jsp_taghandler_5); __jsp_taghandler_46.setKey("activos4.desadicional"); __jsp_tag_starteval=__jsp_taghandler_46.doStartTag(); if (OracleJspRuntime.checkStartTagEval(__jsp_tag_starteval)) { do { } while (__jsp_taghandler_46.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); } if (__jsp_taghandler_46.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_46); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[50]); /*@lineinfo:translated-code*//*@lineinfo:101^14*/ { org.apache.struts.taglib.html.TextTag __jsp_taghandler_47=(org.apache.struts.taglib.html.TextTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.TextTag.class,"org.apache.struts.taglib.html.TextTag maxlength name property readonly size"); __jsp_taghandler_47.setParent(__jsp_taghandler_5); __jsp_taghandler_47.setMaxlength("240"); __jsp_taghandler_47.setName("ActivosForm"); __jsp_taghandler_47.setProperty("act_desadicional"); __jsp_taghandler_47.setReadonly(true); __jsp_taghandler_47.setSize("60"); __jsp_tag_starteval=__jsp_taghandler_47.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_47,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_47.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_47.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_47); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[51]); /*@lineinfo:translated-code*//*@lineinfo:105^13*/ { org.apache.struts.taglib.bean.MessageTag __jsp_taghandler_48=(org.apache.struts.taglib.bean.MessageTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.bean.MessageTag.class,"org.apache.struts.taglib.bean.MessageTag key"); __jsp_taghandler_48.setParent(__jsp_taghandler_5); __jsp_taghandler_48.setKey("activos.proveedor"); __jsp_tag_starteval=__jsp_taghandler_48.doStartTag(); if (OracleJspRuntime.checkStartTagEval(__jsp_tag_starteval)) { do { } while (__jsp_taghandler_48.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); } if (__jsp_taghandler_48.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_48); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[52]); /*@lineinfo:translated-code*//*@lineinfo:108^13*/ { org.apache.struts.taglib.html.TextTag __jsp_taghandler_49=(org.apache.struts.taglib.html.TextTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.TextTag.class,"org.apache.struts.taglib.html.TextTag maxlength name property readonly size"); __jsp_taghandler_49.setParent(__jsp_taghandler_5); __jsp_taghandler_49.setMaxlength("50"); __jsp_taghandler_49.setName("ActivosForm"); __jsp_taghandler_49.setProperty("act_proveedor"); __jsp_taghandler_49.setReadonly(true); __jsp_taghandler_49.setSize("50"); __jsp_tag_starteval=__jsp_taghandler_49.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_49,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_49.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_49.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_49); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[53]); /*@lineinfo:translated-code*//*@lineinfo:114^27*/ { org.apache.struts.taglib.bean.MessageTag __jsp_taghandler_50=(org.apache.struts.taglib.bean.MessageTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.bean.MessageTag.class,"org.apache.struts.taglib.bean.MessageTag key"); __jsp_taghandler_50.setParent(__jsp_taghandler_5); __jsp_taghandler_50.setKey("activos4.marca"); __jsp_tag_starteval=__jsp_taghandler_50.doStartTag(); if (OracleJspRuntime.checkStartTagEval(__jsp_tag_starteval)) { do { } while (__jsp_taghandler_50.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); } if (__jsp_taghandler_50.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_50); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[54]); /*@lineinfo:translated-code*//*@lineinfo:115^14*/ { org.apache.struts.taglib.html.TextTag __jsp_taghandler_51=(org.apache.struts.taglib.html.TextTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.TextTag.class,"org.apache.struts.taglib.html.TextTag maxlength name property readonly size"); __jsp_taghandler_51.setParent(__jsp_taghandler_5); __jsp_taghandler_51.setMaxlength("30"); __jsp_taghandler_51.setName("ActivosForm"); __jsp_taghandler_51.setProperty("act_marca"); __jsp_taghandler_51.setReadonly(true); __jsp_taghandler_51.setSize("30"); __jsp_tag_starteval=__jsp_taghandler_51.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_51,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_51.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_51.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_51); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[55]); /*@lineinfo:translated-code*//*@lineinfo:116^27*/ { org.apache.struts.taglib.bean.MessageTag __jsp_taghandler_52=(org.apache.struts.taglib.bean.MessageTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.bean.MessageTag.class,"org.apache.struts.taglib.bean.MessageTag key"); __jsp_taghandler_52.setParent(__jsp_taghandler_5); __jsp_taghandler_52.setKey("activos4.color"); __jsp_tag_starteval=__jsp_taghandler_52.doStartTag(); if (OracleJspRuntime.checkStartTagEval(__jsp_tag_starteval)) { do { } while (__jsp_taghandler_52.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); } if (__jsp_taghandler_52.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_52); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[56]); /*@lineinfo:translated-code*//*@lineinfo:117^14*/ { org.apache.struts.taglib.html.TextTag __jsp_taghandler_53=(org.apache.struts.taglib.html.TextTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.TextTag.class,"org.apache.struts.taglib.html.TextTag maxlength name property readonly size"); __jsp_taghandler_53.setParent(__jsp_taghandler_5); __jsp_taghandler_53.setMaxlength("30"); __jsp_taghandler_53.setName("ActivosForm"); __jsp_taghandler_53.setProperty("act_color"); __jsp_taghandler_53.setReadonly(true); __jsp_taghandler_53.setSize("30"); __jsp_tag_starteval=__jsp_taghandler_53.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_53,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_53.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_53.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_53); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[57]); /*@lineinfo:translated-code*//*@lineinfo:120^27*/ { org.apache.struts.taglib.bean.MessageTag __jsp_taghandler_54=(org.apache.struts.taglib.bean.MessageTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.bean.MessageTag.class,"org.apache.struts.taglib.bean.MessageTag key"); __jsp_taghandler_54.setParent(__jsp_taghandler_5); __jsp_taghandler_54.setKey("activos4.procedencia"); __jsp_tag_starteval=__jsp_taghandler_54.doStartTag(); if (OracleJspRuntime.checkStartTagEval(__jsp_tag_starteval)) { do { } while (__jsp_taghandler_54.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); } if (__jsp_taghandler_54.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_54); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[58]); /*@lineinfo:translated-code*//*@lineinfo:121^14*/ { org.apache.struts.taglib.html.TextTag __jsp_taghandler_55=(org.apache.struts.taglib.html.TextTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.TextTag.class,"org.apache.struts.taglib.html.TextTag maxlength name property readonly size"); __jsp_taghandler_55.setParent(__jsp_taghandler_5); __jsp_taghandler_55.setMaxlength("30"); __jsp_taghandler_55.setName("ActivosForm"); __jsp_taghandler_55.setProperty("act_procedencia"); __jsp_taghandler_55.setReadonly(true); __jsp_taghandler_55.setSize("30"); __jsp_tag_starteval=__jsp_taghandler_55.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_55,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_55.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_55.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_55); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[59]); /*@lineinfo:translated-code*//*@lineinfo:122^27*/ { org.apache.struts.taglib.bean.MessageTag __jsp_taghandler_56=(org.apache.struts.taglib.bean.MessageTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.bean.MessageTag.class,"org.apache.struts.taglib.bean.MessageTag key"); __jsp_taghandler_56.setParent(__jsp_taghandler_5); __jsp_taghandler_56.setKey("activos4.gobmunicipal"); __jsp_tag_starteval=__jsp_taghandler_56.doStartTag(); if (OracleJspRuntime.checkStartTagEval(__jsp_tag_starteval)) { do { } while (__jsp_taghandler_56.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); } if (__jsp_taghandler_56.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_56); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[60]); /*@lineinfo:translated-code*//*@lineinfo:123^14*/ { org.apache.struts.taglib.html.TextTag __jsp_taghandler_57=(org.apache.struts.taglib.html.TextTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.TextTag.class,"org.apache.struts.taglib.html.TextTag maxlength name property readonly size"); __jsp_taghandler_57.setParent(__jsp_taghandler_5); __jsp_taghandler_57.setMaxlength("60"); __jsp_taghandler_57.setName("ActivosForm"); __jsp_taghandler_57.setProperty("act_gobmunicipal"); __jsp_taghandler_57.setReadonly(true); __jsp_taghandler_57.setSize("30"); __jsp_tag_starteval=__jsp_taghandler_57.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_57,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_57.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_57.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_57); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[61]); /*@lineinfo:translated-code*//*@lineinfo:126^27*/ { org.apache.struts.taglib.bean.MessageTag __jsp_taghandler_58=(org.apache.struts.taglib.bean.MessageTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.bean.MessageTag.class,"org.apache.struts.taglib.bean.MessageTag key"); __jsp_taghandler_58.setParent(__jsp_taghandler_5); __jsp_taghandler_58.setKey("activos4.valcobol"); __jsp_tag_starteval=__jsp_taghandler_58.doStartTag(); if (OracleJspRuntime.checkStartTagEval(__jsp_tag_starteval)) { do { } while (__jsp_taghandler_58.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); } if (__jsp_taghandler_58.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_58); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[62]); /*@lineinfo:translated-code*//*@lineinfo:127^14*/ { org.apache.struts.taglib.html.TextTag __jsp_taghandler_59=(org.apache.struts.taglib.html.TextTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.TextTag.class,"org.apache.struts.taglib.html.TextTag maxlength name property readonly size"); __jsp_taghandler_59.setParent(__jsp_taghandler_5); __jsp_taghandler_59.setMaxlength("15"); __jsp_taghandler_59.setName("ActivosForm"); __jsp_taghandler_59.setProperty("act_valcobol"); __jsp_taghandler_59.setReadonly(true); __jsp_taghandler_59.setSize("15"); __jsp_tag_starteval=__jsp_taghandler_59.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_59,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_59.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_59.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_59); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[63]); /*@lineinfo:translated-code*//*@lineinfo:128^27*/ { org.apache.struts.taglib.bean.MessageTag __jsp_taghandler_60=(org.apache.struts.taglib.bean.MessageTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.bean.MessageTag.class,"org.apache.struts.taglib.bean.MessageTag key"); __jsp_taghandler_60.setParent(__jsp_taghandler_5); __jsp_taghandler_60.setKey("activos4.ordencompra"); __jsp_tag_starteval=__jsp_taghandler_60.doStartTag(); if (OracleJspRuntime.checkStartTagEval(__jsp_tag_starteval)) { do { } while (__jsp_taghandler_60.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); } if (__jsp_taghandler_60.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_60); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[64]); /*@lineinfo:translated-code*//*@lineinfo:129^14*/ { org.apache.struts.taglib.html.TextTag __jsp_taghandler_61=(org.apache.struts.taglib.html.TextTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.TextTag.class,"org.apache.struts.taglib.html.TextTag maxlength name property readonly size"); __jsp_taghandler_61.setParent(__jsp_taghandler_5); __jsp_taghandler_61.setMaxlength("20"); __jsp_taghandler_61.setName("ActivosForm"); __jsp_taghandler_61.setProperty("act_ordencompra"); __jsp_taghandler_61.setReadonly(true); __jsp_taghandler_61.setSize("20"); __jsp_tag_starteval=__jsp_taghandler_61.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_61,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_61.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_61.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_61); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[65]); /*@lineinfo:translated-code*//*@lineinfo:132^27*/ { org.apache.struts.taglib.bean.MessageTag __jsp_taghandler_62=(org.apache.struts.taglib.bean.MessageTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.bean.MessageTag.class,"org.apache.struts.taglib.bean.MessageTag key"); __jsp_taghandler_62.setParent(__jsp_taghandler_5); __jsp_taghandler_62.setKey("activos4.numfactura"); __jsp_tag_starteval=__jsp_taghandler_62.doStartTag(); if (OracleJspRuntime.checkStartTagEval(__jsp_tag_starteval)) { do { } while (__jsp_taghandler_62.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); } if (__jsp_taghandler_62.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_62); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[66]); /*@lineinfo:translated-code*//*@lineinfo:133^14*/ { org.apache.struts.taglib.html.TextTag __jsp_taghandler_63=(org.apache.struts.taglib.html.TextTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.TextTag.class,"org.apache.struts.taglib.html.TextTag maxlength name property readonly size"); __jsp_taghandler_63.setParent(__jsp_taghandler_5); __jsp_taghandler_63.setMaxlength("8"); __jsp_taghandler_63.setName("ActivosForm"); __jsp_taghandler_63.setProperty("act_numfactura"); __jsp_taghandler_63.setReadonly(true); __jsp_taghandler_63.setSize("8"); __jsp_tag_starteval=__jsp_taghandler_63.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_63,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_63.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_63.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_63); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[67]); /*@lineinfo:translated-code*//*@lineinfo:134^27*/ { org.apache.struts.taglib.bean.MessageTag __jsp_taghandler_64=(org.apache.struts.taglib.bean.MessageTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.bean.MessageTag.class,"org.apache.struts.taglib.bean.MessageTag key"); __jsp_taghandler_64.setParent(__jsp_taghandler_5); __jsp_taghandler_64.setKey("activos4.numcomprobante"); __jsp_tag_starteval=__jsp_taghandler_64.doStartTag(); if (OracleJspRuntime.checkStartTagEval(__jsp_tag_starteval)) { do { } while (__jsp_taghandler_64.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); } if (__jsp_taghandler_64.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_64); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[68]); /*@lineinfo:translated-code*//*@lineinfo:135^14*/ { org.apache.struts.taglib.html.TextTag __jsp_taghandler_65=(org.apache.struts.taglib.html.TextTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.TextTag.class,"org.apache.struts.taglib.html.TextTag maxlength name property readonly size"); __jsp_taghandler_65.setParent(__jsp_taghandler_5); __jsp_taghandler_65.setMaxlength("20"); __jsp_taghandler_65.setName("ActivosForm"); __jsp_taghandler_65.setProperty("act_numcomprobante"); __jsp_taghandler_65.setReadonly(true); __jsp_taghandler_65.setSize("20"); __jsp_tag_starteval=__jsp_taghandler_65.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_65,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_65.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_65.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_65); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[69]); /*@lineinfo:translated-code*//*@lineinfo:138^27*/ { org.apache.struts.taglib.bean.MessageTag __jsp_taghandler_66=(org.apache.struts.taglib.bean.MessageTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.bean.MessageTag.class,"org.apache.struts.taglib.bean.MessageTag key"); __jsp_taghandler_66.setParent(__jsp_taghandler_5); __jsp_taghandler_66.setKey("activos4.codanterior"); __jsp_tag_starteval=__jsp_taghandler_66.doStartTag(); if (OracleJspRuntime.checkStartTagEval(__jsp_tag_starteval)) { do { } while (__jsp_taghandler_66.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); } if (__jsp_taghandler_66.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_66); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[70]); /*@lineinfo:translated-code*//*@lineinfo:139^14*/ { org.apache.struts.taglib.html.TextTag __jsp_taghandler_67=(org.apache.struts.taglib.html.TextTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.TextTag.class,"org.apache.struts.taglib.html.TextTag maxlength name property readonly size"); __jsp_taghandler_67.setParent(__jsp_taghandler_5); __jsp_taghandler_67.setMaxlength("20"); __jsp_taghandler_67.setName("ActivosForm"); __jsp_taghandler_67.setProperty("act_codanterior"); __jsp_taghandler_67.setReadonly(true); __jsp_taghandler_67.setSize("20"); __jsp_tag_starteval=__jsp_taghandler_67.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_67,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_67.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_67.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_67); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[71]); /*@lineinfo:translated-code*//*@lineinfo:140^27*/ { org.apache.struts.taglib.bean.MessageTag __jsp_taghandler_68=(org.apache.struts.taglib.bean.MessageTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.bean.MessageTag.class,"org.apache.struts.taglib.bean.MessageTag key"); __jsp_taghandler_68.setParent(__jsp_taghandler_5); __jsp_taghandler_68.setKey("activos4.fecha"); __jsp_tag_starteval=__jsp_taghandler_68.doStartTag(); if (OracleJspRuntime.checkStartTagEval(__jsp_tag_starteval)) { do { } while (__jsp_taghandler_68.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); } if (__jsp_taghandler_68.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_68); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[72]); /*@lineinfo:translated-code*//*@lineinfo:141^14*/ { org.apache.struts.taglib.html.TextTag __jsp_taghandler_69=(org.apache.struts.taglib.html.TextTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.TextTag.class,"org.apache.struts.taglib.html.TextTag maxlength name property readonly size"); __jsp_taghandler_69.setParent(__jsp_taghandler_5); __jsp_taghandler_69.setMaxlength("10"); __jsp_taghandler_69.setName("ActivosForm"); __jsp_taghandler_69.setProperty("rev_fecha"); __jsp_taghandler_69.setReadonly(true); __jsp_taghandler_69.setSize("10"); __jsp_tag_starteval=__jsp_taghandler_69.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_69,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_69.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_69.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_69); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[73]); /*@lineinfo:translated-code*//*@lineinfo:144^27*/ { org.apache.struts.taglib.bean.MessageTag __jsp_taghandler_70=(org.apache.struts.taglib.bean.MessageTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.bean.MessageTag.class,"org.apache.struts.taglib.bean.MessageTag key"); __jsp_taghandler_70.setParent(__jsp_taghandler_5); __jsp_taghandler_70.setKey("activos4.vidaut"); __jsp_tag_starteval=__jsp_taghandler_70.doStartTag(); if (OracleJspRuntime.checkStartTagEval(__jsp_tag_starteval)) { do { } while (__jsp_taghandler_70.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); } if (__jsp_taghandler_70.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_70); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[74]); /*@lineinfo:translated-code*//*@lineinfo:145^14*/ { org.apache.struts.taglib.html.TextTag __jsp_taghandler_71=(org.apache.struts.taglib.html.TextTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.TextTag.class,"org.apache.struts.taglib.html.TextTag maxlength name property readonly size"); __jsp_taghandler_71.setParent(__jsp_taghandler_5); __jsp_taghandler_71.setMaxlength("4"); __jsp_taghandler_71.setName("ActivosForm"); __jsp_taghandler_71.setProperty("rev_vidaut"); __jsp_taghandler_71.setReadonly(true); __jsp_taghandler_71.setSize("4"); __jsp_tag_starteval=__jsp_taghandler_71.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_71,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_71.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_71.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_71); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[75]); /*@lineinfo:translated-code*//*@lineinfo:146^27*/ { org.apache.struts.taglib.bean.MessageTag __jsp_taghandler_72=(org.apache.struts.taglib.bean.MessageTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.bean.MessageTag.class,"org.apache.struts.taglib.bean.MessageTag key"); __jsp_taghandler_72.setParent(__jsp_taghandler_5); __jsp_taghandler_72.setKey("activos4.estadoactivo"); __jsp_tag_starteval=__jsp_taghandler_72.doStartTag(); if (OracleJspRuntime.checkStartTagEval(__jsp_tag_starteval)) { do { } while (__jsp_taghandler_72.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); } if (__jsp_taghandler_72.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_72); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[76]); /*@lineinfo:translated-code*//*@lineinfo:147^14*/ { org.apache.struts.taglib.html.TextTag __jsp_taghandler_73=(org.apache.struts.taglib.html.TextTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.TextTag.class,"org.apache.struts.taglib.html.TextTag name property readonly size"); __jsp_taghandler_73.setParent(__jsp_taghandler_5); __jsp_taghandler_73.setName("ActivosForm"); __jsp_taghandler_73.setProperty("desestado"); __jsp_taghandler_73.setReadonly(true); __jsp_taghandler_73.setSize("10"); __jsp_tag_starteval=__jsp_taghandler_73.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_73,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_73.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_73.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_73); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[77]); /*@lineinfo:translated-code*//*@lineinfo:150^27*/ { org.apache.struts.taglib.bean.MessageTag __jsp_taghandler_74=(org.apache.struts.taglib.bean.MessageTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.bean.MessageTag.class,"org.apache.struts.taglib.bean.MessageTag key"); __jsp_taghandler_74.setParent(__jsp_taghandler_5); __jsp_taghandler_74.setKey("activos4.desestado"); __jsp_tag_starteval=__jsp_taghandler_74.doStartTag(); if (OracleJspRuntime.checkStartTagEval(__jsp_tag_starteval)) { do { } while (__jsp_taghandler_74.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); } if (__jsp_taghandler_74.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_74); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[78]); /*@lineinfo:translated-code*//*@lineinfo:151^14*/ { org.apache.struts.taglib.html.TextTag __jsp_taghandler_75=(org.apache.struts.taglib.html.TextTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.TextTag.class,"org.apache.struts.taglib.html.TextTag maxlength name property readonly size"); __jsp_taghandler_75.setParent(__jsp_taghandler_5); __jsp_taghandler_75.setMaxlength("60"); __jsp_taghandler_75.setName("ActivosForm"); __jsp_taghandler_75.setProperty("rev_desestado"); __jsp_taghandler_75.setReadonly(true); __jsp_taghandler_75.setSize("60"); __jsp_tag_starteval=__jsp_taghandler_75.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_75,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_75.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_75.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_75); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[79]); /*@lineinfo:translated-code*//*@lineinfo:154^24*/ { org.apache.struts.taglib.html.SubmitTag __jsp_taghandler_76=(org.apache.struts.taglib.html.SubmitTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.SubmitTag.class,"org.apache.struts.taglib.html.SubmitTag onclick property styleClass value"); __jsp_taghandler_76.setParent(__jsp_taghandler_5); __jsp_taghandler_76.setOnclick("operacion.value=2;opcion.value=4"); __jsp_taghandler_76.setProperty("boton"); __jsp_taghandler_76.setStyleClass("boton1"); __jsp_taghandler_76.setValue("Consultar"); __jsp_tag_starteval=__jsp_taghandler_76.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_76,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_76.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_76.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_76); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[80]); /*@lineinfo:translated-code*//*@lineinfo:154^137*/ } while (__jsp_taghandler_5.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); } if (__jsp_taghandler_5.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_5); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[81]); /*@lineinfo:translated-code*//*@lineinfo:158^4*/ { org.apache.struts.taglib.logic.EqualTag __jsp_taghandler_77=(org.apache.struts.taglib.logic.EqualTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.logic.EqualTag.class,"org.apache.struts.taglib.logic.EqualTag name property value"); __jsp_taghandler_77.setParent(__jsp_taghandler_4); __jsp_taghandler_77.setName("ActivosForm"); __jsp_taghandler_77.setProperty("opcion"); __jsp_taghandler_77.setValue("5"); __jsp_tag_starteval=__jsp_taghandler_77.doStartTag(); if (OracleJspRuntime.checkStartTagEval(__jsp_tag_starteval)) { do { /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[82]); /*@lineinfo:translated-code*//*@lineinfo:161^27*/ { org.apache.struts.taglib.bean.MessageTag __jsp_taghandler_78=(org.apache.struts.taglib.bean.MessageTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.bean.MessageTag.class,"org.apache.struts.taglib.bean.MessageTag key"); __jsp_taghandler_78.setParent(__jsp_taghandler_77); __jsp_taghandler_78.setKey("activos4.codrub"); __jsp_tag_starteval=__jsp_taghandler_78.doStartTag(); if (OracleJspRuntime.checkStartTagEval(__jsp_tag_starteval)) { do { } while (__jsp_taghandler_78.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); } if (__jsp_taghandler_78.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_78); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[83]); /*@lineinfo:translated-code*//*@lineinfo:162^26*/ { org.apache.struts.taglib.html.TextTag __jsp_taghandler_79=(org.apache.struts.taglib.html.TextTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.TextTag.class,"org.apache.struts.taglib.html.TextTag maxlength name property readonly size"); __jsp_taghandler_79.setParent(__jsp_taghandler_77); __jsp_taghandler_79.setMaxlength("10"); __jsp_taghandler_79.setName("ActivosForm"); __jsp_taghandler_79.setProperty("act_codrub"); __jsp_taghandler_79.setReadonly(true); __jsp_taghandler_79.setSize("10"); __jsp_tag_starteval=__jsp_taghandler_79.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_79,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_79.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_79.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_79); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[84]); /*@lineinfo:translated-code*//*@lineinfo:163^10*/ { org.apache.struts.taglib.html.TextTag __jsp_taghandler_80=(org.apache.struts.taglib.html.TextTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.TextTag.class,"org.apache.struts.taglib.html.TextTag maxlength name property readonly size"); __jsp_taghandler_80.setParent(__jsp_taghandler_77); __jsp_taghandler_80.setMaxlength("60"); __jsp_taghandler_80.setName("ActivosForm"); __jsp_taghandler_80.setProperty("act_rubdescripcion"); __jsp_taghandler_80.setReadonly(true); __jsp_taghandler_80.setSize("60"); __jsp_tag_starteval=__jsp_taghandler_80.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_80,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_80.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_80.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_80); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[85]); /*@lineinfo:translated-code*//*@lineinfo:166^27*/ { org.apache.struts.taglib.bean.MessageTag __jsp_taghandler_81=(org.apache.struts.taglib.bean.MessageTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.bean.MessageTag.class,"org.apache.struts.taglib.bean.MessageTag key"); __jsp_taghandler_81.setParent(__jsp_taghandler_77); __jsp_taghandler_81.setKey("activos4.codreg"); __jsp_tag_starteval=__jsp_taghandler_81.doStartTag(); if (OracleJspRuntime.checkStartTagEval(__jsp_tag_starteval)) { do { } while (__jsp_taghandler_81.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); } if (__jsp_taghandler_81.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_81); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[86]); /*@lineinfo:translated-code*//*@lineinfo:167^26*/ { org.apache.struts.taglib.html.TextTag __jsp_taghandler_82=(org.apache.struts.taglib.html.TextTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.TextTag.class,"org.apache.struts.taglib.html.TextTag maxlength name property readonly size"); __jsp_taghandler_82.setParent(__jsp_taghandler_77); __jsp_taghandler_82.setMaxlength("10"); __jsp_taghandler_82.setName("ActivosForm"); __jsp_taghandler_82.setProperty("act_codreg"); __jsp_taghandler_82.setReadonly(true); __jsp_taghandler_82.setSize("10"); __jsp_tag_starteval=__jsp_taghandler_82.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_82,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_82.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_82.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_82); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[87]); /*@lineinfo:translated-code*//*@lineinfo:168^10*/ { org.apache.struts.taglib.html.TextTag __jsp_taghandler_83=(org.apache.struts.taglib.html.TextTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.TextTag.class,"org.apache.struts.taglib.html.TextTag maxlength name property readonly size"); __jsp_taghandler_83.setParent(__jsp_taghandler_77); __jsp_taghandler_83.setMaxlength("60"); __jsp_taghandler_83.setName("ActivosForm"); __jsp_taghandler_83.setProperty("act_regdescripcion"); __jsp_taghandler_83.setReadonly(true); __jsp_taghandler_83.setSize("60"); __jsp_tag_starteval=__jsp_taghandler_83.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_83,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_83.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_83.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_83); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[88]); /*@lineinfo:translated-code*//*@lineinfo:171^27*/ { org.apache.struts.taglib.bean.MessageTag __jsp_taghandler_84=(org.apache.struts.taglib.bean.MessageTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.bean.MessageTag.class,"org.apache.struts.taglib.bean.MessageTag key"); __jsp_taghandler_84.setParent(__jsp_taghandler_77); __jsp_taghandler_84.setKey("activos4.codigo"); __jsp_tag_starteval=__jsp_taghandler_84.doStartTag(); if (OracleJspRuntime.checkStartTagEval(__jsp_tag_starteval)) { do { } while (__jsp_taghandler_84.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); } if (__jsp_taghandler_84.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_84); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[89]); /*@lineinfo:translated-code*//*@lineinfo:172^26*/ { org.apache.struts.taglib.html.TextTag __jsp_taghandler_85=(org.apache.struts.taglib.html.TextTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.TextTag.class,"org.apache.struts.taglib.html.TextTag maxlength name property readonly size"); __jsp_taghandler_85.setParent(__jsp_taghandler_77); __jsp_taghandler_85.setMaxlength("5"); __jsp_taghandler_85.setName("ActivosForm"); __jsp_taghandler_85.setProperty("act_codigo"); __jsp_taghandler_85.setReadonly(true); __jsp_taghandler_85.setSize("5"); __jsp_tag_starteval=__jsp_taghandler_85.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_85,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_85.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_85.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_85); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[90]); /*@lineinfo:translated-code*//*@lineinfo:173^10*/ { org.apache.struts.taglib.html.TextTag __jsp_taghandler_86=(org.apache.struts.taglib.html.TextTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.TextTag.class,"org.apache.struts.taglib.html.TextTag maxlength name property readonly size"); __jsp_taghandler_86.setParent(__jsp_taghandler_77); __jsp_taghandler_86.setMaxlength("10"); __jsp_taghandler_86.setName("ActivosForm"); __jsp_taghandler_86.setProperty("act_codbarra"); __jsp_taghandler_86.setReadonly(true); __jsp_taghandler_86.setSize("10"); __jsp_tag_starteval=__jsp_taghandler_86.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_86,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_86.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_86.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_86); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[91]); /*@lineinfo:translated-code*//*@lineinfo:176^27*/ { org.apache.struts.taglib.bean.MessageTag __jsp_taghandler_87=(org.apache.struts.taglib.bean.MessageTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.bean.MessageTag.class,"org.apache.struts.taglib.bean.MessageTag key"); __jsp_taghandler_87.setParent(__jsp_taghandler_77); __jsp_taghandler_87.setKey("activos4.codgrp"); __jsp_tag_starteval=__jsp_taghandler_87.doStartTag(); if (OracleJspRuntime.checkStartTagEval(__jsp_tag_starteval)) { do { } while (__jsp_taghandler_87.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); } if (__jsp_taghandler_87.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_87); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[92]); /*@lineinfo:translated-code*//*@lineinfo:178^14*/ { org.apache.struts.taglib.html.TextTag __jsp_taghandler_88=(org.apache.struts.taglib.html.TextTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.TextTag.class,"org.apache.struts.taglib.html.TextTag maxlength name property readonly size"); __jsp_taghandler_88.setParent(__jsp_taghandler_77); __jsp_taghandler_88.setMaxlength("40"); __jsp_taghandler_88.setName("ActivosForm"); __jsp_taghandler_88.setProperty("act_grpdescripcion"); __jsp_taghandler_88.setReadonly(true); __jsp_taghandler_88.setSize("40"); __jsp_tag_starteval=__jsp_taghandler_88.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_88,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_88.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_88.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_88); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[93]); /*@lineinfo:translated-code*//*@lineinfo:179^14*/ { org.apache.struts.taglib.html.HiddenTag __jsp_taghandler_89=(org.apache.struts.taglib.html.HiddenTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.HiddenTag.class,"org.apache.struts.taglib.html.HiddenTag name property"); __jsp_taghandler_89.setParent(__jsp_taghandler_77); __jsp_taghandler_89.setName("ActivosForm"); __jsp_taghandler_89.setProperty("act_codgrp"); __jsp_tag_starteval=__jsp_taghandler_89.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_89,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_89.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_89.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_89); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[94]); /*@lineinfo:translated-code*//*@lineinfo:181^27*/ { org.apache.struts.taglib.bean.MessageTag __jsp_taghandler_90=(org.apache.struts.taglib.bean.MessageTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.bean.MessageTag.class,"org.apache.struts.taglib.bean.MessageTag key"); __jsp_taghandler_90.setParent(__jsp_taghandler_77); __jsp_taghandler_90.setKey("activos4.codpar"); __jsp_tag_starteval=__jsp_taghandler_90.doStartTag(); if (OracleJspRuntime.checkStartTagEval(__jsp_tag_starteval)) { do { } while (__jsp_taghandler_90.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); } if (__jsp_taghandler_90.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_90); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[95]); /*@lineinfo:translated-code*//*@lineinfo:183^15*/ { org.apache.struts.taglib.html.TextTag __jsp_taghandler_91=(org.apache.struts.taglib.html.TextTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.TextTag.class,"org.apache.struts.taglib.html.TextTag maxlength name property readonly size"); __jsp_taghandler_91.setParent(__jsp_taghandler_77); __jsp_taghandler_91.setMaxlength("40"); __jsp_taghandler_91.setName("ActivosForm"); __jsp_taghandler_91.setProperty("act_pardescripcion"); __jsp_taghandler_91.setReadonly(true); __jsp_taghandler_91.setSize("40"); __jsp_tag_starteval=__jsp_taghandler_91.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_91,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_91.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_91.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_91); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[96]); /*@lineinfo:translated-code*//*@lineinfo:184^15*/ { org.apache.struts.taglib.html.HiddenTag __jsp_taghandler_92=(org.apache.struts.taglib.html.HiddenTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.HiddenTag.class,"org.apache.struts.taglib.html.HiddenTag name property"); __jsp_taghandler_92.setParent(__jsp_taghandler_77); __jsp_taghandler_92.setName("ActivosForm"); __jsp_taghandler_92.setProperty("act_codpar"); __jsp_tag_starteval=__jsp_taghandler_92.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_92,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_92.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_92.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_92); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[97]); /*@lineinfo:translated-code*//*@lineinfo:188^27*/ { org.apache.struts.taglib.bean.MessageTag __jsp_taghandler_93=(org.apache.struts.taglib.bean.MessageTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.bean.MessageTag.class,"org.apache.struts.taglib.bean.MessageTag key"); __jsp_taghandler_93.setParent(__jsp_taghandler_77); __jsp_taghandler_93.setKey("activos4.codofi"); __jsp_tag_starteval=__jsp_taghandler_93.doStartTag(); if (OracleJspRuntime.checkStartTagEval(__jsp_tag_starteval)) { do { } while (__jsp_taghandler_93.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); } if (__jsp_taghandler_93.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_93); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[98]); /*@lineinfo:translated-code*//*@lineinfo:190^10*/ { org.apache.struts.taglib.html.TextTag __jsp_taghandler_94=(org.apache.struts.taglib.html.TextTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.TextTag.class,"org.apache.struts.taglib.html.TextTag maxlength name property readonly size"); __jsp_taghandler_94.setParent(__jsp_taghandler_77); __jsp_taghandler_94.setMaxlength("40"); __jsp_taghandler_94.setName("ActivosForm"); __jsp_taghandler_94.setProperty("act_ofidescripcion"); __jsp_taghandler_94.setReadonly(true); __jsp_taghandler_94.setSize("40"); __jsp_tag_starteval=__jsp_taghandler_94.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_94,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_94.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_94.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_94); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[99]); /*@lineinfo:translated-code*//*@lineinfo:191^10*/ { org.apache.struts.taglib.html.HiddenTag __jsp_taghandler_95=(org.apache.struts.taglib.html.HiddenTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.HiddenTag.class,"org.apache.struts.taglib.html.HiddenTag name property"); __jsp_taghandler_95.setParent(__jsp_taghandler_77); __jsp_taghandler_95.setName("ActivosForm"); __jsp_taghandler_95.setProperty("act_codofi"); __jsp_tag_starteval=__jsp_taghandler_95.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_95,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_95.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_95.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_95); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[100]); /*@lineinfo:translated-code*//*@lineinfo:193^27*/ { org.apache.struts.taglib.bean.MessageTag __jsp_taghandler_96=(org.apache.struts.taglib.bean.MessageTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.bean.MessageTag.class,"org.apache.struts.taglib.bean.MessageTag key"); __jsp_taghandler_96.setParent(__jsp_taghandler_77); __jsp_taghandler_96.setKey("activos4.codfun"); __jsp_tag_starteval=__jsp_taghandler_96.doStartTag(); if (OracleJspRuntime.checkStartTagEval(__jsp_tag_starteval)) { do { } while (__jsp_taghandler_96.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); } if (__jsp_taghandler_96.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_96); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[101]); /*@lineinfo:translated-code*//*@lineinfo:195^10*/ { org.apache.struts.taglib.html.TextTag __jsp_taghandler_97=(org.apache.struts.taglib.html.TextTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.TextTag.class,"org.apache.struts.taglib.html.TextTag maxlength name property readonly size"); __jsp_taghandler_97.setParent(__jsp_taghandler_77); __jsp_taghandler_97.setMaxlength("40"); __jsp_taghandler_97.setName("ActivosForm"); __jsp_taghandler_97.setProperty("act_fundescripcion"); __jsp_taghandler_97.setReadonly(true); __jsp_taghandler_97.setSize("40"); __jsp_tag_starteval=__jsp_taghandler_97.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_97,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_97.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_97.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_97); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[102]); /*@lineinfo:translated-code*//*@lineinfo:196^10*/ { org.apache.struts.taglib.html.HiddenTag __jsp_taghandler_98=(org.apache.struts.taglib.html.HiddenTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.HiddenTag.class,"org.apache.struts.taglib.html.HiddenTag name property"); __jsp_taghandler_98.setParent(__jsp_taghandler_77); __jsp_taghandler_98.setName("ActivosForm"); __jsp_taghandler_98.setProperty("act_codfun"); __jsp_tag_starteval=__jsp_taghandler_98.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_98,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_98.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_98.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_98); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[103]); /*@lineinfo:translated-code*//*@lineinfo:200^27*/ { org.apache.struts.taglib.bean.MessageTag __jsp_taghandler_99=(org.apache.struts.taglib.bean.MessageTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.bean.MessageTag.class,"org.apache.struts.taglib.bean.MessageTag key"); __jsp_taghandler_99.setParent(__jsp_taghandler_77); __jsp_taghandler_99.setKey("activos4.codubi"); __jsp_tag_starteval=__jsp_taghandler_99.doStartTag(); if (OracleJspRuntime.checkStartTagEval(__jsp_tag_starteval)) { do { } while (__jsp_taghandler_99.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); } if (__jsp_taghandler_99.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_99); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[104]); /*@lineinfo:translated-code*//*@lineinfo:202^15*/ { org.apache.struts.taglib.html.TextTag __jsp_taghandler_100=(org.apache.struts.taglib.html.TextTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.TextTag.class,"org.apache.struts.taglib.html.TextTag maxlength name property readonly size"); __jsp_taghandler_100.setParent(__jsp_taghandler_77); __jsp_taghandler_100.setMaxlength("40"); __jsp_taghandler_100.setName("ActivosForm"); __jsp_taghandler_100.setProperty("act_ubidescripcion"); __jsp_taghandler_100.setReadonly(true); __jsp_taghandler_100.setSize("40"); __jsp_tag_starteval=__jsp_taghandler_100.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_100,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_100.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_100.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_100); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[105]); /*@lineinfo:translated-code*//*@lineinfo:203^15*/ { org.apache.struts.taglib.html.HiddenTag __jsp_taghandler_101=(org.apache.struts.taglib.html.HiddenTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.HiddenTag.class,"org.apache.struts.taglib.html.HiddenTag name property"); __jsp_taghandler_101.setParent(__jsp_taghandler_77); __jsp_taghandler_101.setName("ActivosForm"); __jsp_taghandler_101.setProperty("act_codubi"); __jsp_tag_starteval=__jsp_taghandler_101.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_101,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_101.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_101.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_101); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[106]); /*@lineinfo:translated-code*//*@lineinfo:205^27*/ { org.apache.struts.taglib.bean.MessageTag __jsp_taghandler_102=(org.apache.struts.taglib.bean.MessageTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.bean.MessageTag.class,"org.apache.struts.taglib.bean.MessageTag key"); __jsp_taghandler_102.setParent(__jsp_taghandler_77); __jsp_taghandler_102.setKey("activos4.codpry"); __jsp_tag_starteval=__jsp_taghandler_102.doStartTag(); if (OracleJspRuntime.checkStartTagEval(__jsp_tag_starteval)) { do { } while (__jsp_taghandler_102.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); } if (__jsp_taghandler_102.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_102); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[107]); /*@lineinfo:translated-code*//*@lineinfo:207^15*/ { org.apache.struts.taglib.html.TextTag __jsp_taghandler_103=(org.apache.struts.taglib.html.TextTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.TextTag.class,"org.apache.struts.taglib.html.TextTag maxlength name property readonly size"); __jsp_taghandler_103.setParent(__jsp_taghandler_77); __jsp_taghandler_103.setMaxlength("40"); __jsp_taghandler_103.setName("ActivosForm"); __jsp_taghandler_103.setProperty("act_prydescripcion"); __jsp_taghandler_103.setReadonly(true); __jsp_taghandler_103.setSize("40"); __jsp_tag_starteval=__jsp_taghandler_103.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_103,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_103.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_103.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_103); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[108]); /*@lineinfo:translated-code*//*@lineinfo:208^15*/ { org.apache.struts.taglib.html.HiddenTag __jsp_taghandler_104=(org.apache.struts.taglib.html.HiddenTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.HiddenTag.class,"org.apache.struts.taglib.html.HiddenTag name property"); __jsp_taghandler_104.setParent(__jsp_taghandler_77); __jsp_taghandler_104.setName("ActivosForm"); __jsp_taghandler_104.setProperty("act_codpry"); __jsp_tag_starteval=__jsp_taghandler_104.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_104,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_104.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_104.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_104); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[109]); /*@lineinfo:translated-code*//*@lineinfo:212^27*/ { org.apache.struts.taglib.bean.MessageTag __jsp_taghandler_105=(org.apache.struts.taglib.bean.MessageTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.bean.MessageTag.class,"org.apache.struts.taglib.bean.MessageTag key"); __jsp_taghandler_105.setParent(__jsp_taghandler_77); __jsp_taghandler_105.setKey("activos4.codfin"); __jsp_tag_starteval=__jsp_taghandler_105.doStartTag(); if (OracleJspRuntime.checkStartTagEval(__jsp_tag_starteval)) { do { } while (__jsp_taghandler_105.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); } if (__jsp_taghandler_105.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_105); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[110]); /*@lineinfo:translated-code*//*@lineinfo:214^15*/ { org.apache.struts.taglib.html.TextTag __jsp_taghandler_106=(org.apache.struts.taglib.html.TextTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.TextTag.class,"org.apache.struts.taglib.html.TextTag maxlength name property readonly size"); __jsp_taghandler_106.setParent(__jsp_taghandler_77); __jsp_taghandler_106.setMaxlength("40"); __jsp_taghandler_106.setName("ActivosForm"); __jsp_taghandler_106.setProperty("act_findescripcion"); __jsp_taghandler_106.setReadonly(true); __jsp_taghandler_106.setSize("40"); __jsp_tag_starteval=__jsp_taghandler_106.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_106,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_106.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_106.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_106); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[111]); /*@lineinfo:translated-code*//*@lineinfo:215^15*/ { org.apache.struts.taglib.html.HiddenTag __jsp_taghandler_107=(org.apache.struts.taglib.html.HiddenTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.HiddenTag.class,"org.apache.struts.taglib.html.HiddenTag name property"); __jsp_taghandler_107.setParent(__jsp_taghandler_77); __jsp_taghandler_107.setName("ActivosForm"); __jsp_taghandler_107.setProperty("act_codfin"); __jsp_tag_starteval=__jsp_taghandler_107.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_107,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_107.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_107.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_107); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[112]); /*@lineinfo:translated-code*//*@lineinfo:219^27*/ { org.apache.struts.taglib.bean.MessageTag __jsp_taghandler_108=(org.apache.struts.taglib.bean.MessageTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.bean.MessageTag.class,"org.apache.struts.taglib.bean.MessageTag key"); __jsp_taghandler_108.setParent(__jsp_taghandler_77); __jsp_taghandler_108.setKey("activos4.feccompra"); __jsp_tag_starteval=__jsp_taghandler_108.doStartTag(); if (OracleJspRuntime.checkStartTagEval(__jsp_tag_starteval)) { do { } while (__jsp_taghandler_108.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); } if (__jsp_taghandler_108.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_108); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[113]); /*@lineinfo:translated-code*//*@lineinfo:220^14*/ { org.apache.struts.taglib.html.TextTag __jsp_taghandler_109=(org.apache.struts.taglib.html.TextTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.TextTag.class,"org.apache.struts.taglib.html.TextTag maxlength name property readonly size"); __jsp_taghandler_109.setParent(__jsp_taghandler_77); __jsp_taghandler_109.setMaxlength("10"); __jsp_taghandler_109.setName("ActivosForm"); __jsp_taghandler_109.setProperty("act_feccompra"); __jsp_taghandler_109.setReadonly(true); __jsp_taghandler_109.setSize("10"); __jsp_tag_starteval=__jsp_taghandler_109.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_109,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_109.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_109.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_109); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[114]); /*@lineinfo:translated-code*//*@lineinfo:221^27*/ { org.apache.struts.taglib.bean.MessageTag __jsp_taghandler_110=(org.apache.struts.taglib.bean.MessageTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.bean.MessageTag.class,"org.apache.struts.taglib.bean.MessageTag key"); __jsp_taghandler_110.setParent(__jsp_taghandler_77); __jsp_taghandler_110.setKey("activos4.tipcam"); __jsp_tag_starteval=__jsp_taghandler_110.doStartTag(); if (OracleJspRuntime.checkStartTagEval(__jsp_tag_starteval)) { do { } while (__jsp_taghandler_110.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); } if (__jsp_taghandler_110.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_110); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[115]); /*@lineinfo:translated-code*//*@lineinfo:222^14*/ { org.apache.struts.taglib.html.TextTag __jsp_taghandler_111=(org.apache.struts.taglib.html.TextTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.TextTag.class,"org.apache.struts.taglib.html.TextTag maxlength name property readonly size"); __jsp_taghandler_111.setParent(__jsp_taghandler_77); __jsp_taghandler_111.setMaxlength("11"); __jsp_taghandler_111.setName("ActivosForm"); __jsp_taghandler_111.setProperty("act_tipcam"); __jsp_taghandler_111.setReadonly(true); __jsp_taghandler_111.setSize("11"); __jsp_tag_starteval=__jsp_taghandler_111.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_111,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_111.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_111.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_111); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[116]); /*@lineinfo:translated-code*//*@lineinfo:225^27*/ { org.apache.struts.taglib.bean.MessageTag __jsp_taghandler_112=(org.apache.struts.taglib.bean.MessageTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.bean.MessageTag.class,"org.apache.struts.taglib.bean.MessageTag key"); __jsp_taghandler_112.setParent(__jsp_taghandler_77); __jsp_taghandler_112.setKey("activos4.tipufv"); __jsp_tag_starteval=__jsp_taghandler_112.doStartTag(); if (OracleJspRuntime.checkStartTagEval(__jsp_tag_starteval)) { do { } while (__jsp_taghandler_112.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); } if (__jsp_taghandler_112.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_112); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[117]); /*@lineinfo:translated-code*//*@lineinfo:226^14*/ { org.apache.struts.taglib.html.TextTag __jsp_taghandler_113=(org.apache.struts.taglib.html.TextTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.TextTag.class,"org.apache.struts.taglib.html.TextTag maxlength name property readonly size"); __jsp_taghandler_113.setParent(__jsp_taghandler_77); __jsp_taghandler_113.setMaxlength("11"); __jsp_taghandler_113.setName("ActivosForm"); __jsp_taghandler_113.setProperty("act_tipufv"); __jsp_taghandler_113.setReadonly(true); __jsp_taghandler_113.setSize("11"); __jsp_tag_starteval=__jsp_taghandler_113.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_113,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_113.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_113.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_113); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[118]); /*@lineinfo:translated-code*//*@lineinfo:227^27*/ { org.apache.struts.taglib.bean.MessageTag __jsp_taghandler_114=(org.apache.struts.taglib.bean.MessageTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.bean.MessageTag.class,"org.apache.struts.taglib.bean.MessageTag key"); __jsp_taghandler_114.setParent(__jsp_taghandler_77); __jsp_taghandler_114.setKey("activos4.umanejo"); __jsp_tag_starteval=__jsp_taghandler_114.doStartTag(); if (OracleJspRuntime.checkStartTagEval(__jsp_tag_starteval)) { do { } while (__jsp_taghandler_114.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); } if (__jsp_taghandler_114.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_114); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[119]); /*@lineinfo:translated-code*//*@lineinfo:228^14*/ { org.apache.struts.taglib.html.TextTag __jsp_taghandler_115=(org.apache.struts.taglib.html.TextTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.TextTag.class,"org.apache.struts.taglib.html.TextTag maxlength name property readonly size"); __jsp_taghandler_115.setParent(__jsp_taghandler_77); __jsp_taghandler_115.setMaxlength("20"); __jsp_taghandler_115.setName("ActivosForm"); __jsp_taghandler_115.setProperty("act_umanejo"); __jsp_taghandler_115.setReadonly(true); __jsp_taghandler_115.setSize("20"); __jsp_tag_starteval=__jsp_taghandler_115.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_115,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_115.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_115.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_115); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[120]); /*@lineinfo:translated-code*//*@lineinfo:233^27*/ { org.apache.struts.taglib.bean.MessageTag __jsp_taghandler_116=(org.apache.struts.taglib.bean.MessageTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.bean.MessageTag.class,"org.apache.struts.taglib.bean.MessageTag key"); __jsp_taghandler_116.setParent(__jsp_taghandler_77); __jsp_taghandler_116.setKey("activos4.descripcion"); __jsp_tag_starteval=__jsp_taghandler_116.doStartTag(); if (OracleJspRuntime.checkStartTagEval(__jsp_tag_starteval)) { do { } while (__jsp_taghandler_116.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); } if (__jsp_taghandler_116.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_116); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[121]); /*@lineinfo:translated-code*//*@lineinfo:234^14*/ { org.apache.struts.taglib.html.TextTag __jsp_taghandler_117=(org.apache.struts.taglib.html.TextTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.TextTag.class,"org.apache.struts.taglib.html.TextTag maxlength name property readonly size"); __jsp_taghandler_117.setParent(__jsp_taghandler_77); __jsp_taghandler_117.setMaxlength("120"); __jsp_taghandler_117.setName("ActivosForm"); __jsp_taghandler_117.setProperty("act_descripcion"); __jsp_taghandler_117.setReadonly(true); __jsp_taghandler_117.setSize("60"); __jsp_tag_starteval=__jsp_taghandler_117.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_117,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_117.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_117.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_117); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[122]); /*@lineinfo:translated-code*//*@lineinfo:237^27*/ { org.apache.struts.taglib.bean.MessageTag __jsp_taghandler_118=(org.apache.struts.taglib.bean.MessageTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.bean.MessageTag.class,"org.apache.struts.taglib.bean.MessageTag key"); __jsp_taghandler_118.setParent(__jsp_taghandler_77); __jsp_taghandler_118.setKey("activos4.desadicional"); __jsp_tag_starteval=__jsp_taghandler_118.doStartTag(); if (OracleJspRuntime.checkStartTagEval(__jsp_tag_starteval)) { do { } while (__jsp_taghandler_118.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); } if (__jsp_taghandler_118.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_118); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[123]); /*@lineinfo:translated-code*//*@lineinfo:238^14*/ { org.apache.struts.taglib.html.TextTag __jsp_taghandler_119=(org.apache.struts.taglib.html.TextTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.TextTag.class,"org.apache.struts.taglib.html.TextTag maxlength name property readonly size"); __jsp_taghandler_119.setParent(__jsp_taghandler_77); __jsp_taghandler_119.setMaxlength("240"); __jsp_taghandler_119.setName("ActivosForm"); __jsp_taghandler_119.setProperty("act_desadicional"); __jsp_taghandler_119.setReadonly(true); __jsp_taghandler_119.setSize("60"); __jsp_tag_starteval=__jsp_taghandler_119.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_119,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_119.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_119.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_119); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[124]); /*@lineinfo:translated-code*//*@lineinfo:242^13*/ { org.apache.struts.taglib.bean.MessageTag __jsp_taghandler_120=(org.apache.struts.taglib.bean.MessageTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.bean.MessageTag.class,"org.apache.struts.taglib.bean.MessageTag key"); __jsp_taghandler_120.setParent(__jsp_taghandler_77); __jsp_taghandler_120.setKey("activos.proveedor"); __jsp_tag_starteval=__jsp_taghandler_120.doStartTag(); if (OracleJspRuntime.checkStartTagEval(__jsp_tag_starteval)) { do { } while (__jsp_taghandler_120.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); } if (__jsp_taghandler_120.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_120); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[125]); /*@lineinfo:translated-code*//*@lineinfo:245^13*/ { org.apache.struts.taglib.html.TextTag __jsp_taghandler_121=(org.apache.struts.taglib.html.TextTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.TextTag.class,"org.apache.struts.taglib.html.TextTag maxlength name property readonly size"); __jsp_taghandler_121.setParent(__jsp_taghandler_77); __jsp_taghandler_121.setMaxlength("50"); __jsp_taghandler_121.setName("ActivosForm"); __jsp_taghandler_121.setProperty("act_proveedor"); __jsp_taghandler_121.setReadonly(true); __jsp_taghandler_121.setSize("50"); __jsp_tag_starteval=__jsp_taghandler_121.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_121,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_121.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_121.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_121); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[126]); /*@lineinfo:translated-code*//*@lineinfo:251^27*/ { org.apache.struts.taglib.bean.MessageTag __jsp_taghandler_122=(org.apache.struts.taglib.bean.MessageTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.bean.MessageTag.class,"org.apache.struts.taglib.bean.MessageTag key"); __jsp_taghandler_122.setParent(__jsp_taghandler_77); __jsp_taghandler_122.setKey("activos4.marca"); __jsp_tag_starteval=__jsp_taghandler_122.doStartTag(); if (OracleJspRuntime.checkStartTagEval(__jsp_tag_starteval)) { do { } while (__jsp_taghandler_122.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); } if (__jsp_taghandler_122.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_122); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[127]); /*@lineinfo:translated-code*//*@lineinfo:252^14*/ { org.apache.struts.taglib.html.TextTag __jsp_taghandler_123=(org.apache.struts.taglib.html.TextTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.TextTag.class,"org.apache.struts.taglib.html.TextTag maxlength name property readonly size"); __jsp_taghandler_123.setParent(__jsp_taghandler_77); __jsp_taghandler_123.setMaxlength("30"); __jsp_taghandler_123.setName("ActivosForm"); __jsp_taghandler_123.setProperty("act_marca"); __jsp_taghandler_123.setReadonly(true); __jsp_taghandler_123.setSize("30"); __jsp_tag_starteval=__jsp_taghandler_123.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_123,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_123.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_123.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_123); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[128]); /*@lineinfo:translated-code*//*@lineinfo:253^27*/ { org.apache.struts.taglib.bean.MessageTag __jsp_taghandler_124=(org.apache.struts.taglib.bean.MessageTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.bean.MessageTag.class,"org.apache.struts.taglib.bean.MessageTag key"); __jsp_taghandler_124.setParent(__jsp_taghandler_77); __jsp_taghandler_124.setKey("activos4.color"); __jsp_tag_starteval=__jsp_taghandler_124.doStartTag(); if (OracleJspRuntime.checkStartTagEval(__jsp_tag_starteval)) { do { } while (__jsp_taghandler_124.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); } if (__jsp_taghandler_124.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_124); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[129]); /*@lineinfo:translated-code*//*@lineinfo:254^14*/ { org.apache.struts.taglib.html.TextTag __jsp_taghandler_125=(org.apache.struts.taglib.html.TextTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.TextTag.class,"org.apache.struts.taglib.html.TextTag maxlength name property readonly size"); __jsp_taghandler_125.setParent(__jsp_taghandler_77); __jsp_taghandler_125.setMaxlength("30"); __jsp_taghandler_125.setName("ActivosForm"); __jsp_taghandler_125.setProperty("act_color"); __jsp_taghandler_125.setReadonly(true); __jsp_taghandler_125.setSize("30"); __jsp_tag_starteval=__jsp_taghandler_125.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_125,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_125.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_125.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_125); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[130]); /*@lineinfo:translated-code*//*@lineinfo:257^27*/ { org.apache.struts.taglib.bean.MessageTag __jsp_taghandler_126=(org.apache.struts.taglib.bean.MessageTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.bean.MessageTag.class,"org.apache.struts.taglib.bean.MessageTag key"); __jsp_taghandler_126.setParent(__jsp_taghandler_77); __jsp_taghandler_126.setKey("activos4.procedencia"); __jsp_tag_starteval=__jsp_taghandler_126.doStartTag(); if (OracleJspRuntime.checkStartTagEval(__jsp_tag_starteval)) { do { } while (__jsp_taghandler_126.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); } if (__jsp_taghandler_126.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_126); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[131]); /*@lineinfo:translated-code*//*@lineinfo:258^14*/ { org.apache.struts.taglib.html.TextTag __jsp_taghandler_127=(org.apache.struts.taglib.html.TextTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.TextTag.class,"org.apache.struts.taglib.html.TextTag maxlength name property readonly size"); __jsp_taghandler_127.setParent(__jsp_taghandler_77); __jsp_taghandler_127.setMaxlength("30"); __jsp_taghandler_127.setName("ActivosForm"); __jsp_taghandler_127.setProperty("act_procedencia"); __jsp_taghandler_127.setReadonly(true); __jsp_taghandler_127.setSize("30"); __jsp_tag_starteval=__jsp_taghandler_127.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_127,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_127.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_127.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_127); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[132]); /*@lineinfo:translated-code*//*@lineinfo:259^27*/ { org.apache.struts.taglib.bean.MessageTag __jsp_taghandler_128=(org.apache.struts.taglib.bean.MessageTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.bean.MessageTag.class,"org.apache.struts.taglib.bean.MessageTag key"); __jsp_taghandler_128.setParent(__jsp_taghandler_77); __jsp_taghandler_128.setKey("activos4.gobmunicipal"); __jsp_tag_starteval=__jsp_taghandler_128.doStartTag(); if (OracleJspRuntime.checkStartTagEval(__jsp_tag_starteval)) { do { } while (__jsp_taghandler_128.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); } if (__jsp_taghandler_128.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_128); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[133]); /*@lineinfo:translated-code*//*@lineinfo:260^14*/ { org.apache.struts.taglib.html.TextTag __jsp_taghandler_129=(org.apache.struts.taglib.html.TextTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.TextTag.class,"org.apache.struts.taglib.html.TextTag maxlength name property readonly size"); __jsp_taghandler_129.setParent(__jsp_taghandler_77); __jsp_taghandler_129.setMaxlength("60"); __jsp_taghandler_129.setName("ActivosForm"); __jsp_taghandler_129.setProperty("act_gobmunicipal"); __jsp_taghandler_129.setReadonly(true); __jsp_taghandler_129.setSize("30"); __jsp_tag_starteval=__jsp_taghandler_129.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_129,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_129.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_129.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_129); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[134]); /*@lineinfo:translated-code*//*@lineinfo:263^27*/ { org.apache.struts.taglib.bean.MessageTag __jsp_taghandler_130=(org.apache.struts.taglib.bean.MessageTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.bean.MessageTag.class,"org.apache.struts.taglib.bean.MessageTag key"); __jsp_taghandler_130.setParent(__jsp_taghandler_77); __jsp_taghandler_130.setKey("activos4.valcobol"); __jsp_tag_starteval=__jsp_taghandler_130.doStartTag(); if (OracleJspRuntime.checkStartTagEval(__jsp_tag_starteval)) { do { } while (__jsp_taghandler_130.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); } if (__jsp_taghandler_130.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_130); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[135]); /*@lineinfo:translated-code*//*@lineinfo:264^14*/ { org.apache.struts.taglib.html.TextTag __jsp_taghandler_131=(org.apache.struts.taglib.html.TextTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.TextTag.class,"org.apache.struts.taglib.html.TextTag maxlength name property readonly size"); __jsp_taghandler_131.setParent(__jsp_taghandler_77); __jsp_taghandler_131.setMaxlength("15"); __jsp_taghandler_131.setName("ActivosForm"); __jsp_taghandler_131.setProperty("act_valcobol"); __jsp_taghandler_131.setReadonly(true); __jsp_taghandler_131.setSize("15"); __jsp_tag_starteval=__jsp_taghandler_131.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_131,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_131.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_131.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_131); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[136]); /*@lineinfo:translated-code*//*@lineinfo:265^27*/ { org.apache.struts.taglib.bean.MessageTag __jsp_taghandler_132=(org.apache.struts.taglib.bean.MessageTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.bean.MessageTag.class,"org.apache.struts.taglib.bean.MessageTag key"); __jsp_taghandler_132.setParent(__jsp_taghandler_77); __jsp_taghandler_132.setKey("activos4.ordencompra"); __jsp_tag_starteval=__jsp_taghandler_132.doStartTag(); if (OracleJspRuntime.checkStartTagEval(__jsp_tag_starteval)) { do { } while (__jsp_taghandler_132.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); } if (__jsp_taghandler_132.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_132); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[137]); /*@lineinfo:translated-code*//*@lineinfo:266^14*/ { org.apache.struts.taglib.html.TextTag __jsp_taghandler_133=(org.apache.struts.taglib.html.TextTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.TextTag.class,"org.apache.struts.taglib.html.TextTag maxlength name property readonly size"); __jsp_taghandler_133.setParent(__jsp_taghandler_77); __jsp_taghandler_133.setMaxlength("20"); __jsp_taghandler_133.setName("ActivosForm"); __jsp_taghandler_133.setProperty("act_ordencompra"); __jsp_taghandler_133.setReadonly(true); __jsp_taghandler_133.setSize("20"); __jsp_tag_starteval=__jsp_taghandler_133.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_133,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_133.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_133.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_133); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[138]); /*@lineinfo:translated-code*//*@lineinfo:269^27*/ { org.apache.struts.taglib.bean.MessageTag __jsp_taghandler_134=(org.apache.struts.taglib.bean.MessageTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.bean.MessageTag.class,"org.apache.struts.taglib.bean.MessageTag key"); __jsp_taghandler_134.setParent(__jsp_taghandler_77); __jsp_taghandler_134.setKey("activos4.numfactura"); __jsp_tag_starteval=__jsp_taghandler_134.doStartTag(); if (OracleJspRuntime.checkStartTagEval(__jsp_tag_starteval)) { do { } while (__jsp_taghandler_134.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); } if (__jsp_taghandler_134.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_134); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[139]); /*@lineinfo:translated-code*//*@lineinfo:270^14*/ { org.apache.struts.taglib.html.TextTag __jsp_taghandler_135=(org.apache.struts.taglib.html.TextTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.TextTag.class,"org.apache.struts.taglib.html.TextTag maxlength name property readonly size"); __jsp_taghandler_135.setParent(__jsp_taghandler_77); __jsp_taghandler_135.setMaxlength("8"); __jsp_taghandler_135.setName("ActivosForm"); __jsp_taghandler_135.setProperty("act_numfactura"); __jsp_taghandler_135.setReadonly(true); __jsp_taghandler_135.setSize("8"); __jsp_tag_starteval=__jsp_taghandler_135.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_135,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_135.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_135.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_135); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[140]); /*@lineinfo:translated-code*//*@lineinfo:271^27*/ { org.apache.struts.taglib.bean.MessageTag __jsp_taghandler_136=(org.apache.struts.taglib.bean.MessageTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.bean.MessageTag.class,"org.apache.struts.taglib.bean.MessageTag key"); __jsp_taghandler_136.setParent(__jsp_taghandler_77); __jsp_taghandler_136.setKey("activos4.numcomprobante"); __jsp_tag_starteval=__jsp_taghandler_136.doStartTag(); if (OracleJspRuntime.checkStartTagEval(__jsp_tag_starteval)) { do { } while (__jsp_taghandler_136.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); } if (__jsp_taghandler_136.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_136); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[141]); /*@lineinfo:translated-code*//*@lineinfo:272^14*/ { org.apache.struts.taglib.html.TextTag __jsp_taghandler_137=(org.apache.struts.taglib.html.TextTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.TextTag.class,"org.apache.struts.taglib.html.TextTag maxlength name property readonly size"); __jsp_taghandler_137.setParent(__jsp_taghandler_77); __jsp_taghandler_137.setMaxlength("20"); __jsp_taghandler_137.setName("ActivosForm"); __jsp_taghandler_137.setProperty("act_numcomprobante"); __jsp_taghandler_137.setReadonly(true); __jsp_taghandler_137.setSize("20"); __jsp_tag_starteval=__jsp_taghandler_137.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_137,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_137.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_137.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_137); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[142]); /*@lineinfo:translated-code*//*@lineinfo:275^27*/ { org.apache.struts.taglib.bean.MessageTag __jsp_taghandler_138=(org.apache.struts.taglib.bean.MessageTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.bean.MessageTag.class,"org.apache.struts.taglib.bean.MessageTag key"); __jsp_taghandler_138.setParent(__jsp_taghandler_77); __jsp_taghandler_138.setKey("activos4.codanterior"); __jsp_tag_starteval=__jsp_taghandler_138.doStartTag(); if (OracleJspRuntime.checkStartTagEval(__jsp_tag_starteval)) { do { } while (__jsp_taghandler_138.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); } if (__jsp_taghandler_138.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_138); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[143]); /*@lineinfo:translated-code*//*@lineinfo:276^14*/ { org.apache.struts.taglib.html.TextTag __jsp_taghandler_139=(org.apache.struts.taglib.html.TextTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.TextTag.class,"org.apache.struts.taglib.html.TextTag maxlength name property readonly size"); __jsp_taghandler_139.setParent(__jsp_taghandler_77); __jsp_taghandler_139.setMaxlength("20"); __jsp_taghandler_139.setName("ActivosForm"); __jsp_taghandler_139.setProperty("act_codanterior"); __jsp_taghandler_139.setReadonly(true); __jsp_taghandler_139.setSize("20"); __jsp_tag_starteval=__jsp_taghandler_139.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_139,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_139.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_139.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_139); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[144]); /*@lineinfo:translated-code*//*@lineinfo:277^27*/ { org.apache.struts.taglib.bean.MessageTag __jsp_taghandler_140=(org.apache.struts.taglib.bean.MessageTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.bean.MessageTag.class,"org.apache.struts.taglib.bean.MessageTag key"); __jsp_taghandler_140.setParent(__jsp_taghandler_77); __jsp_taghandler_140.setKey("activos4.fecha"); __jsp_tag_starteval=__jsp_taghandler_140.doStartTag(); if (OracleJspRuntime.checkStartTagEval(__jsp_tag_starteval)) { do { } while (__jsp_taghandler_140.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); } if (__jsp_taghandler_140.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_140); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[145]); /*@lineinfo:translated-code*//*@lineinfo:278^14*/ { org.apache.struts.taglib.html.TextTag __jsp_taghandler_141=(org.apache.struts.taglib.html.TextTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.TextTag.class,"org.apache.struts.taglib.html.TextTag maxlength name property readonly size"); __jsp_taghandler_141.setParent(__jsp_taghandler_77); __jsp_taghandler_141.setMaxlength("10"); __jsp_taghandler_141.setName("ActivosForm"); __jsp_taghandler_141.setProperty("rev_fecha"); __jsp_taghandler_141.setReadonly(true); __jsp_taghandler_141.setSize("10"); __jsp_tag_starteval=__jsp_taghandler_141.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_141,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_141.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_141.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_141); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[146]); /*@lineinfo:translated-code*//*@lineinfo:281^27*/ { org.apache.struts.taglib.bean.MessageTag __jsp_taghandler_142=(org.apache.struts.taglib.bean.MessageTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.bean.MessageTag.class,"org.apache.struts.taglib.bean.MessageTag key"); __jsp_taghandler_142.setParent(__jsp_taghandler_77); __jsp_taghandler_142.setKey("activos4.vidaut"); __jsp_tag_starteval=__jsp_taghandler_142.doStartTag(); if (OracleJspRuntime.checkStartTagEval(__jsp_tag_starteval)) { do { } while (__jsp_taghandler_142.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); } if (__jsp_taghandler_142.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_142); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[147]); /*@lineinfo:translated-code*//*@lineinfo:282^14*/ { org.apache.struts.taglib.html.TextTag __jsp_taghandler_143=(org.apache.struts.taglib.html.TextTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.TextTag.class,"org.apache.struts.taglib.html.TextTag maxlength name property readonly size"); __jsp_taghandler_143.setParent(__jsp_taghandler_77); __jsp_taghandler_143.setMaxlength("4"); __jsp_taghandler_143.setName("ActivosForm"); __jsp_taghandler_143.setProperty("rev_vidaut"); __jsp_taghandler_143.setReadonly(true); __jsp_taghandler_143.setSize("4"); __jsp_tag_starteval=__jsp_taghandler_143.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_143,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_143.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_143.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_143); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[148]); /*@lineinfo:translated-code*//*@lineinfo:283^27*/ { org.apache.struts.taglib.bean.MessageTag __jsp_taghandler_144=(org.apache.struts.taglib.bean.MessageTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.bean.MessageTag.class,"org.apache.struts.taglib.bean.MessageTag key"); __jsp_taghandler_144.setParent(__jsp_taghandler_77); __jsp_taghandler_144.setKey("activos4.estadoactivo"); __jsp_tag_starteval=__jsp_taghandler_144.doStartTag(); if (OracleJspRuntime.checkStartTagEval(__jsp_tag_starteval)) { do { } while (__jsp_taghandler_144.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); } if (__jsp_taghandler_144.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_144); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[149]); /*@lineinfo:translated-code*//*@lineinfo:284^14*/ { org.apache.struts.taglib.html.TextTag __jsp_taghandler_145=(org.apache.struts.taglib.html.TextTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.TextTag.class,"org.apache.struts.taglib.html.TextTag name property readonly size"); __jsp_taghandler_145.setParent(__jsp_taghandler_77); __jsp_taghandler_145.setName("ActivosForm"); __jsp_taghandler_145.setProperty("desestado"); __jsp_taghandler_145.setReadonly(true); __jsp_taghandler_145.setSize("10"); __jsp_tag_starteval=__jsp_taghandler_145.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_145,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_145.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_145.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_145); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[150]); /*@lineinfo:translated-code*//*@lineinfo:287^27*/ { org.apache.struts.taglib.bean.MessageTag __jsp_taghandler_146=(org.apache.struts.taglib.bean.MessageTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.bean.MessageTag.class,"org.apache.struts.taglib.bean.MessageTag key"); __jsp_taghandler_146.setParent(__jsp_taghandler_77); __jsp_taghandler_146.setKey("activos4.desestado"); __jsp_tag_starteval=__jsp_taghandler_146.doStartTag(); if (OracleJspRuntime.checkStartTagEval(__jsp_tag_starteval)) { do { } while (__jsp_taghandler_146.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); } if (__jsp_taghandler_146.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_146); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[151]); /*@lineinfo:translated-code*//*@lineinfo:288^14*/ { org.apache.struts.taglib.html.TextTag __jsp_taghandler_147=(org.apache.struts.taglib.html.TextTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.TextTag.class,"org.apache.struts.taglib.html.TextTag maxlength name property readonly size"); __jsp_taghandler_147.setParent(__jsp_taghandler_77); __jsp_taghandler_147.setMaxlength("60"); __jsp_taghandler_147.setName("ActivosForm"); __jsp_taghandler_147.setProperty("rev_desestado"); __jsp_taghandler_147.setReadonly(true); __jsp_taghandler_147.setSize("60"); __jsp_tag_starteval=__jsp_taghandler_147.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_147,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_147.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_147.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_147); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[152]); /*@lineinfo:translated-code*//*@lineinfo:291^24*/ { org.apache.struts.taglib.html.SubmitTag __jsp_taghandler_148=(org.apache.struts.taglib.html.SubmitTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.SubmitTag.class,"org.apache.struts.taglib.html.SubmitTag onclick property styleClass value"); __jsp_taghandler_148.setParent(__jsp_taghandler_77); __jsp_taghandler_148.setOnclick("operacion.value=2;opcion.value=4"); __jsp_taghandler_148.setProperty("boton"); __jsp_taghandler_148.setStyleClass("boton1"); __jsp_taghandler_148.setValue("Reportar"); __jsp_tag_starteval=__jsp_taghandler_148.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_148,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_148.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_148.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_148); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[153]); /*@lineinfo:translated-code*//*@lineinfo:291^136*/ } while (__jsp_taghandler_77.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); } if (__jsp_taghandler_77.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_77); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[154]); /*@lineinfo:translated-code*//*@lineinfo:294^18*/ } while (__jsp_taghandler_4.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); } if (__jsp_taghandler_4.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_4); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[155]); /*@lineinfo:translated-code*//*@lineinfo:296^10*/ { org.apache.struts.taglib.logic.EqualTag __jsp_taghandler_149=(org.apache.struts.taglib.logic.EqualTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.logic.EqualTag.class,"org.apache.struts.taglib.logic.EqualTag name property value"); __jsp_taghandler_149.setParent(__jsp_taghandler_1); __jsp_taghandler_149.setName("ActivosForm"); __jsp_taghandler_149.setProperty("operacion"); __jsp_taghandler_149.setValue("2"); __jsp_tag_starteval=__jsp_taghandler_149.doStartTag(); if (OracleJspRuntime.checkStartTagEval(__jsp_tag_starteval)) { do { /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[156]); /*@lineinfo:translated-code*//*@lineinfo:300^25*/ { org.apache.struts.taglib.bean.MessageTag __jsp_taghandler_150=(org.apache.struts.taglib.bean.MessageTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.bean.MessageTag.class,"org.apache.struts.taglib.bean.MessageTag key"); __jsp_taghandler_150.setParent(__jsp_taghandler_149); __jsp_taghandler_150.setKey("activos.codrub"); __jsp_tag_starteval=__jsp_taghandler_150.doStartTag(); if (OracleJspRuntime.checkStartTagEval(__jsp_tag_starteval)) { do { } while (__jsp_taghandler_150.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); } if (__jsp_taghandler_150.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_150); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[157]); /*@lineinfo:translated-code*//*@lineinfo:303^22*/ { org.apache.struts.taglib.html.SelectTag __jsp_taghandler_151=(org.apache.struts.taglib.html.SelectTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.SelectTag.class,"org.apache.struts.taglib.html.SelectTag disabled name property"); __jsp_taghandler_151.setParent(__jsp_taghandler_149); __jsp_taghandler_151.setDisabled(false); __jsp_taghandler_151.setName("ActivosForm"); __jsp_taghandler_151.setProperty("act_codrub"); __jsp_tag_starteval=__jsp_taghandler_151.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_151,__jsp_tag_starteval,out); do { /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[158]); /*@lineinfo:translated-code*//*@lineinfo:304^28*/ { org.apache.struts.taglib.html.OptionsTag __jsp_taghandler_152=(org.apache.struts.taglib.html.OptionsTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.OptionsTag.class,"org.apache.struts.taglib.html.OptionsTag collection labelProperty property"); __jsp_taghandler_152.setParent(__jsp_taghandler_151); __jsp_taghandler_152.setCollection("RubrosLista"); __jsp_taghandler_152.setLabelProperty("descripcion"); __jsp_taghandler_152.setProperty("codigo"); __jsp_tag_starteval=__jsp_taghandler_152.doStartTag(); if (OracleJspRuntime.checkStartTagEval(__jsp_tag_starteval)) { do { } while (__jsp_taghandler_152.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); } if (__jsp_taghandler_152.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_152); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[159]); /*@lineinfo:translated-code*//*@lineinfo:304^114*/ } while (__jsp_taghandler_151.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_151.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_151); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[160]); /*@lineinfo:translated-code*//*@lineinfo:310^22*/ { org.apache.struts.taglib.bean.MessageTag __jsp_taghandler_153=(org.apache.struts.taglib.bean.MessageTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.bean.MessageTag.class,"org.apache.struts.taglib.bean.MessageTag key"); __jsp_taghandler_153.setParent(__jsp_taghandler_149); __jsp_taghandler_153.setKey("activos.codreg"); __jsp_tag_starteval=__jsp_taghandler_153.doStartTag(); if (OracleJspRuntime.checkStartTagEval(__jsp_tag_starteval)) { do { } while (__jsp_taghandler_153.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); } if (__jsp_taghandler_153.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_153); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[161]); /*@lineinfo:translated-code*//*@lineinfo:313^22*/ { org.apache.struts.taglib.html.HiddenTag __jsp_taghandler_154=(org.apache.struts.taglib.html.HiddenTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.HiddenTag.class,"org.apache.struts.taglib.html.HiddenTag name property"); __jsp_taghandler_154.setParent(__jsp_taghandler_149); __jsp_taghandler_154.setName("ActivosForm"); __jsp_taghandler_154.setProperty("act_codreg"); __jsp_tag_starteval=__jsp_taghandler_154.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_154,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_154.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_154.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_154); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[162]); /*@lineinfo:translated-code*//*@lineinfo:314^25*/ { org.apache.struts.taglib.html.TextTag __jsp_taghandler_155=(org.apache.struts.taglib.html.TextTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.TextTag.class,"org.apache.struts.taglib.html.TextTag maxlength name property readonly size"); __jsp_taghandler_155.setParent(__jsp_taghandler_149); __jsp_taghandler_155.setMaxlength("30"); __jsp_taghandler_155.setName("ActivosForm"); __jsp_taghandler_155.setProperty("act_regdescripcion"); __jsp_taghandler_155.setReadonly(true); __jsp_taghandler_155.setSize("30"); __jsp_tag_starteval=__jsp_taghandler_155.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_155,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_155.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_155.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_155); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[163]); /*@lineinfo:translated-code*//*@lineinfo:319^22*/ { org.apache.struts.taglib.bean.MessageTag __jsp_taghandler_156=(org.apache.struts.taglib.bean.MessageTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.bean.MessageTag.class,"org.apache.struts.taglib.bean.MessageTag key"); __jsp_taghandler_156.setParent(__jsp_taghandler_149); __jsp_taghandler_156.setKey("activos.codfin"); __jsp_tag_starteval=__jsp_taghandler_156.doStartTag(); if (OracleJspRuntime.checkStartTagEval(__jsp_tag_starteval)) { do { } while (__jsp_taghandler_156.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); } if (__jsp_taghandler_156.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_156); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[164]); /*@lineinfo:translated-code*//*@lineinfo:322^22*/ { org.apache.struts.taglib.html.HiddenTag __jsp_taghandler_157=(org.apache.struts.taglib.html.HiddenTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.HiddenTag.class,"org.apache.struts.taglib.html.HiddenTag name property"); __jsp_taghandler_157.setParent(__jsp_taghandler_149); __jsp_taghandler_157.setName("ActivosForm"); __jsp_taghandler_157.setProperty("act_codfin"); __jsp_tag_starteval=__jsp_taghandler_157.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_157,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_157.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_157.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_157); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[165]); /*@lineinfo:translated-code*//*@lineinfo:323^25*/ { org.apache.struts.taglib.html.TextTag __jsp_taghandler_158=(org.apache.struts.taglib.html.TextTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.TextTag.class,"org.apache.struts.taglib.html.TextTag maxlength name property readonly size"); __jsp_taghandler_158.setParent(__jsp_taghandler_149); __jsp_taghandler_158.setMaxlength("30"); __jsp_taghandler_158.setName("ActivosForm"); __jsp_taghandler_158.setProperty("act_findescripcion"); __jsp_taghandler_158.setReadonly(true); __jsp_taghandler_158.setSize("30"); __jsp_tag_starteval=__jsp_taghandler_158.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_158,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_158.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_158.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_158); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[166]); /*@lineinfo:translated-code*//*@lineinfo:326^16*/ { org.apache.struts.taglib.logic.EqualTag __jsp_taghandler_159=(org.apache.struts.taglib.logic.EqualTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.logic.EqualTag.class,"org.apache.struts.taglib.logic.EqualTag name property value"); __jsp_taghandler_159.setParent(__jsp_taghandler_149); __jsp_taghandler_159.setName("ActivosForm"); __jsp_taghandler_159.setProperty("opcion"); __jsp_taghandler_159.setValue("2"); __jsp_tag_starteval=__jsp_taghandler_159.doStartTag(); if (OracleJspRuntime.checkStartTagEval(__jsp_tag_starteval)) { do { /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[167]); /*@lineinfo:translated-code*//*@lineinfo:331^22*/ { org.apache.struts.taglib.html.SubmitTag __jsp_taghandler_160=(org.apache.struts.taglib.html.SubmitTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.SubmitTag.class,"org.apache.struts.taglib.html.SubmitTag onclick property styleClass value"); __jsp_taghandler_160.setParent(__jsp_taghandler_159); __jsp_taghandler_160.setOnclick("operacion.value=6;opcion.value=2"); __jsp_taghandler_160.setProperty("boton"); __jsp_taghandler_160.setStyleClass("boton1"); __jsp_taghandler_160.setValue("Modificar"); __jsp_tag_starteval=__jsp_taghandler_160.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_160,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_160.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_160.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_160); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[168]); /*@lineinfo:translated-code*//*@lineinfo:331^134*/ } while (__jsp_taghandler_159.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); } if (__jsp_taghandler_159.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_159); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[169]); /*@lineinfo:translated-code*//*@lineinfo:335^16*/ { org.apache.struts.taglib.logic.EqualTag __jsp_taghandler_161=(org.apache.struts.taglib.logic.EqualTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.logic.EqualTag.class,"org.apache.struts.taglib.logic.EqualTag name property value"); __jsp_taghandler_161.setParent(__jsp_taghandler_149); __jsp_taghandler_161.setName("ActivosForm"); __jsp_taghandler_161.setProperty("opcion"); __jsp_taghandler_161.setValue("3"); __jsp_tag_starteval=__jsp_taghandler_161.doStartTag(); if (OracleJspRuntime.checkStartTagEval(__jsp_tag_starteval)) { do { /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[170]); /*@lineinfo:translated-code*//*@lineinfo:340^22*/ { org.apache.struts.taglib.html.SubmitTag __jsp_taghandler_162=(org.apache.struts.taglib.html.SubmitTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.SubmitTag.class,"org.apache.struts.taglib.html.SubmitTag onclick property styleClass value"); __jsp_taghandler_162.setParent(__jsp_taghandler_161); __jsp_taghandler_162.setOnclick("operacion.value=6;opcion.value=3"); __jsp_taghandler_162.setProperty("boton"); __jsp_taghandler_162.setStyleClass("boton1"); __jsp_taghandler_162.setValue("Eliminar"); __jsp_tag_starteval=__jsp_taghandler_162.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_162,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_162.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_162.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_162); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[171]); /*@lineinfo:translated-code*//*@lineinfo:340^133*/ } while (__jsp_taghandler_161.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); } if (__jsp_taghandler_161.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_161); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[172]); /*@lineinfo:translated-code*//*@lineinfo:344^16*/ { org.apache.struts.taglib.logic.EqualTag __jsp_taghandler_163=(org.apache.struts.taglib.logic.EqualTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.logic.EqualTag.class,"org.apache.struts.taglib.logic.EqualTag name property value"); __jsp_taghandler_163.setParent(__jsp_taghandler_149); __jsp_taghandler_163.setName("ActivosForm"); __jsp_taghandler_163.setProperty("opcion"); __jsp_taghandler_163.setValue("5"); __jsp_tag_starteval=__jsp_taghandler_163.doStartTag(); if (OracleJspRuntime.checkStartTagEval(__jsp_tag_starteval)) { do { /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[173]); /*@lineinfo:translated-code*//*@lineinfo:349^25*/ { org.apache.struts.taglib.html.SubmitTag __jsp_taghandler_164=(org.apache.struts.taglib.html.SubmitTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.SubmitTag.class,"org.apache.struts.taglib.html.SubmitTag onclick property styleClass value"); __jsp_taghandler_164.setParent(__jsp_taghandler_163); __jsp_taghandler_164.setOnclick("operacion.value=6;opcion.value=4"); __jsp_taghandler_164.setProperty("boton"); __jsp_taghandler_164.setStyleClass("boton1"); __jsp_taghandler_164.setValue("Consultar"); __jsp_tag_starteval=__jsp_taghandler_164.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_164,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_164.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_164.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_164); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[174]); /*@lineinfo:translated-code*//*@lineinfo:349^137*/ } while (__jsp_taghandler_163.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); } if (__jsp_taghandler_163.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_163); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[175]); /*@lineinfo:translated-code*//*@lineinfo:352^30*/ } while (__jsp_taghandler_149.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); } if (__jsp_taghandler_149.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_149); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[176]); /*@lineinfo:translated-code*//*@lineinfo:355^10*/ { org.apache.struts.taglib.logic.EqualTag __jsp_taghandler_165=(org.apache.struts.taglib.logic.EqualTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.logic.EqualTag.class,"org.apache.struts.taglib.logic.EqualTag name property value"); __jsp_taghandler_165.setParent(__jsp_taghandler_1); __jsp_taghandler_165.setName("ActivosForm"); __jsp_taghandler_165.setProperty("operacion"); __jsp_taghandler_165.setValue("6"); __jsp_tag_starteval=__jsp_taghandler_165.doStartTag(); if (OracleJspRuntime.checkStartTagEval(__jsp_tag_starteval)) { do { /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[177]); /*@lineinfo:translated-code*//*@lineinfo:359^25*/ { org.apache.struts.taglib.bean.MessageTag __jsp_taghandler_166=(org.apache.struts.taglib.bean.MessageTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.bean.MessageTag.class,"org.apache.struts.taglib.bean.MessageTag key"); __jsp_taghandler_166.setParent(__jsp_taghandler_165); __jsp_taghandler_166.setKey("activos.codrub"); __jsp_tag_starteval=__jsp_taghandler_166.doStartTag(); if (OracleJspRuntime.checkStartTagEval(__jsp_tag_starteval)) { do { } while (__jsp_taghandler_166.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); } if (__jsp_taghandler_166.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_166); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[178]); /*@lineinfo:translated-code*//*@lineinfo:362^22*/ { org.apache.struts.taglib.html.HiddenTag __jsp_taghandler_167=(org.apache.struts.taglib.html.HiddenTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.HiddenTag.class,"org.apache.struts.taglib.html.HiddenTag name property"); __jsp_taghandler_167.setParent(__jsp_taghandler_165); __jsp_taghandler_167.setName("ActivosForm"); __jsp_taghandler_167.setProperty("act_codrub"); __jsp_tag_starteval=__jsp_taghandler_167.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_167,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_167.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_167.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_167); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[179]); /*@lineinfo:translated-code*//*@lineinfo:363^25*/ { org.apache.struts.taglib.html.TextTag __jsp_taghandler_168=(org.apache.struts.taglib.html.TextTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.TextTag.class,"org.apache.struts.taglib.html.TextTag maxlength name property readonly size"); __jsp_taghandler_168.setParent(__jsp_taghandler_165); __jsp_taghandler_168.setMaxlength("30"); __jsp_taghandler_168.setName("ActivosForm"); __jsp_taghandler_168.setProperty("act_rubdescripcion"); __jsp_taghandler_168.setReadonly(true); __jsp_taghandler_168.setSize("30"); __jsp_tag_starteval=__jsp_taghandler_168.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_168,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_168.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_168.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_168); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[180]); /*@lineinfo:translated-code*//*@lineinfo:368^22*/ { org.apache.struts.taglib.bean.MessageTag __jsp_taghandler_169=(org.apache.struts.taglib.bean.MessageTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.bean.MessageTag.class,"org.apache.struts.taglib.bean.MessageTag key"); __jsp_taghandler_169.setParent(__jsp_taghandler_165); __jsp_taghandler_169.setKey("activos.codreg"); __jsp_tag_starteval=__jsp_taghandler_169.doStartTag(); if (OracleJspRuntime.checkStartTagEval(__jsp_tag_starteval)) { do { } while (__jsp_taghandler_169.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); } if (__jsp_taghandler_169.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_169); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[181]); /*@lineinfo:translated-code*//*@lineinfo:371^22*/ { org.apache.struts.taglib.html.HiddenTag __jsp_taghandler_170=(org.apache.struts.taglib.html.HiddenTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.HiddenTag.class,"org.apache.struts.taglib.html.HiddenTag name property"); __jsp_taghandler_170.setParent(__jsp_taghandler_165); __jsp_taghandler_170.setName("ActivosForm"); __jsp_taghandler_170.setProperty("act_codreg"); __jsp_tag_starteval=__jsp_taghandler_170.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_170,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_170.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_170.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_170); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[182]); /*@lineinfo:translated-code*//*@lineinfo:372^25*/ { org.apache.struts.taglib.html.TextTag __jsp_taghandler_171=(org.apache.struts.taglib.html.TextTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.TextTag.class,"org.apache.struts.taglib.html.TextTag maxlength name property readonly size"); __jsp_taghandler_171.setParent(__jsp_taghandler_165); __jsp_taghandler_171.setMaxlength("30"); __jsp_taghandler_171.setName("ActivosForm"); __jsp_taghandler_171.setProperty("act_regdescripcion"); __jsp_taghandler_171.setReadonly(true); __jsp_taghandler_171.setSize("30"); __jsp_tag_starteval=__jsp_taghandler_171.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_171,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_171.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_171.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_171); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[183]); /*@lineinfo:translated-code*//*@lineinfo:377^22*/ { org.apache.struts.taglib.bean.MessageTag __jsp_taghandler_172=(org.apache.struts.taglib.bean.MessageTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.bean.MessageTag.class,"org.apache.struts.taglib.bean.MessageTag key"); __jsp_taghandler_172.setParent(__jsp_taghandler_165); __jsp_taghandler_172.setKey("activos.codfin"); __jsp_tag_starteval=__jsp_taghandler_172.doStartTag(); if (OracleJspRuntime.checkStartTagEval(__jsp_tag_starteval)) { do { } while (__jsp_taghandler_172.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); } if (__jsp_taghandler_172.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_172); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[184]); /*@lineinfo:translated-code*//*@lineinfo:380^22*/ { org.apache.struts.taglib.html.HiddenTag __jsp_taghandler_173=(org.apache.struts.taglib.html.HiddenTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.HiddenTag.class,"org.apache.struts.taglib.html.HiddenTag name property"); __jsp_taghandler_173.setParent(__jsp_taghandler_165); __jsp_taghandler_173.setName("ActivosForm"); __jsp_taghandler_173.setProperty("act_codfin"); __jsp_tag_starteval=__jsp_taghandler_173.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_173,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_173.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_173.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_173); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[185]); /*@lineinfo:translated-code*//*@lineinfo:381^25*/ { org.apache.struts.taglib.html.TextTag __jsp_taghandler_174=(org.apache.struts.taglib.html.TextTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.TextTag.class,"org.apache.struts.taglib.html.TextTag maxlength name property readonly size"); __jsp_taghandler_174.setParent(__jsp_taghandler_165); __jsp_taghandler_174.setMaxlength("30"); __jsp_taghandler_174.setName("ActivosForm"); __jsp_taghandler_174.setProperty("act_findescripcion"); __jsp_taghandler_174.setReadonly(true); __jsp_taghandler_174.setSize("30"); __jsp_tag_starteval=__jsp_taghandler_174.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_174,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_174.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_174.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_174); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[186]); /*@lineinfo:translated-code*//*@lineinfo:386^22*/ { org.apache.struts.taglib.bean.MessageTag __jsp_taghandler_175=(org.apache.struts.taglib.bean.MessageTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.bean.MessageTag.class,"org.apache.struts.taglib.bean.MessageTag key"); __jsp_taghandler_175.setParent(__jsp_taghandler_165); __jsp_taghandler_175.setKey("activos.codgrp"); __jsp_tag_starteval=__jsp_taghandler_175.doStartTag(); if (OracleJspRuntime.checkStartTagEval(__jsp_tag_starteval)) { do { } while (__jsp_taghandler_175.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); } if (__jsp_taghandler_175.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_175); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[187]); /*@lineinfo:translated-code*//*@lineinfo:389^25*/ { org.apache.struts.taglib.html.SelectTag __jsp_taghandler_176=(org.apache.struts.taglib.html.SelectTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.SelectTag.class,"org.apache.struts.taglib.html.SelectTag disabled name property"); __jsp_taghandler_176.setParent(__jsp_taghandler_165); __jsp_taghandler_176.setDisabled(false); __jsp_taghandler_176.setName("ActivosForm"); __jsp_taghandler_176.setProperty("act_codgrp"); __jsp_tag_starteval=__jsp_taghandler_176.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_176,__jsp_tag_starteval,out); do { /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[188]); /*@lineinfo:translated-code*//*@lineinfo:390^28*/ { org.apache.struts.taglib.html.OptionsTag __jsp_taghandler_177=(org.apache.struts.taglib.html.OptionsTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.OptionsTag.class,"org.apache.struts.taglib.html.OptionsTag collection labelProperty property"); __jsp_taghandler_177.setParent(__jsp_taghandler_176); __jsp_taghandler_177.setCollection("GruposLista"); __jsp_taghandler_177.setLabelProperty("descripcion"); __jsp_taghandler_177.setProperty("codigo"); __jsp_tag_starteval=__jsp_taghandler_177.doStartTag(); if (OracleJspRuntime.checkStartTagEval(__jsp_tag_starteval)) { do { } while (__jsp_taghandler_177.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); } if (__jsp_taghandler_177.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_177); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[189]); /*@lineinfo:translated-code*//*@lineinfo:390^114*/ } while (__jsp_taghandler_176.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_176.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_176); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[190]); /*@lineinfo:translated-code*//*@lineinfo:396^22*/ { org.apache.struts.taglib.bean.MessageTag __jsp_taghandler_178=(org.apache.struts.taglib.bean.MessageTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.bean.MessageTag.class,"org.apache.struts.taglib.bean.MessageTag key"); __jsp_taghandler_178.setParent(__jsp_taghandler_165); __jsp_taghandler_178.setKey("activos.descripcion"); __jsp_tag_starteval=__jsp_taghandler_178.doStartTag(); if (OracleJspRuntime.checkStartTagEval(__jsp_tag_starteval)) { do { } while (__jsp_taghandler_178.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); } if (__jsp_taghandler_178.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_178); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[191]); /*@lineinfo:translated-code*//*@lineinfo:399^22*/ { org.apache.struts.taglib.html.TextTag __jsp_taghandler_179=(org.apache.struts.taglib.html.TextTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.TextTag.class,"org.apache.struts.taglib.html.TextTag maxlength name onchange property size value"); __jsp_taghandler_179.setParent(__jsp_taghandler_165); __jsp_taghandler_179.setMaxlength("120"); __jsp_taghandler_179.setName("ActivosForm"); __jsp_taghandler_179.setOnchange("javascript:this.value=this.value.toUpperCase();"); __jsp_taghandler_179.setProperty("act_descripcion"); __jsp_taghandler_179.setSize("60"); __jsp_taghandler_179.setValue("%"); __jsp_tag_starteval=__jsp_taghandler_179.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_179,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_179.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_179.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_179); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[192]); /*@lineinfo:translated-code*//*@lineinfo:402^16*/ { org.apache.struts.taglib.logic.EqualTag __jsp_taghandler_180=(org.apache.struts.taglib.logic.EqualTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.logic.EqualTag.class,"org.apache.struts.taglib.logic.EqualTag name property value"); __jsp_taghandler_180.setParent(__jsp_taghandler_165); __jsp_taghandler_180.setName("ActivosForm"); __jsp_taghandler_180.setProperty("opcion"); __jsp_taghandler_180.setValue("2"); __jsp_tag_starteval=__jsp_taghandler_180.doStartTag(); if (OracleJspRuntime.checkStartTagEval(__jsp_tag_starteval)) { do { /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[193]); /*@lineinfo:translated-code*//*@lineinfo:407^25*/ { org.apache.struts.taglib.html.SubmitTag __jsp_taghandler_181=(org.apache.struts.taglib.html.SubmitTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.SubmitTag.class,"org.apache.struts.taglib.html.SubmitTag onclick property styleClass value"); __jsp_taghandler_181.setParent(__jsp_taghandler_180); __jsp_taghandler_181.setOnclick("operacion.value=3;opcion.value=2"); __jsp_taghandler_181.setProperty("boton"); __jsp_taghandler_181.setStyleClass("boton1"); __jsp_taghandler_181.setValue("Modificar"); __jsp_tag_starteval=__jsp_taghandler_181.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_181,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_181.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_181.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_181); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[194]); /*@lineinfo:translated-code*//*@lineinfo:407^137*/ } while (__jsp_taghandler_180.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); } if (__jsp_taghandler_180.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_180); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[195]); /*@lineinfo:translated-code*//*@lineinfo:411^16*/ { org.apache.struts.taglib.logic.EqualTag __jsp_taghandler_182=(org.apache.struts.taglib.logic.EqualTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.logic.EqualTag.class,"org.apache.struts.taglib.logic.EqualTag name property value"); __jsp_taghandler_182.setParent(__jsp_taghandler_165); __jsp_taghandler_182.setName("ActivosForm"); __jsp_taghandler_182.setProperty("opcion"); __jsp_taghandler_182.setValue("3"); __jsp_tag_starteval=__jsp_taghandler_182.doStartTag(); if (OracleJspRuntime.checkStartTagEval(__jsp_tag_starteval)) { do { /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[196]); /*@lineinfo:translated-code*//*@lineinfo:416^25*/ { org.apache.struts.taglib.html.SubmitTag __jsp_taghandler_183=(org.apache.struts.taglib.html.SubmitTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.SubmitTag.class,"org.apache.struts.taglib.html.SubmitTag onclick property styleClass value"); __jsp_taghandler_183.setParent(__jsp_taghandler_182); __jsp_taghandler_183.setOnclick("operacion.value=3;opcion.value=3"); __jsp_taghandler_183.setProperty("boton"); __jsp_taghandler_183.setStyleClass("boton1"); __jsp_taghandler_183.setValue("Eliminar"); __jsp_tag_starteval=__jsp_taghandler_183.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_183,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_183.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_183.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_183); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[197]); /*@lineinfo:translated-code*//*@lineinfo:416^136*/ } while (__jsp_taghandler_182.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); } if (__jsp_taghandler_182.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_182); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[198]); /*@lineinfo:translated-code*//*@lineinfo:420^16*/ { org.apache.struts.taglib.logic.EqualTag __jsp_taghandler_184=(org.apache.struts.taglib.logic.EqualTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.logic.EqualTag.class,"org.apache.struts.taglib.logic.EqualTag name property value"); __jsp_taghandler_184.setParent(__jsp_taghandler_165); __jsp_taghandler_184.setName("ActivosForm"); __jsp_taghandler_184.setProperty("opcion"); __jsp_taghandler_184.setValue("4"); __jsp_tag_starteval=__jsp_taghandler_184.doStartTag(); if (OracleJspRuntime.checkStartTagEval(__jsp_tag_starteval)) { do { /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[199]); /*@lineinfo:translated-code*//*@lineinfo:425^25*/ { org.apache.struts.taglib.html.SubmitTag __jsp_taghandler_185=(org.apache.struts.taglib.html.SubmitTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.SubmitTag.class,"org.apache.struts.taglib.html.SubmitTag onclick property styleClass value"); __jsp_taghandler_185.setParent(__jsp_taghandler_184); __jsp_taghandler_185.setOnclick("operacion.value=3;opcion.value=4"); __jsp_taghandler_185.setProperty("boton"); __jsp_taghandler_185.setStyleClass("boton1"); __jsp_taghandler_185.setValue("Consultar"); __jsp_tag_starteval=__jsp_taghandler_185.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_185,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_185.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_185.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_185); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[200]); /*@lineinfo:translated-code*//*@lineinfo:425^137*/ } while (__jsp_taghandler_184.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); } if (__jsp_taghandler_184.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_184); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[201]); /*@lineinfo:translated-code*//*@lineinfo:428^30*/ } while (__jsp_taghandler_165.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); } if (__jsp_taghandler_165.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_165); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[202]); /*@lineinfo:translated-code*//*@lineinfo:431^1*/ { org.apache.struts.taglib.logic.EqualTag __jsp_taghandler_186=(org.apache.struts.taglib.logic.EqualTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.logic.EqualTag.class,"org.apache.struts.taglib.logic.EqualTag name property value"); __jsp_taghandler_186.setParent(__jsp_taghandler_1); __jsp_taghandler_186.setName("ActivosForm"); __jsp_taghandler_186.setProperty("operacion"); __jsp_taghandler_186.setValue("3"); __jsp_tag_starteval=__jsp_taghandler_186.doStartTag(); if (OracleJspRuntime.checkStartTagEval(__jsp_tag_starteval)) { do { /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[203]); /*@lineinfo:translated-code*//*@lineinfo:437^6*/ { org.apache.struts.taglib.html.HiddenTag __jsp_taghandler_187=(org.apache.struts.taglib.html.HiddenTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.HiddenTag.class,"org.apache.struts.taglib.html.HiddenTag name property"); __jsp_taghandler_187.setParent(__jsp_taghandler_186); __jsp_taghandler_187.setName("ActivosForm"); __jsp_taghandler_187.setProperty("act_codrub"); __jsp_tag_starteval=__jsp_taghandler_187.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_187,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_187.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_187.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_187); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[204]); /*@lineinfo:translated-code*//*@lineinfo:438^6*/ { org.apache.struts.taglib.html.HiddenTag __jsp_taghandler_188=(org.apache.struts.taglib.html.HiddenTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.HiddenTag.class,"org.apache.struts.taglib.html.HiddenTag name property"); __jsp_taghandler_188.setParent(__jsp_taghandler_186); __jsp_taghandler_188.setName("ActivosForm"); __jsp_taghandler_188.setProperty("act_codreg"); __jsp_tag_starteval=__jsp_taghandler_188.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_188,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_188.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_188.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_188); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[205]); /*@lineinfo:translated-code*//*@lineinfo:439^6*/ { org.apache.struts.taglib.html.HiddenTag __jsp_taghandler_189=(org.apache.struts.taglib.html.HiddenTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.HiddenTag.class,"org.apache.struts.taglib.html.HiddenTag name property"); __jsp_taghandler_189.setParent(__jsp_taghandler_186); __jsp_taghandler_189.setName("ActivosForm"); __jsp_taghandler_189.setProperty("act_codgrp"); __jsp_tag_starteval=__jsp_taghandler_189.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_189,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_189.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_189.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_189); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[206]); /*@lineinfo:translated-code*//*@lineinfo:440^6*/ { org.apache.struts.taglib.html.HiddenTag __jsp_taghandler_190=(org.apache.struts.taglib.html.HiddenTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.HiddenTag.class,"org.apache.struts.taglib.html.HiddenTag name property"); __jsp_taghandler_190.setParent(__jsp_taghandler_186); __jsp_taghandler_190.setName("ActivosForm"); __jsp_taghandler_190.setProperty("act_codfin"); __jsp_tag_starteval=__jsp_taghandler_190.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_190,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_190.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_190.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_190); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[207]); /*@lineinfo:translated-code*//*@lineinfo:441^6*/ { org.apache.struts.taglib.html.HiddenTag __jsp_taghandler_191=(org.apache.struts.taglib.html.HiddenTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.HiddenTag.class,"org.apache.struts.taglib.html.HiddenTag name property"); __jsp_taghandler_191.setParent(__jsp_taghandler_186); __jsp_taghandler_191.setName("ActivosForm"); __jsp_taghandler_191.setProperty("act_descripcion"); __jsp_tag_starteval=__jsp_taghandler_191.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_191,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_191.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_191.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_191); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[208]); /*@lineinfo:user-code*//*@lineinfo:449^7*/ int pnum=0; /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[209]); /*@lineinfo:translated-code*//*@lineinfo:450^7*/ { org.apache.struts.taglib.logic.IterateTag __jsp_taghandler_192=(org.apache.struts.taglib.logic.IterateTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.logic.IterateTag.class,"org.apache.struts.taglib.logic.IterateTag id name"); __jsp_taghandler_192.setParent(__jsp_taghandler_186); __jsp_taghandler_192.setId("lista"); __jsp_taghandler_192.setName("Activos3Lista"); java.lang.Object lista = null; __jsp_tag_starteval=__jsp_taghandler_192.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_192,__jsp_tag_starteval,out); do { lista = (java.lang.Object) pageContext.findAttribute("lista"); /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[210]); /*@lineinfo:user-code*//*@lineinfo:451^9*/ if (pnum==1) { /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[211]); /*@lineinfo:user-code*//*@lineinfo:453^9*/ } else { /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[212]); /*@lineinfo:user-code*//*@lineinfo:455^9*/ } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[213]); /*@lineinfo:translated-code*//*@lineinfo:456^16*/ { org.apache.struts.taglib.bean.WriteTag __jsp_taghandler_193=(org.apache.struts.taglib.bean.WriteTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.bean.WriteTag.class,"org.apache.struts.taglib.bean.WriteTag name property"); __jsp_taghandler_193.setParent(__jsp_taghandler_192); __jsp_taghandler_193.setName("lista"); __jsp_taghandler_193.setProperty("codrub"); __jsp_tag_starteval=__jsp_taghandler_193.doStartTag(); if (OracleJspRuntime.checkStartTagEval(__jsp_tag_starteval)) { do { } while (__jsp_taghandler_193.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); } if (__jsp_taghandler_193.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_193); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[214]); /*@lineinfo:translated-code*//*@lineinfo:456^62*/ { org.apache.struts.taglib.bean.WriteTag __jsp_taghandler_194=(org.apache.struts.taglib.bean.WriteTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.bean.WriteTag.class,"org.apache.struts.taglib.bean.WriteTag name property"); __jsp_taghandler_194.setParent(__jsp_taghandler_192); __jsp_taghandler_194.setName("lista"); __jsp_taghandler_194.setProperty("codreg"); __jsp_tag_starteval=__jsp_taghandler_194.doStartTag(); if (OracleJspRuntime.checkStartTagEval(__jsp_tag_starteval)) { do { } while (__jsp_taghandler_194.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); } if (__jsp_taghandler_194.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_194); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[215]); /*@lineinfo:translated-code*//*@lineinfo:456^108*/ { org.apache.struts.taglib.bean.WriteTag __jsp_taghandler_195=(org.apache.struts.taglib.bean.WriteTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.bean.WriteTag.class,"org.apache.struts.taglib.bean.WriteTag name property"); __jsp_taghandler_195.setParent(__jsp_taghandler_192); __jsp_taghandler_195.setName("lista"); __jsp_taghandler_195.setProperty("ceros"); __jsp_tag_starteval=__jsp_taghandler_195.doStartTag(); if (OracleJspRuntime.checkStartTagEval(__jsp_tag_starteval)) { do { } while (__jsp_taghandler_195.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); } if (__jsp_taghandler_195.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_195); } /*@lineinfo:456^152*/ { org.apache.struts.taglib.bean.WriteTag __jsp_taghandler_196=(org.apache.struts.taglib.bean.WriteTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.bean.WriteTag.class,"org.apache.struts.taglib.bean.WriteTag name property"); __jsp_taghandler_196.setParent(__jsp_taghandler_192); __jsp_taghandler_196.setName("lista"); __jsp_taghandler_196.setProperty("codigo"); __jsp_tag_starteval=__jsp_taghandler_196.doStartTag(); if (OracleJspRuntime.checkStartTagEval(__jsp_tag_starteval)) { do { } while (__jsp_taghandler_196.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); } if (__jsp_taghandler_196.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_196); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[216]); /*@lineinfo:translated-code*//*@lineinfo:457^16*/ { org.apache.struts.taglib.bean.WriteTag __jsp_taghandler_197=(org.apache.struts.taglib.bean.WriteTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.bean.WriteTag.class,"org.apache.struts.taglib.bean.WriteTag name property"); __jsp_taghandler_197.setParent(__jsp_taghandler_192); __jsp_taghandler_197.setName("lista"); __jsp_taghandler_197.setProperty("descodgrp"); __jsp_tag_starteval=__jsp_taghandler_197.doStartTag(); if (OracleJspRuntime.checkStartTagEval(__jsp_tag_starteval)) { do { } while (__jsp_taghandler_197.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); } if (__jsp_taghandler_197.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_197); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[217]); /*@lineinfo:translated-code*//*@lineinfo:458^16*/ { org.apache.struts.taglib.bean.WriteTag __jsp_taghandler_198=(org.apache.struts.taglib.bean.WriteTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.bean.WriteTag.class,"org.apache.struts.taglib.bean.WriteTag name property"); __jsp_taghandler_198.setParent(__jsp_taghandler_192); __jsp_taghandler_198.setName("lista"); __jsp_taghandler_198.setProperty("descripcion"); __jsp_tag_starteval=__jsp_taghandler_198.doStartTag(); if (OracleJspRuntime.checkStartTagEval(__jsp_tag_starteval)) { do { } while (__jsp_taghandler_198.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); } if (__jsp_taghandler_198.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_198); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[218]); /*@lineinfo:translated-code*//*@lineinfo:459^12*/ { org.apache.struts.taglib.logic.EqualTag __jsp_taghandler_199=(org.apache.struts.taglib.logic.EqualTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.logic.EqualTag.class,"org.apache.struts.taglib.logic.EqualTag name property value"); __jsp_taghandler_199.setParent(__jsp_taghandler_192); __jsp_taghandler_199.setName("ActivosForm"); __jsp_taghandler_199.setProperty("opcion"); __jsp_taghandler_199.setValue("4"); __jsp_tag_starteval=__jsp_taghandler_199.doStartTag(); if (OracleJspRuntime.checkStartTagEval(__jsp_tag_starteval)) { do { /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[219]); /*@lineinfo:translated-code*//*@lineinfo:460^33*/ { org.apache.struts.taglib.html.SubmitTag __jsp_taghandler_200=(org.apache.struts.taglib.html.SubmitTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.SubmitTag.class,"org.apache.struts.taglib.html.SubmitTag indexed onclick property styleClass value"); __jsp_taghandler_200.setParent(__jsp_taghandler_199); __jsp_taghandler_200.setIndexed(true); __jsp_taghandler_200.setOnclick("operacion.value=1;opcion.value=4"); __jsp_taghandler_200.setProperty("boton"); __jsp_taghandler_200.setStyleClass("boton1"); __jsp_taghandler_200.setValue("Consultar"); __jsp_tag_starteval=__jsp_taghandler_200.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_200,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_200.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_200.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_200); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[220]); /*@lineinfo:translated-code*//*@lineinfo:460^160*/ } while (__jsp_taghandler_199.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); } if (__jsp_taghandler_199.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_199); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[221]); /*@lineinfo:user-code*//*@lineinfo:463^10*/ if (pnum==0) pnum=1; else pnum=0; /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[222]); /*@lineinfo:translated-code*//*@lineinfo:463^49*/ } while (__jsp_taghandler_192.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_192.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_192); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[223]); /*@lineinfo:translated-code*//*@lineinfo:464^23*/ } while (__jsp_taghandler_186.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); } if (__jsp_taghandler_186.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_186); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[224]); /*@lineinfo:translated-code*//*@lineinfo:471^15*/ } while (__jsp_taghandler_1.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); } if (__jsp_taghandler_1.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_1); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[225]); } catch( Throwable e) { try { if (out != null) out.clear(); } catch( Exception clearException) { } pageContext.handlePageException( e); } finally { OracleJspRuntime.extraHandlePCFinally(pageContext,true); JspFactory.getDefaultFactory().releasePageContext(pageContext); } } private static class __jsp_StaticText { private static final char text[][]=new char[226][]; static { try { text[0] = "\n".toCharArray(); text[1] = "\n".toCharArray(); text[2] = "\n".toCharArray(); text[3] = "\n".toCharArray(); text[4] = "\n<html>\n<head>\n <meta http-equiv=\"Content-Type\" content=\"text/html; charset=windows-125\">\n <meta http-equiv=\"Expires\" content=\"-1\">\n <link href=\"Estilos.css\" rel=\"stylesheet\" type=\"text/css\">\n</head>\n<script language=\"JavaScript\" type=\"text/JavaScript\" src=\"Validaciones2.js?1.3\"></script>\n<body>\n<table border=\"1\" width=\"100%\" align=\"center\" class=\"soloborde\" bgcolor=\"#C1C1FF\">\n<caption>Activos</caption>\n<tr><td>\n".toCharArray(); text[5] = "\n".toCharArray(); text[6] = "\n".toCharArray(); text[7] = "\n".toCharArray(); text[8] = "\n ".toCharArray(); text[9] = "\n <table width=\"100%\" align=\"center\" class=\"soloborde\" bgcolor=\"#C1C1FF\" border=\"1\">\n <tr>\n <td class=\"S10d\">".toCharArray(); text[10] = "</td>\n <td colspan=\"3\">".toCharArray(); text[11] = "\n ".toCharArray(); text[12] = "</td>\n </tr>\n <tr>\n <td class=\"S10d\">".toCharArray(); text[13] = "</td>\n <td colspan=\"3\">".toCharArray(); text[14] = "\n ".toCharArray(); text[15] = "</td>\n </tr>\n <tr>\n <td class=\"S10d\">".toCharArray(); text[16] = "</td>\n <td colspan=\"3\">".toCharArray(); text[17] = "\n ".toCharArray(); text[18] = "</td>\n </tr>\n <tr>\n <td class=\"S10d\">".toCharArray(); text[19] = "</td>\n <td>\n ".toCharArray(); text[20] = " \n ".toCharArray(); text[21] = "\n </td>\n <td class=\"S10d\">".toCharArray(); text[22] = "</td>\n <td>\n ".toCharArray(); text[23] = " \n ".toCharArray(); text[24] = "\n </td>\n </tr>\n <tr>\n <td class=\"S10d\">".toCharArray(); text[25] = "</td>\n <td>\n ".toCharArray(); text[26] = " \n ".toCharArray(); text[27] = "\n </td>\n <td class=\"S10d\">".toCharArray(); text[28] = "</td>\n <td>\n ".toCharArray(); text[29] = " \n ".toCharArray(); text[30] = "\n </td>\n </tr>\n <tr>\n <td class=\"S10d\">".toCharArray(); text[31] = "</td>\n <td>\n ".toCharArray(); text[32] = " \n ".toCharArray(); text[33] = "\n </td>\n <td class=\"S10d\">".toCharArray(); text[34] = "</td>\n <td>\n ".toCharArray(); text[35] = " \n ".toCharArray(); text[36] = "\n </td>\n </tr>\n <tr>\n <td class=\"S10d\">".toCharArray(); text[37] = "</td>\n <td>\n ".toCharArray(); text[38] = " \n ".toCharArray(); text[39] = "\n </td>\n </tr>\n <tr>\n <td class=\"S10d\">".toCharArray(); text[40] = "</td>\n <td>".toCharArray(); text[41] = "</td>\n <td class=\"S10d\">".toCharArray(); text[42] = "</td>\n <td>".toCharArray(); text[43] = "</td>\n </tr>\n <tr>\n <td class=\"S10d\">".toCharArray(); text[44] = "</td>\n <td>".toCharArray(); text[45] = "</td>\n <td class=\"S10d\">".toCharArray(); text[46] = "</td>\n <td>".toCharArray(); text[47] = "</td>\n </tr> \n </table>\n <table width=\"100%\" align=\"center\" class=\"soloborde\" bgcolor=\"#C1C1FF\" border=\"1\">\n <tr>\n <td class=\"S10d\">".toCharArray(); text[48] = "</td>\n <td>".toCharArray(); text[49] = "</td>\n </tr>\n <tr>\n <td class=\"S10d\">".toCharArray(); text[50] = "</td>\n <td>".toCharArray(); text[51] = "</td>\n </tr>\n <tr>\n <td class=\"S10d\">\n ".toCharArray(); text[52] = "\n </td>\n <td>\n ".toCharArray(); text[53] = "\n </td>\n </tr> \n </table>\n <table width=\"100%\" align=\"center\" class=\"soloborde\" bgcolor=\"#C1C1FF\" border=\"1\"> \n <tr>\n <td class=\"S10d\">".toCharArray(); text[54] = "</td>\n <td>".toCharArray(); text[55] = "</td>\n <td class=\"S10d\">".toCharArray(); text[56] = "</td>\n <td>".toCharArray(); text[57] = "</td>\n </tr>\n <tr>\n <td class=\"S10d\">".toCharArray(); text[58] = "</td>\n <td>".toCharArray(); text[59] = "</td>\n <td class=\"S10d\">".toCharArray(); text[60] = "</td>\n <td>".toCharArray(); text[61] = "</td>\n </tr>\n <tr>\n <td class=\"S10d\">".toCharArray(); text[62] = "</td>\n <td>".toCharArray(); text[63] = "</td>\n <td class=\"S10d\">".toCharArray(); text[64] = "</td>\n <td>".toCharArray(); text[65] = "</td>\n </tr>\n <tr>\n <td class=\"S10d\">".toCharArray(); text[66] = "</td>\n <td>".toCharArray(); text[67] = "</td>\n <td class=\"S10d\">".toCharArray(); text[68] = "</td>\n <td>".toCharArray(); text[69] = "</td>\n </tr>\n <tr>\n <td class=\"S10d\">".toCharArray(); text[70] = "</td>\n <td>".toCharArray(); text[71] = "</td>\n <td class=\"S10d\">".toCharArray(); text[72] = "</td>\n <td>".toCharArray(); text[73] = "</td>\n </tr>\n <tr>\n <td class=\"S10d\">".toCharArray(); text[74] = "</td>\n <td>".toCharArray(); text[75] = "</td>\n <td class=\"S10d\">".toCharArray(); text[76] = "</td>\n <td>".toCharArray(); text[77] = "</td>\n </tr> \n <tr>\n <td class=\"S10d\">".toCharArray(); text[78] = "</td>\n <td>".toCharArray(); text[79] = "</td>\n </tr>\n <tr>\n <td colspan=2>".toCharArray(); text[80] = "</td>\n </tr> \n </table> \n ".toCharArray(); text[81] = " \n ".toCharArray(); text[82] = "\n <table width=\"100%\" align=\"center\" class=\"soloborde\" bgcolor=\"#C1C1FF\" border=\"1\">\n <tr>\n <td class=\"S10d\">".toCharArray(); text[83] = "</td>\n <td colspan=\"3\">".toCharArray(); text[84] = "\n ".toCharArray(); text[85] = "</td>\n </tr>\n <tr>\n <td class=\"S10d\">".toCharArray(); text[86] = "</td>\n <td colspan=\"3\">".toCharArray(); text[87] = "\n ".toCharArray(); text[88] = "</td>\n </tr>\n <tr>\n <td class=\"S10d\">".toCharArray(); text[89] = "</td>\n <td colspan=\"3\">".toCharArray(); text[90] = "\n ".toCharArray(); text[91] = "</td>\n </tr>\n <tr>\n <td class=\"S10d\">".toCharArray(); text[92] = "</td>\n <td>\n ".toCharArray(); text[93] = " \n ".toCharArray(); text[94] = "\n </td>\n <td class=\"S10d\">".toCharArray(); text[95] = "</td>\n <td>\n ".toCharArray(); text[96] = " \n ".toCharArray(); text[97] = "\n </td>\n </tr>\n <tr>\n <td class=\"S10d\">".toCharArray(); text[98] = "</td>\n <td>\n ".toCharArray(); text[99] = " \n ".toCharArray(); text[100] = "\n </td>\n <td class=\"S10d\">".toCharArray(); text[101] = "</td>\n <td>\n ".toCharArray(); text[102] = " \n ".toCharArray(); text[103] = "\n </td>\n </tr>\n <tr>\n <td class=\"S10d\">".toCharArray(); text[104] = "</td>\n <td>\n ".toCharArray(); text[105] = " \n ".toCharArray(); text[106] = "\n </td>\n <td class=\"S10d\">".toCharArray(); text[107] = "</td>\n <td>\n ".toCharArray(); text[108] = " \n ".toCharArray(); text[109] = "\n </td>\n </tr>\n <tr>\n <td class=\"S10d\">".toCharArray(); text[110] = "</td>\n <td>\n ".toCharArray(); text[111] = " \n ".toCharArray(); text[112] = "\n </td>\n </tr>\n <tr>\n <td class=\"S10d\">".toCharArray(); text[113] = "</td>\n <td>".toCharArray(); text[114] = "</td>\n <td class=\"S10d\">".toCharArray(); text[115] = "</td>\n <td>".toCharArray(); text[116] = "</td>\n </tr>\n <tr>\n <td class=\"S10d\">".toCharArray(); text[117] = "</td>\n <td>".toCharArray(); text[118] = "</td>\n <td class=\"S10d\">".toCharArray(); text[119] = "</td>\n <td>".toCharArray(); text[120] = "</td>\n </tr> \n </table>\n <table width=\"100%\" align=\"center\" class=\"soloborde\" bgcolor=\"#C1C1FF\" border=\"1\">\n <tr>\n <td class=\"S10d\">".toCharArray(); text[121] = "</td>\n <td>".toCharArray(); text[122] = "</td>\n </tr>\n <tr>\n <td class=\"S10d\">".toCharArray(); text[123] = "</td>\n <td>".toCharArray(); text[124] = "</td>\n </tr>\n <tr>\n <td class=\"S10d\">\n ".toCharArray(); text[125] = "\n </td>\n <td>\n ".toCharArray(); text[126] = "\n </td>\n </tr> \n </table>\n <table width=\"100%\" align=\"center\" class=\"soloborde\" bgcolor=\"#C1C1FF\" border=\"1\"> \n <tr>\n <td class=\"S10d\">".toCharArray(); text[127] = "</td>\n <td>".toCharArray(); text[128] = "</td>\n <td class=\"S10d\">".toCharArray(); text[129] = "</td>\n <td>".toCharArray(); text[130] = "</td>\n </tr>\n <tr>\n <td class=\"S10d\">".toCharArray(); text[131] = "</td>\n <td>".toCharArray(); text[132] = "</td>\n <td class=\"S10d\">".toCharArray(); text[133] = "</td>\n <td>".toCharArray(); text[134] = "</td>\n </tr>\n <tr>\n <td class=\"S10d\">".toCharArray(); text[135] = "</td>\n <td>".toCharArray(); text[136] = "</td>\n <td class=\"S10d\">".toCharArray(); text[137] = "</td>\n <td>".toCharArray(); text[138] = "</td>\n </tr>\n <tr>\n <td class=\"S10d\">".toCharArray(); text[139] = "</td>\n <td>".toCharArray(); text[140] = "</td>\n <td class=\"S10d\">".toCharArray(); text[141] = "</td>\n <td>".toCharArray(); text[142] = "</td>\n </tr>\n <tr>\n <td class=\"S10d\">".toCharArray(); text[143] = "</td>\n <td>".toCharArray(); text[144] = "</td>\n <td class=\"S10d\">".toCharArray(); text[145] = "</td>\n <td>".toCharArray(); text[146] = "</td>\n </tr>\n <tr>\n <td class=\"S10d\">".toCharArray(); text[147] = "</td>\n <td>".toCharArray(); text[148] = "</td>\n <td class=\"S10d\">".toCharArray(); text[149] = "</td>\n <td>".toCharArray(); text[150] = "</td>\n </tr> \n <tr>\n <td class=\"S10d\">".toCharArray(); text[151] = "</td>\n <td>".toCharArray(); text[152] = "</td>\n </tr>\n <tr>\n <td colspan=2>".toCharArray(); text[153] = "</td>\n </tr> \n </table> \n ".toCharArray(); text[154] = " \n".toCharArray(); text[155] = "\n ".toCharArray(); text[156] = "\n <table width=\"100%\" align=\"center\" class=\"soloborde\" bgcolor=\"#C1C1FF\">\n <tr>\n <td class=\"S10d\">\n ".toCharArray(); text[157] = "\n </td>\n <td>\n\t\t\t ".toCharArray(); text[158] = "\n ".toCharArray(); text[159] = "\n ".toCharArray(); text[160] = "\n\t\t\t </td>\n </tr>\n <tr>\n <td class=\"S10d\">\n\t\t\t ".toCharArray(); text[161] = "\n\t\t\t </td>\n <td>\n\t\t\t ".toCharArray(); text[162] = "\n ".toCharArray(); text[163] = "\n\t\t\t </td>\n </tr> \n <tr>\n <td class=\"S10d\">\n\t\t\t ".toCharArray(); text[164] = "\n\t\t\t </td>\n <td>\n\t\t\t ".toCharArray(); text[165] = "\n ".toCharArray(); text[166] = "\n\t\t\t </td>\n </tr> \n ".toCharArray(); text[167] = "\n <tr>\n <td>\n\t\t\t </td>\n <td align=\"left\">\n ".toCharArray(); text[168] = "\n </td>\n </tr>\n ".toCharArray(); text[169] = " \n ".toCharArray(); text[170] = "\n <tr>\n <td>\n\t\t\t </td>\n <td align=\"left\">\n ".toCharArray(); text[171] = "\n </td>\n </tr>\n ".toCharArray(); text[172] = " \n ".toCharArray(); text[173] = "\n <tr>\n <td>\n\t\t\t </td>\n <td align=\"left\">\n ".toCharArray(); text[174] = "\n </td>\n </tr>\n ".toCharArray(); text[175] = " \n </table>\n ".toCharArray(); text[176] = " \n ".toCharArray(); text[177] = "\n <table width=\"100%\" align=\"center\" class=\"soloborde\" bgcolor=\"#C1C1FF\">\n <tr>\n <td class=\"S10d\">\n ".toCharArray(); text[178] = "\n </td>\n <td>\n\t\t\t ".toCharArray(); text[179] = "\n ".toCharArray(); text[180] = " \n\t\t\t </td>\n </tr>\n <tr>\n <td class=\"S10d\">\n\t\t\t ".toCharArray(); text[181] = "\n\t\t\t </td>\n <td>\n\t\t\t ".toCharArray(); text[182] = "\n ".toCharArray(); text[183] = "\n\t\t\t </td>\n </tr> \n <tr>\n <td class=\"S10d\">\n\t\t\t ".toCharArray(); text[184] = "\n\t\t\t </td>\n <td>\n\t\t\t ".toCharArray(); text[185] = "\n ".toCharArray(); text[186] = "\n\t\t\t </td>\n </tr> \n <tr>\n <td class=\"S10d\">\n\t\t\t ".toCharArray(); text[187] = "\n\t\t\t </td>\n <td>\n ".toCharArray(); text[188] = "\n ".toCharArray(); text[189] = "\n ".toCharArray(); text[190] = "\n </td>\n </tr> \n <tr>\n <td class=\"S10d\">\n\t\t\t ".toCharArray(); text[191] = " % = Comodin\n\t\t\t </td>\n <td>\n\t\t\t ".toCharArray(); text[192] = "\n\t\t\t </td>\n </tr> \n ".toCharArray(); text[193] = "\n <tr>\n <td>\n\t\t\t </td>\n <td align=\"left\">\n ".toCharArray(); text[194] = "\n </td>\n </tr>\n ".toCharArray(); text[195] = " \n ".toCharArray(); text[196] = "\n <tr>\n <td>\n\t\t\t </td>\n <td align=\"left\">\n ".toCharArray(); text[197] = "\n </td>\n </tr>\n ".toCharArray(); text[198] = " \n ".toCharArray(); text[199] = " \n <tr>\n <td>\n\t\t\t </td>\n <td align=\"left\">\n ".toCharArray(); text[200] = "\n </td>\n </tr>\n ".toCharArray(); text[201] = " \n </table>\n ".toCharArray(); text[202] = "\n".toCharArray(); text[203] = "\n<table width=\"100%\" align=\"center\" class=\"soloborde\" bgcolor=\"#C1C1FF\" border=\"1\">\n <tr class=\"T8a\">\n <td>\n <table width=\"100%\" align=\"center\" class=\"soloborde\" bgcolor=\"#C1C1FF\" border=\"1\">\n <tr><td>\n ".toCharArray(); text[204] = "\n ".toCharArray(); text[205] = "\n ".toCharArray(); text[206] = " \n ".toCharArray(); text[207] = " \n ".toCharArray(); text[208] = " \n <table width=\"100%\" class=\"soloborde\" bgcolor=\"#C1C1FF\">\n <tr class=\"FondoAzul\">\n <td width=\"60\" scope=\"col\" class=\"S10c\">Código</td>\n <td width=\"60\" scope=\"col\" class=\"S10c\">Grupo</td> \n <td width=\"160\" scope=\"col\" class=\"S10c\">Descripción</td>\n <td></td>\n </tr>\n ".toCharArray(); text[209] = "\n ".toCharArray(); text[210] = "\n ".toCharArray(); text[211] = "\n <tr class=\"T8b\">\n ".toCharArray(); text[212] = "\n <tr class=\"T8a\">\n ".toCharArray(); text[213] = "\n <td>".toCharArray(); text[214] = "-".toCharArray(); text[215] = "-".toCharArray(); text[216] = "</td>\n <td>".toCharArray(); text[217] = "</td>\n <td>".toCharArray(); text[218] = "</td>\n ".toCharArray(); text[219] = "\n <td align=\"right\">".toCharArray(); text[220] = "</td>\n ".toCharArray(); text[221] = " \n </tr>\n ".toCharArray(); text[222] = "\n ".toCharArray(); text[223] = "\n </table>\n </td></tr> \n </table>\n </td>\n </tr>\n</table> \n".toCharArray(); text[224] = "\n".toCharArray(); text[225] = "\n</td></tr>\n<tr><td align=\"center\" colspan=\"2\" class=\"S10d\">(*) Campos Obligatorios</td></tr>\n</table>\n</body>\n</html>".toCharArray(); } catch (Throwable th) { System.err.println(th); } } } } <file_sep>package ActivosFijos; import org.apache.struts.action.ActionForm; import org.apache.struts.action.ActionErrors; import org.apache.struts.action.ActionError; import org.apache.struts.action.ActionMapping; import javax.servlet.http.HttpServletRequest; public class DocumentosForm extends ActionForm { String doc_codreg; String doc_tipdoc; int doc_numero; int doc_devolucion; String doc_fecha; String doc_codofiorigen; String doc_codfunorigen; String doc_codubiorigen; String doc_codfinorigen; String doc_codfin; String doc_codpryorigen; String doc_codofidestino; String doc_codfundestino; String doc_codubidestino; String doc_codfindestino; String doc_codprydestino; String doc_observacion; String doc_inconfirma; private String boton; private int fila; private int operacion; private int opcion; int ddo_item; String ddo_codrubactual; String ddo_codregactual; int ddo_codigo; String doc_funorinombre; String doc_fundesnombre; String doc_feccierre; String doc_codregdestino; String doc_regdescripcion; String doc_findescripcion; String ddo_codmot; String ddo_codofiactual; String ddo_codubiactual; String mes; String anio; String doc_ofiorinombre; String doc_ofidesnombre; String doc_carorinombre; String doc_cardesnombre; String cte_tipdocentrega; String cte_tipdocdevolucion; String cte_tipdoctransferencia; String cte_tipdocbaja; String doc_glosa; String usuario; int inicio; int fin; String confirmados; String gestionant; String desactivo; String desbaja; String desofi; /** * Reset all properties to their default values. * @param mapping The ActionMapping used to select this instance. * @param request The HTTP Request we are processing. */ public void reset(ActionMapping mapping, HttpServletRequest request) { super.reset(mapping, request); } /** * Validate all properties to their default values. * @param mapping The ActionMapping used to select this instance. * @param request The HTTP Request we are processing. * @return ActionErrors A list of all errors found. */ public ActionErrors validate(ActionMapping mapping, HttpServletRequest request) { return super.validate(mapping, request); } public String getDoc_codreg() { return doc_codreg; } public void setDoc_codreg(String newDoc_codreg) { doc_codreg = newDoc_codreg; } public String getDoc_tipdoc() { return doc_tipdoc; } public void setDoc_tipdoc(String newDoc_tipdoc) { doc_tipdoc = newDoc_tipdoc; } public int getDoc_numero() { return doc_numero; } public void setDoc_numero(int newDoc_numero) { doc_numero = newDoc_numero; } public int getDoc_devolucion() { return doc_devolucion; } public void setDoc_devolucion(int newDoc_devolucion) { doc_devolucion = newDoc_devolucion; } public String getDoc_fecha() { return doc_fecha; } public void setDoc_fecha(String newDoc_fecha) { doc_fecha = newDoc_fecha; } public String getDoc_codofiorigen() { return doc_codofiorigen; } public void setDoc_codofiorigen(String newDoc_codofiorigen) { doc_codofiorigen = newDoc_codofiorigen; } public String getDoc_codfunorigen() { return doc_codfunorigen; } public void setDoc_codfunorigen(String newDoc_codfunorigen) { doc_codfunorigen = newDoc_codfunorigen; } public String getDoc_codubiorigen() { return doc_codubiorigen; } public void setDoc_codubiorigen(String newDoc_codubiorigen) { doc_codubiorigen = newDoc_codubiorigen; } public String getDoc_codfinorigen() { return doc_codfinorigen; } public void setDoc_codfinorigen(String newDoc_codfinorigen) { doc_codfinorigen = newDoc_codfinorigen; } public String getDoc_codfin() { return doc_codfin; } public void setDoc_codfin(String newDoc_codfin) { doc_codfin = newDoc_codfin; } public String getDoc_codpryorigen() { return doc_codpryorigen; } public void setDoc_codpryorigen(String newDoc_codpryorigen) { doc_codpryorigen = newDoc_codpryorigen; } public String getDoc_codofidestino() { return doc_codofidestino; } public void setDoc_codofidestino(String newDoc_codofidestino) { doc_codofidestino = newDoc_codofidestino; } public String getDoc_codfundestino() { return doc_codfundestino; } public void setDoc_codfundestino(String newDoc_codfundestino) { doc_codfundestino = newDoc_codfundestino; } public String getDoc_codubidestino() { return doc_codubidestino; } public void setDoc_codubidestino(String newDoc_codubidestino) { doc_codubidestino = newDoc_codubidestino; } public String getDoc_codfindestino() { return doc_codfindestino; } public void setDoc_codfindestino(String newDoc_codfindestino) { doc_codfindestino = newDoc_codfindestino; } public String getDoc_codprydestino() { return doc_codprydestino; } public void setDoc_codprydestino(String newDoc_codprydestino) { doc_codprydestino = newDoc_codprydestino; } public String getDoc_observacion() { return doc_observacion; } public void setDoc_observacion(String newDoc_observacion) { doc_observacion = newDoc_observacion; } public String getDoc_inconfirma() { return doc_inconfirma; } public void setDoc_inconfirma(String newDoc_inconfirma) { doc_inconfirma = newDoc_inconfirma; } public void setBoton(String newBoton) { boton = newBoton; } public String getBoton(int index) { return boton; } public void setBoton(int index, String newBoton) { boton = newBoton; fila = index; } public int getFila() { return fila; } public void setFila(int newFila) { fila = newFila; } public int getOperacion() { return operacion; } public void setOperacion(int newOperacion) { operacion = newOperacion; } public int getOpcion() { return opcion; } public void setOpcion(int newOpcion) { opcion = newOpcion; } public int getDdo_item() { return ddo_item; } public void setDdo_item(int newDdo_item) { ddo_item = newDdo_item; } public String getDdo_codrubactual() { return ddo_codrubactual; } public void setDdo_codrubactual(String newDdo_codrubactual) { ddo_codrubactual = newDdo_codrubactual; } public String getDdo_codregactual() { return ddo_codregactual; } public void setDdo_codregactual(String newDdo_codregactual) { ddo_codregactual = newDdo_codregactual; } public int getDdo_codigo() { return ddo_codigo; } public void setDdo_codigo(int newDdo_codigo) { ddo_codigo = newDdo_codigo; } public String getDoc_funorinombre() { return doc_funorinombre; } public void setDoc_funorinombre(String newDoc_funorinombre) { doc_funorinombre = newDoc_funorinombre; } public String getDoc_fundesnombre() { return doc_fundesnombre; } public void setDoc_fundesnombre(String newDoc_fundesnombre) { doc_fundesnombre = newDoc_fundesnombre; } public String getDoc_feccierre() { return doc_feccierre; } public void setDoc_feccierre(String newDoc_feccierre) { doc_feccierre = newDoc_feccierre; } public String getDoc_codregdestino() { return doc_codregdestino; } public void setDoc_codregdestino(String newDoc_codregdestino) { doc_codregdestino = newDoc_codregdestino; } public String getDoc_regdescripcion() { return doc_regdescripcion; } public void setDoc_regdescripcion(String newDoc_regdescripcion) { doc_regdescripcion = newDoc_regdescripcion; } public String getDoc_findescripcion() { return doc_findescripcion; } public void setDoc_findescripcion(String newDoc_findescripcion) { doc_findescripcion = newDoc_findescripcion; } public String getDdo_codmot() { return ddo_codmot; } public void setDdo_codmot(String newDdo_codmot) { ddo_codmot = newDdo_codmot; } public String getDdo_codofiactual() { return ddo_codofiactual; } public void setDdo_codofiactual(String newDdo_codofiactual) { ddo_codofiactual = newDdo_codofiactual; } public String getDdo_codubiactual() { return ddo_codubiactual; } public void setDdo_codubiactual(String newDdo_codubiactual) { ddo_codubiactual = newDdo_codubiactual; } public String getMes() { return mes; } public void setMes(String newMes) { mes = newMes; } public String getAnio() { return anio; } public void setAnio(String newAnio) { anio = newAnio; } public String getDoc_ofiorinombre() { return doc_ofiorinombre; } public void setDoc_ofiorinombre(String newDoc_ofiorinombre) { doc_ofiorinombre = newDoc_ofiorinombre; } public String getDoc_ofidesnombre() { return doc_ofidesnombre; } public void setDoc_ofidesnombre(String newDoc_ofidesnombre) { doc_ofidesnombre = newDoc_ofidesnombre; } public String getDoc_carorinombre() { return doc_carorinombre; } public void setDoc_carorinombre(String newDoc_carorinombre) { doc_carorinombre = newDoc_carorinombre; } public String getDoc_cardesnombre() { return doc_cardesnombre; } public void setDoc_cardesnombre(String newDoc_cardesnombre) { doc_cardesnombre = newDoc_cardesnombre; } public String getCte_tipdocentrega() { return cte_tipdocentrega; } public void setCte_tipdocentrega(String newCte_tipdocentrega) { cte_tipdocentrega = newCte_tipdocentrega; } public String getCte_tipdocdevolucion() { return cte_tipdocdevolucion; } public void setCte_tipdocdevolucion(String newCte_tipdocdevolucion) { cte_tipdocdevolucion = newCte_tipdocdevolucion; } public String getCte_tipdoctransferencia() { return cte_tipdoctransferencia; } public void setCte_tipdoctransferencia(String newCte_tipdoctransferencia) { cte_tipdoctransferencia = newCte_tipdoctransferencia; } public String getCte_tipdocbaja() { return cte_tipdocbaja; } public void setCte_tipdocbaja(String newCte_tipdocbaja) { cte_tipdocbaja = newCte_tipdocbaja; } public String getDoc_glosa() { return doc_glosa; } public void setDoc_glosa(String newDoc_glosa) { doc_glosa = newDoc_glosa; } public String getUsuario() { return usuario; } public void setUsuario(String newUsuario) { usuario = newUsuario; } public int getInicio() { return inicio; } public void setInicio(int newInicio) { inicio = newInicio; } public int getFin() { return fin; } public void setFin(int newFin) { fin = newFin; } public String getConfirmados() { return confirmados; } public void setConfirmados(String newConfirmados) { confirmados = newConfirmados; } public String getGestionant() { return gestionant; } public void setGestionant(String newGestionant) { gestionant = newGestionant; } public String getDesactivo() { return desactivo; } public void setDesactivo(String newDesactivo) { desactivo = newDesactivo; } public String getDesbaja() { return desbaja; } public void setDesbaja(String newDesbaja) { desbaja = newDesbaja; } public String getDesofi() { return desofi; } public void setDesofi(String newDesofi) { desofi = newDesofi; } }<file_sep>package ActivosFijos; import org.apache.struts.action.Action; import org.apache.struts.action.ActionForm; import org.apache.struts.action.ActionForward; import org.apache.struts.action.ActionMapping; import org.apache.struts.action.ActionMessage; import org.apache.struts.action.ActionMessages; import org.apache.struts.action.ActionError; import org.apache.struts.action.ActionErrors; import java.io.IOException; import javax.servlet.ServletException; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import java.util.ArrayList; public class FuncionariosAction extends Action { /** * This is the main action called from the Struts framework. * @param mapping The ActionMapping used to select this instance. * @param form The optional ActionForm bean for this request. * @param request The HTTP Request we are processing. * @param response The HTTP Response we are processing. */ public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException { ActionMessages error = new ActionMessages(); FuncionariosForm finform = (FuncionariosForm)form; InicioForm fInicio = (InicioForm) request.getSession().getAttribute("InicioForm"); //finform.setFun_codreg(fInicio.getCod_reg()); //finform.setDescripcion_codreg(fInicio.getRegional()); //finform.setFun_codfin(fInicio.getCod_fin()); String usuario = fInicio.getNombreUsuario(); BDConection bdc = new BDConection(); ArrayList aCalm; ArrayList aCalm2; ArrayList aCalm3; ArrayList aCalm4; ArrayList aCalm5; if (!(fInicio.getNombreUsuario().equals("SALIO"))) { int it = finform.getFila(); try { aCalm = bdc.listarFuncionariosf(1,fInicio.getCod_reg(),fInicio.getCod_fin()); request.setAttribute("FuncionariosLista", aCalm); //aCalm2 = bdc.listarOficinas(0,fInicio.getCod_reg()); aCalm2 = bdc.listarOficinas(0,fInicio.getCod_reg()); request.setAttribute("OficinasLista", aCalm2); aCalm5 = bdc.listarOficinas1(fInicio.getCod_reg()); request.setAttribute("OficinasLista1", aCalm5); aCalm3 = bdc.listarRegionales(0); request.setAttribute("RegionalesLista", aCalm3); aCalm4 = bdc.listarFinanciadores(0); request.setAttribute("FinanciadoresLista", aCalm4); ArrayList datos = (ArrayList) request.getAttribute("FuncionariosLista"); if (finform.getOperacion()==1) { FuncionariosDetalleForm d = new FuncionariosDetalleForm(); d = (FuncionariosDetalleForm) datos.get(it); finform.setFun_codigo(d.getCodigo()); finform.setFun_descripcion(d.getDescripcion()); finform.setFun_cargo(d.getCargo()); finform.setFun_codofi(d.getCodofi()); finform.setFun_codreg(d.getCodreg()); finform.setFun_codfin(d.getCodfin()); finform.setFun_correo(d.getCorreo()); finform.setFun_estado(d.getEstado()); finform.setDescripcion_codreg(d.getDescripcion_codreg()); finform.setDescripcion_codofi(d.getDescripcion_codofi()); finform.setDescripcion_codfin(d.getDescripcion_codfin()); } if (finform.getOperacion()==2) { try { if (!finform.getBoton().equals("Cancelar")) { String msgsql=null; msgsql = bdc.insertarfuncionarios(finform.getFun_codigo(),finform.getFun_descripcion(),finform.getFun_cargo(),finform.getFun_codofi(),finform.getFun_codreg(),fInicio.getTxt_usu(),finform.getOpcion(),finform.getFun_codfin(),finform.getFun_correo(),finform.getFun_estado()); finform.setFun_codigo(""); finform.setFun_descripcion(""); finform.setFun_cargo(""); finform.setFun_codofi(""); finform.setFun_codreg(""); finform.setFun_codfin(""); finform.setFun_correo(""); finform.setFun_estado(""); if (!msgsql.equals("0")) { error.add("error", new ActionMessage("error", msgsql)); saveErrors( request, error ); } else { error.add("error", new ActionMessage("error", "La transacción fue realizada correctamente")); saveErrors( request, error ); } } else { finform.setFun_codigo(""); finform.setFun_descripcion(""); finform.setFun_cargo(""); finform.setFun_codofi(""); finform.setFun_codreg(""); finform.setFun_codfin(""); finform.setFun_correo(""); finform.setFun_estado(""); } try { aCalm = bdc.listarFuncionariosf(1,fInicio.getCod_reg(),fInicio.getCod_fin()); request.setAttribute("FuncionariosLista", aCalm); aCalm2 = bdc.listarOficinas(0,finform.getFun_codreg()); request.setAttribute("OficinasLista", aCalm2); aCalm5 = bdc.listarOficinas1(finform.getFun_codreg()); request.setAttribute("OficinasLista1", aCalm5); aCalm3 = bdc.listarRegionales(0); request.setAttribute("RegionalesLista", aCalm3); aCalm4 = bdc.listarFinanciadores(0); request.setAttribute("FinanciadoresLista", aCalm4); } catch (Exception e) { error.add("error", new ActionMessage("errordb", "No se pudo iniciar Funcionarios")); error.add("error", new ActionMessage("errordb", e.toString() )); e.printStackTrace(); saveErrors( request, error ); } } catch (Exception e) { error.add("error", new ActionMessage("errordb", "No se pudo realizar la transaccion.")); error.add("error", new ActionMessage("errordb", e.toString() )); e.printStackTrace(); saveErrors( request, error ); } } } catch (Exception e) { error.add("error", new ActionMessage("errordb", "No se pudo iniciar Funcionarios")); error.add("error", new ActionMessage("errordb", e.toString() )); e.printStackTrace(); saveErrors( request, error ); } } return mapping.findForward("volver"); } }<file_sep>package ActivosFijos; import org.apache.struts.action.Action; import org.apache.struts.action.ActionForm; import org.apache.struts.action.ActionForward; import org.apache.struts.action.ActionMapping; import org.apache.struts.action.ActionMessage; import org.apache.struts.action.ActionMessages; import org.apache.struts.action.ActionError; import org.apache.struts.action.ActionErrors; import java.io.IOException; import javax.servlet.ServletException; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import java.util.ArrayList; public class InventariosAction extends Action { /** * This is the main action called from the Struts framework. * @param mapping The ActionMapping used to select this instance. * @param form The optional ActionForm bean for this request. * @param request The HTTP Request we are processing. * @param response The HTTP Response we are processing. */ public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException { ActionMessages error = new ActionMessages(); InventariosForm finform = (InventariosForm)form; InicioForm fInicio = (InicioForm) request.getSession().getAttribute("InicioForm"); finform.setInv_codreg(fInicio.getCod_reg()); finform.setInv_regdescripcion(fInicio.getRegional()); finform.setInv_codfin(fInicio.getCod_fin()); finform.setInv_findescripcion(fInicio.getFinanciador()); String usuario = fInicio.getNombreUsuario(); BDConection bdc = new BDConection(); ArrayList aCalm; ArrayList aCalm2; ArrayList aCalm5; ArrayList aCalm6; ArrayList aCalm8; ArrayList aCalm9; ArrayList aCalm12; if (!(fInicio.getNombreUsuario().equals("SALIO"))) { int it = finform.getFila(); try { aCalm5 = bdc.listarOficinas(0,fInicio.getCod_reg()); request.setAttribute("OficinasLista", aCalm5); aCalm6 = bdc.listarFuncionarios(0,fInicio.getCod_reg()); request.setAttribute("FuncionariosLista", aCalm6); aCalm8 = bdc.listarFinanciadores(0); request.setAttribute("FinanciadoresLista", aCalm8); aCalm9 = bdc.listarProyectos(0); request.setAttribute("ProyectosLista", aCalm9); aCalm2 = bdc.listarRegionales(0); request.setAttribute("RegionalesLista", aCalm2); aCalm12 = bdc.listarEstados(); request.setAttribute("EstadosLista", aCalm12); aCalm = bdc.listarInventarios(fInicio.getCod_reg(),1); request.setAttribute("InventariosLista", aCalm); ArrayList datos = (ArrayList) request.getAttribute("InventariosLista"); if (finform.getOperacion()==1) { InventariosDetalleForm d = new InventariosDetalleForm(); d = (InventariosDetalleForm) datos.get(it); finform.setInv_codbarrad(d.getCodbarrad()); finform.setInv_codbarra(d.getCodbarra()); finform.setInv_fecha(d.getFecha()); finform.setInv_codofi(d.getCodofi()); finform.setInv_codfun(d.getCodfun()); finform.setInv_codubi(d.getCodubi()); finform.setInv_codfin(d.getCodfin()); finform.setInv_codpry(d.getCodpry()); finform.setInv_codreg(d.getCodreg()); finform.setInv_estado(d.getEstado()); finform.setInv_mod(d.getMod()); } if (finform.getOperacion()==2) { try { if (!finform.getBoton().equals("Cancelar")) { if (finform.getOpcion()!=6) { String msgsql=null; msgsql = bdc.insertarinventarios( finform.getInv_codbarra(), finform.getInv_fecha(), finform.getInv_codofi(), finform.getInv_codfun(), finform.getInv_codubi(), finform.getInv_codfin(), finform.getInv_codpry(), finform.getInv_codreg(), finform.getInv_estado(), fInicio.getTxt_usu(), finform.getInv_mod(), finform.getOpcion() ); finform.setInv_codbarra(""); finform.setInv_fecha(""); finform.setInv_codofi(""); finform.setInv_codfun(""); finform.setInv_codubi(""); finform.setInv_codfin(""); finform.setInv_codpry(""); finform.setInv_codreg(""); finform.setInv_estado(""); finform.setInv_mod(""); if (!msgsql.equals("0")) { error.add("error", new ActionMessage("error", msgsql)); saveErrors( request, error ); } else { error.add("error", new ActionMessage("error", "La transacción fue realizada correctamente")); saveErrors( request, error ); } } else { String msgsql=null; msgsql = bdc.generarinventarios(fInicio.getCod_reg(),fInicio.getCod_fin(),fInicio.getTxt_usu(),finform.getActas()); error.add("error", new ActionMessage("error", msgsql)); saveErrors( request, error ); } } else { finform.setInv_codbarra(""); finform.setInv_fecha(""); finform.setInv_codofi(""); finform.setInv_codfun(""); finform.setInv_codubi(""); finform.setInv_codfin(""); finform.setInv_codpry(""); finform.setInv_codreg(""); finform.setInv_estado(""); finform.setInv_mod(""); } try { aCalm = bdc.listarInventarios(fInicio.getCod_reg(),1); request.setAttribute("InventariosLista", aCalm); } catch (Exception e) { error.add("error", new ActionMessage("errordb", "No se pudo iniciar Inventarios")); error.add("error", new ActionMessage("errordb", e.toString() )); e.printStackTrace(); saveErrors( request, error ); } } catch (Exception e) { error.add("error", new ActionMessage("errordb", "No se pudo realizar la transaccion.")); error.add("error", new ActionMessage("errordb", e.toString() )); e.printStackTrace(); saveErrors( request, error ); } } } catch (Exception e) { error.add("error", new ActionMessage("errordb", "No se pudo iniciar Inventarios")); error.add("error", new ActionMessage("errordb", e.toString() )); e.printStackTrace(); saveErrors( request, error ); } } return mapping.findForward("volver"); } }<file_sep>package ActivosFijos; import org.apache.struts.action.ActionForm; import org.apache.struts.action.ActionErrors; import org.apache.struts.action.ActionError; import org.apache.struts.action.ActionMapping; import javax.servlet.http.HttpServletRequest; public class InventariosDetalleForm extends ActionForm { String codbarra; String fecha; String codofi; String codfun; String codubi; String codfin; String codpry; String codreg; String estado; String mod; String codbarrad; String codfindes; String codfundes; String codofides; String codprydes; String codregdes; String codubides; String estadodes; /** * Reset all properties to their default values. * @param mapping The ActionMapping used to select this instance. * @param request The HTTP Request we are processing. */ public void reset(ActionMapping mapping, HttpServletRequest request) { super.reset(mapping, request); } /** * Validate all properties to their default values. * @param mapping The ActionMapping used to select this instance. * @param request The HTTP Request we are processing. * @return ActionErrors A list of all errors found. */ public ActionErrors validate(ActionMapping mapping, HttpServletRequest request) { return super.validate(mapping, request); } public String getCodbarra() { return codbarra; } public void setCodbarra(String newCodbarra) { codbarra = newCodbarra; } public String getFecha() { return fecha; } public void setFecha(String newFecha) { fecha = newFecha; } public String getCodofi() { return codofi; } public void setCodofi(String newCodofi) { codofi = newCodofi; } public String getCodfun() { return codfun; } public void setCodfun(String newCodfun) { codfun = newCodfun; } public String getCodubi() { return codubi; } public void setCodubi(String newCodubi) { codubi = newCodubi; } public String getCodfin() { return codfin; } public void setCodfin(String newCodfin) { codfin = newCodfin; } public String getCodpry() { return codpry; } public void setCodpry(String newCodpry) { codpry = newCodpry; } public String getCodreg() { return codreg; } public void setCodreg(String newCodreg) { codreg = newCodreg; } public String getEstado() { return estado; } public void setEstado(String newEstado) { estado = newEstado; } public String getMod() { return mod; } public void setMod(String newMod) { mod = newMod; } public String getCodbarrad() { return codbarrad; } public void setCodbarrad(String newCodbarrad) { codbarrad = newCodbarrad; } public String getCodfindes() { return codfindes; } public void setCodfindes(String newCodfindes) { codfindes = newCodfindes; } public String getCodfundes() { return codfundes; } public void setCodfundes(String newCodfundes) { codfundes = newCodfundes; } public String getCodofides() { return codofides; } public void setCodofides(String newCodofides) { codofides = newCodofides; } public String getCodprydes() { return codprydes; } public void setCodprydes(String newCodprydes) { codprydes = newCodprydes; } public String getCodregdes() { return codregdes; } public void setCodregdes(String newCodregdes) { codregdes = newCodregdes; } public String getCodubides() { return codubides; } public void setCodubides(String newCodubides) { codubides = newCodubides; } public String getEstadodes() { return estadodes; } public void setEstadodes(String newEstadodes) { estadodes = newEstadodes; } }<file_sep>package ActivosFijos; import org.apache.struts.action.Action; import org.apache.struts.action.ActionForm; import org.apache.struts.action.ActionForward; import org.apache.struts.action.ActionMapping; import org.apache.struts.action.ActionError; import org.apache.struts.action.ActionErrors; import java.io.IOException; import javax.servlet.ServletException; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.apache.struts.action.ActionMessage; import org.apache.struts.action.ActionMessages; import java.util.ArrayList; public class MejorasRebajas extends Action { /** * This is the main action called from the Struts framework. * @param mapping The ActionMapping used to select this instance. * @param form The optional ActionForm bean for this request. * @param request The HTTP Request we are processing. * @param response The HTTP Response we are processing. */ public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException { ActionMessages error = new ActionMessages(); MejorasRebajasForm opform = (MejorasRebajasForm) form; InicioForm fInicio = (InicioForm) request.getSession().getAttribute("InicioForm"); opform.setMre_codreg(fInicio.getCod_reg()); opform.setMre_regdescripcion(fInicio.getRegional()); BDConection bdc = new BDConection(); try { MesAnioDetalleForm mesanio = bdc.listarMesAnio(); opform.setMes(mesanio.getMes()); opform.setAnio(mesanio.getAnio()); opform.setOperacion(0); ArrayList aCalm = bdc.listarRubros(0); request.setAttribute("RubrosLista", aCalm); ArrayList aCalm2 = bdc.listarRegionales(0); request.setAttribute("RegionalesLista", aCalm2); ArrayList aCalm3 = bdc.listarGrupos(0,opform.getMre_codrub()); request.setAttribute("GruposLista", aCalm3); if (mapping.getParameter().equals("ins")) { opform.setOpcion(1); opform.setOperacion(2); } if (mapping.getParameter().equals("mod")) { opform.setOpcion(2); opform.setOperacion(2); } if (mapping.getParameter().equals("eli")) { opform.setOpcion(3); opform.setOperacion(2); } } catch (Exception e) { error.add("error", new ActionMessage("errordb", "No se pudo iniciar MejorasRebajas")); error.add("error", new ActionMessage("errordb", e.toString() )); e.printStackTrace(); saveErrors( request, error ); } return mapping.findForward("mejorasrebajas"); } }<file_sep>package Paquete; public class ClaseUsuario { private String usuario; private String nit; private String aduana; private String aux; private String sistema; private String perfil; private ClaseOpcion[] lopcion; public ClaseUsuario() { } public String getUsuario() { return usuario; } public void setUsuario(String newUsuario) { usuario = newUsuario; } public String getNit() { return nit; } public void setNit(String newNit) { nit = newNit; } public String getAduana() { return aduana; } public void setAduana(String newAduana) { aduana = newAduana; } public String getAux() { return aux; } public void setAux(String newAux) { aux = newAux; } public String getSistema() { return sistema; } public void setSistema(String newSistema) { sistema = newSistema; } public String getPerfil() { return perfil; } public void setPerfil(String newPerfil) { perfil = newPerfil; } public ClaseOpcion[] getLopcion() { return lopcion; } public ClaseOpcion getLopcion( int index ) { return lopcion[ index ]; } public void setLopcion( ClaseOpcion[] newLopcion ) { lopcion = newLopcion; } public void setLopcion( ClaseOpcion newLopcion, int i ) { lopcion[i] = newLopcion; } public void setLopcion( int i ) { lopcion = new ClaseOpcion[ i ]; } }<file_sep> /*@lineinfo:filename=/Activos1.jsp*/ /*@lineinfo:generated-code*/ import oracle.jsp.runtime.*; import javax.servlet.*; import javax.servlet.http.*; import javax.servlet.jsp.*; import java.util.Vector; import ActivosFijos.*; public class _Activos1 extends oracle.jsp.runtime.HttpJsp { public final String _globalsClassName = null; // ** Begin Declarations // ** End Declarations public void _jspService(HttpServletRequest request, HttpServletResponse response) throws java.io.IOException, ServletException { response.setContentType( "text/html;charset=windows-1252"); /* set up the intrinsic variables using the pageContext goober: ** session = HttpSession ** application = ServletContext ** out = JspWriter ** page = this ** config = ServletConfig ** all session/app beans declared in globals.jsa */ PageContext pageContext = JspFactory.getDefaultFactory().getPageContext( this, request, response, null, true, JspWriter.DEFAULT_BUFFER, true); // Note: this is not emitted if the session directive == false HttpSession session = pageContext.getSession(); if (pageContext.getAttribute(OracleJspRuntime.JSP_REQUEST_REDIRECTED, PageContext.REQUEST_SCOPE) != null) { pageContext.setAttribute(OracleJspRuntime.JSP_PAGE_DONTNOTIFY, "true", PageContext.PAGE_SCOPE); JspFactory.getDefaultFactory().releasePageContext(pageContext); return; } int __jsp_tag_starteval; ServletContext application = pageContext.getServletContext(); JspWriter out = pageContext.getOut(); _Activos1 page = this; ServletConfig config = pageContext.getServletConfig(); try { // global beans // end global beans out.write(__jsp_StaticText.text[0]); out.write(__jsp_StaticText.text[1]); out.write(__jsp_StaticText.text[2]); out.write(__jsp_StaticText.text[3]); out.write(__jsp_StaticText.text[4]); /*@lineinfo:translated-code*//*@lineinfo:25^1*/ { org.apache.struts.taglib.html.FormTag __jsp_taghandler_1=(org.apache.struts.taglib.html.FormTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.FormTag.class,"org.apache.struts.taglib.html.FormTag action onsubmit"); __jsp_taghandler_1.setParent(null); __jsp_taghandler_1.setAction("/activosAction"); __jsp_taghandler_1.setOnsubmit("return validar1(this)"); __jsp_tag_starteval=__jsp_taghandler_1.doStartTag(); if (OracleJspRuntime.checkStartTagEval(__jsp_tag_starteval)) { do { /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[5]); /*@lineinfo:translated-code*//*@lineinfo:27^1*/ { org.apache.struts.taglib.html.HiddenTag __jsp_taghandler_2=(org.apache.struts.taglib.html.HiddenTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.HiddenTag.class,"org.apache.struts.taglib.html.HiddenTag property"); __jsp_taghandler_2.setParent(__jsp_taghandler_1); __jsp_taghandler_2.setProperty("operacion"); __jsp_tag_starteval=__jsp_taghandler_2.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_2,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_2.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_2.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_2); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[6]); /*@lineinfo:translated-code*//*@lineinfo:28^1*/ { org.apache.struts.taglib.html.HiddenTag __jsp_taghandler_3=(org.apache.struts.taglib.html.HiddenTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.HiddenTag.class,"org.apache.struts.taglib.html.HiddenTag property"); __jsp_taghandler_3.setParent(__jsp_taghandler_1); __jsp_taghandler_3.setProperty("opcion"); __jsp_tag_starteval=__jsp_taghandler_3.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_3,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_3.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_3.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_3); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[7]); /*@lineinfo:translated-code*//*@lineinfo:29^1*/ { org.apache.struts.taglib.logic.EqualTag __jsp_taghandler_4=(org.apache.struts.taglib.logic.EqualTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.logic.EqualTag.class,"org.apache.struts.taglib.logic.EqualTag name property value"); __jsp_taghandler_4.setParent(__jsp_taghandler_1); __jsp_taghandler_4.setName("ActivosForm"); __jsp_taghandler_4.setProperty("operacion"); __jsp_taghandler_4.setValue("1"); __jsp_tag_starteval=__jsp_taghandler_4.doStartTag(); if (OracleJspRuntime.checkStartTagEval(__jsp_tag_starteval)) { do { /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[8]); /*@lineinfo:translated-code*//*@lineinfo:30^4*/ { org.apache.struts.taglib.html.HiddenTag __jsp_taghandler_5=(org.apache.struts.taglib.html.HiddenTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.HiddenTag.class,"org.apache.struts.taglib.html.HiddenTag name property"); __jsp_taghandler_5.setParent(__jsp_taghandler_4); __jsp_taghandler_5.setName("ActivosForm"); __jsp_taghandler_5.setProperty("act_codpar"); __jsp_tag_starteval=__jsp_taghandler_5.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_5,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_5.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_5.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_5); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[9]); /*@lineinfo:translated-code*//*@lineinfo:31^4*/ { org.apache.struts.taglib.html.HiddenTag __jsp_taghandler_6=(org.apache.struts.taglib.html.HiddenTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.HiddenTag.class,"org.apache.struts.taglib.html.HiddenTag name property"); __jsp_taghandler_6.setParent(__jsp_taghandler_4); __jsp_taghandler_6.setName("ActivosForm"); __jsp_taghandler_6.setProperty("act_codofi"); __jsp_tag_starteval=__jsp_taghandler_6.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_6,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_6.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_6.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_6); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[10]); /*@lineinfo:translated-code*//*@lineinfo:32^4*/ { org.apache.struts.taglib.html.HiddenTag __jsp_taghandler_7=(org.apache.struts.taglib.html.HiddenTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.HiddenTag.class,"org.apache.struts.taglib.html.HiddenTag name property"); __jsp_taghandler_7.setParent(__jsp_taghandler_4); __jsp_taghandler_7.setName("ActivosForm"); __jsp_taghandler_7.setProperty("act_codfun"); __jsp_tag_starteval=__jsp_taghandler_7.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_7,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_7.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_7.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_7); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[11]); /*@lineinfo:translated-code*//*@lineinfo:33^4*/ { org.apache.struts.taglib.html.HiddenTag __jsp_taghandler_8=(org.apache.struts.taglib.html.HiddenTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.HiddenTag.class,"org.apache.struts.taglib.html.HiddenTag name property"); __jsp_taghandler_8.setParent(__jsp_taghandler_4); __jsp_taghandler_8.setName("ActivosForm"); __jsp_taghandler_8.setProperty("act_codfin"); __jsp_tag_starteval=__jsp_taghandler_8.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_8,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_8.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_8.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_8); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[12]); /*@lineinfo:translated-code*//*@lineinfo:34^4*/ { org.apache.struts.taglib.html.HiddenTag __jsp_taghandler_9=(org.apache.struts.taglib.html.HiddenTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.HiddenTag.class,"org.apache.struts.taglib.html.HiddenTag name property"); __jsp_taghandler_9.setParent(__jsp_taghandler_4); __jsp_taghandler_9.setName("ActivosForm"); __jsp_taghandler_9.setProperty("act_codmot"); __jsp_tag_starteval=__jsp_taghandler_9.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_9,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_9.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_9.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_9); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[13]); /*@lineinfo:translated-code*//*@lineinfo:35^4*/ { org.apache.struts.taglib.html.HiddenTag __jsp_taghandler_10=(org.apache.struts.taglib.html.HiddenTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.HiddenTag.class,"org.apache.struts.taglib.html.HiddenTag name property"); __jsp_taghandler_10.setParent(__jsp_taghandler_4); __jsp_taghandler_10.setName("ActivosForm"); __jsp_taghandler_10.setProperty("act_tipcam"); __jsp_tag_starteval=__jsp_taghandler_10.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_10,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_10.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_10.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_10); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[14]); /*@lineinfo:translated-code*//*@lineinfo:36^4*/ { org.apache.struts.taglib.html.HiddenTag __jsp_taghandler_11=(org.apache.struts.taglib.html.HiddenTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.HiddenTag.class,"org.apache.struts.taglib.html.HiddenTag name property"); __jsp_taghandler_11.setParent(__jsp_taghandler_4); __jsp_taghandler_11.setName("ActivosForm"); __jsp_taghandler_11.setProperty("act_tipufv"); __jsp_tag_starteval=__jsp_taghandler_11.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_11,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_11.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_11.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_11); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[15]); /*@lineinfo:translated-code*//*@lineinfo:37^4*/ { org.apache.struts.taglib.html.HiddenTag __jsp_taghandler_12=(org.apache.struts.taglib.html.HiddenTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.HiddenTag.class,"org.apache.struts.taglib.html.HiddenTag name property"); __jsp_taghandler_12.setParent(__jsp_taghandler_4); __jsp_taghandler_12.setName("ActivosForm"); __jsp_taghandler_12.setProperty("act_marca"); __jsp_tag_starteval=__jsp_taghandler_12.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_12,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_12.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_12.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_12); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[16]); /*@lineinfo:translated-code*//*@lineinfo:38^4*/ { org.apache.struts.taglib.html.HiddenTag __jsp_taghandler_13=(org.apache.struts.taglib.html.HiddenTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.HiddenTag.class,"org.apache.struts.taglib.html.HiddenTag name property"); __jsp_taghandler_13.setParent(__jsp_taghandler_4); __jsp_taghandler_13.setName("ActivosForm"); __jsp_taghandler_13.setProperty("act_modelo"); __jsp_tag_starteval=__jsp_taghandler_13.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_13,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_13.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_13.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_13); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[17]); /*@lineinfo:translated-code*//*@lineinfo:39^4*/ { org.apache.struts.taglib.html.HiddenTag __jsp_taghandler_14=(org.apache.struts.taglib.html.HiddenTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.HiddenTag.class,"org.apache.struts.taglib.html.HiddenTag name property"); __jsp_taghandler_14.setParent(__jsp_taghandler_4); __jsp_taghandler_14.setName("ActivosForm"); __jsp_taghandler_14.setProperty("act_docrefotro"); __jsp_tag_starteval=__jsp_taghandler_14.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_14,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_14.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_14.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_14); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[18]); /*@lineinfo:translated-code*//*@lineinfo:40^4*/ { org.apache.struts.taglib.html.HiddenTag __jsp_taghandler_15=(org.apache.struts.taglib.html.HiddenTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.HiddenTag.class,"org.apache.struts.taglib.html.HiddenTag name property"); __jsp_taghandler_15.setParent(__jsp_taghandler_4); __jsp_taghandler_15.setName("ActivosForm"); __jsp_taghandler_15.setProperty("act_placa"); __jsp_tag_starteval=__jsp_taghandler_15.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_15,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_15.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_15.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_15); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[19]); /*@lineinfo:translated-code*//*@lineinfo:41^4*/ { org.apache.struts.taglib.html.HiddenTag __jsp_taghandler_16=(org.apache.struts.taglib.html.HiddenTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.HiddenTag.class,"org.apache.struts.taglib.html.HiddenTag name property"); __jsp_taghandler_16.setParent(__jsp_taghandler_4); __jsp_taghandler_16.setName("ActivosForm"); __jsp_taghandler_16.setProperty("act_aniofabricacion"); __jsp_tag_starteval=__jsp_taghandler_16.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_16,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_16.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_16.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_16); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[20]); /*@lineinfo:translated-code*//*@lineinfo:42^4*/ { org.apache.struts.taglib.html.HiddenTag __jsp_taghandler_17=(org.apache.struts.taglib.html.HiddenTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.HiddenTag.class,"org.apache.struts.taglib.html.HiddenTag name property"); __jsp_taghandler_17.setParent(__jsp_taghandler_4); __jsp_taghandler_17.setName("ActivosForm"); __jsp_taghandler_17.setProperty("act_color"); __jsp_tag_starteval=__jsp_taghandler_17.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_17,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_17.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_17.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_17); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[21]); /*@lineinfo:translated-code*//*@lineinfo:43^4*/ { org.apache.struts.taglib.html.HiddenTag __jsp_taghandler_18=(org.apache.struts.taglib.html.HiddenTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.HiddenTag.class,"org.apache.struts.taglib.html.HiddenTag name property"); __jsp_taghandler_18.setParent(__jsp_taghandler_4); __jsp_taghandler_18.setName("ActivosForm"); __jsp_taghandler_18.setProperty("act_valcodol"); __jsp_tag_starteval=__jsp_taghandler_18.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_18,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_18.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_18.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_18); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[22]); /*@lineinfo:translated-code*//*@lineinfo:44^4*/ { org.apache.struts.taglib.html.HiddenTag __jsp_taghandler_19=(org.apache.struts.taglib.html.HiddenTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.HiddenTag.class,"org.apache.struts.taglib.html.HiddenTag name property"); __jsp_taghandler_19.setParent(__jsp_taghandler_4); __jsp_taghandler_19.setName("ActivosForm"); __jsp_taghandler_19.setProperty("act_valcoufv"); __jsp_tag_starteval=__jsp_taghandler_19.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_19,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_19.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_19.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_19); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[23]); /*@lineinfo:translated-code*//*@lineinfo:45^4*/ { org.apache.struts.taglib.html.HiddenTag __jsp_taghandler_20=(org.apache.struts.taglib.html.HiddenTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.HiddenTag.class,"org.apache.struts.taglib.html.HiddenTag name property"); __jsp_taghandler_20.setParent(__jsp_taghandler_4); __jsp_taghandler_20.setName("ActivosForm"); __jsp_taghandler_20.setProperty("act_fecbaja"); __jsp_tag_starteval=__jsp_taghandler_20.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_20,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_20.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_20.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_20); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[24]); /*@lineinfo:translated-code*//*@lineinfo:46^4*/ { org.apache.struts.taglib.html.HiddenTag __jsp_taghandler_21=(org.apache.struts.taglib.html.HiddenTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.HiddenTag.class,"org.apache.struts.taglib.html.HiddenTag name property"); __jsp_taghandler_21.setParent(__jsp_taghandler_4); __jsp_taghandler_21.setName("ActivosForm"); __jsp_taghandler_21.setProperty("act_indetiqueta"); __jsp_tag_starteval=__jsp_taghandler_21.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_21,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_21.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_21.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_21); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[25]); /*@lineinfo:translated-code*//*@lineinfo:47^4*/ { org.apache.struts.taglib.logic.EqualTag __jsp_taghandler_22=(org.apache.struts.taglib.logic.EqualTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.logic.EqualTag.class,"org.apache.struts.taglib.logic.EqualTag name property value"); __jsp_taghandler_22.setParent(__jsp_taghandler_4); __jsp_taghandler_22.setName("ActivosForm"); __jsp_taghandler_22.setProperty("opcion"); __jsp_taghandler_22.setValue("1"); __jsp_tag_starteval=__jsp_taghandler_22.doStartTag(); if (OracleJspRuntime.checkStartTagEval(__jsp_tag_starteval)) { do { /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[26]); /*@lineinfo:translated-code*//*@lineinfo:50^27*/ { org.apache.struts.taglib.bean.MessageTag __jsp_taghandler_23=(org.apache.struts.taglib.bean.MessageTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.bean.MessageTag.class,"org.apache.struts.taglib.bean.MessageTag key"); __jsp_taghandler_23.setParent(__jsp_taghandler_22); __jsp_taghandler_23.setKey("activos1.codrub"); __jsp_tag_starteval=__jsp_taghandler_23.doStartTag(); if (OracleJspRuntime.checkStartTagEval(__jsp_tag_starteval)) { do { } while (__jsp_taghandler_23.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); } if (__jsp_taghandler_23.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_23); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[27]); /*@lineinfo:translated-code*//*@lineinfo:51^26*/ { org.apache.struts.taglib.html.TextTag __jsp_taghandler_24=(org.apache.struts.taglib.html.TextTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.TextTag.class,"org.apache.struts.taglib.html.TextTag maxlength name onkeypress property readonly size"); __jsp_taghandler_24.setParent(__jsp_taghandler_22); __jsp_taghandler_24.setMaxlength("10"); __jsp_taghandler_24.setName("ActivosForm"); __jsp_taghandler_24.setOnkeypress("return handleEnter(this, event)"); __jsp_taghandler_24.setProperty("act_codrub"); __jsp_taghandler_24.setReadonly(true); __jsp_taghandler_24.setSize("10"); __jsp_tag_starteval=__jsp_taghandler_24.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_24,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_24.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_24.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_24); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[28]); /*@lineinfo:translated-code*//*@lineinfo:52^10*/ { org.apache.struts.taglib.html.TextTag __jsp_taghandler_25=(org.apache.struts.taglib.html.TextTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.TextTag.class,"org.apache.struts.taglib.html.TextTag maxlength name onkeypress property readonly size"); __jsp_taghandler_25.setParent(__jsp_taghandler_22); __jsp_taghandler_25.setMaxlength("60"); __jsp_taghandler_25.setName("ActivosForm"); __jsp_taghandler_25.setOnkeypress("return handleEnter(this, event)"); __jsp_taghandler_25.setProperty("act_rubdescripcion"); __jsp_taghandler_25.setReadonly(true); __jsp_taghandler_25.setSize("60"); __jsp_tag_starteval=__jsp_taghandler_25.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_25,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_25.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_25.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_25); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[29]); /*@lineinfo:translated-code*//*@lineinfo:55^27*/ { org.apache.struts.taglib.bean.MessageTag __jsp_taghandler_26=(org.apache.struts.taglib.bean.MessageTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.bean.MessageTag.class,"org.apache.struts.taglib.bean.MessageTag key"); __jsp_taghandler_26.setParent(__jsp_taghandler_22); __jsp_taghandler_26.setKey("activos1.codreg"); __jsp_tag_starteval=__jsp_taghandler_26.doStartTag(); if (OracleJspRuntime.checkStartTagEval(__jsp_tag_starteval)) { do { } while (__jsp_taghandler_26.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); } if (__jsp_taghandler_26.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_26); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[30]); /*@lineinfo:translated-code*//*@lineinfo:56^26*/ { org.apache.struts.taglib.html.TextTag __jsp_taghandler_27=(org.apache.struts.taglib.html.TextTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.TextTag.class,"org.apache.struts.taglib.html.TextTag maxlength name onkeypress property readonly size"); __jsp_taghandler_27.setParent(__jsp_taghandler_22); __jsp_taghandler_27.setMaxlength("10"); __jsp_taghandler_27.setName("ActivosForm"); __jsp_taghandler_27.setOnkeypress("return handleEnter(this, event)"); __jsp_taghandler_27.setProperty("act_codreg"); __jsp_taghandler_27.setReadonly(true); __jsp_taghandler_27.setSize("10"); __jsp_tag_starteval=__jsp_taghandler_27.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_27,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_27.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_27.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_27); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[31]); /*@lineinfo:translated-code*//*@lineinfo:57^10*/ { org.apache.struts.taglib.html.TextTag __jsp_taghandler_28=(org.apache.struts.taglib.html.TextTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.TextTag.class,"org.apache.struts.taglib.html.TextTag maxlength name onkeypress property readonly size"); __jsp_taghandler_28.setParent(__jsp_taghandler_22); __jsp_taghandler_28.setMaxlength("60"); __jsp_taghandler_28.setName("ActivosForm"); __jsp_taghandler_28.setOnkeypress("return handleEnter(this, event)"); __jsp_taghandler_28.setProperty("act_regdescripcion"); __jsp_taghandler_28.setReadonly(true); __jsp_taghandler_28.setSize("60"); __jsp_tag_starteval=__jsp_taghandler_28.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_28,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_28.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_28.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_28); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[32]); /*@lineinfo:translated-code*//*@lineinfo:60^27*/ { org.apache.struts.taglib.bean.MessageTag __jsp_taghandler_29=(org.apache.struts.taglib.bean.MessageTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.bean.MessageTag.class,"org.apache.struts.taglib.bean.MessageTag key"); __jsp_taghandler_29.setParent(__jsp_taghandler_22); __jsp_taghandler_29.setKey("activos1.codigo"); __jsp_tag_starteval=__jsp_taghandler_29.doStartTag(); if (OracleJspRuntime.checkStartTagEval(__jsp_tag_starteval)) { do { } while (__jsp_taghandler_29.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); } if (__jsp_taghandler_29.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_29); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[33]); /*@lineinfo:translated-code*//*@lineinfo:61^26*/ { org.apache.struts.taglib.html.TextTag __jsp_taghandler_30=(org.apache.struts.taglib.html.TextTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.TextTag.class,"org.apache.struts.taglib.html.TextTag maxlength name onkeypress property readonly size"); __jsp_taghandler_30.setParent(__jsp_taghandler_22); __jsp_taghandler_30.setMaxlength("5"); __jsp_taghandler_30.setName("ActivosForm"); __jsp_taghandler_30.setOnkeypress("return handleEnter(this, event)"); __jsp_taghandler_30.setProperty("act_codigo"); __jsp_taghandler_30.setReadonly(true); __jsp_taghandler_30.setSize("5"); __jsp_tag_starteval=__jsp_taghandler_30.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_30,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_30.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_30.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_30); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[34]); /*@lineinfo:translated-code*//*@lineinfo:62^10*/ { org.apache.struts.taglib.html.TextTag __jsp_taghandler_31=(org.apache.struts.taglib.html.TextTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.TextTag.class,"org.apache.struts.taglib.html.TextTag maxlength name onkeypress property readonly size"); __jsp_taghandler_31.setParent(__jsp_taghandler_22); __jsp_taghandler_31.setMaxlength("10"); __jsp_taghandler_31.setName("ActivosForm"); __jsp_taghandler_31.setOnkeypress("return handleEnter(this, event)"); __jsp_taghandler_31.setProperty("act_codbarra"); __jsp_taghandler_31.setReadonly(true); __jsp_taghandler_31.setSize("10"); __jsp_tag_starteval=__jsp_taghandler_31.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_31,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_31.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_31.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_31); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[35]); /*@lineinfo:translated-code*//*@lineinfo:65^27*/ { org.apache.struts.taglib.bean.MessageTag __jsp_taghandler_32=(org.apache.struts.taglib.bean.MessageTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.bean.MessageTag.class,"org.apache.struts.taglib.bean.MessageTag key"); __jsp_taghandler_32.setParent(__jsp_taghandler_22); __jsp_taghandler_32.setKey("activos1.codgrp"); __jsp_tag_starteval=__jsp_taghandler_32.doStartTag(); if (OracleJspRuntime.checkStartTagEval(__jsp_tag_starteval)) { do { } while (__jsp_taghandler_32.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); } if (__jsp_taghandler_32.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_32); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[36]); /*@lineinfo:translated-code*//*@lineinfo:66^14*/ { org.apache.struts.taglib.html.SelectTag __jsp_taghandler_33=(org.apache.struts.taglib.html.SelectTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.SelectTag.class,"org.apache.struts.taglib.html.SelectTag disabled name onkeypress property"); __jsp_taghandler_33.setParent(__jsp_taghandler_22); __jsp_taghandler_33.setDisabled(false); __jsp_taghandler_33.setName("ActivosForm"); __jsp_taghandler_33.setOnkeypress("return handleEnter(this, event)"); __jsp_taghandler_33.setProperty("act_codgrp"); __jsp_tag_starteval=__jsp_taghandler_33.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_33,__jsp_tag_starteval,out); do { /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[37]); /*@lineinfo:translated-code*//*@lineinfo:67^15*/ { org.apache.struts.taglib.html.OptionsTag __jsp_taghandler_34=(org.apache.struts.taglib.html.OptionsTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.OptionsTag.class,"org.apache.struts.taglib.html.OptionsTag collection labelProperty property"); __jsp_taghandler_34.setParent(__jsp_taghandler_33); __jsp_taghandler_34.setCollection("GruposLista"); __jsp_taghandler_34.setLabelProperty("descripcion"); __jsp_taghandler_34.setProperty("codigo"); __jsp_tag_starteval=__jsp_taghandler_34.doStartTag(); if (OracleJspRuntime.checkStartTagEval(__jsp_tag_starteval)) { do { } while (__jsp_taghandler_34.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); } if (__jsp_taghandler_34.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_34); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[38]); /*@lineinfo:translated-code*//*@lineinfo:67^101*/ } while (__jsp_taghandler_33.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_33.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_33); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[39]); /*@lineinfo:translated-code*//*@lineinfo:69^27*/ { org.apache.struts.taglib.bean.MessageTag __jsp_taghandler_35=(org.apache.struts.taglib.bean.MessageTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.bean.MessageTag.class,"org.apache.struts.taglib.bean.MessageTag key"); __jsp_taghandler_35.setParent(__jsp_taghandler_22); __jsp_taghandler_35.setKey("activos1.codpar"); __jsp_tag_starteval=__jsp_taghandler_35.doStartTag(); if (OracleJspRuntime.checkStartTagEval(__jsp_tag_starteval)) { do { } while (__jsp_taghandler_35.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); } if (__jsp_taghandler_35.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_35); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[40]); /*@lineinfo:translated-code*//*@lineinfo:71^15*/ { org.apache.struts.taglib.html.TextTag __jsp_taghandler_36=(org.apache.struts.taglib.html.TextTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.TextTag.class,"org.apache.struts.taglib.html.TextTag maxlength name onkeypress property readonly size"); __jsp_taghandler_36.setParent(__jsp_taghandler_22); __jsp_taghandler_36.setMaxlength("40"); __jsp_taghandler_36.setName("ActivosForm"); __jsp_taghandler_36.setOnkeypress("return handleEnter(this, event)"); __jsp_taghandler_36.setProperty("act_pardescripcion"); __jsp_taghandler_36.setReadonly(true); __jsp_taghandler_36.setSize("40"); __jsp_tag_starteval=__jsp_taghandler_36.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_36,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_36.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_36.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_36); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[41]); /*@lineinfo:translated-code*//*@lineinfo:75^27*/ { org.apache.struts.taglib.bean.MessageTag __jsp_taghandler_37=(org.apache.struts.taglib.bean.MessageTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.bean.MessageTag.class,"org.apache.struts.taglib.bean.MessageTag key"); __jsp_taghandler_37.setParent(__jsp_taghandler_22); __jsp_taghandler_37.setKey("activos1.codofi"); __jsp_tag_starteval=__jsp_taghandler_37.doStartTag(); if (OracleJspRuntime.checkStartTagEval(__jsp_tag_starteval)) { do { } while (__jsp_taghandler_37.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); } if (__jsp_taghandler_37.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_37); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[42]); /*@lineinfo:translated-code*//*@lineinfo:77^14*/ { org.apache.struts.taglib.html.TextTag __jsp_taghandler_38=(org.apache.struts.taglib.html.TextTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.TextTag.class,"org.apache.struts.taglib.html.TextTag maxlength name onkeypress property readonly size"); __jsp_taghandler_38.setParent(__jsp_taghandler_22); __jsp_taghandler_38.setMaxlength("40"); __jsp_taghandler_38.setName("ActivosForm"); __jsp_taghandler_38.setOnkeypress("return handleEnter(this, event)"); __jsp_taghandler_38.setProperty("act_ofidescripcion"); __jsp_taghandler_38.setReadonly(true); __jsp_taghandler_38.setSize("40"); __jsp_tag_starteval=__jsp_taghandler_38.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_38,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_38.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_38.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_38); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[43]); /*@lineinfo:translated-code*//*@lineinfo:79^27*/ { org.apache.struts.taglib.bean.MessageTag __jsp_taghandler_39=(org.apache.struts.taglib.bean.MessageTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.bean.MessageTag.class,"org.apache.struts.taglib.bean.MessageTag key"); __jsp_taghandler_39.setParent(__jsp_taghandler_22); __jsp_taghandler_39.setKey("activos1.codfun"); __jsp_tag_starteval=__jsp_taghandler_39.doStartTag(); if (OracleJspRuntime.checkStartTagEval(__jsp_tag_starteval)) { do { } while (__jsp_taghandler_39.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); } if (__jsp_taghandler_39.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_39); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[44]); /*@lineinfo:translated-code*//*@lineinfo:81^14*/ { org.apache.struts.taglib.html.TextTag __jsp_taghandler_40=(org.apache.struts.taglib.html.TextTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.TextTag.class,"org.apache.struts.taglib.html.TextTag maxlength name onkeypress property readonly size"); __jsp_taghandler_40.setParent(__jsp_taghandler_22); __jsp_taghandler_40.setMaxlength("40"); __jsp_taghandler_40.setName("ActivosForm"); __jsp_taghandler_40.setOnkeypress("return handleEnter(this, event)"); __jsp_taghandler_40.setProperty("act_fundescripcion"); __jsp_taghandler_40.setReadonly(true); __jsp_taghandler_40.setSize("40"); __jsp_tag_starteval=__jsp_taghandler_40.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_40,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_40.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_40.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_40); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[45]); /*@lineinfo:translated-code*//*@lineinfo:85^27*/ { org.apache.struts.taglib.bean.MessageTag __jsp_taghandler_41=(org.apache.struts.taglib.bean.MessageTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.bean.MessageTag.class,"org.apache.struts.taglib.bean.MessageTag key"); __jsp_taghandler_41.setParent(__jsp_taghandler_22); __jsp_taghandler_41.setKey("activos1.codubi"); __jsp_tag_starteval=__jsp_taghandler_41.doStartTag(); if (OracleJspRuntime.checkStartTagEval(__jsp_tag_starteval)) { do { } while (__jsp_taghandler_41.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); } if (__jsp_taghandler_41.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_41); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[46]); /*@lineinfo:translated-code*//*@lineinfo:86^14*/ { org.apache.struts.taglib.html.SelectTag __jsp_taghandler_42=(org.apache.struts.taglib.html.SelectTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.SelectTag.class,"org.apache.struts.taglib.html.SelectTag disabled name onkeypress property"); __jsp_taghandler_42.setParent(__jsp_taghandler_22); __jsp_taghandler_42.setDisabled(false); __jsp_taghandler_42.setName("ActivosForm"); __jsp_taghandler_42.setOnkeypress("return handleEnter(this, event)"); __jsp_taghandler_42.setProperty("act_codubi"); __jsp_tag_starteval=__jsp_taghandler_42.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_42,__jsp_tag_starteval,out); do { /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[47]); /*@lineinfo:translated-code*//*@lineinfo:87^15*/ { org.apache.struts.taglib.html.OptionsTag __jsp_taghandler_43=(org.apache.struts.taglib.html.OptionsTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.OptionsTag.class,"org.apache.struts.taglib.html.OptionsTag collection labelProperty property"); __jsp_taghandler_43.setParent(__jsp_taghandler_42); __jsp_taghandler_43.setCollection("UbicacionesLista"); __jsp_taghandler_43.setLabelProperty("descripcion"); __jsp_taghandler_43.setProperty("codigo"); __jsp_tag_starteval=__jsp_taghandler_43.doStartTag(); if (OracleJspRuntime.checkStartTagEval(__jsp_tag_starteval)) { do { } while (__jsp_taghandler_43.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); } if (__jsp_taghandler_43.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_43); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[48]); /*@lineinfo:translated-code*//*@lineinfo:87^106*/ } while (__jsp_taghandler_42.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_42.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_42); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[49]); /*@lineinfo:translated-code*//*@lineinfo:89^27*/ { org.apache.struts.taglib.bean.MessageTag __jsp_taghandler_44=(org.apache.struts.taglib.bean.MessageTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.bean.MessageTag.class,"org.apache.struts.taglib.bean.MessageTag key"); __jsp_taghandler_44.setParent(__jsp_taghandler_22); __jsp_taghandler_44.setKey("activos1.codpry"); __jsp_tag_starteval=__jsp_taghandler_44.doStartTag(); if (OracleJspRuntime.checkStartTagEval(__jsp_tag_starteval)) { do { } while (__jsp_taghandler_44.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); } if (__jsp_taghandler_44.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_44); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[50]); /*@lineinfo:translated-code*//*@lineinfo:90^14*/ { org.apache.struts.taglib.html.SelectTag __jsp_taghandler_45=(org.apache.struts.taglib.html.SelectTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.SelectTag.class,"org.apache.struts.taglib.html.SelectTag disabled name onkeypress property"); __jsp_taghandler_45.setParent(__jsp_taghandler_22); __jsp_taghandler_45.setDisabled(false); __jsp_taghandler_45.setName("ActivosForm"); __jsp_taghandler_45.setOnkeypress("return handleEnter(this, event)"); __jsp_taghandler_45.setProperty("act_codpry"); __jsp_tag_starteval=__jsp_taghandler_45.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_45,__jsp_tag_starteval,out); do { /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[51]); /*@lineinfo:translated-code*//*@lineinfo:91^15*/ { org.apache.struts.taglib.html.OptionsTag __jsp_taghandler_46=(org.apache.struts.taglib.html.OptionsTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.OptionsTag.class,"org.apache.struts.taglib.html.OptionsTag collection labelProperty property"); __jsp_taghandler_46.setParent(__jsp_taghandler_45); __jsp_taghandler_46.setCollection("ProyectosLista"); __jsp_taghandler_46.setLabelProperty("descripcion"); __jsp_taghandler_46.setProperty("codigo"); __jsp_tag_starteval=__jsp_taghandler_46.doStartTag(); if (OracleJspRuntime.checkStartTagEval(__jsp_tag_starteval)) { do { } while (__jsp_taghandler_46.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); } if (__jsp_taghandler_46.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_46); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[52]); /*@lineinfo:translated-code*//*@lineinfo:91^104*/ } while (__jsp_taghandler_45.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_45.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_45); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[53]); /*@lineinfo:translated-code*//*@lineinfo:95^27*/ { org.apache.struts.taglib.bean.MessageTag __jsp_taghandler_47=(org.apache.struts.taglib.bean.MessageTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.bean.MessageTag.class,"org.apache.struts.taglib.bean.MessageTag key"); __jsp_taghandler_47.setParent(__jsp_taghandler_22); __jsp_taghandler_47.setKey("activos1.codfin"); __jsp_tag_starteval=__jsp_taghandler_47.doStartTag(); if (OracleJspRuntime.checkStartTagEval(__jsp_tag_starteval)) { do { } while (__jsp_taghandler_47.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); } if (__jsp_taghandler_47.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_47); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[54]); /*@lineinfo:translated-code*//*@lineinfo:96^14*/ { org.apache.struts.taglib.html.TextTag __jsp_taghandler_48=(org.apache.struts.taglib.html.TextTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.TextTag.class,"org.apache.struts.taglib.html.TextTag maxlength name onkeypress property readonly size"); __jsp_taghandler_48.setParent(__jsp_taghandler_22); __jsp_taghandler_48.setMaxlength("40"); __jsp_taghandler_48.setName("ActivosForm"); __jsp_taghandler_48.setOnkeypress("return handleEnter(this, event)"); __jsp_taghandler_48.setProperty("act_findescripcion"); __jsp_taghandler_48.setReadonly(true); __jsp_taghandler_48.setSize("40"); __jsp_tag_starteval=__jsp_taghandler_48.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_48,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_48.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_48.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_48); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[55]); /*@lineinfo:translated-code*//*@lineinfo:97^27*/ { org.apache.struts.taglib.bean.MessageTag __jsp_taghandler_49=(org.apache.struts.taglib.bean.MessageTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.bean.MessageTag.class,"org.apache.struts.taglib.bean.MessageTag key"); __jsp_taghandler_49.setParent(__jsp_taghandler_22); __jsp_taghandler_49.setKey("activos1.feccompra"); __jsp_tag_starteval=__jsp_taghandler_49.doStartTag(); if (OracleJspRuntime.checkStartTagEval(__jsp_tag_starteval)) { do { } while (__jsp_taghandler_49.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); } if (__jsp_taghandler_49.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_49); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[56]); /*@lineinfo:translated-code*//*@lineinfo:98^14*/ { org.apache.struts.taglib.html.TextTag __jsp_taghandler_50=(org.apache.struts.taglib.html.TextTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.TextTag.class,"org.apache.struts.taglib.html.TextTag maxlength name onkeypress property size"); __jsp_taghandler_50.setParent(__jsp_taghandler_22); __jsp_taghandler_50.setMaxlength("10"); __jsp_taghandler_50.setName("ActivosForm"); __jsp_taghandler_50.setOnkeypress("return handleEnter(this, event)"); __jsp_taghandler_50.setProperty("act_feccompra"); __jsp_taghandler_50.setSize("10"); __jsp_tag_starteval=__jsp_taghandler_50.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_50,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_50.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_50.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_50); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[57]); /*@lineinfo:translated-code*//*@lineinfo:103^27*/ { org.apache.struts.taglib.bean.MessageTag __jsp_taghandler_51=(org.apache.struts.taglib.bean.MessageTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.bean.MessageTag.class,"org.apache.struts.taglib.bean.MessageTag key"); __jsp_taghandler_51.setParent(__jsp_taghandler_22); __jsp_taghandler_51.setKey("activos1.umanejo"); __jsp_tag_starteval=__jsp_taghandler_51.doStartTag(); if (OracleJspRuntime.checkStartTagEval(__jsp_tag_starteval)) { do { } while (__jsp_taghandler_51.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); } if (__jsp_taghandler_51.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_51); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[58]); /*@lineinfo:translated-code*//*@lineinfo:104^14*/ { org.apache.struts.taglib.html.TextTag __jsp_taghandler_52=(org.apache.struts.taglib.html.TextTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.TextTag.class,"org.apache.struts.taglib.html.TextTag maxlength name onchange onkeypress property size"); __jsp_taghandler_52.setParent(__jsp_taghandler_22); __jsp_taghandler_52.setMaxlength("20"); __jsp_taghandler_52.setName("ActivosForm"); __jsp_taghandler_52.setOnchange("javascript:this.value=this.value.toUpperCase();"); __jsp_taghandler_52.setOnkeypress("return handleEnter(this, event)"); __jsp_taghandler_52.setProperty("act_umanejo"); __jsp_taghandler_52.setSize("20"); __jsp_tag_starteval=__jsp_taghandler_52.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_52,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_52.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_52.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_52); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[59]); /*@lineinfo:translated-code*//*@lineinfo:107^27*/ { org.apache.struts.taglib.bean.MessageTag __jsp_taghandler_53=(org.apache.struts.taglib.bean.MessageTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.bean.MessageTag.class,"org.apache.struts.taglib.bean.MessageTag key"); __jsp_taghandler_53.setParent(__jsp_taghandler_22); __jsp_taghandler_53.setKey("activos1.descripcion"); __jsp_tag_starteval=__jsp_taghandler_53.doStartTag(); if (OracleJspRuntime.checkStartTagEval(__jsp_tag_starteval)) { do { } while (__jsp_taghandler_53.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); } if (__jsp_taghandler_53.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_53); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[60]); /*@lineinfo:translated-code*//*@lineinfo:108^14*/ { org.apache.struts.taglib.html.TextTag __jsp_taghandler_54=(org.apache.struts.taglib.html.TextTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.TextTag.class,"org.apache.struts.taglib.html.TextTag maxlength name onchange onkeypress property size"); __jsp_taghandler_54.setParent(__jsp_taghandler_22); __jsp_taghandler_54.setMaxlength("120"); __jsp_taghandler_54.setName("ActivosForm"); __jsp_taghandler_54.setOnchange("javascript:this.value=this.value.toUpperCase();"); __jsp_taghandler_54.setOnkeypress("return handleEnter(this, event)"); __jsp_taghandler_54.setProperty("act_descripcion"); __jsp_taghandler_54.setSize("60"); __jsp_tag_starteval=__jsp_taghandler_54.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_54,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_54.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_54.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_54); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[61]); /*@lineinfo:translated-code*//*@lineinfo:111^27*/ { org.apache.struts.taglib.bean.MessageTag __jsp_taghandler_55=(org.apache.struts.taglib.bean.MessageTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.bean.MessageTag.class,"org.apache.struts.taglib.bean.MessageTag key"); __jsp_taghandler_55.setParent(__jsp_taghandler_22); __jsp_taghandler_55.setKey("activos1.desadicional"); __jsp_tag_starteval=__jsp_taghandler_55.doStartTag(); if (OracleJspRuntime.checkStartTagEval(__jsp_tag_starteval)) { do { } while (__jsp_taghandler_55.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); } if (__jsp_taghandler_55.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_55); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[62]); /*@lineinfo:translated-code*//*@lineinfo:112^14*/ { org.apache.struts.taglib.html.TextTag __jsp_taghandler_56=(org.apache.struts.taglib.html.TextTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.TextTag.class,"org.apache.struts.taglib.html.TextTag maxlength name onchange onkeypress property size"); __jsp_taghandler_56.setParent(__jsp_taghandler_22); __jsp_taghandler_56.setMaxlength("240"); __jsp_taghandler_56.setName("ActivosForm"); __jsp_taghandler_56.setOnchange("javascript:this.value=this.value.toUpperCase();"); __jsp_taghandler_56.setOnkeypress("return handleEnter(this, event)"); __jsp_taghandler_56.setProperty("act_desadicional"); __jsp_taghandler_56.setSize("60"); __jsp_tag_starteval=__jsp_taghandler_56.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_56,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_56.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_56.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_56); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[63]); /*@lineinfo:translated-code*//*@lineinfo:116^13*/ { org.apache.struts.taglib.bean.MessageTag __jsp_taghandler_57=(org.apache.struts.taglib.bean.MessageTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.bean.MessageTag.class,"org.apache.struts.taglib.bean.MessageTag key"); __jsp_taghandler_57.setParent(__jsp_taghandler_22); __jsp_taghandler_57.setKey("activos1.proveedor"); __jsp_tag_starteval=__jsp_taghandler_57.doStartTag(); if (OracleJspRuntime.checkStartTagEval(__jsp_tag_starteval)) { do { } while (__jsp_taghandler_57.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); } if (__jsp_taghandler_57.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_57); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[64]); /*@lineinfo:translated-code*//*@lineinfo:119^13*/ { org.apache.struts.taglib.html.TextTag __jsp_taghandler_58=(org.apache.struts.taglib.html.TextTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.TextTag.class,"org.apache.struts.taglib.html.TextTag maxlength name onchange onkeypress property size"); __jsp_taghandler_58.setParent(__jsp_taghandler_22); __jsp_taghandler_58.setMaxlength("50"); __jsp_taghandler_58.setName("ActivosForm"); __jsp_taghandler_58.setOnchange("javascript:this.value=this.value.toUpperCase();"); __jsp_taghandler_58.setOnkeypress("return handleEnter(this, event)"); __jsp_taghandler_58.setProperty("act_proveedor"); __jsp_taghandler_58.setSize("50"); __jsp_tag_starteval=__jsp_taghandler_58.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_58,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_58.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_58.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_58); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[65]); /*@lineinfo:translated-code*//*@lineinfo:123^27*/ { org.apache.struts.taglib.logic.EqualTag __jsp_taghandler_59=(org.apache.struts.taglib.logic.EqualTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.logic.EqualTag.class,"org.apache.struts.taglib.logic.EqualTag name property value"); __jsp_taghandler_59.setParent(__jsp_taghandler_22); __jsp_taghandler_59.setName("ActivosForm"); __jsp_taghandler_59.setProperty("act_codrub"); __jsp_taghandler_59.setValue("01"); __jsp_tag_starteval=__jsp_taghandler_59.doStartTag(); if (OracleJspRuntime.checkStartTagEval(__jsp_tag_starteval)) { do { /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[66]); /*@lineinfo:translated-code*//*@lineinfo:123^92*/ } while (__jsp_taghandler_59.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); } if (__jsp_taghandler_59.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_59); } /*@lineinfo:123^107*/ { org.apache.struts.taglib.bean.MessageTag __jsp_taghandler_60=(org.apache.struts.taglib.bean.MessageTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.bean.MessageTag.class,"org.apache.struts.taglib.bean.MessageTag key"); __jsp_taghandler_60.setParent(__jsp_taghandler_22); __jsp_taghandler_60.setKey("activos1.accesorios"); __jsp_tag_starteval=__jsp_taghandler_60.doStartTag(); if (OracleJspRuntime.checkStartTagEval(__jsp_tag_starteval)) { do { } while (__jsp_taghandler_60.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); } if (__jsp_taghandler_60.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_60); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[67]); /*@lineinfo:translated-code*//*@lineinfo:124^14*/ { org.apache.struts.taglib.html.TextTag __jsp_taghandler_61=(org.apache.struts.taglib.html.TextTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.TextTag.class,"org.apache.struts.taglib.html.TextTag maxlength name onchange onkeypress property size"); __jsp_taghandler_61.setParent(__jsp_taghandler_22); __jsp_taghandler_61.setMaxlength("60"); __jsp_taghandler_61.setName("ActivosForm"); __jsp_taghandler_61.setOnchange("javascript:this.value=this.value.toUpperCase();"); __jsp_taghandler_61.setOnkeypress("return handleEnter(this, event)"); __jsp_taghandler_61.setProperty("act_accesorios"); __jsp_taghandler_61.setSize("60"); __jsp_tag_starteval=__jsp_taghandler_61.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_61,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_61.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_61.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_61); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[68]); /*@lineinfo:translated-code*//*@lineinfo:129^27*/ { org.apache.struts.taglib.bean.MessageTag __jsp_taghandler_62=(org.apache.struts.taglib.bean.MessageTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.bean.MessageTag.class,"org.apache.struts.taglib.bean.MessageTag key"); __jsp_taghandler_62.setParent(__jsp_taghandler_22); __jsp_taghandler_62.setKey("activos1.serie1"); __jsp_tag_starteval=__jsp_taghandler_62.doStartTag(); if (OracleJspRuntime.checkStartTagEval(__jsp_tag_starteval)) { do { } while (__jsp_taghandler_62.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); } if (__jsp_taghandler_62.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_62); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[69]); /*@lineinfo:translated-code*//*@lineinfo:130^14*/ { org.apache.struts.taglib.html.TextTag __jsp_taghandler_63=(org.apache.struts.taglib.html.TextTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.TextTag.class,"org.apache.struts.taglib.html.TextTag maxlength name onchange onkeypress property size"); __jsp_taghandler_63.setParent(__jsp_taghandler_22); __jsp_taghandler_63.setMaxlength("30"); __jsp_taghandler_63.setName("ActivosForm"); __jsp_taghandler_63.setOnchange("javascript:this.value=this.value.toUpperCase();"); __jsp_taghandler_63.setOnkeypress("return handleEnter(this, event)"); __jsp_taghandler_63.setProperty("act_serie1"); __jsp_taghandler_63.setSize("30"); __jsp_tag_starteval=__jsp_taghandler_63.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_63,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_63.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_63.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_63); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[70]); /*@lineinfo:translated-code*//*@lineinfo:131^27*/ { org.apache.struts.taglib.bean.MessageTag __jsp_taghandler_64=(org.apache.struts.taglib.bean.MessageTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.bean.MessageTag.class,"org.apache.struts.taglib.bean.MessageTag key"); __jsp_taghandler_64.setParent(__jsp_taghandler_22); __jsp_taghandler_64.setKey("activos1.serie2"); __jsp_tag_starteval=__jsp_taghandler_64.doStartTag(); if (OracleJspRuntime.checkStartTagEval(__jsp_tag_starteval)) { do { } while (__jsp_taghandler_64.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); } if (__jsp_taghandler_64.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_64); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[71]); /*@lineinfo:translated-code*//*@lineinfo:132^14*/ { org.apache.struts.taglib.html.TextTag __jsp_taghandler_65=(org.apache.struts.taglib.html.TextTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.TextTag.class,"org.apache.struts.taglib.html.TextTag maxlength name onchange onkeypress property size"); __jsp_taghandler_65.setParent(__jsp_taghandler_22); __jsp_taghandler_65.setMaxlength("30"); __jsp_taghandler_65.setName("ActivosForm"); __jsp_taghandler_65.setOnchange("javascript:this.value=this.value.toUpperCase();"); __jsp_taghandler_65.setOnkeypress("return handleEnter(this, event)"); __jsp_taghandler_65.setProperty("act_serie2"); __jsp_taghandler_65.setSize("30"); __jsp_tag_starteval=__jsp_taghandler_65.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_65,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_65.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_65.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_65); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[72]); /*@lineinfo:translated-code*//*@lineinfo:135^27*/ { org.apache.struts.taglib.bean.MessageTag __jsp_taghandler_66=(org.apache.struts.taglib.bean.MessageTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.bean.MessageTag.class,"org.apache.struts.taglib.bean.MessageTag key"); __jsp_taghandler_66.setParent(__jsp_taghandler_22); __jsp_taghandler_66.setKey("activos1.docreferencia"); __jsp_tag_starteval=__jsp_taghandler_66.doStartTag(); if (OracleJspRuntime.checkStartTagEval(__jsp_tag_starteval)) { do { } while (__jsp_taghandler_66.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); } if (__jsp_taghandler_66.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_66); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[73]); /*@lineinfo:translated-code*//*@lineinfo:136^14*/ { org.apache.struts.taglib.html.TextTag __jsp_taghandler_67=(org.apache.struts.taglib.html.TextTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.TextTag.class,"org.apache.struts.taglib.html.TextTag maxlength name onchange onkeypress property size"); __jsp_taghandler_67.setParent(__jsp_taghandler_22); __jsp_taghandler_67.setMaxlength("30"); __jsp_taghandler_67.setName("ActivosForm"); __jsp_taghandler_67.setOnchange("javascript:this.value=this.value.toUpperCase();"); __jsp_taghandler_67.setOnkeypress("return handleEnter(this, event)"); __jsp_taghandler_67.setProperty("act_docreferencia"); __jsp_taghandler_67.setSize("30"); __jsp_tag_starteval=__jsp_taghandler_67.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_67,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_67.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_67.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_67); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[74]); /*@lineinfo:translated-code*//*@lineinfo:137^27*/ { org.apache.struts.taglib.bean.MessageTag __jsp_taghandler_68=(org.apache.struts.taglib.bean.MessageTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.bean.MessageTag.class,"org.apache.struts.taglib.bean.MessageTag key"); __jsp_taghandler_68.setParent(__jsp_taghandler_22); __jsp_taghandler_68.setKey("activos1.fecreferencia"); __jsp_tag_starteval=__jsp_taghandler_68.doStartTag(); if (OracleJspRuntime.checkStartTagEval(__jsp_tag_starteval)) { do { } while (__jsp_taghandler_68.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); } if (__jsp_taghandler_68.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_68); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[75]); /*@lineinfo:translated-code*//*@lineinfo:138^14*/ { org.apache.struts.taglib.html.TextTag __jsp_taghandler_69=(org.apache.struts.taglib.html.TextTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.TextTag.class,"org.apache.struts.taglib.html.TextTag maxlength name onkeypress property size"); __jsp_taghandler_69.setParent(__jsp_taghandler_22); __jsp_taghandler_69.setMaxlength("10"); __jsp_taghandler_69.setName("ActivosForm"); __jsp_taghandler_69.setOnkeypress("return handleEnter(this, event)"); __jsp_taghandler_69.setProperty("act_fecreferencia"); __jsp_taghandler_69.setSize("10"); __jsp_tag_starteval=__jsp_taghandler_69.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_69,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_69.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_69.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_69); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[76]); /*@lineinfo:translated-code*//*@lineinfo:141^27*/ { org.apache.struts.taglib.bean.MessageTag __jsp_taghandler_70=(org.apache.struts.taglib.bean.MessageTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.bean.MessageTag.class,"org.apache.struts.taglib.bean.MessageTag key"); __jsp_taghandler_70.setParent(__jsp_taghandler_22); __jsp_taghandler_70.setKey("activos1.procedencia"); __jsp_tag_starteval=__jsp_taghandler_70.doStartTag(); if (OracleJspRuntime.checkStartTagEval(__jsp_tag_starteval)) { do { } while (__jsp_taghandler_70.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); } if (__jsp_taghandler_70.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_70); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[77]); /*@lineinfo:translated-code*//*@lineinfo:142^14*/ { org.apache.struts.taglib.html.TextTag __jsp_taghandler_71=(org.apache.struts.taglib.html.TextTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.TextTag.class,"org.apache.struts.taglib.html.TextTag maxlength name onchange onkeypress property size"); __jsp_taghandler_71.setParent(__jsp_taghandler_22); __jsp_taghandler_71.setMaxlength("30"); __jsp_taghandler_71.setName("ActivosForm"); __jsp_taghandler_71.setOnchange("javascript:this.value=this.value.toUpperCase();"); __jsp_taghandler_71.setOnkeypress("return handleEnter(this, event)"); __jsp_taghandler_71.setProperty("act_procedencia"); __jsp_taghandler_71.setSize("30"); __jsp_tag_starteval=__jsp_taghandler_71.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_71,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_71.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_71.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_71); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[78]); /*@lineinfo:translated-code*//*@lineinfo:143^27*/ { org.apache.struts.taglib.bean.MessageTag __jsp_taghandler_72=(org.apache.struts.taglib.bean.MessageTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.bean.MessageTag.class,"org.apache.struts.taglib.bean.MessageTag key"); __jsp_taghandler_72.setParent(__jsp_taghandler_22); __jsp_taghandler_72.setKey("activos1.gobmunicipal"); __jsp_tag_starteval=__jsp_taghandler_72.doStartTag(); if (OracleJspRuntime.checkStartTagEval(__jsp_tag_starteval)) { do { } while (__jsp_taghandler_72.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); } if (__jsp_taghandler_72.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_72); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[79]); /*@lineinfo:translated-code*//*@lineinfo:144^14*/ { org.apache.struts.taglib.html.TextTag __jsp_taghandler_73=(org.apache.struts.taglib.html.TextTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.TextTag.class,"org.apache.struts.taglib.html.TextTag maxlength name onchange onkeypress property size"); __jsp_taghandler_73.setParent(__jsp_taghandler_22); __jsp_taghandler_73.setMaxlength("30"); __jsp_taghandler_73.setName("ActivosForm"); __jsp_taghandler_73.setOnchange("javascript:this.value=this.value.toUpperCase();"); __jsp_taghandler_73.setOnkeypress("return handleEnter(this, event)"); __jsp_taghandler_73.setProperty("act_gobmunicipal"); __jsp_taghandler_73.setSize("30"); __jsp_tag_starteval=__jsp_taghandler_73.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_73,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_73.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_73.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_73); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[80]); /*@lineinfo:translated-code*//*@lineinfo:147^27*/ { org.apache.struts.taglib.bean.MessageTag __jsp_taghandler_74=(org.apache.struts.taglib.bean.MessageTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.bean.MessageTag.class,"org.apache.struts.taglib.bean.MessageTag key"); __jsp_taghandler_74.setParent(__jsp_taghandler_22); __jsp_taghandler_74.setKey("activos1.valcobol"); __jsp_tag_starteval=__jsp_taghandler_74.doStartTag(); if (OracleJspRuntime.checkStartTagEval(__jsp_tag_starteval)) { do { } while (__jsp_taghandler_74.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); } if (__jsp_taghandler_74.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_74); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[81]); /*@lineinfo:translated-code*//*@lineinfo:148^14*/ { org.apache.struts.taglib.html.TextTag __jsp_taghandler_75=(org.apache.struts.taglib.html.TextTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.TextTag.class,"org.apache.struts.taglib.html.TextTag maxlength name onkeypress property size"); __jsp_taghandler_75.setParent(__jsp_taghandler_22); __jsp_taghandler_75.setMaxlength("13"); __jsp_taghandler_75.setName("ActivosForm"); __jsp_taghandler_75.setOnkeypress("return handleEnter(this, event)"); __jsp_taghandler_75.setProperty("act_valcobol"); __jsp_taghandler_75.setSize("13"); __jsp_tag_starteval=__jsp_taghandler_75.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_75,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_75.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_75.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_75); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[82]); /*@lineinfo:translated-code*//*@lineinfo:149^27*/ { org.apache.struts.taglib.bean.MessageTag __jsp_taghandler_76=(org.apache.struts.taglib.bean.MessageTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.bean.MessageTag.class,"org.apache.struts.taglib.bean.MessageTag key"); __jsp_taghandler_76.setParent(__jsp_taghandler_22); __jsp_taghandler_76.setKey("activos1.ordencompra"); __jsp_tag_starteval=__jsp_taghandler_76.doStartTag(); if (OracleJspRuntime.checkStartTagEval(__jsp_tag_starteval)) { do { } while (__jsp_taghandler_76.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); } if (__jsp_taghandler_76.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_76); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[83]); /*@lineinfo:translated-code*//*@lineinfo:150^14*/ { org.apache.struts.taglib.html.TextTag __jsp_taghandler_77=(org.apache.struts.taglib.html.TextTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.TextTag.class,"org.apache.struts.taglib.html.TextTag maxlength name onkeypress property size"); __jsp_taghandler_77.setParent(__jsp_taghandler_22); __jsp_taghandler_77.setMaxlength("20"); __jsp_taghandler_77.setName("ActivosForm"); __jsp_taghandler_77.setOnkeypress("return handleEnter(this, event)"); __jsp_taghandler_77.setProperty("act_ordencompra"); __jsp_taghandler_77.setSize("20"); __jsp_tag_starteval=__jsp_taghandler_77.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_77,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_77.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_77.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_77); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[84]); /*@lineinfo:translated-code*//*@lineinfo:153^27*/ { org.apache.struts.taglib.bean.MessageTag __jsp_taghandler_78=(org.apache.struts.taglib.bean.MessageTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.bean.MessageTag.class,"org.apache.struts.taglib.bean.MessageTag key"); __jsp_taghandler_78.setParent(__jsp_taghandler_22); __jsp_taghandler_78.setKey("activos1.numfactura"); __jsp_tag_starteval=__jsp_taghandler_78.doStartTag(); if (OracleJspRuntime.checkStartTagEval(__jsp_tag_starteval)) { do { } while (__jsp_taghandler_78.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); } if (__jsp_taghandler_78.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_78); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[85]); /*@lineinfo:translated-code*//*@lineinfo:154^14*/ { org.apache.struts.taglib.html.TextTag __jsp_taghandler_79=(org.apache.struts.taglib.html.TextTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.TextTag.class,"org.apache.struts.taglib.html.TextTag maxlength name onkeypress property size"); __jsp_taghandler_79.setParent(__jsp_taghandler_22); __jsp_taghandler_79.setMaxlength("12"); __jsp_taghandler_79.setName("ActivosForm"); __jsp_taghandler_79.setOnkeypress("return handleEnter(this, event)"); __jsp_taghandler_79.setProperty("act_numfactura"); __jsp_taghandler_79.setSize("12"); __jsp_tag_starteval=__jsp_taghandler_79.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_79,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_79.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_79.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_79); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[86]); /*@lineinfo:translated-code*//*@lineinfo:155^27*/ { org.apache.struts.taglib.bean.MessageTag __jsp_taghandler_80=(org.apache.struts.taglib.bean.MessageTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.bean.MessageTag.class,"org.apache.struts.taglib.bean.MessageTag key"); __jsp_taghandler_80.setParent(__jsp_taghandler_22); __jsp_taghandler_80.setKey("activos1.numcomprobante"); __jsp_tag_starteval=__jsp_taghandler_80.doStartTag(); if (OracleJspRuntime.checkStartTagEval(__jsp_tag_starteval)) { do { } while (__jsp_taghandler_80.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); } if (__jsp_taghandler_80.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_80); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[87]); /*@lineinfo:translated-code*//*@lineinfo:156^14*/ { org.apache.struts.taglib.html.TextTag __jsp_taghandler_81=(org.apache.struts.taglib.html.TextTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.TextTag.class,"org.apache.struts.taglib.html.TextTag maxlength name onkeypress property size"); __jsp_taghandler_81.setParent(__jsp_taghandler_22); __jsp_taghandler_81.setMaxlength("20"); __jsp_taghandler_81.setName("ActivosForm"); __jsp_taghandler_81.setOnkeypress("return handleEnter(this, event)"); __jsp_taghandler_81.setProperty("act_numcomprobante"); __jsp_taghandler_81.setSize("20"); __jsp_tag_starteval=__jsp_taghandler_81.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_81,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_81.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_81.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_81); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[88]); /*@lineinfo:translated-code*//*@lineinfo:159^27*/ { org.apache.struts.taglib.bean.MessageTag __jsp_taghandler_82=(org.apache.struts.taglib.bean.MessageTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.bean.MessageTag.class,"org.apache.struts.taglib.bean.MessageTag key"); __jsp_taghandler_82.setParent(__jsp_taghandler_22); __jsp_taghandler_82.setKey("activos1.codanterior"); __jsp_tag_starteval=__jsp_taghandler_82.doStartTag(); if (OracleJspRuntime.checkStartTagEval(__jsp_tag_starteval)) { do { } while (__jsp_taghandler_82.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); } if (__jsp_taghandler_82.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_82); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[89]); /*@lineinfo:translated-code*//*@lineinfo:160^14*/ { org.apache.struts.taglib.html.TextTag __jsp_taghandler_83=(org.apache.struts.taglib.html.TextTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.TextTag.class,"org.apache.struts.taglib.html.TextTag maxlength name onchange onkeypress property size"); __jsp_taghandler_83.setParent(__jsp_taghandler_22); __jsp_taghandler_83.setMaxlength("20"); __jsp_taghandler_83.setName("ActivosForm"); __jsp_taghandler_83.setOnchange("javascript:this.value=this.value.toUpperCase();"); __jsp_taghandler_83.setOnkeypress("return handleEnter(this, event)"); __jsp_taghandler_83.setProperty("act_codanterior"); __jsp_taghandler_83.setSize("20"); __jsp_tag_starteval=__jsp_taghandler_83.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_83,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_83.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_83.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_83); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[90]); /*@lineinfo:translated-code*//*@lineinfo:161^27*/ { org.apache.struts.taglib.bean.MessageTag __jsp_taghandler_84=(org.apache.struts.taglib.bean.MessageTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.bean.MessageTag.class,"org.apache.struts.taglib.bean.MessageTag key"); __jsp_taghandler_84.setParent(__jsp_taghandler_22); __jsp_taghandler_84.setKey("activos1.fecha"); __jsp_tag_starteval=__jsp_taghandler_84.doStartTag(); if (OracleJspRuntime.checkStartTagEval(__jsp_tag_starteval)) { do { } while (__jsp_taghandler_84.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); } if (__jsp_taghandler_84.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_84); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[91]); /*@lineinfo:translated-code*//*@lineinfo:162^14*/ { org.apache.struts.taglib.html.TextTag __jsp_taghandler_85=(org.apache.struts.taglib.html.TextTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.TextTag.class,"org.apache.struts.taglib.html.TextTag maxlength name onkeypress property size"); __jsp_taghandler_85.setParent(__jsp_taghandler_22); __jsp_taghandler_85.setMaxlength("10"); __jsp_taghandler_85.setName("ActivosForm"); __jsp_taghandler_85.setOnkeypress("return handleEnter(this, event)"); __jsp_taghandler_85.setProperty("rev_fecha"); __jsp_taghandler_85.setSize("10"); __jsp_tag_starteval=__jsp_taghandler_85.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_85,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_85.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_85.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_85); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[92]); /*@lineinfo:translated-code*//*@lineinfo:165^27*/ { org.apache.struts.taglib.bean.MessageTag __jsp_taghandler_86=(org.apache.struts.taglib.bean.MessageTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.bean.MessageTag.class,"org.apache.struts.taglib.bean.MessageTag key"); __jsp_taghandler_86.setParent(__jsp_taghandler_22); __jsp_taghandler_86.setKey("activos1.vidaut"); __jsp_tag_starteval=__jsp_taghandler_86.doStartTag(); if (OracleJspRuntime.checkStartTagEval(__jsp_tag_starteval)) { do { } while (__jsp_taghandler_86.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); } if (__jsp_taghandler_86.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_86); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[93]); /*@lineinfo:translated-code*//*@lineinfo:166^14*/ { org.apache.struts.taglib.html.TextTag __jsp_taghandler_87=(org.apache.struts.taglib.html.TextTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.TextTag.class,"org.apache.struts.taglib.html.TextTag maxlength name onkeypress property readonly size"); __jsp_taghandler_87.setParent(__jsp_taghandler_22); __jsp_taghandler_87.setMaxlength("4"); __jsp_taghandler_87.setName("ActivosForm"); __jsp_taghandler_87.setOnkeypress("return handleEnter(this, event)"); __jsp_taghandler_87.setProperty("rev_vidaut"); __jsp_taghandler_87.setReadonly(true); __jsp_taghandler_87.setSize("4"); __jsp_tag_starteval=__jsp_taghandler_87.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_87,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_87.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_87.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_87); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[94]); /*@lineinfo:translated-code*//*@lineinfo:167^27*/ { org.apache.struts.taglib.bean.MessageTag __jsp_taghandler_88=(org.apache.struts.taglib.bean.MessageTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.bean.MessageTag.class,"org.apache.struts.taglib.bean.MessageTag key"); __jsp_taghandler_88.setParent(__jsp_taghandler_22); __jsp_taghandler_88.setKey("activos1.estadoactivo"); __jsp_tag_starteval=__jsp_taghandler_88.doStartTag(); if (OracleJspRuntime.checkStartTagEval(__jsp_tag_starteval)) { do { } while (__jsp_taghandler_88.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); } if (__jsp_taghandler_88.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_88); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[95]); /*@lineinfo:translated-code*//*@lineinfo:168^14*/ { org.apache.struts.taglib.html.SelectTag __jsp_taghandler_89=(org.apache.struts.taglib.html.SelectTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.SelectTag.class,"org.apache.struts.taglib.html.SelectTag disabled name onkeypress property"); __jsp_taghandler_89.setParent(__jsp_taghandler_22); __jsp_taghandler_89.setDisabled(false); __jsp_taghandler_89.setName("ActivosForm"); __jsp_taghandler_89.setOnkeypress("return handleEnter(this, event)"); __jsp_taghandler_89.setProperty("rev_estadoactivo"); __jsp_tag_starteval=__jsp_taghandler_89.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_89,__jsp_tag_starteval,out); do { /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[96]); /*@lineinfo:translated-code*//*@lineinfo:169^14*/ { org.apache.struts.taglib.html.OptionsTag __jsp_taghandler_90=(org.apache.struts.taglib.html.OptionsTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.OptionsTag.class,"org.apache.struts.taglib.html.OptionsTag collection labelProperty property"); __jsp_taghandler_90.setParent(__jsp_taghandler_89); __jsp_taghandler_90.setCollection("EstadosLista"); __jsp_taghandler_90.setLabelProperty("desestado"); __jsp_taghandler_90.setProperty("estado"); __jsp_tag_starteval=__jsp_taghandler_90.doStartTag(); if (OracleJspRuntime.checkStartTagEval(__jsp_tag_starteval)) { do { } while (__jsp_taghandler_90.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); } if (__jsp_taghandler_90.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_90); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[97]); /*@lineinfo:translated-code*//*@lineinfo:169^99*/ } while (__jsp_taghandler_89.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_89.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_89); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[98]); /*@lineinfo:translated-code*//*@lineinfo:174^27*/ { org.apache.struts.taglib.bean.MessageTag __jsp_taghandler_91=(org.apache.struts.taglib.bean.MessageTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.bean.MessageTag.class,"org.apache.struts.taglib.bean.MessageTag key"); __jsp_taghandler_91.setParent(__jsp_taghandler_22); __jsp_taghandler_91.setKey("activos1.desestado"); __jsp_tag_starteval=__jsp_taghandler_91.doStartTag(); if (OracleJspRuntime.checkStartTagEval(__jsp_tag_starteval)) { do { } while (__jsp_taghandler_91.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); } if (__jsp_taghandler_91.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_91); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[99]); /*@lineinfo:translated-code*//*@lineinfo:175^14*/ { org.apache.struts.taglib.html.TextTag __jsp_taghandler_92=(org.apache.struts.taglib.html.TextTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.TextTag.class,"org.apache.struts.taglib.html.TextTag maxlength name onchange onkeypress property size"); __jsp_taghandler_92.setParent(__jsp_taghandler_22); __jsp_taghandler_92.setMaxlength("60"); __jsp_taghandler_92.setName("ActivosForm"); __jsp_taghandler_92.setOnchange("javascript:this.value=this.value.toUpperCase();"); __jsp_taghandler_92.setOnkeypress("return handleEnter(this, event)"); __jsp_taghandler_92.setProperty("rev_desestado"); __jsp_taghandler_92.setSize("60"); __jsp_tag_starteval=__jsp_taghandler_92.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_92,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_92.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_92.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_92); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[100]); /*@lineinfo:translated-code*//*@lineinfo:178^24*/ { org.apache.struts.taglib.html.SubmitTag __jsp_taghandler_93=(org.apache.struts.taglib.html.SubmitTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.SubmitTag.class,"org.apache.struts.taglib.html.SubmitTag onclick property styleClass value"); __jsp_taghandler_93.setParent(__jsp_taghandler_22); __jsp_taghandler_93.setOnclick("operacion.value=2;opcion.value=1"); __jsp_taghandler_93.setProperty("boton"); __jsp_taghandler_93.setStyleClass("boton1"); __jsp_taghandler_93.setValue("Insertar"); __jsp_tag_starteval=__jsp_taghandler_93.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_93,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_93.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_93.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_93); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[101]); /*@lineinfo:translated-code*//*@lineinfo:183^12*/ { org.apache.struts.taglib.html.LinkTag __jsp_taghandler_94=(org.apache.struts.taglib.html.LinkTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.LinkTag.class,"org.apache.struts.taglib.html.LinkTag href"); __jsp_taghandler_94.setParent(__jsp_taghandler_22); __jsp_taghandler_94.setHref("javascript:pantallaCompleta('tipocambio.do');"); __jsp_tag_starteval=__jsp_taghandler_94.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_94,__jsp_tag_starteval,out); do { /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[102]); /*@lineinfo:translated-code*//*@lineinfo:183^76*/ } while (__jsp_taghandler_94.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_94.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_94); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[103]); /*@lineinfo:translated-code*//*@lineinfo:185^24*/ } while (__jsp_taghandler_22.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); } if (__jsp_taghandler_22.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_22); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[104]); /*@lineinfo:translated-code*//*@lineinfo:191^4*/ { org.apache.struts.taglib.logic.EqualTag __jsp_taghandler_95=(org.apache.struts.taglib.logic.EqualTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.logic.EqualTag.class,"org.apache.struts.taglib.logic.EqualTag name property value"); __jsp_taghandler_95.setParent(__jsp_taghandler_4); __jsp_taghandler_95.setName("ActivosForm"); __jsp_taghandler_95.setProperty("opcion"); __jsp_taghandler_95.setValue("2"); __jsp_tag_starteval=__jsp_taghandler_95.doStartTag(); if (OracleJspRuntime.checkStartTagEval(__jsp_tag_starteval)) { do { /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[105]); /*@lineinfo:translated-code*//*@lineinfo:194^27*/ { org.apache.struts.taglib.bean.MessageTag __jsp_taghandler_96=(org.apache.struts.taglib.bean.MessageTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.bean.MessageTag.class,"org.apache.struts.taglib.bean.MessageTag key"); __jsp_taghandler_96.setParent(__jsp_taghandler_95); __jsp_taghandler_96.setKey("activos1.codrub"); __jsp_tag_starteval=__jsp_taghandler_96.doStartTag(); if (OracleJspRuntime.checkStartTagEval(__jsp_tag_starteval)) { do { } while (__jsp_taghandler_96.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); } if (__jsp_taghandler_96.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_96); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[106]); /*@lineinfo:translated-code*//*@lineinfo:195^26*/ { org.apache.struts.taglib.html.TextTag __jsp_taghandler_97=(org.apache.struts.taglib.html.TextTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.TextTag.class,"org.apache.struts.taglib.html.TextTag maxlength name onkeypress property readonly size"); __jsp_taghandler_97.setParent(__jsp_taghandler_95); __jsp_taghandler_97.setMaxlength("10"); __jsp_taghandler_97.setName("ActivosForm"); __jsp_taghandler_97.setOnkeypress("return handleEnter(this, event)"); __jsp_taghandler_97.setProperty("act_codrub"); __jsp_taghandler_97.setReadonly(true); __jsp_taghandler_97.setSize("10"); __jsp_tag_starteval=__jsp_taghandler_97.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_97,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_97.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_97.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_97); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[107]); /*@lineinfo:translated-code*//*@lineinfo:196^10*/ { org.apache.struts.taglib.html.TextTag __jsp_taghandler_98=(org.apache.struts.taglib.html.TextTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.TextTag.class,"org.apache.struts.taglib.html.TextTag maxlength name onkeypress property readonly size"); __jsp_taghandler_98.setParent(__jsp_taghandler_95); __jsp_taghandler_98.setMaxlength("60"); __jsp_taghandler_98.setName("ActivosForm"); __jsp_taghandler_98.setOnkeypress("return handleEnter(this, event)"); __jsp_taghandler_98.setProperty("act_rubdescripcion"); __jsp_taghandler_98.setReadonly(true); __jsp_taghandler_98.setSize("60"); __jsp_tag_starteval=__jsp_taghandler_98.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_98,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_98.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_98.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_98); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[108]); /*@lineinfo:translated-code*//*@lineinfo:199^27*/ { org.apache.struts.taglib.bean.MessageTag __jsp_taghandler_99=(org.apache.struts.taglib.bean.MessageTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.bean.MessageTag.class,"org.apache.struts.taglib.bean.MessageTag key"); __jsp_taghandler_99.setParent(__jsp_taghandler_95); __jsp_taghandler_99.setKey("activos1.codreg"); __jsp_tag_starteval=__jsp_taghandler_99.doStartTag(); if (OracleJspRuntime.checkStartTagEval(__jsp_tag_starteval)) { do { } while (__jsp_taghandler_99.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); } if (__jsp_taghandler_99.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_99); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[109]); /*@lineinfo:translated-code*//*@lineinfo:200^26*/ { org.apache.struts.taglib.html.TextTag __jsp_taghandler_100=(org.apache.struts.taglib.html.TextTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.TextTag.class,"org.apache.struts.taglib.html.TextTag maxlength name onkeypress property readonly size"); __jsp_taghandler_100.setParent(__jsp_taghandler_95); __jsp_taghandler_100.setMaxlength("10"); __jsp_taghandler_100.setName("ActivosForm"); __jsp_taghandler_100.setOnkeypress("return handleEnter(this, event)"); __jsp_taghandler_100.setProperty("act_codreg"); __jsp_taghandler_100.setReadonly(true); __jsp_taghandler_100.setSize("10"); __jsp_tag_starteval=__jsp_taghandler_100.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_100,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_100.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_100.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_100); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[110]); /*@lineinfo:translated-code*//*@lineinfo:201^10*/ { org.apache.struts.taglib.html.TextTag __jsp_taghandler_101=(org.apache.struts.taglib.html.TextTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.TextTag.class,"org.apache.struts.taglib.html.TextTag maxlength name onkeypress property readonly size"); __jsp_taghandler_101.setParent(__jsp_taghandler_95); __jsp_taghandler_101.setMaxlength("60"); __jsp_taghandler_101.setName("ActivosForm"); __jsp_taghandler_101.setOnkeypress("return handleEnter(this, event)"); __jsp_taghandler_101.setProperty("act_regdescripcion"); __jsp_taghandler_101.setReadonly(true); __jsp_taghandler_101.setSize("60"); __jsp_tag_starteval=__jsp_taghandler_101.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_101,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_101.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_101.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_101); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[111]); /*@lineinfo:translated-code*//*@lineinfo:204^27*/ { org.apache.struts.taglib.bean.MessageTag __jsp_taghandler_102=(org.apache.struts.taglib.bean.MessageTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.bean.MessageTag.class,"org.apache.struts.taglib.bean.MessageTag key"); __jsp_taghandler_102.setParent(__jsp_taghandler_95); __jsp_taghandler_102.setKey("activos1.codigo"); __jsp_tag_starteval=__jsp_taghandler_102.doStartTag(); if (OracleJspRuntime.checkStartTagEval(__jsp_tag_starteval)) { do { } while (__jsp_taghandler_102.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); } if (__jsp_taghandler_102.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_102); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[112]); /*@lineinfo:translated-code*//*@lineinfo:205^26*/ { org.apache.struts.taglib.html.TextTag __jsp_taghandler_103=(org.apache.struts.taglib.html.TextTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.TextTag.class,"org.apache.struts.taglib.html.TextTag maxlength name onkeypress property readonly size"); __jsp_taghandler_103.setParent(__jsp_taghandler_95); __jsp_taghandler_103.setMaxlength("5"); __jsp_taghandler_103.setName("ActivosForm"); __jsp_taghandler_103.setOnkeypress("return handleEnter(this, event)"); __jsp_taghandler_103.setProperty("act_codigo"); __jsp_taghandler_103.setReadonly(true); __jsp_taghandler_103.setSize("5"); __jsp_tag_starteval=__jsp_taghandler_103.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_103,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_103.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_103.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_103); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[113]); /*@lineinfo:translated-code*//*@lineinfo:206^10*/ { org.apache.struts.taglib.html.TextTag __jsp_taghandler_104=(org.apache.struts.taglib.html.TextTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.TextTag.class,"org.apache.struts.taglib.html.TextTag maxlength name onkeypress property readonly size"); __jsp_taghandler_104.setParent(__jsp_taghandler_95); __jsp_taghandler_104.setMaxlength("10"); __jsp_taghandler_104.setName("ActivosForm"); __jsp_taghandler_104.setOnkeypress("return handleEnter(this, event)"); __jsp_taghandler_104.setProperty("act_codbarra"); __jsp_taghandler_104.setReadonly(true); __jsp_taghandler_104.setSize("10"); __jsp_tag_starteval=__jsp_taghandler_104.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_104,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_104.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_104.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_104); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[114]); /*@lineinfo:translated-code*//*@lineinfo:209^27*/ { org.apache.struts.taglib.bean.MessageTag __jsp_taghandler_105=(org.apache.struts.taglib.bean.MessageTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.bean.MessageTag.class,"org.apache.struts.taglib.bean.MessageTag key"); __jsp_taghandler_105.setParent(__jsp_taghandler_95); __jsp_taghandler_105.setKey("activos1.codgrp"); __jsp_tag_starteval=__jsp_taghandler_105.doStartTag(); if (OracleJspRuntime.checkStartTagEval(__jsp_tag_starteval)) { do { } while (__jsp_taghandler_105.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); } if (__jsp_taghandler_105.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_105); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[115]); /*@lineinfo:translated-code*//*@lineinfo:211^13*/ { org.apache.struts.taglib.html.SelectTag __jsp_taghandler_106=(org.apache.struts.taglib.html.SelectTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.SelectTag.class,"org.apache.struts.taglib.html.SelectTag disabled name onkeypress property"); __jsp_taghandler_106.setParent(__jsp_taghandler_95); __jsp_taghandler_106.setDisabled(false); __jsp_taghandler_106.setName("ActivosForm"); __jsp_taghandler_106.setOnkeypress("return handleEnter(this, event)"); __jsp_taghandler_106.setProperty("act_codgrp"); __jsp_tag_starteval=__jsp_taghandler_106.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_106,__jsp_tag_starteval,out); do { /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[116]); /*@lineinfo:translated-code*//*@lineinfo:212^16*/ { org.apache.struts.taglib.html.OptionsTag __jsp_taghandler_107=(org.apache.struts.taglib.html.OptionsTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.OptionsTag.class,"org.apache.struts.taglib.html.OptionsTag collection labelProperty property"); __jsp_taghandler_107.setParent(__jsp_taghandler_106); __jsp_taghandler_107.setCollection("GruposLista"); __jsp_taghandler_107.setLabelProperty("descripcion"); __jsp_taghandler_107.setProperty("codigo"); __jsp_tag_starteval=__jsp_taghandler_107.doStartTag(); if (OracleJspRuntime.checkStartTagEval(__jsp_tag_starteval)) { do { } while (__jsp_taghandler_107.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); } if (__jsp_taghandler_107.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_107); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[117]); /*@lineinfo:translated-code*//*@lineinfo:212^102*/ } while (__jsp_taghandler_106.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_106.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_106); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[118]); /*@lineinfo:translated-code*//*@lineinfo:215^27*/ { org.apache.struts.taglib.bean.MessageTag __jsp_taghandler_108=(org.apache.struts.taglib.bean.MessageTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.bean.MessageTag.class,"org.apache.struts.taglib.bean.MessageTag key"); __jsp_taghandler_108.setParent(__jsp_taghandler_95); __jsp_taghandler_108.setKey("activos1.codpar"); __jsp_tag_starteval=__jsp_taghandler_108.doStartTag(); if (OracleJspRuntime.checkStartTagEval(__jsp_tag_starteval)) { do { } while (__jsp_taghandler_108.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); } if (__jsp_taghandler_108.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_108); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[119]); /*@lineinfo:translated-code*//*@lineinfo:217^15*/ { org.apache.struts.taglib.html.TextTag __jsp_taghandler_109=(org.apache.struts.taglib.html.TextTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.TextTag.class,"org.apache.struts.taglib.html.TextTag maxlength name onkeypress property readonly size"); __jsp_taghandler_109.setParent(__jsp_taghandler_95); __jsp_taghandler_109.setMaxlength("40"); __jsp_taghandler_109.setName("ActivosForm"); __jsp_taghandler_109.setOnkeypress("return handleEnter(this, event)"); __jsp_taghandler_109.setProperty("act_pardescripcion"); __jsp_taghandler_109.setReadonly(true); __jsp_taghandler_109.setSize("40"); __jsp_tag_starteval=__jsp_taghandler_109.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_109,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_109.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_109.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_109); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[120]); /*@lineinfo:translated-code*//*@lineinfo:221^27*/ { org.apache.struts.taglib.bean.MessageTag __jsp_taghandler_110=(org.apache.struts.taglib.bean.MessageTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.bean.MessageTag.class,"org.apache.struts.taglib.bean.MessageTag key"); __jsp_taghandler_110.setParent(__jsp_taghandler_95); __jsp_taghandler_110.setKey("activos1.codofi"); __jsp_tag_starteval=__jsp_taghandler_110.doStartTag(); if (OracleJspRuntime.checkStartTagEval(__jsp_tag_starteval)) { do { } while (__jsp_taghandler_110.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); } if (__jsp_taghandler_110.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_110); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[121]); /*@lineinfo:translated-code*//*@lineinfo:223^10*/ { org.apache.struts.taglib.html.TextTag __jsp_taghandler_111=(org.apache.struts.taglib.html.TextTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.TextTag.class,"org.apache.struts.taglib.html.TextTag maxlength name onkeypress property readonly size"); __jsp_taghandler_111.setParent(__jsp_taghandler_95); __jsp_taghandler_111.setMaxlength("40"); __jsp_taghandler_111.setName("ActivosForm"); __jsp_taghandler_111.setOnkeypress("return handleEnter(this, event)"); __jsp_taghandler_111.setProperty("act_ofidescripcion"); __jsp_taghandler_111.setReadonly(true); __jsp_taghandler_111.setSize("40"); __jsp_tag_starteval=__jsp_taghandler_111.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_111,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_111.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_111.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_111); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[122]); /*@lineinfo:translated-code*//*@lineinfo:225^27*/ { org.apache.struts.taglib.bean.MessageTag __jsp_taghandler_112=(org.apache.struts.taglib.bean.MessageTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.bean.MessageTag.class,"org.apache.struts.taglib.bean.MessageTag key"); __jsp_taghandler_112.setParent(__jsp_taghandler_95); __jsp_taghandler_112.setKey("activos1.codfun"); __jsp_tag_starteval=__jsp_taghandler_112.doStartTag(); if (OracleJspRuntime.checkStartTagEval(__jsp_tag_starteval)) { do { } while (__jsp_taghandler_112.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); } if (__jsp_taghandler_112.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_112); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[123]); /*@lineinfo:translated-code*//*@lineinfo:227^10*/ { org.apache.struts.taglib.html.TextTag __jsp_taghandler_113=(org.apache.struts.taglib.html.TextTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.TextTag.class,"org.apache.struts.taglib.html.TextTag maxlength name onkeypress property readonly size"); __jsp_taghandler_113.setParent(__jsp_taghandler_95); __jsp_taghandler_113.setMaxlength("40"); __jsp_taghandler_113.setName("ActivosForm"); __jsp_taghandler_113.setOnkeypress("return handleEnter(this, event)"); __jsp_taghandler_113.setProperty("act_fundescripcion"); __jsp_taghandler_113.setReadonly(true); __jsp_taghandler_113.setSize("40"); __jsp_tag_starteval=__jsp_taghandler_113.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_113,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_113.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_113.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_113); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[124]); /*@lineinfo:translated-code*//*@lineinfo:231^27*/ { org.apache.struts.taglib.bean.MessageTag __jsp_taghandler_114=(org.apache.struts.taglib.bean.MessageTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.bean.MessageTag.class,"org.apache.struts.taglib.bean.MessageTag key"); __jsp_taghandler_114.setParent(__jsp_taghandler_95); __jsp_taghandler_114.setKey("activos1.codubi"); __jsp_tag_starteval=__jsp_taghandler_114.doStartTag(); if (OracleJspRuntime.checkStartTagEval(__jsp_tag_starteval)) { do { } while (__jsp_taghandler_114.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); } if (__jsp_taghandler_114.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_114); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[125]); /*@lineinfo:translated-code*//*@lineinfo:233^15*/ { org.apache.struts.taglib.html.TextTag __jsp_taghandler_115=(org.apache.struts.taglib.html.TextTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.TextTag.class,"org.apache.struts.taglib.html.TextTag maxlength name onkeypress property readonly size"); __jsp_taghandler_115.setParent(__jsp_taghandler_95); __jsp_taghandler_115.setMaxlength("40"); __jsp_taghandler_115.setName("ActivosForm"); __jsp_taghandler_115.setOnkeypress("return handleEnter(this, event)"); __jsp_taghandler_115.setProperty("act_ubidescripcion"); __jsp_taghandler_115.setReadonly(true); __jsp_taghandler_115.setSize("40"); __jsp_tag_starteval=__jsp_taghandler_115.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_115,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_115.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_115.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_115); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[126]); /*@lineinfo:translated-code*//*@lineinfo:235^27*/ { org.apache.struts.taglib.bean.MessageTag __jsp_taghandler_116=(org.apache.struts.taglib.bean.MessageTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.bean.MessageTag.class,"org.apache.struts.taglib.bean.MessageTag key"); __jsp_taghandler_116.setParent(__jsp_taghandler_95); __jsp_taghandler_116.setKey("activos1.codpry"); __jsp_tag_starteval=__jsp_taghandler_116.doStartTag(); if (OracleJspRuntime.checkStartTagEval(__jsp_tag_starteval)) { do { } while (__jsp_taghandler_116.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); } if (__jsp_taghandler_116.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_116); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[127]); /*@lineinfo:translated-code*//*@lineinfo:236^14*/ { org.apache.struts.taglib.html.SelectTag __jsp_taghandler_117=(org.apache.struts.taglib.html.SelectTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.SelectTag.class,"org.apache.struts.taglib.html.SelectTag disabled name property"); __jsp_taghandler_117.setParent(__jsp_taghandler_95); __jsp_taghandler_117.setDisabled(false); __jsp_taghandler_117.setName("ActivosForm"); __jsp_taghandler_117.setProperty("act_codpry"); __jsp_tag_starteval=__jsp_taghandler_117.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_117,__jsp_tag_starteval,out); do { /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[128]); /*@lineinfo:translated-code*//*@lineinfo:237^15*/ { org.apache.struts.taglib.html.OptionsTag __jsp_taghandler_118=(org.apache.struts.taglib.html.OptionsTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.OptionsTag.class,"org.apache.struts.taglib.html.OptionsTag collection labelProperty property"); __jsp_taghandler_118.setParent(__jsp_taghandler_117); __jsp_taghandler_118.setCollection("ProyectosLista"); __jsp_taghandler_118.setLabelProperty("descripcion"); __jsp_taghandler_118.setProperty("codigo"); __jsp_tag_starteval=__jsp_taghandler_118.doStartTag(); if (OracleJspRuntime.checkStartTagEval(__jsp_tag_starteval)) { do { } while (__jsp_taghandler_118.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); } if (__jsp_taghandler_118.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_118); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[129]); /*@lineinfo:translated-code*//*@lineinfo:237^104*/ } while (__jsp_taghandler_117.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_117.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_117); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[130]); /*@lineinfo:translated-code*//*@lineinfo:242^27*/ { org.apache.struts.taglib.bean.MessageTag __jsp_taghandler_119=(org.apache.struts.taglib.bean.MessageTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.bean.MessageTag.class,"org.apache.struts.taglib.bean.MessageTag key"); __jsp_taghandler_119.setParent(__jsp_taghandler_95); __jsp_taghandler_119.setKey("activos1.codfin"); __jsp_tag_starteval=__jsp_taghandler_119.doStartTag(); if (OracleJspRuntime.checkStartTagEval(__jsp_tag_starteval)) { do { } while (__jsp_taghandler_119.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); } if (__jsp_taghandler_119.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_119); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[131]); /*@lineinfo:translated-code*//*@lineinfo:244^15*/ { org.apache.struts.taglib.html.TextTag __jsp_taghandler_120=(org.apache.struts.taglib.html.TextTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.TextTag.class,"org.apache.struts.taglib.html.TextTag maxlength name onkeypress property readonly size"); __jsp_taghandler_120.setParent(__jsp_taghandler_95); __jsp_taghandler_120.setMaxlength("40"); __jsp_taghandler_120.setName("ActivosForm"); __jsp_taghandler_120.setOnkeypress("return handleEnter(this, event)"); __jsp_taghandler_120.setProperty("act_findescripcion"); __jsp_taghandler_120.setReadonly(true); __jsp_taghandler_120.setSize("40"); __jsp_tag_starteval=__jsp_taghandler_120.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_120,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_120.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_120.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_120); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[132]); /*@lineinfo:translated-code*//*@lineinfo:246^27*/ { org.apache.struts.taglib.bean.MessageTag __jsp_taghandler_121=(org.apache.struts.taglib.bean.MessageTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.bean.MessageTag.class,"org.apache.struts.taglib.bean.MessageTag key"); __jsp_taghandler_121.setParent(__jsp_taghandler_95); __jsp_taghandler_121.setKey("activos1.feccompra"); __jsp_tag_starteval=__jsp_taghandler_121.doStartTag(); if (OracleJspRuntime.checkStartTagEval(__jsp_tag_starteval)) { do { } while (__jsp_taghandler_121.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); } if (__jsp_taghandler_121.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_121); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[133]); /*@lineinfo:translated-code*//*@lineinfo:247^14*/ { org.apache.struts.taglib.html.TextTag __jsp_taghandler_122=(org.apache.struts.taglib.html.TextTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.TextTag.class,"org.apache.struts.taglib.html.TextTag maxlength name onkeypress property size"); __jsp_taghandler_122.setParent(__jsp_taghandler_95); __jsp_taghandler_122.setMaxlength("10"); __jsp_taghandler_122.setName("ActivosForm"); __jsp_taghandler_122.setOnkeypress("return handleEnter(this, event)"); __jsp_taghandler_122.setProperty("act_feccompra"); __jsp_taghandler_122.setSize("10"); __jsp_tag_starteval=__jsp_taghandler_122.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_122,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_122.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_122.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_122); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[134]); /*@lineinfo:translated-code*//*@lineinfo:252^27*/ { org.apache.struts.taglib.bean.MessageTag __jsp_taghandler_123=(org.apache.struts.taglib.bean.MessageTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.bean.MessageTag.class,"org.apache.struts.taglib.bean.MessageTag key"); __jsp_taghandler_123.setParent(__jsp_taghandler_95); __jsp_taghandler_123.setKey("activos1.umanejo"); __jsp_tag_starteval=__jsp_taghandler_123.doStartTag(); if (OracleJspRuntime.checkStartTagEval(__jsp_tag_starteval)) { do { } while (__jsp_taghandler_123.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); } if (__jsp_taghandler_123.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_123); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[135]); /*@lineinfo:translated-code*//*@lineinfo:253^14*/ { org.apache.struts.taglib.html.TextTag __jsp_taghandler_124=(org.apache.struts.taglib.html.TextTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.TextTag.class,"org.apache.struts.taglib.html.TextTag maxlength name onchange onkeypress property size"); __jsp_taghandler_124.setParent(__jsp_taghandler_95); __jsp_taghandler_124.setMaxlength("20"); __jsp_taghandler_124.setName("ActivosForm"); __jsp_taghandler_124.setOnchange("javascript:this.value=this.value.toUpperCase();"); __jsp_taghandler_124.setOnkeypress("return handleEnter(this, event)"); __jsp_taghandler_124.setProperty("act_umanejo"); __jsp_taghandler_124.setSize("20"); __jsp_tag_starteval=__jsp_taghandler_124.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_124,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_124.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_124.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_124); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[136]); /*@lineinfo:translated-code*//*@lineinfo:256^27*/ { org.apache.struts.taglib.bean.MessageTag __jsp_taghandler_125=(org.apache.struts.taglib.bean.MessageTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.bean.MessageTag.class,"org.apache.struts.taglib.bean.MessageTag key"); __jsp_taghandler_125.setParent(__jsp_taghandler_95); __jsp_taghandler_125.setKey("activos1.descripcion"); __jsp_tag_starteval=__jsp_taghandler_125.doStartTag(); if (OracleJspRuntime.checkStartTagEval(__jsp_tag_starteval)) { do { } while (__jsp_taghandler_125.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); } if (__jsp_taghandler_125.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_125); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[137]); /*@lineinfo:translated-code*//*@lineinfo:257^14*/ { org.apache.struts.taglib.html.TextTag __jsp_taghandler_126=(org.apache.struts.taglib.html.TextTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.TextTag.class,"org.apache.struts.taglib.html.TextTag maxlength name onchange onkeypress property size"); __jsp_taghandler_126.setParent(__jsp_taghandler_95); __jsp_taghandler_126.setMaxlength("120"); __jsp_taghandler_126.setName("ActivosForm"); __jsp_taghandler_126.setOnchange("javascript:this.value=this.value.toUpperCase();"); __jsp_taghandler_126.setOnkeypress("return handleEnter(this, event)"); __jsp_taghandler_126.setProperty("act_descripcion"); __jsp_taghandler_126.setSize("60"); __jsp_tag_starteval=__jsp_taghandler_126.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_126,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_126.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_126.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_126); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[138]); /*@lineinfo:translated-code*//*@lineinfo:260^27*/ { org.apache.struts.taglib.bean.MessageTag __jsp_taghandler_127=(org.apache.struts.taglib.bean.MessageTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.bean.MessageTag.class,"org.apache.struts.taglib.bean.MessageTag key"); __jsp_taghandler_127.setParent(__jsp_taghandler_95); __jsp_taghandler_127.setKey("activos1.desadicional"); __jsp_tag_starteval=__jsp_taghandler_127.doStartTag(); if (OracleJspRuntime.checkStartTagEval(__jsp_tag_starteval)) { do { } while (__jsp_taghandler_127.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); } if (__jsp_taghandler_127.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_127); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[139]); /*@lineinfo:translated-code*//*@lineinfo:261^14*/ { org.apache.struts.taglib.html.TextTag __jsp_taghandler_128=(org.apache.struts.taglib.html.TextTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.TextTag.class,"org.apache.struts.taglib.html.TextTag maxlength name onchange onkeypress property size"); __jsp_taghandler_128.setParent(__jsp_taghandler_95); __jsp_taghandler_128.setMaxlength("240"); __jsp_taghandler_128.setName("ActivosForm"); __jsp_taghandler_128.setOnchange("javascript:this.value=this.value.toUpperCase();"); __jsp_taghandler_128.setOnkeypress("return handleEnter(this, event)"); __jsp_taghandler_128.setProperty("act_desadicional"); __jsp_taghandler_128.setSize("60"); __jsp_tag_starteval=__jsp_taghandler_128.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_128,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_128.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_128.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_128); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[140]); /*@lineinfo:translated-code*//*@lineinfo:265^13*/ { org.apache.struts.taglib.bean.MessageTag __jsp_taghandler_129=(org.apache.struts.taglib.bean.MessageTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.bean.MessageTag.class,"org.apache.struts.taglib.bean.MessageTag key"); __jsp_taghandler_129.setParent(__jsp_taghandler_95); __jsp_taghandler_129.setKey("activos1.proveedor"); __jsp_tag_starteval=__jsp_taghandler_129.doStartTag(); if (OracleJspRuntime.checkStartTagEval(__jsp_tag_starteval)) { do { } while (__jsp_taghandler_129.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); } if (__jsp_taghandler_129.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_129); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[141]); /*@lineinfo:translated-code*//*@lineinfo:268^13*/ { org.apache.struts.taglib.html.TextTag __jsp_taghandler_130=(org.apache.struts.taglib.html.TextTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.TextTag.class,"org.apache.struts.taglib.html.TextTag maxlength name onchange onkeypress property size"); __jsp_taghandler_130.setParent(__jsp_taghandler_95); __jsp_taghandler_130.setMaxlength("50"); __jsp_taghandler_130.setName("ActivosForm"); __jsp_taghandler_130.setOnchange("javascript:this.value=this.value.toUpperCase();"); __jsp_taghandler_130.setOnkeypress("return handleEnter(this, event)"); __jsp_taghandler_130.setProperty("act_proveedor"); __jsp_taghandler_130.setSize("50"); __jsp_tag_starteval=__jsp_taghandler_130.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_130,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_130.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_130.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_130); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[142]); /*@lineinfo:translated-code*//*@lineinfo:272^27*/ { org.apache.struts.taglib.logic.EqualTag __jsp_taghandler_131=(org.apache.struts.taglib.logic.EqualTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.logic.EqualTag.class,"org.apache.struts.taglib.logic.EqualTag name property value"); __jsp_taghandler_131.setParent(__jsp_taghandler_95); __jsp_taghandler_131.setName("ActivosForm"); __jsp_taghandler_131.setProperty("act_codrub"); __jsp_taghandler_131.setValue("01"); __jsp_tag_starteval=__jsp_taghandler_131.doStartTag(); if (OracleJspRuntime.checkStartTagEval(__jsp_tag_starteval)) { do { /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[143]); /*@lineinfo:translated-code*//*@lineinfo:272^92*/ } while (__jsp_taghandler_131.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); } if (__jsp_taghandler_131.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_131); } /*@lineinfo:272^107*/ { org.apache.struts.taglib.bean.MessageTag __jsp_taghandler_132=(org.apache.struts.taglib.bean.MessageTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.bean.MessageTag.class,"org.apache.struts.taglib.bean.MessageTag key"); __jsp_taghandler_132.setParent(__jsp_taghandler_95); __jsp_taghandler_132.setKey("activos1.accesorios"); __jsp_tag_starteval=__jsp_taghandler_132.doStartTag(); if (OracleJspRuntime.checkStartTagEval(__jsp_tag_starteval)) { do { } while (__jsp_taghandler_132.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); } if (__jsp_taghandler_132.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_132); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[144]); /*@lineinfo:translated-code*//*@lineinfo:273^14*/ { org.apache.struts.taglib.html.TextTag __jsp_taghandler_133=(org.apache.struts.taglib.html.TextTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.TextTag.class,"org.apache.struts.taglib.html.TextTag maxlength name onchange onkeypress property size"); __jsp_taghandler_133.setParent(__jsp_taghandler_95); __jsp_taghandler_133.setMaxlength("60"); __jsp_taghandler_133.setName("ActivosForm"); __jsp_taghandler_133.setOnchange("javascript:this.value=this.value.toUpperCase();"); __jsp_taghandler_133.setOnkeypress("return handleEnter(this, event)"); __jsp_taghandler_133.setProperty("act_accesorios"); __jsp_taghandler_133.setSize("60"); __jsp_tag_starteval=__jsp_taghandler_133.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_133,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_133.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_133.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_133); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[145]); /*@lineinfo:translated-code*//*@lineinfo:278^27*/ { org.apache.struts.taglib.bean.MessageTag __jsp_taghandler_134=(org.apache.struts.taglib.bean.MessageTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.bean.MessageTag.class,"org.apache.struts.taglib.bean.MessageTag key"); __jsp_taghandler_134.setParent(__jsp_taghandler_95); __jsp_taghandler_134.setKey("activos1.serie1"); __jsp_tag_starteval=__jsp_taghandler_134.doStartTag(); if (OracleJspRuntime.checkStartTagEval(__jsp_tag_starteval)) { do { } while (__jsp_taghandler_134.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); } if (__jsp_taghandler_134.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_134); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[146]); /*@lineinfo:translated-code*//*@lineinfo:279^14*/ { org.apache.struts.taglib.html.TextTag __jsp_taghandler_135=(org.apache.struts.taglib.html.TextTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.TextTag.class,"org.apache.struts.taglib.html.TextTag maxlength name onchange onkeypress property size"); __jsp_taghandler_135.setParent(__jsp_taghandler_95); __jsp_taghandler_135.setMaxlength("30"); __jsp_taghandler_135.setName("ActivosForm"); __jsp_taghandler_135.setOnchange("javascript:this.value=this.value.toUpperCase();"); __jsp_taghandler_135.setOnkeypress("return handleEnter(this, event)"); __jsp_taghandler_135.setProperty("act_serie1"); __jsp_taghandler_135.setSize("30"); __jsp_tag_starteval=__jsp_taghandler_135.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_135,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_135.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_135.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_135); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[147]); /*@lineinfo:translated-code*//*@lineinfo:280^27*/ { org.apache.struts.taglib.bean.MessageTag __jsp_taghandler_136=(org.apache.struts.taglib.bean.MessageTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.bean.MessageTag.class,"org.apache.struts.taglib.bean.MessageTag key"); __jsp_taghandler_136.setParent(__jsp_taghandler_95); __jsp_taghandler_136.setKey("activos1.serie2"); __jsp_tag_starteval=__jsp_taghandler_136.doStartTag(); if (OracleJspRuntime.checkStartTagEval(__jsp_tag_starteval)) { do { } while (__jsp_taghandler_136.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); } if (__jsp_taghandler_136.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_136); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[148]); /*@lineinfo:translated-code*//*@lineinfo:281^14*/ { org.apache.struts.taglib.html.TextTag __jsp_taghandler_137=(org.apache.struts.taglib.html.TextTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.TextTag.class,"org.apache.struts.taglib.html.TextTag maxlength name onchange onkeypress property size"); __jsp_taghandler_137.setParent(__jsp_taghandler_95); __jsp_taghandler_137.setMaxlength("30"); __jsp_taghandler_137.setName("ActivosForm"); __jsp_taghandler_137.setOnchange("javascript:this.value=this.value.toUpperCase();"); __jsp_taghandler_137.setOnkeypress("return handleEnter(this, event)"); __jsp_taghandler_137.setProperty("act_serie2"); __jsp_taghandler_137.setSize("30"); __jsp_tag_starteval=__jsp_taghandler_137.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_137,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_137.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_137.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_137); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[149]); /*@lineinfo:translated-code*//*@lineinfo:284^27*/ { org.apache.struts.taglib.bean.MessageTag __jsp_taghandler_138=(org.apache.struts.taglib.bean.MessageTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.bean.MessageTag.class,"org.apache.struts.taglib.bean.MessageTag key"); __jsp_taghandler_138.setParent(__jsp_taghandler_95); __jsp_taghandler_138.setKey("activos1.docreferencia"); __jsp_tag_starteval=__jsp_taghandler_138.doStartTag(); if (OracleJspRuntime.checkStartTagEval(__jsp_tag_starteval)) { do { } while (__jsp_taghandler_138.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); } if (__jsp_taghandler_138.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_138); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[150]); /*@lineinfo:translated-code*//*@lineinfo:285^14*/ { org.apache.struts.taglib.html.TextTag __jsp_taghandler_139=(org.apache.struts.taglib.html.TextTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.TextTag.class,"org.apache.struts.taglib.html.TextTag maxlength name onchange onkeypress property size"); __jsp_taghandler_139.setParent(__jsp_taghandler_95); __jsp_taghandler_139.setMaxlength("30"); __jsp_taghandler_139.setName("ActivosForm"); __jsp_taghandler_139.setOnchange("javascript:this.value=this.value.toUpperCase();"); __jsp_taghandler_139.setOnkeypress("return handleEnter(this, event)"); __jsp_taghandler_139.setProperty("act_docreferencia"); __jsp_taghandler_139.setSize("30"); __jsp_tag_starteval=__jsp_taghandler_139.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_139,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_139.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_139.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_139); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[151]); /*@lineinfo:translated-code*//*@lineinfo:286^27*/ { org.apache.struts.taglib.bean.MessageTag __jsp_taghandler_140=(org.apache.struts.taglib.bean.MessageTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.bean.MessageTag.class,"org.apache.struts.taglib.bean.MessageTag key"); __jsp_taghandler_140.setParent(__jsp_taghandler_95); __jsp_taghandler_140.setKey("activos1.fecreferencia"); __jsp_tag_starteval=__jsp_taghandler_140.doStartTag(); if (OracleJspRuntime.checkStartTagEval(__jsp_tag_starteval)) { do { } while (__jsp_taghandler_140.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); } if (__jsp_taghandler_140.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_140); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[152]); /*@lineinfo:translated-code*//*@lineinfo:287^14*/ { org.apache.struts.taglib.html.TextTag __jsp_taghandler_141=(org.apache.struts.taglib.html.TextTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.TextTag.class,"org.apache.struts.taglib.html.TextTag maxlength name property size"); __jsp_taghandler_141.setParent(__jsp_taghandler_95); __jsp_taghandler_141.setMaxlength("10"); __jsp_taghandler_141.setName("ActivosForm"); __jsp_taghandler_141.setProperty("act_fecreferencia"); __jsp_taghandler_141.setSize("10"); __jsp_tag_starteval=__jsp_taghandler_141.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_141,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_141.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_141.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_141); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[153]); /*@lineinfo:translated-code*//*@lineinfo:290^27*/ { org.apache.struts.taglib.bean.MessageTag __jsp_taghandler_142=(org.apache.struts.taglib.bean.MessageTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.bean.MessageTag.class,"org.apache.struts.taglib.bean.MessageTag key"); __jsp_taghandler_142.setParent(__jsp_taghandler_95); __jsp_taghandler_142.setKey("activos1.procedencia"); __jsp_tag_starteval=__jsp_taghandler_142.doStartTag(); if (OracleJspRuntime.checkStartTagEval(__jsp_tag_starteval)) { do { } while (__jsp_taghandler_142.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); } if (__jsp_taghandler_142.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_142); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[154]); /*@lineinfo:translated-code*//*@lineinfo:291^14*/ { org.apache.struts.taglib.html.TextTag __jsp_taghandler_143=(org.apache.struts.taglib.html.TextTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.TextTag.class,"org.apache.struts.taglib.html.TextTag maxlength name onchange onkeypress property size"); __jsp_taghandler_143.setParent(__jsp_taghandler_95); __jsp_taghandler_143.setMaxlength("30"); __jsp_taghandler_143.setName("ActivosForm"); __jsp_taghandler_143.setOnchange("javascript:this.value=this.value.toUpperCase();"); __jsp_taghandler_143.setOnkeypress("return handleEnter(this, event)"); __jsp_taghandler_143.setProperty("act_procedencia"); __jsp_taghandler_143.setSize("30"); __jsp_tag_starteval=__jsp_taghandler_143.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_143,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_143.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_143.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_143); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[155]); /*@lineinfo:translated-code*//*@lineinfo:292^27*/ { org.apache.struts.taglib.bean.MessageTag __jsp_taghandler_144=(org.apache.struts.taglib.bean.MessageTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.bean.MessageTag.class,"org.apache.struts.taglib.bean.MessageTag key"); __jsp_taghandler_144.setParent(__jsp_taghandler_95); __jsp_taghandler_144.setKey("activos1.gobmunicipal"); __jsp_tag_starteval=__jsp_taghandler_144.doStartTag(); if (OracleJspRuntime.checkStartTagEval(__jsp_tag_starteval)) { do { } while (__jsp_taghandler_144.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); } if (__jsp_taghandler_144.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_144); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[156]); /*@lineinfo:translated-code*//*@lineinfo:293^14*/ { org.apache.struts.taglib.html.TextTag __jsp_taghandler_145=(org.apache.struts.taglib.html.TextTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.TextTag.class,"org.apache.struts.taglib.html.TextTag maxlength name onchange onkeypress property size"); __jsp_taghandler_145.setParent(__jsp_taghandler_95); __jsp_taghandler_145.setMaxlength("30"); __jsp_taghandler_145.setName("ActivosForm"); __jsp_taghandler_145.setOnchange("javascript:this.value=this.value.toUpperCase();"); __jsp_taghandler_145.setOnkeypress("return handleEnter(this, event)"); __jsp_taghandler_145.setProperty("act_gobmunicipal"); __jsp_taghandler_145.setSize("30"); __jsp_tag_starteval=__jsp_taghandler_145.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_145,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_145.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_145.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_145); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[157]); /*@lineinfo:translated-code*//*@lineinfo:296^27*/ { org.apache.struts.taglib.bean.MessageTag __jsp_taghandler_146=(org.apache.struts.taglib.bean.MessageTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.bean.MessageTag.class,"org.apache.struts.taglib.bean.MessageTag key"); __jsp_taghandler_146.setParent(__jsp_taghandler_95); __jsp_taghandler_146.setKey("activos1.valcobol"); __jsp_tag_starteval=__jsp_taghandler_146.doStartTag(); if (OracleJspRuntime.checkStartTagEval(__jsp_tag_starteval)) { do { } while (__jsp_taghandler_146.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); } if (__jsp_taghandler_146.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_146); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[158]); /*@lineinfo:translated-code*//*@lineinfo:297^14*/ { org.apache.struts.taglib.html.TextTag __jsp_taghandler_147=(org.apache.struts.taglib.html.TextTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.TextTag.class,"org.apache.struts.taglib.html.TextTag maxlength name onkeypress property size"); __jsp_taghandler_147.setParent(__jsp_taghandler_95); __jsp_taghandler_147.setMaxlength("13"); __jsp_taghandler_147.setName("ActivosForm"); __jsp_taghandler_147.setOnkeypress("return handleEnter(this, event)"); __jsp_taghandler_147.setProperty("act_valcobol"); __jsp_taghandler_147.setSize("13"); __jsp_tag_starteval=__jsp_taghandler_147.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_147,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_147.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_147.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_147); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[159]); /*@lineinfo:translated-code*//*@lineinfo:298^27*/ { org.apache.struts.taglib.bean.MessageTag __jsp_taghandler_148=(org.apache.struts.taglib.bean.MessageTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.bean.MessageTag.class,"org.apache.struts.taglib.bean.MessageTag key"); __jsp_taghandler_148.setParent(__jsp_taghandler_95); __jsp_taghandler_148.setKey("activos1.ordencompra"); __jsp_tag_starteval=__jsp_taghandler_148.doStartTag(); if (OracleJspRuntime.checkStartTagEval(__jsp_tag_starteval)) { do { } while (__jsp_taghandler_148.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); } if (__jsp_taghandler_148.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_148); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[160]); /*@lineinfo:translated-code*//*@lineinfo:299^14*/ { org.apache.struts.taglib.html.TextTag __jsp_taghandler_149=(org.apache.struts.taglib.html.TextTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.TextTag.class,"org.apache.struts.taglib.html.TextTag maxlength name onkeypress property size"); __jsp_taghandler_149.setParent(__jsp_taghandler_95); __jsp_taghandler_149.setMaxlength("20"); __jsp_taghandler_149.setName("ActivosForm"); __jsp_taghandler_149.setOnkeypress("return handleEnter(this, event)"); __jsp_taghandler_149.setProperty("act_ordencompra"); __jsp_taghandler_149.setSize("20"); __jsp_tag_starteval=__jsp_taghandler_149.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_149,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_149.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_149.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_149); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[161]); /*@lineinfo:translated-code*//*@lineinfo:302^27*/ { org.apache.struts.taglib.bean.MessageTag __jsp_taghandler_150=(org.apache.struts.taglib.bean.MessageTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.bean.MessageTag.class,"org.apache.struts.taglib.bean.MessageTag key"); __jsp_taghandler_150.setParent(__jsp_taghandler_95); __jsp_taghandler_150.setKey("activos1.numfactura"); __jsp_tag_starteval=__jsp_taghandler_150.doStartTag(); if (OracleJspRuntime.checkStartTagEval(__jsp_tag_starteval)) { do { } while (__jsp_taghandler_150.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); } if (__jsp_taghandler_150.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_150); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[162]); /*@lineinfo:translated-code*//*@lineinfo:303^14*/ { org.apache.struts.taglib.html.TextTag __jsp_taghandler_151=(org.apache.struts.taglib.html.TextTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.TextTag.class,"org.apache.struts.taglib.html.TextTag maxlength name onkeypress property size"); __jsp_taghandler_151.setParent(__jsp_taghandler_95); __jsp_taghandler_151.setMaxlength("12"); __jsp_taghandler_151.setName("ActivosForm"); __jsp_taghandler_151.setOnkeypress("return handleEnter(this, event)"); __jsp_taghandler_151.setProperty("act_numfactura"); __jsp_taghandler_151.setSize("12"); __jsp_tag_starteval=__jsp_taghandler_151.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_151,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_151.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_151.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_151); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[163]); /*@lineinfo:translated-code*//*@lineinfo:304^27*/ { org.apache.struts.taglib.bean.MessageTag __jsp_taghandler_152=(org.apache.struts.taglib.bean.MessageTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.bean.MessageTag.class,"org.apache.struts.taglib.bean.MessageTag key"); __jsp_taghandler_152.setParent(__jsp_taghandler_95); __jsp_taghandler_152.setKey("activos1.numcomprobante"); __jsp_tag_starteval=__jsp_taghandler_152.doStartTag(); if (OracleJspRuntime.checkStartTagEval(__jsp_tag_starteval)) { do { } while (__jsp_taghandler_152.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); } if (__jsp_taghandler_152.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_152); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[164]); /*@lineinfo:translated-code*//*@lineinfo:305^14*/ { org.apache.struts.taglib.html.TextTag __jsp_taghandler_153=(org.apache.struts.taglib.html.TextTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.TextTag.class,"org.apache.struts.taglib.html.TextTag maxlength name onkeypress property size"); __jsp_taghandler_153.setParent(__jsp_taghandler_95); __jsp_taghandler_153.setMaxlength("20"); __jsp_taghandler_153.setName("ActivosForm"); __jsp_taghandler_153.setOnkeypress("return handleEnter(this, event)"); __jsp_taghandler_153.setProperty("act_numcomprobante"); __jsp_taghandler_153.setSize("20"); __jsp_tag_starteval=__jsp_taghandler_153.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_153,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_153.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_153.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_153); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[165]); /*@lineinfo:translated-code*//*@lineinfo:308^27*/ { org.apache.struts.taglib.bean.MessageTag __jsp_taghandler_154=(org.apache.struts.taglib.bean.MessageTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.bean.MessageTag.class,"org.apache.struts.taglib.bean.MessageTag key"); __jsp_taghandler_154.setParent(__jsp_taghandler_95); __jsp_taghandler_154.setKey("activos1.codanterior"); __jsp_tag_starteval=__jsp_taghandler_154.doStartTag(); if (OracleJspRuntime.checkStartTagEval(__jsp_tag_starteval)) { do { } while (__jsp_taghandler_154.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); } if (__jsp_taghandler_154.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_154); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[166]); /*@lineinfo:translated-code*//*@lineinfo:309^14*/ { org.apache.struts.taglib.html.TextTag __jsp_taghandler_155=(org.apache.struts.taglib.html.TextTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.TextTag.class,"org.apache.struts.taglib.html.TextTag maxlength name onchange onkeypress property size"); __jsp_taghandler_155.setParent(__jsp_taghandler_95); __jsp_taghandler_155.setMaxlength("20"); __jsp_taghandler_155.setName("ActivosForm"); __jsp_taghandler_155.setOnchange("javascript:this.value=this.value.toUpperCase();"); __jsp_taghandler_155.setOnkeypress("return handleEnter(this, event)"); __jsp_taghandler_155.setProperty("act_codanterior"); __jsp_taghandler_155.setSize("20"); __jsp_tag_starteval=__jsp_taghandler_155.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_155,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_155.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_155.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_155); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[167]); /*@lineinfo:translated-code*//*@lineinfo:310^27*/ { org.apache.struts.taglib.bean.MessageTag __jsp_taghandler_156=(org.apache.struts.taglib.bean.MessageTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.bean.MessageTag.class,"org.apache.struts.taglib.bean.MessageTag key"); __jsp_taghandler_156.setParent(__jsp_taghandler_95); __jsp_taghandler_156.setKey("activos1.fecha"); __jsp_tag_starteval=__jsp_taghandler_156.doStartTag(); if (OracleJspRuntime.checkStartTagEval(__jsp_tag_starteval)) { do { } while (__jsp_taghandler_156.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); } if (__jsp_taghandler_156.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_156); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[168]); /*@lineinfo:translated-code*//*@lineinfo:311^14*/ { org.apache.struts.taglib.html.TextTag __jsp_taghandler_157=(org.apache.struts.taglib.html.TextTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.TextTag.class,"org.apache.struts.taglib.html.TextTag maxlength name onkeypress property size"); __jsp_taghandler_157.setParent(__jsp_taghandler_95); __jsp_taghandler_157.setMaxlength("10"); __jsp_taghandler_157.setName("ActivosForm"); __jsp_taghandler_157.setOnkeypress("return handleEnter(this, event)"); __jsp_taghandler_157.setProperty("rev_fecha"); __jsp_taghandler_157.setSize("10"); __jsp_tag_starteval=__jsp_taghandler_157.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_157,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_157.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_157.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_157); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[169]); /*@lineinfo:translated-code*//*@lineinfo:314^27*/ { org.apache.struts.taglib.bean.MessageTag __jsp_taghandler_158=(org.apache.struts.taglib.bean.MessageTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.bean.MessageTag.class,"org.apache.struts.taglib.bean.MessageTag key"); __jsp_taghandler_158.setParent(__jsp_taghandler_95); __jsp_taghandler_158.setKey("activos1.vidaut"); __jsp_tag_starteval=__jsp_taghandler_158.doStartTag(); if (OracleJspRuntime.checkStartTagEval(__jsp_tag_starteval)) { do { } while (__jsp_taghandler_158.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); } if (__jsp_taghandler_158.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_158); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[170]); /*@lineinfo:translated-code*//*@lineinfo:315^14*/ { org.apache.struts.taglib.html.TextTag __jsp_taghandler_159=(org.apache.struts.taglib.html.TextTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.TextTag.class,"org.apache.struts.taglib.html.TextTag maxlength name onkeypress property readonly size"); __jsp_taghandler_159.setParent(__jsp_taghandler_95); __jsp_taghandler_159.setMaxlength("4"); __jsp_taghandler_159.setName("ActivosForm"); __jsp_taghandler_159.setOnkeypress("return handleEnter(this, event)"); __jsp_taghandler_159.setProperty("rev_vidaut"); __jsp_taghandler_159.setReadonly(true); __jsp_taghandler_159.setSize("4"); __jsp_tag_starteval=__jsp_taghandler_159.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_159,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_159.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_159.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_159); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[171]); /*@lineinfo:translated-code*//*@lineinfo:316^27*/ { org.apache.struts.taglib.bean.MessageTag __jsp_taghandler_160=(org.apache.struts.taglib.bean.MessageTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.bean.MessageTag.class,"org.apache.struts.taglib.bean.MessageTag key"); __jsp_taghandler_160.setParent(__jsp_taghandler_95); __jsp_taghandler_160.setKey("activos1.estadoactivo"); __jsp_tag_starteval=__jsp_taghandler_160.doStartTag(); if (OracleJspRuntime.checkStartTagEval(__jsp_tag_starteval)) { do { } while (__jsp_taghandler_160.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); } if (__jsp_taghandler_160.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_160); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[172]); /*@lineinfo:translated-code*//*@lineinfo:317^14*/ { org.apache.struts.taglib.html.SelectTag __jsp_taghandler_161=(org.apache.struts.taglib.html.SelectTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.SelectTag.class,"org.apache.struts.taglib.html.SelectTag disabled name onkeypress property"); __jsp_taghandler_161.setParent(__jsp_taghandler_95); __jsp_taghandler_161.setDisabled(false); __jsp_taghandler_161.setName("ActivosForm"); __jsp_taghandler_161.setOnkeypress("return handleEnter(this, event)"); __jsp_taghandler_161.setProperty("rev_estadoactivo"); __jsp_tag_starteval=__jsp_taghandler_161.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_161,__jsp_tag_starteval,out); do { /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[173]); /*@lineinfo:translated-code*//*@lineinfo:318^14*/ { org.apache.struts.taglib.html.OptionsTag __jsp_taghandler_162=(org.apache.struts.taglib.html.OptionsTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.OptionsTag.class,"org.apache.struts.taglib.html.OptionsTag collection labelProperty property"); __jsp_taghandler_162.setParent(__jsp_taghandler_161); __jsp_taghandler_162.setCollection("EstadosLista"); __jsp_taghandler_162.setLabelProperty("desestado"); __jsp_taghandler_162.setProperty("estado"); __jsp_tag_starteval=__jsp_taghandler_162.doStartTag(); if (OracleJspRuntime.checkStartTagEval(__jsp_tag_starteval)) { do { } while (__jsp_taghandler_162.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); } if (__jsp_taghandler_162.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_162); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[174]); /*@lineinfo:translated-code*//*@lineinfo:318^100*/ } while (__jsp_taghandler_161.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_161.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_161); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[175]); /*@lineinfo:translated-code*//*@lineinfo:323^27*/ { org.apache.struts.taglib.bean.MessageTag __jsp_taghandler_163=(org.apache.struts.taglib.bean.MessageTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.bean.MessageTag.class,"org.apache.struts.taglib.bean.MessageTag key"); __jsp_taghandler_163.setParent(__jsp_taghandler_95); __jsp_taghandler_163.setKey("activos1.desestado"); __jsp_tag_starteval=__jsp_taghandler_163.doStartTag(); if (OracleJspRuntime.checkStartTagEval(__jsp_tag_starteval)) { do { } while (__jsp_taghandler_163.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); } if (__jsp_taghandler_163.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_163); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[176]); /*@lineinfo:translated-code*//*@lineinfo:324^14*/ { org.apache.struts.taglib.html.TextTag __jsp_taghandler_164=(org.apache.struts.taglib.html.TextTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.TextTag.class,"org.apache.struts.taglib.html.TextTag maxlength name onchange onkeypress property size"); __jsp_taghandler_164.setParent(__jsp_taghandler_95); __jsp_taghandler_164.setMaxlength("60"); __jsp_taghandler_164.setName("ActivosForm"); __jsp_taghandler_164.setOnchange("javascript:this.value=this.value.toUpperCase();"); __jsp_taghandler_164.setOnkeypress("return handleEnter(this, event)"); __jsp_taghandler_164.setProperty("rev_desestado"); __jsp_taghandler_164.setSize("60"); __jsp_tag_starteval=__jsp_taghandler_164.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_164,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_164.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_164.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_164); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[177]); /*@lineinfo:translated-code*//*@lineinfo:327^24*/ { org.apache.struts.taglib.html.SubmitTag __jsp_taghandler_165=(org.apache.struts.taglib.html.SubmitTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.SubmitTag.class,"org.apache.struts.taglib.html.SubmitTag onclick property styleClass value"); __jsp_taghandler_165.setParent(__jsp_taghandler_95); __jsp_taghandler_165.setOnclick("operacion.value=2;opcion.value=2"); __jsp_taghandler_165.setProperty("boton"); __jsp_taghandler_165.setStyleClass("boton1"); __jsp_taghandler_165.setValue("Modificar"); __jsp_tag_starteval=__jsp_taghandler_165.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_165,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_165.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_165.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_165); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[178]); /*@lineinfo:translated-code*//*@lineinfo:327^137*/ } while (__jsp_taghandler_95.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); } if (__jsp_taghandler_95.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_95); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[179]); /*@lineinfo:translated-code*//*@lineinfo:331^4*/ { org.apache.struts.taglib.logic.EqualTag __jsp_taghandler_166=(org.apache.struts.taglib.logic.EqualTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.logic.EqualTag.class,"org.apache.struts.taglib.logic.EqualTag name property value"); __jsp_taghandler_166.setParent(__jsp_taghandler_4); __jsp_taghandler_166.setName("ActivosForm"); __jsp_taghandler_166.setProperty("opcion"); __jsp_taghandler_166.setValue("3"); __jsp_tag_starteval=__jsp_taghandler_166.doStartTag(); if (OracleJspRuntime.checkStartTagEval(__jsp_tag_starteval)) { do { /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[180]); /*@lineinfo:translated-code*//*@lineinfo:334^27*/ { org.apache.struts.taglib.bean.MessageTag __jsp_taghandler_167=(org.apache.struts.taglib.bean.MessageTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.bean.MessageTag.class,"org.apache.struts.taglib.bean.MessageTag key"); __jsp_taghandler_167.setParent(__jsp_taghandler_166); __jsp_taghandler_167.setKey("activos1.codrub"); __jsp_tag_starteval=__jsp_taghandler_167.doStartTag(); if (OracleJspRuntime.checkStartTagEval(__jsp_tag_starteval)) { do { } while (__jsp_taghandler_167.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); } if (__jsp_taghandler_167.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_167); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[181]); /*@lineinfo:translated-code*//*@lineinfo:335^26*/ { org.apache.struts.taglib.html.TextTag __jsp_taghandler_168=(org.apache.struts.taglib.html.TextTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.TextTag.class,"org.apache.struts.taglib.html.TextTag maxlength name property readonly size"); __jsp_taghandler_168.setParent(__jsp_taghandler_166); __jsp_taghandler_168.setMaxlength("10"); __jsp_taghandler_168.setName("ActivosForm"); __jsp_taghandler_168.setProperty("act_codrub"); __jsp_taghandler_168.setReadonly(true); __jsp_taghandler_168.setSize("10"); __jsp_tag_starteval=__jsp_taghandler_168.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_168,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_168.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_168.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_168); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[182]); /*@lineinfo:translated-code*//*@lineinfo:336^10*/ { org.apache.struts.taglib.html.TextTag __jsp_taghandler_169=(org.apache.struts.taglib.html.TextTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.TextTag.class,"org.apache.struts.taglib.html.TextTag maxlength name property readonly size"); __jsp_taghandler_169.setParent(__jsp_taghandler_166); __jsp_taghandler_169.setMaxlength("60"); __jsp_taghandler_169.setName("ActivosForm"); __jsp_taghandler_169.setProperty("act_rubdescripcion"); __jsp_taghandler_169.setReadonly(true); __jsp_taghandler_169.setSize("60"); __jsp_tag_starteval=__jsp_taghandler_169.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_169,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_169.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_169.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_169); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[183]); /*@lineinfo:translated-code*//*@lineinfo:339^27*/ { org.apache.struts.taglib.bean.MessageTag __jsp_taghandler_170=(org.apache.struts.taglib.bean.MessageTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.bean.MessageTag.class,"org.apache.struts.taglib.bean.MessageTag key"); __jsp_taghandler_170.setParent(__jsp_taghandler_166); __jsp_taghandler_170.setKey("activos1.codreg"); __jsp_tag_starteval=__jsp_taghandler_170.doStartTag(); if (OracleJspRuntime.checkStartTagEval(__jsp_tag_starteval)) { do { } while (__jsp_taghandler_170.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); } if (__jsp_taghandler_170.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_170); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[184]); /*@lineinfo:translated-code*//*@lineinfo:340^26*/ { org.apache.struts.taglib.html.TextTag __jsp_taghandler_171=(org.apache.struts.taglib.html.TextTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.TextTag.class,"org.apache.struts.taglib.html.TextTag maxlength name property readonly size"); __jsp_taghandler_171.setParent(__jsp_taghandler_166); __jsp_taghandler_171.setMaxlength("10"); __jsp_taghandler_171.setName("ActivosForm"); __jsp_taghandler_171.setProperty("act_codreg"); __jsp_taghandler_171.setReadonly(true); __jsp_taghandler_171.setSize("10"); __jsp_tag_starteval=__jsp_taghandler_171.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_171,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_171.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_171.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_171); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[185]); /*@lineinfo:translated-code*//*@lineinfo:341^10*/ { org.apache.struts.taglib.html.TextTag __jsp_taghandler_172=(org.apache.struts.taglib.html.TextTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.TextTag.class,"org.apache.struts.taglib.html.TextTag maxlength name property readonly size"); __jsp_taghandler_172.setParent(__jsp_taghandler_166); __jsp_taghandler_172.setMaxlength("60"); __jsp_taghandler_172.setName("ActivosForm"); __jsp_taghandler_172.setProperty("act_regdescripcion"); __jsp_taghandler_172.setReadonly(true); __jsp_taghandler_172.setSize("60"); __jsp_tag_starteval=__jsp_taghandler_172.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_172,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_172.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_172.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_172); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[186]); /*@lineinfo:translated-code*//*@lineinfo:344^27*/ { org.apache.struts.taglib.bean.MessageTag __jsp_taghandler_173=(org.apache.struts.taglib.bean.MessageTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.bean.MessageTag.class,"org.apache.struts.taglib.bean.MessageTag key"); __jsp_taghandler_173.setParent(__jsp_taghandler_166); __jsp_taghandler_173.setKey("activos1.codigo"); __jsp_tag_starteval=__jsp_taghandler_173.doStartTag(); if (OracleJspRuntime.checkStartTagEval(__jsp_tag_starteval)) { do { } while (__jsp_taghandler_173.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); } if (__jsp_taghandler_173.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_173); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[187]); /*@lineinfo:translated-code*//*@lineinfo:345^26*/ { org.apache.struts.taglib.html.TextTag __jsp_taghandler_174=(org.apache.struts.taglib.html.TextTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.TextTag.class,"org.apache.struts.taglib.html.TextTag maxlength name property readonly size"); __jsp_taghandler_174.setParent(__jsp_taghandler_166); __jsp_taghandler_174.setMaxlength("5"); __jsp_taghandler_174.setName("ActivosForm"); __jsp_taghandler_174.setProperty("act_codigo"); __jsp_taghandler_174.setReadonly(true); __jsp_taghandler_174.setSize("5"); __jsp_tag_starteval=__jsp_taghandler_174.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_174,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_174.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_174.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_174); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[188]); /*@lineinfo:translated-code*//*@lineinfo:346^10*/ { org.apache.struts.taglib.html.TextTag __jsp_taghandler_175=(org.apache.struts.taglib.html.TextTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.TextTag.class,"org.apache.struts.taglib.html.TextTag maxlength name property readonly size"); __jsp_taghandler_175.setParent(__jsp_taghandler_166); __jsp_taghandler_175.setMaxlength("10"); __jsp_taghandler_175.setName("ActivosForm"); __jsp_taghandler_175.setProperty("act_codbarra"); __jsp_taghandler_175.setReadonly(true); __jsp_taghandler_175.setSize("10"); __jsp_tag_starteval=__jsp_taghandler_175.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_175,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_175.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_175.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_175); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[189]); /*@lineinfo:translated-code*//*@lineinfo:349^27*/ { org.apache.struts.taglib.bean.MessageTag __jsp_taghandler_176=(org.apache.struts.taglib.bean.MessageTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.bean.MessageTag.class,"org.apache.struts.taglib.bean.MessageTag key"); __jsp_taghandler_176.setParent(__jsp_taghandler_166); __jsp_taghandler_176.setKey("activos1.codgrp"); __jsp_tag_starteval=__jsp_taghandler_176.doStartTag(); if (OracleJspRuntime.checkStartTagEval(__jsp_tag_starteval)) { do { } while (__jsp_taghandler_176.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); } if (__jsp_taghandler_176.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_176); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[190]); /*@lineinfo:translated-code*//*@lineinfo:351^14*/ { org.apache.struts.taglib.html.TextTag __jsp_taghandler_177=(org.apache.struts.taglib.html.TextTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.TextTag.class,"org.apache.struts.taglib.html.TextTag maxlength name property readonly size"); __jsp_taghandler_177.setParent(__jsp_taghandler_166); __jsp_taghandler_177.setMaxlength("40"); __jsp_taghandler_177.setName("ActivosForm"); __jsp_taghandler_177.setProperty("act_grpdescripcion"); __jsp_taghandler_177.setReadonly(true); __jsp_taghandler_177.setSize("40"); __jsp_tag_starteval=__jsp_taghandler_177.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_177,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_177.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_177.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_177); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[191]); /*@lineinfo:translated-code*//*@lineinfo:353^27*/ { org.apache.struts.taglib.bean.MessageTag __jsp_taghandler_178=(org.apache.struts.taglib.bean.MessageTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.bean.MessageTag.class,"org.apache.struts.taglib.bean.MessageTag key"); __jsp_taghandler_178.setParent(__jsp_taghandler_166); __jsp_taghandler_178.setKey("activos1.codpar"); __jsp_tag_starteval=__jsp_taghandler_178.doStartTag(); if (OracleJspRuntime.checkStartTagEval(__jsp_tag_starteval)) { do { } while (__jsp_taghandler_178.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); } if (__jsp_taghandler_178.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_178); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[192]); /*@lineinfo:translated-code*//*@lineinfo:355^15*/ { org.apache.struts.taglib.html.TextTag __jsp_taghandler_179=(org.apache.struts.taglib.html.TextTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.TextTag.class,"org.apache.struts.taglib.html.TextTag maxlength name property readonly size"); __jsp_taghandler_179.setParent(__jsp_taghandler_166); __jsp_taghandler_179.setMaxlength("40"); __jsp_taghandler_179.setName("ActivosForm"); __jsp_taghandler_179.setProperty("act_pardescripcion"); __jsp_taghandler_179.setReadonly(true); __jsp_taghandler_179.setSize("40"); __jsp_tag_starteval=__jsp_taghandler_179.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_179,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_179.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_179.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_179); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[193]); /*@lineinfo:translated-code*//*@lineinfo:359^27*/ { org.apache.struts.taglib.bean.MessageTag __jsp_taghandler_180=(org.apache.struts.taglib.bean.MessageTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.bean.MessageTag.class,"org.apache.struts.taglib.bean.MessageTag key"); __jsp_taghandler_180.setParent(__jsp_taghandler_166); __jsp_taghandler_180.setKey("activos1.codofi"); __jsp_tag_starteval=__jsp_taghandler_180.doStartTag(); if (OracleJspRuntime.checkStartTagEval(__jsp_tag_starteval)) { do { } while (__jsp_taghandler_180.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); } if (__jsp_taghandler_180.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_180); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[194]); /*@lineinfo:translated-code*//*@lineinfo:361^10*/ { org.apache.struts.taglib.html.TextTag __jsp_taghandler_181=(org.apache.struts.taglib.html.TextTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.TextTag.class,"org.apache.struts.taglib.html.TextTag maxlength name property readonly size"); __jsp_taghandler_181.setParent(__jsp_taghandler_166); __jsp_taghandler_181.setMaxlength("40"); __jsp_taghandler_181.setName("ActivosForm"); __jsp_taghandler_181.setProperty("act_ofidescripcion"); __jsp_taghandler_181.setReadonly(true); __jsp_taghandler_181.setSize("40"); __jsp_tag_starteval=__jsp_taghandler_181.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_181,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_181.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_181.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_181); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[195]); /*@lineinfo:translated-code*//*@lineinfo:363^27*/ { org.apache.struts.taglib.bean.MessageTag __jsp_taghandler_182=(org.apache.struts.taglib.bean.MessageTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.bean.MessageTag.class,"org.apache.struts.taglib.bean.MessageTag key"); __jsp_taghandler_182.setParent(__jsp_taghandler_166); __jsp_taghandler_182.setKey("activos1.codfun"); __jsp_tag_starteval=__jsp_taghandler_182.doStartTag(); if (OracleJspRuntime.checkStartTagEval(__jsp_tag_starteval)) { do { } while (__jsp_taghandler_182.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); } if (__jsp_taghandler_182.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_182); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[196]); /*@lineinfo:translated-code*//*@lineinfo:365^10*/ { org.apache.struts.taglib.html.TextTag __jsp_taghandler_183=(org.apache.struts.taglib.html.TextTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.TextTag.class,"org.apache.struts.taglib.html.TextTag maxlength name property readonly size"); __jsp_taghandler_183.setParent(__jsp_taghandler_166); __jsp_taghandler_183.setMaxlength("40"); __jsp_taghandler_183.setName("ActivosForm"); __jsp_taghandler_183.setProperty("act_fundescripcion"); __jsp_taghandler_183.setReadonly(true); __jsp_taghandler_183.setSize("40"); __jsp_tag_starteval=__jsp_taghandler_183.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_183,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_183.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_183.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_183); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[197]); /*@lineinfo:translated-code*//*@lineinfo:369^27*/ { org.apache.struts.taglib.bean.MessageTag __jsp_taghandler_184=(org.apache.struts.taglib.bean.MessageTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.bean.MessageTag.class,"org.apache.struts.taglib.bean.MessageTag key"); __jsp_taghandler_184.setParent(__jsp_taghandler_166); __jsp_taghandler_184.setKey("activos1.codubi"); __jsp_tag_starteval=__jsp_taghandler_184.doStartTag(); if (OracleJspRuntime.checkStartTagEval(__jsp_tag_starteval)) { do { } while (__jsp_taghandler_184.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); } if (__jsp_taghandler_184.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_184); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[198]); /*@lineinfo:translated-code*//*@lineinfo:371^15*/ { org.apache.struts.taglib.html.TextTag __jsp_taghandler_185=(org.apache.struts.taglib.html.TextTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.TextTag.class,"org.apache.struts.taglib.html.TextTag maxlength name property readonly size"); __jsp_taghandler_185.setParent(__jsp_taghandler_166); __jsp_taghandler_185.setMaxlength("40"); __jsp_taghandler_185.setName("ActivosForm"); __jsp_taghandler_185.setProperty("act_ubidescripcion"); __jsp_taghandler_185.setReadonly(true); __jsp_taghandler_185.setSize("40"); __jsp_tag_starteval=__jsp_taghandler_185.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_185,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_185.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_185.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_185); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[199]); /*@lineinfo:translated-code*//*@lineinfo:373^27*/ { org.apache.struts.taglib.bean.MessageTag __jsp_taghandler_186=(org.apache.struts.taglib.bean.MessageTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.bean.MessageTag.class,"org.apache.struts.taglib.bean.MessageTag key"); __jsp_taghandler_186.setParent(__jsp_taghandler_166); __jsp_taghandler_186.setKey("activos1.codpry"); __jsp_tag_starteval=__jsp_taghandler_186.doStartTag(); if (OracleJspRuntime.checkStartTagEval(__jsp_tag_starteval)) { do { } while (__jsp_taghandler_186.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); } if (__jsp_taghandler_186.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_186); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[200]); /*@lineinfo:translated-code*//*@lineinfo:375^15*/ { org.apache.struts.taglib.html.TextTag __jsp_taghandler_187=(org.apache.struts.taglib.html.TextTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.TextTag.class,"org.apache.struts.taglib.html.TextTag maxlength name property readonly size"); __jsp_taghandler_187.setParent(__jsp_taghandler_166); __jsp_taghandler_187.setMaxlength("40"); __jsp_taghandler_187.setName("ActivosForm"); __jsp_taghandler_187.setProperty("act_prydescripcion"); __jsp_taghandler_187.setReadonly(true); __jsp_taghandler_187.setSize("40"); __jsp_tag_starteval=__jsp_taghandler_187.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_187,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_187.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_187.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_187); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[201]); /*@lineinfo:translated-code*//*@lineinfo:379^27*/ { org.apache.struts.taglib.bean.MessageTag __jsp_taghandler_188=(org.apache.struts.taglib.bean.MessageTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.bean.MessageTag.class,"org.apache.struts.taglib.bean.MessageTag key"); __jsp_taghandler_188.setParent(__jsp_taghandler_166); __jsp_taghandler_188.setKey("activos1.codfin"); __jsp_tag_starteval=__jsp_taghandler_188.doStartTag(); if (OracleJspRuntime.checkStartTagEval(__jsp_tag_starteval)) { do { } while (__jsp_taghandler_188.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); } if (__jsp_taghandler_188.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_188); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[202]); /*@lineinfo:translated-code*//*@lineinfo:381^15*/ { org.apache.struts.taglib.html.TextTag __jsp_taghandler_189=(org.apache.struts.taglib.html.TextTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.TextTag.class,"org.apache.struts.taglib.html.TextTag maxlength name property readonly size"); __jsp_taghandler_189.setParent(__jsp_taghandler_166); __jsp_taghandler_189.setMaxlength("40"); __jsp_taghandler_189.setName("ActivosForm"); __jsp_taghandler_189.setProperty("act_findescripcion"); __jsp_taghandler_189.setReadonly(true); __jsp_taghandler_189.setSize("40"); __jsp_tag_starteval=__jsp_taghandler_189.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_189,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_189.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_189.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_189); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[203]); /*@lineinfo:translated-code*//*@lineinfo:383^27*/ { org.apache.struts.taglib.bean.MessageTag __jsp_taghandler_190=(org.apache.struts.taglib.bean.MessageTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.bean.MessageTag.class,"org.apache.struts.taglib.bean.MessageTag key"); __jsp_taghandler_190.setParent(__jsp_taghandler_166); __jsp_taghandler_190.setKey("activos1.feccompra"); __jsp_tag_starteval=__jsp_taghandler_190.doStartTag(); if (OracleJspRuntime.checkStartTagEval(__jsp_tag_starteval)) { do { } while (__jsp_taghandler_190.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); } if (__jsp_taghandler_190.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_190); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[204]); /*@lineinfo:translated-code*//*@lineinfo:384^14*/ { org.apache.struts.taglib.html.TextTag __jsp_taghandler_191=(org.apache.struts.taglib.html.TextTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.TextTag.class,"org.apache.struts.taglib.html.TextTag maxlength name property readonly size"); __jsp_taghandler_191.setParent(__jsp_taghandler_166); __jsp_taghandler_191.setMaxlength("10"); __jsp_taghandler_191.setName("ActivosForm"); __jsp_taghandler_191.setProperty("act_feccompra"); __jsp_taghandler_191.setReadonly(true); __jsp_taghandler_191.setSize("10"); __jsp_tag_starteval=__jsp_taghandler_191.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_191,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_191.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_191.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_191); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[205]); /*@lineinfo:translated-code*//*@lineinfo:387^24*/ { org.apache.struts.taglib.html.SubmitTag __jsp_taghandler_192=(org.apache.struts.taglib.html.SubmitTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.SubmitTag.class,"org.apache.struts.taglib.html.SubmitTag onclick property styleClass value"); __jsp_taghandler_192.setParent(__jsp_taghandler_166); __jsp_taghandler_192.setOnclick("operacion.value=2;opcion.value=3"); __jsp_taghandler_192.setProperty("boton"); __jsp_taghandler_192.setStyleClass("boton1"); __jsp_taghandler_192.setValue("Eliminar"); __jsp_tag_starteval=__jsp_taghandler_192.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_192,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_192.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_192.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_192); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[206]); /*@lineinfo:translated-code*//*@lineinfo:387^136*/ } while (__jsp_taghandler_166.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); } if (__jsp_taghandler_166.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_166); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[207]); /*@lineinfo:translated-code*//*@lineinfo:390^18*/ } while (__jsp_taghandler_4.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); } if (__jsp_taghandler_4.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_4); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[208]); /*@lineinfo:translated-code*//*@lineinfo:392^1*/ { org.apache.struts.taglib.logic.EqualTag __jsp_taghandler_193=(org.apache.struts.taglib.logic.EqualTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.logic.EqualTag.class,"org.apache.struts.taglib.logic.EqualTag name property value"); __jsp_taghandler_193.setParent(__jsp_taghandler_1); __jsp_taghandler_193.setName("ActivosForm"); __jsp_taghandler_193.setProperty("operacion"); __jsp_taghandler_193.setValue("2"); __jsp_tag_starteval=__jsp_taghandler_193.doStartTag(); if (OracleJspRuntime.checkStartTagEval(__jsp_tag_starteval)) { do { /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[209]); /*@lineinfo:translated-code*//*@lineinfo:396^6*/ { org.apache.struts.taglib.logic.EqualTag __jsp_taghandler_194=(org.apache.struts.taglib.logic.EqualTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.logic.EqualTag.class,"org.apache.struts.taglib.logic.EqualTag name property value"); __jsp_taghandler_194.setParent(__jsp_taghandler_193); __jsp_taghandler_194.setName("ActivosForm"); __jsp_taghandler_194.setProperty("opcion"); __jsp_taghandler_194.setValue("3"); __jsp_tag_starteval=__jsp_taghandler_194.doStartTag(); if (OracleJspRuntime.checkStartTagEval(__jsp_tag_starteval)) { do { /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[210]); /*@lineinfo:translated-code*//*@lineinfo:398^29*/ { org.apache.struts.taglib.bean.MessageTag __jsp_taghandler_195=(org.apache.struts.taglib.bean.MessageTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.bean.MessageTag.class,"org.apache.struts.taglib.bean.MessageTag key"); __jsp_taghandler_195.setParent(__jsp_taghandler_194); __jsp_taghandler_195.setKey("activos1.codrub"); __jsp_tag_starteval=__jsp_taghandler_195.doStartTag(); if (OracleJspRuntime.checkStartTagEval(__jsp_tag_starteval)) { do { } while (__jsp_taghandler_195.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); } if (__jsp_taghandler_195.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_195); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[211]); /*@lineinfo:translated-code*//*@lineinfo:399^16*/ { org.apache.struts.taglib.html.SelectTag __jsp_taghandler_196=(org.apache.struts.taglib.html.SelectTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.SelectTag.class,"org.apache.struts.taglib.html.SelectTag disabled name property"); __jsp_taghandler_196.setParent(__jsp_taghandler_194); __jsp_taghandler_196.setDisabled(false); __jsp_taghandler_196.setName("ActivosForm"); __jsp_taghandler_196.setProperty("act_codrub"); __jsp_tag_starteval=__jsp_taghandler_196.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_196,__jsp_tag_starteval,out); do { /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[212]); /*@lineinfo:translated-code*//*@lineinfo:400^16*/ { org.apache.struts.taglib.html.OptionsTag __jsp_taghandler_197=(org.apache.struts.taglib.html.OptionsTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.OptionsTag.class,"org.apache.struts.taglib.html.OptionsTag collection labelProperty property"); __jsp_taghandler_197.setParent(__jsp_taghandler_196); __jsp_taghandler_197.setCollection("RubrosLista"); __jsp_taghandler_197.setLabelProperty("descripcion"); __jsp_taghandler_197.setProperty("codigo"); __jsp_tag_starteval=__jsp_taghandler_197.doStartTag(); if (OracleJspRuntime.checkStartTagEval(__jsp_tag_starteval)) { do { } while (__jsp_taghandler_197.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); } if (__jsp_taghandler_197.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_197); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[213]); /*@lineinfo:translated-code*//*@lineinfo:400^102*/ } while (__jsp_taghandler_196.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_196.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_196); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[214]); /*@lineinfo:translated-code*//*@lineinfo:404^30*/ { org.apache.struts.taglib.bean.MessageTag __jsp_taghandler_198=(org.apache.struts.taglib.bean.MessageTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.bean.MessageTag.class,"org.apache.struts.taglib.bean.MessageTag key"); __jsp_taghandler_198.setParent(__jsp_taghandler_194); __jsp_taghandler_198.setKey("activos1.codreg"); __jsp_tag_starteval=__jsp_taghandler_198.doStartTag(); if (OracleJspRuntime.checkStartTagEval(__jsp_tag_starteval)) { do { } while (__jsp_taghandler_198.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); } if (__jsp_taghandler_198.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_198); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[215]); /*@lineinfo:translated-code*//*@lineinfo:405^17*/ { org.apache.struts.taglib.html.HiddenTag __jsp_taghandler_199=(org.apache.struts.taglib.html.HiddenTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.HiddenTag.class,"org.apache.struts.taglib.html.HiddenTag name property"); __jsp_taghandler_199.setParent(__jsp_taghandler_194); __jsp_taghandler_199.setName("ActivosForm"); __jsp_taghandler_199.setProperty("act_codreg"); __jsp_tag_starteval=__jsp_taghandler_199.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_199,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_199.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_199.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_199); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[216]); /*@lineinfo:translated-code*//*@lineinfo:406^13*/ { org.apache.struts.taglib.html.TextTag __jsp_taghandler_200=(org.apache.struts.taglib.html.TextTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.TextTag.class,"org.apache.struts.taglib.html.TextTag maxlength name property readonly size"); __jsp_taghandler_200.setParent(__jsp_taghandler_194); __jsp_taghandler_200.setMaxlength("30"); __jsp_taghandler_200.setName("ActivosForm"); __jsp_taghandler_200.setProperty("act_regdescripcion"); __jsp_taghandler_200.setReadonly(true); __jsp_taghandler_200.setSize("30"); __jsp_tag_starteval=__jsp_taghandler_200.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_200,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_200.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_200.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_200); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[217]); /*@lineinfo:translated-code*//*@lineinfo:409^30*/ { org.apache.struts.taglib.bean.MessageTag __jsp_taghandler_201=(org.apache.struts.taglib.bean.MessageTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.bean.MessageTag.class,"org.apache.struts.taglib.bean.MessageTag key"); __jsp_taghandler_201.setParent(__jsp_taghandler_194); __jsp_taghandler_201.setKey("activos1.codfin"); __jsp_tag_starteval=__jsp_taghandler_201.doStartTag(); if (OracleJspRuntime.checkStartTagEval(__jsp_tag_starteval)) { do { } while (__jsp_taghandler_201.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); } if (__jsp_taghandler_201.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_201); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[218]); /*@lineinfo:translated-code*//*@lineinfo:410^17*/ { org.apache.struts.taglib.html.HiddenTag __jsp_taghandler_202=(org.apache.struts.taglib.html.HiddenTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.HiddenTag.class,"org.apache.struts.taglib.html.HiddenTag name property"); __jsp_taghandler_202.setParent(__jsp_taghandler_194); __jsp_taghandler_202.setName("ActivosForm"); __jsp_taghandler_202.setProperty("act_codfin"); __jsp_tag_starteval=__jsp_taghandler_202.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_202,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_202.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_202.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_202); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[219]); /*@lineinfo:translated-code*//*@lineinfo:411^13*/ { org.apache.struts.taglib.html.TextTag __jsp_taghandler_203=(org.apache.struts.taglib.html.TextTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.TextTag.class,"org.apache.struts.taglib.html.TextTag maxlength name property readonly size"); __jsp_taghandler_203.setParent(__jsp_taghandler_194); __jsp_taghandler_203.setMaxlength("30"); __jsp_taghandler_203.setName("ActivosForm"); __jsp_taghandler_203.setProperty("act_findescripcion"); __jsp_taghandler_203.setReadonly(true); __jsp_taghandler_203.setSize("30"); __jsp_tag_starteval=__jsp_taghandler_203.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_203,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_203.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_203.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_203); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[220]); /*@lineinfo:translated-code*//*@lineinfo:414^29*/ { org.apache.struts.taglib.bean.MessageTag __jsp_taghandler_204=(org.apache.struts.taglib.bean.MessageTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.bean.MessageTag.class,"org.apache.struts.taglib.bean.MessageTag key"); __jsp_taghandler_204.setParent(__jsp_taghandler_194); __jsp_taghandler_204.setKey("activos1.descripcion"); __jsp_tag_starteval=__jsp_taghandler_204.doStartTag(); if (OracleJspRuntime.checkStartTagEval(__jsp_tag_starteval)) { do { } while (__jsp_taghandler_204.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); } if (__jsp_taghandler_204.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_204); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[221]); /*@lineinfo:translated-code*//*@lineinfo:415^16*/ { org.apache.struts.taglib.html.TextTag __jsp_taghandler_205=(org.apache.struts.taglib.html.TextTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.TextTag.class,"org.apache.struts.taglib.html.TextTag maxlength name onchange property size value"); __jsp_taghandler_205.setParent(__jsp_taghandler_194); __jsp_taghandler_205.setMaxlength("120"); __jsp_taghandler_205.setName("ActivosForm"); __jsp_taghandler_205.setOnchange("javascript:this.value=this.value.toUpperCase();"); __jsp_taghandler_205.setProperty("act_descripcion"); __jsp_taghandler_205.setSize("60"); __jsp_taghandler_205.setValue("%"); __jsp_tag_starteval=__jsp_taghandler_205.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_205,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_205.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_205.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_205); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[222]); /*@lineinfo:translated-code*//*@lineinfo:420^12*/ { org.apache.struts.taglib.html.SubmitTag __jsp_taghandler_206=(org.apache.struts.taglib.html.SubmitTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.SubmitTag.class,"org.apache.struts.taglib.html.SubmitTag onclick property styleClass value"); __jsp_taghandler_206.setParent(__jsp_taghandler_194); __jsp_taghandler_206.setOnclick("operacion.value=3;opcion.value=3"); __jsp_taghandler_206.setProperty("boton"); __jsp_taghandler_206.setStyleClass("boton1"); __jsp_taghandler_206.setValue("Eliminar"); __jsp_tag_starteval=__jsp_taghandler_206.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_206,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_206.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_206.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_206); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[223]); /*@lineinfo:translated-code*//*@lineinfo:420^123*/ } while (__jsp_taghandler_194.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); } if (__jsp_taghandler_194.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_194); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[224]); /*@lineinfo:translated-code*//*@lineinfo:424^6*/ { org.apache.struts.taglib.logic.EqualTag __jsp_taghandler_207=(org.apache.struts.taglib.logic.EqualTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.logic.EqualTag.class,"org.apache.struts.taglib.logic.EqualTag name property value"); __jsp_taghandler_207.setParent(__jsp_taghandler_193); __jsp_taghandler_207.setName("ActivosForm"); __jsp_taghandler_207.setProperty("opcion"); __jsp_taghandler_207.setValue("2"); __jsp_tag_starteval=__jsp_taghandler_207.doStartTag(); if (OracleJspRuntime.checkStartTagEval(__jsp_tag_starteval)) { do { /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[225]); /*@lineinfo:translated-code*//*@lineinfo:426^29*/ { org.apache.struts.taglib.bean.MessageTag __jsp_taghandler_208=(org.apache.struts.taglib.bean.MessageTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.bean.MessageTag.class,"org.apache.struts.taglib.bean.MessageTag key"); __jsp_taghandler_208.setParent(__jsp_taghandler_207); __jsp_taghandler_208.setKey("activos1.codrub"); __jsp_tag_starteval=__jsp_taghandler_208.doStartTag(); if (OracleJspRuntime.checkStartTagEval(__jsp_tag_starteval)) { do { } while (__jsp_taghandler_208.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); } if (__jsp_taghandler_208.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_208); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[226]); /*@lineinfo:translated-code*//*@lineinfo:427^16*/ { org.apache.struts.taglib.html.SelectTag __jsp_taghandler_209=(org.apache.struts.taglib.html.SelectTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.SelectTag.class,"org.apache.struts.taglib.html.SelectTag disabled name property"); __jsp_taghandler_209.setParent(__jsp_taghandler_207); __jsp_taghandler_209.setDisabled(false); __jsp_taghandler_209.setName("ActivosForm"); __jsp_taghandler_209.setProperty("act_codrub"); __jsp_tag_starteval=__jsp_taghandler_209.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_209,__jsp_tag_starteval,out); do { /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[227]); /*@lineinfo:translated-code*//*@lineinfo:428^16*/ { org.apache.struts.taglib.html.OptionsTag __jsp_taghandler_210=(org.apache.struts.taglib.html.OptionsTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.OptionsTag.class,"org.apache.struts.taglib.html.OptionsTag collection labelProperty property"); __jsp_taghandler_210.setParent(__jsp_taghandler_209); __jsp_taghandler_210.setCollection("RubrosLista"); __jsp_taghandler_210.setLabelProperty("descripcion"); __jsp_taghandler_210.setProperty("codigo"); __jsp_tag_starteval=__jsp_taghandler_210.doStartTag(); if (OracleJspRuntime.checkStartTagEval(__jsp_tag_starteval)) { do { } while (__jsp_taghandler_210.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); } if (__jsp_taghandler_210.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_210); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[228]); /*@lineinfo:translated-code*//*@lineinfo:428^102*/ } while (__jsp_taghandler_209.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_209.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_209); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[229]); /*@lineinfo:translated-code*//*@lineinfo:432^30*/ { org.apache.struts.taglib.bean.MessageTag __jsp_taghandler_211=(org.apache.struts.taglib.bean.MessageTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.bean.MessageTag.class,"org.apache.struts.taglib.bean.MessageTag key"); __jsp_taghandler_211.setParent(__jsp_taghandler_207); __jsp_taghandler_211.setKey("activos1.codreg"); __jsp_tag_starteval=__jsp_taghandler_211.doStartTag(); if (OracleJspRuntime.checkStartTagEval(__jsp_tag_starteval)) { do { } while (__jsp_taghandler_211.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); } if (__jsp_taghandler_211.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_211); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[230]); /*@lineinfo:translated-code*//*@lineinfo:433^17*/ { org.apache.struts.taglib.html.HiddenTag __jsp_taghandler_212=(org.apache.struts.taglib.html.HiddenTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.HiddenTag.class,"org.apache.struts.taglib.html.HiddenTag name property"); __jsp_taghandler_212.setParent(__jsp_taghandler_207); __jsp_taghandler_212.setName("ActivosForm"); __jsp_taghandler_212.setProperty("act_codreg"); __jsp_tag_starteval=__jsp_taghandler_212.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_212,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_212.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_212.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_212); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[231]); /*@lineinfo:translated-code*//*@lineinfo:434^13*/ { org.apache.struts.taglib.html.TextTag __jsp_taghandler_213=(org.apache.struts.taglib.html.TextTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.TextTag.class,"org.apache.struts.taglib.html.TextTag maxlength name property readonly size"); __jsp_taghandler_213.setParent(__jsp_taghandler_207); __jsp_taghandler_213.setMaxlength("30"); __jsp_taghandler_213.setName("ActivosForm"); __jsp_taghandler_213.setProperty("act_regdescripcion"); __jsp_taghandler_213.setReadonly(true); __jsp_taghandler_213.setSize("30"); __jsp_tag_starteval=__jsp_taghandler_213.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_213,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_213.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_213.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_213); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[232]); /*@lineinfo:translated-code*//*@lineinfo:437^30*/ { org.apache.struts.taglib.bean.MessageTag __jsp_taghandler_214=(org.apache.struts.taglib.bean.MessageTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.bean.MessageTag.class,"org.apache.struts.taglib.bean.MessageTag key"); __jsp_taghandler_214.setParent(__jsp_taghandler_207); __jsp_taghandler_214.setKey("activos1.codfin"); __jsp_tag_starteval=__jsp_taghandler_214.doStartTag(); if (OracleJspRuntime.checkStartTagEval(__jsp_tag_starteval)) { do { } while (__jsp_taghandler_214.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); } if (__jsp_taghandler_214.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_214); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[233]); /*@lineinfo:translated-code*//*@lineinfo:438^17*/ { org.apache.struts.taglib.html.HiddenTag __jsp_taghandler_215=(org.apache.struts.taglib.html.HiddenTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.HiddenTag.class,"org.apache.struts.taglib.html.HiddenTag name property"); __jsp_taghandler_215.setParent(__jsp_taghandler_207); __jsp_taghandler_215.setName("ActivosForm"); __jsp_taghandler_215.setProperty("act_codfin"); __jsp_tag_starteval=__jsp_taghandler_215.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_215,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_215.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_215.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_215); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[234]); /*@lineinfo:translated-code*//*@lineinfo:439^13*/ { org.apache.struts.taglib.html.TextTag __jsp_taghandler_216=(org.apache.struts.taglib.html.TextTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.TextTag.class,"org.apache.struts.taglib.html.TextTag maxlength name property readonly size"); __jsp_taghandler_216.setParent(__jsp_taghandler_207); __jsp_taghandler_216.setMaxlength("30"); __jsp_taghandler_216.setName("ActivosForm"); __jsp_taghandler_216.setProperty("act_findescripcion"); __jsp_taghandler_216.setReadonly(true); __jsp_taghandler_216.setSize("30"); __jsp_tag_starteval=__jsp_taghandler_216.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_216,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_216.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_216.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_216); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[235]); /*@lineinfo:translated-code*//*@lineinfo:442^29*/ { org.apache.struts.taglib.bean.MessageTag __jsp_taghandler_217=(org.apache.struts.taglib.bean.MessageTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.bean.MessageTag.class,"org.apache.struts.taglib.bean.MessageTag key"); __jsp_taghandler_217.setParent(__jsp_taghandler_207); __jsp_taghandler_217.setKey("activos1.descripcion"); __jsp_tag_starteval=__jsp_taghandler_217.doStartTag(); if (OracleJspRuntime.checkStartTagEval(__jsp_tag_starteval)) { do { } while (__jsp_taghandler_217.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); } if (__jsp_taghandler_217.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_217); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[236]); /*@lineinfo:translated-code*//*@lineinfo:443^16*/ { org.apache.struts.taglib.html.TextTag __jsp_taghandler_218=(org.apache.struts.taglib.html.TextTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.TextTag.class,"org.apache.struts.taglib.html.TextTag maxlength name onchange property size"); __jsp_taghandler_218.setParent(__jsp_taghandler_207); __jsp_taghandler_218.setMaxlength("120"); __jsp_taghandler_218.setName("ActivosForm"); __jsp_taghandler_218.setOnchange("javascript:this.value=this.value.toUpperCase();"); __jsp_taghandler_218.setProperty("act_descripcion"); __jsp_taghandler_218.setSize("60"); __jsp_tag_starteval=__jsp_taghandler_218.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_218,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_218.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_218.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_218); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[237]); /*@lineinfo:translated-code*//*@lineinfo:448^12*/ { org.apache.struts.taglib.html.SubmitTag __jsp_taghandler_219=(org.apache.struts.taglib.html.SubmitTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.SubmitTag.class,"org.apache.struts.taglib.html.SubmitTag onclick property styleClass value"); __jsp_taghandler_219.setParent(__jsp_taghandler_207); __jsp_taghandler_219.setOnclick("operacion.value=3;opcion.value=2"); __jsp_taghandler_219.setProperty("boton"); __jsp_taghandler_219.setStyleClass("boton1"); __jsp_taghandler_219.setValue("Modificar"); __jsp_tag_starteval=__jsp_taghandler_219.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_219,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_219.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_219.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_219); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[238]); /*@lineinfo:translated-code*//*@lineinfo:448^124*/ } while (__jsp_taghandler_207.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); } if (__jsp_taghandler_207.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_207); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[239]); /*@lineinfo:translated-code*//*@lineinfo:452^6*/ { org.apache.struts.taglib.logic.EqualTag __jsp_taghandler_220=(org.apache.struts.taglib.logic.EqualTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.logic.EqualTag.class,"org.apache.struts.taglib.logic.EqualTag name property value"); __jsp_taghandler_220.setParent(__jsp_taghandler_193); __jsp_taghandler_220.setName("ActivosForm"); __jsp_taghandler_220.setProperty("opcion"); __jsp_taghandler_220.setValue("1"); __jsp_tag_starteval=__jsp_taghandler_220.doStartTag(); if (OracleJspRuntime.checkStartTagEval(__jsp_tag_starteval)) { do { /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[240]); /*@lineinfo:translated-code*//*@lineinfo:454^29*/ { org.apache.struts.taglib.bean.MessageTag __jsp_taghandler_221=(org.apache.struts.taglib.bean.MessageTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.bean.MessageTag.class,"org.apache.struts.taglib.bean.MessageTag key"); __jsp_taghandler_221.setParent(__jsp_taghandler_220); __jsp_taghandler_221.setKey("activos1.codrub"); __jsp_tag_starteval=__jsp_taghandler_221.doStartTag(); if (OracleJspRuntime.checkStartTagEval(__jsp_tag_starteval)) { do { } while (__jsp_taghandler_221.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); } if (__jsp_taghandler_221.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_221); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[241]); /*@lineinfo:translated-code*//*@lineinfo:455^16*/ { org.apache.struts.taglib.html.SelectTag __jsp_taghandler_222=(org.apache.struts.taglib.html.SelectTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.SelectTag.class,"org.apache.struts.taglib.html.SelectTag disabled name property"); __jsp_taghandler_222.setParent(__jsp_taghandler_220); __jsp_taghandler_222.setDisabled(false); __jsp_taghandler_222.setName("ActivosForm"); __jsp_taghandler_222.setProperty("act_codrub"); __jsp_tag_starteval=__jsp_taghandler_222.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_222,__jsp_tag_starteval,out); do { /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[242]); /*@lineinfo:translated-code*//*@lineinfo:456^16*/ { org.apache.struts.taglib.html.OptionsTag __jsp_taghandler_223=(org.apache.struts.taglib.html.OptionsTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.OptionsTag.class,"org.apache.struts.taglib.html.OptionsTag collection labelProperty property"); __jsp_taghandler_223.setParent(__jsp_taghandler_222); __jsp_taghandler_223.setCollection("RubrosLista"); __jsp_taghandler_223.setLabelProperty("descripcion"); __jsp_taghandler_223.setProperty("codigo"); __jsp_tag_starteval=__jsp_taghandler_223.doStartTag(); if (OracleJspRuntime.checkStartTagEval(__jsp_tag_starteval)) { do { } while (__jsp_taghandler_223.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); } if (__jsp_taghandler_223.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_223); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[243]); /*@lineinfo:translated-code*//*@lineinfo:456^102*/ } while (__jsp_taghandler_222.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_222.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_222); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[244]); /*@lineinfo:translated-code*//*@lineinfo:460^30*/ { org.apache.struts.taglib.bean.MessageTag __jsp_taghandler_224=(org.apache.struts.taglib.bean.MessageTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.bean.MessageTag.class,"org.apache.struts.taglib.bean.MessageTag key"); __jsp_taghandler_224.setParent(__jsp_taghandler_220); __jsp_taghandler_224.setKey("activos1.codreg"); __jsp_tag_starteval=__jsp_taghandler_224.doStartTag(); if (OracleJspRuntime.checkStartTagEval(__jsp_tag_starteval)) { do { } while (__jsp_taghandler_224.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); } if (__jsp_taghandler_224.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_224); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[245]); /*@lineinfo:translated-code*//*@lineinfo:461^17*/ { org.apache.struts.taglib.html.HiddenTag __jsp_taghandler_225=(org.apache.struts.taglib.html.HiddenTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.HiddenTag.class,"org.apache.struts.taglib.html.HiddenTag name property"); __jsp_taghandler_225.setParent(__jsp_taghandler_220); __jsp_taghandler_225.setName("ActivosForm"); __jsp_taghandler_225.setProperty("act_codreg"); __jsp_tag_starteval=__jsp_taghandler_225.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_225,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_225.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_225.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_225); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[246]); /*@lineinfo:translated-code*//*@lineinfo:462^13*/ { org.apache.struts.taglib.html.TextTag __jsp_taghandler_226=(org.apache.struts.taglib.html.TextTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.TextTag.class,"org.apache.struts.taglib.html.TextTag maxlength name property readonly size"); __jsp_taghandler_226.setParent(__jsp_taghandler_220); __jsp_taghandler_226.setMaxlength("30"); __jsp_taghandler_226.setName("ActivosForm"); __jsp_taghandler_226.setProperty("act_regdescripcion"); __jsp_taghandler_226.setReadonly(true); __jsp_taghandler_226.setSize("30"); __jsp_tag_starteval=__jsp_taghandler_226.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_226,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_226.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_226.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_226); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[247]); /*@lineinfo:translated-code*//*@lineinfo:465^30*/ { org.apache.struts.taglib.bean.MessageTag __jsp_taghandler_227=(org.apache.struts.taglib.bean.MessageTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.bean.MessageTag.class,"org.apache.struts.taglib.bean.MessageTag key"); __jsp_taghandler_227.setParent(__jsp_taghandler_220); __jsp_taghandler_227.setKey("activos1.codfin"); __jsp_tag_starteval=__jsp_taghandler_227.doStartTag(); if (OracleJspRuntime.checkStartTagEval(__jsp_tag_starteval)) { do { } while (__jsp_taghandler_227.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); } if (__jsp_taghandler_227.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_227); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[248]); /*@lineinfo:translated-code*//*@lineinfo:466^17*/ { org.apache.struts.taglib.html.HiddenTag __jsp_taghandler_228=(org.apache.struts.taglib.html.HiddenTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.HiddenTag.class,"org.apache.struts.taglib.html.HiddenTag name property"); __jsp_taghandler_228.setParent(__jsp_taghandler_220); __jsp_taghandler_228.setName("ActivosForm"); __jsp_taghandler_228.setProperty("act_codfin"); __jsp_tag_starteval=__jsp_taghandler_228.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_228,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_228.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_228.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_228); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[249]); /*@lineinfo:translated-code*//*@lineinfo:467^13*/ { org.apache.struts.taglib.html.TextTag __jsp_taghandler_229=(org.apache.struts.taglib.html.TextTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.TextTag.class,"org.apache.struts.taglib.html.TextTag maxlength name property readonly size"); __jsp_taghandler_229.setParent(__jsp_taghandler_220); __jsp_taghandler_229.setMaxlength("30"); __jsp_taghandler_229.setName("ActivosForm"); __jsp_taghandler_229.setProperty("act_findescripcion"); __jsp_taghandler_229.setReadonly(true); __jsp_taghandler_229.setSize("30"); __jsp_tag_starteval=__jsp_taghandler_229.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_229,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_229.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_229.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_229); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[250]); /*@lineinfo:translated-code*//*@lineinfo:472^12*/ { org.apache.struts.taglib.html.SubmitTag __jsp_taghandler_230=(org.apache.struts.taglib.html.SubmitTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.SubmitTag.class,"org.apache.struts.taglib.html.SubmitTag onclick property styleClass value"); __jsp_taghandler_230.setParent(__jsp_taghandler_220); __jsp_taghandler_230.setOnclick("operacion.value=1;opcion.value=1"); __jsp_taghandler_230.setProperty("boton"); __jsp_taghandler_230.setStyleClass("boton1"); __jsp_taghandler_230.setValue("Insertar"); __jsp_tag_starteval=__jsp_taghandler_230.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_230,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_230.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_230.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_230); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[251]); /*@lineinfo:translated-code*//*@lineinfo:472^123*/ } while (__jsp_taghandler_220.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); } if (__jsp_taghandler_220.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_220); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[252]); /*@lineinfo:translated-code*//*@lineinfo:475^20*/ } while (__jsp_taghandler_193.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); } if (__jsp_taghandler_193.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_193); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[253]); /*@lineinfo:translated-code*//*@lineinfo:480^1*/ { org.apache.struts.taglib.logic.EqualTag __jsp_taghandler_231=(org.apache.struts.taglib.logic.EqualTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.logic.EqualTag.class,"org.apache.struts.taglib.logic.EqualTag name property value"); __jsp_taghandler_231.setParent(__jsp_taghandler_1); __jsp_taghandler_231.setName("ActivosForm"); __jsp_taghandler_231.setProperty("operacion"); __jsp_taghandler_231.setValue("3"); __jsp_tag_starteval=__jsp_taghandler_231.doStartTag(); if (OracleJspRuntime.checkStartTagEval(__jsp_tag_starteval)) { do { /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[254]); /*@lineinfo:translated-code*//*@lineinfo:486^6*/ { org.apache.struts.taglib.html.HiddenTag __jsp_taghandler_232=(org.apache.struts.taglib.html.HiddenTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.HiddenTag.class,"org.apache.struts.taglib.html.HiddenTag name property"); __jsp_taghandler_232.setParent(__jsp_taghandler_231); __jsp_taghandler_232.setName("ActivosForm"); __jsp_taghandler_232.setProperty("act_codrub"); __jsp_tag_starteval=__jsp_taghandler_232.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_232,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_232.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_232.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_232); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[255]); /*@lineinfo:translated-code*//*@lineinfo:487^6*/ { org.apache.struts.taglib.html.HiddenTag __jsp_taghandler_233=(org.apache.struts.taglib.html.HiddenTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.HiddenTag.class,"org.apache.struts.taglib.html.HiddenTag name property"); __jsp_taghandler_233.setParent(__jsp_taghandler_231); __jsp_taghandler_233.setName("ActivosForm"); __jsp_taghandler_233.setProperty("act_codreg"); __jsp_tag_starteval=__jsp_taghandler_233.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_233,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_233.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_233.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_233); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[256]); /*@lineinfo:translated-code*//*@lineinfo:488^6*/ { org.apache.struts.taglib.html.HiddenTag __jsp_taghandler_234=(org.apache.struts.taglib.html.HiddenTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.HiddenTag.class,"org.apache.struts.taglib.html.HiddenTag name property"); __jsp_taghandler_234.setParent(__jsp_taghandler_231); __jsp_taghandler_234.setName("ActivosForm"); __jsp_taghandler_234.setProperty("act_codgrp"); __jsp_tag_starteval=__jsp_taghandler_234.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_234,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_234.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_234.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_234); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[257]); /*@lineinfo:translated-code*//*@lineinfo:489^6*/ { org.apache.struts.taglib.html.HiddenTag __jsp_taghandler_235=(org.apache.struts.taglib.html.HiddenTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.HiddenTag.class,"org.apache.struts.taglib.html.HiddenTag name property"); __jsp_taghandler_235.setParent(__jsp_taghandler_231); __jsp_taghandler_235.setName("ActivosForm"); __jsp_taghandler_235.setProperty("act_codfin"); __jsp_tag_starteval=__jsp_taghandler_235.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_235,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_235.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_235.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_235); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[258]); /*@lineinfo:translated-code*//*@lineinfo:490^6*/ { org.apache.struts.taglib.html.HiddenTag __jsp_taghandler_236=(org.apache.struts.taglib.html.HiddenTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.HiddenTag.class,"org.apache.struts.taglib.html.HiddenTag name property"); __jsp_taghandler_236.setParent(__jsp_taghandler_231); __jsp_taghandler_236.setName("ActivosForm"); __jsp_taghandler_236.setProperty("act_descripcion"); __jsp_tag_starteval=__jsp_taghandler_236.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_236,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_236.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_236.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_236); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[259]); /*@lineinfo:user-code*//*@lineinfo:498^7*/ int pnum=0; /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[260]); /*@lineinfo:translated-code*//*@lineinfo:499^7*/ { org.apache.struts.taglib.logic.IterateTag __jsp_taghandler_237=(org.apache.struts.taglib.logic.IterateTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.logic.IterateTag.class,"org.apache.struts.taglib.logic.IterateTag id name"); __jsp_taghandler_237.setParent(__jsp_taghandler_231); __jsp_taghandler_237.setId("lista"); __jsp_taghandler_237.setName("Activos3Lista"); java.lang.Object lista = null; __jsp_tag_starteval=__jsp_taghandler_237.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_237,__jsp_tag_starteval,out); do { lista = (java.lang.Object) pageContext.findAttribute("lista"); /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[261]); /*@lineinfo:user-code*//*@lineinfo:500^9*/ if (pnum==1) { /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[262]); /*@lineinfo:user-code*//*@lineinfo:502^9*/ } else { /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[263]); /*@lineinfo:user-code*//*@lineinfo:504^9*/ } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[264]); /*@lineinfo:translated-code*//*@lineinfo:506^12*/ { org.apache.struts.taglib.bean.WriteTag __jsp_taghandler_238=(org.apache.struts.taglib.bean.WriteTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.bean.WriteTag.class,"org.apache.struts.taglib.bean.WriteTag name property"); __jsp_taghandler_238.setParent(__jsp_taghandler_237); __jsp_taghandler_238.setName("lista"); __jsp_taghandler_238.setProperty("codrub"); __jsp_tag_starteval=__jsp_taghandler_238.doStartTag(); if (OracleJspRuntime.checkStartTagEval(__jsp_tag_starteval)) { do { } while (__jsp_taghandler_238.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); } if (__jsp_taghandler_238.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_238); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[265]); /*@lineinfo:translated-code*//*@lineinfo:506^58*/ { org.apache.struts.taglib.bean.WriteTag __jsp_taghandler_239=(org.apache.struts.taglib.bean.WriteTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.bean.WriteTag.class,"org.apache.struts.taglib.bean.WriteTag name property"); __jsp_taghandler_239.setParent(__jsp_taghandler_237); __jsp_taghandler_239.setName("lista"); __jsp_taghandler_239.setProperty("codreg"); __jsp_tag_starteval=__jsp_taghandler_239.doStartTag(); if (OracleJspRuntime.checkStartTagEval(__jsp_tag_starteval)) { do { } while (__jsp_taghandler_239.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); } if (__jsp_taghandler_239.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_239); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[266]); /*@lineinfo:translated-code*//*@lineinfo:506^104*/ { org.apache.struts.taglib.bean.WriteTag __jsp_taghandler_240=(org.apache.struts.taglib.bean.WriteTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.bean.WriteTag.class,"org.apache.struts.taglib.bean.WriteTag name property"); __jsp_taghandler_240.setParent(__jsp_taghandler_237); __jsp_taghandler_240.setName("lista"); __jsp_taghandler_240.setProperty("ceros"); __jsp_tag_starteval=__jsp_taghandler_240.doStartTag(); if (OracleJspRuntime.checkStartTagEval(__jsp_tag_starteval)) { do { } while (__jsp_taghandler_240.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); } if (__jsp_taghandler_240.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_240); } /*@lineinfo:506^148*/ { org.apache.struts.taglib.bean.WriteTag __jsp_taghandler_241=(org.apache.struts.taglib.bean.WriteTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.bean.WriteTag.class,"org.apache.struts.taglib.bean.WriteTag name property"); __jsp_taghandler_241.setParent(__jsp_taghandler_237); __jsp_taghandler_241.setName("lista"); __jsp_taghandler_241.setProperty("codigo"); __jsp_tag_starteval=__jsp_taghandler_241.doStartTag(); if (OracleJspRuntime.checkStartTagEval(__jsp_tag_starteval)) { do { } while (__jsp_taghandler_241.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); } if (__jsp_taghandler_241.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_241); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[267]); /*@lineinfo:translated-code*//*@lineinfo:507^16*/ { org.apache.struts.taglib.bean.WriteTag __jsp_taghandler_242=(org.apache.struts.taglib.bean.WriteTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.bean.WriteTag.class,"org.apache.struts.taglib.bean.WriteTag name property"); __jsp_taghandler_242.setParent(__jsp_taghandler_237); __jsp_taghandler_242.setName("lista"); __jsp_taghandler_242.setProperty("descodgrp"); __jsp_tag_starteval=__jsp_taghandler_242.doStartTag(); if (OracleJspRuntime.checkStartTagEval(__jsp_tag_starteval)) { do { } while (__jsp_taghandler_242.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); } if (__jsp_taghandler_242.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_242); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[268]); /*@lineinfo:translated-code*//*@lineinfo:508^16*/ { org.apache.struts.taglib.bean.WriteTag __jsp_taghandler_243=(org.apache.struts.taglib.bean.WriteTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.bean.WriteTag.class,"org.apache.struts.taglib.bean.WriteTag name property"); __jsp_taghandler_243.setParent(__jsp_taghandler_237); __jsp_taghandler_243.setName("lista"); __jsp_taghandler_243.setProperty("descripcion"); __jsp_tag_starteval=__jsp_taghandler_243.doStartTag(); if (OracleJspRuntime.checkStartTagEval(__jsp_tag_starteval)) { do { } while (__jsp_taghandler_243.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); } if (__jsp_taghandler_243.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_243); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[269]); /*@lineinfo:translated-code*//*@lineinfo:509^12*/ { org.apache.struts.taglib.logic.EqualTag __jsp_taghandler_244=(org.apache.struts.taglib.logic.EqualTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.logic.EqualTag.class,"org.apache.struts.taglib.logic.EqualTag name property value"); __jsp_taghandler_244.setParent(__jsp_taghandler_237); __jsp_taghandler_244.setName("ActivosForm"); __jsp_taghandler_244.setProperty("opcion"); __jsp_taghandler_244.setValue("5"); __jsp_tag_starteval=__jsp_taghandler_244.doStartTag(); if (OracleJspRuntime.checkStartTagEval(__jsp_tag_starteval)) { do { /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[270]); /*@lineinfo:translated-code*//*@lineinfo:510^33*/ { org.apache.struts.taglib.html.SubmitTag __jsp_taghandler_245=(org.apache.struts.taglib.html.SubmitTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.SubmitTag.class,"org.apache.struts.taglib.html.SubmitTag indexed onclick property styleClass value"); __jsp_taghandler_245.setParent(__jsp_taghandler_244); __jsp_taghandler_245.setIndexed(true); __jsp_taghandler_245.setOnclick("operacion.value=1;opcion.value=5"); __jsp_taghandler_245.setProperty("boton"); __jsp_taghandler_245.setStyleClass("boton1"); __jsp_taghandler_245.setValue("Reportar"); __jsp_tag_starteval=__jsp_taghandler_245.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_245,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_245.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_245.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_245); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[271]); /*@lineinfo:translated-code*//*@lineinfo:510^159*/ } while (__jsp_taghandler_244.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); } if (__jsp_taghandler_244.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_244); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[272]); /*@lineinfo:translated-code*//*@lineinfo:512^12*/ { org.apache.struts.taglib.logic.EqualTag __jsp_taghandler_246=(org.apache.struts.taglib.logic.EqualTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.logic.EqualTag.class,"org.apache.struts.taglib.logic.EqualTag name property value"); __jsp_taghandler_246.setParent(__jsp_taghandler_237); __jsp_taghandler_246.setName("ActivosForm"); __jsp_taghandler_246.setProperty("opcion"); __jsp_taghandler_246.setValue("3"); __jsp_tag_starteval=__jsp_taghandler_246.doStartTag(); if (OracleJspRuntime.checkStartTagEval(__jsp_tag_starteval)) { do { /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[273]); /*@lineinfo:translated-code*//*@lineinfo:513^33*/ { org.apache.struts.taglib.html.SubmitTag __jsp_taghandler_247=(org.apache.struts.taglib.html.SubmitTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.SubmitTag.class,"org.apache.struts.taglib.html.SubmitTag indexed onclick property styleClass value"); __jsp_taghandler_247.setParent(__jsp_taghandler_246); __jsp_taghandler_247.setIndexed(true); __jsp_taghandler_247.setOnclick("operacion.value=1;opcion.value=3"); __jsp_taghandler_247.setProperty("boton"); __jsp_taghandler_247.setStyleClass("boton1"); __jsp_taghandler_247.setValue("Eliminar"); __jsp_tag_starteval=__jsp_taghandler_247.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_247,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_247.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_247.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_247); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[274]); /*@lineinfo:translated-code*//*@lineinfo:513^159*/ } while (__jsp_taghandler_246.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); } if (__jsp_taghandler_246.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_246); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[275]); /*@lineinfo:translated-code*//*@lineinfo:515^12*/ { org.apache.struts.taglib.logic.EqualTag __jsp_taghandler_248=(org.apache.struts.taglib.logic.EqualTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.logic.EqualTag.class,"org.apache.struts.taglib.logic.EqualTag name property value"); __jsp_taghandler_248.setParent(__jsp_taghandler_237); __jsp_taghandler_248.setName("ActivosForm"); __jsp_taghandler_248.setProperty("opcion"); __jsp_taghandler_248.setValue("2"); __jsp_tag_starteval=__jsp_taghandler_248.doStartTag(); if (OracleJspRuntime.checkStartTagEval(__jsp_tag_starteval)) { do { /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[276]); /*@lineinfo:translated-code*//*@lineinfo:516^33*/ { org.apache.struts.taglib.html.SubmitTag __jsp_taghandler_249=(org.apache.struts.taglib.html.SubmitTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.SubmitTag.class,"org.apache.struts.taglib.html.SubmitTag indexed onclick property styleClass value"); __jsp_taghandler_249.setParent(__jsp_taghandler_248); __jsp_taghandler_249.setIndexed(true); __jsp_taghandler_249.setOnclick("operacion.value=1;opcion.value=2"); __jsp_taghandler_249.setProperty("boton"); __jsp_taghandler_249.setStyleClass("boton1"); __jsp_taghandler_249.setValue("Modificar"); __jsp_tag_starteval=__jsp_taghandler_249.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_249,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_249.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_249.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_249); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[277]); /*@lineinfo:translated-code*//*@lineinfo:516^160*/ } while (__jsp_taghandler_248.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); } if (__jsp_taghandler_248.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_248); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[278]); /*@lineinfo:user-code*//*@lineinfo:519^10*/ if (pnum==0) pnum=1; else pnum=0; /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[279]); /*@lineinfo:translated-code*//*@lineinfo:519^49*/ } while (__jsp_taghandler_237.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_237.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_237); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[280]); /*@lineinfo:translated-code*//*@lineinfo:520^23*/ } while (__jsp_taghandler_231.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); } if (__jsp_taghandler_231.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_231); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[281]); /*@lineinfo:translated-code*//*@lineinfo:527^15*/ } while (__jsp_taghandler_1.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); } if (__jsp_taghandler_1.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_1); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[282]); } catch( Throwable e) { try { if (out != null) out.clear(); } catch( Exception clearException) { } pageContext.handlePageException( e); } finally { OracleJspRuntime.extraHandlePCFinally(pageContext,true); JspFactory.getDefaultFactory().releasePageContext(pageContext); } } private static class __jsp_StaticText { private static final char text[][]=new char[283][]; static { try { text[0] = "\n".toCharArray(); text[1] = "\n".toCharArray(); text[2] = "\n".toCharArray(); text[3] = "\n".toCharArray(); text[4] = "\n<html>\n<head>\n <meta http-equiv=\"Content-Type\" content=\"text/html; charset=windows-125\">\n <meta http-equiv=\"Expires\" content=\"-1\">\n <link href=\"Estilos.css\" rel=\"stylesheet\" type=\"text/css\">\n</head>\n<script language=\"JavaScript\" type=\"text/JavaScript\" src=\"Validaciones2.js?1.3\"></script>\n<script language=\"JavaScript\" type=\"text/JavaScript\">\n function pantallaCompleta(pagina) {\n var ancho = window.screen.availWidth - 50;\n var alto = window.screen.availHeight - 150;\n var omenu = window.open(pagina, \"_blank\", \"width=\"+ancho+\", height=\"+alto+\",left=20,top=20,status=yes,resizable=yes,titlebar=yes,scrollbars=yes,dependent=yes\");\n omenu.focus();\n }\n</script>\n<body onload=\"javascript:document.ActivosForm.act_codgrp.focus()\">\n<table border=\"1\" width=\"100%\" align=\"center\" class=\"soloborde\" bgcolor=\"#C1C1FF\">\n<caption>Activos</caption>\n<tr><td>\n".toCharArray(); text[5] = "\n\n".toCharArray(); text[6] = "\n".toCharArray(); text[7] = "\n".toCharArray(); text[8] = "\n ".toCharArray(); text[9] = "\n ".toCharArray(); text[10] = "\n ".toCharArray(); text[11] = "\n ".toCharArray(); text[12] = "\n ".toCharArray(); text[13] = "\n ".toCharArray(); text[14] = "\n ".toCharArray(); text[15] = "\n ".toCharArray(); text[16] = "\n ".toCharArray(); text[17] = "\n ".toCharArray(); text[18] = "\n ".toCharArray(); text[19] = "\n ".toCharArray(); text[20] = "\n ".toCharArray(); text[21] = "\n ".toCharArray(); text[22] = "\n ".toCharArray(); text[23] = "\n ".toCharArray(); text[24] = "\n ".toCharArray(); text[25] = "\n ".toCharArray(); text[26] = "\n <table width=\"100%\" align=\"center\" class=\"soloborde\" bgcolor=\"#C1C1FF\" border=\"1\">\n <tr>\n <td class=\"S10d\">".toCharArray(); text[27] = "</td>\n <td colspan=\"3\">".toCharArray(); text[28] = "\n ".toCharArray(); text[29] = "</td>\n </tr>\n <tr>\n <td class=\"S10d\">".toCharArray(); text[30] = "</td>\n <td colspan=\"3\">".toCharArray(); text[31] = "\n ".toCharArray(); text[32] = "</td>\n </tr>\n <tr>\n <td class=\"S10d\">".toCharArray(); text[33] = "</td>\n <td colspan=\"3\">".toCharArray(); text[34] = "\n ".toCharArray(); text[35] = "</td>\n </tr>\n <tr>\n <td class=\"S10d\">".toCharArray(); text[36] = "</td>\n <td>".toCharArray(); text[37] = "\n ".toCharArray(); text[38] = "\n ".toCharArray(); text[39] = "</td>\n <td class=\"S10d\">".toCharArray(); text[40] = "</td>\n <td>\n ".toCharArray(); text[41] = " \n </td>\n </tr>\n <tr>\n <td class=\"S10d\">".toCharArray(); text[42] = "</td>\n <td>\n ".toCharArray(); text[43] = " \n </td>\n <td class=\"S10d\">".toCharArray(); text[44] = "</td>\n <td>\n ".toCharArray(); text[45] = " \n </td>\n </tr>\n <tr>\n <td class=\"S10d\">".toCharArray(); text[46] = "</td>\n <td>".toCharArray(); text[47] = "\n ".toCharArray(); text[48] = "\n ".toCharArray(); text[49] = "</td>\n <td class=\"S10d\">".toCharArray(); text[50] = "</td>\n <td>".toCharArray(); text[51] = "\n ".toCharArray(); text[52] = "\n ".toCharArray(); text[53] = "</td>\n </tr>\n <tr>\n <td class=\"S10d\">".toCharArray(); text[54] = "</td>\n <td>".toCharArray(); text[55] = "</td>\n <td class=\"S10d\">".toCharArray(); text[56] = "</td>\n <td>".toCharArray(); text[57] = "</td>\n </tr>\n </table>\n <table width=\"100%\" align=\"center\" class=\"soloborde\" bgcolor=\"#C1C1FF\" border=\"1\">\n <tr>\n <td class=\"S10d\">".toCharArray(); text[58] = "</td>\n <td>".toCharArray(); text[59] = "</td>\n </tr>\n <tr>\n <td class=\"S10d\">".toCharArray(); text[60] = "</td>\n <td>".toCharArray(); text[61] = "</td>\n </tr>\n <tr>\n <td class=\"S10d\">".toCharArray(); text[62] = "</td>\n <td>".toCharArray(); text[63] = "</td>\n </tr>\n <tr>\n <td class=\"S10d\">\n ".toCharArray(); text[64] = "\n </td>\n <td>\n ".toCharArray(); text[65] = "\n </td>\n </tr> \n <tr>\n <td class=\"S10d\">".toCharArray(); text[66] = "*".toCharArray(); text[67] = "</td>\n <td>".toCharArray(); text[68] = "</td>\n </tr>\n </table>\n <table width=\"100%\" align=\"center\" class=\"soloborde\" bgcolor=\"#C1C1FF\" border=\"1\"> \n <tr>\n <td class=\"S10d\">".toCharArray(); text[69] = "</td>\n <td>".toCharArray(); text[70] = "</td>\n <td class=\"S10d\">".toCharArray(); text[71] = "</td>\n <td>".toCharArray(); text[72] = "</td>\n </tr>\n <tr>\n <td class=\"S10d\">".toCharArray(); text[73] = "</td>\n <td>".toCharArray(); text[74] = "</td>\n <td class=\"S10d\">".toCharArray(); text[75] = "</td>\n <td>".toCharArray(); text[76] = "</td>\n </tr>\n <tr>\n <td class=\"S10d\">".toCharArray(); text[77] = "</td>\n <td>".toCharArray(); text[78] = "</td>\n <td class=\"S10d\">".toCharArray(); text[79] = "</td>\n <td>".toCharArray(); text[80] = "</td>\n </tr>\n <tr>\n <td class=\"S10d\">".toCharArray(); text[81] = "</td>\n <td>".toCharArray(); text[82] = "</td>\n <td class=\"S10d\">".toCharArray(); text[83] = "</td>\n <td>".toCharArray(); text[84] = "</td>\n </tr>\n <tr>\n <td class=\"S10d\">".toCharArray(); text[85] = "</td>\n <td>".toCharArray(); text[86] = "</td>\n <td class=\"S10d\">".toCharArray(); text[87] = "</td>\n <td>".toCharArray(); text[88] = "</td>\n </tr>\n <tr>\n <td class=\"S10d\">".toCharArray(); text[89] = "</td>\n <td>".toCharArray(); text[90] = "</td>\n <td class=\"S10d\">".toCharArray(); text[91] = "</td>\n <td>".toCharArray(); text[92] = "</td>\n </tr>\n <tr>\n <td class=\"S10d\">".toCharArray(); text[93] = "</td>\n <td>".toCharArray(); text[94] = "</td>\n <td class=\"S10d\">".toCharArray(); text[95] = "</td>\n <td>".toCharArray(); text[96] = "\n ".toCharArray(); text[97] = "\n ".toCharArray(); text[98] = "\n </td>\n </tr>\n <tr>\n <td class=\"S10d\">".toCharArray(); text[99] = "</td>\n <td>".toCharArray(); text[100] = "</td>\n </tr>\n <tr>\n <td colspan=2>".toCharArray(); text[101] = "</td>\n </tr> \n <tr>\n <td colspan=4>\n <FONT color=\"#FF0000\" face=\"Arial, Helvetica, san-serif\" size=2> \n ".toCharArray(); text[102] = "\n No se olvide verificar la existencia del tipo de cambio para la fecha de compra y la fecha de activación\n ".toCharArray(); text[103] = "\n </FONT>\n </td>\n </tr> \n </table>\n ".toCharArray(); text[104] = "\n ".toCharArray(); text[105] = "\n <table width=\"100%\" align=\"center\" class=\"soloborde\" bgcolor=\"#C1C1FF\" border=\"1\">\n <tr>\n <td class=\"S10d\">".toCharArray(); text[106] = "</td>\n <td colspan=\"3\">".toCharArray(); text[107] = "\n ".toCharArray(); text[108] = "</td>\n </tr>\n <tr>\n <td class=\"S10d\">".toCharArray(); text[109] = "</td>\n <td colspan=\"3\">".toCharArray(); text[110] = "\n ".toCharArray(); text[111] = "</td>\n </tr>\n <tr>\n <td class=\"S10d\">".toCharArray(); text[112] = "</td>\n <td colspan=\"3\">".toCharArray(); text[113] = "\n ".toCharArray(); text[114] = "</td>\n </tr>\n <tr>\n <td class=\"S10d\">".toCharArray(); text[115] = "</td>\n <td>\n ".toCharArray(); text[116] = "\n ".toCharArray(); text[117] = "\n ".toCharArray(); text[118] = "\n </td>\n <td class=\"S10d\">".toCharArray(); text[119] = "</td>\n <td>\n ".toCharArray(); text[120] = " \n </td>\n </tr>\n <tr>\n <td class=\"S10d\">".toCharArray(); text[121] = "</td>\n <td>\n ".toCharArray(); text[122] = " \n </td>\n <td class=\"S10d\">".toCharArray(); text[123] = "</td>\n <td>\n ".toCharArray(); text[124] = " \n </td>\n </tr>\n <tr>\n <td class=\"S10d\">".toCharArray(); text[125] = "</td>\n <td>\n ".toCharArray(); text[126] = " \n </td>\n <td class=\"S10d\">".toCharArray(); text[127] = "</td>\n <td>".toCharArray(); text[128] = "\n ".toCharArray(); text[129] = "\n ".toCharArray(); text[130] = "\n </td> \n </tr>\n <tr>\n <td class=\"S10d\">".toCharArray(); text[131] = "</td>\n <td>\n ".toCharArray(); text[132] = " \n </td>\n <td class=\"S10d\">".toCharArray(); text[133] = "</td>\n <td>".toCharArray(); text[134] = "</td>\n </tr>\n </table>\n <table width=\"100%\" align=\"center\" class=\"soloborde\" bgcolor=\"#C1C1FF\" border=\"1\">\n <tr>\n <td class=\"S10d\">".toCharArray(); text[135] = "</td>\n <td>".toCharArray(); text[136] = "</td>\n </tr>\n <tr>\n <td class=\"S10d\">".toCharArray(); text[137] = "</td>\n <td>".toCharArray(); text[138] = "</td>\n </tr>\n <tr>\n <td class=\"S10d\">".toCharArray(); text[139] = "</td>\n <td>".toCharArray(); text[140] = "</td>\n </tr>\n <tr>\n <td class=\"S10d\">\n ".toCharArray(); text[141] = "\n </td>\n <td>\n ".toCharArray(); text[142] = "\n </td>\n </tr> \n <tr>\n <td class=\"S10d\">".toCharArray(); text[143] = "*".toCharArray(); text[144] = "</td>\n <td>".toCharArray(); text[145] = "</td>\n </tr>\n </table>\n <table width=\"100%\" align=\"center\" class=\"soloborde\" bgcolor=\"#C1C1FF\" border=\"1\"> \n <tr>\n <td class=\"S10d\">".toCharArray(); text[146] = "</td>\n <td>".toCharArray(); text[147] = "</td>\n <td class=\"S10d\">".toCharArray(); text[148] = "</td>\n <td>".toCharArray(); text[149] = "</td>\n </tr>\n <tr>\n <td class=\"S10d\">".toCharArray(); text[150] = "</td>\n <td>".toCharArray(); text[151] = "</td>\n <td class=\"S10d\">".toCharArray(); text[152] = "</td>\n <td>".toCharArray(); text[153] = "</td>\n </tr>\n <tr>\n <td class=\"S10d\">".toCharArray(); text[154] = "</td>\n <td>".toCharArray(); text[155] = "</td>\n <td class=\"S10d\">".toCharArray(); text[156] = "</td>\n <td>".toCharArray(); text[157] = "</td>\n </tr>\n <tr>\n <td class=\"S10d\">".toCharArray(); text[158] = "</td>\n <td>".toCharArray(); text[159] = "</td>\n <td class=\"S10d\">".toCharArray(); text[160] = "</td>\n <td>".toCharArray(); text[161] = "</td>\n </tr>\n <tr>\n <td class=\"S10d\">".toCharArray(); text[162] = "</td>\n <td>".toCharArray(); text[163] = "</td>\n <td class=\"S10d\">".toCharArray(); text[164] = "</td>\n <td>".toCharArray(); text[165] = "</td>\n </tr>\n <tr>\n <td class=\"S10d\">".toCharArray(); text[166] = "</td>\n <td>".toCharArray(); text[167] = "</td>\n <td class=\"S10d\">".toCharArray(); text[168] = "</td>\n <td>".toCharArray(); text[169] = "</td>\n </tr>\n <tr>\n <td class=\"S10d\">".toCharArray(); text[170] = "</td>\n <td>".toCharArray(); text[171] = "</td>\n <td class=\"S10d\">".toCharArray(); text[172] = "</td>\n <td>".toCharArray(); text[173] = "\n ".toCharArray(); text[174] = "\n ".toCharArray(); text[175] = "\n </td>\n </tr>\n <tr>\n <td class=\"S10d\">".toCharArray(); text[176] = "</td>\n <td>".toCharArray(); text[177] = "</td>\n </tr>\n <tr>\n <td colspan=2>".toCharArray(); text[178] = "</td>\n </tr> \n </table> \n ".toCharArray(); text[179] = " \n ".toCharArray(); text[180] = "\n <table width=\"100%\" align=\"center\" class=\"soloborde\" bgcolor=\"#C1C1FF\" border=\"1\">\n <tr>\n <td class=\"S10d\">".toCharArray(); text[181] = "</td>\n <td colspan=\"3\">".toCharArray(); text[182] = "\n ".toCharArray(); text[183] = "</td>\n </tr>\n <tr>\n <td class=\"S10d\">".toCharArray(); text[184] = "</td>\n <td colspan=\"3\">".toCharArray(); text[185] = "\n ".toCharArray(); text[186] = "</td>\n </tr>\n <tr>\n <td class=\"S10d\">".toCharArray(); text[187] = "</td>\n <td colspan=\"3\">".toCharArray(); text[188] = "\n ".toCharArray(); text[189] = "</td>\n </tr>\n <tr>\n <td class=\"S10d\">".toCharArray(); text[190] = "</td>\n <td>\n ".toCharArray(); text[191] = " \n </td>\n <td class=\"S10d\">".toCharArray(); text[192] = "</td>\n <td>\n ".toCharArray(); text[193] = " \n </td>\n </tr>\n <tr>\n <td class=\"S10d\">".toCharArray(); text[194] = "</td>\n <td>\n ".toCharArray(); text[195] = " \n </td>\n <td class=\"S10d\">".toCharArray(); text[196] = "</td>\n <td>\n ".toCharArray(); text[197] = " \n </td>\n </tr>\n <tr>\n <td class=\"S10d\">".toCharArray(); text[198] = "</td>\n <td>\n ".toCharArray(); text[199] = " \n </td>\n <td class=\"S10d\">".toCharArray(); text[200] = "</td>\n <td>\n ".toCharArray(); text[201] = " \n </td>\n </tr>\n <tr>\n <td class=\"S10d\">".toCharArray(); text[202] = "</td>\n <td>\n ".toCharArray(); text[203] = " \n </td>\n <td class=\"S10d\">".toCharArray(); text[204] = "</td>\n <td>".toCharArray(); text[205] = "</td>\n </tr>\n <tr>\n <td colspan=2>".toCharArray(); text[206] = "</td>\n </tr> \n </table>\n ".toCharArray(); text[207] = "\n".toCharArray(); text[208] = "\n".toCharArray(); text[209] = "\n <table width=\"100%\" align=\"center\" class=\"soloborde\" bgcolor=\"#C1C1FF\">\n <tr class=\"T8a\">\n <td>\n ".toCharArray(); text[210] = "\n <tr>\n <td class=\"S10d\">".toCharArray(); text[211] = "</td>\n <td>".toCharArray(); text[212] = "\n ".toCharArray(); text[213] = "\n ".toCharArray(); text[214] = "</td> \n </tr>\n <tr>\n <td class=\"S10d\">".toCharArray(); text[215] = "</td>\n <td>".toCharArray(); text[216] = "\n ".toCharArray(); text[217] = "</td>\n </tr> \n <tr>\n <td class=\"S10d\">".toCharArray(); text[218] = "</td>\n <td>".toCharArray(); text[219] = "\n ".toCharArray(); text[220] = "</td>\n </tr> \n <tr>\n <td class=\"S10d\">".toCharArray(); text[221] = " % = Comodin</td>\n <td>".toCharArray(); text[222] = "</td>\n </tr> \n <tr>\n <td></td>\n <td align=\"left\">\n ".toCharArray(); text[223] = "\n </td>\n </tr>\n ".toCharArray(); text[224] = "\n ".toCharArray(); text[225] = "\n <tr>\n <td class=\"S10d\">".toCharArray(); text[226] = "</td>\n <td>".toCharArray(); text[227] = "\n ".toCharArray(); text[228] = "\n ".toCharArray(); text[229] = "</td> \n </tr>\n <tr>\n <td class=\"S10d\">".toCharArray(); text[230] = "</td>\n <td>".toCharArray(); text[231] = "\n ".toCharArray(); text[232] = "</td>\n </tr> \n <tr>\n <td class=\"S10d\">".toCharArray(); text[233] = "</td>\n <td>".toCharArray(); text[234] = "\n ".toCharArray(); text[235] = "</td>\n </tr> \n <tr>\n <td class=\"S10d\">".toCharArray(); text[236] = " % = Comodin</td>\n <td>".toCharArray(); text[237] = "</td>\n </tr> \n <tr>\n <td></td>\n <td align=\"left\">\n ".toCharArray(); text[238] = "\n </td>\n </tr>\n ".toCharArray(); text[239] = "\n ".toCharArray(); text[240] = "\n <tr>\n <td class=\"S10d\">".toCharArray(); text[241] = "</td>\n <td>".toCharArray(); text[242] = "\n ".toCharArray(); text[243] = "\n ".toCharArray(); text[244] = "</td> \n </tr>\n <tr>\n <td class=\"S10d\">".toCharArray(); text[245] = "</td>\n <td>".toCharArray(); text[246] = "\n ".toCharArray(); text[247] = "</td>\n </tr> \n <tr>\n <td class=\"S10d\">".toCharArray(); text[248] = "</td>\n <td>".toCharArray(); text[249] = "\n ".toCharArray(); text[250] = "</td>\n </tr> \n <tr>\n <td></td>\n <td align=\"left\">\n ".toCharArray(); text[251] = "\n </td>\n </tr>\n ".toCharArray(); text[252] = "\n </td>\n </tr>\n </table>\n".toCharArray(); text[253] = "\n".toCharArray(); text[254] = "\n<table width=\"100%\" align=\"center\" class=\"soloborde\" bgcolor=\"#C1C1FF\" border=\"1\">\n <tr class=\"T8a\">\n <td>\n <table width=\"100%\" align=\"center\" class=\"soloborde\" bgcolor=\"#C1C1FF\" border=\"1\">\n <tr><td>\n ".toCharArray(); text[255] = "\n ".toCharArray(); text[256] = "\n ".toCharArray(); text[257] = "\n ".toCharArray(); text[258] = "\n ".toCharArray(); text[259] = "\n <table width=\"100%\" class=\"soloborde\" bgcolor=\"#C1C1FF\">\n <tr class=\"FondoAzul\">\n <td width=\"60\" scope=\"col\" class=\"S10c\">Código</td>\n <td width=\"60\" scope=\"col\" class=\"S10c\">Grupo</td>\n <td width=\"160\" scope=\"col\" class=\"S10c\">Descripción</td>\n <td></td>\n </tr>\n ".toCharArray(); text[260] = "\n ".toCharArray(); text[261] = "\n ".toCharArray(); text[262] = "\n <tr class=\"T8b\">\n ".toCharArray(); text[263] = "\n <tr class=\"T8a\">\n ".toCharArray(); text[264] = "\n <td>\n ".toCharArray(); text[265] = "-".toCharArray(); text[266] = "-".toCharArray(); text[267] = "</td>\n <td>".toCharArray(); text[268] = "</td>\n <td>".toCharArray(); text[269] = "</td>\n ".toCharArray(); text[270] = "\n <td align=\"right\">".toCharArray(); text[271] = "</td>\n ".toCharArray(); text[272] = "\n ".toCharArray(); text[273] = "\n <td align=\"right\">".toCharArray(); text[274] = "</td>\n ".toCharArray(); text[275] = " \n ".toCharArray(); text[276] = "\n <td align=\"right\">".toCharArray(); text[277] = "</td>\n ".toCharArray(); text[278] = " \n </tr>\n ".toCharArray(); text[279] = "\n ".toCharArray(); text[280] = "\n </table>\n </td></tr> \n </table>\n </td>\n </tr>\n</table>\n".toCharArray(); text[281] = "\n".toCharArray(); text[282] = "\n</td></tr>\n<tr><td align=\"center\" colspan=\"2\" class=\"S10d\">(*) Campos Obligatorios</td></tr>\n</table>\n</body>\n</html>".toCharArray(); } catch (Throwable th) { System.err.println(th); } } } } <file_sep>package ActivosFijos; import org.apache.struts.action.ActionForm; import org.apache.struts.action.ActionErrors; import org.apache.struts.action.ActionError; import org.apache.struts.action.ActionMapping; import javax.servlet.http.HttpServletRequest; public class ParametrosDetalleForm extends ActionForm { String codinstitucion; String codrubaccesorios; String codrubmejoras; String codrubrebajas; String codrub1; String codrub2; String codrub3; String codrub4; String codrub5; String codrub6; String tipdocentrega; String tipdocdevolucion; String tipdoctransferencia; String tipdoctraregionales; String tipdocbaja; String gestion; /** * Reset all properties to their default values. * @param mapping The ActionMapping used to select this instance. * @param request The HTTP Request we are processing. */ public void reset(ActionMapping mapping, HttpServletRequest request) { super.reset(mapping, request); } /** * Validate all properties to their default values. * @param mapping The ActionMapping used to select this instance. * @param request The HTTP Request we are processing. * @return ActionErrors A list of all errors found. */ public ActionErrors validate(ActionMapping mapping, HttpServletRequest request) { return super.validate(mapping, request); } public String getcodinstitucion() { return codinstitucion; } public void setcodinstitucion(String newcodinstitucion) { codinstitucion = newcodinstitucion; } public String getcodrubaccesorios() { return codrubaccesorios; } public void setcodrubaccesorios(String newcodrubaccesorios) { codrubaccesorios = newcodrubaccesorios; } public String getcodrubmejoras() { return codrubmejoras; } public void setcodrubmejoras(String newcodrubmejoras) { codrubmejoras = newcodrubmejoras; } public String getcodrubrebajas() { return codrubrebajas; } public void setcodrubrebajas(String newcodrubrebajas) { codrubrebajas = newcodrubrebajas; } public String getcodrub1() { return codrub1; } public void setcodrub1(String newcodrub1) { codrub1 = newcodrub1; } public String getcodrub2() { return codrub2; } public void setcodrub2(String newcodrub2) { codrub2 = newcodrub2; } public String getcodrub3() { return codrub3; } public void setcodrub3(String newcodrub3) { codrub3 = newcodrub3; } public String getcodrub4() { return codrub4; } public void setcodrub4(String newcodrub4) { codrub4 = newcodrub4; } public String getcodrub5() { return codrub5; } public void setcodrub5(String newcodrub5) { codrub5 = newcodrub5; } public String getcodrub6() { return codrub6; } public void setcodrub6(String newcodrub6) { codrub6 = newcodrub6; } public String getTipdocentrega() { return tipdocentrega; } public void setTipdocentrega(String newTipdocentrega) { tipdocentrega = newTipdocentrega; } public String getTipdocdevolucion() { return tipdocdevolucion; } public void setTipdocdevolucion(String newTipdocdevolucion) { tipdocdevolucion = newTipdocdevolucion; } public String getTipdoctransferencia() { return tipdoctransferencia; } public void setTipdoctransferencia(String newTipdoctransferencia) { tipdoctransferencia = newTipdoctransferencia; } public String getTipdoctraregionales() { return tipdoctraregionales; } public void setTipdoctraregionales(String newTipdoctraregionales) { tipdoctraregionales = newTipdoctraregionales; } public String getTipdocbaja() { return tipdocbaja; } public void setTipdocbaja(String newtipdocbaja) { tipdocbaja = newtipdocbaja; } public String getGestion() { return gestion; } public void setGestion(String newGestion) { gestion = newGestion; } }<file_sep>package ActivosFijos; import org.apache.struts.action.ActionForm; import org.apache.struts.action.ActionErrors; import org.apache.struts.action.ActionError; import org.apache.struts.action.ActionMapping; import javax.servlet.http.HttpServletRequest; public class TipoCambioDetalleForm extends ActionForm { String fecha; double tipcam; double tipufv; /** * Reset all properties to their default values. * @param mapping The ActionMapping used to select this instance. * @param request The HTTP Request we are processing. */ public void reset(ActionMapping mapping, HttpServletRequest request) { super.reset(mapping, request); } /** * Validate all properties to their default values. * @param mapping The ActionMapping used to select this instance. * @param request The HTTP Request we are processing. * @return ActionErrors A list of all errors found. */ public ActionErrors validate(ActionMapping mapping, HttpServletRequest request) { return super.validate(mapping, request); } public String getFecha() { return fecha; } public void setFecha(String newFecha) { fecha = newFecha; } public double getTipcam() { return tipcam; } public void setTipcam(double newTipcam) { tipcam = newTipcam; } public double getTipufv() { return tipufv; } public void setTipufv(double newTipufv) { tipufv = newTipufv; } }<file_sep>package ActivosFijos; import org.apache.struts.action.Action; import org.apache.struts.action.ActionForm; import org.apache.struts.action.ActionForward; import org.apache.struts.action.ActionMapping; import org.apache.struts.action.ActionMessage; import org.apache.struts.action.ActionMessages; import org.apache.struts.action.ActionError; import org.apache.struts.action.ActionErrors; import java.io.IOException; import javax.servlet.ServletException; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import java.util.ArrayList; public class AccesoriosAction extends Action { /** * This is the main action called from the Struts framework. * @param mapping The ActionMapping used to select this instance. * @param form The optional ActionForm bean for this request. * @param request The HTTP Request we are processing. * @param response The HTTP Response we are processing. */ public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException { ActionMessages error = new ActionMessages(); AccesoriosForm finform = (AccesoriosForm)form; InicioForm fInicio = (InicioForm) request.getSession().getAttribute("InicioForm"); String usuario = fInicio.getNombreUsuario(); BDConection bdc = new BDConection(); ArrayList aCalm; ArrayList aCalm2; ArrayList aCalm3; ArrayList aCalm4; System.out.println("Paso conexion"); int it = 0; try { aCalm2 = bdc.listarRubros(0); request.setAttribute("RubrosLista", aCalm2); aCalm3 = bdc.listarRegionales(0); request.setAttribute("RegionalesLista", aCalm3); aCalm4 = bdc.listarGrupos(0); request.setAttribute("GruposLista", aCalm4); System.out.println(finform.getOpcion()); System.out.println(finform.getOperacion()); if (finform.getOperacion()==1) { aCalm = bdc.listarAccesorios(finform.getAcc_codrub(),finform.getAcc_codreg(),finform.getAcc_codigo()); request.setAttribute("AccesoriosLista", aCalm); ArrayList datos = (ArrayList) request.getAttribute("AccesoriosLista"); if (finform.getOpcion()==2) { System.out.println("Entro por modificar"); } if (finform.getOpcion()==3) { System.out.println("Entro por elimonar"); } AccesoriosDetalleForm d = new AccesoriosDetalleForm(); d = (AccesoriosDetalleForm) datos.get(it); finform.setAcc_codrub(d.getCodrub()); finform.setAcc_codreg(d.getCodreg()); finform.setAcc_codigo(d.getCodigo()); finform.setAcc_codrubact(d.getCodrubact()); finform.setAcc_codregact(d.getCodregact()); finform.setAcc_codigoact(d.getCodigoact()); finform.setAcc_codgrp(d.getCodgrp()); finform.setAcc_codmot(d.getCodmot()); finform.setAcc_feccompra(d.getFeccompra()); finform.setAcc_tipcam(d.getTipcam()); finform.setAcc_tipufv(d.getTipufv()); finform.setAcc_umanejo(d.getUmanejo()); finform.setAcc_descripcion(d.getDescripcion()); finform.setAcc_desadicional(d.getDesadicional()); finform.setAcc_proveedor(d.getProveedor()); finform.setAcc_marca(d.getMarca()); finform.setAcc_modelo(d.getModelo()); finform.setAcc_serie1(d.getSerie1()); finform.setAcc_serie2(d.getSerie2()); finform.setAcc_docreferencia(d.getDocreferencia()); finform.setAcc_fecreferencia(d.getFecreferencia()); finform.setAcc_valcobol(d.getValcobol()); finform.setAcc_valcodol(d.getValcodol()); finform.setAcc_valcoufv(d.getValcoufv()); finform.setAcc_fecbaja(d.getFecbaja()); finform.setAcc_docbaja(d.getDocbaja()); finform.setAcc_ordencompra(d.getOrdencompra()); finform.setAcc_numfactura(d.getNumfactura()); finform.setAcc_numcomprobante(d.getNumcomprobante()); finform.setAcc_codanterior(d.getCodanterior()); finform.setAcc_indetiqueta(d.getIndetiqueta()); } if (finform.getOperacion()==2) { try { String msgsql=null; msgsql = bdc.insertaraccesorios(finform.getAcc_codrub(), finform.getAcc_codreg(), finform.getAcc_codigo(),finform.getAcc_codrubact(),finform.getAcc_codregact(),finform.getAcc_codigoact(),finform.getAcc_codgrp(),finform.getAcc_codmot(),finform.getAcc_feccompra(),finform.getAcc_tipcam(),finform.getAcc_tipufv(),finform.getAcc_umanejo(),finform.getAcc_descripcion(),finform.getAcc_desadicional(),finform.getAcc_proveedor(),finform.getAcc_marca(),finform.getAcc_modelo(),finform.getAcc_serie1(),finform.getAcc_serie2(),finform.getAcc_docreferencia(),finform.getAcc_fecreferencia(),finform.getAcc_valcobol(),finform.getAcc_valcodol(),finform.getAcc_valcoufv(),finform.getAcc_fecbaja(),finform.getAcc_docbaja(),finform.getAcc_ordencompra(),finform.getAcc_numfactura(),finform.getAcc_numcomprobante(),finform.getAcc_codanterior(),finform.getAcc_indetiqueta(),fInicio.getTxt_usu(),finform.getOpcion()); System.out.println("Paso insertar"); finform.setAcc_codrub(""); finform.setAcc_codreg(""); finform.setAcc_codigo(0); finform.setAcc_codrubact(""); finform.setAcc_codregact(""); finform.setAcc_codigoact(0); finform.setAcc_codgrp(""); finform.setAcc_codmot(""); finform.setAcc_feccompra(""); finform.setAcc_tipcam(0); finform.setAcc_tipufv(0); finform.setAcc_umanejo(""); finform.setAcc_descripcion(""); finform.setAcc_desadicional(""); finform.setAcc_proveedor(""); finform.setAcc_marca(""); finform.setAcc_modelo(""); finform.setAcc_serie1(""); finform.setAcc_serie2(""); finform.setAcc_docreferencia(""); finform.setAcc_fecreferencia(""); finform.setAcc_valcobol(0); finform.setAcc_valcodol(0); finform.setAcc_valcoufv(0); finform.setAcc_fecbaja(""); finform.setAcc_docbaja(""); finform.setAcc_ordencompra(""); finform.setAcc_numfactura(0); finform.setAcc_numcomprobante(0); finform.setAcc_codanterior(""); finform.setAcc_indetiqueta(""); if (!msgsql.equals("0")) { error.add("error", new ActionMessage("error", msgsql)); saveErrors( request, error ); } } catch (Exception e) { error.add("error", new ActionMessage("errordb", "No se pudo realizar la transaccion.")); error.add("error", new ActionMessage("errordb", e.toString() )); e.printStackTrace(); saveErrors( request, error ); } } } catch (Exception e) { error.add("error", new ActionMessage("errordb", "No se pudo iniciar Accesorios")); error.add("error", new ActionMessage("errordb", e.toString() )); e.printStackTrace(); saveErrors( request, error ); } return mapping.findForward("volver"); } }<file_sep> var sesion=0 var dele0 = new Array() var valo0 = new Array() function ftarget() { f = document.forms[0]; f.target='_blank'; } function cargar_anios() { document.ReportesForm.condicion10.value=document.ReportesForm.condicion5.value.substr(6,4); document.ReportesForm.condicion11.value=Number(document.ReportesForm.condicion5.value.substr(6,4))-1; } //" function cargar() { if ((document.ReportesForm.opcion.value==3)||(document.ReportesForm.opcion.value==5)) { for (var i=0; i < document.ReportesForm.condicion2.options.length; i++) { valo0[i]=document.ReportesForm.condicion2.options[i].value dele0[i]=document.ReportesForm.condicion2.options[i].text } } } function quitar() { var j=0 var k=0 var t=0 dele = new Array() valo = new Array() for (var i=0; i < document.ReportesForm.condicion1.options.length; i++) { if (document.ReportesForm.condicion1.options[i].selected==true) { k=i } } if (sesion==0) { m=0 for (var i=1; i < document.ReportesForm.condicion2.options.length; i++) { valor=document.ReportesForm.condicion2.options[i].text if (valor.substr(0,valor.indexOf("-"))==document.ReportesForm.condicion1.options[k].text) { valor=document.ReportesForm.condicion2.options[i].text valor=valor dele[m]=valor.substr(valor.indexOf("-")+1) valo[m]=document.ReportesForm.condicion2.options[i].value m=m+1 } } sesion=sesion+1 } else { m=0 for (var i=1; i < valo0.length; i++) { valor=dele0[i] if (valor.substr(0,valor.indexOf("-"))==document.ReportesForm.condicion1.options[k].text) { valor=dele0[i] valor=valor dele[m]=valor.substr(valor.indexOf("-")+1) valo[m]=valo0[i] m=m+1 } } } lon=document.ReportesForm.condicion2.options.length for (var i=1; i < lon; i++) { document.ReportesForm.condicion2.options[0]=null } document.ReportesForm.condicion2.options[0]=null n=0 for (var i=0; i < m; i++) { valor="var option0 = new Option(dele[i], valo[i])" eval(valor) eval("document.ReportesForm.condicion2.options[n]=option0") n=++n } } <file_sep> /*@lineinfo:filename=/Inicio.jsp*/ /*@lineinfo:generated-code*/ import oracle.jsp.runtime.*; import javax.servlet.*; import javax.servlet.http.*; import javax.servlet.jsp.*; public class _Inicio extends oracle.jsp.runtime.HttpJsp { public final String _globalsClassName = null; // ** Begin Declarations // ** End Declarations public void _jspService(HttpServletRequest request, HttpServletResponse response) throws java.io.IOException, ServletException { response.setContentType( "text/html;charset=windows-1252"); /* set up the intrinsic variables using the pageContext goober: ** session = HttpSession ** application = ServletContext ** out = JspWriter ** page = this ** config = ServletConfig ** all session/app beans declared in globals.jsa */ PageContext pageContext = JspFactory.getDefaultFactory().getPageContext( this, request, response, null, true, JspWriter.DEFAULT_BUFFER, true); // Note: this is not emitted if the session directive == false HttpSession session = pageContext.getSession(); if (pageContext.getAttribute(OracleJspRuntime.JSP_REQUEST_REDIRECTED, PageContext.REQUEST_SCOPE) != null) { pageContext.setAttribute(OracleJspRuntime.JSP_PAGE_DONTNOTIFY, "true", PageContext.PAGE_SCOPE); JspFactory.getDefaultFactory().releasePageContext(pageContext); return; } int __jsp_tag_starteval; ServletContext application = pageContext.getServletContext(); JspWriter out = pageContext.getOut(); _Inicio page = this; ServletConfig config = pageContext.getServletConfig(); try { // global beans // end global beans out.write(__jsp_StaticText.text[0]); out.write(__jsp_StaticText.text[1]); out.write(__jsp_StaticText.text[2]); /*@lineinfo:translated-code*//*@lineinfo:28^1*/ { org.apache.struts.taglib.html.ErrorsTag __jsp_taghandler_1=(org.apache.struts.taglib.html.ErrorsTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.ErrorsTag.class,"org.apache.struts.taglib.html.ErrorsTag"); __jsp_taghandler_1.setParent(null); __jsp_tag_starteval=__jsp_taghandler_1.doStartTag(); if (OracleJspRuntime.checkStartTagEval(__jsp_tag_starteval)) { do { } while (__jsp_taghandler_1.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); } if (__jsp_taghandler_1.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_1); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[3]); /*@lineinfo:translated-code*//*@lineinfo:33^3*/ { org.apache.struts.taglib.html.FormTag __jsp_taghandler_2=(org.apache.struts.taglib.html.FormTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.FormTag.class,"org.apache.struts.taglib.html.FormTag action focus"); __jsp_taghandler_2.setParent(null); __jsp_taghandler_2.setAction("/inicio"); __jsp_taghandler_2.setFocus("txt_usu"); __jsp_tag_starteval=__jsp_taghandler_2.doStartTag(); if (OracleJspRuntime.checkStartTagEval(__jsp_tag_starteval)) { do { /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[4]); /*@lineinfo:translated-code*//*@lineinfo:34^5*/ { org.apache.struts.taglib.html.HiddenTag __jsp_taghandler_3=(org.apache.struts.taglib.html.HiddenTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.HiddenTag.class,"org.apache.struts.taglib.html.HiddenTag property"); __jsp_taghandler_3.setParent(__jsp_taghandler_2); __jsp_taghandler_3.setProperty("txt_npas"); __jsp_tag_starteval=__jsp_taghandler_3.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_3,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_3.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_3.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_3); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[5]); /*@lineinfo:translated-code*//*@lineinfo:40^47*/ { org.apache.struts.taglib.bean.MessageTag __jsp_taghandler_4=(org.apache.struts.taglib.bean.MessageTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.bean.MessageTag.class,"org.apache.struts.taglib.bean.MessageTag key"); __jsp_taghandler_4.setParent(__jsp_taghandler_2); __jsp_taghandler_4.setKey("login.usuario"); __jsp_tag_starteval=__jsp_taghandler_4.doStartTag(); if (OracleJspRuntime.checkStartTagEval(__jsp_tag_starteval)) { do { } while (__jsp_taghandler_4.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); } if (__jsp_taghandler_4.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_4); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[6]); /*@lineinfo:translated-code*//*@lineinfo:41^33*/ { org.apache.struts.taglib.html.TextTag __jsp_taghandler_5=(org.apache.struts.taglib.html.TextTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.TextTag.class,"org.apache.struts.taglib.html.TextTag accesskey maxlength onblur property size"); __jsp_taghandler_5.setParent(__jsp_taghandler_2); __jsp_taghandler_5.setAccesskey("13"); __jsp_taghandler_5.setMaxlength("15"); __jsp_taghandler_5.setOnblur("Mayusculas(this);"); __jsp_taghandler_5.setProperty("txt_usu"); __jsp_taghandler_5.setSize("15"); __jsp_tag_starteval=__jsp_taghandler_5.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_5,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_5.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_5.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_5); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[7]); /*@lineinfo:translated-code*//*@lineinfo:44^47*/ { org.apache.struts.taglib.bean.MessageTag __jsp_taghandler_6=(org.apache.struts.taglib.bean.MessageTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.bean.MessageTag.class,"org.apache.struts.taglib.bean.MessageTag key"); __jsp_taghandler_6.setParent(__jsp_taghandler_2); __jsp_taghandler_6.setKey("<PASSWORD>"); __jsp_tag_starteval=__jsp_taghandler_6.doStartTag(); if (OracleJspRuntime.checkStartTagEval(__jsp_tag_starteval)) { do { } while (__jsp_taghandler_6.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); } if (__jsp_taghandler_6.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_6); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[8]); /*@lineinfo:translated-code*//*@lineinfo:45^33*/ { org.apache.struts.taglib.html.PasswordTag __jsp_taghandler_7=(org.apache.struts.taglib.html.PasswordTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.PasswordTag.class,"org.apache.struts.taglib.html.PasswordTag accesskey maxlength property size"); __jsp_taghandler_7.setParent(__jsp_taghandler_2); __jsp_taghandler_7.setAccesskey("13"); __jsp_taghandler_7.setMaxlength("17"); __jsp_taghandler_7.setProperty("txt_pas"); __jsp_taghandler_7.setSize("15"); __jsp_tag_starteval=__jsp_taghandler_7.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_7,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_7.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_7.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_7); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[9]); /*@lineinfo:translated-code*//*@lineinfo:48^44*/ { org.apache.struts.taglib.html.SubmitTag __jsp_taghandler_8=(org.apache.struts.taglib.html.SubmitTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.html.SubmitTag.class,"org.apache.struts.taglib.html.SubmitTag styleClass value"); __jsp_taghandler_8.setParent(__jsp_taghandler_2); __jsp_taghandler_8.setStyleClass("boton1"); __jsp_taghandler_8.setValue("Autentificar"); __jsp_tag_starteval=__jsp_taghandler_8.doStartTag(); if (OracleJspRuntime.checkStartBodyTagEval(__jsp_tag_starteval)) { out=OracleJspRuntime.pushBodyIfNeeded(pageContext,__jsp_taghandler_8,__jsp_tag_starteval,out); do { } while (__jsp_taghandler_8.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); out=OracleJspRuntime.popBodyIfNeeded(pageContext,out); } if (__jsp_taghandler_8.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_8); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[10]); /*@lineinfo:translated-code*//*@lineinfo:48^100*/ } while (__jsp_taghandler_2.doAfterBody()==javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN); } if (__jsp_taghandler_2.doEndTag()==javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; OracleJspRuntime.releaseTagHandler(pageContext,__jsp_taghandler_2); } /*@lineinfo:generated-code*/ out.write(__jsp_StaticText.text[11]); } catch( Throwable e) { try { if (out != null) out.clear(); } catch( Exception clearException) { } pageContext.handlePageException( e); } finally { OracleJspRuntime.extraHandlePCFinally(pageContext,true); JspFactory.getDefaultFactory().releasePageContext(pageContext); } } private static class __jsp_StaticText { private static final char text[][]=new char[12][]; static { try { text[0] = "\n".toCharArray(); text[1] = "\n".toCharArray(); text[2] = "\n<html>\n<head>\n <meta http-equiv=\"Content-Type\" content=\"text/html; charset=windows-1252\">\n <link href=\"Estilos.css\" rel=\"stylesheet\" type=\"text/css\">\n <title>SISTEMA DE ACTIVOS FIJOS</title>\n</head>\n<script language=\"JavaScript\" type=\"text/JavaScript\" src=\"Validaciones.js\"></script>\n<script language=\"JavaScript\" type=\"text/JavaScript\" >\n \nfunction limpiar()\n{\n document.InicioForm.txt_usu.value=\"\";\n document.InicioForm.txt_pas.value=\"\";\n document.InicioForm.txt_npas.value=\"\";\n}\n\nfunction checkShortcut()\n{\n if (event.keycode==8 || event.keycode==13) {\n return false;\n }\n}\n</script>\n<span class=\"S10i\">\n".toCharArray(); text[3] = "\n</span>\n\n<body onload=\"limpiar()\" oncontextmenu=\"return false\" onkeydown=\"return checkShortcut()\">\n<br><br><br><br>\n ".toCharArray(); text[4] = " \n ".toCharArray(); text[5] = "\n <table width=65% align=\"center\" class=\"soloborde\" bgcolor=\"#C1C1FF\">\n <tr> <td class=\"FondoAzul\" align=\"center\" colspan=\"2\"><b>Activos fijos</b></td> </tr>\n <tr> <td class=\"FondoAzul\" align=\"center\" colspan=\"2\"><b>Autentificación</b></td> </tr>\n <br>\n <tr>\n <td width=40% class=\"S8\" align=\"right\">".toCharArray(); text[6] = "</td>\n <td width=60% class=\"S8\">".toCharArray(); text[7] = " </td>\n </tr>\n <tr>\n <td width=40% class=\"S8\" align=\"right\">".toCharArray(); text[8] = "</td>\n <td width=60% class=\"S8\">".toCharArray(); text[9] = "</td>\n </tr> \n <tr>\n <tr><td align=\"center\" colspan=\"2\"> ".toCharArray(); text[10] = " </td>\n </tr>\n </table> \n ".toCharArray(); text[11] = " \n</body>\n</html>\n".toCharArray(); } catch (Throwable th) { System.err.println(th); } } } } <file_sep> errors.footer=<hr color="#345487"><br> error=<span class="message"> <strong>Mensaje: </strong>{0} </span><br> mensaje=<span class="message">{0} </span> login.usuario=Nombre Usuario login.password=<PASSWORD> login.newpassword=<PASSWORD> login.conpassword=<PASSWORD> de Acceso financiadores.codigo=Código financiadores.descripcion=Descripción financiadores.fecalta=Fecha Alta funcionarios.codigo=Código funcionarios.descripcion=Nombre funcionarios.cargo=Cargo funcionarios.codofi=Oficina funcionarios.codreg=Regional funcionarios.codfin=Financiador funcionarios.correo=Correo funcionarios.estado=Estado grupos.codigo=Código grupos.descripcion=Descripción Abreviada grupos.codrub=Rubro grupos.estado=Estado oficinas.codigo=Código oficinas.descripcion=Descripción oficinas.codreg=Regional oficinas.codubi=Ubicación partidas.codigo=Código partidas.descripcion=Descripción proyectos.codigo=Código proyectos.descripcion=Descripción proyectos.codfin=Financiador regionales.codigo=Código regionales.descripcion=Descripción regionales.codfun=Responsable usuarios.codigo=Código usuarios.carnet=Carnet usuarios.codfun=Funcionario rubros.codigo=Código rubros.descripcion=Descripción rubros.vidaut=Vida Útil (meses) rubros.porcen=% Depreciación rubros.codpar=Partida rubros.ctadep=Cuenta Depreciación rubros.ctadac=Cuenta Actualización rubros.fecalta=Fecha Alta secbarras.rubro=Rubro secbarras.codreg=Regional secbarras.numero=Número Inicial sectiposdoc.codfin=Financiador sectiposdoc.codreg=Regional sectiposdoc.tipdoc=Tipo de Acta sectiposdoc.numero=Número Inicial tipocambio.fecha=Fecha tipocambio.tipcam=Dólar tipocambio.tipufv=UFV tiposbaja.codigo=Código tiposbaja.descripcion=Descripción tiposdoc.codigo=Código tiposdoc.descripcion=Descripción tiposdoc.feccie=Fecha Cierre ubicaciones.codigo=Código ubicaciones.descripcion=Descripción ubicaciones.direccion=Dirección ubicaciones.codreg=Regional accesorios.codrub=Rubro accesorios.codreg=Regional accesorios.codigo=Código accesorios.codrubact=Rubro Actual accesorios.codregact=Regional Actual accesorios.codigoact=Actual accesorios.codgrp=Grupo accesorios.codmot=Baja accesorios.feccompra=Fecha Compra accesorios.tipcam=Tipo Cambio $us accesorios.tipufv=Tipo UFV accesorios.umanejo=Unidad Manejo accesorios.descripcion=Descripción accesorios.desadicional=Descripción Adicional accesorios.proveedor=Proveedor accesorios.marca=Marca accesorios.modelo=Modelo accesorios.serie1=Serie 1 accesorios.serie2=Serie 2 accesorios.docreferencia=Documento Referencia accesorios.fecreferencia=Fecha Registro accesorios.valcobol=Valor Compra Bs accesorios.valcodol=Valor Compra $us accesorios.valcoufv=Valor Compra UFV accesorios.fecbaja=Fecha Baja accesorios.docbaja=Documento Baja accesorios.ordencompra=Orden Compra accesorios.numfactura=Número Factura accesorios.numcomprobante=Número Compra accesorios.codanterior=Código Anterior accesorios.indetiqueta=Etiqueta activos.codrub=*Rubro activos.codreg=*Regional activos.codigo=*Código activos.codgrp=*Grupo activos.codpar=*Partida activos.codofi=*Oficina activos.codfun=*Funcionario activos.codubi=*Ubicación activos.codfin=*Financiador activos.codpry=*Proyecto activos.codmot=Baja activos.feccompra=*Fecha Compra activos.tipcam=*Tipo Cambio $us activos.tipufv=*Factor UFV activos.umanejo=Unidad Manejo activos.descripcion=*Descripción activos.desadicional=Descripción Adicional activos.proveedor=Proveedor activos.marca=Marca activos.modelo=Modelo activos.serie1=Nro. Serie activos.serie2=Nro. Parte activos.docreferencia=Documento Referencia activos.fecreferencia=*Fecha Registro activos.placa=Placa activos.valcobol=*Valor Compra Bolivianos activos.valcodol=*Valor Compra Dólares activos.valcoufv=*Valor Compra UFV activos.fecbaja=Fecha Baja activos.ordencompra=Orden Compra activos.numfactura=Número Factura activos.numcomprobante=Número Comprobante activos.codanterior=Código Anterior activos.indetiqueta=Identificación Etiqueta activos.fecha=*Fecha Activación activos.vidaut=Vida Útil (meses) activos.estadoactivo=*Estado Activo activos.desestado=Observación Estado activos.indepreciacion=Depreciable activos.numdocumento=Documento Revalúo mejorasrebajas.codrub=*Rubro mejorasrebajas.codreg=*Regional mejorasrebajas.codigo=*Código mejorasrebajas.inmejreb=*Mejora/Rebaja mejorasrebajas.corel=*Correlativo mejorasrebajas.fecha=*Fecha de Compra mejorasrebajas.tipcam=*Tipo Cambio $us mejorasrebajas.tipufv=*Tipo UFV mejorasrebajas.descripcion=*Descripción mejorasrebajas.desadicional=Descripción Adicional mejorasrebajas.proveedor=Proveedor mejorasrebajas.marca=Marca mejorasrebajas.modelo=Modelo mejorasrebajas.serie=Serie mejorasrebajas.docreferencia=*Documento Referencia mejorasrebajas.fecreferencia=*Fecha Registro mejorasrebajas.valbol=*Valor Bolivianos mejorasrebajas.valdol=Valor Dólares mejorasrebajas.valufv=Valor UFV mejorasrebajas.ordencompra=*Orden de Compra mejorasrebajas.numfactura=*Número de Factura mejorasrebajas.numcomprobante=Número de comprobante revaluos.codrub=*Rubro revaluos.codreg=*Regional revaluos.codigo=*Código revaluos.correlmre=Número de Mejora revaluos.numrevaluo=Número de Revalúo revaluos.fecha=*Fecha revaluos.tipcam=*Tipo Cambio $us revaluos.tipufv=*Tipo UFV revaluos.valbol=*Valor Bolivianos revaluos.valdol=Valor Dólares revaluos.valufv=Valor UFV revaluos.depacubol=*Depreciación Acumulada Bolivianos revaluos.depacudol=Depreciación Acumulada Dólares revaluos.depacuufv=Depreciación Acumulada UFV revaluos.vidaut=*Vida Útil (meses) revaluos.estadoactivo=*Estado revaluos.desestado=Observación Estado revaluos.indepreciacion=Identificador revaluos.numdocumento=Documento Revalúo depreciaciones.fecha=Fecha depreciaciones.tipcamini=Tipo Cambio $us Mes Anterior depreciaciones.tipufvini=Tipo UFV Mes Anterior depreciaciones.tipcamfin=Tipo Cambio $us Cierre Mes Actual depreciaciones.tipufvfin=Tipo UFV Cierre Mes Actual depreciaciones.ok=Depreciación Generada reportedepreciacion.codrub=Rubro reportedepreciacion.codreg=Regional reportedepreciacion.codigo=Código reportedepreciacion.numrevaluo=Número Revalúo reportedepreciacion.numdepreciacion=Número Depreciación reportedepreciacion.fecha=Fecha reportedepreciacion.tipcamini=T/C Inicial reportedepreciacion.tipcamfin=T/C Final reportedepreciacion.tipufvini=UFV Inicial reportedepreciacion.tipufvfin=UFV Final reportedepreciacion.factorbol=Factor Bolivianos reportedepreciacion.factordol=Factor Dólares reportedepreciacion.factorufv=Factor UFV reportedepreciacion.actuvalbol=Actualización Bolivianos reportedepreciacion.actuvaldol=Actualización Dólares reportedepreciacion.actuvalufv=Actualización UFV reportedepreciacion.actufacbol=Actualización Factor Bolivianos reportedepreciacion.actufacdol=Actualización Factor Dólares reportedepreciacion.actufacufv=Actualización Factor UFV Documentos.codreg=Regional Documentos.codfin=Financiador Documentos.tipdoc=Tipo Documento Documentos.numero=Número Documentos.fecha=*Fecha Documentos.codofiorigen=Oficina Origen Documentos.codfunorigen=*Funcionario Origen Documentos.codubiorigen=Ubicación Origen Documentos.codfinorigen=Financiador Origen Documentos.codpryorigen=Proyecto Origen Documentos.codofidestino=Oficina Destino Documentos.codfundestino=*Funcionario Destino Documentos.codubidestino=Ubicación Destino Documentos.codfindestino=Financiador Destino Documentos.codprydestino=Proyecto Destino Documentos.observacion=Documento que Respalda Documentos.inconfirma=Indicador Confirmación Documentos.inicio=Número Inicial Documentos.fin=Número Final Documentos.inicod=Codigo Inicial Documentos.fin=Codigo Final activos1.codrub=*Rubro activos1.codreg=*Regional activos1.codigo=*Código activos1.codgrp=*Grupo activos1.codpar=*Partida activos1.codofi=*Oficina activos1.codfun=*Funcionario activos1.codubi=*Ubicación activos1.codfin=*Financiador activos1.codpry=*Proyecto activos1.codmot=Baja activos1.feccompra=*Fecha de Compra activos1.tipcam=*Tipo Cambio $us activos1.tipufv=*Factor UFV activos1.umanejo=*Superficie Terreno/Construcción activos1.descripcion=*Descripción Inmueble activos1.desadicional=Otras Caracteristicas activos1.accesorios=Dirección activos1.proveedor=Proveedor activos1.marca=Marca activos1.modelo=Modelo activos1.serie1=*Testimonio No. activos1.serie2=Código Catastral activos1.docreferencia=*Folio No. activos1.fecreferencia=*Fecha Registro activos1.placa=Placa activos1.procedencia=*Departamento activos1.gobmunicipal=*Provincia activos1.valcobol=*Valor Compra Bs. activos1.valcodol=*Valor Compra $us. activos1.valcoufv=*Valor Compra UFV activos1.fecbaja=Fecha Baja activos1.ordencompra=Orden Compra activos1.numfactura=Número Factura activos1.numcomprobante=Número Comprobante activos1.codanterior=Código Anterior activos1.indetiqueta=Indicador Etiqueta activos1.fecha=*Fecha Activación activos1.vidaut=Vida Útil (meses) activos1.estadoactivo=*Estado Activo activos1.desestado=Observación Estado activos1.indepreciacion=Depreciable activos1.numdocumento=Documento Revalúo activos2.codrub=*Rubro activos2.codreg=*Regional activos2.codigo=*Código activos2.codgrp=*Clase activos2.codpar=*Partida activos2.codofi=*Oficina activos2.codfun=*Responsable activos2.codubi=*Ubicación activos2.codfin=*Financiador activos2.codpry=*Proyecto activos2.codmot=Baja activos2.feccompra=*Fecha Compra activos2.tipcam=*Tipo Cambio $us activos2.tipufv=*Factor UFV activos2.umanejo=*Cilindrada activos2.descripcion=*Descripción activos2.desadicional=Otras Caracteristicas activos2.accesorios=Accesorios activos2.proveedor=Proveedor activos2.marca=*Marca activos2.modelo=*Tipo activos2.serie1=*Chasis activos2.serie2=*Motor activos2.docreferencia=*Carnet Propiedad activos2.fecreferencia=*Fecha Registro activos2.docrefotro=Póliza Importación No. activos2.placa=*Placa activos2.aniofabricacion=*Año Fabricación activos2.color=*Color activos2.procedencia=*Procedencia activos2.gobmunicipal=*Gobierno Municipal activos2.valcobol=*Valor Compra Bs. activos2.valcodol=*Valor Compra $us. activos2.valcoufv=*Valor Compra UFV activos2.fecbaja=Fecha Baja activos2.ordencompra=Orden Compra activos2.numfactura=Número Factura activos2.numcomprobante=Número Comprobante activos2.codanterior=Código Anterior activos2.indetiqueta=Indicador Etiqueta activos2.fecha=*Fecha Activación activos2.vidaut=Vida Útil (meses) activos2.estadoactivo=*Estado Activo activos2.desestado=Observación Estado activos2.indepreciacion=Depreciable activos2.numdocumento=Documento Revalúo activos3.codrub=*Rubro activos3.codreg=*Regional activos3.codigo=*Código activos3.codgrp=*Bien activos3.codpar=*Partida activos3.codofi=*Oficina activos3.codfun=*Responsable activos3.codubi=*Ubicación activos3.codfin=*Financiador activos3.codpry=*Proyecto activos3.codmot=Baja activos3.feccompra=*Fecha Compra activos3.tipcam=*Tipo Cambio $us activos3.tipufv=*Factor UFV activos3.umanejo=*Unidad Manejo activos3.descripcion=*Descripción activos3.desadicional=Otras Caracteristicas activos3.accesorios=Accesorios activos3.proveedor=Proveedor activos3.marca=*Marca activos3.modelo=*Modelo activos3.serie1=*Número Serie activos3.serie2=Serie 2 activos3.docreferencia=Documento Referencia activos3.fecreferencia=Fecha Registro activos3.placa=*Placa activos3.color=Microprocesador activos3.procedencia=Memoria RAM activos3.gobmunicipal=Disco Duro activos3.valcobol=*Valor Compra Bs. activos3.valcodol=*Valor Compra $us. activos3.valcoufv=*Valor Compra UFV activos3.fecbaja=Fecha Baja activos3.ordencompra=Orden Compra activos3.numfactura=Número Factura activos3.numcomprobante=Número Comprobante activos3.codanterior=Código Anterior activos3.indetiqueta=Indicador Etiqueta activos3.fecha=*Fecha Activación activos3.vidaut=Vida Útil (meses) activos3.estadoactivo=*Estado Activo activos3.desestado=Observación Estado activos3.indepreciacion=Depreciable activos3.numdocumento=Documento Revalúo activos4.codrub=*Rubro activos4.codreg=*Regional activos4.codigo=*Código activos4.codgrp=*Bien activos4.codpar=*Partida activos4.codofi=*Oficina activos4.codfun=*Responsable activos4.codubi=*Ubicación activos4.codfin=*Financiador activos4.codpry=*Proyecto activos4.codmot=Baja activos4.feccompra=*Fecha Compra activos4.tipcam=*Tipo Cambio $us activos4.tipufv=*Factor UFV activos4.umanejo=*Unidad Manejo activos4.descripcion=*Descripción activos4.desadicional=Otras Caracteristicas activos4.marca=Marca activos4.color=Color activos4.procedencia=*Material activos4.gobmunicipal=Dimensiones activos4.valcobol=*Valor Compra Bs. activos4.valcodol=*Valor Compra $us. activos4.valcoufv=*Valor Compra UFV activos4.ordencompra=Orden Compra activos4.numfactura=Número Factura activos4.numcomprobante=Número Comprobante activos4.codanterior=Código Anterior activos4.fecha=*Fecha Activación activos4.vidaut=Vida Útil (meses) activos4.estadoactivo=*Estado Activo activos4.desestado=Observación Estado activos4.indepreciacion=Depreciable activos4.numdocumento=Documento Revalúo inventarios.codbarra=Codigo de Barras inventarios.fecha=Fecha inventarios.codofi=Código de Oficina inventarios.codfun=Código de funcionario inventarios.codubi=Códido de Ubicación inventarios.codfin=Código de Financiador inventarios.codpry=Código de Proyecto inventarios.codreg=Código de Regional inventarios.estado=Estado Activo inventarios.mod=Modificación parametros.codinstitucion=Código Institución parametros.codrubaccesorios=Gestión a Depreciar parametros.codrubmejoras=Código Rubro Mejoras parametros.codrubrebajas=Código Rubro Rebajas parametros.codrub1=Código Rubro Terrenos parametros.codrub2=Código Rubro Edificaciones parametros.codrub3=Código Rubro Equipo de Transporte parametros.codrub4=Código Rubro Equipo de Computación parametros.codrub5=Código Rubro Muebles y Enseres parametros.codrub6=Código Rubro Equipo Educacional parametros.tipdocentrega=Tipo de Documento de Entrega parametros.tipdocdevolucion=Tipo de Documento de Devolución parametros.tipdoctransferencia=Tipo de Documento de Transferencia parametros.tipdocbaja=Tipo de Documento de Baja parametros.tipdoctraregionales=Tipo de Documento de Transferencia Entre Regionales parametros.gestion=Gestión Actas
aba506bf2862dbde555410bd2bbc15add1b48f3e
[ "JavaScript", "Java", "INI" ]
41
Java
n1ghtcr4wl3r26/4ct1v0s
1f4e2bef81c0cd1d3b984b917dcf59036f4d79a0
b349ed3a93d202338528b4234541e2dc3146a871
refs/heads/master
<repo_name>ThomasYoung76/ML<file_sep>/KNN/knn_by_ysf.py """ 利用numpy和pandas库实现KNN算法。 """ __author__ = 'YangShiFu' __date__ = '2017-11-18' import numpy as np import pandas as pd from doc import utils def calc_distance(inst1, inst2, length): """ calculate the distance between instance1 and instance2 :param inst1: array-like :param inst2: array-like :param length: int 维度 :return: float """ array_dist = np.power(np.array(inst1[:length]) - np.array(inst2[:length]), 2) return np.sqrt(array_dist.sum()) def get_neighbors(training_set, testing_inst, k): """ 获取训练集中距离k以内的neighbors :param training_set: array-like 训练集 :param testing_inst: array-like 测试实例 :param k: int :return: 距离k以内的neighbors """ training_set = np.array(training_set) testing_inst = np.array(testing_inst) # dist = list(map(lambda x: calc_distance(testing_inst, x, length=len(testing_inst)), training_set)) # training_df = pd.DataFrame(data=training_set) # training_df.insert(loc=1, column='dist', value=dist) # training_df = training_df.sort_values(by=training_df['dist'], axis=1, ascending=True) # training_df = training_df.drop(axis=1, columns='dist') # training_df = training_df[:k] # 取前k行 # return training_df.as_matrix() filt = filter(lambda x: calc_distance(testing_inst, x, length=len(testing_inst)) <= k, training_set) # 过滤出距离小于k return np.array(list(filt)) def prediction(neighbors, is_proba=False): """ 根据邻近数据预测结果,如果is_proba为false则直接返回结果,否则返回各结果的概率 :param neighbors: array-like :param is_proba: bool whether to calc the probability :return: """ df_neighbors = pd.DataFrame(data=neighbors) df_count = df_neighbors.groupby(by=df_neighbors.iloc[:,-1]).count() s_neighbors = df_count.iloc[:, -1] # Series s_neighbors = s_neighbors.sort_values(ascending=False) # sort descending count = [] for index in s_neighbors.index: count.append((index, s_neighbors[index])) # predict or predict_probal if not is_proba: result = [count[0][0], 1] return result else: result = [] index, values = zip(*count) total = sum(values) for i in range(len(count)): result.append((count[i][0], count[i][1]/total)) return result def main(): training_set =utils.array_from_csv('../doc/iris.csv') inst = [3, 4, 4, 1] neighbors = get_neighbors(training_set, inst, 3) print(prediction(neighbors, is_proba=False)) print(prediction(neighbors, is_proba=True)) if __name__ == "__main__": main()<file_sep>/SVM/svm.py """ suppot vector machine """ __author__ = 'YangShiFu' __date__ = '2017-11-20' from sklearn.svm import SVC import numpy as np # traing set np.random.seed(0) X = np.r_[np.random.randn(20, 5) + [2] * 5, np.random.randn(20,5) - [2] * 5] Y = [0] * 20 + [1] * 20 # build SVM algorithm clf = SVC(kernel='linear') clf.fit(X,Y) # to predict y = np.random.randn(1,5) - [1] * 5 print(y) print(clf.predict(y)) print(clf.coef_) print(clf.support_vectors_)<file_sep>/doc/load_datasets.py from sklearn import datasets import pandas as pd iris = datasets.load_iris() df_iris_data = pd.DataFrame(data=iris.data, columns=iris.feature_names) s_iris_target = pd.Series(data=list(map(lambda x: iris.target_names[x], iris.target)), name='target') df_iris = df_iris_data.join(s_iris_target) df_iris.to_csv('iris.csv', encoding='utf-8', index=False) <file_sep>/mean_shift/mean_shift_v1.1.py #!/usr/bin/env python3 ''' @File : mean_shift.py @Time : 2020/04/21 17:33:39 @Author : yangshifu @Version : v1.1 @Contact : <EMAIL> @Desc : 使用meanshift计算视觉中心坐标 ''' import numpy as np # from matplotlib import pyplot # from mpl_toolkits.mplot3d import Axes3D # from sklearn.datasets.samples_generator import make_blobs from pathlib import Path import re from datetime import datetime """ 方法: step1: 取一个点当做圆心, 得到所有在半径为bandwidth的圆里的点, 使用这些点计算他们的平均值坐标(对x, y坐标分别求均值), 即质心. step2: 以质心当圆心, 得到所有在半径为bandwidth的圆里的点, 使用这些点计算他们的质心坐标. step3: 重复step2, 直到下一个质心坐标与圆心坐标完全一样. step4: 遍历所有的定位点, 重复step1到step3. """ class Mean_Shift(): def __init__(self, bandwidth=0.5): self._bandwidth = bandwidth def fit(self, data): scores = {} centers = {} for i in range(len(data)): center = data[i] while True: # 把所有圆内的点放入_in_bandwidth _in_bandwidth = [] for feature in data: distance = np.linalg.norm(center-feature) if int(distance // self._bandwidth) == 0: _in_bandwidth.append(feature) scores[i] = len(_in_bandwidth) # 找到质心坐标 new_center = np.average(_in_bandwidth, axis=0) # 质心和圆心为同一点时 if not (new_center - center).all(): centers[i] = new_center break center = new_center index = sorted(scores.items(), key=lambda x: x[1], reverse=True)[0][0] self.center = centers[index] def get_data(file_name): result_xz = np.genfromtxt(file_name, dtype=str, usecols=[0, 1,2], delimiter=',') for i in range(len(result_xz)): result_xz[i][0] = Path(result_xz[i][0]).parent.name.split('_')[-3:][0] # ms.fit() dict_xz_point = {} dict_xz_area = {} for row in result_xz: # dict_xz_point的key是点 if row[0] not in dict_xz_point.keys(): dict_xz_point[row[0]] = [list(map(float, row[1:]))] else: dict_xz_point[row[0]].append(list(map(float, row[1:]))) # dict_xz_area的key是区 area_id = re.match(r'[A-Za-z]+', row[0]).group() if area_id not in dict_xz_area.keys(): dict_xz_area[area_id] = [list(map(float, row[1:]))] else: dict_xz_area[area_id].append(list(map(float, row[1:]))) # for point in dict_xz_point: # print(point) # data = dict_xz_point[point] # break return dict_xz_point if __name__ == "__main__": ms = Mean_Shift(0.5) file_name = r"/home/SENSETIME/yangshifu/Documents/gitlab/armap/result/ret_xzy_20200421.txt" dict_xz_point = get_data(file_name) fa = open("GT_center.csv", 'w') for point in dict_xz_point: data = np.array(dict_xz_point[point]) start = datetime.now() ms.fit(data) end = datetime.now() print(f"{point},{ms.center[0]},{ms.center[1]},0", file=fa) # print(f"循环次数: {ms.count}") elapsed = (end - start).seconds print(f"points count: {len(data)}. elpased: {elapsed}s") <file_sep>/doc/utils.py """ 定义通用方法 """ __author__ = 'YangShiFu' __date__ = '2017-11-18' import numpy as np import pandas as pd def array_from_csv(filename, encoding='utf-8'): """ load data from csv str_file. and return a tuple :param filename: csv str_file :param encoding: :return: ndarray """ df = pd.read_csv(filename, encoding=encoding) return df.as_matrix() if __name__ == "__main__": # test X, y data = array_from_csv('buy_computers.csv') X,y = data[:, :-1], data[:, -1] print(X) print(y) <file_sep>/KNN/knn_iris.py """ 使用sklearn模块实现KNN算法,通过iris中的training datas来预测testing datas """ __author__ = 'YangShiFu' __date__ = '2017-11-18' import numpy as np from sklearn.datasets import load_iris from sklearn.neighbors import KNeighborsClassifier from doc import utils # X is training data and y is target values iris = load_iris() X,y = iris.data, iris.target # fit the models using X and y knn = KNeighborsClassifier(n_neighbors=3, algorithm='brute') knn.fit(X,y) # to predict predict_iris = knn.predict_proba([[3, 4, 4, 1]]) print(predict_iris) <file_sep>/DTree/entropy.py """ Desion Tree entropy: f(p) = -log(p) H(X) = - (p1 * log(p1) + p2 * log(p2) ) ID3 """ import csv from sklearn.feature_extraction import DictVectorizer from sklearn import preprocessing from sklearn import tree import graphviz # read data fa = open('../doc/buy_computers.csv', 'r') reader = csv.reader(fa) # features heads = next(reader) feature_list = [] # featureas lable_list = [] # class lales for row in reader: lable_list.append(row[len(row)-1]) row_dict = {} for i in range(1, len(heads)-1): row_dict[heads[i]] = row[i] feature_list.append(row_dict) # vectorize features vector = DictVectorizer() print(vector) dummyX = vector.fit_transform(feature_list).toarray() # vectorize class labels lb = preprocessing.LabelBinarizer() dummyY = lb.fit_transform(lable_list) clf = tree.DecisionTreeClassifier(criterion='entropy') clf.fit(dummyX, dummyY) # 保存dot文件,使用graphviz转换成pdf # with open('pt_information_gain.dot', 'w') as f: # dot_data = tree.export_graphviz(clf, f, feature_names=vector.get_feature_names()) # 直接使用graphviz库来把文件保存为pdf和dot格式 dot_data = tree.export_graphviz(clf, out_file=None, feature_names=vector.get_feature_names()) graph = graphviz.Source(dot_data) graph.render('tree') # 预测 new_rowX = dummyX[0:1] print(new_rowX) predictY = clf.predict(new_rowX) predictY = clf.predict_proba() print(predictY)
319c3a0d6723468cefdf8e80ab79ea83c9274dd4
[ "Python" ]
7
Python
ThomasYoung76/ML
9c536d857ef4121c2ad457cda34b118c34dc0bf3
665f545662eb7f0c8ab281805f0b0baf3c430949
refs/heads/master
<file_sep>package fuli; import java.awt.Color; import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; import java.text.NumberFormat; import javax.swing.DefaultComboBoxModel; import javax.swing.JButton; import javax.swing.JComboBox; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JPanel; import javax.swing.JTextField; import javax.swing.SwingUtilities; import javax.swing.UIManager; import javax.swing.border.LineBorder; import org.dyno.visual.swing.layouts.Constraints; import org.dyno.visual.swing.layouts.GroupLayout; import org.dyno.visual.swing.layouts.Leading; //VS4E -- DO NOT REMOVE THIS LINE! public class fuli_2 extends JFrame { private static final long serialVersionUID = 1L; private JLabel jLabel0; private JLabel jLabel1; private JPanel jPanel1; private JPanel jPanel0; private JLabel jLabel2; private JButton jButton4; private JLabel jLabel3; private JTextField jTextField0; private JTextField jTextField1; private JTextField jTextField2; private JTextField jTextField3; private static final MouseEvent event2 = null; private JComboBox jComboBox0; private JComboBox jComboBox1; private JButton jButton1; private JLabel jLabel4; private static final String PREFERRED_LOOK_AND_FEEL = "javax.swing.plaf.metal.MetalLookAndFeel"; public fuli_2() { initComponents(); } private void initComponents() { setLayout(new GroupLayout()); add(getJPanel0(), new Constraints(new Leading(9, 304, 10, 10), new Leading(80, 361, 10, 10))); add(getJComboBox1(), new Constraints(new Leading(23, 10, 10), new Leading(19, 10, 10))); setSize(320, 449); } private JLabel getJLabel4() { if (jLabel4 == null) { jLabel4 = new JLabel(); jLabel4.setText("%"); } return jLabel4; } private JButton getJButton1() { if (jButton1 == null) { jButton1 = new JButton(); jButton1.setText("确定"); jButton1.addMouseListener(new MouseAdapter() { public void mouseClicked(MouseEvent event) { jButton1MouseMouseClicked(event); } }); } return jButton1; } private JComboBox getJComboBox1() { if (jComboBox1 == null) { jComboBox1 = new JComboBox(); jComboBox1.setModel(new DefaultComboBoxModel(new Object[] { "复利计算", "单利计算" })); jComboBox1.setDoubleBuffered(false); jComboBox1.setBorder(null); jComboBox1.addMouseListener(new MouseAdapter() { }); } return jComboBox1; } private JComboBox getJComboBox0() { if (jComboBox0 == null) { jComboBox0 = new JComboBox(); jComboBox0.setModel(new DefaultComboBoxModel(new Object[] { "终值计算", "本金计算" ,"年限计算","利息计算"})); jComboBox0.setDoubleBuffered(false); jComboBox0.setBorder(null); jComboBox0.addMouseListener(new MouseAdapter() { }); } return jComboBox0; } private JTextField getJTextField3() { if (jTextField3 == null) { jTextField3 = new JTextField(10); } return jTextField3; } private JTextField getJTextField2() { if (jTextField2 == null) { jTextField2 = new JTextField(); } return jTextField2; } private JTextField getJTextField1() { if (jTextField1 == null) { jTextField1 = new JTextField(10); } return jTextField1; } private JTextField getJTextField0() { if (jTextField0 == null) { jTextField0 = new JTextField(10); } return jTextField0; } private JLabel getJLabel3() { if (jLabel3 == null) { jLabel3 = new JLabel(); jLabel3.setText("终值"); } return jLabel3; } private JButton getJButton4() { if (jButton4 == null) { jButton4 = new JButton(); jButton4.setText("确定"); jButton4.addMouseListener(new MouseAdapter() { public void mouseClicked(MouseEvent event) { jButton4MouseMouseClicked(event); } }); } return jButton4; } private JLabel getJLabel2() { if (jLabel2 == null) { jLabel2 = new JLabel(); jLabel2.setText("利率"); } return jLabel2; } private JPanel getJPanel0() { if (jPanel0 == null) { jPanel0 = new JPanel(); jPanel0.setBorder(new LineBorder(Color.red, 1, false)); jPanel0.setLayout(new GroupLayout()); jPanel0.add(getJPanel1(), new Constraints(new Leading(17, 261, 10, 10), new Leading(74, 264, 10, 10))); jPanel0.add(getJComboBox0(), new Constraints(new Leading(14, 10, 10), new Leading(20, 10, 10))); jPanel0.add(getJButton1(), new Constraints(new Leading(119, 10, 10), new Leading(19, 12, 12))); } return jPanel0; } private JPanel getJPanel1() { if (jPanel1 == null) { jPanel1 = new JPanel(); jPanel1.setBorder(new LineBorder(Color.black, 1, false)); jPanel1.setLayout(new GroupLayout()); jPanel1.add(getJLabel0(), new Constraints(new Leading(14, 10, 10), new Leading(26, 10, 10))); jPanel1.add(getJLabel1(), new Constraints(new Leading(14, 12, 12), new Leading(113, 10, 10))); jPanel1.add(getJLabel2(), new Constraints(new Leading(12, 12, 12), new Leading(70, 10, 10))); jPanel1.add(getJButton4(), new Constraints(new Leading(74, 10, 10), new Leading(161, 10, 10))); jPanel1.add(getJLabel3(), new Constraints(new Leading(14, 12, 12), new Leading(215, 10, 10))); jPanel1.add(getJTextField0(), new Constraints(new Leading(60, 182, 10, 10), new Leading(26, 12, 12))); jPanel1.add(getJTextField3(), new Constraints(new Leading(60, 178, 12, 12), new Leading(213, 12, 12))); jPanel1.add(getJTextField1(), new Constraints(new Leading(60, 182, 12, 12), new Leading(113, 12, 12))); jPanel1.add(getJLabel4(), new Constraints(new Leading(56, 26, 12, 12), new Leading(72, 12, 12))); jPanel1.add(getJTextField2(), new Constraints(new Leading(74, 158, 12, 12), new Leading(70, 12, 12))); } return jPanel1; } private JLabel getJLabel1() { if (jLabel1 == null) { jLabel1 = new JLabel(); jLabel1.setText("年限"); } return jLabel1; } private JLabel getJLabel0() { if (jLabel0 == null) { jLabel0 = new JLabel(); jLabel0.setText("本金"); } return jLabel0; } private static void installLnF() { try { String lnfClassname = PREFERRED_LOOK_AND_FEEL; if (lnfClassname == null) lnfClassname = UIManager.getCrossPlatformLookAndFeelClassName(); UIManager.setLookAndFeel(lnfClassname); } catch (Exception e) { System.err.println("Cannot install " + PREFERRED_LOOK_AND_FEEL + " on this platform:" + e.getMessage()); } } /** * Main entry of the class. * Note: This class is only created so that you can easily preview the result at runtime. * It is not expected to be managed by the designer. * You can modify it as you like. */ public static void main(String[] args) { installLnF(); SwingUtilities.invokeLater(new Runnable() { public void run() { fuli_2 frame = new fuli_2(); frame.setDefaultCloseOperation(fuli_2.EXIT_ON_CLOSE); frame.setTitle("复利、单利计算 "); frame.getContentPane().setPreferredSize(frame.getSize()); frame.pack(); frame.setLocationRelativeTo(null); frame.setVisible(true); } }); } //终值,本金 private void jButton1MouseMouseClicked(MouseEvent event) { if (jComboBox0.getSelectedItem() == "终值计算") { jPanel1 = new JPanel(); jTextField0 = new JTextField(); jTextField1 = new JTextField(); jTextField2 = new JTextField(); jTextField3 = new JTextField(); } else if (jComboBox0.getSelectedItem() == "本金计算") { jPanel1 = new JPanel(); this.jLabel0.setText("终值"); this.jLabel3.setText("本金"); } else if (jComboBox0.getSelectedItem() == "年限计算") { jPanel1 = new JPanel(); this.jLabel0.setText("本金"); this.jLabel1.setText("终值"); this.jLabel3.setText("年限"); } else if (jComboBox0.getSelectedItem() == "利息计算") { jPanel1 = new JPanel(); this.jLabel0.setText("本金"); this.jLabel3.setText("利息"); this.jLabel1.setText("年限"); } } private void jButton4MouseMouseClicked(MouseEvent event) { NumberFormat currencyformatter = NumberFormat.getCurrencyInstance(); // 字符串转化为数字 double p = Double.parseDouble(jTextField0.getText()); double r = Double.parseDouble(jTextField1.getText()); double n = Double.parseDouble(jTextField2.getText()); double f=0; if (jComboBox1.getSelectedItem() == "复利计算") { if (jComboBox0.getSelectedItem() == "终值计算") { f = p * Math.pow((1 + 0.01*r),n); } else if (jComboBox0.getSelectedItem() == "本金计算") { f = p/Math.pow((1+0.01*r), n); } else if (jComboBox0.getSelectedItem() == "年限计算") { f=0; } else if (jComboBox0.getSelectedItem() == "利息计算") { f=p * Math.pow((1 + 0.01*r),n)-1; } } else { if (jComboBox0.getSelectedItem() == "终值计算") { f = p*(1+0.01*r*n); } else if (jComboBox0.getSelectedItem() == "本金计算") { f = p/(1+0.01*r*n); } else if (jComboBox0.getSelectedItem() == "年限计算") { f=0; } else if (jComboBox0.getSelectedItem() == "利息计算") { f=p*(1+0.01*r*n)-p; } } jTextField3.setText(String.valueOf(f)); } } <file_sep>package name.feisky.android.test; import android.test.AndroidTestCase; import junit.framework.Assert; public class PersonServiceTest extends AndroidTestCase{ public void testSave()throws Exception{ PersonService service=new PersonService(); service.save(null); } //加法运算 public void testAdd()throws Exception{ PersonService service=new PersonService(); int result=service.add(1, 2); Assert.assertEquals(3, result); Assert.assertEquals(2, result); } //减法运算 public void testAdd1()throws Exception{ PersonService service=new PersonService(); int result=service.add1(1, 2); Assert.assertEquals(-1, result); Assert.assertEquals(0.5, result); } //乘法运算 public void testAdd2()throws Exception{ PersonService service=new PersonService(); int result=service.add2(1, 2); Assert.assertEquals(2, result); Assert.assertEquals(3, result); } //除法运算 public void testAdd3()throws Exception{ PersonService service=new PersonService(); int result=service.add3(1, 2); Assert.assertEquals(0.5, result); Assert.assertEquals(1, result); } }
2a12818c769073f790ee7e0352b125017a6d6512
[ "Java" ]
2
Java
LanLeaf/Lan-work
ca97965a1a0cc94b9bbd4ae3c56596c6a2b22191
a7a27c2e34ccacf7679887f0fab2a1e9b52f133d
refs/heads/master
<file_sep>import { Component, OnInit } from '@angular/core'; import { Person } from 'src/app/models/person.model'; import { PhoneNumber } from 'src/app/models/phoneNumber.model'; import { PhoneNumberService } from 'src/app/services/phoneNumber.service'; @Component({ selector: 'app-list-phone-numbers', templateUrl: './list-phone-numbers.component.html', styleUrls: ['./list-phone-numbers.component.css'] }) export class ListPhoneNumbersComponent implements OnInit { phones: PhoneNumber[]; constructor(private _phoneNumberService: PhoneNumberService) { } ngOnInit() { this.getPhoneNumbers(); } public getPhoneNumbers() { this._phoneNumberService.getPhoneNumbers().subscribe((data: Person[]) => { this.phones = data['data'].personObjects; }); } } <file_sep>import { BrowserModule } from '@angular/platform-browser'; import { NgModule } from '@angular/core'; import { AppComponent } from './app.component'; import { ListPhoneNumbersComponent } from './components/list-phone-numbers/list-phone-numbers.component'; import { CreatePhoneNumbersComponent } from './components/create-phone-numbers/create-phone-numbers.component'; import { Routes, RouterModule } from '@angular/router'; import { HttpClientModule } from '@angular/common/http'; import { PhoneNumberService } from './services/phoneNumber.service'; const appRoutes: Routes = [ { path: 'list', component: ListPhoneNumbersComponent }, { path: 'create', component: CreatePhoneNumbersComponent }, { path: '', redirectTo: '/list', pathMatch: 'full' } ]; @NgModule({ declarations: [ AppComponent, ListPhoneNumbersComponent, CreatePhoneNumbersComponent ], imports: [ BrowserModule, HttpClientModule, RouterModule.forRoot(appRoutes) ], providers: [ PhoneNumberService ], bootstrap: [AppComponent] }) export class AppModule { } <file_sep>import { Person } from "./person.model"; export class PhoneNumber { id: string; phoneNumber: string; person: Person; type: string; } <file_sep>import { PhoneNumber } from "./phoneNumber.model"; export class Person { businessEntityID: string; name: string; phones: PhoneNumber[]; } <file_sep>import { Injectable } from '@angular/core'; import { HttpClient } from '@angular/common/http'; @Injectable() export class PhoneNumberService { API_URL = 'http://localhost:5000'; constructor(private httpClient: HttpClient) { } getPhoneNumbers() { return this.httpClient.get(`${this.API_URL}/api/Person`); } } <file_sep>using AutoMapper; using Microsoft.AspNetCore.Mvc; using Examples.Charge.Application.Interfaces; using Examples.Charge.Application.Messages.Request; using Examples.Charge.Application.Messages.Response; using System.Threading.Tasks; using Examples.Charge.API; namespace Persons.Charge.API.Controllers { [Route("api/[controller]")] [ApiController] public class PersonController : BaseController { private IPersonFacade _facade; public PersonController(IPersonFacade facade, IMapper mapper) { _facade = facade; } [HttpGet] public async Task<ActionResult<PersonResponse>> Get() => Response(await _facade.FindAllAsync()); [HttpGet("{id}")] public ActionResult<string> Get(int id) { return Response(null); } [HttpPost] public IActionResult Post([FromBody] PersonRequest request) { return Response(0, null); } } }
7143aaad1410d925e58e2618d736a153b369cecf
[ "C#", "TypeScript" ]
6
TypeScript
brunosr1985/projeto_desafio
58fc7ea15f39e103e4d4487934db5e94252a0994
ce34273ee0a161bcd533b0d7c2e5e9a7879e3254
refs/heads/master
<repo_name>kedriss/AudrenCyril<file_sep>/src/main/java/cli/bean/jpa/ResponsableEntity.java /* * Created on 19 nov. 2015 ( Time 13:31:06 ) * Generated by Telosys Tools Generator ( version 2.1.1 ) */ // This Bean has a basic Primary Key (not composite) package cli.bean.jpa; import java.io.Serializable; //import javax.validation.constraints.* ; //import org.hibernate.validator.constraints.* ; import java.util.List; import javax.persistence.*; /** * Persistent class for entity stored in table "RESPONSABLE" * * @author Telosys Tools Generator * */ @Entity @Table(name="RESPONSABLE", schema="PUBLIC", catalog="MARIAGEAUDRENCYRIL" ) @NamedQueries ( { @NamedQuery ( name="ResponsableEntity.countAll", query="SELECT COUNT(x) FROM ResponsableEntity x" ) } ) public class ResponsableEntity implements Serializable { private static final long serialVersionUID = 1L; //---------------------------------------------------------------------- // ENTITY PRIMARY KEY ( BASED ON A SINGLE FIELD ) //---------------------------------------------------------------------- @Id @GeneratedValue(strategy=GenerationType.AUTO) @Column(name="ID", nullable=false) private Integer id ; //---------------------------------------------------------------------- // ENTITY DATA FIELDS //---------------------------------------------------------------------- @Column(name="NOM", nullable=false, length=255) private String nom ; @Column(name="MDP", nullable=false, length=255) private String mdp ; @Column(name="ESTADMIN", nullable=false) private Boolean estadmin ; //---------------------------------------------------------------------- // ENTITY LINKS ( RELATIONSHIP ) //---------------------------------------------------------------------- @OneToMany(mappedBy="responsable", targetEntity=PersonneEntity.class) private List<PersonneEntity> listOfPersonne; //---------------------------------------------------------------------- // CONSTRUCTOR(S) //---------------------------------------------------------------------- public ResponsableEntity() { super(); } //---------------------------------------------------------------------- // GETTER & SETTER FOR THE KEY FIELD //---------------------------------------------------------------------- public void setId( Integer id ) { this.id = id ; } public Integer getId() { return this.id; } //---------------------------------------------------------------------- // GETTERS & SETTERS FOR FIELDS //---------------------------------------------------------------------- //--- DATABASE MAPPING : NOM ( VARCHAR ) public void setNom( String nom ) { this.nom = nom; } public String getNom() { return this.nom; } //--- DATABASE MAPPING : MDP ( VARCHAR ) public void setMdp( String mdp ) { this.mdp = mdp; } public String getMdp() { return this.mdp; } //--- DATABASE MAPPING : ESTADMIN ( BOOLEAN ) public void setEstadmin( Boolean estadmin ) { this.estadmin = estadmin; } public Boolean getEstadmin() { return this.estadmin; } //---------------------------------------------------------------------- // GETTERS & SETTERS FOR LINKS //---------------------------------------------------------------------- public void setListOfPersonne( List<PersonneEntity> listOfPersonne ) { this.listOfPersonne = listOfPersonne; } public List<PersonneEntity> getListOfPersonne() { return this.listOfPersonne; } //---------------------------------------------------------------------- // toString METHOD //---------------------------------------------------------------------- public String toString() { StringBuffer sb = new StringBuffer(); sb.append("["); sb.append(id); sb.append("]:"); sb.append(nom); sb.append("|"); sb.append(mdp); sb.append("|"); sb.append(estadmin); return sb.toString(); } } <file_sep>/src/main/java/cli/persistence/services/ResponsablePersistence.java /* * Created on 19 nov. 2015 ( Time 13:31:06 ) * Generated by Telosys Tools Generator ( version 2.1.1 ) */ package cli.persistence.services; import java.util.List; import java.util.Map; import cli.bean.jpa.ResponsableEntity; /** * Basic persistence operations for entity "Responsable" * * This Bean has a basic Primary Key : Integer * * @author Telosys Tools Generator * */ public interface ResponsablePersistence { /** * Deletes the given entity <br> * Transactional operation ( begin transaction and commit ) * @param responsable * @return true if found and deleted, false if not found */ public boolean delete(ResponsableEntity responsable) ; /** * Deletes the entity by its Primary Key <br> * Transactional operation ( begin transaction and commit ) * @param id * @return true if found and deleted, false if not found */ public boolean delete(Integer id) ; /** * Inserts the given entity and commit <br> * Transactional operation ( begin transaction and commit ) * @param responsable */ public void insert(ResponsableEntity responsable) ; /** * Loads the entity for the given Primary Key <br> * @param id * @return the entity loaded (or null if not found) */ public ResponsableEntity load(Integer id) ; /** * Loads ALL the entities (use with caution) * @return */ public List<ResponsableEntity> loadAll() ; /** * Loads a list of entities using the given "named query" without parameter * @param queryName * @return */ public List<ResponsableEntity> loadByNamedQuery(String queryName) ; /** * Loads a list of entities using the given "named query" with parameters * @param queryName * @param queryParameters * @return */ public List<ResponsableEntity> loadByNamedQuery(String queryName, Map<String, Object> queryParameters) ; /** * Saves (create or update) the given entity <br> * Transactional operation ( begin transaction and commit ) * @param responsable * @return */ public ResponsableEntity save(ResponsableEntity responsable) ; /** * Search the entities matching the given search criteria * @param criteria * @return */ public List<ResponsableEntity> search( Map<String, Object> criteria ) ; /** * Count all the occurrences * @return */ public long countAll(); } <file_sep>/src/main/java/cli/servlet/admin/ListeInvite.java package cli.servlet.admin; import java.io.IOException; import java.util.List; import javax.servlet.RequestDispatcher; import javax.servlet.ServletContext; import javax.servlet.ServletException; import javax.servlet.annotation.WebServlet; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import cli.bean.jpa.PersonneEntity; import cli.bean.jpa.ResponsableEntity; import cli.persistence.services.jpa.PersonnePersistenceJPA; import cli.persistence.services.jpa.ResponsablePersistenceJPA; /** * Servlet implementation class ListeInvite */ @WebServlet("/ListeInvite/*") public class ListeInvite extends HttpServlet { private String JSP_PATH ="/view/listeInvite.jsp"; private static final long serialVersionUID = 1L; /** * @see HttpServlet#HttpServlet() */ public ListeInvite() { super(); // TODO Auto-generated constructor stub } public void handleRequest(HttpServletRequest request, HttpServletResponse response){ String pathInfo= request.getPathInfo(); System.out.println(" yo les mec"+pathInfo+""); switch(pathInfo+""){ case "/add": System.out.println("addpersonne"); ajouterPersonne(request); break; case "/addResponsable": System.out.println("addResponsable"); addResponsable(request); break; case "/deleteResponsable": deleteResponsable(request); break; case "/deleteInvite": deleteInvite(request); break; } AfficherListeInvite(request,response); RequestDispatcher rd; ServletContext context = this.getServletContext(); rd = context.getRequestDispatcher(JSP_PATH); try { rd.forward(request, response); } catch (Exception e) {} } private void deleteInvite(HttpServletRequest request) { String identifiant = request.getParameter("id"); int id = Integer.valueOf(identifiant); try{ new PersonnePersistenceJPA().delete(id); } catch(Exception e){ } } private void deleteResponsable(HttpServletRequest request) { String identifiant = request.getParameter("id"); int id = Integer.valueOf(identifiant); try{ new ResponsablePersistenceJPA().delete(new ResponsablePersistenceJPA().load(id)); } catch(Exception e){ System.out.println("Erreur lors de la suppression du Responsable "+identifiant); } } private void addResponsable(HttpServletRequest request) { String nom = request.getParameter("nom"); String mdp = request.getParameter("mdp"); boolean estadmin = request.getParameter("estadmin").equals("on"); ResponsablePersistenceJPA responsableManager = new ResponsablePersistenceJPA(); ResponsableEntity responsable = new ResponsableEntity(); responsable.setEstadmin(estadmin); responsable.setNom(nom); responsable.setMdp(mdp); responsableManager.insert(responsable); } private void ajouterPersonne(HttpServletRequest request) { PersonnePersistenceJPA PersonneManager = new PersonnePersistenceJPA(); ResponsablePersistenceJPA responsableMnanger = new ResponsablePersistenceJPA(); String nom = request.getParameter("nom"); String prenom = request.getParameter("prenom"); String mail = request.getParameter("mail"); boolean estadulte = request.getParameter("estAdulte").equals("on"); boolean invitesoir = request.getParameter("inviteSoir").equals("on"); boolean vientsoir = request.getParameter("vientSoir").equals("on"); boolean invitevin = request.getParameter("inviteVin").equals("on"); boolean vientvin = request.getParameter("vientVin").equals("on"); ResponsableEntity responsable = responsableMnanger.load(Integer.valueOf(request.getParameter("responsable"))); PersonneEntity personne = new PersonneEntity(); personne.setEstadulte(estadulte); personne.setNom(nom); personne.setPrenom(prenom); personne.setMail(mail); personne.setResponsable(responsable); personne.setInvitesoir(invitesoir); personne.setVientsoir(vientsoir); personne.setInvitevin(invitevin); personne.setVientvin(vientvin); PersonneManager.insert(personne); } private void AfficherListeInvite(HttpServletRequest request, HttpServletResponse response) { PersonnePersistenceJPA personneManager = new PersonnePersistenceJPA(); ResponsablePersistenceJPA responsableManager = new ResponsablePersistenceJPA(); List<PersonneEntity> personnes = personneManager.loadByNamedQuery("PersonneEntity.ordered"); List<ResponsableEntity> responsables = responsableManager.loadAll(); request.setAttribute("ListeInvites", personnes); request.setAttribute("ListeResponsables", responsables); } /** * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response) */ protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { handleRequest(request, response); // response.getWriter().append("Served at: ").append(request.getContextPath()); } /** * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response) */ protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { doGet(request, response); } }
8eb15332556a6529803c6bf2db2b6303f09e3eee
[ "Java" ]
3
Java
kedriss/AudrenCyril
e59174dd730fbf548d31147cd556b1eca8fc3adf
ca6a1f69b451afd67b69f28d01c8afba03f826a2
refs/heads/master
<repo_name>s-coimbra21/relate<file_sep>/test/store/link.js import expect from 'expect'; import Link from '../../lib/store/link'; describe('Link', () => { const link = new Link('a'); const arraylink = new Link(['a', 'b']); it('Stores data received from argument', () => { expect(link.nodes).toEqual('a'); expect(arraylink.nodes).toEqual(['a', 'b']); }); it('Gets data received', () => { expect(link.get()).toEqual('a'); expect(arraylink.get()).toEqual(['a', 'b']); }); }); <file_sep>/lib/store/link.js export default class Link { constructor (nodes) { // nodes can be an array of nodes or a single one this.nodes = nodes; } get () { return this.nodes; } }
e954abe38b004f891da4817747357d6332f8965d
[ "JavaScript" ]
2
JavaScript
s-coimbra21/relate
e5dafbf578839f251e5dddcc380624140d282c75
f7ea10ac9c617e97eb0ef227deef359f6ae411dc
refs/heads/master
<repo_name>nodecraft/ini<file_sep>/README.md An ini format parser and serializer for node. [![Build Status](https://github.com/nodecraft/ini/workflows/Test/badge.svg)](https://github.com/nodecraft/ini/actions?workflow=Test) [![Coverage Status](https://coveralls.io/repos/github/nodecraft/ini/badge.svg?branch=master)](https://coveralls.io/github/nodecraft/ini?branch=master) Sections are treated as nested objects. Items before the first heading are saved on the object directly. ## Differences from https://github.com/npm/ini ### Code Improvements - Tests fixed for EOL on different systems - Readability fixes - Modernised code ### New `inlineArrays` option An `inlineArrays` option to parse the following. This is common in Unreal Engine games. ```ini sServerAdmins=12345 sServerAdmins=54321 sServerAdmins=09876 ``` Previously, only the last `sServerAdmins` would be retained and the previous ones would be stripped. Now, when this option is passed, this is parsed into an array: `[12345, 54321, 09876]` ### New `defaultValue` option An `defaultValue` option when decoding to use when encountering a key without a value. ```ini key= secondkey ``` Previously both keys would contain the value `true`, now both keys would contain whatever this option is set to, or an empty string if this option is not set. This is a breaking change, and will decode some inputs differently. ## New `forceStringifyKeys` optoin Sometimes you need to write strings into an `ini` file with quotes around them, such as: ```ini key="some string" ``` By passing an array of `forceStringifyKeys`, you can specify which keys are forced stringified with `JSON.stringify` and therefore maintain their quotes. Note: This is pretty limited currently in that it doesn't account for the same key being in different sections, but covers our current use-case. ## Usage Consider an ini-file `config.ini` that looks like this: ; this comment is being ignored scope = global [database] user = dbuser password = <PASSWORD> database = use_this_database [paths.default] datadir = /var/lib/data array[] = first value array[] = second value array[] = third value You can read, manipulate and write the ini-file like so: var fs = require('fs') , ini = require('ini') var config = ini.parse(fs.readFileSync('./config.ini', 'utf-8')) config.scope = 'local' config.database.database = 'use_another_database' config.paths.default.tmpdir = '/tmp' delete config.paths.default.datadir config.paths.default.array.push('fourth value') fs.writeFileSync('./config_modified.ini', ini.stringify(config, { section: 'section' })) This will result in a file called `config_modified.ini` being written to the filesystem with the following content: [section] scope=local [section.database] user=dbuser password=<PASSWORD> database=use_another_database [section.paths.default] tmpdir=/tmp array[]=first value array[]=second value array[]=third value array[]=fourth value ## API ### decode(inistring, [options]) Decode the ini-style formatted `inistring` into a nested object. The `options` object may contain the following: * `inlineArrays` Whether to parse duplicate key values as an array. See usage above for more info. ### parse(inistring, [options]) Alias for `decode(inistring)` ### encode(object, [options]) Encode the object `object` into an ini-style formatted string. If the optional parameter `section` is given, then all top-level properties of the object are put into this section and the `section`-string is prepended to all sub-sections, see the usage example above. The `options` object may contain the following: * `section` A string which will be the first `section` in the encoded ini data. Defaults to none. * `inlineArrays` Whether to parse duplicate key values as an array. See usage above for more info. * `whitespace` Boolean to specify whether to put whitespace around the `=` character. By default, whitespace is omitted, to be friendly to some persnickety old parsers that don't tolerate it well. But some find that it's more human-readable and pretty with the whitespace. For backwards compatibility reasons, if a `string` options is passed in, then it is assumed to be the `section` value. ### stringify(object, [options]) Alias for `encode(object, [options])` ### safe(val) Escapes the string `val` such that it is safe to be used as a key or value in an ini-file. Basically escapes quotes. For example ini.safe('"unsafe string"') would result in "\"unsafe string\"" ### unsafe(val) Unescapes the string `val` <file_sep>/ini.js 'use strict'; /* eslint-disable no-use-before-define */ const {hasOwnProperty} = Object.prototype; const eol = require('os').EOL; function isConstructorOrProto(obj, key){ return key === 'constructor' && typeof obj[key] === 'function' || key === '__proto__'; } const encode = (obj, options) => { const children = []; let out = ''; // opt.section is passed in recursively. If passed in on top-level, it'll affect both the top-level ini keys, and any children if(typeof options === 'string'){ options = { section: options, whitespace: false, inlineArrays: false, }; }else{ options = options || Object.create(null); options.whitespace = options.whitespace === true; } const separator = options.whitespace ? ' = ' : '='; for(const [key, val] of Object.entries(obj)){ if(val && Array.isArray(val)){ for(const item of val){ if(options.inlineArrays){ out += safe(key, null, options) + separator + safe(item, null, options) + eol; }else{ // real code out += safe(key + '[]', null, options) + separator + safe(item, null, options) + eol; } } }else if(val && typeof val === 'object'){ children.push(key); }else{ out += safe(key, null, options) + separator + safe(val, key, options) + eol; } } if(options.section && out.length > 0){ out = '[' + safe(options.section, null, options) + ']' + eol + out; } for(const key of children){ const parsedSection = dotSplit(key).join('\\.'); const section = (options.section ? options.section + '.' : '') + parsedSection; const child = encode(obj[key], { section: section, whitespace: options.whitespace, inlineArrays: options.inlineArrays, forceStringifyKeys: options.forceStringifyKeys, }); if(out.length > 0 && child.length > 0){ out += eol; } out += child; } return out; }; const dotSplit = str => str.replace(/\1/g, '\u0002LITERAL\\1LITERAL\u0002') .replace(/\\\./g, '\u0001') .split(/\./) .map(part => part.replace(/\1/g, '\\.') .replace(/\2LITERAL\\1LITERAL\2/g, '\u0001')); const decode = (str, options = {}) => { const defaultValue = typeof options.defaultValue !== 'undefined' ? options.defaultValue : ''; const out = Object.create(null); let ref = out; let section = null; // section |key = value const re = /^\[([^\]]*)]$|^([^=]+)(?:=(.*))?$/i; const lines = str.split(/[\n\r]+/g); const commentMatch = /^\s*[#;]/; for(const line of lines){ if(!line || commentMatch.test(line)){ continue; } const match = line.match(re); if(!match){ continue; } if(match[1] !== undefined){ section = unsafe(match[1]); if(isConstructorOrProto(out, section)){ // not allowed // keep parsing the section, but don't attach it. ref = Object.create(null); continue; } ref = out[section] = out[section] || Object.create(null); continue; } let key = unsafe(match[2]); if(isConstructorOrProto(ref, key)){ continue; } let value = match[3] ? unsafe(match[3]) : defaultValue; switch(value){ case 'true': case 'True': case 'TRUE': case 'false': case 'False': case 'FALSE': case 'null': value = JSON.parse(value.toLowerCase()); } // Convert keys with '[]' suffix to an array if(key.length > 2 && key.slice(-2) === '[]'){ key = key.slice(0, Math.max(0, key.length - 2)); if(isConstructorOrProto(ref, key)){ continue; } if(!hasOwnProperty.call(ref, key)){ ref[key] = []; }else if(!Array.isArray(ref[key])){ ref[key] = [ref[key]]; } }else if(options.inlineArrays && typeof(ref[key]) !== 'undefined' && !Array.isArray(ref[key])){ ref[key] = [ref[key]]; } // safeguard against resetting a previously defined // array by accidentally forgetting the brackets if(Array.isArray(ref[key])){ ref[key].push(value); }else{ ref[key] = value; } } // {a:{y:1},"a.b":{x:2}} --> {a:{y:1,b:{x:2}}} // use a filter to return the keys that have to be deleted. const remove = []; for(const key of Object.keys(out)){ if(!hasOwnProperty.call(out, key) || typeof out[key] !== 'object' || Array.isArray(out[key])){ continue; } // see if the parent section is also an object. // if so, add it to that, and mark this one for deletion const parts = dotSplit(key); let outPart = out; const lastKey = parts.pop(); const unescapedLastKey = lastKey.replace(/\\\./g, '.'); for(const part of parts){ if(isConstructorOrProto(outPart, part)){ continue; } if(!hasOwnProperty.call(outPart, part) || typeof outPart[part] !== 'object'){ outPart[part] = Object.create(null); } outPart = outPart[part]; } if(outPart === out && unescapedLastKey === lastKey){ continue; } outPart[unescapedLastKey] = out[key]; remove.push(key); } for(const del of remove){ delete out[del]; } return out; }; // determines if string is encased in quotes const isQuoted = val => (val.startsWith('"') && val.endsWith('"')) || (val.startsWith("'") && val.endsWith("'")); // escapes the string val such that it is safe to be used as a key or value in an ini-file. Basically escapes quotes const safe = (val, key, options = {}) => { // all kinds of values and keys if(typeof val !== 'string' || /[\n\r=]/.test(val) || /^\[/.test(val) || (val.length > 1 && isQuoted(val)) || val !== val.trim()){ return JSON.stringify(val); } // force stringify certain keys if(key && options.forceStringifyKeys && options.forceStringifyKeys.includes(key)){ return JSON.stringify(val); } // comments return val.replace(/;/g, '\\;').replace(/#/g, '\\#'); }; // unescapes the string val const unsafe = (val) => { const escapableChars = '\\;#'; const commentChars = ';#'; val = (val || '').trim(); if(isQuoted(val)){ // remove the single quotes before calling JSON.parse if(val.charAt(0) === "'"){ val = val.substr(1, val.length - 2); // eslint-disable-line unicorn/prefer-string-slice } try{ val = JSON.parse(val); }catch{ // we tried :( } return val; } // walk the val to find the first not-escaped ; character let isEscaping = false; let escapedVal = ''; for(let i = 0, len = val.length; i < len; i++){ const char = val.charAt(i); if(isEscaping){ // check if this character is an escapable character like \ or ; or # if(escapableChars.includes(char)){ escapedVal += char; }else{ escapedVal += '\\' + char; } isEscaping = false; }else if(commentChars.includes(char)){ break; }else if(char === '\\'){ isEscaping = true; }else{ escapedVal += char; } } // we're still escaping - something isn't right. Close out with an escaped escape char if(isEscaping){ escapedVal += '\\'; } return escapedVal.trim(); }; module.exports = { parse: decode, decode, stringify: encode, encode, safe, unsafe, };<file_sep>/test/foo.js 'use strict'; const fs = require("fs"); const path = require("path"); const ini = require("../"); const tap = require("tap"); const test = tap.test; const fixture = path.resolve(__dirname, "./fixtures/foo.ini"); const fixtureInlineArrays = path.resolve(__dirname, "./fixtures/fooInlineArrays.ini"); const data = fs.readFileSync(fixture, "utf8"); const dataInlineArrays = fs.readFileSync(fixtureInlineArrays, "utf8"); const eol = require('os').EOL; const expectE = 'o=p' + eol + 'a with spaces=b c' + eol + '" xa n p "="\\"\\r\\nyoyoyo\\r\\r\\n"' + eol + '"[disturbing]"=hey you never know' + eol + 's=something' + eol + 's1="something\'' + eol + 's2=something else' + eol + 'zr[]=deedee' + eol + 'ar[]=one' + eol + 'ar[]=three' + eol + 'ar[]=this is included' + eol + 'br=warm' + eol + 'eq="eq=eq"' + eol + 'nv=' + eol + eol + '[a]' + eol + 'av=a val' + eol + 'e={ o: p, a: ' + '{ av: a val, b: { c: { e: "this [value]" ' + '} } } }' + eol + 'j="\\"{ o: \\"p\\", a: { av:' + ' \\"a val\\", b: { c: { e: \\"this [value]' + '\\" } } } }\\""' + eol + '"[]"=a square?' + eol + 'cr[]=four' + eol + 'cr[]=eight' + eol + eol + '[a.b.c]' + eol + 'e=1' + eol + 'j=2' + eol + eol + '[x\\.y\\.z]' + eol + 'x.y.z=xyz' + eol + eol + '[x\\.y\\.z.a\\.b\\.c]' + eol + 'a.b.c=abc' + eol + 'nocomment=this\\; this is not a comment' + eol + 'noHashComment=this\\# this is not a comment' + eol; const expectEInlineArrays = 'o=p' + eol + 'a with spaces=b c' + eol + '" xa n p "="\\"\\r\\nyoyoyo\\r\\r\\n"' + eol + '"[disturbing]"=hey you never know' + eol + 's=something' + eol + 's1="something\'' + eol + 's2=something else' + eol + 'zr=deedee' + eol + 'ar=one' + eol + 'ar=three' + eol + 'ar=this is included' + eol + 'br=warm' + eol + 'eq="eq=eq"' + eol + 'nv=' + eol + eol + '[a]' + eol + 'av=a val' + eol + 'e={ o: p, a: ' + '{ av: a val, b: { c: { e: "this [value]" ' + '} } } }' + eol + 'j="\\"{ o: \\"p\\", a: { av:' + ' \\"a val\\", b: { c: { e: \\"this [value]' + '\\" } } } }\\""' + eol + '"[]"=a square?' + eol + 'cr=four' + eol + 'cr=eight' + eol + eol + '[a.b.c]' + eol + 'e=1' + eol + 'j=2' + eol + eol + '[x\\.y\\.z]' + eol + 'x.y.z=xyz' + eol + eol + '[x\\.y\\.z.a\\.b\\.c]' + eol + 'a.b.c=abc' + eol + 'nocomment=this\\; this is not a comment' + eol + 'noHashComment=this\\# this is not a comment' + eol; const expectforceStringifyKeys = 'o=p' + eol + 'a with spaces=b c' + eol + '" xa n p "="\\"\\r\\nyoyoyo\\r\\r\\n"' + eol + '"[disturbing]"=hey you never know' + eol + 's=something' + eol + 's1="something\'' + eol + 's2=something else' + eol + 'zr[]=deedee' + eol + 'ar[]=one' + eol + 'ar[]=three' + eol + 'ar[]=this is included' + eol + 'br="warm"' + eol + 'eq="eq=eq"' + eol + 'nv=' + eol + eol + '[a]' + eol + 'av="a val"' + eol + 'e={ o: p, a: ' + '{ av: a val, b: { c: { e: "this [value]" ' + '} } } }' + eol + 'j="\\"{ o: \\"p\\", a: { av:' + ' \\"a val\\", b: { c: { e: \\"this [value]' + '\\" } } } }\\""' + eol + '"[]"=a square?' + eol + 'cr[]=four' + eol + 'cr[]=eight' + eol + eol + '[a.b.c]' + eol + 'e=1' + eol + 'j=2' + eol + eol + '[x\\.y\\.z]' + eol + 'x.y.z=xyz' + eol + eol + '[x\\.y\\.z.a\\.b\\.c]' + eol + 'a.b.c=abc' + eol + 'nocomment=this\\; this is not a comment' + eol + 'noHashComment=this\\# this is not a comment' + eol; const expectD = { o: 'p', 'a with spaces': 'b c', " xa n p ": '"\r\nyoyoyo\r\r\n', '[disturbing]': 'hey you never know', 's': 'something', 's1': '"something\'', 's2': 'something else', 'zr': ['deedee'], 'ar': ['one', 'three', 'this is included'], 'br': 'warm', 'eq': 'eq=eq', 'nv': '', a: { av: 'a val', e: '{ o: p, a: { av: a val, b: { c: { e: "this [value]" } } } }', j: '"{ o: "p", a: { av: "a val", b: { c: { e: "this [value]" } } } }"', "[]": "a square?", cr: [ 'four', 'eight', ], b: { c: { e: '1', j: '2', }, }, }, 'x.y.z': { 'x.y.z': 'xyz', 'a.b.c': { 'a.b.c': 'abc', 'nocomment': 'this; this is not a comment', noHashComment: 'this# this is not a comment', }, }, }; const expectDInlineArrays = { o: 'p', 'a with spaces': 'b c', " xa n p ": '"\r\nyoyoyo\r\r\n', '[disturbing]': 'hey you never know', 's': 'something', 's1': '"something\'', 's2': 'something else', 'zr': 'deedee', 'ar': ['one', 'three', 'this is included'], 'br': ['cold', 'warm'], 'eq': 'eq=eq', 'nv': '', a: { av: 'a val', e: '{ o: p, a: { av: a val, b: { c: { e: "this [value]" } } } }', j: '"{ o: "p", a: { av: "a val", b: { c: { e: "this [value]" } } } }"', "[]": "a square?", cr: [ 'four', 'eight', ], b: { c: { e: '1', j: '2', }, }, }, 'x.y.z': { 'x.y.z': 'xyz', 'a.b.c': { 'a.b.c': 'abc', 'nocomment': 'this; this is not a comment', noHashComment: 'this# this is not a comment', }, }, }; const expectF = '[prefix.log]' + eol + 'type=file' + eol + eol + '[prefix.log.level]' + eol + 'label=debug' + eol + 'value=10' + eol; const expectG = '[log]' + eol + 'type = file' + eol + eol + '[log.level]' + eol + 'label = debug' + eol + 'value = 10' + eol; /*eslint-disable id-length */ test("decode from file", function(t){ const d = ini.decode(data); t.same(d, expectD); t.end(); }); test("decode from file inlineArrays=true", function(t){ const d = ini.decode(dataInlineArrays, {inlineArrays: true}); t.same(d, expectDInlineArrays); t.end(); }); test("encode from data, inlineArrays=false", function(t){ let e = ini.encode(expectD, {inlineArrays: false}); t.same(e, expectE); const obj = {log: {type: 'file', level: {label: 'debug', value: 10}}}; e = ini.encode(obj); t.not(e.slice(0, 1), eol, 'Never a blank first line'); t.not(e.slice(-2), eol + eol, 'Never a blank final line'); t.end(); }); test("encode from data, inlineArrays=true", function(t){ let e = ini.encode(expectD, {inlineArrays: true}); t.same(e, expectEInlineArrays); const obj = {log: {type: 'file', level: {label: 'debug', value: 10}}}; e = ini.encode(obj); t.not(e.slice(0, 1), eol, 'Never a blank first line'); t.not(e.slice(-2), eol + eol, 'Never a blank final line'); t.end(); }); test("encode with option", function(t){ const obj = {log: {type: 'file', level: {label: 'debug', value: 10}}}; const e = ini.encode(obj, {section: 'prefix'}); t.equal(e, expectF); t.end(); }); test("encode with string", function(t){ const obj = {log: {type: 'file', level: {label: 'debug', value: 10}}}; const e = ini.encode(obj, 'prefix'); t.equal(e, expectF); t.end(); }); test("encode with whitespace", function(t){ const obj = {log: {type: 'file', level: {label: 'debug', value: 10}}}; const e = ini.encode(obj, {whitespace: true}); t.equal(e, expectG); t.end(); }); test("encode from data with `forceStringifyKeys`", function(t){ let e = ini.encode(expectD, {forceStringifyKeys: [ 'av', 'br', ]}); t.same(e, expectforceStringifyKeys); const obj = {log: {type: 'file', level: {label: 'debug', value: 10}}}; e = ini.encode(obj); t.not(e.slice(0, 1), eol, 'Never a blank first line'); t.not(e.slice(-2), eol + eol, 'Never a blank final line'); t.end(); }); test('array destructing', function(t){ t.same(ini.decode('[x]' + eol + 'y=1' + eol + 'y[]=2' + eol), { x: { y: [1, 2], }, }); t.end(); }); test('defaulting unset value to an empty string', function(t){ t.same(ini.decode('foo' + eol + 'bar=false' + eol), { foo: '', bar: false, }); t.end(); }); test('defaulting unset value to specified value', function(t){ t.same(ini.decode('foo' + eol + 'bar=false' + eol, {defaultValue: true}), { foo: true, bar: false, }); t.end(); }); test('ignores invalid line (=)', function(t){ t.same(ini.decode('foo=true' + eol + '=' + eol + 'bar=false' + eol), { foo: true, bar: false, }); t.end(); }); test("unsafe escape values", function(t){ t.equal(ini.unsafe(''), ''); t.equal(ini.unsafe('x;y'), 'x'); t.equal(ini.unsafe('x # y'), 'x'); t.equal(ini.unsafe('x "\\'), 'x "\\'); t.end(); }); test("safe escape tests", function(t){ t.equal(ini.safe('abc'), 'abc'); t.equal(ini.safe('abc', 'someKey', {forceStringifyKeys: ['someKey']}), '"abc"'); t.end(); });<file_sep>/test/bar.js 'use strict'; const ini = require('../'); const test = require('tap').test; const data = { 'number': {count: 10}, 'string': {drink: 'white russian'}, 'boolean': {isTrue: true}, 'nested boolean': {theDude: {abides: true, rugCount: 1}}, }; /*eslint-disable id-length */ test('parse(stringify(x)) same x', function(t){ for(const k in data){ const s = ini.stringify(data[k]); t.comment(s, data[k]); t.same(ini.parse(s), data[k]); } t.end(); });
0d75a6115b2cf1e2d254d7c86b85af0baf47a642
[ "Markdown", "JavaScript" ]
4
Markdown
nodecraft/ini
b438bd5b840d76430c42841197cb07457a2fedf1
073632849cfc026611eaacc0f76729558bfe6557
refs/heads/master
<file_sep>export { default as colours } from './colours'; export { default as typography } from './typography'; export * from './utils/typography-utils'; <file_sep>export default ` --font-size-large: 5rem; --font-size-medium: 3rem; --font-size-small: 1rem; `; <file_sep>import React from 'react'; declare type iconType = 'bell' | 'bookmark'; export interface IconProps extends React.SVGProps<SVGAElement> { size: 'small' | 'medium' | 'large'; icon: iconType; } declare const Icon: ({ size, icon, className }: IconProps) => JSX.Element; export default Icon; <file_sep>declare const _default: "\n --font-size-large: 5rem;\n --font-size-medium: 3rem;\n --font-size-small: 1rem;\n"; export default _default; <file_sep>import { TestComponentProps } from './TestComponent'; export declare const Container: import("styled-components").StyledComponent<"div", any, TestComponentProps, never>; export declare const Heading: import("styled-components").StyledComponent<"h1", any, {}, never>; <file_sep>export declare const fontLarge: () => string; export declare const fontSmall: () => string; export declare const abrilFatFace: () => string; <file_sep>export { default as TestComponent } from './components/TestComponent/TestComponent'; export { default as PrimaryButton } from './components/PrimaryButton/PrimaryButton'; export { default as SecondaryButton } from './components/SecondaryButton/SecondaryButton'; export { default as RedTitle } from './components/RedTitle/RedTitle'; export { default as ThemedComponent } from './components/ThemedComponent/ThemedComponent'; export * from './design-system'; export { default as GlobalStyle } from './design-system/globalStyles'; export { default as Icon } from './design-system/icons/Icon'; export { default as ThemeProvider } from './components/ThemeProvider/ThemeProvider'; <file_sep>import styled, { css } from 'styled-components'; import theme from 'styled-theming'; export const Container = styled.div` ${theme('mode', { light: css` background-color: lightgray; color: black; `, dark: css` background-color: darkblue; color: gold; `, })} `; <file_sep>import React from 'react'; export interface BaseButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement> { } declare const BaseButton: ({ className, children, ...otherProps }: BaseButtonProps) => JSX.Element; export default BaseButton; <file_sep>import React from 'react'; declare const _default: { title: string; component: React.ForwardRefExoticComponent<{} & { theme?: any; }>; }; export default _default; export declare const Primary: () => JSX.Element; <file_sep>module.exports = { roots: ["<rootDir>/src"], setupFilesAfterEnv: ["./jest.setup.ts"], moduleFileExtensions: ["ts", "tsx", "js", "jsx"], testPathIgnorePatters: ["node_modules/"], transform: { "^.+\\.tsx?$": "ts-jest", }, preset: "ts-jest", testMatch: ["**/*.test.(ts|tsx|js|jsx)"], moduleNameMapper: { // Mocks the following file formats when tests are run "\\.(jpg|ico|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$": "identity-obj-proxy", "\\.(css|less|scss|sass)$": "identity-obj-proxy", }, }; <file_sep>import { createGlobalStyle } from 'styled-components'; import { colours, typography } from './index'; import abrilfatface_woff from '../assets/fonts/abrilfatface-regular.woff'; import abrilfatface_woff2 from '../assets/fonts/abrilfatface-regular.woff2'; const GlobalStyle = createGlobalStyle` :root { ${colours} ${typography} font-family: 'abril_fatface', sans-serif; } @font-face { font-family: 'abril_fatface'; src: url(${abrilfatface_woff}) format('woff'), url(${abrilfatface_woff2}) format('woff2'); font-weight: normal; font-style: normal; } * { box-sizing: border-box; font-family: inherit; } *::before, *::after { box-sizing: inherit; } `; export default GlobalStyle; <file_sep>import React from 'react'; export interface BaseTitleProps { className?: string; children: React.ReactNode; } declare const BaseTitle: ({ className, children }: BaseTitleProps) => JSX.Element; export default BaseTitle; <file_sep>declare const _default: "\n --primary-colour: orange;\n --secondary-colour: green;\n --tertiary-colour: purple;\n"; export default _default; <file_sep>import { BaseButtonProps } from '../BaseButton/BaseButton'; declare const _default: { title: string; component: import("styled-components").StyledComponent<({ className, children, ...otherProps }: BaseButtonProps) => JSX.Element, any, BaseButtonProps, never>; args: { children: string; }; argTypes: { onClick: { action: string; }; }; }; export default _default; export declare const Primary: any; <file_sep>import React from 'react'; export declare type TestingCompDoisProps = { foo: 'test' | 'example test'; }; declare const TestingCompDois: React.FC<TestingCompDoisProps>; export default TestingCompDois; <file_sep>export default ` --primary-colour: orange; --secondary-colour: green; --tertiary-colour: purple; `; <file_sep>import { BaseButtonProps } from '../BaseButton/BaseButton'; declare const PrimaryButton: import("styled-components").StyledComponent<({ className, children, ...otherProps }: BaseButtonProps) => JSX.Element, any, BaseButtonProps, never>; export default PrimaryButton; <file_sep>import React from 'react'; import { Primary } from '../PrimaryButton/PrimaryButton.stories'; import { Secondary } from '../SecondaryButton/SecondaryButton.stories'; export default { title: 'Form/Subscription', }; Primary.args = { children: 'Primary Button', }; Secondary.args = { children: 'Secondary Button', }; export const PrimarySubscription = () => ( <> <Primary {...Primary.args} /> <Secondary {...Secondary.args} /> </> ); <file_sep>import peerDepsExternal from 'rollup-plugin-peer-deps-external'; import resolve from '@rollup/plugin-node-resolve'; import commonjs from '@rollup/plugin-commonjs'; import typescript from 'rollup-plugin-typescript2'; import postcss from 'rollup-plugin-postcss'; import clear from 'rollup-plugin-clear'; import rebasePlugin from 'rollup-plugin-rebase'; import svgr from '@svgr/rollup'; import { terser } from 'rollup-plugin-terser'; const packageJson = require('./package.json'); export default { input: 'src/index.ts', output: [ { file: packageJson.main, format: 'cjs', sourcemap: true, }, { file: packageJson.module, format: 'esm', sourcemap: true, }, ], plugins: [ peerDepsExternal(), clear({ targets: ['build/'], watch: true, }), rebasePlugin({ include: ['**/*.woff', '**/*.woff2'] }), resolve(), postcss({ modules: true }), commonjs(), // svgr({ ref: true, outDir: 'icons', typescript: true }), typescript({ useTsconfigDeclarationDir: true }), terser(), ], }; <file_sep>import { BaseTitleProps } from '../BaseTitle/BaseTitle'; declare const RedTitle: import("styled-components").StyledComponent<({ className, children }: BaseTitleProps) => JSX.Element, any, BaseTitleProps, never>; export default RedTitle; <file_sep>declare const _default: { title: string; component: import("styled-components").StyledComponent<({ className, children, ...otherProps }: import("../BaseButton/BaseButton").BaseButtonProps) => JSX.Element, any, import("../BaseButton/BaseButton").BaseButtonProps, never>; args: { children: string; }; }; export default _default; export declare const Secondary: any; <file_sep>export const fontLarge = () => ` font-size: var(--font-size-large); color: var(--secondary-colour); `; export const fontSmall = () => ` font-size: var(--font-size-small); color: var(--primary-colour); `; export const abrilFatFace = () => ` font-family: 'abril_fatface', sans-serif; font-weight: normal; font-style: normal; `; <file_sep>import React from "react"; declare const _default: { title: string; component: React.FC<import("./TestingCompDois").TestingCompDoisProps>; }; export default _default; export declare const First: () => JSX.Element; <file_sep>import React from 'react'; export declare type ThemeMode = 'light' | 'dark'; export declare type ThemeProviderProps = { children: React.ReactNode; /** * An object to describe the theme of the application. */ theme: { mode?: ThemeMode; }; }; declare const ThemeProvider: ({ children, theme, }: ThemeProviderProps) => JSX.Element; export default ThemeProvider; <file_sep>declare const _default: { title: string; component: import("styled-components").StyledComponent<({ className, children }: import("../BaseTitle/BaseTitle").BaseTitleProps) => JSX.Element, any, import("../BaseTitle/BaseTitle").BaseTitleProps, never>; args: { children: string; }; }; export default _default; export declare const FirstStory: any; export declare const SecondStory: any; <file_sep>export interface TestComponentProps { mode: 'primary' | 'secondary'; } declare const TestComponent: ({ mode }: TestComponentProps) => JSX.Element; export default TestComponent; <file_sep>import React from 'react'; declare const _default: React.ForwardRefExoticComponent<{} & { theme?: any; }>; export default _default; <file_sep>import { BaseButtonProps } from '../BaseButton/BaseButton'; declare const SecondaryButton: import("styled-components").StyledComponent<({ className, children, ...otherProps }: BaseButtonProps) => JSX.Element, any, BaseButtonProps, never>; export default SecondaryButton; <file_sep>declare namespace _default { const title: string; } export default _default; export function PrimarySubscription(): JSX.Element; <file_sep>declare const _default: { bell: { viewbox: string; path: string; }; bookmark: { viewbox: string; path: string; }; }; export default _default; <file_sep>import * as React from 'react'; import GlobalStyle from '../src/design-system/globalStyles'; import { ThemeProvider } from 'styled-components'; import styled from 'styled-components'; const StoryWrapper = styled.div` display: flex; flex-wrap: wrap; justify-content: center; margin: 0 auto 1rem; padding: 1rem; width: 100%; `; const StoryHeading = styled.h2` font-size: 1rem; margin-bottom: 2rem; text-align: center; width: 100%; `; const StoryContainer = ({ children, description }) => ( <StoryWrapper> <StoryHeading>{description}</StoryHeading> {children} </StoryWrapper> ); const GlobalDecorator = ({ Story }) => ( <> <GlobalStyle /> <ThemeProvider theme={{ mode: 'light' }}> <StoryContainer description='Light theme'> <Story /> </StoryContainer> </ThemeProvider> <ThemeProvider theme={{ mode: 'dark' }}> <StoryContainer description='Dark theme'> <Story /> </StoryContainer> </ThemeProvider> </> ); export default GlobalDecorator;
66336e522a7034d1824b5600e80359da9dff1b8d
[ "JavaScript", "TypeScript" ]
32
TypeScript
Dan-Bird/react-component-library-v2
1c6f265572a52443fb484a3b964ec328269513d3
44fa6e360cc4f91d9093fce8ef5ce330b51cac49
refs/heads/master
<file_sep>SELECT matchid, player FROM goal WHERE teamid = 'GER'; SELECT id,stadium,team1,team2 FROM game WHERE id = 1012; SELECT player, teamid, stadium, mdate FROM game JOIN goal ON (game.id=goal.matchid) WHERE teamid = 'GER'; SELECT team1, team2, player FROM game JOIN goal ON (id=matchid) WHERE player LIKE 'Mario %'; SELECT player, teamid, coach, gtime FROM goal g JOIN eteam e ON g.teamid = e.id WHERE gtime<=10; -- To JOIN game with eteam you could use either game JOIN eteam ON (team1=eteam.id) or game JOIN eteam ON (team2=eteam.id) -- Notice that because id is a column name in both game and eteam you must specify eteam.id instead of just id -- List the dates of the matches and the name of the team in which '<NAME>' was the team1 coach. SELECT mdate,teamname FROM game JOIN eteam ON (team1=eteam.id) WHERE team1 = (SELECT eteam.id FROM eteam WHERE coach = '<NAME>') -- List the player for every goal scored in a game where the stadium was 'National Stadium, Warsaw' SELECT player FROM goal JOIN GAME ON (matchid = id) WHERE stadium = 'National Stadium, Warsaw'; -- The example query shows all goals scored in the Germany-Greece quarterfinal. -- Instead show the name of all players who scored a goal against Germany. SELECT DISTINCT player FROM game JOIN goal on matchid = id WHERE team1 = 'GER' OR team2 = 'GER' AND teamid <> 'GER'; -- Show teamname and the total number of goals scored. SELECT teamname, COUNT(matchid) as TotalGoals FROM eteam JOIN goal ON id=teamid GROUP BY teamname ORDER BY TotalGoals DESC; -- 10 Show the stadium and the number of goals scored in each stadium. SELECT stadium, COUNT(gtime) AS totalgoals FROM game JOIN goal ON id = matchid GROUP by Stadium ORDER BY totalgoals DESC; -- 11. For every match involving 'POL', show the matchid, date and the number of goals scored. SELECT matchid, mdate, COUNT(*) as goals FROM game JOIN goal ON matchid = id WHERE (team1 = 'POL' OR team2 = 'POL') GROUP by matchid, mdate; -- 12.For every match where 'GER' scored, show matchid, match date and the number of goals scored by 'GER' SELECT matchid, mdate, COUNT(*) AS TotalGoals FROM game JOIN goal ON id = matchid WHERE teamid = 'GER' GROUP BY matchid, mdate; -- 13 hardest one: -- List every match with the goals scored by each team as shown. This will use "CASE WHEN" which has not been explained in any previous exercises. -- mdate team1 score1 team2 score2 -- 1 July 2012 ESP 4 ITA 0 -- 10 June 2012 ESP 1 ITA 1 -- 10 June 2012 IRL 1 CRO 3 -- ... -- Notice in the query given every goal is listed. If it was a team1 goal then a 1 appears in score1, otherwise there is a 0. You could SUM this column to get a count of the goals scored by team1. Sort your result by mdate, matchid, team1 and team2. SELECT mdate, team1, SUM(CASE WHEN teamid = team1 THEN 1 ELSE 0 END) score1, team2, SUM(CASE WHEN teamid = team2 THEN 1 ELSE 0 END) score2 FROM game LEFT JOIN goal ON matchid = id GROUP BY mdate, matchid, team1, team2 <file_sep>SELECT id, title FROM movie WHERE yr=1962 SELECT yr FROM movie WHERE title = 'Citizen Kane'; SELECT id, title, yr FROM movie WHERE title LIKE '%Star Trek%' ORDER BY yr; SELECT id FROM actor WHERE name LIKE '<NAME>'; SELECT id FROM movie WHERE title LIKE 'Casablanca'; SELECT name FROM actor JOIN casting ON actor.id = actorid JOIN movie ON movieid=movie.id WHERE title = 'Casablanca'; -- List the films in which '<NAME>ord' has appeared SELECT title FROM movie JOIN casting ON movie.id=movieid JOIN actor ON actor.id= casting.actorid WHERE name = '<NAME>'; -- List the films where '<NAME>' has appeared - but not in the starring role. [Note: the ord field of casting gives the position of the actor. If ord=1 then this actor is in the starring role] SELECT title FROM movie JOIN casting ON movie.id = movieid JOIN actor ON actorid = actor.id WHERE actor.name = '<NAME>' AND ord <> 1; -- List the films together with the leading star for all 1962 films. SELECT title, name FROM movie JOIN casting ON movieid = movie.id JOIN actor ON actorid = actor.id WHERE yr = 1962 AND ord = 1; -- Which were the busiest years for 'Rock Hudson', show the year and the number of movies he made each year for any year in which he made more than 2 movies. SELECT yr,COUNT(title) FROM movie JOIN casting ON movie.id=movieid JOIN actor ON actorid=actor.id WHERE name='<NAME>' GROUP BY yr HAVING COUNT(title) > 1 -- List the film title and the leading actor for all of the films '<NAME>' played in. -- watch video on this one, it explains the nested SELECT, basically the output of -- that nested select will be a list of movieids SELECT title, name FROM movie JOIN casting ON movie.id = movieid JOIN actor ON actorid = actor.id WHERE ord=1 AND movieid IN (SELECT movieid FROM casting JOIN actor ON actorid = actor.id WHERE name = '<NAME>' ); -- Obtain a list, in alphabetical order, of actors who've had at least 15 starring roles. SELECT name FROM actor JOIN casting ON actorid = actor.id WHERE ord = 1 GROUP BY actor.name HAVING COUNT(ord) >= 15; -- List the films released in the year 1978 ordered by the number of actors in the cast, then by title. SELECT title, COUNT(actorid) as cast FROM movie JOIN casting ON movieid=id WHERE yr = 1978 GROUP BY title ORDER BY cast DESC, title ASC; -- Hardest: List all the people who have worked with '<NAME>'. SELECT name FROM actor JOIN casting ON actorid=actor.id JOIN movie ON movieid=movie.id WHERE movie.id IN ( SELECT movieid FROM casting WHERE actorid IN ( SELECT id FROM actor WHERE name = '<NAME>' ) AND actor.name <> '<NAME>' ) -- or select name from actor, (select actorid from casting, (select distinct movieid from casting where actorid in ( select id from actor where name = '<NAME>' ) ) movies_he_is_in where casting.movieid = movies_he_is_in.movieid and actorid not in (select id from actor where name = '<NAME>') ) actors_with_him where actor.id = actors_with_him.actorid;
2d92c3f44116388f6b2c0b5b399bd2fd0eec663d
[ "SQL" ]
2
SQL
joseterrera/sql-joins
1dbff4d489c9b6dcf9596f84addf8dac80c6c3c4
12df695e896ffd053e7d103e8d91151c3e5d51cc
refs/heads/master
<file_sep>global.td = require('testdouble') require('testdouble-jest')(td, jest) // eslint-disable-line <file_sep>'use strict' // const lib = require('..') describe('lib', () => { test.todo('needs test') }) <file_sep>module.exports = { collectCoverage: true, collectCoverageFrom: [ '<rootDir>/packages/*/src/**/*.js' ], testEnvironment: 'node', setupFilesAfterEnv: [ '<rootDir>/test-helpers/testdouble-jest.js' ], setupFiles: [ '<rootDir>/test-helpers/jest.config.js' ], 'testPathIgnorePatterns': [ '<rootDir>/node_modules/', '/build/' ], transform: { '^.+\\.(js|ts|tsx)?$': require.resolve('babel-jest') }, transformIgnorePatterns: [ '<rootDir>.*(node_modules)/(?!(@monorepo-demo))' ] } <file_sep>'use strict' // const ui = require('..') describe('ui', () => { test.todo('needs test') }) <file_sep>'use strict' module.exports = ui function ui () { // TODO } <file_sep>/** * Script to bundle deployable applications build artifacts with a scripts directory * and internal node copy and impl. Can be utilized via npm run package by the CI server to * produce the build artifacts */ const { name } = require('./package.json') const fs = require('fs') const { writeFile, access, symlink } = fs.promises const { resolve, join } = require('path') const { promisify } = require('util') const mkdirp = promisify(require('mkdirp')) const copyFile = promisify(require('fs-extra').copy) const { existsSync } = fs const START_SCRIPT_NAME = 'start.js' const START_SCRIPT_RAW = ` const path = require('path'); const configFile = process.argv[2]; require(configFile); console.log(\`configFile=\${process.cwd()}/\${configFile}\`); console.log(\`process.env.NODE_ENV=\${process.env.NODE_ENV}\`); console.log('Trying to start server', path.join(process.cwd(), 'index.js')); require(path.join(process.cwd(), 'index.js')); ` const DIST_DIR = 'package' const SCRIPTS_DIR = 'scripts' const NODE_BIN_SYM_DIR = './node_modules/.bin' // path to node binary symlink const NODE_BIN_DIR = './node_modules/node/bin/node' // path to local node binary if (!process.env.SCOPES) { console.log(`Please set environment variable $SCOPES to package`) process.exit() } const scopes = process.env.SCOPES.split(',').map(scope => scope.trim()) const scopeRegex = new RegExp(`^@${name}/(.*)$`) async function main () { await Promise.all(scopes.map(async scope => { const scopeMatch = scopeRegex.exec(scope) if (!scopeMatch) { console.log(`$SCOPES must be a comma (',') seperated list of values in the format @${name}/[package]`) process.exit() } const pkgName = scopeMatch[1] const pkgDir = resolve(__dirname, 'packages', pkgName, DIST_DIR) try { // Ensure package exists and destination directory exists await access(pkgDir) } catch (error) { console.log(`${scope} (in $SCOPES) is not a valid package inside ${name}, or it's '${DIST_DIR}' directory has not been created yet.`) process.exit() } const nodeSymLinkPath = join(NODE_BIN_SYM_DIR, 'node') /** * Sometimes, npm does not create the symlink to the local node binary * so we first check if it exists and create it if it does not */ if (!existsSync(nodeSymLinkPath)) { console.log(`Node symlink does not exist. Creating...`) await symlink(resolve(NODE_BIN_DIR), nodeSymLinkPath, 'file') console.log(`Node symlink created. Continuing...`) } try { await access(resolve(__dirname, nodeSymLinkPath)) } catch (error) { console.log(`node must be installed locally [${error.message}]`) process.exit() } const nodeModulesDir = resolve(pkgDir, NODE_BIN_SYM_DIR) const scriptsDir = resolve(pkgDir, SCRIPTS_DIR) // create dest node_modules and scripts dirs in package directory of app being deployed await mkdirp(nodeModulesDir) await mkdirp(scriptsDir) // Moves node_modules binaries into package await copyFile(resolve(__dirname, NODE_BIN_SYM_DIR), resolve(pkgDir, NODE_BIN_SYM_DIR), { dereference: true, filter: async (f) => !!f }) // Moves scripts into package await writeFile(resolve(scriptsDir, START_SCRIPT_NAME), START_SCRIPT_RAW) })) } main() <file_sep>FROM node:11-alpine RUN apk add openrc RUN apk add curl RUN apk add docker RUN apk add git ARG base=https://github.com/docker/machine/releases/download/v0.16.0 RUN curl -L $base/docker-machine-$(uname -s)-$(uname -m) > /tmp/docker-machine RUN chmod +x /tmp/docker-machine RUN mv /tmp/docker-machine /usr/local/bin/docker-machine RUN rc-update add docker boot<file_sep>'use strict' // const api = require('..') describe('api', () => { test.todo('needs test') }) <file_sep># Monorepo Demo [![JavaScript Style Guide](https://img.shields.io/badge/code_style-standard-brightgreen.svg)](https://standardjs.com) [![lerna](https://img.shields.io/badge/maintained%20with-lerna-cc00ff.svg)](https://lernajs.io/) [![Conventional Commits](https://img.shields.io/badge/Conventional%20Commits-1.0.0-yellow.svg)](https://conventionalcommits.org) ## Setup `$ git clone` `$ npm run bootstrap` ## Project Structure The repo follows a monorepo pattern. This pattern is used by companies and products like React, Babel, Ember, and More. Read about monorepos and their pros and cons [here](https://danluu.com/monorepo/) ## How We Do That Important Thing We use [Lerna](https://lernajs.io/) to help us maintain much of our monorepo - **Linting**: Simple. Lint everything with a shared linting configuration at the root. All your code style in *all* of your packages are homogenous (we use StandardJS). - **Unit Testing**: Also easy. Jest runs at the root of the repo, picking up all the tests and running them. *Note*: Some artifacts that are deployed are built at runtime and their coverage comes from `src` as opposed to `build` - **Acceptance Testing**: Also easy (but not *quite* as easy): Lerna calls `npm test` on each package. This should be set to run any acceptance tests for that package - **Versioning**: Also easy (are you noticing a pattern?). Using a combination of tools like `husky`, `commitlint`, and `config-conventional`, we enforce rules on our monorepo's commit messages (you should be doing this *anyway*). By adhereing to this, `@lerna/version` is able to inspect our commits and increment each package's version respectively based on the changes to that package. It also generates `CHANGELOG's` for each package. Much neat. Such semantic. - **Deploying**: Also easy (but not *quite* as easy): Most CI solutions provide apis for diffing specific paths in your source code and running commands based on those results. We can leverage this to tailor a unique deploy strategy for each package. - **Building**: Easy. Run Babel from the root on each package, using Lerna, and a shared Babel config We also get the added benefit of a single codebase for developers to clone to get started, single place for issues, and single place for PRs. Tests for the whole repo are run on each commit, reducing the chance of cross project regressions. ## How to Build An Artifact `lerna` has another command we can utilize called `lerna changed`. This command will inspect the commits since the last git tagging and list the packages that have changed. This can be piped into any pipeline to determine if a particular package has changed. With all of the other tools mentioned above, along with another tool called `ncc`, building an isolated, standalone, build artifact is simple. The CI should set an environment variable `SCOPES` to a comma delineated list of the packages that it would like to 'watch'. Here are the steps to build the artifact - `npm run bootstrap` - `npm run build` - `npm run package` These scripts will take `SCOPES` into account and only build what is necessary for the packages that are included in `$SCOPES`. The result will be a `package` directory in each package you have built. This is your build artifact for that package, dependencies included and all. Deploy the aritfact using `./node_modules/.bin/node ./scripts/start.js` ## Useful Links [Conventional Commits](https://www.conventionalcommits.org/en/v1.0.0-beta.3/) [Independent Versioning](https://michaljanaszek.com/blog/lerna-conventional-commits) (Also good for Verdaccio, which is a private npm registry) [GraphQL Language Cheatsheet](https://github.com/sogko/graphql-schema-language-cheat-sheet) [Why is Babel a monorepo?](https://github.com/babel/babel/blob/master/doc/design/monorepo.md)
1dbc5f081bbc6dc10f4cf811d2b0eeb6eceafab0
[ "JavaScript", "Dockerfile", "Markdown" ]
9
JavaScript
monorepo-demo/monorepo-demo
cb1b18d2c92bbb52473052fd3730b1dcb12b8e0c
8f13575269a115e23f2533890562ca6a884eaddb
refs/heads/main
<repo_name>aislandmin/property-react-redux-hook<file_sep>/src/views/list-page/components/property-list/property-list.jsx import PropertyListIterm from "./property-list-iterm"; import styles from "./property-list.module.scss"; import { connect } from "react-redux"; function PropertyList(props) { const propListData = props.list; return ( <div className={styles["properties"]}> <ul className={styles["property-list"]}> {propListData.map((item, index) => { return <PropertyListIterm itemData={item} key={index} />; })} </ul> </div> ); } export default connect((state) => { const { list } = state; return { list }; })(PropertyList); <file_sep>/src/views/list-page/components/property-search/property-search.jsx import { useState } from "react"; import axios from "axios"; import styles from "./property-search.module.scss"; import { connect } from "react-redux"; import { updateList } from "../../../../redux/list-slice"; import { updateShowOptions } from "../../../../redux/show-option-slice"; function PropertySearch(props) { const [type, setType] = useState("All Types"); async function processSearchByFilter(type) { console.log("processSearchByFilter... ", type); let houCondition = { sortBy: "listingCreatedTimestamp", descOrAsc: 0, latitude: 43.6529, longitude: -79.3849, radius: 812, lowestPrice: 200, }; if (type === "For Rent") { houCondition.listingType = "Lease"; } else if (type === "For Sale") { houCondition.listingType = "Sale"; } try { const resData = await axios({ url: "https://api.realjaja.com/mh/queryHouCondition", method: "POST", data: { houCondition, page: 1, rows: 54, userid: 0, ltype: 0, }, }); console.log("ListPage resData: ", resData); props.updateList(resData?.data?.data); } catch (er) { console.log( "Get error from https://api.realjaja.com/mh/queryHouCondition" ); } } function handleTypeClick(type) { console.log("handleTypeChange......", type); setType(type); console.log("after setType.....", type); props.updateShowOptions(false); processSearchByFilter(type); } function handleFilterClick(event) { console.log("handleFilterClick......"); props.updateShowOptions(!props.showOptions); } return ( <div className={styles["properties-search"]}> <div className={styles["searchs-container"]}> <div id="search-filter-container"> <button className={styles["search-filter"]} onClick={handleFilterClick} > <span className={styles["options-title"]}> {type === "All Types" ? "Listing Types" : type} </span> <div className={styles["options-downarrow"]}>&#10095;</div> </button> <ul className={styles["options-three"]} id="options-three" style={{ display: props.showOptions ? "block" : "none" }} > <li className={styles["options-item"]} onClick={() => { handleTypeClick("All Types"); }} > All Types </li> <li className={styles["options-item"]} onClick={() => { handleTypeClick("For Rent"); }} > For Rent </li> <li className={styles["options-item"]} onClick={() => handleTypeClick("For Sale")} > For Sale </li> </ul>{" "} </div> </div> </div> ); } export default connect( (state) => { const { showOptions } = state; return { showOptions }; }, { updateList, updateShowOptions } )(PropertySearch); <file_sep>/src/views/list-page/components/property-list/property-list-iterm.jsx import { Link } from "react-router-dom"; import styles from "./property-list.module.scss"; export default function PropertyListIterm(props) { const itemData = props.itemData; const itemImageUrl = itemData.pictures[0] || ""; // console.log("itemData.pictures[0]:", itemImageUrl); return ( <li className={styles["property-list-item"]}> <div className={styles["property-item-img-container"]}> <Link to={"/detail/" + itemData.identifier}> <div style={{ backgroundImage: `url(${itemImageUrl})` }} className={styles["property-item-img"]} > {" "} </div> </Link> </div> <div className={styles["property-item-text"]}> {props.itemData.fullAddress} </div> </li> ); } <file_sep>/src class/views/list-page/components/property-list/property-list.jsx import { Component } from "react"; import PropertyListIterm from "./property-list-iterm"; import styles from "./property-list.module.scss"; import { connect } from "react-redux"; class PropertyList extends Component { render() { // const propListData = this.props.listData; const propListData = this.props.list; return ( <div className={styles["properties"]}> <ul className={styles["property-list"]}> {propListData.map((item, index) => { return <PropertyListIterm itemData={item} key={index} />; })} </ul> </div> ); } } export default connect((state) => { const { list } = state; return { list }; })(PropertyList); <file_sep>/src/App.js import { Component } from "react"; import ListPage from "./views/list-page/list-page"; import { BrowserRouter as Router, Route, Switch } from "react-router-dom"; import DetailPage from "./views/detail-page/detail-page"; import store from "./redux/store"; import { Provider } from "react-redux"; class App extends Component { render() { return ( <Provider store={store}> <Router> <Switch> <Route path="/detail/:id"> <DetailPage /> </Route> <Route path="/"> <ListPage /> </Route> </Switch> </Router> </Provider> ); } } export default App; <file_sep>/src class/views/list-page/components/property-search/property-search.jsx import { Component } from "react"; import axios from "axios"; import styles from "./property-search.module.scss"; import { connect } from "react-redux"; import { updateList } from "../../../../redux/list-slice"; import { updateShowOptions } from "../../../../redux/show-option-slice"; class PropertySearch extends Component { constructor(props) { super(props); this.state = { type: "All Types", // isShowOptions: false, }; } componentDidMount() { document.addEventListener("click", this.handleHideMenu); } handleHideMenu = () => { this.setState({ isShowOptions: false }); }; processSearchByFilter = async () => { console.log("processSearchByFilter......"); let houCondition = { sortBy: "listingCreatedTimestamp", descOrAsc: 0, latitude: 43.6529, longitude: -79.3849, radius: 812, lowestPrice: 200, }; if (this.state.type === "For Rent") { houCondition.listingType = "Lease"; } else if (this.state.type === "For Sale") { houCondition.listingType = "Sale"; } try { const resData = await axios({ url: "https://api.realjaja.com/mh/queryHouCondition", method: "POST", data: { houCondition, page: 1, rows: 54, userid: 0, ltype: 0, }, }); console.log("ListPage componentDidMount resData: ", resData); //this.props.setPropertyList(resData?.data?.data); this.props.updateList(resData?.data?.data); } catch (er) { console.log( "Get error from https://api.realjaja.com/mh/queryHouCondition" ); } }; handleTypeClick = (type) => { console.log("handleTypeChange Type=: ", type); this.setState({ type }); // if (event.target.outerText === "All Types") { // document.getElementById("options-title").innerHTML = "Listing Types"; // } else { // document.getElementById("options-title").innerHTML = // event.target.outerText; // } // this.setState({ isShowOptions: false }); this.props.updateShowOptions(false); //document.getElementById("options-three").style.display = "none"; this.processSearchByFilter(); }; handleFilterClick = (event) => { // event.nativeEvent.stopImmediatePropagation(); // this.setState((state) => ({ isShowOptions: !state.isShowOptions })); this.props.updateShowOptions(!this.props.showOptions); //document.getElementById("options-three").style.display = "block"; }; render() { return ( <div className={styles["properties-search"]}> <div className={styles["searchs-container"]}> <div className={styles["search-filter-container"]} id="search-filter-container" > <button className={styles["search-filter"]} onClick={this.handleFilterClick} > <span className={styles["options-title"]} id="options-title"> {this.state.type} </span> <div className={styles["options-downarrow"]}>&#10095;</div> </button> {/* <select value={this.state.type} onChange={this.handleTypeChange}> <option value="All Types">All Types</option> <option value="For Rent">For Rent</option> <option value="For Sale">For Sale</option> </select> */} <ul className={styles["options-three"]} id="options-three" style={{ display: this.props.showOptions ? "block" : "none" }} > <li className={styles["options-item"]} onClick={() => { this.handleTypeClick("All Types"); }} > All Types </li> <li className={styles["options-item"]} value="For Rent" onClick={() => { this.handleTypeClick("For Rent"); }} > For Rent </li> <li className={styles["options-item"]} value="For Sale" onClick={() => { this.handleTypeClick("For Sale"); }} > For Sale </li> </ul> </div> {/* <button className={styles["search-item"]} value="Search" onClick={this.handleSearchClick} > Search </button> */} </div> </div> ); } } export default connect( (state) => { const { showOptions } = state; return { showOptions }; }, { updateList, updateShowOptions } )(PropertySearch); <file_sep>/src class/views/detail-page/detail-page.jsx import { Component } from "react"; import axios from "axios"; import { withRouter } from "react-router-dom"; import "./detail-page.scss"; import "react-responsive-carousel/lib/styles/carousel.min.css"; // requires a loader import { Carousel } from "react-responsive-carousel"; class DetailPage extends Component { constructor(props) { super(props); this.state = { propertyDetail: null, }; } async componentDidMount() { console.log("Detail page componentDidMount........."); console.log(this.props.match); try { const resData = await axios.get( `https://api.realjaja.com/mh/queryHouByid?houid=${this.props.match.params.id}&ltype=0&userid=1` ); console.log("Detail page get resData", resData); this.setState({ propertyDetail: resData?.data?.data }); } catch (er) { console.log(er); } // this.imgIndex = 0; // this.timerId = setInterval(() => this.handleSwitchImgs(), 3000); } // handleSwitchImgs() { // const imgs = this.state.propertyDetail?.pictures; // if (imgs == null || imgs.length === 0) return; // document.getElementById("detail-imgs").style.backgroundImage = `url(${ // imgs[this.imgIndex] // })`; // console.log(imgs[this.imgIndex]); // this.imgIndex++; // this.imgIndex %= imgs.length; // } // componentWillUnmount() { // clearInterval(this.timerId); // } render() { const propertyDetail = this.state.propertyDetail; const imgs = propertyDetail?.pictures; if (propertyDetail == null) return null; return ( <div className="details"> <div className="details-container"> <div className="detail-imgs" id="detail-imgs"> <Carousel autoPlay={true}> {imgs.map((img, index) => { return ( <div style={{ backgroundImage: `url(${img})`, height: "600px", backgroundSize: "cover", backgroundPosition: "center", }} ></div> ); })} </Carousel> </div> <div className="detail-address">{propertyDetail.fullAddress}</div> <hr /> <div className="detail-description"> {propertyDetail.remarks.client} </div>{" "} <hr /> </div> </div> ); } } export default withRouter(DetailPage); <file_sep>/src/views/detail-page/detail-page.jsx import { useState, useEffect } from "react"; import axios from "axios"; import { withRouter } from "react-router-dom"; import "./detail-page.scss"; import "react-responsive-carousel/lib/styles/carousel.min.css"; // requires a loader import { Carousel } from "react-responsive-carousel"; function DetailPage(props) { const [propertyDetail, setPropertyDetail] = useState(null); useEffect(() => { async function getPropertyDetail() { console.log( "Detail page useEffect getPropertyDetail.........", props.match ); try { const resData = await axios.get( `https://api.realjaja.com/mh/queryHouByid?houid=${props.match.params.id}&ltype=0&userid=1` ); console.log("Detail page get resData", resData); setPropertyDetail(resData?.data?.data); } catch (er) { console.log(er); } } getPropertyDetail(); }, [props.match]); const imgs = propertyDetail?.pictures; if (propertyDetail === null) return null; return ( <div className="details"> <div className="details-container"> <div className="detail-imgs" id="detail-imgs"> <Carousel autoPlay={true} showThumbs={false}> {imgs.map((img, index) => { return ( <div key={index} style={{ backgroundImage: `url(${img})`, height: "600px", backgroundSize: "cover", backgroundPosition: "center", }} ></div> ); })} </Carousel> </div> <div className="detail-address">{propertyDetail.fullAddress}</div> <hr /> <div className="detail-description"> {propertyDetail.remarks.client} </div>{" "} <hr /> </div> </div> ); } export default withRouter(DetailPage); <file_sep>/src class/redux/store.js import { configureStore } from '@reduxjs/toolkit'; import listReducer from './list-slice'; import showOptionsReducer from './show-option-slice' export default configureStore({ reducer: {list: listReducer, showOptions: showOptionsReducer}, }) <file_sep>/src class/views/list-page/components/property-list/property-list-iterm.jsx import { Component } from "react"; import { Link } from "react-router-dom"; import styles from "./property-list.module.scss"; export default class PropertyListIterm extends Component { render() { const itemData = this.props.itemData; const itemImageUrl = itemData.pictures[0] || ""; ///console.log("itemData.pictures[0]:", itemImageUrl); return ( <li className={styles["property-list-item"]}> <div className={styles["property-item-img-container"]}> <Link to={"/detail/" + itemData.identifier}> <div style={{ backgroundImage: `url(${itemImageUrl})` }} className={styles["property-item-img"]} > {" "} </div> </Link> </div> <div className={styles["property-item-text"]}> {this.props.itemData.fullAddress} </div> </li> ); } }
3a9d09d7b89df95a058d280835e17e887e6e65b9
[ "JavaScript" ]
10
JavaScript
aislandmin/property-react-redux-hook
42ac7a6861e11b5ef2fbfa31c5f4da6a45baadbe
8428fe7b23d3d812fa5cd864090f05722a8cc6ba
refs/heads/master
<repo_name>mukisabonface/interns-challenge<file_sep>/database/register.sql -- phpMyAdmin SQL Dump -- version 4.6.6deb5 -- https://www.phpmyadmin.net/ -- -- Host: localhost:3306 -- Generation Time: Jun 10, 2019 at 02:02 PM -- Server version: 5.7.26-0ubuntu0.18.04.1 -- PHP Version: 7.2.19-0ubuntu0.18.04.1 SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO"; SET time_zone = "+00:00"; /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; /*!40101 SET NAMES utf8mb4 */; -- -- Database: `register` -- -- -------------------------------------------------------- -- -- Table structure for table `member` -- CREATE TABLE `member` ( `user_id` int(11) NOT NULL, `username` varchar(50) NOT NULL, `full_name` varchar(50) NOT NULL, `password_hash` varchar(256) NOT NULL, `salt` varchar(256) NOT NULL, `created_date` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ) ENGINE=InnoDB DEFAULT CHARSET=latin1; /*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; /*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
a269401f9fb924b1ad622c05ba6ceeb12ec6ee70
[ "SQL" ]
1
SQL
mukisabonface/interns-challenge
86f733ff617cf9e2e177ee629cf83579ca13480e
031754191d5343822c8db3d7f673d812157be62e
refs/heads/master
<file_sep>package lab4; import java.io.IOException; import java.util.*; class Switch { void s() throws IOException, ClassNotFoundException { int num; Scanner sc = new Scanner(System.in); Factory fn = new Factory(); ArrayContainer<Furniture> furnitureArrayContainer = new ArrayContainer<>(); while (true) { help(); num = sc.nextInt(); switch (num) { case 1: { System.out.println("Выберите мебель"); System.out.println("1. Стол"); System.out.println("2. Шкаф"); int number = sc.nextInt(); if (number == 1) { System.out.println("Введите длину"); int h = sc.nextInt(); System.out.println("Введите высоту"); int w = sc.nextInt(); System.out.println("Ввудите код стиля (BLUE(0), RED(1), GREEN(2))"); int code = sc.nextInt(); System.out.println("Введите количество столов"); int q = sc.nextInt(); furnitureArrayContainer.add(fn.createTable(h, w, Style.valueOf(code), q)); } else if (number == 2) { System.out.println("Введите длину"); int h1 = sc.nextInt(); System.out.println("Введите высоту"); int w1 = sc.nextInt(); System.out.println("Ввудите код стиля (BLUE(0), RED(1), GREEN(2))"); int code1 = sc.nextInt(); System.out.println("Введите вмещаемость"); int q1 = sc.nextInt(); furnitureArrayContainer.add(fn.createCupboard(h1, w1, Style.valueOf(code1), q1)); } else { System.out.println("Введеный объект не существует"); } break; } case 2: { if (furnitureArrayContainer.getCount()==0) { System.out.println("Количсвто элементов = 0"); } else { System.out.println("Выберите индекс элемента"); int index = sc.nextInt(); furnitureArrayContainer.update(index); } break; } case 3: { if (furnitureArrayContainer.getCount() == 0) { System.out.println("Количсвто элементов = 0"); } else { System.out.println("Выберите индекс массива для удаления"); int index = sc.nextInt(); furnitureArrayContainer.delete(index); } break; } case 4: { furnitureArrayContainer.printAll(); break; } case 5: { System.out.println("Сортировка по длине"); furnitureArrayContainer.sort(); break; } case 6:{ System.out.println("Сумма = " + furnitureArrayContainer.count()); break; } case 7:{ furnitureArrayContainer.upload(); break; } case 8:{ furnitureArrayContainer.load(); break; } case 9:{ return; } } } } private static void help() { System.out.println("1. Добавить элемент"); System.out.println("2. Обновить эелемент по индексу"); System.out.println("3. Удалить элемент по индексу"); System.out.println("4. Вывести всё"); System.out.println("5. Сортировать по высоте"); System.out.println("6. Сумма"); System.out.println("7. Загрузить"); System.out.println("8. Выгрузить"); System.out.println("9. Завершить"); } } <file_sep>package lab4; public enum Style { BLUE(1), RED(2), GREEN(3); private final int code; Style(int code){ this.code = code; } public int getCode(){ return code; } public int value(Style style){ return code; } public static Style valueOf(int index){ for(Style value : values()){ if(value.ordinal() == index) return value; } return null; } } <file_sep>package lab4; import java.io.Serializable; public class Furniture<T> implements Serializable { private int height, width; private Style style; Furniture(){ } public Furniture(int width, int height, Style style) { this.width = width; this.height = height; this.style = style; } //методы доступа public double getHeight() { return height; } public void setHeight(int h){ height = h; } public double getWidth() { return width; } public void setWidth(int w){ width = w; } @Override public String toString() { return "Furniture{" + "width=" + width + ", height=" + height + ", style= " + style + '}'; } public Style getStyle() { return style; } public void setStyle(Style s){ style = s; } } <file_sep>package lab4; import java.io.Serializable; class Table<T> extends Furniture<Table<T>> implements Serializable { private int quantity; public Table(int width, int height, Style style, int quantity){ setWidth(width); setHeight(height); setStyle(style); this.quantity = quantity; } public int getQuantity(){ return quantity; } void setQuantity(int quantity){ this.quantity = quantity; } @Override public String toString() { return "Table{" + "quantity= " + quantity + ", " + "style= " + getStyle() + ", " + "width=" + getWidth() + ", " + "height=" + getHeight() + '}'; } } <file_sep>package lab4; public interface IShape { double getHeight(); double getWidth(); }
7350b5a0de62b61a3229636900ce51b0d851d1ac
[ "Java" ]
5
Java
Alchotest/lab4
5cc3dde86890f976f99ef2ca136139706e37162d
10a019e876603844906da32a2db7925af690a2c1
refs/heads/main
<repo_name>mvazquezc/dummy-nfs-on-ocp<file_sep>/unfs3-server.dockerfile # quay.io/mavazque/nfs-server:latest FROM fedora:32 RUN dnf install rpcbind https://ftp.tu-chemnitz.de/pub/linux/dag/redhat/el6/en/x86_64/rpmforge/RPMS/unfs3-0.9.22-2.el6.rf.x86_64.rpm -y && dnf clean all RUN mkdir -p /nfs-share RUN echo "/nfs-share 0.0.0.0/0(rw,insecure,no_root_squash)" > /etc/exports ADD start.sh /usr/local/bin/ RUN useradd nfsowner -u 5000 -U -M -s /sbin/nologin # You can get rid of the following test line RUN echo "This is a testfile owned by user 5000" > /nfs-share/testfile.txt # End of test line RUN chown -R nfsowner:nfsowner /nfs-share && chmod 2775 /nfs-share && chmod 0660 /nfs-share/* USER 0 EXPOSE 2049 CMD ["start.sh"] <file_sep>/start.sh #!/bin/bash rpcbind unfsd -d -n 2049 -m 2049 -p -e /etc/exports <file_sep>/README.md # Dummy NFS Server on OCP Instructions to run a dummy NFS server as a pod. NOT FOR PRODUCTION. This uses the [unfs3 project](https://github.com/unfs3/unfs3). ## Deploy the NFS Server Below instructions as they are will only work on OpenShift since they leverage SCCs. Below command will create: * A Namespace * A ServiceAccount to run the NFS Server * A RoleBinding to give access to the `anyuid` SCC to the ServiceAccount * A Deployment for the NFS Server * A Service for the NFS Server (ClusterIP) > **NOTE**: The NFS has no persistent storage, any stored file will be lost when the pod dies. ~~~sh # Set test namespace NAMESPACE=test-nfs # Objects creation cat <<EOF | oc -n ${NAMESPACE} create -f - apiVersion: v1 kind: Namespace metadata: name: ${NAMESPACE} --- apiVersion: v1 kind: ServiceAccount metadata: name: nfs-server --- apiVersion: rbac.authorization.k8s.io/v1 kind: RoleBinding metadata: name: nfs-server-anyuid-scc roleRef: apiGroup: rbac.authorization.k8s.io kind: ClusterRole name: system:openshift:scc:anyuid subjects: - kind: ServiceAccount name: nfs-server namespace: ${NAMESPACE} --- apiVersion: apps/v1 kind: Deployment metadata: creationTimestamp: null labels: app: nfs-server name: nfs-server spec: replicas: 1 selector: matchLabels: app: nfs-server strategy: {} template: metadata: creationTimestamp: null labels: app: nfs-server spec: serviceAccountName: nfs-server containers: - image: quay.io/mavazque/nfs-server:latest name: nfs-server securityContext: runAsUser: 0 ports: - containerPort: 2049 resources: {} status: {} --- apiVersion: v1 kind: Service metadata: creationTimestamp: null labels: app: nfs-server name: nfs-server spec: ports: - name: 2049-2049 port: 2049 protocol: TCP targetPort: 2049 selector: app: nfs-server type: ClusterIP status: loadBalancer: {} EOF ~~~ ## Test the Server Now we can try to mount the NFS Share on a pod. Below command will create: * A PersistentVolume using the `nfs` plugin * A PersistentVolumeClaim binding to the PersistentVolume * A Deployment mounting the PV ~~~sh # Set test namespace NAMESPACE=test-nfs # Get ClusterIP Service IP NFS_SERVER=$(oc -n ${NAMESPACE} get svc nfs-server -o jsonpath='{.spec.clusterIP}') # Objects creation cat <<EOF | oc -n ${NAMESPACE} create -f - apiVersion: v1 kind: PersistentVolume metadata: name: nfs-test-volume spec: capacity: storage: 500Mi accessModes: - ReadWriteMany nfs: server: ${NFS_SERVER} path: "/nfs-share" mountOptions: - port=2049 - mountport=2049 - nfsvers=3 - tcp --- apiVersion: v1 kind: PersistentVolumeClaim metadata: name: nfs-test-volume-claim spec: accessModes: - ReadWriteMany storageClassName: "" volumeName: nfs-test-volume resources: requests: storage: 500Mi --- apiVersion: apps/v1 kind: Deployment metadata: creationTimestamp: null labels: app: reversewords-app-shared-storage name: reversewords-app-shared-storage spec: replicas: 1 selector: matchLabels: app: reversewords-app-shared-storage strategy: {} template: metadata: creationTimestamp: null labels: app: reversewords-app-shared-storage spec: securityContext: supplementalGroups: [5000] volumes: - name: shared-volume persistentVolumeClaim: claimName: nfs-test-volume-claim containers: - image: quay.io/mavazque/reversewords:ubi8 name: reversewords resources: {} volumeMounts: - name: shared-volume mountPath: "/mnt" status: {} EOF
7e948c7faedf10a0f33cb22a47fb05e0c8b90a64
[ "Markdown", "Dockerfile", "Shell" ]
3
Dockerfile
mvazquezc/dummy-nfs-on-ocp
6befa5f480952073fd9695075de4073ed4b635e7
e6b01ff4a0619a4d7401e0dadc6b673f391d47ce
refs/heads/master
<file_sep>#include <iostream> #include <fstream> #include <string> #include <iomanip> using namespace std; class person { private: string name,num_phone,num_qq,address; bool judge; //判断此数据是否有效,以便于增删、查找、浏览操作 public: person(); void set_name(string name) {this->name=name;} void set_num_phone(string num_phone) {this->num_phone=num_phone;} void set_num_qq(string num_qq) {this->num_qq=num_qq;} void set_address(string address) {this->address=address;} void set_judge(bool judge) {this->judge=judge;} string get_name() {return name;} string get_num_phone() {return num_phone;} string get_num_qq() {return num_qq;} string get_address() {return address;} bool get_judge() {return judge;} }; person::person():judge(false) {} class book { private: person contact[1000];//每个电话本最大容量为1000 bool weizhi; //false为电话内部,true为存储卡存储 public: book(bool weizhi); bool get_weizhi(){return weizhi;}//返回值false为电话内部,true为存储卡存储 void add_person(); void delete_person(string name); //传入要删除的编号 void revise_person(string name); //修改 void find_person(string name); //查询 void look_though(); //浏览全部 void transfer(bool j); //转存:False:phone to card True:card to phone bool get_judge(int PhoneNum){return contact[PhoneNum].get_judge();} void Read(); void Save(); }; book::book(bool weizhi):weizhi(weizhi) {} void book::add_person() { int num; for (int i = 0; i < 1000; i++) { if (!contact[i].get_judge()) num = i; } string temp; bool judge; cout << "请输入联系人姓名:\n"; cin >> temp; contact[num].set_name(temp); contact[num].set_judge(true); cout << "是否记录电话号码?(1/0)"; cin >> judge; if (judge) { cout << "请输入:"; cin >> temp; contact[num].set_num_phone(temp); } cout << "是否记录QQ号码?(1/0)"; cin >> judge; if (judge) { cout << "请输入:"; cin >> temp; contact[num].set_num_qq(temp); } cout << "是否记录联系人地址?(1/0)"; cin >> judge; if (judge) { cout << "请输入:"; cin >> temp; contact[num].set_address(temp); } cout << "添加成功!\n"; } void book::delete_person(string name) { cout<<"删除成功!\n"; } void book::revise_person(string name) { cout<<"修改成功!\n"; } void book::find_person(string name) { for(int i=0;i<1000;i++){ if(name==contact[i].get_name()) { cout << contact[i].get_name() << "\t" << contact[i].get_num_phone() << "\t" << contact[i].get_num_qq() << "\t" << contact[i].get_address(); if (!weizhi) cout << "\t手机存储" << "\t" << i << "\n"; if (weizhi) cout << "\t储存卡" << "\t" << i << "\n"; } } } void book::look_though() { for(int i=0;i<1000;i++) if(contact[i].get_judge()==true) { cout << contact[i].get_name() << "\t" << contact[i].get_num_phone() << "\t" << contact[i].get_num_qq() << "\t" << contact[i].get_address() ; if (!weizhi) cout << "\t内部" << "\t" << i << "\n"; if (weizhi) cout << "\t储存卡" << "\t" << i << "\n"; } } void book::Read() { string str,a,b,c,d; if(!weizhi) str="PhoneIn.ini"; else if(weizhi) str="PhoneSdCard.ini"; fstream tooo(str.c_str(),ios::in); for(int i=0;tooo.peek()!=EOF;i++){ if(!contact[i].get_judge()){ tooo>>a>>b>>c>>d; contact[i].set_name(a); contact[i].set_num_phone(b); contact[i].set_num_qq(c); contact[i].set_address(d); contact[i].set_judge(true); } } } void book::Save() { string str; if(!weizhi) str="PhoneIn.ini"; else if(weizhi) str="PhoneSdCard.ini"; fstream tooo(str.c_str(),ios::out); for(int i=0;i<1000;i++){ if(contact[i].get_judge()) { tooo << contact[i].get_name() << " " << contact[i].get_num_phone() << " " << contact[i].get_num_qq() << " " << contact[i].get_address() << "\n"; } } } int main() { book phone_in(false), phone_card(true); //定义手机通讯录 、储存卡通讯录 phone_in.Read(); phone_card.Read(); while (true) { cout.setf(ios::left); cout<<setw(46)<<"*"<<cout.fill('*')<<"\n"; cout.fill(' '); cout <<setw(45)<< "*"<<"*\n"; cout <<setw(45)<< "*     通讯录管理系统"<<"*\n"; cout <<setw(45)<< "* 请输入数字来进行有关操作:"<<"*\n"; cout <<setw(45)<< "*   1、 添加联系人"<<"*\n"; cout <<setw(45)<< "*   2、 删除联系人"<<"*\n"; cout <<setw(45)<< "*   3、 查找联系人"<<"*\n"; cout <<setw(45)<< "*   4、 修改已经存在的联系人信息"<<"*\n"; cout <<setw(45)<< "*   5、 浏览已经存在的联系人信息"<<"*\n"; cout <<setw(45)<< "*   9、 退出系统"<<"*\n"; cout <<setw(45)<< "*"<<"*\n"; cout<<setw(46)<<"*"<<cout.fill('*')<<"\n"; int num; string name; cin >> num; switch (num) { case 1: //添加联系人 while (true) { cout << "请选择存储位置:\n1、手机存储\t2、储存卡\n"; cin >> num; if (num == 1) { phone_in.add_person(); break; } else if (num == 2) { phone_card.add_person(); break; } else { cout << "错误!请输入正确的号码:\n"; } }break; case 2: //删除联系人 while (true) { cout<<"请输入联系人姓名:\n"; cin>>name; cout<<"姓名\t电话号\tQQ号\t地址\t位置\t序号\n"; phone_in.find_person(name); phone_card.find_person(name); cout<<"是否还要删除其他联系人?(Y/N)"; cin>>name; if(name=="n"||name=="N")break; }break; case 3: //查找联系人 while(true) { cout<<"请输入被查找姓名:\n"; cin>>name; cout<<"姓名\t电话号\tQQ号\t地址\t位置\t序号\n"; phone_in.find_person(name); phone_card.find_person(name); cout<<"你想查找其他联系人吗?(Y/N)\n"; cin>>name; if(name=="N"||name=="n") break; }break; case 4: //修改联系人 while(true) { cout << "请输入联系人姓名:"; cin >> name; cout<<"是否还要修改其他联系人?(Y/N)"; cin>>name; if(name=="n"||name=="N")break; }break; case 5: //浏览已存储联系人 cout<<"姓名\t电话号\tQQ号\t地址\t位置\t序号\n"; phone_in.look_though(); phone_card.look_though(); break; case 9: //退出系统并保存 phone_in.Save(); phone_card.Save(); return 0; default: cout << "错误!请输入正确的号码!\n"; } } } <file_sep>// // Created by imamouse on 18-4-17. // #include <iostream> using namespace std; class person{ private: };<file_sep>// // Created by Clion on 18-4-9. // #include <iostream> using namespace std; class triangle{ private: double deepline,high,area;//底、高、面积 public: triangle(){area=(deepline*high)/2;}// triangle(double deepline,double high):deepline(deepline),high(high){area=(deepline*high)/2;} bool operator>(triangle &compare); bool operator<(triangle &compare); bool operator>=(triangle &compare); bool operator<=(triangle &compare); bool operator!=(triangle &compare); bool operator==(triangle &compare); }; bool triangle::operator>(triangle &compare) { if(this->area>compare.area) return true; else return false; } bool triangle::operator<(triangle &compare) { if(this->area<compare.area) return true; else return false; } bool triangle::operator>=(triangle &compare) { if(this->area>=compare.area) return true; else return false; } bool triangle::operator<=(triangle &compare) { if(this->area<=compare.area) return true; else return false; } bool triangle::operator!=(triangle &compare) { if(this->area!=compare.area) return true; else return false; } bool triangle::operator==(triangle &compare) { if(this->area==compare.area) return true; else return false; } void compare(triangle t1,triangle t2){ if(t1>t2) cout<<"t1>t2"<<'\t'<<"true"<<'\n'; else cout<<"t1>t2"<<'\t'<<"false"<<'\n'; if(t1<t2) cout<<"t1<t2"<<'\t'<<"true"<<'\n'; else cout<<"t1<t2"<<'\t'<<"false"<<'\n'; if(t1>=t2) cout<<"t1>=t2"<<'\t'<<"true"<<'\n'; else cout<<"t1>=t2"<<'\t'<<"false"<<'\n'; if(t1<=t2) cout<<"t1<=t2"<<'\t'<<"true"<<'\n'; else cout<<"t1<=t2"<<'\t'<<"false"<<'\n'; if(t1!=t2) cout<<"t1!=t2"<<'\t'<<"true"<<'\n'; else cout<<"t1!=t2"<<'\t'<<"false"<<'\n'; if(t1==t2) cout<<"t1==t2"<<'\t'<<"true"<<'\n'; else cout<<"t1==t2"<<'\t'<<"false"<<'\n'; } int main(){ triangle t1(5,5); double deepline,high; cout<<"The triangle(5,5) will be compared,\nplease input the other triangle:\n"; cin>>deepline>>high; triangle t2(deepline,high); compare(t1,t2); //system("pause"); return 0; }
2b2fc9b3528c09b4266312381f0feaa92e0fc1db
[ "C++" ]
3
C++
imAmouse/C-Plus-Plus-Practice
fae4b7163e62b4cf5c9adb5e1d95a70aeaa0dc1b
de42ebb86736e151683d26f0494e03ac5ac4bbac
refs/heads/master
<file_sep>// check if document is loaded document.addEventListener( 'DOMContentLoaded', function() { console.log( 'Script loaded!' ); }); let username = document.getElementById("username"); let showpass = document.getElementById('c-input-password-show'); let hidepass = document.getElementById('c-input-password-hide'); username.addEventListener('focusout',function(){ // debug if triggered console.log("unfocus username active"); let isfloating = "is-floating"; let userlabel = document.getElementById("js-floating-label"); // check if there is a value if(this.value != ""){ console.log("value finded: "+this.value); userlabel.classList.add(isfloating); } else{ console.log("value is empty"); userlabel.classList.remove(isfloating); }; }); showpass.addEventListener('click',function(){ // show if clicked console.log("show password"); let hide = "c-input-password-icon--hide"; let passinput = document.getElementById("password"); passinput.type = "text"; showpass.classList.add(hide); hidepass.classList.remove(hide); }); hidepass.addEventListener('click',function(){ // show if clicked console.log("hide password"); let hide = "c-input-password-icon--hide"; let passinput = document.getElementById("password"); passinput.type = "<PASSWORD>"; showpass.classList.remove(hide); hidepass.classList.add(hide); }); document.addEventListener( 'DOMContentLoaded', handleQualityRange()); function handleQualityRange(){ console.log("slider active"); let slider = document.getElementById("quality"); let sliderHolder = document.getElementById("js-range-holder"); //let sliderHolder = window.getComputedStyle(document.querySelector('#js-range-holder'), ':after'); slider.addEventListener('input',function(){ console.log("slider changed"); let value = slider.value; sliderHolder.dataset.value = value; sliderHolder.style.transform = "translateX(calc("+value+"% - 16px)"; //sliderHolder.style.width = "calc(100% - "+value+"%)"; }) } let dropButton = document.getElementById("js-dropdown-button"); let clicked = 0; dropButton.addEventListener('click',function(){ let dropContent = document.getElementById("js-dropdown-content"); if(clicked == 0){ dropContent.classList.remove("hidden"); clicked = 1; } else{ dropContent.classList.add("hidden"); clicked = 0; } })
0767d0fcfa28cb4edf1d4c030e6888668d2a142e
[ "JavaScript" ]
1
JavaScript
nmct-create3/basic-javascript-interaction-ThibautSanty
2a9536d7384a981f48b9c370c7eacdc195099ce3
c34d80cf03af9057086aed026b70a1139ca23952
refs/heads/master
<file_sep>#!/usr/bin/env python import sys test1 = int(sys.argv[1]) test2 = int(sys.argv[2]) test3 = int(sys.argv[3]) test4 = int(sys.argv[4]) average = (test1 + test2 + test3 + test4) / 4 print "The average score is: ", average if average >= 90: print "Your grade is an A" elif average >= 80: print "Your grade is a B" elif average >= 70: print "Your grade is a C" elif average >= 60: print "Your grade is a D" else: print "Your grade is an F"<file_sep>#!/usr/bin/env python firstName = "Sam" lastName = "Spade" age = 41 print firstName, lastName, age sideA = 12.55 sideB = 17.85 sqrtSideC = sideA**2 + sideB**2 sideC = sqrtSideC**0.5 print "The lenght of side C it", sideC,"\n" operand1 = 95 operand2 = 64.5 print operand1 + operand2 print operand1 - operand2 print operand1 * operand2 print operand1 / operand2 print operand1 % operand2 # using this solution you only need to change the value for operand1 and operand2 to see how the number change.
af26d1039996d29d4988535c515408503524983f
[ "Python" ]
2
Python
Oz0n3/PFAB
5b0ebee6d8a47b541ec9d63c2d1d152faed4a81c
564a5207296fbf4d8b5445e35ae50dcbc9f531d7
refs/heads/master
<file_sep>import random from matplotlib import pyplot as plt from matplotlib import font_manager my_font = font_manager.FontProperties(fname='/System/Library/Fonts/PingFang.ttc', size=10) x = range(0, 120) y1 = [random.randint(20, 25) for i in range(120)] y2 = [random.randint(20, 25) for k in range(120)] x_lable = ["{}:{}".format(10 + int(i / 60), (i % 60 if i % 60 >= 10 else '0' + str(i % 60))) for i in x] # 大小 plt.figure(figsize=(30, 8), dpi=100) # 设置x轴上显示的字符(可以把数字转换成字符串) plt.xticks(list(x)[::2], x_lable[::2], rotation=0, fontproperties=my_font) # 折线图 plt.plot(x, y1, label='北京', color='r', linestyle='-.') # 散点图 plt.scatter(x, y2, label='阳泉', color='y') # 条形图 plt.bar(x, y1, color='g') # 横着的条形图 plt.barh(x, y1, color='g', height=0.8) plt.xlabel('时间', fontproperties=my_font) plt.ylabel('温度 单位(℃)', fontproperties=my_font) plt.title('10点到12点每分钟的气温变化情况', fontproperties=my_font) # 网格 plt.grid(alpha=0.4, color='g', linestyle=':') # 图例 plt.legend(prop=my_font, loc='upper left') # plt.show() plt.savefig('./t2.png') <file_sep>from matplotlib import pyplot as plt x = range(2,26,2) y = [15,13,14.5,17,20,25,26,26,27,22,18,15] plt.figure(figsize=(20,8),dpi=80) plt.plot(x,y) plt.xticks(range(0,25)[::2]) # plt.savefig("./t1.png") plt.show()
fb0315d1b9e6008bd5dcbb53011bcc26fb937921
[ "Python" ]
2
Python
houxiubin/Data_Analysis
add793b53b51ac078af2586636a9b0f3081b2314
8a494565d09d63472056ac92a433e8cc07d71a90
refs/heads/master
<repo_name>nitesh-weboniselab/backbone_gallery_example<file_sep>/backbonecake/app/webroot/js/backbone/router.js var Album = Album || {}; Album.Gallery = Album.Gallery || {}; Album.Gallery.router = (function(){ return{ AppRouter:Backbone.Router.extend({ routes:{ '':'index', 'dashboard/:userId':"dashboard", 'createAlbum/:id':"createAlbum", 'listAlbums':"listAlbums", 'listPhotos/:albumId':'listPhotos', 'addPhoto/:albumId':"addPhoto" }, initialize:function(){ }, index:function(){ this.userLoginModel = new Album.Gallery.model.userLoginModel(); this.userLoginView = new Album.Gallery.view.userLoginView({ userLoginModel : this.userLoginModel, parent : this, el : $('#album') }) }, dashboard:function(userId) { this.userDashboard = new Album.Gallery.view.dashboardView({ el:$("#album"), userId:userId }); }, createAlbum:function(userId) { this.createAlbumModel = new Album.Gallery.model.addAlbum(); this.cretaeAlbumView = new Album.Gallery.view.createAlbumView({ createAlbumModel:this.createAlbumModel, parent:this, userId:userId, el:$("#album") }) }, listAlbums:function(){ this.listAlbumModel = new Album.Gallery.model.listAlbumModel(); this.listAlbumView = new Album.Gallery.view.listAlbumView({ listAlbumModel:this.listAlbumModel, parent:this, el:$("#album") }); this.listAlbumModel.fetch(); }, listPhotos:function(albumId){ this.listPhotoModel = new Album.Gallery.model.listPhotoModel(albumId); this.listPhotoView = new Album.Gallery.view.listPhotoView({ listPhotoModel:this.listPhotoModel, parent:this, el:$('#album') }); this.listPhotoModel.fetch(); }, addPhoto:function(albumId){ this.addPhotoModel = new Album.Gallery.model.addPhotoModel(albumId); this.addPhotoView = new Album.Gallery.view.addPhotoView({ addPhotoModel:this.addPhotoModel, parent:this, albumId:albumId, el:$('#album') }); }, deletePhoto:function(photoId){ this.deletePhotoModel = new Album.Gallery.model.deletePhotoModel(photoId); this.deletePhotoView = new Album.Gallery.view.deletePhotoView({ deletePhotoModel:this.deletePhotoModel, parent:this }); } }) }; })(); var app = new Album.Gallery.router.AppRouter(); Backbone.history.start(); <file_sep>/backbonecake/app/models/photo.php <?php class Photo extends AppModel { public function getPhotos($albumId) { $sendPhotoList = array(); $photos = $this->find('all', array('conditions' => array('Photo.album_id' => $albumId))); foreach($photos as $key => $photo){ $photoList[$key]['id'] = $photo['Photo']['id']; $photoList[$key]['name'] = 'app/webroot/img/'.$photo['Photo']['name']; } $sendAlbumList['photoList']['photos'] = $photoList; return $sendAlbumList; } public function addPhoto($albumId,$fileName){ $data = array('album_id' => $albumId, 'name'=>$fileName); $this->create($data); if($this->save()){ return true; } return false; } public function deletePhoto($photoId){ $sendAlbumId = array(); $this->id = $photoId; $albumId = $this->field('Photo.album_id'); if(!empty($albumId)){ $this->delete(); $sendAlbumId = array('albumId' => $albumId); } else{ $sendAlbumId = array('error' => 'No photo found'); } return $sendAlbumId; } }<file_sep>/backbonecake/app/views/elements/albumTemplate.ctp <script type="text/html" id="userLoginTemplate"> <div> <form id="userLoginForm" method="post" action=""> <label>User Name:</label><input type="text" id="username" name="username"> <label>Password :</label><input type="<PASSWORD>" id="password" name="password"> <span style="display:none" id='loginError'>Username or password is wrong</span> </form> <button id="userLoginBtn">Login</button> </div> </script> <script type="text/html" id="dashboardTemplate"> <div> <h3> Dashboard </h3> <input type="hidden" id="userId" value="<%= userId%>" /> <a href="javascript:void(0)" id="createAlbum" >Create Album</a> <a href="javascript:void(0)" id="seeList" >List Of album</a> </div> </script> <script type="text/script" id="createAlbumTemplate"> <form id="createAlbumForm" method="post" action=""> <input type="text" id="albumName" name="albumName"> </form> <button id="createAlbumBtn">Create</button> </script> <script type="text/script" id="addPhoto"> <form id="addPhotoForm" method="post" action="" enctype="multipart/form-data"> <div id="fine-uploader"></div> </form> <button class="addmorePhotoBtn">Add More Photo</button> </script> <script type="text/script" id="albumListTemplate"> <ol> <% _.each(albums, function(album){ %> <li><a href="javascript:void(0)" class="albumList" id="<%= album.id%>"><%= album.name%></a><button id="<%= album.id%>" class="addMorePhoto">Add more Photo</button></li> <%});%> </ol> </script> <script type="text/script" id="photoListTemplate"> <ul> <% _.each(photos, function(photo){ %> <li><a href="<%= photo.name%>" class="group1" rel="group1"><img src="<%= photo.name%>" alt="<%= photo.name%>" height="70" width="70"></a></li> <%});%> </ul> </script> <file_sep>/backbonecake/app/views/album/index.ctp <div id='loginUser'></div> <div id="album"></div> <ul id='list'></ul> <div id="NewAlbumcreate"> </div> <?php echo $html->css(array('backbone/colorbox.css', 'backbone/fineuploader.css')); ?> <?php echo $this->element('albumTemplate'); ?> <?php echo $this->Javascript->link(array('backbone/jquery-1.9.1.min', 'backbone/jquery.validate.min', 'backbone/jquery.fineuploader-3.4.1', 'backbone/jquery.ui', 'backbone/jquery.upload', 'backbone/underscore-min', 'backbone/backbone-min', 'backbone/model', 'backbone/view', 'backbone/collection', 'backbone/router', 'backbone/jquery.colorbox'),true); ?> <file_sep>/backbonecake/app/controllers/album_controller.php <?php /** * Created by JetBrains PhpStorm. * User: webonise * Date: 15/7/14 * Time: 9:22 AM * To change this template use File | Settings | File Templates. */ class AlbumController extends AppController { var $helpers = array('Form', 'Html', 'Javascript'); public $uses = array( 'Album', 'User', 'Photo' ); public $components = array( 'AjaxFileUpload' ); public function index() { } public function userlogin(){ $this->layout = 'ajax'; $this->autoRender = false; $data = json_decode(file_get_contents('php://input')); $sendUserId = $this->User->checkUsernamePassword($data->username,$data->password); echo json_encode($sendUserId); } public function addAlbum(){ $this->layout = 'ajax'; $this->autoRender = false; $data = json_decode(file_get_contents('php://input')); $sendAlbumData = $this->Album->addAlbum($data); echo json_encode($sendAlbumData); } public function addPhoto($albumId){ $this->layout = 'ajax'; $this->autoRender = false; $url = WWW_ROOT . 'img' ; $permitted = array("png","jpeg","jpg","gif"); $uploadFile = ($this->AjaxFileUpload->uploadFiles('img', $permitted)); $file = json_decode($uploadFile); if($file){ if($this->Photo->addPhoto($albumId,$file->filename[0])){ echo json_encode($uploadFile); } else{ echo json_encode(array("error" => 'error in upload')); } } echo json_encode(array("error" => 'error in upload')); die(); } public function listAlbum($userId){ $this->layout = 'ajax'; $this->autoRender = false; $sendAlbumList = $this->Album->getAlbum(); echo json_encode($sendAlbumList); } public function listPhoto($albumId){ $this->layout = 'ajax'; $this->autoRender = false; $sendPhotoList = $this->Photo->getPhotos($albumId); echo json_encode($sendPhotoList); } public function deletePhoto($photoId){ $this->layout = 'ajax'; $this->autoRender = false; $sendAlbumId = $this->Photo->deletePhoto($photoId); echo $sendAlbumId; } }<file_sep>/backbonecake/app/webroot/js/backbone/collection.js var Album = Album || {}; Album.Gallery = Album.Gallery || {}; Album.Gallery.collection= (function(){ return{ listAlbumCollection : Backbone.Collection.extend(), listPhotoCollection : Backbone.Collection.extend() }; })();<file_sep>/backbonecake/app/models/album.php <?php class Album extends AppModel { public function getAlbum() { $sendAlbumList = array(); $albums = $this->find('all', array('condition' => array(1 => 1))); if(!empty($albums)){ foreach($albums as $key => $album){ $albumList[$key]['id'] = $album['Album']['id']; $albumList[$key]['name'] = $album['Album']['name']; } $sendAlbumList['albumList']['albums'] = $albumList; } else{ $sendAlbumList['albumList']['albums'] = array('error' => 'No Images'); } return $sendAlbumList; } public function addAlbum($post) { $data = array('Album' => array('user_id' => $post->user_id,'name' => $post->name)); $this->create($data); if ($this->save()) { return array('albumId' => $this->id); } return array('error' => 'Not saved'); } public function getAlbumByUserId($userId){ $albumList = $this->find('all', array('condition' => array(1 => 1))); } } <file_sep>/database/photos.sql -- phpMyAdmin SQL Dump -- version 3.4.10.1deb1 -- http://www.phpmyadmin.net -- -- Host: localhost -- Generation Time: Jul 31, 2014 at 10:42 PM -- Server version: 5.5.35 -- PHP Version: 5.3.10-1ubuntu3.11 SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO"; SET time_zone = "+00:00"; /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; /*!40101 SET NAMES utf8 */; -- -- Database: `demo` -- -- -------------------------------------------------------- -- -- Table structure for table `photos` -- CREATE TABLE IF NOT EXISTS `photos` ( `id` int(11) NOT NULL AUTO_INCREMENT, `album_id` char(255) NOT NULL, `name` char(255) DEFAULT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=19 ; -- -- Dumping data for table `photos` -- INSERT INTO `photos` (`id`, `album_id`, `name`) VALUES (1, '5', 'download.jpg'), (2, '5', 'me.jpg'), (3, '5', 'yo.jpg'), (4, '5', 'go.jpg'), (5, '5', 'home.jpg'), (9, '43', 'forum-commenter.jpg'), (10, '43', 'game_win_bg.jpg'), (11, '43', 'g2_add.jpg'), (12, '5', 'franklin_photo.jpg'), (13, '45', 'my_fan_clubs_img.jpg'), (14, '45', 'fb_profile_photo.jpg'), (15, '45', 'image_5.jpg'), (16, '45', 'video_bg.jpg'), (17, '44', '1406826558_cave_img.jpg'), (18, '44', 'loader_white.gif'); /*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; /*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; <file_sep>/backbonecake/app/models/user.php <?php class User extends AppModel { public function checkUsernamePassword($userName, $password) { $userId = $this->find('first', array('conditions' => array('User.username' => $userName, 'User.password' => $password), 'fields' => array('id') )); if ($userId) { return array('userId' => $userId['User']['id']); } return array('error' => 'Not Found'); } }<file_sep>/backbonecake/app/app_model.php <?php class AppModel extends Model { public $cacheQueries = true; } ?><file_sep>/README.md backbone_gallery_example ======================== clone it and put it in localhost. use the url to start http://localhost/backbonecake/album we will get the login page use the username : webonise and password : <PASSWORD> we will get the dashboard page on dashboard page we have add album and list album option. 1)on click of add album will get add album form fill the name and click on create. on click of create it shows add photo view on that we use the fineuploader. select the file on click of select file. it will upload the file. 2) on click of list album will get the list of all albums and add more photo option click the album name will get the list of photo of that album. click the photo it will show the next previous option to show next previous photo on click of add more it will show add photo view. <file_sep>/backbonecake/app/webroot/js/backbone/bbassetsupload.js /* # BBAssetsUpload * url: https://github.com/fguillen/BBAssetsUpload * author: http://fernandoguillen.info * demo page: http://fguillen.github.com/BBAssetsUpload/ ## Versión v0.0.3 ## Documentation * README: https://github.com/fguillen/BBAssetsUpload/blob/master/README.md */ var BBAssetsUpload; $(function(){ console.log( "[BBAssetsUpload 0.0.3] BBAssetsUpload::Loading ..." ); // Removing dragover event over page $(document.body).bind("dragover", function(e){ e.stopPropagation(); e.preventDefault(); return false }); // // The root class // BBAssetsUpload = function( opts ){ console.debug( "[BBAssetsUpload 0.0.3] BBAssetsUpload::Initializing with opts", opts ); if (typeof opts.listSortable === 'undefined') { opts.listSortable = true } // required this.url = opts.url; this.listElement = opts.listElement; this.dropElement = opts.dropElement; this.assetTemplate = opts.assetTemplate; this.assetUploadingTemplate = opts.assetUploadingTemplate; // optional this.listSortable = opts.listSortable this.onStartCallback = opts.onStart this.onProgressCallback = opts.onProgress this.onSuccessCallback = opts.onSuccess this.onErrorCallback = opts.onError this.validateOptions = function( opts ){ errors = []; if( !opts.url ) errors.push( "'url' required" ); if( !opts.listElement ) errors.push( "'listElement' required" ); if( !opts.dropElement ) errors.push( "'dropElement' required" ); if( !opts.assetTemplate ) errors.push( "'assetTemplate' required" ); if( !opts.assetUploadingTemplate ) errors.push( "'assetUploadingTemplate' required" ); if( opts.listElement && !opts.listElement.length ) errors.push( "'listElement' element not found with selector '" + opts.listElement.selector + "'" ); if( opts.dropElement && !opts.dropElement.length ) errors.push( "'dropElement' element not found with selector '" + opts.dropElement.selector + "'" ); if( opts.assetTemplate && !opts.assetTemplate.length ) errors.push( "'assetTemplate' template empty" ); if( opts.assetUploadingTemplate && !opts.assetUploadingTemplate.length ) errors.push( "'assetUploadingTemplate' template empty" ); if( errors.length > 0 ) { errors.unshift( errors.length + " errors found in options") throw new Error( errors.join( ", " ) ) } }; this.initialize = function( opts ){ this.validateOptions( opts ); // global events this.eventCatcher = _.extend({}, Backbone.Events); if( this.onStartCallback ) this.eventCatcher.on( "asset:start", this.onStartCallback ); if( this.onProgressCallback ) this.eventCatcher.on( "asset:progress", this.onProgressCallback ); if( this.onSuccessCallback ) this.eventCatcher.on( "asset:success", this.onSuccessCallback ); if( this.onErrorCallback ) this.eventCatcher.on( "asset:error", this.onErrorCallback ); // Backbone elements this.assets = new BBAssetsUpload.Backbone.Assets({ url: this.url, eventCatcher: this.eventCatcher }); this.dropView = new BBAssetsUpload.Backbone.DropView({ el: this.dropElement, collection: this.assets, url: this.url, validator: new BBAssetsUpload.FileValidator( opts ) }); this.assetsView = new BBAssetsUpload.Backbone.AssetsView({ reorderUrl: this.url + "/reorder", collection: this.assets, assetTemplate: this.assetTemplate, assetUploadingTemplate: this.assetUploadingTemplate, listSortable: this.listSortable }); $(this.listElement).append( this.assetsView.render().el ); this.assets.fetch(); }; this.destroy = function(){ this.dropView.undelegateEvents(); this.assetsView.undelegateEvents(); this.assets.off(); } this.initialize( opts ); }; // // Messages if any file validation error // BBAssetsUpload.Messages = { maxFileSizeExceeded: "File too big", fileTypeNotAccepted: "File type not accepted" }; // // To be used as HTML element classes or data custom attributes // BBAssetsUpload.Constants = { URL: (window.URL || window.webkitURL), assetElementClass: "bbassetsupload-asset", assetListClass: "bbassetsupload-assets", assetDataId: "data-bbassetsupload-asset-id", dropOverClass: "bbassetsupload-over" }; // // The File Validator // in charge of validate each file // showing alert messages if any error found // BBAssetsUpload.FileValidator = function( opts ){ // optional this.acceptFileTypes = opts.acceptFileTypes; this.maxFileSize = opts.maxFileSize * 1000; this.errors = function( file ){ var result = []; if( this.maxFileSize ) { if( file.size > this.maxFileSize ) { result.push( BBAssetsUpload.Messages.maxFileSizeExceeded ); } } if( this.acceptFileTypes ) { var file_extension = file.name.split( "\." ).slice(-1)[0]; var regExp = new RegExp( "(^|,| )" + file_extension + "($|,| )", "i" ) if( this.acceptFileTypes.search( regExp ) == -1 ){ result.push( BBAssetsUpload.Messages.fileTypeNotAccepted ); } } if( result.length == 0 ) return false; return result; }; this.validate = function( file ){ var errors = this.errors( file ); if( errors ) { message = "The file '" + file.name + "' has errors: "; message += errors.join( ", " ); alert( message ); return false; } else { return true; } }; }; // // Backbone elements // BBAssetsUpload.Backbone = {} // // The Asset Model // BBAssetsUpload.Backbone.Asset = Backbone.Model.extend({ initialize: function(){ _.bindAll( this, "onProgress", "onSuccess", "onError" ); if( !this.get( "state" ) ) this.set( "state", "completed" ); }, toJSONDecorated: function() { return _.extend( this.toJSON(), { cid: this.cid } ); }, upload: function() { console.debug( "[BBAssetsUpload 0.0.3] Uploading file: " + this.get( "file" ).name ); $.upload( this.get( "url" ), this.get( "file" ), { upload: { progress: this.onProgress }, success: this.onSuccess, error: this.onError } ); }, onStart: function(){ if( this.eventCatcher ) this.eventCatcher.trigger( "asset:start", this ); }, onProgress: function( event ){ var progress = Math.round((event.position / event.total) * 100); var opts = { "progress": progress }; if( progress == 100 ) opts["state"] = "processing"; this.set( opts ); if( this.eventCatcher ) this.eventCatcher.trigger( "asset:progress", this ); }, onSuccess: function( event ){ console.debug( "[BBAssetsUpload 0.0.3] File uploaded: " + this.get( "file" ).name ); var opts = _.extend( event, { "state": "completed" } ); this.set( opts ); if( this.eventCatcher ) this.eventCatcher.trigger( "asset:success", this ); }, onError: function( event ){ console.error( "[BBAssetsUpload 0.0.3] onError uploading file: " + this.get( "file" ).name, event ); if( this.eventCatcher ) this.eventCatcher.trigger( "asset:error", this ); } }); // // The Assets Collection // BBAssetsUpload.Backbone.Assets = Backbone.Collection.extend({ model: BBAssetsUpload.Backbone.Asset, initialize: function( options ){ this.url = options.url; this.eventCatcher = options.eventCatcher; this.on( "add", this.initializeAssetEventCatcher, this ); }, initializeAssetEventCatcher: function( model ){ model.eventCatcher = this.eventCatcher; model.onStart(); } }); // // The AssetsOrder Model // in charge of sent reorder requests // BBAssetsUpload.Backbone.AssetsOrder = Backbone.Model.extend({ initialize: function( options ){ this.url = options.url } }); // // The Assets View // in charge or render all the Assets // BBAssetsUpload.Backbone.AssetsView = Backbone.View.extend({ tagName: "ul", attributes: { class: BBAssetsUpload.Constants.assetListClass }, initialize: function() { this.collection.on( 'add', this.addOne, this ); this.collection.on( 'reset', this.addAll, this ); if( this.options.listSortable ) { this.$el.sortable({ placeholder : "placeholder", items : "li.completed." + BBAssetsUpload.Constants.assetElementClass, update : $.proxy( this.updateOrder, this ), }); this.$el.disableSelection(); } }, updateOrder: function(){ var sorted_ids = $.makeArray( this.$el.find( "li." + BBAssetsUpload.Constants.assetElementClass ).map( function( element ){ return $(this).attr( BBAssetsUpload.Constants.assetDataId ); }) ); var asset_order = new BBAssetsUpload.Backbone.AssetsOrder({ url : this.options.reorderUrl }); asset_order.save({ ids: sorted_ids }) }, addOne: function( model ) { var view = new BBAssetsUpload.Backbone.AssetView({ model: model, template: this.options.assetTemplate, templateUploading: this.options.assetUploadingTemplate, }); this.$el.append( view.render().el ); if( this.options.listSortable ) { this.$el.sortable( "refresh" ); } }, addAll: function() { this.collection.each( $.proxy( this.addOne, this ) ); }, }); // // The Asset View // in charge or rendering each Asset // changing between templates on depending the Asset.state // BBAssetsUpload.Backbone.AssetView = Backbone.View.extend({ tagName: "li", attributes: { class: BBAssetsUpload.Constants.assetElementClass, }, initialize: function(){ this.template = _.template( this.options.template ); this.templateUploading = _.template( this.options.templateUploading ); this.model.on( "destroy", this.remove, this ); this.model.on( "change", this.render, this ); }, events: { "click .delete": "destroy" }, destroy: function(){ this.model.destroy(); }, render: function() { var template = this.model.get( "state" ) == "completed" ? this.template : this.templateUploading; this.$el.html( template( this.model.toJSONDecorated() ) ); this.$el.addClass( this.model.get( "state" ) ); this.$el.attr( BBAssetsUpload.Constants.assetDataId, this.model.id ); return this; } }); // // The Drop View // in charge of capturing the `drop` event // and create new Assets on demand // BBAssetsUpload.Backbone.DropView = Backbone.View.extend({ events: { "drop": "drop", "dragenter": "dragEnter", "dragover": "dragOver", "dragleave": "dragLeave" }, initialize: function( options ) { this.url = options.url; }, // events inspired on: Code modified from: https://github.com/maccman/holla/blob/master/app/javascripts/lib/jquery.drop.js // License: MIT dragEnter: function( event ) { this.$el.addClass( BBAssetsUpload.Constants.dropOverClass ); this.stopEvent( event ); return false; }, dragOver: function( event ) { event.originalEvent.dataTransfer.dropEffect = "copy"; this.stopEvent( event ); return false; }, dragLeave:function( event ) { this.$el.removeClass( BBAssetsUpload.Constants.dropOverClass ); this.stopEvent( event ); return false; }, drop: function( event ){ this.$el.removeClass( BBAssetsUpload.Constants.dropOverClass ); var files = event.originalEvent.dataTransfer.files; this.stopEvent( event ); this.processFiles( files ); return false; }, processFiles: function( files ){ _.each( files, function( file ){ this.processFile( file ) }, this); }, processFile: function( file ){ if( this.options.validator.validate( file ) ) { asset = this.createAsset( file ); this.uploadAsset( asset ) } }, uploadAsset: function( asset ){ asset.upload(); }, createAsset: function( file ){ var file_url = BBAssetsUpload.Constants.URL.createObjectURL( file ); var asset = new BBAssetsUpload.Backbone.Asset({ url: this.url, name: file.name, file: file, file_url: file_url, progress: 0, state: "uploading", }); this.collection.add( asset ); return asset; }, stopEvent: function( event ){ event.stopPropagation(); event.preventDefault(); } }); console.log( "[BBAssetsUpload 0.0.3] ... BBAssetsUpload::Loaded" ); });
2048783244ae20f507838484f5a4fff19350ac83
[ "JavaScript", "SQL", "Markdown", "PHP" ]
12
JavaScript
nitesh-weboniselab/backbone_gallery_example
d2d7ab8a37567b4ecfedddacf9398e634c7d2bf3
3175774163c410db710ba8665ddb95a25fe5f938
refs/heads/master
<file_sep>define('c', function(require, exports){ exports.name = 'c'; exports.sayHi = function(name){ name = name || ''; console.log('hi,' + name); } exports.work = function(){ console.log('good good study'); }; console.log('c.js'); });<file_sep>var chokidar = require('chokidar'); var exec = require('child_process').exec; var connect = require('connect'); var serverStatic = require('serve-static'); var app = connect(); var tmpl = [ '<!doctype html>', '<html>', '<head>', '<body>', '<a href="/demo">查看demo</a>', '</body>', '</head>', '</html>' ].join(''); app.use(serverStatic(__dirname)).listen(5555, function(){ console.log('Static Server listening on port 5555'); }); app.use(function(req, res){ res.end(tmpl); }); if(process.argv.indexOf('-w') != -1){ var watch = chokidar.watch('../', {ignored : /[\/\\]\./, persistent : true}); watch.on('change', function(path){ exec('make build', function(err, stdout, stderr){//windows下执行命令会出错,linux下不会。所以windows就手动make吧。。 console.log(stdout); if(stderr){ console.log('stderr: ' + stderr); } }); }) .on('error', function(error){ console.error('Error happened', error); }); }<file_sep>seajs-appcache ============ A Sea.js plugin for appcache and increjs Usage ----- ```html <script src="path/to/sea.js"></script> <script src="path/to/seajs-appcache.js"></script> <script type="text/javascript"> seajs.config({ base : 'tests/assets', alias : { a : 'a_140707.js', b : 'b_140707_140708.js', 'sub/c' : 'sub/c_140708.js' }, appcache : {//appcache插件相关配置 //dev : true,//开发调试环境 jsdir : 'http://cdn.com/js',//cdn上js目录 cacheEnable : true, //是否启用appcache特性 incre : true//是否启用增量更新特性 } }); seajs.use('a', function(A){ A.sayHi('Alice'); }); seajs.use('b', function(B){ B.thanks('Bob'); }); </script> ``` Attention ----- **modify seatools/Gruntfile.js** from ```javascript watch: { options: { spawn: false }, template: { files: src, tasks: ['copy', 'meta'], options: { livereload: true } } } ``` to ```javascript watch: { options: { spawn: false }, template: { files: src, tasks: ['build','copy', 'meta'], options: { livereload: true } } } ``` when use `seatools site -w`, it can build plugin before livereload. And seatools is installed global in system, don`t modify the wrong Gruntfile.js file. <file_sep>REPORTER = spec build: @seatools build site: @seatools build @seatools site -w test: @mocha tests/spec/mocha-runner.js --reporter $(REPORTER) #test-cov:lib-cov # $(MAKE) test REPORTER=html-cov > coverage.html #test-cov: # @$(MAKE) test REPORTER='html-cov > coverage.html' #lib-cov: # jscoverage lib lib-cov totoro: @seatools site @seatools test --totoro size: @seatools size <file_sep>###说明 此目录用nodejs实现一些系统命令 ###命令列表 <file_sep>/** * Run test specs in mocha environment */ var should = require('should'); describe('mocha demo', function(){ it('should return a number', function(){ var a = 4; a.should.be.a.Number; }); it('should return a string', function(){ var num = '4'; num.should.be.a.String; }); }); <file_sep>define('a', function(require, exports){ exports.name = 'a'; exports.sayHi = function(name){ name = name || ''; console.log('hi,' + name); } console.log('a.js'); });<file_sep>(function(){ /** * The Sea.js plugin for appcache and increjs * require : sea.js 3.0.0 * * localStorage,version,increjs * MI.define * MI.app * MI.appcache * MI.S * * test framework * mocha+should.js+blanket.js * * @todo * 1、appcache测试用例 * 2、开发increjs node模块 increfile.js * 3、暂不支持IE * 4、holdLoad不好使,只能存callback+打标记了 * * seatools build会检测语法错误 * * appCache原理: * 使用ajax的方式请求cdn上的js代码内容,并将其存入localStorage中 * 版本控制方案:在文件名后追加"_140801x",如"a_140801.js","a_140801a.js" * 增量文件生成,可使用increjs工作(https://github.com/aslinwang/increjs) * 可能有跨域问题,解决方案 * - Access-Control-Allow-Origin:http://m.qzone.com * - 将js文件存在与主站同域的CDN上 * - 本插件方案专为腾讯微博实现 */ var Module = seajs.Module; var Data = seajs.data; /** * 浏览器版本 * * @type Object * @example * B.ie//如果是IE,返回IE的版本号(6,8,9,10,11) * B.ie6 * B.ipad */ var B = (function(){ //Browser var b = {}, userAgent = navigator.userAgent, key = { win : 'Windows', mac : 'Mac', ie : 'MSIE', ie6 : 'MSIE 6', ie7 : 'MSIE 7', ie8 : 'MSIE 8', ie9 : 'MSIE 9', safari : 'WebKit', webkit : 'WebKit', chrome : 'Chrome', ipad : 'iPad', iphone : 'iPhone', os4 : 'OS 4', os5 : 'OS 5', os6 : 'OS 6', qq : 'QQBrowser', firefox : 'Firefox', tt : 'TencentTraveler', opera : 'Opera', esobi : 'eSobiSubscriber'//http://product.esobi.com/esobi/index.jsp,@liuy使用这货 }; b.win = b.win || userAgent.indexOf('Win32') != -1; for(var item in key){ b[item] = userAgent.indexOf(key[item]) != -1; }; b.ie6 = b.ie6 && !b.ie7 && !b.ie8; b.opera = window['opera'] || b.opera; try{ b.maxthon = window['external'] && window['external']['max_version'];//Error In Some ie8 }catch(e){} //detect ie11 var m = /(msie\s|trident.*rv:)([\w.]+)/.exec(userAgent.toLowerCase()); if(m && m.length > 0){ b.ie = true; if(m[2]){ b.ie = parseFloat(m[2]); } } //@TODO 万恶的微软啊,先这样处理IE11吧,如果以后出IE12什么的要升级Trident,到时候再处理吧 if(!!userAgent.match(/Trident\/7\./)){ b.ie = 11; } return b; })(); var DomReady = (function(){ var done = false,//ready队列中的操作是否执行完毕 loaded = false,//页面是否已经加载完全 funcs = [], ie9 = navigator.userAgent.indexOf('MSIE 9') !== -1; var onReady = function(){ if(!done){ done = true; for(var i = 0, num = funcs.length; i < num; i++){ if(funcs[i]){ funcs[i](); } } funcs = null; } }; var load = function(){ if(loaded){ return; } loaded = true; if(document.readyState === 'complete'){ onReady(); } else if(document.addEventListener){ if(document.readyState === 'interactive' && !ie9){ onReady(); } else{ document.addEventListener('DOMContentLoaded', function(){ document.removeEventListener('DOMContentLoaded', arguments.callee, false); onReady(); }, false); } } else if(document.attachEvent){ var iframe = top !== self; if(iframe){ document.attachEvent('onreadystatechange', function(){ if(document.readyState === 'complete'){ document.detachEvent('onreadystatechange', arguments.callee); onReady(); } }); } else if(document.documentElement.doScroll && !iframe){ (function(){ if(done){ return; } try{ document.documentElement.doScroll('left'); } catch(e){ setTimeout(arguments.callee, 0); return; } onReady(); }()); } } if(document.addEventListener){ window.addEventListener('load', onReady, false); } else if(document.attachEvent){ window.attachEvent('onload', onReady, false); } }; var ready = function(f){ if(done){ return f(); } if(loaded){ funcs.push(f); } else{ funcs = [f]; load(); } }; return ready; }()); function random(){ return parseInt( new Date().getTime()); } function createNode(n){ return document.createElement(n); } function attr(o,n,v){ if(o && o.getAttribute){ if(v == undefined){ return o.getAttribute(n) || ''; } else if(v == ''){ o.removeAttribute(n); } else{ o.setAttribute(n,v); } } } function html(s){ var wrap = createNode('div'),nodes=[]; wrap.innerHTML = s; var children = wrap.childNodes; for(var i = 0; i < children.length; i++){ var node = children[i]; if(node && node.nodeType === 1){ nodes.push(node); } } return nodes; } function sealog(){ if(Data.appcache && Data.appcache.dev){ console.log.apply(console, arguments); } } var xmlHttp = (function(){ var f; if(window.ActiveXObject){ f = function(){ return new ActiveXObject('Microsoft.XMLHTTP'); }; } else if(window.XMLHttpRequest){ f = function(){ return new XMLHttpRequest(); }; } else{ f = function(){ return; }; } return f; })(); function rawAjax(o){ var xhr = o.xhr || xmlHttp(), complete, timeout; o.async = typeof o.async === 'undefined' ? true : o.async; xhr.onreadystatechange = function(){ if(xhr.readyState === 1){ if(o.timeout && o.fail){//超时 timeout = setTimeout(function(){ if(!complete){ complete = 1; o.fail(); xhr.abort(); xhr = null; } }, o.timeout); o.timeout = 0; } } else if(xhr.readyState === 2){ if(o.send){ o.send(); } } else if(xhr.readyState === 4 && !complete){ complete = 1; if(xhr.status === 200){ if(o.success){ o.success(xhr.responseText); } } else{ if(o.fail){ o.fail(); } } clearTimeout(timeout); xhr = null; } }; if(typeof o.data === 'object'){ var data = []; for(var i in o.data){ data.push(i + '=' + encodeURIComponent(o.data[i])); } o.data = data.join('&'); } var rf = function(){ if(o.refer){ xhr.setRequestHeader('rf', o.refer); } } if(o.type && o.type.toLowerCase() === 'get'){ if(o.data){ o.url += (o.url.indexOf('?') !== -1 ? '&' : '?') + o.data; } xhr.open('GET', o.url, o.async); rf(); xhr.send(null); } else{ xhr.open('POST', o.url, o.async); rf(); xhr.setRequestHeader('Content-type', 'application/x-www-form-urlencoded'); xhr.send(o.data); } return xhr; } window.fetchAjax = function(o, lonely){ var iframe = '_ajaxProxy_', ajax = '_ajax_', xhrName = '_ajaxXhr_', xhrObj = '_ajaxObj_'; var srcHost = 'http://' + document.location.host; var destHost = srcHost; if(typeof o === 'object'){ if(o.url){ destHost = o.url.match(/(http:\/\/)+([^\/]+)/i); if(destHost && destHost[0]){ destHost = destHost[0]; } } o.data = o.data || ''; o.id = o.id || xhrObj + random(); if(destHost === srcHost){//同域跳过 return rawAjax(o); } } document.domain = 'qq.com'; if(!window._AJAX_){ window._AJAX_ = {}; } if(typeof o === 'string'){ destHost = 'http://' + o.replace(ajax, ''); } var _AJAX_ = window._AJAX_; var destHostName = destHost.replace('http://', ''); iframe += destHostName; xhrName += destHostName; ajax += destHostName; if(typeof o === 'string'){//来自iframe onload的调用 ajax = o; } if(!_AJAX_[ajax]){//请求队列 _AJAX_[ajax] = []; } if(!_AJAX_[iframe]){//创建proxy.html iframe _AJAX_[ajax].push(o); var name = 'ajaxProxy' + random(); if(o.url && o.url.indexOf('www.qq.com/mb') !== -1){//请求素材 destHost += '/mb/mat1/mb/js'; } _AJAX_[iframe] = html([ '<iframe id = "', name , '" name = "', name , '" src = "', destHost , '/proxy.html" ', 'style = "display:none" ', 'onload = "setTimeout(function(){window._AJAX_[\'', xhrName , '\'] = 1; window.fetchAjax(\'', ajax , '\');},50);"', '></iframe>' ].join(''))[0]; DomReady(function(){ document.body.appendChild(_AJAX_[iframe]); }); } else if(!_AJAX_[xhrName]){//proxy.html加载中 _AJAX_[ajax].push(o); } else{ if(_AJAX_[ajax].length && !lonely){ for(var key in _AJAX_[ajax]){ window.fetchAjax(_AJAX_[ajax][key], true); } } else if(typeof o === 'object'){ _AJAX_[ajax] = []; try{ o.xhr = _AJAX_[iframe].contentWindow.xmlHttp(); } catch(e){} o.refer = document.location.href; _AJAX_[o.id] = rawAjax(o); return _AJAX_[o.id]; } } } //__getjs__为自定义get ajax var getjs = window.__getjs__ || function(url, cb){ window.fetchAjax({ url : url, type : 'get', success : function(data){ if(cb){ cb(data); } } }); }; var getJsonp = function(url, call, charset, keep){ var el = createNode('script'); if(B.ie && B.ie < 11){ el.onreadystatechange = function(){ if(this.readyState == 'loaded' || this.readyState == 'complete'){ if(call){ call(); } el = null; } } } else{ el.onload = function(){ if(call){ call(); } el = null; } } if(charset){ attr(el, 'charset', charset); } attr(el, 'type', 'text/javascript'); attr(el, 'src', url); attr(el, 'async', 'true'); document.getElementsByTagName('head')[0].appendChild(el); }; var S = { _maxRetry : 1, _retry : true, _prefix : /^https?\:/,//key前缀 enable : window.hasOwnProperty('localStorage'), setPrefix : function(v){ this._prefix = v; }, get : function(key, parse){ var val; try{ val = localStorage.getItem(key); } catch(e){ return undefined; } if(val){ return parse ? JSON.parse(val) : val; } else{ return undefined; } }, set : function(key, val, retry){ retry = (typeof retry === 'undefined') ? this._retry : retry; try{ localStorage.setItem(key, val); } catch(e){ if(retry){ var max = this._maxRetry; while(max > 0){ max--; this.removeAll(); this.set(key, val, false); } } } }, remove : function(url){ try{ localStorage.removeItem(url); } catch(e){ } }, removeAll : function(){ var prefix = this._prefix; for(var i = localStorage.length - 1; i >= 0; i--){ var key = localStorage.key(i); if(!prefix.test(key)){ continue; } localStorage.removeItem(key); } } }; var jscode = (function(){ var manifestKey = 'seajs_manifest'; var manifest = S.get(manifestKey, true) || {}; var parseUri = function(uri){ var info = {}; info.jsdir = Data.appcache.jsdir; info.url = uri.replace(Data.appcache.jsdir, '').replace(/_(\w+).js/, ''); // info.ver = uri.match(/_(\w+).js/); // info.ver = info.ver ? info.ver[1] : null; var vers = uri.match(/\d{6}[a-zA-Z0-9]?/g); if(vers){ if(vers.length == 1){ info.ver = vers[0]; info.localver = null; } else if(vers.length == 2){ info.ver = vers[1]; info.localver = vers[0]; } } else{ info.ver = null; info.localver = null; } manifest = S.get(manifestKey, true) || {}; info.cachever = manifest[info.url]; return info; }; var execjs = function(code){ if(window.execScript){ window.execScript(code); } else{ window.eval(code); } }; var ret = {}; ret.save = function(uri, code){ uri = uri.replace('mat1.gtimg.com/www', 'www.qq.com/mb/mat1');//腾讯微博解决方案 var info = parseUri(uri); if(info.ver){//有版本号才保存 manifest.jsdir = info.jsdir; if(code){ manifest[info.url] = info.ver; S.set(manifestKey, JSON.stringify(manifest)); S.set(info.url, code); } else{ getjs(uri, function(text){ manifest[info.url] = info.ver; S.set(manifestKey, JSON.stringify(manifest)); S.set(info.url, text); }); } } }; ret.exist = function(uri){//检测uri是否在本地存储中有备份 /* manifest = S.get(manifestKey, true) || {}; var info = parseUri(uri); if(info.ver){ if(manifest[info.url] === info.ver){ return true; } } return false; */ var info = parseUri(uri); return info.cachever && info.cachever == info.ver; }; ret.exec = function(uri){//从cache中获取代码并执行 var code = ret.getcode(uri); if(code){ execjs(code); sealog('exec js...'); } }; ret.getcode = function(uri){ var info = parseUri(uri); var code = '' if(info.ver){ code = S.get(info.url) || ''; } return code; }; ret.clear = function(){//从cache中清除 S.removeAll(); manifest = {}; }; ret.getIncre = function(uri){//是否请求增量版本 var info = parseUri(uri); var _ret = { incre : false, ver : info.ver,//cdn version localver : info.localver,//local version cachever : info.cachever//cache version }; //parse version if(info.ver){ if(info.localver && info.localver == info.cachever && increEnable){ _ret.js = [Data.appcache.jsdir, info.url, '_', info.localver, '_', info.ver, '.js'].join(''); _ret.incre = true; } else{ _ret.js = [Data.appcache.jsdir, info.url, '_', info.ver, '.js'].join(''); } _ret.alljs = [Data.appcache.jsdir, info.url, '_', info.ver, '.js'].join(''); } else{ _ret.js = uri; _ret.alljs = uri; } //check enable return _ret; }; /** * js增量更新算法-增量文件合并 * @param {[type]} source [description] * @param {[type]} trunksize [description] * @param {[type]} checksumcode [description] * @return {[type]} [description] */ ret.mergejs = function(source, trunksize, checksumcode){ var str = ''; for(var i = 0; i < checksumcode.length; i++){ var code = checksumcode[i]; if(typeof (code) == 'string'){ str += code; } else{ var start = code[0]*trunksize; var end = code[1]*trunksize; var oldcode = source.substr(start, end); str += oldcode; } } return str; }; ret.execjs = execjs; return ret; }()); var cacheEnable = true;//是否启用appcache var increEnable = true;//是否启用增量更新 var modInfoCache = {}; function debug(){ seajs.S = S; seajs.getjs = getjs; seajs.clearS = function(){//快速清空cache jscode.clear(); }; } seajs.on('config', function(){ Data.appcache.sPrefix = /(.*\.js$)|(^seajs_manifest$)/;//localstorage中key正则 cacheEnable = Data.appcache.cacheEnable && S.enable; increEnable = cacheEnable && Data.appcache.incre; S.setPrefix(Data.appcache.sPrefix); if(Data.appcache.dev){ debug(); } }); seajs.on("load", function(arg){ //sealog('load>>>>>', arg); }); seajs.on("fetch", function(data){ //data.uri - 存储最终要发出请求的url //1.查询本地存储,是否有本地cache //2.查看url的版本号,是否符合增量规则[pathname:jscode] //Data.fetchedList[data.requestUri] = true;//终止网络请求 var mod = Module.get(data.uri); if(cacheEnable){ if(!jscode.exist(data.uri)){ var incre = jscode.getIncre(data.uri); if(incre.incre){ var key = data.uri.replace(Data.base, '') .replace(/_[0-9a-zA-Z]+/g, '') .replace('.js', ''); //getjs increjs getJsonp(incre.js, function(){ var mergejs = ''; var localjs = ''; var increData = window['increCallback_' + key.replace('/', '_')]; localjs = jscode.getcode(Data.base + key + '_' + incre.cachever + '.js'); if(localjs && increData){ //merge js mergejs = jscode.mergejs(localjs, increData.chunkSize, increData.data); mergejs = mergejs ? '/**' + incre.localver + '_' + incre.ver + '**/' + mergejs : localjs; try{ //exec js jscode.execjs(mergejs); console.log(mergejs); //resume callback Module.resumeCallback(); //save js jscode.save(Data.base + key + '_' + incre.ver + '.js', mergejs); } catch(e){ sealog(e); getJsonp(incre.alljs, function(){ //resume callback Module.resumeCallback(); jscode.save(incre.alljs); }); } } }); Data.fetchedList[data.uri] = true;//终止网络请求 mod.holdCallback(); } else{ jscode.save(incre.js);//存储code data.requestUri = incre.js; } } else{//本地cache有代码,不必重新请求 jscode.exec(data.uri); Data.fetchedList[data.uri] = true;//终止网络请求 } } sealog('fetch>>>>>'); }); seajs.on("loaded", function(mod){ if(mod.nonet){ mod.status = Module.STATUS.FETCHING; } }); seajs.on("request", function(arg){ sealog('request>>>>>'); }); seajs.on("define", function(data){ sealog('define>>>>>'); }); seajs.on('error', function(data){ //请求失败-js文件404 }); Module.prototype.holdCallback = function(){ var mod = this; mod.nonet = true;//不经过网络请求 if(typeof mod.callback == 'function'){ mod.holdCb = true; } for(var i = 0, len = (mod._entry || []).length; i < len; i++){ var entry = mod._entry[i]; if(typeof entry.callback == 'function'){ entry.holdCb = true; } } mod.entrybak = mod._entry; }; //@override Module.prototype.onload = function() { var mod = this; mod.status = Module.STATUS.LOADED; // When sometimes cached in IE, exec will occur before onload, make sure len is an number for (var i = 0, len = (mod._entry || []).length; i < len; i++) { var entry = mod._entry[i]; if (--entry.remain === 0) { entry.callback(); } } seajs.emit('loaded', mod); delete mod._entry } var isArray = Array.isArray || isType("Array"); // @override // Use function is equal to load a anonymous module Module.use = function (ids, callback, uri) { var mod = Module.get(uri, isArray(ids) ? ids : [ids]); mod._entry.push(mod); mod.history = {}; mod.remain = 1; mod.callback = function() { if (callback && !mod.holdCb) { var exports = []; var uris = mod.resolve(); for (var i = 0, len = uris.length; i < len; i++) { exports[i] = seajs.cache[uris[i]].exec(); } callback.apply(window, exports); } modInfoCache[mod.uri] = { mod : mod, callback : callback, exports : exports }; delete mod.callback; delete mod.history; delete mod.remain; delete mod._entry; } mod.load(); } Module.resumeCallback = function(){ for(var key in modInfoCache){ var modInfo = modInfoCache[key]; var mod = modInfo.mod; if(mod.holdCb){ var exports = []; var uris = mod.resolve(); for (var i = 0, len = uris.length; i < len; i++) { var cache = seajs.cache[uris[i]]; cache.status = Module.STATUS.LOADED; cache._entry = cache.entrybak; exports[i] = cache.exec(); } modInfo.callback.apply(window, exports); delete mod.holdCb; } delete modInfoCache[key]; } } define("seajs/seajs-appcache/1.0.1/seajs-appcache-debug", [], {}); })();<file_sep>define('b', function(require, exports){ exports.name = 'b'; exports.sayHi = function(name){ name = name || ''; console.log('hi,' + name); } console.log('b.js'); });
68c319c09462a259c8d0f33efce241c2c5d12b0f
[ "JavaScript", "Makefile", "Markdown" ]
9
JavaScript
aslinwang/seajs-appcache
57fc6db6253518ae5ee93e2fb996099a7af1d306
f0399d757cfb15cb55495ad6cca60bc19e05e60e
refs/heads/master
<file_sep># encoding: utf-8 # copyright: 2015, The Authors control 'windows-rdp' do impact 1.0 title 'Windows RDP Configured to Encrypt and Prompt for Password' desc 'All RDP connections should be encrypted and prompt for a password on each connection. This is an internal security requirement.' describe registry_key('HKLM\SOFTWARE\Policies\Microsoft\Windows NT\Terminal Services') do it { should exist } its('fPromptForPassword') { should eq 1 } its('MinEncryptionLevel') { should eq 3 } end end
e064f87434a3e4ddc75ccbeff45b6208b4c811ae
[ "Ruby" ]
1
Ruby
ericcalabretta/detect_correct_automate
04ec03e33db48f851ad495c07f3f6b11a68b91f4
462ec8bb81265b37c10e7f7444f4bba126768456
refs/heads/master
<file_sep>using System.ComponentModel; public enum PageName { LogIn } public enum Element { SignIn, UserName, Header, Password }<file_sep>#!/usr/bin/env sh docker-compose run --rm nodejs npm install docker-compose run --rm nodejs npm run e2e<file_sep>version: '3.7' services: nodejs: working_dir: /project image: node:latest dns: 8.8.4.4 depends_on: - chrome volumes: - .:/project chrome: ports: - '4444' - '5901:5900' dns: 8.8.4.4 image: selenium/standalone-chrome-debug:latest<file_sep>const {By} = require("selenium-webdriver"); module.exports = { elements: { UserName: By.id("identity"), Password: By.id("<PASSWORD>"), SignIn: By.name("submit"), Title: By.xpath("//title"), } }; <file_sep>let assert = require('assert'); let loginPage = require('../../page-objects/LoginPage'); module.exports = function () { this.Given(/^I am on "([^"]*)"$/, function (arg1) { return this.driver.get(arg1); }); this.Then(/^I should see "([^"]*)" in title$/, function (text) { return this.driver.getTitle().then(function (title) { assert.equal(title, text) }) }); this.When(/^I click on "([^"]*)"$/, function (element) { return this.driver.findElement(loginPage.elements[element]).click() }); this.When(/^I fill in "([^"]*)" with "([^"]*)"$/, function (field, value) { return this.driver.findElement(loginPage.elements[field]).sendKeys(value); }); }; <file_sep><?php namespace Page; class LoginPageObject { public static $elements = [ 'UserName' => ['id' => 'identity'], 'Password' => ['id' => '<PASSWORD>'], ]; } <file_sep><?php use Page\LoginPageObject; use Codeception\Step\Assertion; /** * Inherited Methods * @method void wantToTest($text) * @method void wantTo($text) * @method void execute($callable) * @method void expectTo($prediction) * @method void expect($prediction) * @method void amGoingTo($argumentation) * @method void am($role) * @method void lookForwardTo($achieveValue) * @method void comment($description) * @method \Codeception\Lib\Friend haveFriend($name, $actorClass = NULL) * * @SuppressWarnings(PHPMD) */ class AcceptanceTester extends \Codeception\Actor { use _generated\AcceptanceTesterActions; private $xlsFile; /** * @Given I am on :arg1 */ public function iAmOn($arg1) { $this->amOnPage($arg1); } /** * @Given I should see :text * @throws Exception */ public function iShouldSee($text) { $this->waitForText($text); } /** * @Given I fill in :fieldName with :fieldValue * @param $fieldName * @param $fieldValue */ public function iFillInWith($fieldName, $fieldValue) { $this->fillField(LoginPageObject::$elements[$fieldName], $fieldValue); } /** * @Given I press search btn */ public function iPressSearchBtn() { $this->click(LoginPageObject::$elements['searchBtn']); } /** * @Given I click on :arg1 */ public function iClickOn($arg1) { $this->click($arg1); } } <file_sep># Automation framework demo: ## Stack: PHP/BDD/Docker/Selenium **This demo framework showing one login test to our staging server** *** General prerequisites: 1) Docker should be installed: https://hub.docker.com/?overlay=onboarding 2) VNC viewer will allow you to check UI inside docker: https://www.realvnc.com/en/connect/download/viewer/ a. use host "localhost:5901" and password "<PASSWORD>" to connect *** Unix: 1) Run: ``sudo chmod +x ./run`` 2) Execute: ``./run`` *** Windows: 1) Execute ``run.bat``<file_sep>using System.Collections.ObjectModel; using OpenQA.Selenium; using OpenQA.Selenium.Chrome; using Selenium.Support; namespace Selenium.Pages { public class LogInPage : TestPage { public LogInPage(ChromeDriver webDriver) { Setup(webDriver); Name = PageName.LogIn; } protected sealed override Collection<Locator> InitializeLocators() { return new Collection<Locator> { new Locator(Element.SignIn, By.Name("submit")), new Locator(Element.UserName, By.Id("identity")), new Locator(Element.Header, By.XPath("//li[@class='vd-tab active-tab ' and contains(.,'CONTENT HEALTH')]")), new Locator(Element.Password, By.Id("<PASSWORD>")) }; } } } <file_sep>using NUnit.Framework; using Selenium.Pages; using Selenium.Support; using TechTalk.SpecFlow; namespace SpecFlow.Steps { [Binding] public class Stepdefs { private AutomationTestSite automationTestSite; public Stepdefs(AutomationTestSite automationTestSite) { this.automationTestSite = automationTestSite; } [Given(@"I am on ""(.*)""")] public void GivenIAmOn(string url) { automationTestSite.GoTo(url); } [When(@"I fill in username with ""(.*)""")] public void WhenIFillInUsernameWith(string value) { automationTestSite.EnterTextIntoInputField(PageName.LogIn, Element.UserName, value); } [When(@"I fill in password with ""(.*)""")] public void WhenIFillInPasswordWith(string value) { automationTestSite.EnterTextIntoInputField(PageName.LogIn, Element.Password, value); } [When(@"I click on ""(.*)""")] public void WhenIClickOn(string element) { automationTestSite.ClickElementOnPage(PageName.LogIn, Element.SignIn); } [Then(@"I should see ""(.*)"" in title")] public void ThenIShouldSeeInTitle(string text) { automationTestSite.DoesElementExistOnPage(PageName.LogIn, Element.Header); } } } <file_sep>#!/usr/bin/env sh docker-compose run --rm --entrypoint "bash -c 'chmod +x composer.phar; ./composer.phar install; codecept build'" codecept docker-compose run --rm codecept run "tests/acceptance/Login.feature:Login selenium test" --steps -o "modules: config: WebDriver: host: chrome"
237519383dbebddf4cccfec9458b6c33a8323d46
[ "YAML", "JavaScript", "Markdown", "C#", "PHP", "Shell" ]
11
C#
dimonze/autoFrameworks
20d9293e9ec557217130d0886f3b88b8e4f4c0fb
9829ad37dcbd7b428a1bb00253d0a59f9b63e87c
refs/heads/master
<repo_name>YanYixuan999/BasicMathFormula<file_sep>/app/src/main/java/sg/edu/rp/c346/basicmathformula/MainActivity.java package sg.edu.rp.c346.basicmathformula; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.widget.ListView; import java.util.ArrayList; public class MainActivity extends AppCompatActivity { ListView lvFormula; ArrayList<FormulaList> alFormulaList; ShapeAdapter saFormula; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); lvFormula = findViewById(R.id.ListViewFormula); alFormulaList = new ArrayList<FormulaList>(); FormulaList formula1 = new FormulaList("Area of rectangle","Length x Length","Formula type is: Area"); FormulaList formula2 = new FormulaList("Area of triangle","(Length of base x Length)/2","Formula type is: Area"); FormulaList formula3 = new FormulaList("Volume of cube","Length x Length x Length","Formula type is: Volume"); alFormulaList.add(formula1); alFormulaList.add(formula2); alFormulaList.add(formula3); saFormula = new ShapeAdapter(this,R.layout.formula_list,alFormulaList); lvFormula.setAdapter(saFormula); } }
3f9d4d963280b99e799715127385e351a27a96b7
[ "Java" ]
1
Java
YanYixuan999/BasicMathFormula
49858fa9a1dfedb2ee8a14eb68f4d5938e85923a
28887ec9aededf6804b899b5f3f8357eaaa43559
refs/heads/master
<repo_name>sterlingdax/Class---Tutorial-Stuff<file_sep>/boxprint.py def boxPrint(symbol, width, height): if len(symbol) != 1: raise Exception('"Symbol" needs to be a string length of 1') if (width < 2) or (height <2): raise Exception('"Width" and "height" must be greater than or equal to 2.') print (symbol * width) for i in range(height - 2): print(symbol + (' ' * (width -2)) + symbol) print(symbol * width) boxPrint('*', 15, 5) boxPrint('O', 5, 16)
41ba3db403b0453ee4d457e2a019bc7eff32df65
[ "Python" ]
1
Python
sterlingdax/Class---Tutorial-Stuff
6f64defb466d269fed2e463c5c9d2c3e28deb9c1
b206f1b150e4574ceffa1eb16212eb045720163b
refs/heads/master
<repo_name>LutskovaKI/RDLabsStudentTask<file_sep>/src/main/java/pages/UsersPage.java package pages; import lombok.Getter; import lombok.extern.slf4j.Slf4j; import net.serenitybdd.core.annotations.findby.FindBy; import net.serenitybdd.core.pages.WebElementFacade; import org.openqa.selenium.By; import org.openqa.selenium.Keys; import pageComponents.FilterUsersModalWindow; import java.time.Duration; import static utils.SessionVariables.FILTER_USERS_WINDOW; @Getter @Slf4j public class UsersPage extends BasePage { @FindBy(xpath = "//a[@data-tooltip='Filter']") private WebElementFacade filterButton; @FindBy(xpath = "//div[@id='status_inputfileddiv']//input") private WebElementFacade userStatusField; @FindBy(xpath = "//div[@id='adminroles_inputfileddiv']//input") private WebElementFacade userAdminRoleField; public void clickOnFilterButton() { log.info("Clicking on the [Filter button]"); filterButton.withTimeoutOf(Duration.ofSeconds(15)).waitUntilVisible(); waitUntilSpinnerGone(3); filterButton.withTimeoutOf(Duration.ofSeconds(15)).waitUntilVisible().waitUntilEnabled().waitUntilClickable().click(); } } <file_sep>/src/test/java/stepDefs/WorkShiftsStepDefs.java package stepDefs; import grids.UsersGrid; import grids.WorkShiftGrid; import net.thucydides.core.annotations.Steps; import org.jbehave.core.annotations.Then; import org.jbehave.core.annotations.When; import org.jbehave.core.model.ExamplesTable; import steps.DefaultStepsData; import steps.WorkShiftsSteps; import java.util.List; import java.util.Map; public class WorkShiftsStepDefs extends DefaultStepsData { @Steps private WorkShiftsSteps workShiftsSteps; @When("I click on Add Work Shift button") public void clickOnAddWorkShiftButton() { workShiftsSteps.clickOnAddWorkShiftButton(); } @Then("I check that rows with values $firstValue, $secondValue in WorkShift column are shown by default") public void checkValuesInDefaultWorkShift(String firstValue, String secondValue) { List<WorkShiftGrid> allItems = workShiftsSteps.getWorkShiftGrid(); softly.assertThat(allItems.get(0).getWorkShift()).as("Wrong [First Value] is shown").isEqualTo(firstValue); softly.assertThat(allItems.get(1).getWorkShift()).as("Wrong [Second Value] is shown").isEqualTo(secondValue); } @Then ("I click on Save button in Add Work Shift window") public void clickOnSaveAddWorkShiftButton() { workShiftPage.clickOnSaveAddWorkShiftButton(); } @Then ("I check that $errorMessage error message is shown under Work Shift field") public void errorMessageIsShownUnderWorkShiftField(String errorMessage) { softly.assertThat(workShiftPage.getDefaultErrorMessageText()).as("Text in error message field is different").contains(errorMessage); } // @Then ("Using time picker I set 10:50 value into From filed") // // @Then ("Using time picker I set 18:20 value into To filed") // // @Then ("I check that 7.50 value calculated in Hours Per Day field") // // @Then ("Using time picker I set 8:05 value into From filed") // // @Then ("Using time picker I set 20:25 value into To filed") // // @Then ("I check that 12.33 value calculated in Hours Per Day field") } <file_sep>/src/test/java/stepDefs/DashboardPageStepDef.java package stepDefs; import net.thucydides.core.annotations.Steps; import org.jbehave.core.annotations.Alias; import org.jbehave.core.annotations.Then; import org.jbehave.core.annotations.When; import steps.CommonSteps; import steps.DashboardPageSteps; import steps.DefaultStepsData; public class DashboardPageStepDef extends DefaultStepsData { @Steps private DashboardPageSteps dashboardPageSteps; @Steps private CommonSteps commonSteps; @Then("dashboard page opens with account name $userName") public void checkThatDashboardPageOpens(String userName) { softly.assertThat(dashboardPageSteps.getDashBoardPageTitle()) .as("Wrong page title") .isEqualTo(dashboardPage.getTitle()); softly.assertThat(dashboardPageSteps.getAccountNameFromDashboard()) .as("Wrong account name is shown on page") .isEqualTo(userName); } //https://jbehave.org/reference/latest/aliases.html @When("I click on hide menu button") @Alias("I click on show menu button") public void whenClickOnTheHideMenuButton() { dashboardPageSteps.clickOnHideMenuButton(); } @Then("main menu $condition") public void mainMenuCondition(String condition) { String warningMessage = "Menu not " + condition + " after clicking on the hide/show menu button"; if (condition.equals("disappear")) { softly.assertThat(commonSteps.isMenuAvatarVisibleNow()).as(warningMessage).isFalse(); } if (condition.equals("appear")) { softly.assertThat(commonSteps.isMenuAvatarVisibleNow()).as(warningMessage).isTrue(); } } @When("I click on the three dots button inside $sectionName section") public void clickiOnThreeDotsButton(String sectionName) { dashboardPageSteps.expandContainerClickingOnThreeDots(sectionName); } @Then("Legend component appears in $sectionName section") public void checkThatLegendAppears(String sectionName) { softly.assertThat(dashboardPageSteps.checkThatLegendAppearsIn(sectionName)).as("Legend component not appers").isTrue(); } @Then ("I check that News section is present on Dashboard page with header $News") public void checkNewsSectionIsPresentWithHeaderNews(String headerName) { if (dashboardPage.checkNewsSectionIsPresent()) { softly.assertThat(dashboardPage.getNewsSectionHeaderName()).as("News section is present on Dashboard page with header News").isEqualTo(headerName); } else{ System.out.println("News section is not present on Dashboard page"); } } @Then ("I check that news counter (Showing: number / number) under News section is same as real amount of news in list") public void checkThatNewsCounterEqualsToRealAmountOfNews(){ softly.assertThat(dashboardPage.newsCounter()).isEqualTo(dashboardPage.getRealAmountOfNews()); } @Then ("I check that Documents section is present on Dashboard page with header $Documents") public void checkDocumentsSectionIsPresentWithHeaderDocuments(String headerName) { if (dashboardPage.checkDocumentsSectionIsPresent()) { softly.assertThat(dashboardPage.getDocumentsSectionHeaderName()).as("Documents section is present on Dashboard page with header Documents").isEqualTo(headerName); } else{ System.out.println("Documents section is not present on Dashboard page"); } } @Then ("I check that news counter (Showing: number / number) under Documents section is same as real amount of news in list") public void checkThatNewsCounterEqualsToRealAmountOfDocuments(){ softly.assertThat(dashboardPage.documentsCounter()).isEqualTo(dashboardPage.getRealAmountOfDocuments()); } }
0ae0da3e10b1d52425af43547c3b97be8ccb4399
[ "Java" ]
3
Java
LutskovaKI/RDLabsStudentTask
4dddcf15d044930ea70dd1888df7b158baea5d9c
444a2ed3d503fbf771ac864d018d8fdbda6cec36
refs/heads/master
<repo_name>larshvile/pyupnp<file_sep>/pyupnp/ssdp/transport.py # TODO docme """ blah blah """ from socket import * # TODO fixo import platform import struct import time from pyupnp.ssdp.protocol import * SSDP_MULTICAST_TTL = 2 def create_ssdp_broadcast_server_socket(): """Returns a socket configured to receive broadcasted SSDP messages.""" s = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP) return configure_ssdp_broadcast_server_socket(s) def configure_ssdp_broadcast_server_socket(socket): """Configures an existing socket for receiving broadcasted SSDP messages.""" socket.setsockopt(SOL_SOCKET, SO_REUSEADDR, 1) socket.bind(('', SSDP_MULTICAST_ADDR[1])) socket.setsockopt(IPPROTO_IP, IP_ADD_MEMBERSHIP, struct.pack("=4sl", inet_aton(SSDP_MULTICAST_ADDR[0]), INADDR_ANY)) return socket def create_ssdp_broadcast_client_socket(): """Returns a socket configured to broadcast SSDP messages.""" s = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP) s.setsockopt(IPPROTO_IP, IP_MULTICAST_TTL, SSDP_MULTICAST_TTL) return s if __name__ == '__main__': search = True if not search: s = create_ssdp_broadcast_server_socket() else: req = SearchRequest() req.mx = 10 print('Sending %s to %s' % (req, req.host)) print() time.sleep(2) s = create_ssdp_broadcast_client_socket() s.sendto(req.encode().encode('utf-8'), req.host) # Await replies while True: data, (addr, port) = s.recvfrom(4096) print("Msg from", addr, port) print(parse_ssdp_message(data.decode('utf-8'))) print() print() <file_sep>/README.md pyupnp ====== A simple UPnP library for python 3.1+. Nose must be installed to run the tests. TODO ==== - SSDP - transport - ControlPoint / devices <file_sep>/pyupnp/ssdp/protocol.py from time import gmtime, strftime from pprint import pformat import platform SSDP_MULTICAST_ADDR = ('172.16.17.32', 1900) # TODO harcoded version string.. SSDP_USER_AGENT = '%s/%s UPnP/1.1 pyupnp/0.1' % (platform.system(), platform.release()) SSDP_SERVER = SSDP_USER_AGENT def parse_ssdp_message(msg_string): """Parse an SSDP message provided as text.""" startline, *header_lines = filter(None, msg_string.splitlines()) msgtype = MESSAGE_TYPES.get(startline) if msgtype is None: raise ParsingError('Invalid SSDP start-line "%s"' % startline) headers = [(k.upper(), v.strip()) for (k, s, v) in [l.partition(':') for l in header_lines]] return msgtype.from_headers(dict(headers)) class SSDPMessage(object): """Base class for SSDP messages.""" @classmethod def from_headers(cls, headers): """Create a new message based on headers provided in a dict.""" msg = cls() msg._headers = {} for (k, v) in headers.items(): parser = '_parse_' + _propname(k) if hasattr(msg, parser): try: getattr(msg, parser)(v) except Exception as e: raise ParsingError('Unable to parse %s=%s - %s' % (k, v, e)) else: msg.set_headers(**{k: v}) return msg def __init__(self): # set the defaults the same way as during parsing?? self._headers = dict(self._defaults()) def __repr__(self): return (self.__class__.__name__ + ' ' + pformat(_drop_empty_values(self._headers))) def set_headers(self, **headers): """Stores key/value pairs as headers.""" for k, v in headers.items(): self._headers[k.upper()] = v def get_header(self, k): """Returns the value of a header, or None""" return self._headers.get(k.upper()) def encode(self): """Encodes the message as a string ready for transport""" hdrs = ['%s: %s' % (k, v) for k, v in _items_sorted_by_key(self._headers)] return "%s\r\n%s\r\n" % (self.__class__.START_LINE, '\r\n'.join(hdrs)) class SearchRequest(SSDPMessage): """An SSDP search request, issued to locate devices and services.""" START_LINE = 'M-SEARCH * HTTP/1.1' def __init__(self): super(SearchRequest, self).__init__() @property def host(self): """The destination (addr, port) of the request.""" val = self.get_header('host') if val == None: return None addr, port = val.split(':') return (addr, int(port)) @host.setter def host(self, value): addr, port = value self.set_headers(host = addr + ':' + str(port)) def _parse_host(self, value): self.host = value.split(':') @property def mx(self): """The number of seconds that the control point will wait for replies.""" val = self.get_header('mx') return None if val == None else int(val) @mx.setter def mx(self, value): if int(value) <= 0: raise IllegalValueError('MX (%s) must be > 0' % value) self.set_headers(mx = str(value)) def _parse_mx(self, value): self.mx = value def _defaults(self): return { 'HOST': SSDP_MULTICAST_ADDR[0] + ':' + str(SSDP_MULTICAST_ADDR[1]), 'MAN': '"ssdp:discover"', 'MX': '1', 'ST': 'ssdp:all', 'USER-AGENT': SSDP_USER_AGENT } class SearchResponse(SSDPMessage): """The response to an SSDP search request.""" START_LINE = 'HTTP/1.1 200 OK' def __init__(self): super(SearchResponse, self).__init__() # LOCATION: URL for UPnP description for root device # TODO required, set by client # ST: search target # TODO required, based on request # USN: composite identifier for the advertisement # TODO required, set by client # BOOTID.UPNP.ORG: number increased each time device sends an initial announce or an update message # TODO required set by client # SEARCHPORT.UPNP.ORG: number identifies port on which device responds to unicast M-SEARCH # TODO set by client in case of non-standard listen port (always?) def _defaults(self): return { 'CACHE-CONTROL': 'max-age=60', # TODO should match the frequency of adverts 'EXT': '', 'DATE': strftime("%a, %d %b %Y %H:%M:%S GMT", gmtime()), 'SERVER': SSDP_SERVER } class Advertisement(SSDPMessage): """An SSDP device/service advertisement message.""" START_LINE = 'NOTIFY * HTTP/1.1' def __init__(self): super(Advertisement, self).__init__() def _defaults(self): return {} # TODO # TODO .. most of these are shared with SearchResponse # NOTIFY * HTTP/1.1 # HOST: 172.16.17.32:1900 # TODO reuse the stuff from SearchRequest # CACHE-CONTROL: max-age = seconds until advertisement expires # LOCATION: URL for UPnP description for root device # NT: notification type # NTS: ssdp:alive # SERVER: OS/version UPnP/1.1 product/version # USN: composite identifier for the advertisement # BOOTID.UPNP.ORG: number increased each time device sends an initial announce or an update message # CONFIGID.UPNP.ORG: number used for caching description information # SEARCHPORT.UPNP.ORG: number identifies port on which device responds to unicast M-SEARCH MESSAGE_TYPES = { SearchRequest.START_LINE: SearchRequest, SearchResponse.START_LINE: SearchResponse, Advertisement.START_LINE: Advertisement } class ParsingError(Exception): """An SSDP message could not be parsed.""" pass class IllegalValueError(Exception): """Protocol-disobedience thwarted.""" pass def _propname(header): return header.lower().replace('-', '_') def _drop_empty_values(dict_): return dict((k, v) for k, v in dict_.items() if v.strip()) def _items_sorted_by_key(dict_): return sorted(((k, v) for k, v in dict_.items())) <file_sep>/pyupnp/control_point.py import socketserver import time # TODO rm? import threading from pyupnp.ssdp.protocol import * from pyupnp.ssdp.transport import * # TODO this isn't exactly a control point.. A control point is the client of this class.. This is more like # the SSDP neighborhood, a record of the discovered devices/services... ? class ControlPoint(object): """An UPnP control point, locating available devices and services.""" def __init__(self): self._server = ControlPoint._SsdpBroadcastServer(self._on_message) self.search() def stop(self): # TODO docme self._server.shutdown() def search(self, target = 'ssdp:all', mx = 5): req = SearchRequest() req.set_headers(st = target) # TODO crap req.mx = mx search = threading.Thread(args=(req, self._on_message), target=_ssdp_search) search.daemon = True search.start() def _on_message(self, client, msg): # TODO remember synchronization when updating cached information print('Received message from', client) print(msg) print() print() # TODO return replies here as well? # TODO two separate ports, on for multicast adverts, one for uncast replies to M-SEARCH # TODO open/close new sockets on-demand instead of keeping one search-port open? # TODO send a search-request once started, and every 30sec? # TODO keep a list of devices/services, make it possible to query # TODO notify clients of updates (addition/removal of services?) # TODO search for specific devices/services ..? class _SsdpBroadcastServer(socketserver.UDPServer, socketserver.ThreadingMixIn): def __init__(self, callback): super(socketserver.UDPServer, self).__init__(SSDP_MULTICAST_ADDR, ControlPoint._RequestHandler) self.callback = callback self.server_thread = threading.Thread(target=self.serve_forever) self.server_thread.daemon = True self.server_thread.start() def server_bind(self): configure_ssdp_broadcast_server_socket(self.socket) class _RequestHandler(socketserver.BaseRequestHandler): # TODO generic request-handler, or broadcast-specific? def handle(self): # TODO log any failure to parse the message, override server.handle_error for this? msg = parse_ssdp_message(self.request[0].decode('utf-8')) self.server.callback(self.client_address, msg) def _ssdp_search(req, callback): # TODO naming, at least =) s = create_ssdp_broadcast_client_socket() try: s.sendto(req.encode().encode('utf-8'), req.host) s.settimeout(1) while True: # TODO more like: time < mx * 2 data, client = s.recvfrom(8192) callback(client, parse_ssdp_message(data.decode('utf-8'))) # TODO error-logging? finally: s.close() if __name__ == '__main__': cp = ControlPoint() print('Waiting for messages...') for x in range(5): print('.'); time.sleep(1) <file_sep>/pyupnp/ssdp/test/test_protocol.py from nose.tools import * from pyupnp.ssdp.protocol import * MSEARCH = 'M-SEARCH * HTTP/1.1' _200OK = 'HTTP/1.1 200 OK' NOTIFY = 'NOTIFY * HTTP/1.1' class TestProtocol: def test_MSEARCH_message_yields_search_request(self): msg = parse_ssdp_message(msg_string(MSEARCH)) assert type(msg) == SearchRequest def test_200OK_message_yields_search_reponse(self): msg = parse_ssdp_message(msg_string(_200OK)) assert type(msg) == SearchResponse def test_NOTIFY_message_yields_advertisement(self): msg = parse_ssdp_message(msg_string(NOTIFY)) assert type(msg) == Advertisement @raises(ParsingError) def test_other_messages_cannot_be_read(self): parse_ssdp_message(msg_string('something else')) def test_headers_are_persisted_in_parsed_message(self): msg = parse_ssdp_message(msg_string(K1 = 'a', K2 = 'b')) assert msg.get_header('k1') == 'a' assert msg.get_header('k2') == 'b' def test_header_access_is_case_insensitive(self): msg = parse_ssdp_message(msg_string(key = 'v')) msg.set_headers(OTHER = 'w') assert msg.get_header('KEY') == 'v' assert msg.get_header('OTher') == 'w' def test_header_keys_are_stored_in_upper_case(self): msg = parse_ssdp_message(msg_string(key = 'v')) msg.set_headers(other = 'w') assert 'KEY' in msg._headers assert 'OTHER' in msg._headers def test_header_values_are_stripped_for_whitespace(self): msg = parse_ssdp_message(msg_string(key = ' v ')) assert msg.get_header('key') == 'v' def test_parsed_message_does_not_contain_empty_header(self): msg = parse_ssdp_message(msg_string()) assert '' not in msg._headers def test_headers_in_encoded_message_are_sorted_alphabetically(self): msg = some_message() msg.set_headers(x = 'some', y = 'other') assert 'X: some\r\nY: other' in msg.encode() def test_encoded_message_is_identical_to_the_original(self): orig = 'M-SEARCH * HTTP/1.1\r\n'\ 'HOST: host:port\r\n'\ 'MAN: "ssdp:discover"\r\n'\ 'MX: 1\r\n'\ 'ST: ssdp:all\r\n'\ 'USER-AGENT: agentX\r\n' assert parse_ssdp_message(orig).encode() == orig def test_empty_headers_are_excluded_from_repr_output(self): msg = parse_ssdp_message(msg_string(h1 = '1', h2 = '')) assert 'H1' in repr(msg) assert 'H2' not in repr(msg) def test_fresh_message_is_initialized_with_default_values(self): msg = SearchRequest() assert msg.mx != None def test_default_values_are_not_present_in_parsed_messages(self): msg = SearchRequest.from_headers({'a': 'b'}) assert msg.mx == None assert msg.get_header('a') == 'b' @raises(ParsingError) def test_exceptions_during_parsing_results_in_parsing_error(self): parse_ssdp_message(msg_string(mx = 'abc')) def test_mx_property_in_search_request_behaves_properly(self): msg = parse_ssdp_message(msg_string(startline = MSEARCH, mx = '1')) assert msg.mx == 1 msg.set_headers(mx = '2') assert msg.mx == 2 msg.mx = 3 assert msg.mx == 3 assert msg.get_header('mx') == '3' msg._headers = {} assert msg.mx == None @raises(IllegalValueError) def test_mx_must_be_positive(self): SearchRequest().mx = -1 def test_host_in_search_request_defaults_to_ssdp_multicast_addr(self): assert ('192.168.3.11', 1900) == SearchRequest().host def test_host_property_in_search_request_behaves_properly(self): msg = parse_ssdp_message(msg_string(startline = MSEARCH, host = 'addr:123')) assert msg.host == ('addr', 123) msg.set_headers(host = 'a:1') assert msg.host == ('a', 1) msg.host = ('b', 2) assert msg.host == ('b', 2) assert msg.get_header('host') == 'b:2' msg._headers = {} assert msg.host == None def msg_string(startline = MSEARCH, **headers): hdrs = ['%s: %s' % (k, v) for k, v in headers.items()] return "%s\r\n%s\r\n" % (startline, '\r\n'.join(hdrs)) def some_message(): return SearchRequest() <file_sep>/setup.py #!/usr/bin/env python from setuptools import setup setup( name='pyupnp', version='0.1', description='A simple UPnP library', author='<NAME>', author_email='<EMAIL>', url='https://github.com/larshvile/pyupnp', packages=['pyupnp'], test_suite='nose.collector', tests_require=['nose>=1.2'] )
57790f79b8313b61586a7feebd4d51b4d3071568
[ "Markdown", "Python" ]
6
Python
larshvile/pyupnp
cbc4a23d93fcb5e19f5b6ef94bbe2483366f08f2
af8fcee074b2193c0c66880ef54a33ed2317b6b1
refs/heads/main
<file_sep>from turtle import left,right,up,down,setposition,circle,color,width,speed,forward,exitonclick from math import sqrt def wrong_input(): print("Špatný vstup") vertikalni = int(input("Zadejte vertikalni počet polí: ")) while vertikalni < 1: wrong_input() vertikalni = int(input("Zadejte vertikalni počet polí: ")) horizontalni = int(input("Zadejte horizontální počet polí: ")) while horizontalni < 1: wrong_input() horizontalni = int(input("Zadejte horizontální počet polí: ")) strana = 20 p_pol = horizontalni*vertikalni #počet polí speed(0) d = round(2*(sqrt(strana**2-(strana/2)**2)),2) #výpočet dálky pátého vrcholu šestiúhelníku od prvního #vykreslení sítě for i in range(vertikalni): up() setposition(0,d*i) down() for _ in range(horizontalni): for _ in range(7): forward(strana) left(60) forward(strana) right(60) #hra width(2) for v in range(p_pol): #opakuje dokud není počet zahrání stejný jako počet polí if v % 2 == 0: #pro prvního hráče x = int(input(f"První hráči, zadejte souřadnici x od 1 do {horizontalni}: ")) while x > horizontalni or x < 1: #zabraňuje vstupu mimo pole wrong_input() x = int(input(f"První hráči, zadejte souřadnici x od 1 do {horizontalni}: ")) x = x - 1 #převod na souřadnice, které používá turtle y = int(input(f"První hráči, zadejte souřadnici y od 1 do {vertikalni}: ")) while y > vertikalni or y < 1: #zabraňuje vstupu mimo pole wrong_input() y = int(input(f"První hráči, zadejte souřadnici y od 1 do {vertikalni}: ")) y = y - 1 #převod na souřadnice, které používá turtle #vykresleni krizku color("blue") sourad_y = y + (x*0.5) up() setposition(strana*x*1.5,d*sourad_y) down() left(60) forward(2*strana) up() setposition(strana*x*1.5,d*(sourad_y+1)) down() right(120) forward(2*strana) left(60) else: #pro druhého hráče x = int(input(f"Druhý hráči, zadejte souřadnici x od 1 do {horizontalni}: ")) while x > horizontalni or x < 1: wrong_input() x = int(input(f"Druhý hráči, zadejte souřadnici x od 1 do {horizontalni}: ")) x = x - 1 y = int(input(f"Druhý hráči, zadejte souřadnici y od 1 do {vertikalni}: ")) while y > vertikalni or y < 1: wrong_input() y = int(input(f"Druhý hráči, zadejte souřadnici y od 1 do {vertikalni}: ")) y = y - 1 #vykreslení kolečka color("red") sourad_y = y + (x*0.5) up() setposition(strana*x*1.5+(strana*0.5),d*sourad_y+(d*0.2)) down() circle(d*0.3) print("Hra skončila") exitonclick()
b284a26224cca866e65906719955198ddb7b3c5b
[ "Python" ]
1
Python
Omactek/du1_frantisek_macek
6bf47364187594684718866fadccc29ba44d5f62
128351393a9eef979b0863d3e3394f344c20bfa3
refs/heads/master
<file_sep>var counter = 0; var donations = '' window.onload=function(){ document.addEventListener('resize',resize); document.addEventListener("iraRenderingComplete",function(event){ if (!iraApp) return false; if (event.iraEventSource != "update") return false; var scope = iraApp.getScope(event.iraScopeUuid); if (!scope || !scope["root"]) return false; if (scope.root.classList.contains("donation")) { document.getElementsByClassName('progress__amount-background')[0].style.width = '50%' donations = convertCollectionToArray(document.getElementsByClassName('donation')); document.getElementsByClassName('progress__amount-front')[0].style.clipPath = `inset(0 ${'50%'} 0 0)` setTimeout(function(){ filterComments(); requestAnimationFrame(animateDonations) },700) } // ok we have found a scope, set the new value }); } function filterComments(){ var donations = document.getElementsByClassName('donation'); var newDonations = []; for(var i = 0; i<donations.length; i++){ console.log(donations[i].children[0].children[0].innerText.length) if(donations[i].children[0].children[0].innerText.length != 0){ newDonations.push(donations[i]); } } console.log(newDonations) document.getElementById('donations').innerHTML = ''; for(var i = 0; i<newDonations.length;i++){ document.getElementById('donations').appendChild(newDonations[i]) } } function animateDonations(){ console.log('go') var donations = document.getElementsByClassName('donation'); if(document.getElementsByClassName('donation-in')[0]){ donations[counter].classList.add('donation-out'); console.log(donations); setTimeout(function(){ console.log(counter); donations[counter].classList.remove('donation-in'); donations[counter].classList.remove('donation-out'); if(counter<donations.length-1){ donations[counter+1].classList.add('donation-in'); }else{ donations[0].classList.add('donation-in'); counter=-1; } counter++; },700) }else{ console.log(donations) donations[0].classList.add('donation-in') } setTimeout(function(){ requestAnimationFrame(animateDonations) },3000) } function convertCollectionToArray(collection){ var arr = []; Array.prototype.forEach.call(collection,function(item){ arr.push(item) }); return arr.splice(1,arr.length) } function resize(e){ console.log('sdfsefwergwerfwe') } <file_sep>var counter = 0; window.onload = function(){ document.addEventListener("iraRenderingComplete",function(event){ if (!iraApp) return false; if (event.iraEventSource != "update") return false; var scope = iraApp.getScope(event.iraScopeUuid); if (!scope || !scope["root"]) return false; if (scope.root.classList.contains("donation")) { document.getElementById('amountGraphic').style.height = '20%'; console.log(document.getElementById('amountGraphic')) console.log(document.getElementsByClassName('donation')); setTimeout(function(){ requestAnimationFrame(animateDonations) },1000) } // ok we have found a scope, set the new value }); } function convertCollectionToArray(collection){ var arr = []; console.log(collection) try{ Array.prototype.forEach.call(collection,function(item){ console.log(item) arr.push(item); }); }catch(e){ console.log(e) } return arr.splice(1,arr.length) } function animateDonations(){ var donations = convertCollectionToArray(document.getElementsByClassName('donation')); console.log(donations) donations[0].classList.add('donation-out'); setTimeout(function(){ document.getElementById('donations').removeChild(donations[0]); donations[0].classList.remove('donation-out'); document.getElementById('donations').appendChild(donations[0]); requestAnimationFrame(animateDonations) },3000) console.log(donations) } function resize(e){ console.log('sdfsefwergwerfwe') } <file_sep>var counter = 0; var previousWindowWidth = 0; window.onload = function(){ window.addEventListener('resize',resize); previousWindowWidth = window.innerWidth; document.addEventListener("iraRenderingComplete",function(event){ if (!iraApp) return false; if (event.iraEventSource != "update") return false; var scope = iraApp.getScope(event.iraScopeUuid); if (!scope || !scope["root"]) return false; if (scope.root.classList.contains("donation")) { setTimeout(function(){ requestAnimationFrame(animateDonations) if(window.innerWidth >=800){ console.log('desktop'); initializeDonationDesktop(); } },1000) createDigletts(); } // ok we have found a scope, set the new value }); } function initializeDonationDesktop(){ var donations = convertCollectionToArray(document.getElementsByClassName('donation')); console.log(donations) for(var i = 0; i<5; i++){ donations[i].classList.add(`donation__${i+1}-big`); } } function animateDonationDesktop(){ var donations = convertCollectionToArray(document.getElementsByClassName('donation')); setTimeout(function(){ requestAnimationFrame(animateDonationDesktop) },20) } function fadeInDigletts(){ var digletts = document.getElementsByClassName('progress__diglett'); setTimeout(function(){ document.getElementsByClassName('amount')[0].classList.add('amount-in') document.getElementsByClassName('amount')[1].classList.add('amount-in') },500) for(var i = 0; i<digletts.length;i++){ setTimeout(function(digletts,i){ console.log(this) digletts[i].classList.add('progress__diglett-in') }.bind(null,digletts,i),i*50) } setTimeout(function(){ showProgress(); },digletts.length * 50) } function createDigletts(){ var diglett = document.createElement('div'); diglett.classList.add('progress__diglett'); document.getElementById('diglettContainer').innerHTML+='<div class="progress__spacer-left"></div>' for(var i = 0; i<20;i++){ document.getElementById('diglettContainer').innerHTML+=diglett.outerHTML } document.getElementById('diglettContainer').innerHTML+='<div class="progress__spacer-right"></div>' fadeInDigletts(); } function convertCollectionToArray(collection){ var arr = []; try{ Array.prototype.forEach.call(collection,function(item){ arr.push(item); }); }catch(e){ console.log(e) } return arr.splice(1,arr.length) } function animateDonations(){ var donations = convertCollectionToArray(document.getElementsByClassName('donation')); console.log('donations') donations[0].classList.add('donation-out'); setTimeout(function(){ document.getElementById('donations').removeChild(donations[0]); donations[0].classList.remove('donation-out'); document.getElementById('donations').appendChild(donations[0]); requestAnimationFrame(animateDonations) },3000) console.log(donations) } function roundDownToFive(number){ var rest = number%5; return number - rest } function showProgress(){ var percentage = 78; var roundedValue = roundDownToFive(percentage); var digletts = document.getElementsByClassName('progress__diglett'); for(var i = 0; i<roundedValue/5; i++){ setTimeout(function(digletts,i,endValue){ digletts[i].classList.add('progress__diglett-active'); console.log(endValue) console.log(i) if(i==endValue-1){ setTimeout(function(diglett){ diglett.classList.add('progress__diglett-active-medium') }.bind(null, digletts[i+1]),25); setTimeout(function(diglett){ diglett.classList.add('progress__diglett-active-small') }.bind(null, digletts[i+2]),50); console.log(digletts[i+1]); console.log(digletts[i+2]); } }.bind(null,digletts,i,roundedValue/5),i*50) } } function resize(e){ var donations = convertCollectionToArray(document.getElementsByClassName('donation')); for(var i = 0; i<donations.length;i++){ donations[i].classList.remove('donation-out') } if(previousWindowWidth>window.innerWidth){ //move left if(previousWindowWidth>=800&&window.innerWidth<800){ console.log('downscale') } }else{ //move right if(previousWindowWidth<=800&&window.innerWidth>800){ console.log('upscale') } } console.log(donations) previousWindowWidth = window.innerWidth }
a1dd74f6c57bf6c88b1f50900de7311129f3d18e
[ "JavaScript" ]
3
JavaScript
phanthachlinh/irplugins
325d3039183e4ec76b1d9329789f39046661f7fc
dff29b823c8f191b4efca1b35f2abe26d87d950e
refs/heads/master
<file_sep>use gtk::gdk::gdk_pixbuf::Colorspace; use gtk::gdk_pixbuf::Pixbuf; use gtk::glib::Bytes; use gtk::prelude::{BuilderExtManual, ImageExt, WidgetExt}; use gtk::{Builder, Image, Inhibit, Window}; use image::DynamicImage; use relm::{connect, Relm, Update, Widget}; use crate::gui::event::Msg; use crate::gui::state::State; use crate::gui::Widgets; use gtk::gdk::{EventKey, ModifierType}; pub struct App { state: State, gui: Widgets, } fn with_ctrl(e: &EventKey) -> bool { e.state().contains(ModifierType::CONTROL_MASK) } impl Update for App { type Model = State; type ModelParam = (DynamicImage, u32); type Msg = Msg; fn model(_: &Relm<Self>, param: (DynamicImage, u32)) -> State { State::new(param.0, param.1) } fn update(&mut self, event: Msg) { match event { Msg::InputEvent(e) => { if let Some(letter) = e.keyval().to_unicode() { if let Some(r) = match letter { 'w' => self.state.up(), 's' => self.state.down(), 'a' => self.state.left(), 'd' => self.state.right(), 'j' if with_ctrl(&e) => { println!("save jpg"); None } 'p' if with_ctrl(&e) => { println!("save png"); None } _ => None, } { let chip = self.state.chip(r); let b = Bytes::from_owned(chip.bytes); let pb = Pixbuf::from_bytes( &b, Colorspace::Rgb, true, 8, chip.w as i32, chip.h as i32, chip.w as i32 * 4, ); self.gui.image_widget.set_from_pixbuf(Some(&pb)); } } } Msg::Quit => gtk::main_quit(), } } } impl Widget for App { type Root = Window; fn init_view(&mut self) { let chip = self.state.chip(self.state.bounds); let b = Bytes::from_owned(chip.bytes); let pb = Pixbuf::from_bytes( &b, Colorspace::Rgb, true, 8, chip.w as i32, chip.h as i32, chip.w as i32 * 4, ); self.gui.image_widget.set_from_pixbuf(Some(&pb)); } fn root(&self) -> Self::Root { self.gui.main_window.clone() } fn view(relm: &Relm<Self>, state: Self::Model) -> Self { let glade_src = include_str!("../resources/chipper.glade"); let builder = Builder::from_string(glade_src); let main_window: Window = builder.object("main_window").unwrap(); connect!( relm, main_window, connect_delete_event(_, _), return (Some(Msg::Quit), Inhibit(false)) ); connect!( relm, main_window, connect_key_press_event(_, e), return (Some(Msg::InputEvent(e.clone())), Inhibit(false)) ); let image_widget: Image = builder.object("image_widget").unwrap(); main_window.show_all(); App { state, gui: Widgets { image_widget, main_window, }, } } } <file_sep>use gtk::gdk::EventKey; use relm_derive::Msg; #[derive(Msg)] pub enum Msg { InputEvent(EventKey), Quit, } <file_sep>use image::{DynamicImage, GenericImage, GenericImageView}; use crate::gui::{Grid, Rect}; use crate::Buffer; pub struct State { pub full_image: DynamicImage, pub chip_size: u32, pub bounds: Rect, pub grid: Grid, pos: (u32, u32), } impl State { pub fn new(full_image: DynamicImage, chip_size: u32) -> Self { let (w, h) = full_image.dimensions(); State { full_image, chip_size, bounds: Rect { w: chip_size, h: chip_size, ..Rect::default() }, grid: Grid { w: w / chip_size, h: h / chip_size, wr: w % chip_size - 1, hr: h % chip_size - 1, }, pos: (0, 0), } } pub fn chip(&mut self, r: Rect) -> Buffer { let bytes = self .full_image .sub_image(r.x, r.y, r.w, r.h) .to_image() .into_raw(); Buffer { w: r.w, h: r.h, bytes, } } pub fn up(&mut self) -> Option<Rect> { if self.pos.1 > 0 { self.pos = (self.pos.0, self.pos.1 - 1); self.bounds = Rect { y: self.pos.1 * self.chip_size, ..self.bounds }; Some(self.bounds) } else { None } } pub fn down(&mut self) -> Option<Rect> { if self.pos.1 + 1 < self.grid.h { self.pos = (self.pos.0, self.pos.1 + 1); self.bounds = Rect { y: self.pos.1 * self.chip_size, ..self.bounds }; Some(self.bounds) } else { None } } pub fn left(&mut self) -> Option<Rect> { if self.pos.0 > 0 { self.pos = (self.pos.0 - 1, self.pos.1); self.bounds = Rect { x: self.pos.0 * self.chip_size, ..self.bounds }; Some(self.bounds) } else { None } } pub fn right(&mut self) -> Option<Rect> { if self.pos.0 + 1 < self.grid.w { self.pos = (self.pos.0 + 1, self.pos.1); self.bounds = Rect { x: self.pos.0 * self.chip_size, ..self.bounds }; Some(self.bounds) } else { None } } } <file_sep>use clap::Clap; #[derive(Clap)] #[clap(name = "Chipper")] /// Image in, images out pub struct Opts { /// Input image pub path: String, /// Output chip size #[clap(short, long, default_value = "544")] pub size: u32, /// Output chip format #[clap(long, default_value = "jpg")] pub format: String, /// Max input image size (GB) #[clap(long, default_value = "1")] pub mem: u8, /// Output directory #[clap(short, long)] pub outdir: Option<String>, } #[derive(Clap)] #[clap(name = "Chipper GUI")] /// Image in, GUI out pub struct GuiOpts { /// Input image pub path: String, /// Max input image size (GB) #[clap(long, default_value = "1")] pub mem: u8, /// Chip size #[clap(short, long, default_value = "544")] pub size: u32, } <file_sep>use image::{DynamicImage, ImageBuffer}; use std::fmt::{Display, Formatter}; use std::fs::File; use std::io::BufReader; use std::path::Path; use std::str::FromStr; use tiff::decoder::DecodingResult; use tiff::TiffError; pub mod args; #[cfg(feature = "gui")] pub mod gui; pub type Coord = (u32, u32); pub struct BBox { pub x: u32, pub y: u32, pub w: u32, pub h: u32, } impl BBox { pub fn new(x: u32, y: u32, w: u32, h: u32) -> Self { BBox { x, y, w, h } } } #[derive(Copy, Clone)] pub enum ImageType { Jpeg, Png, } impl Display for ImageType { fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result { match self { ImageType::Jpeg => f.write_str("jpg"), ImageType::Png => f.write_str("png"), } } } impl FromStr for ImageType { type Err = String; fn from_str(s: &str) -> Result<Self, Self::Err> { match s.to_lowercase().as_str() { "jpg" | "jpeg" => Ok(ImageType::Jpeg), "png" => Ok(ImageType::Jpeg), f => Err(format!("{} is not a supported image type", f)), } } } pub struct Namer { base: String, name: String, } impl Namer { pub fn new(input_path: &str, output_dir: Option<String>) -> Self { let source_file = Path::new(input_path); let output_path = output_dir.unwrap_or("./".into()); let base_name: String = source_file.file_name().unwrap().to_str().unwrap().into(); let source_ext = source_file.extension().unwrap().to_str().unwrap(); let base_name = base_name.strip_suffix(&format!(".{}", source_ext)).unwrap(); Namer { base: output_path, name: base_name.into(), } } pub fn make(&self, key: &str, fmt: ImageType) -> String { format!("{}/{}-{}.{}", self.base, self.name, key, fmt) } } pub fn matrix(dim: (u32, u32), sz: u32) -> Vec<BBox> { let (w, h) = (dim.0 / sz, dim.1 / sz); let (rx, ry) = (dim.0 % sz, dim.1 % sz); let (xc, yc) = ((0..w), 0..h); let mut xc: Vec<(u32, u32)> = xc.map(|i| (i * sz, sz)).collect(); let mut yc: Vec<(u32, u32)> = yc.map(|i| (i * sz, sz)).collect(); if rx > 0 { xc.push((xc.len() as u32 * sz, rx)); } if ry > 0 { yc.push((yc.len() as u32 * sz, ry)); } xc.iter() .flat_map(|&ww| { yc.iter() .map(|&hh| BBox::new(ww.0, hh.0, ww.1, hh.1)) .collect::<Vec<BBox>>() }) .collect() } pub struct Buffer { pub w: u32, pub h: u32, pub bytes: Vec<u8>, } fn load_tif_buffer(path: &str, mem: u8) -> Result<Buffer, String> { let mut limits = tiff::decoder::Limits::default(); limits.decoding_buffer_size = giga_bytes(mem); let f = File::open(path).expect("failed to open file"); let r = BufReader::new(&f); let mut d = tiff::decoder::Decoder::new(r) .expect("bad decoder") .with_limits(limits); match d.read_image() { Ok(DecodingResult::U8(bytes)) => { let (w, h) = d.dimensions().unwrap(); Ok(Buffer { w, h, bytes }) } Err(TiffError::LimitsExceeded) => { Err(format!("Memory limit of {} gb exceeded, try --mem", mem)) } _ => Err("Decoded unsupported result".into()), } } pub fn load_tif_image(path: &str, mem: u8) -> Result<DynamicImage, String> { let buf = load_tif_buffer(path, mem).unwrap(); match ImageBuffer::from_raw(buf.w, buf.h, buf.bytes).map(DynamicImage::ImageRgba8) { Some(x) => Ok(x), None => Err("Failed to convert to dynamic image".into()), } } fn giga_bytes(n: u8) -> usize { n as usize * 1024 * 1024 * 1024 } #[cfg(test)] mod tests { use crate::{ImageType, Namer}; #[test] fn namer_relative() { let namer = Namer::new("foo.tiff", Some("rel".into())); let name = namer.make("bar", ImageType::Jpeg); assert_eq!("rel/foo-bar.jpg", name); } } <file_sep>chipper === <file_sep>use std::str::FromStr; use clap::Clap; use image::{GenericImage, GenericImageView}; use rayon::prelude::*; use libchip::args::Opts; use libchip::{load_tif_image, matrix, BBox, ImageType, Namer}; fn main() { let opts: Opts = Opts::parse(); let outfmt = ImageType::from_str(&opts.format).expect("Invalid image format"); let sz = opts.size; let t = std::time::SystemTime::now(); let source = load_tif_image(&opts.path, opts.mem).unwrap(); let (w, h) = source.dimensions(); println!("{} x {}", w, h); let v: Vec<BBox> = matrix((w, h), sz); let namer = Namer::new(&opts.path, opts.outdir); v.par_iter().for_each(|b| { let name = namer.make(&key(b.x, b.y), outfmt); match source .clone() .sub_image(b.x, b.y, b.w, b.h) .to_image() .save(name) { Ok(_) => print!("."), Err(_) => print!("x"), }; }); let d = t.elapsed().unwrap(); println!("{} chips in {} ms", v.len(), d.as_millis()); } fn key(x: u32, y: u32) -> String { format!("{}x{}", x, y) } <file_sep>[package] name = "chipper" version = "0.1.0" edition = "2018" [dependencies] image = "0.23" rayon = "1.5" clap = "3.0.0-beta.2" tiff = "0.7" [dependencies.gtk] version = "0.14.0" features = ["v3_22_29"] optional = true [dependencies.relm] version = "0.22" optional = true [dependencies.relm-derive] version = "0.22" optional = true [lib] name = "libchip" path = "src/lib.rs" [[bin]] name = "chipper" path = "src/bin/cli.rs" [[bin]] name = "chipper-gui" path = "src/bin/gui.rs" required-features = ["gui"] [features] gui = ["gtk", "relm", "relm-derive"] <file_sep>use clap::Clap; use relm::Widget; use libchip::args::GuiOpts; use libchip::gui::app::App; use libchip::load_tif_image; fn main() { let opts = GuiOpts::parse(); let full_image = load_tif_image(&opts.path, opts.mem).unwrap(); App::run((full_image, opts.size)).expect("App::run failed"); } <file_sep>use gtk::{Image, Window}; pub mod app; pub mod event; pub mod state; #[derive(Copy, Clone)] pub struct Rect { pub x: u32, pub y: u32, pub w: u32, pub h: u32, } impl Default for Rect { fn default() -> Self { Rect { x: 0, y: 0, w: 0, h: 0, } } } impl From<(u32, u32, u32, u32)> for Rect { fn from(v: (u32, u32, u32, u32)) -> Self { Rect { x: v.0, y: v.1, w: v.2, h: v.3, } } } pub struct Grid { pub w: u32, pub h: u32, pub wr: u32, pub hr: u32, } struct Widgets { image_widget: Image, main_window: Window, }
2eba98945dafc688e4ea14ee3861a5ef9b71c8d1
[ "Markdown", "Rust", "TOML" ]
10
Rust
jw3/chipper
f9aa6342459a2109772237e70c7f4102cb709e3d
98d4130e8aa47c16e829f7cf5c99994299066d09
refs/heads/master
<file_sep>var mongoose = require('mongoose'); var uniqueValidator = require('mongoose-unique-validator'); var CitySchema = new mongoose.Schema({ name: { type: String, lowercase: true, unique: true}, country: { type: String, lowercase: true} }, {timestamps: true, collection: 'city' }); CitySchema.plugin(uniqueValidator, { message: 'La ciudad ya existe'}); CitySchema.methods.toJSON = function(){ return { name: this.name, country: this.country }; }; mongoose.model('City', CitySchema); <file_sep>var mongoose = require('mongoose'); var uniqueValidator = require('mongoose-unique-validator'); var slug = require('slug'); var HotelSchema = new mongoose.Schema({ slug: {type: String, lowercase: true, unique: true}, name: {type: String, required: [true, 'name no puede ser nulo']}, stars: {type: Number, required: [true, 'stars no puede ser nulo']}, _city: {type: mongoose.Schema.Types.ObjectId, ref: 'City', required: [true, 'city no puede ser nulo']}, description: {type: String}, position: [{ latitude: {type: Number}, longitude: {type: Number} }], price: {type: Number, default: 0}, createdBy: { type: String }, // Validar objeto User.method.getUserDescriptionJSON() _comments: [{ type: mongoose.Schema.Types.ObjectId, ref: 'Comment' }] }, {timestamps: true, collection: 'hotels' }); HotelSchema.plugin(uniqueValidator, {message: 'el nombre ya fue usado'}); HotelSchema.methods.slugify = function() { this.slug = slug(this.name) + '-' + (Math.random() * Math.pow(2, 8) | 0).toString(2); }; HotelSchema.methods.toJSONFor = function() { return { _id : this._id, slug: this.slug, name: this.name, stars: this.stars, _city: this.city, description: this.description, position: this.position, price: this.price, createdAt: this.createdAt, updatedAt: this.updatedAt, createdBy: this.created, _comments: this.comments } } HotelSchema.methods.setPosition = function(position){ this.position = [0, 0]; } HotelSchema.pre('validate', function(next){ this.slugify(); next(); }); mongoose.model('Hotel', HotelSchema); <file_sep>var fs = require('fs'); var http = require('http'); var path = require('path'); // var methods = require('methods'); var express = require('express'); var bodyParser = require('body-parser'); var session = require('express-session'); var cors = require('cors'); var passport = require('passport'); var errorhandler = require('errorhandler'); var mongoose = require('mongoose'); var logger = require('morgan'); var favicon = require('serve-favicon'); var isProduction = process.env.NODE_ENV === 'production'; // Create global app object var app = express(); app.use(cors()); // view engine setup // app.set('views', path.join(__dirname, 'views')); // app.set('view engine', 'ejs'); app.use(logger('dev')); app.use(bodyParser.json()); app.use(bodyParser.urlencoded({ extended: false })); app.use(express.static(path.join(__dirname, 'public'))); app.use(session({ secret: 'almundo', cookie: { maxAge: 60000 }, resave: false, saveUninitialized: false })); if (!isProduction) { app.use(errorhandler()); } if(isProduction){ mongoose.connect(process.env.MONGODB_URI); } else { mongoose.connect('mongodb://localhost/almundo'); mongoose.set('debug', true); } // Esquemas de mongoDB require('./models/User'); require('./models/Hotels'); require('./models/Comments'); require('./models/City'); require('./models/Room'); require('./config/passport'); // Routing app.use(require('./routes')); // catch 404 and forward to error handler app.use(function(req, res, next) { var err = new Error('Not Found'); err.status = 404; next(err); }); // Error handler // Para desarrollo error handler imprime el stacktrace if(!isProduction){ app.use(function(err, req, res, next){ console.log(err.stack); res.status(err.status || 500); res.json({'errors': { message: err.message, error: err }}); }); } // Para produccion error handler no filtra el stacktrace al usuario app.use(function(err, req, res, next) { res.status(err.status || 500); res.json({'errors': { message: err.message, error: {} }}); }); var server = app.listen( process.env.PORT || 3000, function(){ console.log('Listening on port ' + server.address().port); }); <file_sep>var router = require('express').Router(); var passport = require('passport'); var auth = require('../auth'); var mongoose = require('mongoose'); var City = mongoose.model('City'); // Get cities router.get('/cities', auth.optional, function(req, res, next){ var query = {}; return Promise.all([ City.find(query) .sort({ name : 'desc' }) .exec(), City.count(query).exec() ]).then(function(results){ var cities = results[0]; var citiesCount = results[1]; return res.json({ cities : cities, citiesCount : citiesCount }); }).catch(next); }); // Add new city router.post('/city', auth.required, function(req, res, next){ var city = new City({ name : req.body.city.name, country : req.body.city.country }); city.save().then(function(){ return res.json({ city : city.toJSON() }); }).catch(next); }); module.exports = router; <file_sep>var mongoose = require('mongoose'); var Comment = mongoose.model('Comment'); var City = mongoose.model('City'); // router.param('comment', function(req, res, next, id) { // // var query = Comment.findById(id); // // query.exec(function(err, comment) { // if (err) { // return next(err); // } // if (!comment) { // return next(new Error('No se encuentra el comentario.')); // } // // req.comment = comment; // return next(); // }); // }); // router.post('/hoteles/:hotel/comments', function(req, res, next) { // var comment = new Comment(req.body); // comment.hotel = req.hotel; // // comment.save(function(err, comment) { // if (err) { // return next(err); // } // // req.hotel.comments.push(comment); // req.hotel.save(function(err, hotel) { // if (err) { // return next(err); // } // // res.json(comment); // }) // }) // }); // // router.put('/hoteles/:hotel/comments/:comment/upvote', function(req, res, next) { // if (!req.hotel) { // return next(new Error('No se encuentra el hotel.')); // } // // req.comment.upvote(function(err, comment) { // if (err) { // return next(err); // } // // res.json(comment); // }); // }) <file_sep># Ejercicio 1 Fullstack AlMundo ## Instalacion - Clonar repo - `npm install` - Instala las dependencias configuradas en package.json - `mongod` - Levantar una instancia de MongoDB con puerto 27017 ('mongodb://localhost/almundo:27017') - `npm run dev` - Ejecuta el backend con nodemon en http://localhost:3000 (en caso de no estas bloqueado ese puerto) - Cargar algunos datos por terminal :) `curl --data 'name=Hotel Emperador&stars=3&price=1596' http://localhost:3000/hoteles` `curl --data 'name=Petit Palace San Bernardo&stars=4&price=2145' http://localhost:3000/hoteles` `curl --data 'name=Hotel Nuevo Boston&stars=2&price=861' http://localhost:3000/hoteles`
074c1e63e3bdb1180648ed8ac8a9858e9140faa2
[ "JavaScript", "Markdown" ]
6
JavaScript
nicopini/API-RESTful
2615fa7f6035dfaa9e8d35dabbc0874fe7231790
892f553ffa9a26138555d4ad9dd5a61122ebc362
refs/heads/master
<file_sep>require 'rake' require 'rake/tasklib' class Jeweler class Tasks < ::Rake::TaskLib attr_accessor :gemspec, :jeweler def initialize(gemspec = nil, &block) @gemspec = gemspec || Gem::Specification.new @jeweler = Jeweler.new(@gemspec) yield @gemspec if block_given? define end private def define desc "Setup initial version of 0.0.0" file "VERSION.yml" do @jeweler.write_version 0, 0, 0, :commit => false $stdout.puts "Created VERSION.yml: 0.0.0" end desc "Build gem" task :build do @jeweler.build_gem end desc "Install gem using sudo" task :install => :build do @jeweler.install_gem end desc "Generate and validates gemspec" task :gemspec => ['gemspec:generate', 'gemspec:validate'] namespace :gemspec do desc "Validates the gemspec" task :validate => 'VERSION.yml' do @jeweler.validate_gemspec end desc "Generates the gemspec, using version from VERSION.yml" task :generate => 'VERSION.yml' do @jeweler.write_gemspec end end desc "Displays the current version" task :version => 'VERSION.yml' do $stdout.puts "Current version: #{@jeweler.version}" end namespace :version do desc "Writes out an explicit version. Respects the following environment variables, or defaults to 0: MAJOR, MINOR, PATCH" task :write do major, minor, patch = ENV['MAJOR'].to_i, ENV['MINOR'].to_i, ENV['PATCH'].to_i @jeweler.write_version(major, minor, patch, :announce => false, :commit => false) $stdout.puts "Updated version: #{@jeweler.version}" end namespace :bump do desc "Bump the gemspec by a major version." task :major => ['VERSION.yml', :version] do @jeweler.bump_major_version $stdout.puts "Updated version: #{@jeweler.version}" end desc "Bump the gemspec by a minor version." task :minor => ['VERSION.yml', :version] do @jeweler.bump_minor_version $stdout.puts "Updated version: #{@jeweler.version}" end desc "Bump the gemspec by a patch version." task :patch => ['VERSION.yml', :version] do @jeweler.bump_patch_version $stdout.puts "Updated version: #{@jeweler.version}" end end end desc "Release the current version. Includes updating the gemspec, pushing, and tagging the release" task :release do @jeweler.release end namespace :rubyforge do namespace :release do desc "Release the current gem version to RubyForge." task :gem => [:gemspec, :build] do begin @jeweler.release_gem_to_rubyforge rescue NoRubyForgeProjectInGemspecError => e abort "Setting up RubyForge requires that you specify a 'rubyforge_project' in your Jeweler::Tasks declaration" rescue MissingRubyForgePackageError => e abort "Rubyforge reported that the #{e.message} package isn't setup. Run rake rubyforge:setup to do so." rescue RubyForgeProjectNotConfiguredError => e abort "RubyForge reported that #{e.message} wasn't configured. This means you need to run 'rubyforge setup', 'rubyforge login', and 'rubyforge configure', or maybe the project doesn't exist on RubyForge" end end end desc "Setup a rubyforge project for this gem" task :setup do begin @jeweler.setup_rubyforge rescue NoRubyForgeProjectInGemspecError => e abort "Setting up RubyForge requires that you specify a 'rubyforge_project' in your Jeweler::Tasks declaration" rescue RubyForgeProjectNotConfiguredError => e abort "The RubyForge reported that #{e.message} wasn't configured. This means you need to run 'rubyforge setup', 'rubyforge login', and 'rubyforge configure', or maybe the project doesn't exist on RubyForge" end end end end end end <file_sep>require 'test_helper' class TestGenerator < Test::Unit::TestCase def build_generator(testing_framework = nil, options = {}) stub.instance_of(Git::Lib).parse_config '~/.gitconfig' do {'user.name' => '<NAME>', 'user.email' => '<EMAIL>', 'github.user' => 'johndoe', 'github.token' => 'yyz'} end options[:testing_framework] = testing_framework Jeweler::Generator.new('the-perfect-gem', options) end context "initialize" do should "raise error if nil repo name given" do assert_raise Jeweler::NoGitHubRepoNameGiven do Jeweler::Generator.new(nil) end end should "raise error if blank repo name given" do assert_raise Jeweler::NoGitHubRepoNameGiven do Jeweler::Generator.new("") end end should "have shoulda as default framework" do assert_equal :shoulda, build_generator.testing_framework end should "have repository name as default target dir" do assert_equal 'the-perfect-gem', build_generator.target_dir end should "have TODO as default summary" do assert_equal "TODO", build_generator.summary end should "not create repo by default" do assert ! build_generator.should_create_repo end should "not use cucumber by default" do assert ! build_generator.should_use_cucumber end should "raise error for invalid testing frameworks" do assert_raise ArgumentError do build_generator(:zomg_invalid) end end end should "have the correct git remote" do assert_equal 'git@github.com:johndoe/the-perfect-gem.git', build_generator.git_remote end should "have the correct project homepage" do assert_equal 'http://github.com/johndoe/the-perfect-gem', build_generator.project_homepage end should "have the correct constant name" do assert_equal "ThePerfectGem", build_generator.constant_name end should "have the correct file name prefix" do assert_equal "the_perfect_gem", build_generator.file_name_prefix end def self.should_have_generator_attribute(attribute, value) should "have #{value} for #{attribute}" do assert_equal value, build_generator(@framework).send(attribute) end end context "shoulda" do setup { @framework = :shoulda } should_have_generator_attribute :test_or_spec, 'test' should_have_generator_attribute :test_task, 'test' should_have_generator_attribute :test_dir, 'test' should_have_generator_attribute :default_task, 'test' should_have_generator_attribute :feature_support_require, 'test/unit/assertions' should_have_generator_attribute :feature_support_extend, 'Test::Unit::Assertions' should_have_generator_attribute :test_pattern, 'test/**/*_test.rb' end context "testunit" do setup { @framework = :testunit } should_have_generator_attribute :test_or_spec, 'test' should_have_generator_attribute :test_task, 'test' should_have_generator_attribute :test_dir, 'test' should_have_generator_attribute :default_task, 'test' should_have_generator_attribute :feature_support_require, 'test/unit/assertions' should_have_generator_attribute :feature_support_extend, 'Test::Unit::Assertions' should_have_generator_attribute :test_pattern, 'test/**/*_test.rb' end context "minitest" do setup { @framework = :minitest } should_have_generator_attribute :test_or_spec, 'test' should_have_generator_attribute :test_task, 'test' should_have_generator_attribute :test_dir, 'test' should_have_generator_attribute :default_task, 'test' should_have_generator_attribute :feature_support_require, 'mini/test' should_have_generator_attribute :feature_support_extend, 'Mini::Test::Assertions' should_have_generator_attribute :test_pattern, 'test/**/*_test.rb' end context "bacon" do setup { @framework = :bacon } should_have_generator_attribute :test_or_spec, 'spec' should_have_generator_attribute :test_task, 'spec' should_have_generator_attribute :test_dir, 'spec' should_have_generator_attribute :default_task, 'spec' should_have_generator_attribute :feature_support_require, 'test/unit/assertions' should_have_generator_attribute :feature_support_extend, 'Test::Unit::Assertions' should_have_generator_attribute :test_pattern, 'spec/**/*_spec.rb' end context "rspec" do setup { @framework = :rspec } should_have_generator_attribute :test_or_spec, 'spec' should_have_generator_attribute :test_task, 'spec' should_have_generator_attribute :test_dir, 'spec' should_have_generator_attribute :default_task, 'spec' should_have_generator_attribute :feature_support_require, 'spec/expectations' should_have_generator_attribute :feature_support_extend, nil should_have_generator_attribute :test_pattern, 'spec/**/*_spec.rb' end context "micronaut" do setup { @framework = :micronaut } should_have_generator_attribute :test_or_spec, 'example' should_have_generator_attribute :test_task, 'examples' should_have_generator_attribute :test_dir, 'examples' should_have_generator_attribute :default_task, 'examples' should_have_generator_attribute :feature_support_require, 'micronaut/expectations' should_have_generator_attribute :feature_support_extend, 'Micronaut::Matchers' should_have_generator_attribute :test_pattern, 'examples/**/*_example.rb' end end <file_sep># Jeweler: Craft the perfect RubyGem Jeweler provides two things: * Rake tasks for managing gems and versioning of a <a href="http://github.com">GitHub</a> project * A generator for creating kickstarting a new project ## Installing # Install the gem: sudo gem install jeweler ## Using in an existing project It's easy to get up and running. Update your Rakefile to instantiate a `Jeweler::Tasks`, and give it a block with details about your project. begin require 'jeweler' Jeweler::Tasks.new do |gemspec| gemspec.name = "the-perfect-gem" gemspec.summary = "TODO" gemspec.email = "<EMAIL>" gemspec.homepage = "http://github.com/technicalpickles/the-perfect-gem" gemspec.description = "TODO" gemspec.authors = ["<NAME>"] end rescue LoadError puts "Jeweler not available. Install it with: sudo gem install technicalpickles-jeweler -s http://gems.github.com" end The yield object here, `gemspec`, is a `Gem::Specification` object. See the [Customizing your project's gem specification](http://wiki.github.com/technicalpickles/jeweler/customizing-your-projects-gem-specification) for more details about how you can customize your gemspec. ## Using to start a new project Jeweler provides a generator. It requires you to [setup your name and email for git](http://github.com/guides/tell-git-your-user-name-and-email-address) and [your username and token for GitHub](http://github.com/guides/local-github-config). jeweler the-perfect-gem This will prepare a project in the 'the-perfect-gem' directory, setup to use Jeweler. It supports a number of options: * --create-repo: in addition to preparing a project, it create an repo up on GitHub and enable RubyGem generation * --testunit: generate test_helper.rb and test ready for test/unit * --minitest: generate test_helper.rb and test ready for minitest * --shoulda: generate test_helper.rb and test ready for shoulda (this is the default) * --rspec: generate spec_helper.rb and spec ready for rspec * --bacon: generate spec_helper.rb and spec ready for bacon * --rubyforge: setup releasing to rubyforge ### Default options Jeweler respects the JEWELER_OPTS environment variable. Want to always use RSpec, and you're using bash? Add this to ~/.bashrc: export JEWELER_OPTS="--rspec" ## Gemspec Jeweler handles generating a gemspec file for your project: rake gemspec This creates a gemspec for your project. It's based on the info you give `Jeweler::Tasks`, the current version of your project, and some defaults that Jeweler provides. ## Gem Jeweler gives you tasks for building and installing your gem: rake build rake install ## Versioning Jeweler tracks the version of your project. It assumes you will be using a version in the format `x.y.z`. `x` is the 'major' version, `y` is the 'minor' version, and `z` is the patch version. Initially, your project starts out at 0.0.0. Jeweler provides Rake tasks for bumping the version: rake version:bump:major rake version:bump:minor rake version:bump:patch ## Releasing to GitHub Jeweler handles releasing your gem into the wild: rake release It does the following for you: * Regenerate the gemspec to the latest version of your project * Push to GitHub (which results in a gem being build) * Tag the version and push to GitHub ## Releasing to RubyForge Jeweler can also handle releasing to [RubyForge](http://rubyforge.org). There are a few steps you need to do before doing any RubyForge releases with Jeweler: * [Create an account on RubyForge](http://rubyforge.org/account/register.php) * Request a project on RubyForge. This involves waiting for a project approval, which can take any amount of time from a few hours to a week * You might want to create an umbrella project where you can publish your gems, instead of one project per gem * Install the RubyForge gem: sudo gem install rubyforge * Run 'rubyforge setup' and fill in your username and password for RubyForge * Run 'rubyforge config' to pull down information about your projects * Run 'rubyforge login' to make sure you are able to login With this in place, you now update your Jeweler::Tasks to setup `rubyforge_project` with the RubyForge project you've just created. (Note, using `jeweler --rubyforge` when generating the project does this for you automatically.) begin require 'jeweler' Jeweler::Tasks.new do |s| s.name = "the-perfect-gem" s.summary = "TODO" s.email = "<EMAIL>" s.homepage = "http://github.com/technicalpickles/the-perfect-gem" s.description = "TODO" s.authors = ["<NAME>"] s.rubyforge_project = 'the-perfect-gem' # This line would be new end rescue LoadError puts "Jeweler not available. Install it with: sudo gem install jeweler" end # These are new tasks begin require 'rake/contrib/sshpublisher' namespace :rubyforge do desc "Release gem and RDoc documentation to RubyForge" task :release => ["rubyforge:release:gem", "rubyforge:release:docs"] namespace :release do desc "Publish RDoc to RubyForge." task :docs => [:rdoc] do config = YAML.load( File.read(File.expand_path('~/.rubyforge/user-config.yml')) ) host = "#{config['username']}@rubyforge.org" remote_dir = "/var/www/gforge-projects/the-perfect-gem/" local_dir = 'rdoc' Rake::SshDirPublisher.new(host, remote_dir, local_dir).upload end end end rescue LoadError puts "Rake SshDirPublisher is unavailable or your rubyforge environment is not configured." end Now you must initially create a 'package' for your gem in your 'project': $ rake rubyforge:setup With all that setup out of the way, you can now release to RubyForge with impunity. This would release the current version of your gem, and upload the rdoc as your project's webpage. $ rake rubyforge:release ## Workflow * Hack, commit, hack, commit, etc, etc * `rake version:bump:patch release` to do the actual version bump and release * Have a delicious scotch * Install [gemstalker](http://github.com/technicalpickles/gemstalker), and use it to know when gem is built. It typically builds in a few minutes, but won't be installable for another 15 minutes. ## Links * [Bugs](http://technicalpickles.lighthouseapp.com/projects/23560-jeweler/overview) * [Donate](http://pledgie.org/campaigns/2604) <file_sep>class Jeweler module Commands class Release attr_accessor :gemspec, :version, :repo, :output, :gemspec_helper, :base_dir def initialize self.output = $stdout end def run repo.checkout('master') raise "Hey buddy, try committing them files first" if any_pending_changes? gemspec_helper.update_version(version) gemspec_helper.write repo.add(gemspec_helper.path) output.puts "Committing #{gemspec_helper.path}" repo.commit("Regenerated gemspec for version #{version}") output.puts "Pushing master to origin" repo.push output.puts "Tagging #{release_tag}" repo.add_tag(release_tag) output.puts "Pushing #{release_tag} to origin" repo.push('origin', release_tag) end def any_pending_changes? !(@repo.status.added.empty? && @repo.status.deleted.empty? && @repo.status.changed.empty?) end def release_tag "v#{version}" end def gemspec_helper @gemspec_helper ||= Jeweler::GemSpecHelper.new(self.gemspec, self.base_dir) end def self.build_for(jeweler) command = self.new command.base_dir = jeweler.base_dir command.gemspec = jeweler.gemspec command.version = jeweler.version command.repo = jeweler.repo command.output = jeweler.output command.gemspec_helper = jeweler.gemspec_helper command end end end end <file_sep>class Jeweler module Commands module Version class Base attr_accessor :repo, :version_helper, :gemspec, :commit def run update_version self.version_helper.write self.gemspec.version = self.version_helper.to_s commit_version if self.repo && self.commit end def update_version raise "Subclasses should implement this" end def commit_version if self.repo self.repo.add('VERSION.yml') self.repo.commit("Version bump to #{self.version_helper.to_s}") end end def self.build_for(jeweler) command = new command.repo = jeweler.repo command.version_helper = jeweler.version_helper command.gemspec = jeweler.gemspec command.commit = jeweler.commit command end end end end end <file_sep>class Jeweler class GemSpecHelper attr_accessor :spec, :base_dir def initialize(spec, base_dir = nil) self.spec = spec self.base_dir = base_dir || '' yield spec if block_given? end def valid? begin parse true rescue false end end def write normalize_files(:files) normalize_files(:files) normalize_files(:extra_rdoc_files) File.open(path, 'w') do |f| gemspec_ruby = @spec.to_ruby gemspec_ruby = prettyify_array(gemspec_ruby, :files) gemspec_ruby = prettyify_array(gemspec_ruby, :test_files) gemspec_ruby = prettyify_array(gemspec_ruby, :extra_rdoc_files) f.write gemspec_ruby end end def path denormalized_path = File.join(@base_dir, "#{@spec.name}.gemspec") absolute_path = File.expand_path(denormalized_path) absolute_path.gsub(Dir.getwd + File::SEPARATOR, '') end def parse data = File.read(path) parsed_gemspec = nil Thread.new { parsed_gemspec = eval("$SAFE = 3\n#{data}", binding, path) }.join parsed_gemspec end def normalize_files(array_name) array = @spec.send(array_name) # only keep files, no directories, and sort array = array.select do |path| File.file? File.join(@base_dir, path) end.sort @spec.send("#{array_name}=", array) end def prettyify_array(gemspec_ruby, array_name) array = @spec.send(array_name) quoted_array = array.map {|file| %Q{"#{file}"}} nastily_formated_array = "s.#{array_name} = [#{quoted_array.join(", ")}]" nicely_formated_array = "s.#{array_name} = [\n #{quoted_array.join(",\n ")}\n ]" gemspec_ruby.gsub(nastily_formated_array, nicely_formated_array) end def gem_path File.join(@base_dir, 'pkg', parse.file_name) end def update_version(version) @spec.version = version.to_s end end end <file_sep>require 'test_helper' class TestOptions < Test::Unit::TestCase def self.should_have_testing_framework(testing_framework) should "use #{testing_framework} for testing" do assert_equal testing_framework.to_sym, @options[:testing_framework] end end def setup_options(*arguments) @options = Jeweler::Generator::Options.new(arguments) end def self.for_options(*options) context options.join(' ') do setup { setup_options *options } yield end end context "default options" do setup { setup_options } should_have_testing_framework :shoulda should 'not create repository' do assert ! @options[:create_repo] end end for_options '--shoulda' do should_have_testing_framework :shoulda end for_options "--bacon" do should_have_testing_framework :bacon end for_options "--testunit" do should_have_testing_framework :testunit end for_options '--minitest' do should_have_testing_framework :minitest end for_options '--rspec' do should_have_testing_framework :rspec end for_options '--micronaut' do should_have_testing_framework :micronaut end for_options '--cucumber' do should 'enable cucumber' do assert_equal true, @options[:use_cucumber] end end for_options '--create-repo' do should 'create repository' do assert @options[:create_repo] end end for_options '--rubyforge' do should 'enable rubyforge' do assert @options[:rubyforge] end end for_options '--summary', 'zomg so awesome' do should 'have summary zomg so awesome' do assert_equal 'zomg so awesome', @options[:summary] end end for_options '--directory', 'foo' do should 'have directory foo' do assert_equal 'foo', @options[:directory] end end for_options '--help' do should 'show help' do assert @options[:show_help] end end for_options '-h' do should 'show help' do assert @options[:show_help] end end for_options '--zomg-invalid' do should 'be an invalid argument' do assert @options[:invalid_argument] end end context "merging options" do should "take options from each" do options = Jeweler::Generator::Options.new(["--rspec"]). merge Jeweler::Generator::Options.new(["--create-repo"]) assert_equal :rspec, options[:testing_framework] assert options[:create_repo] end should "shadow options" do options = Jeweler::Generator::Options.new(["--bacon"]). merge Jeweler::Generator::Options.new(["--rspec"]) assert_equal :rspec, options[:testing_framework] end end end <file_sep>class Jeweler class Generator module BaconMixin def default_task 'spec' end def feature_support_require 'test/unit/assertions' end def feature_support_extend 'Test::Unit::Assertions' # NOTE can't use bacon inside of cucumber actually end def test_dir 'spec' end def test_or_spec 'spec' end def test_task 'spec' end def test_pattern 'spec/**/*_spec.rb' end end end end <file_sep>require 'rubygems' require 'rake' begin require 'jeweler' Jeweler::Tasks.new do |gem| gem.name = "<%= project_name %>" gem.summary = %Q{<%= summary %>} gem.email = "<%= user_email %>" gem.homepage = "<%= project_homepage %>" gem.authors = ["<%= user_name %>"] <% if should_setup_rubyforge %> gem.rubyforge_project = "<%= project_name %>" <% end %> # gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings end rescue LoadError puts "Jeweler (or a dependency) not available. Install it with: sudo gem install jeweler" end <% case testing_framework.to_sym %> <% when :rspec %> require 'spec/rake/spectask' Spec::Rake::SpecTask.new(:<%= test_task %>) do |<%= test_task %>| <%= test_task %>.libs << 'lib' << '<%= test_dir %>' <%= test_task %>.spec_files = FileList['<%= test_pattern %>'] end <% when :micronaut %> require 'micronaut/rake_task' Micronaut::RakeTask.new(<%= test_task %>) do |<%= test_task %>| <%= test_task %>.pattern = '<%= test_pattern %>' <%= test_task %>.ruby_opts << '-Ilib -I<%= test_dir %>' end <% else %> require 'rake/testtask' Rake::TestTask.new(:<%= test_task %>) do |<%= test_task %>| <%= test_task %>.libs << 'lib' << '<%= test_dir %>' <%= test_task %>.pattern = '<%= test_pattern %>' <%= test_task %>.verbose = true end <% end %> <% case testing_framework.to_sym %> <% when :rspec %> Spec::Rake::SpecTask.new(:rcov) do |spec| spec.libs << 'lib' << 'spec' spec.pattern = '<%= test_pattern %>' spec.rcov = true end <% when :micronaut %> Micronaut::RakeTask.new(:rcov) do |examples| examples.pattern = '<%= test_pattern %>' examples.rcov_opts = '-Ilib -I<%= test_dir %>' examples.rcov = true end <% else %> begin require 'rcov/rcovtask' Rcov::RcovTask.new do |<%= test_task %>| <%= test_task %>.libs << '<%= test_dir %>' <%= test_task %>.pattern = '<%= test_pattern %>' <%= test_task %>.verbose = true end rescue LoadError task :rcov do abort "RCov is not available. In order to run rcov, you must: sudo gem install spicycode-rcov" end end <% end %> <% if should_use_cucumber %> begin require 'cucumber/rake/task' Cucumber::Rake::Task.new(:features) rescue LoadError task :features do abort "Cucumber is not available. In order to run features, you must: sudo gem install cucumber" end end <% end %> task :default => :<%= default_task %> require 'rake/rdoctask' Rake::RDocTask.new do |rdoc| if File.exist?('VERSION.yml') config = YAML.load(File.read('VERSION.yml')) version = "#{config[:major]}.#{config[:minor]}.#{config[:patch]}" else version = "" end rdoc.rdoc_dir = 'rdoc' rdoc.title = "<%= project_name %> #{version}" rdoc.rdoc_files.include('README*') rdoc.rdoc_files.include('lib/**/*.rb') end <% if should_setup_rubyforge %> begin require 'rake/contrib/sshpublisher' namespace :rubyforge do desc "Release gem and RDoc documentation to RubyForge" task :release => ["rubyforge:release:gem", "rubyforge:release:docs"] namespace :release do desc "Publish RDoc to RubyForge." task :docs => [:rdoc] do config = YAML.load( File.read(File.expand_path('~/.rubyforge/user-config.yml')) ) host = "#{config['username']}@rubyforge.org" remote_dir = "/var/www/gforge-projects/<%= project_name %>/" local_dir = 'rdoc' Rake::SshDirPublisher.new(host, remote_dir, local_dir).upload end end end rescue LoadError puts "Rake SshDirPublisher is unavailable or your rubyforge environment is not configured." end <% end %> <file_sep>class Jeweler class Generator class Application class << self def run!(*arguments) env_opts = if ENV['JEWELER_OPTS'] Jeweler::Generator::Options.new(ENV['JEWELER_OPTS'].split(' ')) end options = Jeweler::Generator::Options.new(arguments) options = options.merge(env_opts) if env_opts if options[:invalid_argument] $stderr.puts options[:invalid_argument] options[:show_help] = true end if options[:show_help] $stderr.puts options.opts return 1 end unless arguments.size == 1 $stderr.puts options.opts return 1 end project_name = arguments.first begin generator = Jeweler::Generator.new(project_name, options) generator.run return 0 rescue Jeweler::NoGitUserName $stderr.puts %Q{No user.name found in ~/.gitconfig. Please tell git about yourself (see http://github.com/guides/tell-git-your-user-name-and-email-address for details). For example: git config --global user.name "mad voo"} return 1 rescue Jeweler::NoGitUserEmail $stderr.puts %Q{No user.email found in ~/.gitconfig. Please tell git about yourself (see http://github.com/guides/tell-git-your-user-name-and-email-address for details). For example: git config --global user.email <EMAIL>} return 1 rescue Jeweler::NoGitHubUser $stderr.puts %Q{No github.user found in ~/.gitconfig. Please tell git about your GitHub account (see http://github.com/blog/180-local-github-config for details). For example: git config --global github.user defunkt} return 1 rescue Jeweler::NoGitHubToken $stderr.puts %Q{No github.token found in ~/.gitconfig. Please tell git about your GitHub account (see http://github.com/blog/180-local-github-config for details). For example: git config --global github.token <PASSWORD>207165f1a82178ae1b984} return 1 rescue Jeweler::FileInTheWay $stderr.puts "The directory #{project_name} already exists. Maybe move it out of the way before continuing?" return 1 end end end end end end <file_sep>require 'test_helper' class TestGeneratorInitialization < Test::Unit::TestCase def setup @project_name = 'the-perfect-gem' @git_name = 'foo' @git_email = '<EMAIL>' @github_user = 'technicalpickles' @github_token = '<PASSWORD>' end def stub_git_config(options = {}) stub.instance_of(Git::Lib).parse_config('~/.gitconfig') { options } end context "given a nil github repo name" do setup do stub_git_config @block = lambda { } end should 'raise NoGithubRepoNameGiven' do assert_raise Jeweler::NoGitHubRepoNameGiven do Jeweler::Generator.new(nil) end end end context "without git user's name set" do setup do stub_git_config 'user.email' => @git_email end should 'raise an NoGitUserName' do assert_raise Jeweler::NoGitUserName do Jeweler::Generator.new(@project_name) end end end context "without git user's email set" do setup do stub_git_config 'user.name' => @git_name end should 'raise NoGitUserName' do assert_raise Jeweler::NoGitUserEmail do Jeweler::Generator.new(@project_name) end end end context "without github username set" do setup do stub_git_config 'user.email' => @git_email, 'user.name' => @git_name end should 'raise NotGitHubUser' do assert_raise Jeweler::NoGitHubUser do Jeweler::Generator.new(@project_name) end end end context "without github token set" do setup do stub_git_config 'user.name' => @git_name, 'user.email' => @git_email, 'github.user' => @github_user end should 'raise NoGitHubToken' do assert_raise Jeweler::NoGitHubToken do Jeweler::Generator.new(@project_name) end end end context "with valid git user configuration" do setup do stub_git_config 'user.name' => @git_name, 'user.email' => @git_email, 'github.user' => @github_user, 'github.token' => @github_token end context "for technicalpickle's the-perfect-gem repository" do setup do @generator = Jeweler::Generator.new(@project_name) end should "assign user's name from git config" do assert_equal @git_name, @generator.user_name end should "assign email from git config" do assert_equal @git_email, @generator.user_email end should "assign github remote" do assert_equal '<EMAIL>:technicalpickles/the-perfect-gem.git', @generator.git_remote end should "assign github username from git config" do assert_equal @github_user, @generator.github_username end should "determine project name as the-perfect-gem" do assert_equal @project_name, @generator.project_name end should "determine target directory as the same as the github repository name" do assert_equal @generator.project_name, @generator.target_dir end end end end <file_sep>require 'test_helper' class Jeweler module Commands class TestReleaseToRubyforge < Test::Unit::TestCase def self.subject Jeweler::Commands::ReleaseToRubyforge.new end rubyforge_command_context "rubyforge_project is defined in gemspec and package exists on rubyforge" do setup do stub(@rubyforge).configure stub(@rubyforge).login stub(@rubyforge).add_release("MyRubyForgeProjectName", "zomg", "1.2.3", "pkg/zomg-1.2.3.gem") stub(@gemspec).description {"The zomg gem rocks."} stub(@gemspec).rubyforge_project {"MyRubyForgeProjectName"} stub(@gemspec).name {"zomg"} stub(@gemspec_helper).write stub(@gemspec_helper).gem_path {'pkg/zomg-1.2.3.gem'} stub(@gemspec_helper).update_version('1.2.3') @command.version = '1.2.3' @command.run end should "configure" do assert_received(@rubyforge) {|rubyforge| rubyforge.configure } end should "login" do assert_received(@rubyforge) {|rubyforge| rubyforge.login } end should "set release notes" do assert_equal "The zomg gem rocks.", @rubyforge.userconfig["release_notes"] end should "set preformatted to true" do assert_equal true, @rubyforge.userconfig['preformatted'] end should "add release" do assert_received(@rubyforge) {|rubyforge| rubyforge.add_release("MyRubyForgeProjectName", "zomg", "1.2.3", "pkg/zomg-1.2.3.gem") } end end rubyforge_command_context "rubyforge_project is defined in gemspec and package does not exist on rubyforge" do setup do stub(@rubyforge).configure stub(@rubyforge).login stub(@rubyforge).scrape_config stub(@rubyforge).add_release("MyRubyForgeProjectName", "zomg", "1.2.3", "pkg/zomg-1.2.3.gem") { raise "no <package_id> configured for <zomg>" } stub(@gemspec).description {"The zomg gem rocks."} stub(@gemspec).rubyforge_project {"MyRubyForgeProjectName"} stub(@gemspec).name {"zomg"} stub(@gemspec_helper).write stub(@gemspec_helper).gem_path {'pkg/zomg-1.2.3.gem'} stub(@gemspec_helper).update_version('1.2.3') @command.version = '1.2.3' end should "raise MissingRubyForgePackageError" do assert_raises Jeweler::MissingRubyForgePackageError do @command.run end end end rubyforge_command_context "rubyforge_project is not defined in gemspec" do setup do stub(@rubyforge).configure stub(@rubyforge).login stub(@rubyforge).add_release(nil, "zomg", "1.2.3", "pkg/zomg-1.2.3.gem") stub(@gemspec).description {"The zomg gem rocks."} stub(@gemspec).rubyforge_project { nil } stub(@gemspec).name {"zomg"} stub(@gemspec_helper).write stub(@gemspec_helper).gem_path {'pkg/zomg-1.2.3.gem'} stub(@gemspec_helper).update_version('1.2.3') @command.version = '1.2.3' end should "raise NoRubyForgeProjectConfigured" do assert_raises Jeweler::NoRubyForgeProjectInGemspecError do @command.run end end end rubyforge_command_context "after running when rubyforge_project is not defined in ~/.rubyforge/auto_config.yml" do setup do stub(@rubyforge).configure stub(@rubyforge).login stub(@rubyforge).add_release("some_project_that_doesnt_exist", "zomg", "1.2.3", "pkg/zomg-1.2.3.gem") do raise RuntimeError, "no <group_id> configured for <some_project_that_doesnt_exist>" end @rubyforge.autoconfig['package_ids'] = { 'zomg' => 1234 } stub(@gemspec).description {"The zomg gem rocks."} stub(@gemspec).rubyforge_project { "some_project_that_doesnt_exist" } stub(@gemspec).name {"zomg"} stub(@gemspec_helper).write stub(@gemspec_helper).gem_path {'pkg/zomg-1.2.3.gem'} stub(@gemspec_helper).update_version('1.2.3') @command.version = '1.2.3' end should "raise RubyForgeProjectNotConfiguredError" do assert_raises RubyForgeProjectNotConfiguredError do @command.run end end end build_command_context "build for jeweler" do setup do @command = Jeweler::Commands::ReleaseToRubyforge.build_for(@jeweler) end should "assign gemspec helper" do assert_equal @gemspec_helper, @command.gemspec_helper end should "assign gemspec" do assert_equal @gemspec, @command.gemspec end should "assign version" do assert_equal @version, @command.version end should "assign output" do assert_equal @output, @command.output end should "assign rubyforge" do assert_equal @rubyforge, @command.rubyforge end end end end end <file_sep>= <%= project_name %> Description goes here. == Copyright Copyright (c) <%= Time.now.year %> <%= user_name %>. See LICENSE for details. <file_sep>require 'date' require 'rubygems/user_interaction' require 'rubygems/builder' require 'rubyforge' require 'jeweler/errors' require 'jeweler/version_helper' require 'jeweler/gemspec_helper' require 'jeweler/generator' require 'jeweler/generator/options' require 'jeweler/generator/application' require 'jeweler/commands' require 'jeweler/tasks' require 'jeweler/specification' # A Jeweler helps you craft the perfect Rubygem. Give him a gemspec, and he takes care of the rest. class Jeweler attr_reader :gemspec, :gemspec_helper, :version_helper attr_accessor :base_dir, :output, :repo, :commit, :rubyforge def initialize(gemspec, base_dir = '.') raise(GemspecError, "Can't create a Jeweler with a nil gemspec") if gemspec.nil? @gemspec = gemspec @gemspec.extend(Specification) @gemspec.set_jeweler_defaults(base_dir) @base_dir = base_dir @repo = Git.open(base_dir) if in_git_repo? @version_helper = Jeweler::VersionHelper.new(base_dir) @output = $stdout @commit = true @gemspec_helper = GemSpecHelper.new(gemspec, base_dir) @rubyforge = RubyForge.new end # Major version, as defined by the gemspec's Version module. # For 1.5.3, this would return 1. def major_version @version_helper.major end # Minor version, as defined by the gemspec's Version module. # For 1.5.3, this would return 5. def minor_version @version_helper.minor end # Patch version, as defined by the gemspec's Version module. # For 1.5.3, this would return 5. def patch_version @version_helper.patch end # Human readable version, which is used in the gemspec. def version @version_helper.to_s end # Writes out the gemspec def write_gemspec Jeweler::Commands::WriteGemspec.build_for(self).run end # Validates the project's gemspec from disk in an environment similar to how # GitHub would build from it. See http://gist.github.com/16215 def validate_gemspec Jeweler::Commands::ValidateGemspec.build_for(self).run end # is the project's gemspec from disk valid? def valid_gemspec? gemspec_helper.valid? end def build_gem Jeweler::Commands::BuildGem.build_for(self).run end def install_gem Jeweler::Commands::InstallGem.build_for(self).run end # Bumps the patch version. # # 1.5.1 -> 1.5.2 def bump_patch_version() Jeweler::Commands::Version::BumpPatch.build_for(self).run end # Bumps the minor version. # # 1.5.1 -> 1.6.0 def bump_minor_version() Jeweler::Commands::Version::BumpMinor.build_for(self).run end # Bumps the major version. # # 1.5.1 -> 2.0.0 def bump_major_version() Jeweler::Commands::Version::BumpMajor.build_for(self).run end # Bumps the version, to the specific major/minor/patch version, writing out the appropriate version.rb, and then reloads it. def write_version(major, minor, patch, options = {}) command = Jeweler::Commands::Version::Write.build_for(self) command.major = major command.minor = minor command.patch = patch command.run end def release Jeweler::Commands::Release.build_for(self).run end def release_gem_to_rubyforge Jeweler::Commands::ReleaseToRubyforge.build_for(self).run end def setup_rubyforge Jeweler::Commands::SetupRubyforge.build_for(self).run end def in_git_repo? File.exists?(File.join(self.base_dir, '.git')) end end <file_sep>#!/usr/bin/env ruby require 'rubygems' require 'optparse' $:.unshift File.join(File.dirname(__FILE__), '..', 'lib') require 'jeweler' Jeweler::Generator::Application.run!(*ARGV) <file_sep>require 'test_helper' require 'rake' class TestTasks < Test::Unit::TestCase include Rake context 'instantiating Jeweler::Tasks' do setup do Task.clear @jt = Jeweler::Tasks.new {} end should 'assign @gemspec' do assert_not_nil @jt.gemspec end should 'assign @jeweler' do assert_not_nil @jt.jeweler end should 'yield the gemspec instance' do spec = nil; Jeweler::Tasks.new { |s| spec = s } assert_not_nil spec end should 'set the gemspec defaults before yielding it' do Jeweler::Tasks.new do |s| assert !s.files.empty? end end should 'define tasks' do assert Task.task_defined?(:build) assert Task.task_defined?(:install) assert Task.task_defined?(:gemspec) assert Task.task_defined?(:build) assert Task.task_defined?(:install) assert Task.task_defined?(:'gemspec:validate') assert Task.task_defined?(:'gemspec:generate') assert Task.task_defined?(:version) assert Task.task_defined?(:'version:write') assert Task.task_defined?(:'version:bump:major') assert Task.task_defined?(:'version:bump:minor') assert Task.task_defined?(:'version:bump:patch') assert Task.task_defined?(:'release') assert Task.task_defined?(:'rubyforge:release:gem') assert Task.task_defined?(:'rubyforge:setup') end end end <file_sep>require 'test_helper' class <%= constant_name %>Test < Test::Unit::TestCase should "probably rename this file and start testing for real" do flunk "hey buddy, you should probably rename this file and start testing for real" end end <file_sep>class Jeweler module Commands module Version class Write < Base attr_accessor :major, :minor, :patch def update_version version_helper.update_to major, minor, patch end end end end end <file_sep>require 'test_helper' class Jeweler module Commands class TestWriteGemspec < Test::Unit::TestCase context "after run" do setup do @gemspec = Gem::Specification.new {|s| s.name = 'zomg' } @gemspec_helper = Object.new stub(@gemspec_helper).spec { @gemspec } stub(@gemspec_helper).path { 'zomg.gemspec' } stub(@gemspec_helper).write @output = StringIO.new @version_helper = Object.new stub(@version_helper).to_s { '1.2.3' } stub(@version_helper).refresh @command = Jeweler::Commands::WriteGemspec.new @command.base_dir = 'tmp' @command.version_helper = @version_helper @command.gemspec = @gemspec @command.output = @output @command.gemspec_helper = @gemspec_helper @now = Time.now stub(Time.now).now { @now } @command.run end should "refresh version" do assert_received(@version_helper) {|version_helper| version_helper.refresh } end should "update gemspec version" do assert_equal '1.2.3', @gemspec.version.to_s end should "update gemspec date to the beginning of today" do assert_equal Time.mktime(@now.year, @now.month, @now.day, 0, 0), @gemspec.date end should "write gemspec" do assert_received(@gemspec_helper) {|gemspec_helper| gemspec_helper.write } end should_eventually "output that the gemspec was written" do assert_equal @output.string, "Generated: tmp/zomg.gemspec" end end build_command_context "building for jeweler" do setup do @command = Jeweler::Commands::WriteGemspec.build_for(@jeweler) end should "assign base_dir" do assert_same @base_dir, @command.base_dir end should "assign gemspec" do assert_same @gemspec, @command.gemspec end should "assign version" do assert_same @version, @command.version end should "assign output" do assert_same @output, @command.output end should "assign gemspec_helper" do assert_same @gemspec_helper, @command.gemspec_helper end should "assign version_helper" do assert_same @version_helper, @command.version_helper end should "return WriteGemspec" do assert_kind_of Jeweler::Commands::WriteGemspec, @command end end end end end <file_sep>class Jeweler module Commands class SetupRubyforge attr_accessor :gemspec, :output, :rubyforge def run raise NoRubyForgeProjectInGemspecError unless @gemspec.rubyforge_project @rubyforge.configure output.puts "Logging into rubyforge" @rubyforge.login output.puts "Creating #{@gemspec.name} package in the #{@gemspec.rubyforge_project} project" begin @rubyforge.create_package(@gemspec.rubyforge_project, @gemspec.name) rescue StandardError => e case e.message when /no <group_id> configured for <#{Regexp.escape @gemspec.rubyforge_project}>/ raise RubyForgeProjectNotConfiguredError, @gemspec.rubyforge_project else raise end end end def self.build_for(jeweler) command = new command.gemspec = jeweler.gemspec command.output = jeweler.output command.rubyforge = jeweler.rubyforge command end end end end <file_sep>require 'test_helper' class Jeweler module Commands module Version class TestWrite < Test::Unit::TestCase should "call write_version on version_helper in update_version" do mock(version_helper = Object.new).update_to 1, 2, 3 command = Jeweler::Commands::Version::Write.new command.version_helper = version_helper command.major = 1 command.minor = 2 command.patch = 3 command.update_version end end end end end <file_sep>class Jeweler class Generator module RspecMixin def default_task 'spec' end def feature_support_require 'spec/expectations' end def feature_support_extend nil # Cucumber is smart enough extend Spec::Expectations on its own end def test_dir 'spec' end def test_or_spec 'spec' end def test_task 'spec' end def test_pattern 'spec/**/*_spec.rb' end end end end <file_sep>require 'test_helper' class TestApplication < Test::Unit::TestCase def run_application(*arguments) original_stdout = $stdout original_stderr = $stderr fake_stdout = StringIO.new fake_stderr = StringIO.new $stdout = fake_stdout $stderr = fake_stderr result = nil begin result = Jeweler::Generator::Application.run!(*arguments) ensure $stdout = original_stdout $stderr = original_stderr end @stdout = fake_stdout.string @stderr = fake_stderr.string result end def self.should_exit_with_code(code) should "exit with code #{code}" do assert_equal code, @result end end context "called without any args" do setup do @result = run_application end should_exit_with_code 1 should 'display usage on stderr' do assert_match 'Usage:', @stderr end should 'not display anything on stdout' do assert_equal '', @stdout.squeeze.strip end end def build_generator(name = 'zomg', options = {:testing_framework => :shoulda}) stub.instance_of(Git::Lib).parse_config '~/.gitconfig' do {'user.name' => '<NAME>', 'user.email' => '<EMAIL>', 'github.user' => 'johndoe', 'github.token' => 'yyz'} end Jeweler::Generator.new(name, options) end context "called with -h" do setup do @generator = build_generator stub(@generator).run stub(Jeweler::Generator).new { raise "Shouldn't have made this far"} assert_nothing_raised do @result = run_application("-h") end end should_exit_with_code 1 should 'display usage on stderr' do assert_match 'Usage:', @stderr end should 'not display anything on stdout' do assert_equal '', @stdout.squeeze.strip end end context "called with --invalid-argument" do setup do @generator = build_generator stub(@generator).run stub(Jeweler::Generator).new { raise "Shouldn't have made this far"} assert_nothing_raised do @result = run_application("--invalid-argument") end end should_exit_with_code 1 should 'display invalid argument' do assert_match '--invalid-argument', @stderr end should 'display usage on stderr' do assert_match 'Usage:', @stderr end should 'not display anything on stdout' do assert_equal '', @stdout.squeeze.strip end end context "when called with repo name" do setup do @options = {:testing_framework => :shoulda} @generator = build_generator('zomg', @options) stub(@generator).run stub(Jeweler::Generator).new { @generator } end should 'return exit code 0' do result = run_application("zomg") assert_equal 0, result end should 'create generator with repo name and no options' do run_application("zomg") assert_received Jeweler::Generator do |subject| subject.new('zomg', @options) end end should 'run generator' do run_application("zomg") assert_received(@generator) {|subject| subject.run } end should 'not display usage on stderr' do assert_no_match /Usage:/, @stderr end end end <file_sep>class Jeweler module Commands class WriteGemspec attr_accessor :base_dir, :gemspec, :version, :output, :gemspec_helper, :version_helper def initialize self.output = $stdout end def run version_helper.refresh gemspec_helper.spec.version = version_helper.to_s gemspec_helper.spec.date = Time.now gemspec_helper.write output.puts "Generated: #{gemspec_helper.path}" end def gemspec_helper @gemspec_helper ||= GemSpecHelper.new(self.gemspec, self.base_dir) end def self.build_for(jeweler) command = new command.base_dir = jeweler.base_dir command.gemspec = jeweler.gemspec command.version = jeweler.version command.output = jeweler.output command.gemspec_helper = jeweler.gemspec_helper command.version_helper = jeweler.version_helper command end end end end <file_sep># -*- encoding: utf-8 -*- Gem::Specification.new do |s| s.name = %q{jeweler} s.version = "0.11.0" s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version= s.authors = ["<NAME>"] s.date = %q{2009-04-05} s.default_executable = %q{jeweler} s.description = %q{Simple and opinionated helper for creating Rubygem projects on GitHub} s.email = %q{<EMAIL>} s.executables = ["jeweler"] s.extra_rdoc_files = [ "ChangeLog.markdown", "LICENSE", "README.markdown" ] s.files = [ "ChangeLog.markdown", "LICENSE", "README.markdown", "Rakefile", "VERSION.yml", "bin/jeweler", "lib/jeweler.rb", "lib/jeweler/commands.rb", "lib/jeweler/commands/build_gem.rb", "lib/jeweler/commands/install_gem.rb", "lib/jeweler/commands/release.rb", "lib/jeweler/commands/release_to_rubyforge.rb", "lib/jeweler/commands/setup_rubyforge.rb", "lib/jeweler/commands/validate_gemspec.rb", "lib/jeweler/commands/version/base.rb", "lib/jeweler/commands/version/bump_major.rb", "lib/jeweler/commands/version/bump_minor.rb", "lib/jeweler/commands/version/bump_patch.rb", "lib/jeweler/commands/version/write.rb", "lib/jeweler/commands/write_gemspec.rb", "lib/jeweler/errors.rb", "lib/jeweler/gemspec_helper.rb", "lib/jeweler/generator.rb", "lib/jeweler/generator/application.rb", "lib/jeweler/generator/options.rb", "lib/jeweler/specification.rb", "lib/jeweler/tasks.rb", "lib/jeweler/templates/.document", "lib/jeweler/templates/.gitignore", "lib/jeweler/templates/LICENSE", "lib/jeweler/templates/README.rdoc", "lib/jeweler/templates/Rakefile", "lib/jeweler/templates/bacon/flunking.rb", "lib/jeweler/templates/bacon/helper.rb", "lib/jeweler/templates/features/default.feature", "lib/jeweler/templates/features/support/env.rb", "lib/jeweler/templates/micronaut/flunking.rb", "lib/jeweler/templates/micronaut/helper.rb", "lib/jeweler/templates/minitest/flunking.rb", "lib/jeweler/templates/minitest/helper.rb", "lib/jeweler/templates/rspec/flunking.rb", "lib/jeweler/templates/rspec/helper.rb", "lib/jeweler/templates/shoulda/flunking.rb", "lib/jeweler/templates/shoulda/helper.rb", "lib/jeweler/templates/testunit/flunking.rb", "lib/jeweler/templates/testunit/helper.rb", "lib/jeweler/version_helper.rb", "test/fixtures/bar/VERSION.yml", "test/fixtures/bar/bin/foo_the_ultimate_bin", "test/fixtures/bar/hey_include_me_in_gemspec", "test/fixtures/bar/lib/foo_the_ultimate_lib.rb", "test/fixtures/existing-project-with-version/LICENSE", "test/fixtures/existing-project-with-version/README.rdoc", "test/fixtures/existing-project-with-version/Rakefile", "test/fixtures/existing-project-with-version/VERSION.yml", "test/fixtures/existing-project-with-version/existing-project-with-version.gemspec", "test/fixtures/existing-project-with-version/lib/existing_project_with_version.rb", "test/fixtures/existing-project-with-version/test/existing_project_with_version_test.rb", "test/fixtures/existing-project-with-version/test/test_helper.rb", "test/geminstaller.yml", "test/generators/initialization_test.rb", "test/jeweler/commands/test_build_gem.rb", "test/jeweler/commands/test_install_gem.rb", "test/jeweler/commands/test_release.rb", "test/jeweler/commands/test_release_to_rubyforge.rb", "test/jeweler/commands/test_setup_rubyforge.rb", "test/jeweler/commands/test_validate_gemspec.rb", "test/jeweler/commands/test_write_gemspec.rb", "test/jeweler/commands/version/test_base.rb", "test/jeweler/commands/version/test_bump_major.rb", "test/jeweler/commands/version/test_bump_minor.rb", "test/jeweler/commands/version/test_bump_patch.rb", "test/jeweler/commands/version/test_write.rb", "test/shoulda_macros/jeweler_macros.rb", "test/test_application.rb", "test/test_gemspec_helper.rb", "test/test_generator.rb", "test/test_helper.rb", "test/test_jeweler.rb", "test/test_options.rb", "test/test_specification.rb", "test/test_tasks.rb", "test/test_version_helper.rb", "test/version_tmp/VERSION.yml" ] s.has_rdoc = true s.homepage = %q{http://github.com/technicalpickles/jeweler} s.rdoc_options = ["--charset=UTF-8"] s.require_paths = ["lib"] s.rubyforge_project = %q{pickles} s.rubygems_version = %q{1.3.1} s.summary = %q{Simple and opinionated helper for creating Rubygem projects on GitHub} s.test_files = [ "test/fixtures/bar/lib/foo_the_ultimate_lib.rb", "test/fixtures/existing-project-with-version/lib/existing_project_with_version.rb", "test/fixtures/existing-project-with-version/test/existing_project_with_version_test.rb", "test/fixtures/existing-project-with-version/test/test_helper.rb", "test/generators/initialization_test.rb", "test/jeweler/commands/test_build_gem.rb", "test/jeweler/commands/test_install_gem.rb", "test/jeweler/commands/test_release.rb", "test/jeweler/commands/test_release_to_rubyforge.rb", "test/jeweler/commands/test_setup_rubyforge.rb", "test/jeweler/commands/test_validate_gemspec.rb", "test/jeweler/commands/test_write_gemspec.rb", "test/jeweler/commands/version/test_base.rb", "test/jeweler/commands/version/test_bump_major.rb", "test/jeweler/commands/version/test_bump_minor.rb", "test/jeweler/commands/version/test_bump_patch.rb", "test/jeweler/commands/version/test_write.rb", "test/shoulda_macros/jeweler_macros.rb", "test/test_application.rb", "test/test_gemspec_helper.rb", "test/test_generator.rb", "test/test_helper.rb", "test/test_jeweler.rb", "test/test_options.rb", "test/test_specification.rb", "test/test_tasks.rb", "test/test_version_helper.rb" ] if s.respond_to? :specification_version then current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION s.specification_version = 2 if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then s.add_runtime_dependency(%q<peterwald-git>, [">= 0"]) else s.add_dependency(%q<peterwald-git>, [">= 0"]) end else s.add_dependency(%q<peterwald-git>, [">= 0"]) end end <file_sep>$LOAD_PATH.unshift(File.dirname(__FILE__) + '/../../lib') require '<%= file_name_prefix %>' require '<%= feature_support_require %>' World do |world| <% if feature_support_extend %> world.extend(<%= feature_support_extend %>) <% end %> world end <file_sep>$LOAD_PATH.unshift(File.dirname(__FILE__) + '/../../lib') require 'jeweler' require 'mocha' require 'output_catcher' require 'test/unit/assertions' World do |world| world.extend(Test::Unit::Assertions) world end def yank_task_info(content, task) if content =~ /#{Regexp.escape(task)}.new(\(.*\))? do \|(.*?)\|(.*?)end/m [$2, $3] end end def fixture_dir File.expand_path File.join(File.dirname(__FILE__), '..', '..', 'test', 'fixtures') end <file_sep># not sure why I need to use this form instead of just require 'test_helper' require File.expand_path(File.join(File.dirname(__FILE__), '..', '..', 'test_helper')) class Jeweler module Commands class TestBuildGem < Test::Unit::TestCase context "after running" do setup do @gemspec = Object.new stub(@gemspec).file_name { 'zomg-1.2.3.gem' } @gemspec_helper = Object.new stub(@gemspec_helper).parse { @gemspec } @builder = Object.new stub(Gem::Builder).new { @builder } stub(@builder).build { 'zomg-1.2.3.gem' } @file_utils = Object.new stub(@file_utils).mkdir_p './pkg' stub(@file_utils).mv './zomg-1.2.3.gem', './pkg' @base_dir = '.' @command = Jeweler::Commands::BuildGem.new @command.base_dir = @base_dir @command.file_utils = @file_utils @command.gemspec_helper = @gemspec_helper @command.run end should "call gemspec helper's parse" do assert_received(@gemspec_helper) {|gemspec_helper| gemspec_helper.parse } end should "build from parsed gemspec" do assert_received(Gem::Builder) {|builder_class| builder_class.new(@gemspec) } assert_received(@builder) {|builder| builder.build } end should 'make package directory' do assert_received(@file_utils) {|file_utils| file_utils.mkdir_p './pkg'} end should 'move built gem into package directory' do assert_received(@file_utils) {|file_utils| file_utils.mv './zomg-1.2.3.gem', './pkg'} end end build_command_context "build for jeweler" do setup do @command = Jeweler::Commands::BuildGem.build_for(@jeweler) end should "assign base_dir" do assert_same @base_dir, @jeweler.base_dir end should "assign gemspec_helper" do assert_same @gemspec_helper, @jeweler.gemspec_helper end should "return BuildGem" do assert_kind_of Jeweler::Commands::BuildGem, @command end end end end end <file_sep>require 'rubyforge' class Jeweler module Commands class ReleaseToRubyforge attr_accessor :gemspec, :version, :output, :gemspec_helper, :rubyforge def initialize self.output = $stdout end def run raise NoRubyForgeProjectInGemspecError unless @gemspec.rubyforge_project @rubyforge.configure rescue nil output.puts 'Logging in rubyforge' @rubyforge.login @rubyforge.userconfig['release_notes'] = @gemspec.description if @gemspec.description @rubyforge.userconfig['preformatted'] = true output.puts "Releasing #{@gemspec.name}-#{@version} to #{@gemspec.rubyforge_project}" begin @rubyforge.add_release(@gemspec.rubyforge_project, @gemspec.name, @version.to_s, @gemspec_helper.gem_path) rescue StandardError => e case e.message when /no <group_id> configured for <#{Regexp.escape @gemspec.rubyforge_project}>/ raise RubyForgeProjectNotConfiguredError, @gemspec.rubyforge_project when /no <package_id> configured for <#{Regexp.escape @gemspec.name}>/i raise MissingRubyForgePackageError, @gemspec.name else raise end end end def self.build_for(jeweler) command = new command.gemspec = jeweler.gemspec command.gemspec_helper = jeweler.gemspec_helper command.version = jeweler.version command.rubyforge = jeweler.rubyforge command.output = jeweler.output command end end end end <file_sep>require 'test_helper' class Jeweler module Commands class TestSetupRubyforge < Test::Unit::TestCase def self.subject Jeweler::Commands::SetupRubyforge.new end rubyforge_command_context "rubyforge_project is defined in gemspec and package exists on rubyforge" do setup do stub(@rubyforge).configure stub(@rubyforge).login stub(@rubyforge).create_package('myproject', 'zomg') stub(@gemspec).name { 'zomg' } stub(@gemspec).rubyforge_project { 'myproject' } @command.run end should "configure rubyforge" do assert_received(@rubyforge) {|rubyforge| rubyforge.configure} end should "login to rubyforge" do assert_received(@rubyforge) {|rubyforge| rubyforge.login} end should "create zomg package to myproject on rubyforge" do assert_received(@rubyforge) {|rubyforge| rubyforge.create_package('myproject', 'zomg') } end end rubyforge_command_context "rubyforge_project not configured" do setup do stub(@gemspec).name { 'zomg' } stub(@gemspec).rubyforge_project { nil } end should "raise NoRubyForgeProjectConfigured" do assert_raises Jeweler::NoRubyForgeProjectInGemspecError do @command.run end end end rubyforge_command_context "rubyforge project doesn't exist or not setup in ~/.rubyforge/autoconfig.yml" do setup do stub(@rubyforge).configure stub(@rubyforge).login stub(@rubyforge).create_package('some_project_that_doesnt_exist', 'zomg')do raise RuntimeError, "no <group_id> configured for <some_project_that_doesnt_exist>" end stub(@gemspec).name { 'zomg' } stub(@gemspec).rubyforge_project { 'some_project_that_doesnt_exist' } end should "raise RubyForgeProjectNotConfiguredError" do assert_raises RubyForgeProjectNotConfiguredError do @command.run end end end build_command_context "build for jeweler" do setup do @command = Jeweler::Commands::SetupRubyforge.build_for(@jeweler) end should "assign gemspec" do assert_equal @gemspec, @command.gemspec end should "assign output" do assert_equal @output, @command.output end should "assign rubyforge" do assert_equal @rubyforge, @command.rubyforge end end end end end <file_sep>require 'test_helper' class TestVersionHelper < Test::Unit::TestCase VERSION_TMP_DIR = File.dirname(__FILE__) + '/version_tmp' def self.should_have_version(major, minor, patch) should "have major version #{major}" do assert_equal major, @version_helper.major end should "have minor version #{minor}" do assert_equal minor, @version_helper.minor end should "have patch version #{patch}" do assert_equal patch, @version_helper.patch end version_s = "#{major}.#{minor}.#{patch}" should "render string as #{version_s.inspect}" do assert_equal version_s, @version_helper.to_s end version_hash = {:major => major, :minor => minor, :patch => patch} should "render hash as #{version_hash.inspect}" do assert_equal version_hash, @version_helper.to_hash end end context "VERSION.yml with 3.5.4" do setup do FileUtils.rm_rf VERSION_TMP_DIR FileUtils.mkdir_p VERSION_TMP_DIR build_version_yml VERSION_TMP_DIR, 3, 5, 4 @version_helper = Jeweler::VersionHelper.new VERSION_TMP_DIR end should_have_version 3, 5, 4 context "bumping major version" do setup { @version_helper.bump_major } should_have_version 4, 0, 0 end context "bumping the minor version" do setup { @version_helper.bump_minor } should_have_version 3, 6, 0 end context "bumping the patch version" do setup { @version_helper.bump_patch } should_have_version 3, 5, 5 end end context "Non-existant VERSION.yml" do setup do FileUtils.rm_rf VERSION_TMP_DIR FileUtils.mkdir_p VERSION_TMP_DIR end should "not raise error if the VERSION.yml doesn't exist" do assert_nothing_raised Jeweler::VersionYmlError do Jeweler::VersionHelper.new(VERSION_TMP_DIR) end end context "setting an initial version" do setup do @version_helper = Jeweler::VersionHelper.new(VERSION_TMP_DIR) @version_helper.update_to 0, 0, 1 end should_have_version 0, 0, 1 should "not create VERSION.yml" do assert ! File.exists?(File.join(VERSION_TMP_DIR, 'VERSION.yml')) end context "outputting" do setup do @version_helper.write end should "create VERSION.yml" do assert File.exists?(File.join(VERSION_TMP_DIR, 'VERSION.yml')) end context "re-reading VERSION.yml" do setup do @version_helper = Jeweler::VersionHelper.new(VERSION_TMP_DIR) end should_have_version 0, 0, 1 end end end end def build_version_yml(base_dir, major, minor, patch) version_yaml_path = File.join(base_dir, 'VERSION.yml') File.open(version_yaml_path, 'w+') do |f| version_hash = { 'major' => major.to_i, 'minor' => minor.to_i, 'patch' => patch.to_i } YAML.dump(version_hash, f) end end end <file_sep>class Jeweler module Commands class InstallGem attr_accessor :gemspec_helper, :output def initialize self.output = $stdout end def run command = "sudo gem install #{gemspec_helper.gem_path}" output.puts "Executing #{command.inspect}:" sh command # TODO where does sh actually come from!? end def self.build_for(jeweler) command = new command.output = jeweler.output command.gemspec_helper = jeweler.gemspec_helper command end end end end <file_sep>require 'test_helper' class Jeweler module Commands class TestRelease < Test::Unit::TestCase context "with added files" do setup do @repo = Object.new stub(@repo).checkout(anything) status = Object.new stub(status).added { ['README'] } stub(status).deleted { [] } stub(status).changed { [] } stub(@repo).status { status } @command = Jeweler::Commands::Release.new @command.output = @output @command.repo = @repo @command.gemspec_helper = @gemspec_helper @command.version = '1.2.3' end should 'raise error' do assert_raises RuntimeError, /try commiting/i do @command.run end end end context "with deleted files" do setup do @repo = Object.new stub(@repo).checkout(anything) status = Object.new stub(status).added { [] } stub(status).deleted { ['README'] } stub(status).changed { [] } stub(@repo).status { status } @command = Jeweler::Commands::Release.new @command.output = @output @command.repo = @repo @command.gemspec_helper = @gemspec_helper @command.version = '1.2.3' @command.base_dir = '.' end should 'raise error' do assert_raises RuntimeError, /try commiting/i do @command.run end end end context "with changed files" do setup do @repo = Object.new stub(@repo).checkout(anything) status = Object.new stub(status).added { [] } stub(status).deleted { [] } stub(status).changed { ['README'] } stub(@repo).status { status } @command = Jeweler::Commands::Release.new @command.output = @output @command.repo = @repo @command.gemspec_helper = @gemspec_helper @command.version = '1.2.3' end should 'raise error' do assert_raises RuntimeError, /try commiting/i do @command.run end end end context "after running without pending changes" do setup do @repo = Object.new stub(@repo).checkout(anything) stub(@repo).add(anything) stub(@repo).commit(anything) stub(@repo).push stub(@repo).push(anything) stub(@repo).add_tag(anything) @gemspec_helper = Object.new stub(@gemspec_helper).write stub(@gemspec_helper).path {'zomg.gemspec'} stub(@gemspec_helper).update_version('1.2.3') status = Object.new stub(status).added { [] } stub(status).deleted { [] } stub(status).changed { [] } stub(@repo).status { status } @output = StringIO.new @command = Jeweler::Commands::Release.new @command.output = @output @command.repo = @repo @command.gemspec_helper = @gemspec_helper @command.version = '1.2.3' @command.run end should "checkout master" do assert_received(@repo) {|repo| repo.checkout('master') } end should "refresh gemspec version" do assert_received(@gemspec_helper) {|gemspec_helper| gemspec_helper.update_version('1.2.3') } end should "write gemspec" do assert_received(@gemspec_helper) {|gemspec_helper| gemspec_helper.write } end should "add gemspec to repository" do assert_received(@repo) {|repo| repo.add('zomg.gemspec') } end should "commit with commit message including version" do assert_received(@repo) {|repo| repo.commit("Regenerated gemspec for version 1.2.3") } end should "push repository" do assert_received(@repo) {|repo| repo.push } end should "tag release" do assert_received(@repo) {|repo| repo.add_tag("v1.2.3")} end should "push tag to repository" do assert_received(@repo) {|repo| repo.push('origin', 'v1.2.3')} end end build_command_context "building from jeweler" do setup do @command = Jeweler::Commands::Release.build_for(@jeweler) end should "assign gemspec" do assert_same @gemspec, @command.gemspec end should "assign version" do assert_same @version, @command.version end should "assign repo" do assert_same @repo, @command.repo end should "assign output" do assert_same @output, @command.output end should "assign gemspec_helper" do assert_same @gemspec_helper, @command.gemspec_helper end should "assign base_dir" do assert_same @base_dir, @command.base_dir end end end end end <file_sep>require 'test_helper' class Jeweler module Commands class TestInstallGem < Test::Unit::TestCase build_command_context "build for jeweler" do setup do @command = Jeweler::Commands::InstallGem.build_for(@jeweler) end should "assign gemspec helper" do assert_equal @gemspec_helper, @command.gemspec_helper end should "assign output" do assert_equal @output, @command.output end end end end end <file_sep>class Jeweler class Generator module MicronautMixin def default_task 'examples' end def feature_support_require 'micronaut/expectations' end def feature_support_extend 'Micronaut::Matchers' end def test_dir 'examples' end def test_or_spec 'example' end def test_task 'examples' end def test_pattern 'examples/**/*_example.rb' end end end end <file_sep>require 'yaml' class Jeweler class VersionHelper attr_accessor :base_dir attr_reader :major, :minor, :patch def initialize(base_dir) self.base_dir = base_dir if File.exists?(yaml_path) parse_yaml end end def bump_major @major += 1 @minor = 0 @patch = 0 end def bump_minor @minor += 1 @patch = 0 end def bump_patch @patch += 1 end def update_to(major, minor, patch) @major = major @minor = minor @patch = patch end def write File.open(yaml_path, 'w+') do |f| YAML.dump(self.to_hash, f) end end def to_s "#{major}.#{minor}.#{patch}" end def to_hash { :major => major, :minor => minor, :patch => patch } end def refresh parse_yaml end def yaml_path denormalized_path = File.join(@base_dir, 'VERSION.yml') absolute_path = File.expand_path(denormalized_path) absolute_path.gsub(Dir.getwd + File::SEPARATOR, '') end protected def parse_yaml yaml = read_yaml @major = (yaml['major'] || yaml[:major]).to_i @minor = (yaml['minor'] || yaml[:minor]).to_i @patch = (yaml['patch'] || yaml[:patch]).to_i end def read_yaml if File.exists?(yaml_path) YAML.load_file(yaml_path) else raise VersionYmlError, "#{yaml_path} does not exist!" end end end end <file_sep>class Jeweler class Generator class Options < Hash attr_reader :opts, :orig_args def initialize(args) super() @orig_args = args.clone self[:testing_framework] = :shoulda @opts = OptionParser.new do |o| o.banner = "Usage: #{File.basename($0)} [options] reponame\ne.g. #{File.basename($0)} the-perfect-gem" o.on('--bacon', 'generate bacon specifications') do self[:testing_framework] = :bacon end o.on('--shoulda', 'generate shoulda tests') do self[:testing_framework] = :shoulda end o.on('--testunit', 'generate test/unit tests') do self[:testing_framework] = :testunit end o.on('--minitest', 'generate minitest tests') do self[:testing_framework] = :minitest end o.on('--rspec', 'generate rspec code examples') do self[:testing_framework] = :rspec end o.on('--micronaut', 'generate micronaut examples') do self[:testing_framework] = :micronaut end o.on('--cucumber', 'generate cucumber stories in addition to the other tests') do self[:use_cucumber] = true end o.on('--create-repo', 'create the repository on GitHub') do self[:create_repo] = true end o.on('--rubyforge', 'setup project for rubyforge') do self[:rubyforge] = true end o.on('--summary [SUMMARY]', 'specify the summary of the project') do |summary| self[:summary] = summary end o.on('--directory [DIRECTORY]', 'specify the directory to generate into') do |directory| self[:directory] = directory end o.on_tail('-h', '--help', 'display this help and exit') do self[:show_help] = true end end begin @opts.parse!(args) rescue OptionParser::InvalidOption => e self[:invalid_argument] = e.message end end def merge(other) self.class.new(@orig_args + other.orig_args) end end end end <file_sep>class Jeweler module Commands class BuildGem attr_accessor :base_dir, :gemspec_helper, :file_utils def initialize self.file_utils = FileUtils end def run gemspec = gemspec_helper.parse gem_file_name = Gem::Builder.new(gemspec).build pkg_dir = File.join(base_dir, 'pkg') file_utils.mkdir_p pkg_dir gem_file_name = File.join(base_dir, gem_file_name) file_utils.mv gem_file_name, pkg_dir end def self.build_for(jeweler) command = new command.base_dir = jeweler.base_dir command.gemspec_helper = jeweler.gemspec_helper command end end end end <file_sep>Given 'a working directory' do @working_dir = File.expand_path File.join(File.dirname(__FILE__), '..', '..', 'tmp') FileUtils.rm_rf @working_dir FileUtils.mkdir_p @working_dir end Given /^I use the jeweler command to generate the "([^"]+)" project in the working directory$/ do |name| @name = name return_to = Dir.pwd path_to_jeweler = File.expand_path File.join(File.dirname(__FILE__), '..', '..', 'bin', 'jeweler') begin FileUtils.cd @working_dir @stdout = `#{path_to_jeweler} #{@name}` ensure FileUtils.cd return_to end end Given /^"([^"]+)" does not exist$/ do |file| assert ! File.exists?(File.join(@working_dir, file)) end When /^I run "([^"]+)" in "([^"]+)"$/ do |command, directory| @stdout = `cd #{File.join(@working_dir, directory)}; #{command}` @exited_cleanly = $?.exited? end Then /^the updated version, (\d+\.\d+\.\d+), is displayed$/ do |version| assert_match "Updated version: #{version}", @stdout end Then /^the current version, (\d+\.\d+\.\d+), is displayed$/ do |version| assert_match "Current version: #{version}", @stdout end Then /^the process should exit cleanly$/ do assert @exited_cleanly, "Process did not exit cleanly: #{@stdout}" end Given /^I use the existing project "([^"]+)" as a template$/ do |fixture_project| @name = fixture_project FileUtils.cp_r File.join(fixture_dir, fixture_project), @working_dir end Given /^"VERSION\.yml" contains hash "([^"]+)"$/ do |ruby_string| version_hash = YAML.load(File.read(File.join(@working_dir, @name, 'VERSION.yml'))) evaled_hash = eval(ruby_string) assert_equal evaled_hash, version_hash end <file_sep>require 'jeweler/commands/build_gem' require 'jeweler/commands/install_gem' require 'jeweler/commands/release' require 'jeweler/commands/release_to_rubyforge' require 'jeweler/commands/setup_rubyforge' require 'jeweler/commands/validate_gemspec' require 'jeweler/commands/write_gemspec' require 'jeweler/commands/version/base' require 'jeweler/commands/version/bump_major' require 'jeweler/commands/version/bump_minor' require 'jeweler/commands/version/bump_patch' require 'jeweler/commands/version/write' <file_sep>require 'rake' $LOAD_PATH.unshift('lib') begin require 'jeweler' Jeweler::Tasks.new do |gem| gem.name = "jeweler" gem.summary = "Simple and opinionated helper for creating Rubygem projects on GitHub" gem.email = "<EMAIL>" gem.homepage = "http://github.com/technicalpickles/jeweler" gem.description = "Simple and opinionated helper for creating Rubygem projects on GitHub" gem.authors = ["<NAME>"] gem.files.include %w(lib/jeweler/templates/.document lib/jeweler/templates/.gitignore) gem.add_dependency "peterwald-git" gem.rubyforge_project = "pickles" end rescue LoadError puts "Jeweler, or one of its dependencies, is not available. Install it with: sudo gem install technicalpickles-jeweler -s http://gems.github.com" end require 'rake/testtask' Rake::TestTask.new(:test) do |test| test.pattern = 'test/**/test_*.rb' test.libs << 'test' test.verbose = true #test.ruby_opts << '-rtest_helper' end require 'rake/rdoctask' Rake::RDocTask.new do |rdoc| rdoc.rdoc_dir = 'rdoc' rdoc.title = 'jeweler' rdoc.rdoc_files.include('README.markdown') rdoc.rdoc_files.include('lib/**/*.rb') end begin require 'rcov/rcovtask' Rcov::RcovTask.new(:rcov) do |rcov| rcov.libs << 'test' rcov.pattern = 'test/**/test_*.rb' end rescue LoadError task :rcov do abort "RCov is not available. In order to run rcov, you must: sudo gem install spicycode-rcov" end end begin require 'cucumber/rake/task' Cucumber::Rake::Task.new(:features) rescue LoadError task :features do abort "Cucumber is not available. In order to run features, you must: sudo gem install cucumber" end end begin require 'rake/contrib/sshpublisher' namespace :rubyforge do desc "Release gem and RDoc documentation to RubyForge" task :release => ["rubyforge:release:gem", "rubyforge:release:docs"] namespace :release do desc "Publish RDoc to RubyForge." task :docs => [:rdoc] do config = YAML.load( File.read(File.expand_path('~/.rubyforge/user-config.yml')) ) host = "#{config['<EMAIL>']}@<EMAIL>" remote_dir = "/var/www/gforge-projects/pickles" local_dir = 'rdoc' Rake::SshDirPublisher.new(host, remote_dir, local_dir).upload end end end rescue LoadError puts "Rake SshDirPublisher is unavailable or your rubyforge environment is not configured." end if ENV["RUN_CODE_RUN"] == "true" task :default => [:test, :features] else task :default => :test end
5461391813e36b3b0710861f1e72da08b16685ac
[ "Markdown", "RDoc", "Ruby" ]
41
Ruby
Peeja/jeweler
49fb3b5e222eacdaeabd43c248843b4d2dd288d4
dd82fcebcdf722751fcae38f719069772e9fc58f
refs/heads/master
<file_sep>import time class Game: bothReady = False def __init__(self,p1,p2): self.p1=Player(p1) self.p2=Player(p2) self.grid={} def touch(self,cell,pName): gridCell = self.grid.get((cell.get('x'),cell.get('y'))) if not(gridCell): gridCell={} if self.bothReady: #playing print('!TOUCH!') return elif self.p1.name==pName: #p1 touch print(f'{pName} touch') if not(self.p1.ready): #placing print(f' place {cell}') gridCell['placed'+pName] = not(gridCell.get('placed'+pName)) else: gridCell['ready'+pName] = True elif self.p2.name==pName: #p2 touch print(f'{pName} touch') if not(self.p2.ready): #placing print(f'{pName} place {cell}') gridCell['placed'+pName] = not(gridCell.get('placed'+pName)) else: gridCell['ready'+pName] = True else: print(f'NO PLAYER ? {self.p1.name} {self.p2.name}') self.grid[(cell.get('x'),cell.get('y'))] = gridCell def getGridState(self,pName): for coord in self.grid: self.grid[coord]['state'] = '' for state in cell_states: if self.grid[coord].get(state+pName): self.grid[coord]['state'] = state jsonGrid = {} for key in self.grid: jsonGrid[str(key)]=self.grid.get(key) if self.bothReady: return {'grid':jsonGrid,'turn':(self.p2.name,self.p1.name)[self.p1.active]} else: return {'grid':jsonGrid} def drawGrid(self,grid,canvas,gridSize,cellNb): global cell_states cellSize = gridSize/cellNb for x in range(0,cellNb+1): dX = x*cellSize canvas.create_line(0,dX,gridSize,dX) canvas.create_line(dX,0,dX,gridSize) for cStr in grid: c = tupleFromStr(cStr) color = cell_states.get(grid.get(cStr).get('state')) canvas.create_rectangle(c[0]*cellSize,c[1]*cellSize,(c[0]+1)*cellSize,(c[1]+1)*cellSize,fill=color) def readyClient(self,getPlayers): self.p1.ready = True c = 100 while c > 0: c-=1 time.sleep(1) players = getPlayers() for p in players: if p.get('name') == self.p2.name and p.get('ready'):#all good return return def readyServer(self,pName): if self.p1.name == pName: self.p1.ready = True elif self.p2.name == pName: self.p2.ready = True self.bothReady = self.p1.ready and self.p2.ready if self.bothReady: self.p1.active = True def getPlayers(self): return [self.p1,self.p2] class Player: ready = False active = False def __init__(self,name): self.name = name cell_states = { 'placed':'#b3b3cc', 'ready':'#4d4d33', 'missed':'#a3c2c2', 'touched':'#ffa64d', 'sunk':'#ff1a25' } def tupleFromStr(str): str = str.replace('(','') str = str.replace(')','') t = tuple(list(map(lambda i : int(i),str.split(', ')))) return t<file_sep>import requests import json from math import * from tkinter import * import lobby import game api_url = 'http://localhost:8082' size = 600 gridSize = 500 cellNb = 10 cellSize = gridSize/cellNb opponent = None ready = False lobby = lobby.Lobby() battle = None drawInterval = None def cellFromMouseClick(event): return (floor(event.x/cellSize),floor(event.y/cellSize)) def onclick(event): global battle if not(battle): return cell = cellFromMouseClick(event) if cell[0]>=cellNb or cell[1]>=cellNb: return requests.post(api_url+'/touch',data=json.dumps({'x':cell[0],'y':cell[1]}),headers=headers()) drawCanvasBattle() # def drawCanvasBattle(): # global ready # canvas.delete("all") # drawGrid() # if not(ready): # txt = canvas.create_text(510,20,text='I am Ready'+' '+opt,anchor='w') # canvas.tag_bind(txt,'<Button-1>',ready) # grid = requests.get(api_url+'/grid',headers=headers()).json()['grid'] # for cell in grid: # if not(ready): # canvas.create_rectangle(b[0]*cellSize,b[1]*cellSize,(b[0]+1)*cellSize,(b[1]+1)*cellSize,fill='#eeeeee') # else: # if cell[2] == name: canvas.create_rectangle(cell[0]*cellSize,cell[1]*cellSize,(cell[0]+1)*cellSize,(cell[1]+1)*cellSize,fill='#00ffbe') # else: canvas.create_rectangle(cell[0]*cellSize,cell[1]*cellSize,(cell[0]+1)*cellSize,(cell[1]+1)*cellSize,fill='#ff00be') # canvas.after(50,drawCanvasBattle) def readyPlayer(event): req = requests.post(api_url+'/ready',headers=headers()) if req.status_code == 200: battle.readyClient(getPlayers) # def placeBoat(event): # cell = cellFromMouseClick(event) # boats.append(cell) def getGrid(): return requests.get(api_url+'/grid',headers=headers()).json() def drawCanvasBattle(): canvas.delete("all") canvas.create_text(gridSize+20,20,text='En combat avec '+battle.p2.name,anchor='w') grid = getGrid() print(f'{grid}') if not(battle.bothReady): ready = canvas.create_text(gridSize+20,50,text='=> Prêt! ',anchor='w') canvas.tag_bind(ready,'<Button-1>',readyPlayer) elif grid.get('turn'): canvas.create_text(gridSize+20,50,text='=> A '+grid.get('turn')+' de jouer !',anchor='w') battle.drawGrid(grid['grid'],canvas,gridSize,cellNb) def getPlayers(): return requests.get(api_url+'/players',headers=headers()).json()['players'] def drawCanvasLobby(): global drawInterval players = getPlayers() for p in players: if p.get('requestAccepted'): initGame(p.get('name')) return lobby.setPlayers(players) canvas.delete("all") canvas.create_text(size/2,20,text='Interface de '+name,anchor='center') lobby.draw(canvas,sendPlayerRequest) drawInterval = canvas.after(50,drawCanvasLobby) def initGame(opp): global battle canvas.bind('<Button-1>', onclick) canvas.after_cancel(drawInterval) battle = game.Game(name,opp) drawCanvasBattle() def sendPlayerRequest(evt,player): accept = requests.post(api_url+'/request',data=json.dumps({'name':player.name}),headers=headers()).json()['accept'] if accept: initGame(player.name) def headers(): head = { 'Content-Type': 'application/json', 'User-Agent': 'fuck', 'Accept': 'application/json', 'clientName' : name } if battle: head['opponent']=battle.p2.name return head print("Enter your name here:") name = input() res = requests.post(api_url+'/join',headers=headers()) if(res.status_code == 200): print(f'Joined successfully') else: print('There was a problem connection to the server') window = Tk() window.title("Battleship") window.resizable(0,0) canvas = Canvas(window,width=size,height=size,bd=0,highlightthickness=0) canvas.pack() drawCanvasLobby() window.mainloop() <file_sep>class Lobby: players = {} requests = {} # Server def join(self, name): self.players[name] = Player(name) # return accepted or not def request(self, fromP, toP): if not(fromP) or not(toP): pass accept = bool(self.requests.get(toP.name) and fromP.name in self.requests.get(toP.name)) if not(self.requests.get(fromP.name)): self.requests[fromP.name] = [] self.requests[fromP.name].append(toP.name) return accept def getPlayers(self,forPlayer = None): ps = [] for pName in self.players: if pName == forPlayer: continue p = self.players.get(pName) forAskTo = self.requests.get(forPlayer) and pName in self.requests.get(forPlayer) toAskFor = self.requests.get(pName) and forPlayer in self.requests.get(pName) if forAskTo and toAskFor: p.requestAccepted = True elif forAskTo: p.requestSend = True elif toAskFor: p.requestNeed = True ps.append(p) return ps def fromName(self, pName): return self.players.get(pName) # Client def setPlayers(self, players): for p in players: self.players[p.get('name')] = Player(p.get('name'),p.get('requestSend'), p.get('requestNeed')) # return state button to send request def draw(self, canvas,actionMethod): y = 100 for pName in self.players: p = self.players.get(pName) opt = '=> <NAME>' fill = 'black' if p.requestSend: fill = '#0a7ddb' opt = 'Requète envoyé..' elif p.requestNeed: fill = '#20c528' opt = '=> Joue maintenant!' canvas.create_text(50, y, text=p.name, anchor='w') state = canvas.create_text(50, y+10, text=opt, fill=fill, anchor='w') def action(evt, player = p): return actionMethod(evt, player) canvas.tag_bind(state, '<Button-1>', action) y += 30 return state class Player: def __init__(self, name, requestSend = False, requestNeed = False,requestAccepted = False): self.name=name # Server # Client self.requestSend=requestSend self.requestNeed=requestNeed self.requestAccepted = requestAccepted <file_sep>from http.server import * import json import lobby import game client_id = 0 class BattleshipHandler(BaseHTTPRequestHandler): battles = {} lobby = lobby.Lobby() def htmlThis(self, htmlBody): return """<!DOCTYPE html> <head> <meta charset="utf-8"></meta> <title>BLOUBLOU</title> </head> <body> """+htmlBody+""" </body> </html> """ def returnHtml(self, htmlStr): self.wfile.write(bytes(htmlStr.encode(encoding='utf-8'))) def do_GET(self): path = self.path if path == '/grid': self.sendGridState() elif path == '/players': self.sendPlayerList() def do_POST(self): path = self.path self.ok() if path == '/join': self.lobby.join(self.headers['clientName']) elif path == '/request': response = self.data() fromP = self.player() toP = self.player(response.get('name')) accept = self.lobby.request(fromP, toP) if accept: self.battles[(fromP.name, toP.name)] = game.Game(fromP.name, toP.name) self.wfile.write(json.dumps({'accept': accept}).encode(encoding='utf-8')) elif path == '/touch': cell = self.data() battle = self.getGame() battle.touch(cell,self.headers['clientName']) elif path == '/ready': battle = self.getGame() battle.readyServer(self.headers['clientName']) def player(self, name=None): if name == None: name = self.headers['clientName'] return self.lobby.fromName(name) def ok(self): self.send_response(200) self.end_headers() def sendGridState(self): battle = self.getGame() # for t in self.battles: # if (t[0]==name or t[1]==name) && (!self.battles[t].p1.ready or !self.battles[t].p2.ready): content = {} self.send_response(200) self.send_header('Content-type', 'application/json') self.end_headers() self.wfile.write(json.dumps(battle.getGridState(self.headers['clientName'])).encode(encoding='utf-8')) def getGame(self): p1 = self.headers['clientName'] p2 = self.headers['opponent'] p1p2 = self.battles.get((p1, p2)) p2p1 = self.battles.get((p2, p1)) if p1p2: return p1p2 if p2p1: return p2p1 return None def sendPlayerList(self): self.send_response(200) self.send_header('Content-type', 'application/json') self.end_headers() g = self.getGame() if g: self.wfile.write(json.dumps({'players': jsonPlayers(self.getGame().getPlayers())}).encode(encoding='utf-8')) else: self.wfile.write(json.dumps({'players': jsonPlayers(self.lobby.getPlayers(self.headers['clientName']))}).encode(encoding='utf-8')) def data(self): content_length = int(self.headers['Content-Length']) post_data = self.rfile.read(content_length) return json.loads(post_data) def jsonPlayers(players): return list(map(lambda p: p.__dict__, players)) class Game: def __init__(self, p1, p2): self.p1 = p1 self.p2 = p2 port = 8082 print('Listening on localhost:%s' % port) server = HTTPServer(('', port), BattleshipHandler) server.serve_forever()
b26a11a07e4199b0409e7d25227de86cf87580f9
[ "Python" ]
4
Python
Biratus/py-mutli-battleship
cd8bb040e77a4b547841ef87d7163f0edd946b4b
0e0a6cff19df790077bbf9d84b85d46266283930
refs/heads/master
<file_sep>require 'roo/excelx/cell/base' require 'roo/excelx/cell/empty' class TestRooExcelxCellEmpty < Minitest::Test def empty Roo::Excelx::Cell::Empty end end <file_sep>require 'simplecov' # require deps require 'tmpdir' require 'fileutils' require 'minitest/autorun' require 'shoulda' require 'fileutils' require 'timeout' require 'logger' require 'date' require 'webmock/minitest' # require gem files require 'roo' TESTDIR = File.join(File.dirname(__FILE__), 'files') # very simple diff implementation # output is an empty string if the files are equal # otherwise differences a printen (not compatible to # the diff command) def file_diff(fn1,fn2) result = '' File.open(fn1) do |f1| File.open(fn2) do |f2| while f1.eof? == false and f2.eof? == false line1 = f1.gets.chomp line2 = f2.gets.chomp result << "<#{line1}\n>#{line2}\n" if line1 != line2 end if f1.eof? == false while f1.eof? == false line1 = f1.gets result << "<#{line1}\n" end end if f2.eof? == false while f2.eof? == false line2 = f2.gets result << ">#{line2}\n" end end end end result end class File def File.delete_if_exist(filename) if File.exist?(filename) File.delete(filename) end end end
109dde7ddae74570e2cb6cc93adc9a0518cd1eda
[ "Ruby" ]
2
Ruby
rogsmith/roo
daaadf7669b723e4fe7864995c2e977ea93b83f8
ae347068be26a4ddd5835d476e750c6b3e6416ac
refs/heads/master
<file_sep>// No cambies los nombres de las funciones. function sumaTodosImpares(array) { // La funcion llamada 'sumaTodosImpares' recibe como argumento un array de enteros. // y debe devolver la suma total entre todos los numeros impares. // ej: // sumaTodosImpares([1, 5, 2, 9, 6, 4]) devuelve 1 + 5 + 9 = 15 // Tu código aca: var resultado = 0; for (var i = 0; i < array.length; i++) { if(array[i]%2 == 1){ resultado = resultado + array[i]; } } return resultado; } function stringMasLarga(str) { // La función llamada 'stringMasLarga', recibe como argumento un frase (string) 'str' // y debe devolver la palabra (string) más larga que haya en esa frase (Es decir el de mayor cantidad de caracteres) // Ej: // stringMasLarga('Ayer fui a pasear a una plaza') debe retornar 'pasear' // stringMasLarga('Me gusta mucho javascript') debe retornar 'javascript' // Tip: podes usar el metodo de String 'split' // Tu código aca: var palabraMasLarga = ""; var arrayString = str.split(" "); for (var i = 0; i < arrayString.length; i++) { if(arrayString[i].length > palabraMasLarga.length){ palabraMasLarga = arrayString[i]; } } return palabraMasLarga; } function estaOffline(usuarios, nombre) { // La funcion llamada "estaOffline" recibe como argumento un array de objetos llamado 'usuarios' y un string llamada 'nombre'. // cada objeto tiene una property 'nombre' que es un string y otra llamada 'online' que es un booleano. // La función debe retornar true si el usuario se encuentra offline, de lo contrario false. // ej: // var usuarios = [ // { // nombre: 'toni', // online: true // }, // { // nombre: 'emi', // online: true // }, // { // nombre: 'agus', // online: false // } // ]; // estaOffline(usuarios, 'agus') retorna true // estaOffline(usuarios, 'emi') retorna false // Tu código aca: var estaOffline = true; for (var i = 0; i < usuarios.length; i++) { if(usuarios[i].nombre == nombre){ if(usuarios[i].online == "true" || usuarios[i].online == true){ estaOffline = false; } } } return estaOffline; } function actividadesEnComun(persona1, persona2) { // La funcion llamada 'actividadesEnComun' recibe como argumento dos arrays de actividades (strings) llamados 'persona1' y 'persona2' // y debe devolver un array de strings con las actividades en comun ( aquellas que se repiten ) entre cada array. // ej: persona1 = ['leer', 'comer', 'pasear', 'dormir', 'jugar'] // persona2 = ['comer', 'dormir', 'futbol'] // actividadesEnComun(persona1, persona2) => ['comer', 'dormir'] // Tip: podes usar ciclos for anidados. // Tu código aca: //Esta funcion lo que hace es comparar los dos array, primero toma cada elemento del primer array, //y lo compara con cada elemento del segundo, a medida que machean, lo va agregandoa interseccion. var inteseccion = persona1.filter(element => persona2.includes(element)); return inteseccion; } function buscaDestruye(arreglo, num) { // La funcion 'buscaDestruye' recibe como argumento un array de enteros 'arreglo' y un entero 'num'. // Esta funcion tiene que eliminar los numeros del array que coincidan el numero recibido como argumento. // La función debe retornar el array sin los números sacados. // Ej: buscaDestruye([1, 2, 3, 4], 2) devuelve => [1, 3, 4] // Nota: Si el numero se repite mas de una vez, tambien hay que eliminarlo. // Ej: buscaDestruye([1, 2, 3, 4, 1], 1) devuelve => [2, 3, 4] // // Tu código aca: var i = 0; while (i < arreglo.length) { if (arreglo[i] === num) { arreglo.splice(i, 1); } else { ++i; } } return arreglo; } function sumarElTipo(arreglo) { // La funcion llamada 'sumarElTipo' recibe un array de strings como argumento // que contiene tipos de vehiculos y debe devolver un objeto con la cantidad // de veces que se repita cada tipo. // El objeto que devuelve tiene como propiedades el nombre de cada vehiculo y su valor es la cantidad de veces que se repite. // Ej: // sumarElTipo(['auto', 'moto', 'auto']); debe retornar {auto: 2, moto: 1} // Tip: podes usar el ciclo for o el metodo de Array 'reduce' // Tu código aca: } // ======================================================================= function crearClaseEmprendedor() { class Emprendedor { constructor(nombre, apellido, libros, mascotas) { // El constructor de la clase Emprendedor recibe nombre (string), apellido (string), libros (array de objetos), mascotas (array de strings) // Inicializar las propiedades del emprendedor con los valores recibidos como argumento // Tu código aca: } addMascota(mascota) { // este método debe agregar una mascota (mascota) al arreglo de mascotas del emprendedor. // no debe retornar nada. // Tu código aca: } getMascotas() { // El método 'getMascotas' debe retornar la cantidad de mascotas que tiene el emprendedor. // Ej: // Suponiendo que el emprendedor tiene estas mascotas: ['perro', 'gato'] // emprendedor.getMascotas() debería devolver 2 // Tu código aca: } addBook(book, autor) { // El método 'addBook' recibe un string 'book' y un string 'autor' y debe agregar un objeto: // { nombre: book, autor: autor} al arreglo de libros del emprendedor. // No debe retornar nada. // Tu código aca: } getBooks() { // El método 'getBooks' debe retornar un arreglo con sólo los nombres del arreglo de libros del emprendedor. // Ej: // Suponiendo que el emprendedor tiene estos libros: [{nombre: 'El señor de las moscas',autor: '<NAME>'}, {nombre: 'Fundacion', autor: '<NAME>'}] // emprendedor.getBooks() debería devolver ['El señor de las moscas', 'Fundacion'] // Tu código aca: } getFullName() { // El metodo getFullName debe retornar un string con el nombre y apellido del emprendedor. // ej: // Suponiendo que el emprendedor tiene: nombre: 'Elon' y apellido: 'Musk' // emprendedor.getFullName() deberia devolver '<NAME>' // Tu código aca: } } return Emprendedor; } function mapear() { // Escribi una funcion mapear en el prototipo del objeto global 'Array' // que recibe una funcion callback , que se ejecuta por cada elemento del array // mapear los elementos de ese array segun la funcion callback // Esta funcion tiene que devolver un array nuevo con los elementos mapeados. // NO USAR LA FUNCION MAP DE ARRAYS. // ej: // var numeros = [1, 2, 3, 4]; // numeros.mapear(function(numero) { // return numero + 1; // }) devuelve [2, 3, 4, 5] // Tu código aca: } // No modificar nada debajo de esta línea // -------------------------------- module.exports = { sumaTodosImpares, buscaDestruye, actividadesEnComun, estaOffline, stringMasLarga, sumarElTipo, crearClaseEmprendedor, mapear };
baea972fb8e50557a0ef623cf781cd126e5f23c7
[ "JavaScript" ]
1
JavaScript
corbalanmagui/cp.prep.jiya
0f9f8f54df321f9428e04bab7ef240e849eadeee
185b563a5432d06822ad8e37010a05dbd84e1a6b
refs/heads/master
<repo_name>alexneustein/music-creation-app-backend<file_sep>/app/controllers/api/v1/song_rooms_controller.rb class Api::V1::SongRoomsController < ApplicationController def index @song_rooms = SongRoom.all render json: @song_rooms end def show @song_room = SongRoom.find(params[:id]) render json: @song_room end def create @song_room = SongRoom.new(song_rooms_params) # can't hit byebug, why does my params want a "song_room" if @song_room.save @lyric_message = LyricMessage.create(song_room_id: @song_room.id) @music_message = MusicMessage.create(song_room_id: @song_room.id) render json: @song_room end end private def song_rooms_params params.require(:song_room).permit(:lyricist_id, :musician_id, :song_name) end end <file_sep>/app/channels/musics_channel.rb class MusicsChannel < ApplicationCable::Channel def subscribed # stream_from "some_channel" stream_from "musics_channel" end def unsubscribed # Any cleanup needed when channel is unsubscribed end def send_text(data) MusicMessage.create(content: data['content'], username: data['username']) # ActionCable.server.broadcast('chat_messages_channel', content: data['content'], username: data['username']) ActionCable.server.broadcast('musics_channel', content: data['content'], username: data['username'] ) end end <file_sep>/app/channels/lyrics_channel.rb class LyricsChannel < ApplicationCable::Channel def subscribed stream_from "lyrics" end def unsubscribed # Any cleanup needed when channel is unsubscribed end def receive(data) lyric_message = LyricMessage.find(data["id"]) lyric_message.update!(content: data["content"]) ActionCable.server.broadcast('lyric_messages', data) end end <file_sep>/app/controllers/api/v1/music_messages_controller.rb class Api::V1::MusicMessagesController < ApplicationController def index @music_messages = MusicMessage.all render json: @music_messages end def create @music_message = MusicMessage.new(@music_message_params) serialized_data = MusicChannel.find(@music_message_params[:music_channel_id]) if @music_message.save serialized_data = ActiveModelSerializers::Adapter::Json.new( MusicMessageSerializer.new(@music_message) ).serializable_hash MusicMessagesChannel.broadcast_to 'musics_channel', serialized_data head :ok end end def update # byebug @music_message = MusicMessage.find(params[:id]) @music_message.update(content: params["content"]) render json: @music_message end private def music_message_params params.require(:music_message).permit(:music_channel_id, :content) end end <file_sep>/db/migrate/20180910171143_create_lyric_messages.rb class CreateLyricMessages < ActiveRecord::Migration[5.2] def change create_table :lyric_messages do |t| t.integer :song_room_id t.text :content end end end <file_sep>/app/controllers/application_controller.rb class ApplicationController < ActionController::API include ActionController::Serialization before_action :authorized def encode_token(payload) JWT.encode({user_id: @user.id}, 'flatiron') end def auth_headers request.headers['Authorization'] end def decoded_token if auth_headers token = auth_headers begin JWT.decode(token, 'flatiron') rescue nil end end end def current_user if decoded_token payload = decoded_token[0] @user = User.find(payload['user_id']) else nil end end def logged_in !!current_user end def authorized render json: {message: 'Invalid Credentials'}, status: :unauthorized unless logged_in end end <file_sep>/app/models/user.rb class User < ApplicationRecord # has_secure_password # validates :username has_secure_password validates :username, uniqueness: { case_sensitive: false} has_many :lyricist_song_rooms, class_name: 'SongRoom', foreign_key: 'lyricist_id' has_many :musician_song_rooms, class_name: 'SongRoom', foreign_key: 'musician_id' has_many :lyric_messages, through: :lyricist_song_rooms, :foreign_key => :song_room_id has_many :music_messages, through: :musician_song_rooms, :foreign_key => :song_room_id def format {username: self.username, id: self.id} end # has_many :lyric_messages, through: :lyricist_song_rooms # # has_many :music_messages, through: :music_song_rooms # has_many :music_channels, through: :song_rooms # has_many :lyric_channels, through: :song_rooms end <file_sep>/app/serializers/music_message_serializer.rb class MusicMessageSerializer < ActiveModel::Serializer attributes :id, :song_room_id, :content, :song_room, :musician # belongs_to :music_channel, # serializer: MusicMessageSerializer, include_nested_associations: true end <file_sep>/config/routes.rb Rails.application.routes.draw do namespace :api do namespace :v1 do # resources :music_channels resources :users resources :music_messages resources :song_rooms # resources :lyric_channels resources :lyric_messages post '/login', to: 'auth#login' get '/reauth', to: 'auth#reauth' # post '/login', to: 'auth/login' mount ActionCable.server => '/cable' end end end <file_sep>/app/models/lyric_message.rb class LyricMessage < ApplicationRecord belongs_to :song_room, foreign_key: :song_room_id has_one :lyricist, :class_name => 'User', through: :song_room, :foreign_key => :lyricist_id end <file_sep>/db/migrate/20180910140603_create_song_rooms.rb class CreateSongRooms < ActiveRecord::Migration[5.2] def change create_table :song_rooms do |t| t.integer :lyricist_id t.integer :musician_id t.string :song_name t.timestamps end end end <file_sep>/app/serializers/song_room_serializer.rb class SongRoomSerializer < ActiveModel::Serializer attributes :id, :lyricist_id, :musician_id, :song_name, :lyric_message, :music_message # has_one :music_channel # has_one :music_message # has_one :lyric_channel # has_one :lyric_message # belongs_to :music_channel, # serializer: MusicMessageSerializer, include_nested_associations: true end <file_sep>/app/controllers/api/v1/lyric_messages_controller.rb class Api::V1::LyricMessagesController < ApplicationController def index @lyric_messages = LyricMessage.all render json: @lyric_messages end def create @lyric_message = LyricMessage.new(@lyric_message_params) serialized_data = LyricChannel.find(@lyric_message_params[:lyric_channel_id]) if @lyric_message.save serialized_data = ActiveModelSerializers::Adapter::Json.new( LyricMessageSerializer.new(@lyric_message) ).serializable_hash LyricMessagesChannel.broadcast_to 'lyrics_channel', serialized_data head :ok end end def update # byebug @lyric_message = LyricMessage.find(params[:id]) @lyric_message.update(content: params["content"]) render json: @lyric_message end private def lyric_message_params params.require(:lyric_message).permit(:lyric_channel_id, :content) end end <file_sep>/app/models/music_message.rb class MusicMessage < ApplicationRecord belongs_to :song_room, foreign_key: :song_room_id has_one :musician, :class_name => 'User', through: :song_room, :foreign_key => :musician_id # https://github.com/QMaximillian/music-creation-app-backend/blob/master/app/controllers/api/v1/musics_controller.rb # # https://stackoverflow.com/questions/40957889/rails-5-api-undefined-method-user-url end <file_sep>/app/models/song_room.rb class SongRoom < ApplicationRecord belongs_to :lyricist, class_name: 'User' belongs_to :musician, class_name: 'User' has_one :music_message has_one :lyric_message # has_one :music_channel # has_one :lyric_channel # # # # has_one :lyric_message, through: :lyric_channel # has_one :music_message, through: :music_channel # has_many :music_messages, through: :music_channel end <file_sep>/app/controllers/api/v1/auth_controller.rb class Api::V1::AuthController < ApplicationController skip_before_action :authorized, only: [:login] def login @user = User.find_by(username: auth_params['username']) if @user && @user.authenticate(auth_params['password']) token = encode_token({user_id: @user.id}) render json: {user: @user.format, jwt: token}, status: :created else render json: {message: 'Invalid Username or Password'}, status: :unauthorized end end def reauth render json: { user: @user.format }, status: :accepted # token = request.headers['Authorization'] # decoded_token = JWT.decode(token, '<PASSWORD>') # user_id = decoded_token[0]['user_id'] # @user = User.find(user_id) # if @user # render json: {user: @user.format}, status: :accepted # else # render json: {message: 'Invalid Credentials'}, status: :unauthorized # end end private def auth_params params.require(:user).permit(:username, :password) end end <file_sep>/db/seeds.rb # This file should contain all the record creation needed to seed the database with its default values. # The data can then be loaded with the rails db:seed command (or created alongside the database with db:setup). # # Examples: # # movies = Movie.create([{ name: 'Star Wars' }, { name: 'Lord of the Rings' }]) # Character.create(name: 'Luke', movie: movies.first) User.create(username: 'Quinn', password: '1') User.create(username: 'Marlon', password: '2') User.create(username: 'Octothorpes', password: '3') SongRoom.create(musician_id: 1, lyricist_id: 2, song_name: "Idea 1") SongRoom.create(musician_id: 2, lyricist_id: 1, song_name: "Idea 2") SongRoom.create(lyricist_id: 3, musician_id: 3, song_name: "Idea 3") LyricMessage.create(song_room_id: 1, content: "Heart and Soul") LyricMessage.create(song_room_id: 2, content: "") LyricMessage.create(song_room_id: 3, content: "") MusicMessage.create(song_room_id: 1, content: "") MusicMessage.create(song_room_id: 2, content: "Oops, I, changed state again") MusicMessage.create(song_room_id: 3, content: "") <file_sep>/app/serializers/user_serializer.rb class UserSerializer < ActiveModel::Serializer attributes :id, :username, :password_digest, :lyricist_song_rooms, :musician_song_rooms, :lyric_messages, :music_messages # has_many :song_rooms # has_many :music_channels, through: :song_rooms # # has_many :music_messages, through: :music_channel # has_many :lyric_channels, through: :song_rooms # has_many :lyric_messages, through: :song_rooms # def song_rooms # customized_song_rooms = [] # # object.song_rooms.each do |song_room| # custom_song_room = song_room.attributes # # custom_song_room[:music_channel] = song_room.music_channel.slice(:song_room_id, :name) # custom_song_room[:music_message] = # song_room.music_message # customized_song_rooms.push(custom_song_room) # end # return customized_song_rooms # end end
87d244175094a24fdf83c40f6a9763ce541c0a9a
[ "Ruby" ]
18
Ruby
alexneustein/music-creation-app-backend
359a454677914a91bf4972ae34ec19c6e057ba62
d29b8d894b256f3ba259c56e839a3d48d57c3c81
refs/heads/master
<file_sep>#include<bits/stdc++.h> #include<string.h> using namespace std; class Student{ public: int id,acm_participation,acm_solve,checkapply=0,applicable=0; char name[20]; void input_student_info(void) { char n[20]; int a,b,c,z=0; //cout<<"Enter in this format name<space>id<space>acmparti<space>acm problem solve no"<<endl; cin>>n>>b>>a>>c>>z; strcpy(name,n); id=b; acm_participation=a; acm_solve=c; checkapply=z; } void displayinfo(void) { cout<<"Student name :"<<name<<"\nid :"<<id<<"\nAcm participation :"<<acm_participation<<"\nAcm solve :"<<acm_solve<<endl; } }; int main() { int i,j,k; cout<<"Enter Total Student No:"<<endl; cin>>i; Student a[i]; cout<<"Enter in this format name<space>id<space>\nAcm participation<space>acm problem solve no<space>press 1 if student applied,otherwise press 0"<<endl; for(j=0;j<i;j++) { a[j].input_student_info(); if(a[j].checkapply==1&&a[j].acm_participation>2&&a[j].acm_solve>300) { a[j].applicable=1; } } cout<<"Eligible student as coach\n.................................................."<<endl; for(k=0;k<i;k++) { if(a[k].applicable==1) {a[k].displayinfo();} cout<<".................................................."<<endl; } return 0; } <file_sep>#include<bits/stdc++.h> #include<string.h> using namespace std; class Student{ public: int acm_solve,id,hnrboard=0; double gpa; char name[20]; void input_student_info(void) { char n[20]; double a; int b,c; //cout<<"Enter in this format name<space>id<space>Gpa<space>acm problem solve no"<<endl; cin>>n>>b>>a>>c; strcpy(name,n); id=b; gpa=a; acm_solve=c; } void displayinfo(void) { cout<<"Student name:"<<name<<"\nid :"<<id<<"\nGpa :"<<gpa<<"\nAcm solve :"<<acm_solve<<endl; } }; int main() { int i,j,k; cout<<"Enter Student No:"<<endl; cin>>i; Student a[i]; cout<<"Enter in this format name<space>id<space>Gpa<space>acm problem solve no"<<endl; for(j=0;j<i;j++) { a[j].input_student_info(); if(a[j].gpa>=3.50&&a[j].acm_solve>99) { a[j].hnrboard=1; } } cout<<"HONOR BOARD\n.................................................."<<endl; for(k=0;k<i;k++) { if(a[k].hnrboard==1) a[k].displayinfo(); cout<<".................................................."<<endl; } return 0; } <file_sep>#include<bits/stdc++.h> #include<string.h> using namespace std; class Person{ public: int i,meal; double deposit,cost,give=0,get=0,giveorget=0; char name[20]; display(){ cout<<"Member name:\t"<<name<<"\nDeposit :\t"<<deposit<<"\nmeal :\t"<<meal<<"\ncost :\t"<<cost<<endl; cout<<name<<" have to give "<<give<<" tk and get "<<get<<" tk"<<endl; } void enter(void){ int i,p; char s[20]; cin>>s>>i>>p; strcpy(name,s); deposit=i; meal=p; } }; int main() { int i,j,sumofmeal=0,k,x,y; double sumofdeposit=0,permealrate=0,bazar; /* cout<<"press 1 to add data\npress 2 to display data\npress 3 to terminate\n"; cin>>k; if(k==1) {*/ cout<<"Adding member Details...\n Enter no of members\n"; cin>>i; Person a[i]; for(j=0;j<i;j++) { cout<<"Enter in this format \"name<space>deposit<space>meal\" of member "<<j+1<<"no"<<endl; a[j].enter(); sumofmeal+=a[j].meal; sumofdeposit+=a[j].deposit; } cout<<"Enter total Bazar cost\n"; cin>>bazar; permealrate=bazar/sumofmeal; cout<<permealrate<<endl; for(j=0;j<i;j++) { a[j].cost=permealrate*a[j].meal; a[j].giveorget=a[j].deposit-a[j].cost; if(a[j].giveorget>=0) { a[j].get=a[j].giveorget; } else { a[j].give=abs(a[j].giveorget); } } cout<<"press 1 to display data\n"; cin>>k; if(k==1) { for(int f=0;f<i;f++) { cout<<f+1<<". "<<a[f].name<<endl; } cout<<"Enter ID no\n Press 555 to Terminate"; while(1) { cin>>x; if(x==555) break; else if(x>i) cout<<"Error ,Press again correctly"<<endl; else { a[x-1].display(); } } } return 0; }
64577c013aaa0d89b4fd27227e289893bb305955
[ "C++" ]
3
C++
nahidul803/Kamal-sir-lab-report
831d43f372c2b4e88cbb39ff590544bc0d9ae7e4
63100f9e5e99931e84beefbbe7692c5f1fd64e35
refs/heads/master
<file_sep>import React from 'react'; import ReactDOM from 'react-dom'; import TodoList from './components/TodoComponents/TodoList'; import TodoForm from './components/TodoComponents/TodoForm'; class App extends React.Component { // you will need a place to store your state in this component. // design `App` to be the parent component of your application. // this component is going to take care of state, and any change handlers you need to work with your state constructor(props) { super(props) this.state = { stateTodos: [ { task: 'Organize Garage', id: 1528817077286, completed: false }, { task: 'Bake Cookies', id: 1528817084358, completed: false } ], newTodo: '' }; } changeHandler = event => { console.log(event.target.value) this.setState({ [event.target.name]: event.target.value }) } addNewTodo = event => { event.preventDefault(); this.setState({ stateTodos: [...this.state.stateTodos, {task: this.state.newTodo}], newTodo: '' }) } render() { return ( <div> <h2>Welcome to your Todo App!</h2> <TodoList todosProps={this.state.stateTodos} /> <TodoForm addTodo={this.changeHandler} newTodo={this.state.newTodo} addNewTodo={this.addNewTodo} /> </div> ); } } export default App; <file_sep>import React from 'react'; import TodoList from './TodoList'; function Todo(props) { return ( <li>{props.propsTodo.task}</li> ) } export default Todo;
16e109f80e466816a900b6bfe03507d602cc625a
[ "JavaScript" ]
2
JavaScript
txiong000/React-Todo
7105d81d5e4d9352769bae7be3e6ffca1616b266
8d301a43bcd73dbf8144f73ee27b067c80c6ba33
refs/heads/master
<file_sep>import csv import numpy as np import pandas as pd from code_review import * from predictcode import * from flask import Flask, render_template,request app = Flask(__name__,template_folder='templates') @app.route('/') def index(): return render_template("index.html") @app.route('/getCode',methods=["POST"]) def getCode(): req = request.form lang = req.get("lang") code = req.get("code") features = main(code,lang) result = features CSV_filename = "A.csv" #Filename of the CSV file which should include outputs. lst= list(features.values()) lst.pop(1) q = arr_input(lst) lst.append(int(q[0])) features['Result']=int(q[0]) #Uncomment for adding result in tht output. result = features with open(CSV_filename, 'a+', newline='') as file: writer = csv.writer(file) writer.writerow(lst) return render_template("reviews.html", lang =lang, code = code,res = result) if __name__=='__main__': app.run(host="0.0.0.0", port="2456") #change host and port accordingly. <file_sep># Code Reviewer # ## STEPS: ## 1.Create a virtual environment <code> $ py -m venv env </code> and activate it by <code> $ .\env\Scripts\activate </code> <br/> 2.In the environment install the following libraries(flask, scikit-learn, lizard, numpy, pandas). <br/> 3.Change in app.py to the csv file in which output should be taken.<br/> 4.Run<code>$ python app.py</code><br/> - - - - ## Requirements for running the code- all can be installed using pip ## 1. flask <br> 2. sklearn <br> 3. lizard <br> 4. numpy <br> 5. pandas <br> - - - - ## Code is divided into 3 parts- ## * app.py: Flask app <br/> * code_review.py: Genrating Halstead Metrics and Cyclomatic Complexity <br/> * predict_code.py: For giving output as good or bad using trained model <br/> - - - - ## Explanation: ## * app.py renders the HTML and CSS UI and handles the routing og templates.<br/> * app.py calls main() function in code_review.py which returns the features of user code.<br/> * code_review.py uses codeparams functions to calculate halstead metrics and Mccabe Cyclomatic complexity.<br/> * After calculating code parameters app.py call arr_input() from predictcode.py.<br/> * arr_input() predicts the output based on the code metrices.<br/> * In arr_input() function saved trained model is stored in form .sav and we use it for prediction.<br/> <file_sep>#!/usr/bin/python3 import math import re from math import log2 import lizard def ccn(code,lang,val): lst={} names=[] extension="zz" if(lang=="python"): extension+=".py" elif(lang=="csharp"): extension+=".cs" elif(lang=="c"): extension+=".c" elif(lang=="javascript"): extension+=".js" elif(lang=="typescript"): extension+=".ts" elif(lang=="cpp"): extension+=".cpp" i = lizard.analyze_file.analyze_source_code(extension,code) a = (len(i.function_list)) z = i.function_list max=0 for j in range(a): if(z[j].__dict__['cyclomatic_complexity']>max): max = z[j].__dict__['cyclomatic_complexity'] names.append(z[j].__dict__['name']) val['CyclomaticComplexity']=max val['FuncNames']=names return def removeComments(line,lang): if(lang=="python"): pattern = re.compile("\#.*") if (re.search(pattern, line)): s = line.index("#") line = line[:s] z = line a = [x.start() for x in re.finditer(r"\"\"\"", line)] for i in range(0,len(a),2): z = z.replace(line[a[i]:a[i+1]+3],"") t=z b = [x.start() for x in re.finditer(r"\'\'\'", t)] for i in range(0,len(b),2): t = t.replace(z[b[i]:b[i+1]+3],"") line=t return line else: pattern = r""" //.*?$ | /\*[^*]*\*+([^/*][^*]*\*+)*/|("(\\.|[^"\\])*"|'(\\.|[^'\\])*'|.[^/"'\\]*) """ regex = re.compile(pattern, re.VERBOSE|re.MULTILINE|re.DOTALL) noncomments = [m.group(2) for m in regex.finditer(line) if m.group(2)] return "".join(noncomments) def codeparams(code,lang): operatorsFileName = "operator_"+ lang # print("operator filename:"+operatorsFileName) q=code # Calculate CCN val={} ccn(q,lang,val) # print("ccn:",cyclomatic_n) operators = {} operands = {} with open(operatorsFileName) as f: for op in f: operators[op.replace('\n','')] = 0 code = removeComments(code,lang) t=code.split("\n") # print(t) for line in t: line = line.strip("\n").strip(' ') # print(line) if(line!=""): if(lang == "c" or lang == "cpp"): pattern = re.compile("\#include\s*<.*>") if(re.search(pattern,line)): s = line.index("<")+1 e = line.index(">") sub = line[s:e] if sub in operands.keys(): operands[sub] = operands[sub] + 1 else: operands[sub] = 1 line = line.replace(sub,"") pattern = re.compile("\#\s*define\s*") mas = pattern.finditer(line) l1 = [] for i in mas: l1.append(list(i.span())) for j in l1: temps = line[j[1]:] temps = temps.split() searchpat = re.compile("[A-Za-z,_]") m1 = searchpat.finditer(temps[1]) z1 =[] for x in m1: z1.append(list(x.span())) if(len(z1)==0): if(temps[0] in operands.keys()): operands[temps[0]] +=1 else: operands[temps[0]] =1 else: if(temps[0] in operators.keys()): operators[temps[0]+" "] +=1 else: operators[temps[0]+" "] =1 if(len(l1)!=0): line = line[l1[0][0]:l1[0][1]].replace(" ","") if(line in operators.keys()): operators[line]+=1 else: operators[line] =1 line = "" if(lang=="cpp" or lang=="csharp"): pat = re.compile(r"\s*[a-zA-z_]*\s*<[a-zA-z,_]*>") ma = pat.finditer(line) z1 =[] for i in ma: z1.append(list(i.span())) key = line[i.span()[0]:i.span()[1]].replace(" ","")+" " if(key in operators): operators[key] +=1 else: operators[key]=1 line = re.sub(r"\s*[a-zA-z_]*\s*<[a-zA-z,_]*>"," ",line) # For Strings st = line s ="" l =[] for i in range(len(st)): if(st[i]=='"' or st[i]=="'"): key = st[i] if(key in operators): operators[key] +=1 else: operators[key]=1 l.append(i) if(len(l)!=0): s += st[0:l[0]] for i in range(2,len(l)): if(i%2==0): s+=st[l[i-1]+1:l[i]] for j in range(1,len(l)): temp = st[l[j-1]+1:l[j]] if(j%2==1): if temp in operands: operands[temp] = operands[temp] + 1 else: operands[temp] = 1 s+=st[l[-1]+1:] if(len(l)!=0): line = s for key in operators.keys(): operators[key] = operators[key] + line.count(key) line = line.replace(key,' ') for key in line.split(): if key in operands: operands[key] = operands[key] + 1 else: operands[key] = 1 operators['"']=operators['"']//2 operators["'"]=operators["'"]//2 n1, N1, n2, N2 = 0, 0, 0, 0 # print("OPERATORS:\n") for key in operators: if(operators[key] > 0): if(key not in ")}]"): n1, N1 = n1 + 1, N1 + operators[key] # print("{} = {}".format(key, operators[key])) # print("\nOPERANDS\n") for key in operands.keys(): if(operands[key] > 0): n2, N2 = n2 + 1, N2 + operands[key] # print("{} = {}".format(key, operands[key])) if(n1==0): val['CyclomaticComplexity']=-1 val['Vocabulary']= -1 val['volume']= -1 val['length']= -1 val['difficulty']= -1 val['IntelligenceCount'] = -1 val['effort'] = -1 val['time'] = -1 val['UniqueOperators']=-1 val['UniqueOperands']=-1 val['TotalOperators']=-1 val['TotalOperands']=-1 return val else: # val['CyclomaticComplexity']=cyclomatic_n val['Vocabulary']= n1 + n2 val['volume']= (N1 + N2) * log2(n1 + n2) val['length']= (N1 + N2) val['difficulty']= (n1 * N2) / (2 * n2) val['IntelligenceCount'] = val['volume'] / val['difficulty'] val['effort'] = val['difficulty'] * val['volume'] val['time'] = val['effort'] / (18) val['UniqueOperators']=n1 val['UniqueOperands']=n2 val['TotalOperators']=N1 val['TotalOperands']=N2 return val def main(code,lang): lst = codeparams(code,lang) # print(lst) return lst <file_sep>import numpy as np import pandas as pd import pickle from sklearn.svm import SVC def arr_input(arr): arr=np.asarray(arr) arr=arr.reshape(1,-1) classifier = pickle.load(open("SVM.sav", 'rb')) y_pred = classifier.predict(arr) arr = list(arr) arr.append(y_pred) # print(y_pred) return y_pred <file_sep>import numpy as np import pandas as pd from sklearn.model_selection import train_test_split from sklearn.svm import SVC import pickle def train_dataset(): data = pd.read_csv('Jm1.csv') parameters=data[['v(g)','n','v','l','d','i','e','t','n1', 'n2', 'N1', 'N2']] X = np.asarray(parameters) y = np.asarray(data['result']) X_train, X_test, y_train, y_test = train_test_split(X, y, test_size = 0.20, random_state=1) classifier = SVC(kernel='rbf',gamma=0.001,C=1000) classifier.fit(X_train,y_train) pickle.dump(classifier, open("SVM.sav", 'wb')) train_dataset() #This is only used while training dataset periodically.
84df918fd6e6dcfeb6a795e0d558d6310a4b42a1
[ "Markdown", "Python" ]
5
Python
aishna-agrawal/Code_Reviewer
00301339e7843dbb2a5fdd3095aa15421d94a62d
df935f742b0158eef5271bab81df9f69358021d6
refs/heads/master
<repo_name>pitchinvasion/graph<file_sep>/node.rb # Copyright 2016 by <NAME>. May be copied with this notice, but not used in classroom training. require_relative './link' require_relative './path' # Understands it's neighbors class Node def initialize @links = [] end def >(neighbor_cost_pair) @links << Link.new(*neighbor_cost_pair) neighbor_cost_pair.first end def reach?(destination) _path(destination, no_visited_nodes, Path::CHEAPEST) != Path::NONE end def hop_count(destination) path_to(destination, Path::SHORTEST).hop_count end def cost(destination) path_to(destination, Path::CHEAPEST).cost end def path_to(destination, strategy = Path::CHEAPEST) result = _path(destination, no_visited_nodes, strategy) raise "Unreachable" if result == Path::NONE result end def _path(destination, visited_nodes, strategy) return Path.new if self == destination return Path::NONE if visited_nodes.include? self @links.map do |link| link._path(destination, visited_nodes.dup << self, strategy) end.min(&strategy) || Path::NONE end private def no_visited_nodes [] end end <file_sep>/path.rb # Understands how to get from one node to another node class Path SHORTEST = -> (champion, challenger) { champion.hop_count <=> challenger.hop_count } CHEAPEST = -> (champion, challenger) { champion.cost <=> challenger.cost } #LONGEST = -> (champion, challenger) { challenger.hop_count <=> #champion.hop_count } attr_reader :links protected :links def initialize(links = []) @links = links end def prepend(link) @links.unshift(link) self end def hop_count @links.length end def cost Link.total_cost(@links) end class UnreachablePath UNREACHABLE = Float::INFINITY def prepend(other) self end def cost UNREACHABLE end def hop_count UNREACHABLE end end NONE = UnreachablePath.new end <file_sep>/link.rb # Copyright 2015 by <NAME>. May be copied with this notice, but not used in classroom training. # Understands a way to reach a neighboring Node class Link attr_reader :target, :cost private :target, :cost def self.total_cost(links) links.map { |link| link.send(:cost) }.inject(0, :+) end def initialize(target, cost) @target, @cost = target, cost end def _path(destination, visited_nodes, total_strategy) @target._path(destination, visited_nodes, total_strategy).prepend(self) end end <file_sep>/graph_test.rb # Copyright 2016 by <NAME>. May be copied with this notice, but not used in classroom training. require 'minitest/autorun' require_relative './node' # Confirms behavior of graphical behaviors of Nodes class GraphTest < Minitest::Test ('A'..'H').each { |label| const_set label.to_sym, Node.new } B > [A, 7] B > [C, 4] > [D, 5] > [E, 2] > [B, 3] > [F, 8] > [H, 9] C > [D, 1] C > [E, 6] def test_can_reach assert(A.reach? A) refute(A.reach? B) refute(G.reach? B) assert(B.reach? A) assert(C.reach? H) refute(B.reach? G) end def test_hop_count assert_equal(0, A.hop_count(A)) assert_equal(1, B.hop_count(A)) assert_equal(4, C.hop_count(H)) assert_raises(RuntimeError) { A.hop_count(B) } assert_raises(RuntimeError) { G.hop_count(B) } assert_raises(RuntimeError) { B.hop_count(G) } end def test_cost assert_equal(0, A.cost(A)) assert_equal(7, B.cost(A)) assert_equal(23, C.cost(H)) assert_raises(RuntimeError) { A.cost(B) } assert_raises(RuntimeError) { G.cost(B) } assert_raises(RuntimeError) { B.cost(G) } end def test_path_to assert_path(0, 0, A, A) assert_path(1, 7, B, A) assert_path(5, 23, C, H) assert_raises(RuntimeError) { A.path_to(B) } assert_raises(RuntimeError) { G.path_to(B) } assert_raises(RuntimeError) { B.path_to(G) } end private def assert_path(expected_hop_count, expected_cost, source, destination) path = source.path_to(destination) assert_equal(expected_hop_count, path.hop_count) assert_equal(expected_cost, path.cost) end end
d307a001be4718013b44848b5445535414ac609f
[ "Ruby" ]
4
Ruby
pitchinvasion/graph
96fe40492fa2a9161e7318dc13d38ed9169d9aec
a841a91b76967c9ce5f01b4069bbb29137159db9
refs/heads/master
<file_sep>const path = require('path'); const node_ssh = require('node-ssh'); // 连接远端服务器 const shell = require('shelljs'); // 在本地执行shell命令 const chalk = require('chalk'); // 修改控制台中字符串的样式 const ora = require('ora'); // 优雅的进度等待插件(类似于loading) const deployConfig = require('./deployConfig'); const ssh = new node_ssh(); /* 连接服务器 */ async function connectSSH() { try { console.log('开始连接服务器'); await ssh.connect(deployConfig.sshConfig); console.log('服务器连接成功'); //let pathObj = analysisPath(); } catch (e) { console.log('连接服务器异常', e); process.exit(); } } /* 解析相关路径 */ function analysisPath() { // 获取压缩包名字 let zipName = deployConfig.zipPath.split('.')[0].split('\\'); zipName = zipName[zipName.length - 1]; // 压缩包后缀 let zipSuffix = deployConfig.zipPath.split('.'); zipSuffix = zipSuffix[zipSuffix.length - 1]; // 获取发包目录的上一级目录 let deployPathParentPath = getParentDirPath(deployConfig.deployPath); let obj = { zipName, zipSuffix, // 压缩包存储目录 zipStorageDir: deployConfig.zipStoragePath ? deployConfig.zipStoragePath : deployPathParentPath, zipBackupName: deployConfig.zipBackupName ? deployConfig.zipBackupName : zipName + '_backup' }; // console.log(obj); return obj; } /* 获取指定目录的上一级目录 */ function getParentDirPath(path) { let parentPath = path.split('/'); parentPath.pop(); parentPath = parentPath.join('/'); return parentPath; } /* 根据文件夹路径获取文件夹名称 */ function getDirNameByPath(path) { let pathArr = path.split('/'); let dirName = pathArr[pathArr.length - 1]; return dirName; } /* 判断文件或目录是否存在于指定文件夹 */ async function fileOrDirExistInDir(fileOrDir, dirPath) { // 获取回来的目录列表是以 \n 进行分割的 let fileList = await execCommand('ls', dirPath); fileList = fileList.split('\n'); // 判断文件或目录是否存在 let fileOrDirExist = fileList.indexOf(fileOrDir) > -1; return fileOrDirExist; } /* 判断文件夹是否为空 */ async function isDirEmpty(dirPath) { let fileNum = await execCommand('ls -l ./|grep "^-"|wc -l', dirPath); let dirNum = await execCommand('ls -l ./|grep "^d"|wc -l', dirPath); // console.log('num', fileNum, dirNum, fileNum == 0 && dirNum == 0); return (fileNum == 0 && dirNum == 0); } /* 在服务器上执行xshell脚本命令 */ function execCommand(commandStr, cwd) { if (cwd) { // 传递了 cwd 属性表示进入指定目录并执行commandStr命令,如果没有指定目录则默认为登录的用户目录 return ssh.exec(commandStr, [], {cwd}); } else { return ssh.exec(commandStr); } } /* 部署至服务器 */ async function deployBySSH() { await connectSSH(); let pathObj = analysisPath(); console.log('准备上传压缩包!'); let deployDirName = getDirNameByPath(deployConfig.deployPath); let zipStorageDirName = getDirNameByPath(pathObj.zipStorageDir); // 存放前端代码目录的父级目录 let deployDirParent = getParentDirPath(deployConfig.deployPath); let zipStorageDirParent = getParentDirPath(pathObj.zipStorageDir); // 判断存放前端代码目录是否存在 let deployDirExist = await fileOrDirExistInDir(deployDirName, deployDirParent); let zipDirExist = await fileOrDirExistInDir(zipStorageDirName, zipStorageDirParent); // 压缩包名称 let zipFileFullName = `${pathObj.zipName}.${pathObj.zipSuffix}`; // 压缩包在服务端存储的路径 let zipStorageFullPath = pathObj.zipStorageDir + `/${zipFileFullName}`; // 上传压缩包并解压 let uploadFileAndUnzip = async function () { const spinner = ora('压缩包上传中...'); await ssh.putFile(deployConfig.zipPath, zipStorageFullPath); spinner.stop(); console.log(chalk.green('压缩包上传成功')); if (deployDirExist) { let dirEmpty = await isDirEmpty(deployConfig.deployPath); console.log('dirEmpty', dirEmpty); if (dirEmpty) { console.log('执行解压压缩包命令'); await execCommand(`unzip -o ${zipFileFullName} -d ${deployConfig.deployPath}`, pathObj.zipStorageDir); console.log(chalk.green('解压压缩包完成,发包完成!')); } else { console.log('清空前端代码目录', deployConfig.deployPath); await execCommand('rm * -r', deployConfig.deployPath); console.log('执行解压压缩包命令'); await execCommand(`unzip -o ${zipFileFullName} -d ${deployConfig.deployPath}`, pathObj.zipStorageDir); console.log(chalk.green('解压压缩包完成,发包完成!')); } } else { console.log('创建前端代码目录'); await execCommand(`mkdir ${deployDirName}`, deployDirParent); console.log('执行解压压缩包命令'); await execCommand(`unzip -o ${zipFileFullName} -d ${deployConfig.deployPath}`, pathObj.zipStorageDir); console.log(chalk.green('解压压缩包完成,发包完成!')); } process.exit(); // 退出流程 }; /* 如果压缩包存放目录与前端代码的目录一致 1、判断前端代码目录是否存在,如果不存在则新建该目录 2、再判断前端代码的目录里面是否有压缩包,如果有则将其拷贝到上一层目录并重命名,作为备份。 3、然后将前端代码目录里面的文件清空,再把压缩包上传到该目录中 3、执行解压压缩包命令 4、将之前拷贝到上一层目录的备份压缩包剪切到前端代码目录中 */ if (pathObj.zipStorageDir === deployConfig.deployPath) { // 压缩包在服务端存储的路径2 let zipStorageFullPath2 = deployConfig.deployPath + `/${zipFileFullName}`; // 上传文件并解压 let uploadZipAndUnzip = async function () { //console.log('正在上传zip文件'); const spinner = ora('压缩包上传中...'); // 上传文件 await ssh.putFile(deployConfig.zipPath, zipStorageFullPath2); spinner.stop(); console.log(chalk.green('压缩包上传成功')); console.log('执行解压压缩包命令'); await execCommand(`unzip -o ${zipFileFullName} -d ${deployConfig.deployPath}`, pathObj.zipStorageDir); console.log(chalk.green('解压压缩包完成,发包完成!')); }; if (deployDirExist) { let zipFileExist = await fileOrDirExistInDir(zipFileFullName, deployConfig.deployPath); let dirEmpty = await isDirEmpty(deployConfig.deployPath); if (zipFileExist) { // 将旧的压缩包重命名 await execCommand(`mv ${zipFileFullName} ${zipFileFullName}.bak`, deployConfig.deployPath); // 将重命名后的旧压缩包移动到上一层目录,以作备份 await execCommand(`mv ${zipFileFullName}.bak ${deployDirParent}`, deployConfig.deployPath); console.log('清空前端代码目录', deployConfig.deployPath); // 清空前端代码目录 await execCommand('rm * -r', deployConfig.deployPath); await uploadZipAndUnzip(); // 将移动到上一层目录的备份压缩包文件移动回前端代码目录,移动前先进行重命名 await execCommand(`mv ${zipFileFullName}.bak ${pathObj.zipBackupName}.${pathObj.zipSuffix}`, deployDirParent); console.log('将移动到上一层目录的备份压缩包文件进行重命名'); await execCommand(`mv ${pathObj.zipBackupName}.${pathObj.zipSuffix} ${deployConfig.deployPath}`, deployDirParent); console.log('将移动到上一层目录的备份压缩包文件移动回前端代码目录'); } else { if (!dirEmpty) { console.log('清空前端代码目录', deployConfig.deployPath); // 清空前端代码目录 await execCommand('rm * -r', deployConfig.deployPath); } await uploadZipAndUnzip(); } } else { console.log('创建前端代码目录'); await execCommand(`mkdir ${deployDirName}`, deployDirParent); await uploadZipAndUnzip(); } process.exit(); } else { /* 如果压缩包存放目录与前端代码目录不一致 1、判断压缩包存放目录是否存在,如果不存在则新建该目录,并将压缩包上传至该目录 2、判断压缩包存放目录中是否已有压缩包,如果有则将其备份并重命名 3、删除原来的压缩包,并将压缩包上传至该目录 4、判断前端代码目录是否存在,如果不存在则新建该目录,如果存在则将该目录清空 5、将上传的压缩包解压到前端代码目录中 */ if (zipDirExist) { let zipExist = await fileOrDirExistInDir(zipFileFullName, pathObj.zipStorageDir); if (zipExist) { // 备份原先的压缩包 await execCommand(`cp ${zipFileFullName} ${pathObj.zipBackupName}.${pathObj.zipSuffix}`, pathObj.zipStorageDir); // 删除原先的压缩包 await execCommand(`sudo rm -f ${zipFileFullName}`, pathObj.zipStorageDir); await uploadFileAndUnzip(); } else { await uploadFileAndUnzip(); } } else { // console.log('存储压缩包文件夹不存在,立即创建该文件夹'); // 存储压缩包文件夹不存在,立即创建该文件夹 await execCommand(`mkdir ${zipStorageDirName}`, zipStorageDirParent); await uploadFileAndUnzip(); } } } /* 发布 */ async function deploy() { if(deployConfig.npmScript){ // 使用shell插件进入本地项目根目录 shell.cd(path.resolve(__dirname, '../')); console.log(chalk.cyan(`开始运行 ${deployConfig.npmScript} 命令`)); const shellRes = await shell.exec(deployConfig.npmScript); if (shellRes.code == 0) { console.log(chalk.cyan(`${deployConfig.npmScript} 命令运行完成,开始走发包流程`)); try { await deployBySSH(); let timer = setTimeout(() => { clearTimeout(timer); shell.exec('exit'); // 关闭命令行,这里不知道为什么走不了 }, 1000); }catch (e) { process.exit(); // 退出流程 console.log(chalk.red('自动发包失败!')); console.log(chalk.red(e)); } } else { console.log(chalk.red(`${deployConfig.npmScript} 命令运行出错,请检查!`)); process.exit(); // 退出流程 } }else{ try { await deployBySSH(); let timer = setTimeout(() => { clearTimeout(timer); shell.exec('exit'); // 关闭命令行,这里不知道为什么走不了 }, 1000); }catch (e) { process.exit(); // 退出流程 console.log(chalk.red('自动发包失败!')); console.log(chalk.red(e)); } } } //connectSSH(); //analysisPath(); //deployBySSH(); deploy(); <file_sep># webfront-auto-deploy 基于nodejs写的一个web前端自动发包小工具 ![自动发包效果图](./assetes/node-auto-deploy.gif); # 使用说明 + 将`auto-deploy`目录拷贝至你的项目根目录中 + 编辑`auto-deploy`目录下的`deployConfig.js` ```$xslt // 需上传的压缩包的路径 const zipPath = '../xxx.zip'; // 发包配置 module.exports = { sshConfig: { // 具体配置见 https://www.npmjs.com/package/node-ssh host: 'xxx.xxx.xxx.xxx', // 服务器地址 username: 'xxx', // 服务器用户名,如root privateKey: <KEY>', // 方式一:使用密钥文件连接服务器。连接服务器的密钥文件,一般是以.pem结尾 // password: 'xxx', //方式二 用密码连接服务器 }, /* 需要运行的npm脚本命令(如:npm run build),自动发包会在该命令执行完成后再执行。在该命令中一般可以生产压缩包文件, 压缩包文件未生成是上传不了的 */ npmScript: 'npm run build', deployPath: '/xxx/xxx/xxx/xxx', // 服务器端前端包存储目录,如: /mnt/data/www/testNodeDeploy zipPath: path.resolve(__dirname, zipPath), // 要上传的压缩包路径 zipStoragePath: '', // 服务器端压缩包存储目录, 默认为deployPath的上一级目录 zipBackupName: '', // 服务器端压缩包备份名称,默认为 压缩包名称+_backup }; ``` + 在项目根目录打开命令行终端,输入`node ./auto-deploy/autoDeploy.js`然后敲回车执行即可 <file_sep>const path = require('path'); // 需上传的压缩包的路径 const zipPath = '../node_deploy.zip'; // 发包配置 module.exports = { sshConfig: { // 具体配置见 https://www.npmjs.com/package/node-ssh host: '172.16.17.32', // 服务器地址 username: 'root', // 服务器用户名 privateKey: '../ecs-key-hongkong.pem', // 方式一:使用密钥文件连接服务器。连接服务器的密钥文件,一般是以.pem结尾 // password: '', //方式二 用密码连接服务器 }, npmScript: 'npm run build', // 需要运行的npm脚本命令(如:npm run build),自动发包会在该命令执行完成后再执行 deployPath: '/mnt/data/www/testNodeDeploy', // 服务器端前端包存储目录 zipPath: path.resolve(__dirname, zipPath), // 要上传的压缩包路径 zipStoragePath: '/mnt/data/www/aaa', // 服务器端压缩包存储目录, 默认为deployPath的上一级目录 zipBackupName: '', // 服务器端压缩包备份名称,默认为 压缩包名称+_backup };
35f1f6998cc5f4b1a34b1d041e8d37b1c638e28c
[ "JavaScript", "Markdown" ]
3
JavaScript
941477276/webfront-auto-deploy
67881415a3565956756f6bf6fe624d1efb572e6d
9ee5b56794ec10a4528e6db926b160e169878238
refs/heads/master
<repo_name>joshlong/kotlin-and-spring-livelessons<file_sep>/README.md # Kotlin and Spring Livelessons ## Kotlin Everywhere * How I Learned to Stop Worrying and Love Kotlin * A Tour of the Ecosystem ## Kotlin, the Language * Syntax * Coroutines ## Kotlin as a Better Java * Motivations * JdbcTemplate * Exposed ORM ## Kotlin DSLs and Spring * Motivations * Reactive Web * Gateway * Functional Configuration * Spring Fu <file_sep>/4.0/reactive/src/main/kotlin/com/example/reactive/ReactiveApplication.kt package com.example.reactive import kotlinx.coroutines.reactive.asFlow import org.springframework.boot.SpringApplication import org.springframework.boot.autoconfigure.SpringBootApplication import org.springframework.boot.runApplication import org.springframework.cloud.gateway.route.builder.RouteLocatorBuilder import org.springframework.cloud.gateway.route.builder.filters import org.springframework.cloud.gateway.route.builder.routes import org.springframework.context.ConfigurableApplicationContext import org.springframework.context.annotation.Bean import org.springframework.context.support.beans import org.springframework.data.annotation.Id import org.springframework.data.mongodb.core.mapping.Document import org.springframework.data.repository.reactive.ReactiveCrudRepository import org.springframework.http.HttpHeaders import org.springframework.web.reactive.function.server.ServerResponse import org.springframework.web.reactive.function.server.bodyAndAwait import org.springframework.web.reactive.function.server.coRouter @Document data class Customer(@Id val id: String, val name: String) interface CustomerRepository : ReactiveCrudRepository<Customer, String> @SpringBootApplication class ReactiveApplication fun main(args: Array<String>) { runApplication<ReactiveApplication>(*args) { val context = beans { bean { ref<RouteLocatorBuilder>().routes { route { host("*.spring.io") and path("/proxy") filters { setPath("/guides") addResponseHeader(HttpHeaders.ACCESS_CONTROL_ALLOW_ORIGIN, "*") } uri("https://spring.io") } } } bean { val customerRepository = ref<CustomerRepository>() coRouter { GET("/customers") { ServerResponse.ok().bodyAndAwait(customerRepository.findAll().asFlow()) } } } } addInitializers(context) } }<file_sep>/4.0/fu/src/test/kotlin/com/example/fu/FuApplicationTests.kt package com.example.fu import org.junit.jupiter.api.Test import org.springframework.boot.test.context.SpringBootTest @SpringBootTest class FuApplicationTests { @Test fun contextLoads() { } } <file_sep>/3.0/jdbc/src/main/kotlin/com/example/jdbc/JdbcApplication.kt package com.example.jdbc import org.jetbrains.exposed.spring.SpringTransactionManager import org.jetbrains.exposed.sql.SchemaUtils import org.jetbrains.exposed.sql.Table import org.jetbrains.exposed.sql.select import org.jetbrains.exposed.sql.selectAll import org.springframework.beans.factory.InitializingBean import org.springframework.boot.autoconfigure.SpringBootApplication import org.springframework.boot.context.event.ApplicationReadyEvent import org.springframework.boot.runApplication import org.springframework.context.annotation.Bean import org.springframework.context.annotation.Profile import org.springframework.context.event.EventListener import org.springframework.jdbc.core.JdbcTemplate import org.springframework.jdbc.core.RowMapper import org.springframework.jdbc.core.queryForObject import org.springframework.stereotype.Component import org.springframework.stereotype.Service import org.springframework.transaction.PlatformTransactionManager import org.springframework.transaction.annotation.Transactional import org.springframework.transaction.support.TransactionTemplate import javax.sql.DataSource @SpringBootApplication class JdbcApplication { @Bean fun springTransactionManager(ds: DataSource) = SpringTransactionManager(ds) @Bean fun transactionTemplate(ptm: PlatformTransactionManager) = TransactionTemplate(ptm) } object Customers : Table("customer") { val id = integer("id").primaryKey() val name = varchar("name", 255) } @Service @Transactional class ExposedOrmCustomerService(val transactionTemplate: TransactionTemplate) : CustomerService, InitializingBean { override fun afterPropertiesSet() { this.transactionTemplate.execute { SchemaUtils.create(Customers) } } override fun all(): List<Customer> = Customers .selectAll() .map { Customer(it[Customers.id], it[Customers.name]) } override fun byId(id: Int): Customer? = Customers .select { Customers.id.eq(id) } .map { Customer(it[Customers.id], it[Customers.name]) } .firstOrNull() } @Service @Profile("jdbcTemplate") class JdbcCustomerService(val jdbcTemplate: JdbcTemplate) : CustomerService { override fun all() = this.jdbcTemplate.query("select * from customer") { resultSet, _ -> Customer(resultSet.getInt("id"), resultSet.getString("name")) } override fun byId(id: Int): Customer? = this.jdbcTemplate.queryForObject("select * from customer where id = ?", id) { resultSet, _ -> Customer(resultSet.getInt("id"), resultSet.getString("name")) } } data class Customer(val id: Int, val name: String) interface CustomerService { fun all(): List<Customer> fun byId(id: Int): Customer? } @Component class Initializer(val customerService: CustomerService) { @EventListener(ApplicationReadyEvent::class) fun ready() { this.customerService.all().forEach { println(this.customerService.byId(it.id)) } } } fun main(args: Array<String>) { runApplication<JdbcApplication>(*args) } <file_sep>/3.0/jdbc/src/main/resources/application.properties spring.datasource.url=jdbc:postgresql://localhost/orders spring.datasource.username=orders spring.datasource.password=<PASSWORD> spring.datasource.driver-class-name=org.postgresql.Driver <file_sep>/1.0/kotlin-native/build.gradle.kts plugins { kotlin("multiplatform") version "1.3.61" } repositories { mavenCentral() } kotlin { // For ARM, preset function should be changed to iosArm32() or iosArm64() // For Linux, preset function should be changed to e.g. linuxX64() // For MacOS, preset function should be changed to e.g. macosX64() macosX64("CSVParser") { binaries { // Comment the next section to generate Kotlin/Native library (KLIB) instead of executable file: executable("CSVParserApp") { // Change to specify fully qualified name of your application's entry point: entryPoint = "sample.csvparser.main" runTask?.args("./European_Mammals_Red_List_Nov_2009.csv", "4", "100") } } } } // Use the following Gradle tasks to run your application: // :runCSVParserAppReleaseExecutableCSVParser - without debug symbols // :runCSVParserAppDebugExecutableCSVParser - with debug symbols <file_sep>/4.0/fu/src/main/kotlin/com/example/fu/FuApplication.kt package com.example.fu import org.springframework.boot.WebApplicationType import org.springframework.boot.context.event.ApplicationReadyEvent import org.springframework.data.mongodb.core.ReactiveMongoTemplate import org.springframework.data.mongodb.core.findAll import org.springframework.fu.kofu.application import org.springframework.fu.kofu.mongo.reactiveMongodb import org.springframework.fu.kofu.webflux.webFlux import org.springframework.web.reactive.function.server.body import reactor.core.publisher.Flux val app = application(WebApplicationType.REACTIVE) { webFlux { router { val repository = ref<CustomerRepository>() GET("/customers") { ok().body(repository.all()) } GET("/greetings/{name}") { ok().bodyValue("Hello, ${it.pathVariable("name")}!") } } codecs { string() jackson { indentOutput = true } } } listener<ApplicationReadyEvent> { val repository = ref<CustomerRepository>() Flux .just("A", "B", "C") .map { Customer(null, it) } .flatMap { repository.insert(it) } .subscribe { println("saving ${it.id} having name ${it.name}") } } reactiveMongodb() beans { bean<CustomerRepository>() } } class CustomerRepository(private val reactiveMongoTemplate: ReactiveMongoTemplate) { fun all(): Flux<Customer> = this.reactiveMongoTemplate.findAll() fun insert(c: Customer) = this.reactiveMongoTemplate.save(c) } data class Customer(val id: String? = null, val name: String) fun main(args: Array<String>) { app.run(args) }
9099f83edfcfb112c7b015c7fad578f6115b3de7
[ "Markdown", "Kotlin", "INI" ]
7
Markdown
joshlong/kotlin-and-spring-livelessons
1057d46e928e3c383207a690767881f6b68956e7
4787907853feda1cc09856da63ca384ef1b7c69a
refs/heads/master
<file_sep>/* * rimPath.h * Rim IO * * Created by <NAME> on 10/30/08. * Copyright 2008 __MyCompanyName__. All rights reserved. * */ #ifndef INCLUDE_RIM_PATH_H #define INCLUDE_RIM_PATH_H #include "rimFileSystemConfig.h" //########################################################################################## //************************* Start Rim File System Namespace ****************************** RIM_FILE_SYSTEM_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class representing a path to a file or directory in the local file system (not networked, etc). class Path { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructors /// Create a path corresponding to the root directory Path(); /// Create a path from the specified NULL-terminated path string. /** * This path string is parsed into a sequence of path elements for easier manipulation. */ Path( const Char* newPathString ); /// Create a path from the specified path string. /** * This path string is parsed into a sequence of path elements for easier manipulation. */ Path( const UTF8String& newPathString ); /// Create a path from an existing path plus the child path specified in the second parameter. /** * This creates a new path which consists of all path components from the first path * plus any additional path components specified by the second path parameter. */ Path( const Path& path, const Path& children ); /// Create a path from an existing path plus the child path string specified in the second parameter. /** * This creates a new path which consists of all path components from the first path * plus any additional path components specified by the second path parameter. */ Path( const Path& path, const UTF8String& children ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Path Equality Comparison Operators /// Return whether or not this path is equal to another. RIM_INLINE Bool operator == ( const Path& other ) const { return pathString == other.pathString; } /// Return whether or not this path is not equal to another. RIM_INLINE Bool operator != ( const Path& other ) const { return !(*this == other); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Path String Accessor Methods /// Return the full string representing this path. RIM_INLINE const UTF8String& toString() const { return pathString; } /// Return the full string representing this path. RIM_INLINE const UTF8String& getString() const { return pathString; } /// Convert this path to a string object. RIM_INLINE operator const UTF8String& () const { return this->toString(); } /// Convert this path to an ASCII string object. /** * This conversion may result in corruption of the path string if * any unicode characters are present in the string */ RIM_INLINE operator String () const { return String(this->toString()); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Path Name Accessor Methods /// Return the name of the file or directory specified by this path. /** * This name is last component of the path string. */ RIM_INLINE UTF8String getName() const { if ( this->isRoot() ) return UTF8String("/"); else { const PathComponent& component = components.getLast(); return UTF8String( pathString.getPointer() + component.startIndex, component.numCharacters ); } } /// Return the base name of the file or directory specified by this path before any file extension. /** * The returned string is the same as if the extension (if it exists) had been removed from * the output of getName(). */ UTF8String getBaseName() const; /// Return a string representing the extension of this paths's file name. /** * The extension is defined as the characters after the last period '.' * in the last component of the path string, if present. If there is no * extension, the empty string is returned. */ UTF8String getExtension() const; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Path Component Accessor Methods /// Return the number of components that make up this path. RIM_INLINE Size getComponentCount() const { return components.getSize(); } /// Return the name of path component at the specified depth in the path heirarchy. /** * If a depth of 0 is specified, the name of the path's last component is returned. * A depth of 1 returns the name of the parent component of the last component and so on. */ RIM_INLINE UTF8String getComponentAtDepth( Index depth ) const { RIM_DEBUG_ASSERT_MESSAGE( depth < components.getSize(), "Cannot access path component at invalid depth." ); const PathComponent& component = components[components.getSize() - depth - 1]; return UTF8String( pathString.getPointer() + component.startIndex, component.numCharacters ); } /// Return a path object that is the parent of this path object in the file system hierarchy. /** * If the path represents a file system node at root level or is the root directory, the * root path is returned. */ Path getParent() const; /// Return a path object that is the ancestor of this path object in the file system at the specified age. /** * A depth of 0 returns a copy of this path object. A depth of 1 returns the parent directory of this * path and so on. If the requested depth is greater than the depth of the path's hierarchy, * the root path is returned. */ Path getParentAtDepth( Index depth ) const; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Path Component Add Methods /// Add all of the path components from the specified path as children of this path. void addChildren( const Path& path ); /// Add all of the path components from the specified path string as children of this path. void addChildren( const UTF8String& pathString ); /// Add all of the path components from the specified path as children of this path. RIM_INLINE Path& operator += ( const Path& path ) { this->addChildren( path ); return *this; } /// Add all of the path components from the specified path string as children of this path. RIM_INLINE Path& operator += ( const UTF8String& pathString ) { this->addChildren( pathString ); return *this; } /// Add all of the path components from the specified path string as children of this path. RIM_INLINE Path& operator += ( const Char* pathString ) { this->addChildren( UTF8String(pathString) ); return *this; } /// Return a new path as the concatenation of the path components from this and another path. RIM_INLINE Path operator + ( const Path& path ) const { return Path( *this, path ); } /// Return a new path as the concatenation of the path components from this and another path string. RIM_INLINE Path operator + ( const UTF8String& pathString ) const { return Path( *this, pathString ); } /// Return a new path as the concatenation of the path components from this and another path string. RIM_INLINE Path operator + ( const Char* pathString ) const { return Path( *this, UTF8String( pathString ) ); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Path Component Remove Methods /// Remove the last path component from this path, resulting in the path representing its parent. void removeLastComponent(); /// Remove the specified number of path components from the path. /** * Starting with the last path component, this method removes as many path components * as possible from the path until either the specified number is removed or the * root directory is reached. */ void removeLastComponents( Size number ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Path Attribute Accessor Methods /// Return whether or not this path is relative to the current working directory. RIM_INLINE Bool isRelative() const { return pathIsRelative; } /// Return whether or not this path specifies a file or directory at root level. RIM_INLINE Bool isAtRootLevel() const { return components.getSize() == 1 && !pathIsRelative; } /// Return whether or not this path specifies the root system directory. RIM_INLINE Bool isRoot() const { return (components.getSize() == 0) && !pathIsRelative; } private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Path Component Class Definition /// A class representing a section of a path string which is a component of the path. class PathComponent { public: RIM_INLINE PathComponent( Index newStartIndex, Size newNumCharacters ) : startIndex( newStartIndex ), numCharacters( newNumCharacters ) { } /// The index of the first character within the path string where this component starts. Index startIndex; /// The number of characters in this path component's name. Size numCharacters; }; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Methods static void sanitizePathString( const UTF8String& pathString, ArrayList<PathComponent>& components, Bool pathIsRelative, UTF8String& outputString ); /// Return whether or not the specified character is a path separator. RIM_FORCE_INLINE static Bool isAPathSeparator( UTF8Char character ); static void parsePathAndAddComponents( const UTF8String& pathString, ArrayList<PathComponent>& components, Bool& pathIsRelative ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Members /// A string representing the entire path. UTF8String pathString; /// A list of the components of this Path. ArrayList<PathComponent> components; /// Whether or not the Path is relative to the current working directory. Bool pathIsRelative; }; //########################################################################################## //************************* End Rim File System Namespace ******************************** RIM_FILE_SYSTEM_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_PATH_H <file_sep>/* * rimLinkedList.h * Rim Framework * * Created by <NAME> on 4/29/07. * Copyright 2007 Rim Software. All rights reserved. * */ #ifndef INCLUDE_RIM_LINKED_LIST_H #define INCLUDE_RIM_LINKED_LIST_H #include "rimUtilitiesConfig.h" #include "rimAllocator.h" //########################################################################################## //*************************** Start Rim Framework Namespace ****************************** RIM_UTILITIES_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A doubly-linked list class. /** * This class has an interface much like that of the class ArrayList, * but it's implementation differs in that this class stores it's * array elements non-contiguously in memory, which allows for * faster insertion than an array-based list if the Iterator is used. * However, the class is mostly useless other than that because * an array-based list outperforms it in almost every other comparison. * Essentially, it is not recommended that one uses this class unless * it's quick insertion time while using the Iterator will be taken * advantage of. */ template < typename T > class LinkedList { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructor /// Create a new empty linked list with no elements. RIM_INLINE LinkedList() : head(NULL), tail(NULL), numElements(0) { } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Copy Constructor /// Create a deep copy of an existing linked list. RIM_INLINE LinkedList( const LinkedList<T>& linkedList ) { numElements = linkedList.numElements; head = util::construct<Node>( linkedList.head->data, NULL, NULL ); Node* thisCurrent = head; Node* otherCurrent = linkedList.head->next; while ( otherCurrent ) { thisCurrent->next = util::construct<Node>( otherCurrent->data, thisCurrent, NULL ); thisCurrent = thisCurrent->next; otherCurrent = otherCurrent->next; } tail = thisCurrent; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Copy Constructor /// Assign this linked list with the contents of another, performing a deep copy. RIM_INLINE LinkedList<T>& operator = ( const LinkedList<T>& linkedList ) { if ( this != &linkedList ) { numElements = linkedList.numElements; head = util::construct<Node>( linkedList.head->data, NULL, NULL ); Node* thisCurrent = head; Node* otherCurrent = linkedList.head->next; while ( otherCurrent ) { thisCurrent->next = util::construct<Node>( otherCurrent->data, thisCurrent, NULL ); thisCurrent = thisCurrent->next; otherCurrent = otherCurrent->next; } tail = thisCurrent; } return *this; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Destructor /// Destroy a linked list, deallocating all resourced used. RIM_INLINE ~LinkedList() { clear(); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Add Methods /// Add an element to the end of the list. /** * @param newElement - the new element to add to the end of the list */ RIM_INLINE void add( const T& newElement ) { if ( !tail ) tail = head = util::construct<Node>( newElement, NULL, NULL ); else tail = tail->next = util::construct<Node>( newElement, tail, NULL ); numElements++; } /// Insert an element at the specified index of the list. /** * If the index is out of the valid indices for the linked list, * then an IndexOutOfBoundsException is thrown. * * @param newElement - the new element to insert in the list * @param index - the index at which to insert the new element */ RIM_INLINE Bool insert( Index index, const T& newElement ) { if ( !tail ) tail = head = util::construct<Node>( newElement, NULL, NULL ); else { Node* node = getNodeAtIndex( index ); if ( node == NULL ) return false; insertBefore( node ); } return true; } /// Set an element at the specified index of the list to a new value. /** * If the index is out of then valid indices for the linked list, * then an IndexOutOfBoundsException is thrown. * Otherwise, the list element at the specified index * is set to a new value, and the old value is returned. * * @param index - the index at which to set the new element * @param newElement - the new element to set in the list * @return the old list element */ RIM_INLINE Bool set( Index index, const T& newElement ) { Node* current = getNodeAtIndex( index ); if ( current == NULL ) return false; current->data = newElement; return true; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Remove Methods /// Remove the element at the specified index. /** * If the index is within the bounds of the list ( >= 0 && < getSize() ), * then the list element at that index is removed and it's * value is returned. Otherwise, a IndexOutOfBoundsException is * thrown and the list is unaffected. * * @param index - the index of the list element to remove * @return the removed element of the list */ RIM_INLINE Bool removeAtIndex( Index index ) { Node* node = getNodeAtIndex( index ); return removeNode( node ); } /// Remove the first element equal to the parameter element. /** * If this element is found, then it is removed and TRUE * is returned. Otherwise, FALSE is returned and the list is unaffected. * * @param element - the list element to remove the first instance of * @return whether or not the element was removed */ RIM_INLINE Bool remove( T element ) { Node* node = getNodeWithData( element ); return removeNode( node ); } /// Remove the last element in the linked list. /** * If the linked list has elements remaining in it, then * the last element in the linked list is removed and * TRUE is returned. Otherwise the list is unmodified and * FALSE is returned. * * @return whether or not the remove operation was successful. */ RIM_INLINE Bool removeLast() { return removeNode( tail ); } /// Remove the first element in the linked list. /** * If the linked list has elements remaining in it, then * the first element in the linked list is removed and * TRUE is returned. Otherwise the list is unmodified and * FALSE is returned. * * @return whether or not the remove operation was successful. */ RIM_INLINE Bool removeFirst() { return removeNode( head ); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Clear Method /// Remove all elements from the linked list. RIM_INLINE void clear() { Node* current = head; Node* previous = NULL; while ( current ) { previous = current; current = current->next; util::destruct( previous ); } head = tail = NULL; numElements = 0; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Element Accessor Methods /// Return the element at the specified index. /** * If the specified index is not within the valid bounds * of the linked list, then an exception is thrown indicating * an index out of bounds error occurred. This is the non-const version * of the get() method, allowing modification of the element. * * @param index - the index of the desired element. * @return a const reference to the element at the index specified by the parameter. */ RIM_INLINE T& get( Index index ) { RIM_DEBUG_ASSERT_MESSAGE( index < numElements, "Linked list index out-of-bounds" ); return getNodeAtIndex( index )->data; } /// Return the element at the specified index. /** * If the specified index is not within the valid bounds * of the array list, then an exception is thrown indicating * an index out of bounds error occurred. This is the const version * of the get() method, disallowing modification of the element. * * @param index - the index of the desired element. * @return a const reference to the element at the index specified by the parameter. */ RIM_INLINE const T& get( Index index ) const { RIM_DEBUG_ASSERT_MESSAGE( index < numElements, "Linked list index out-of-bounds" ); return getNodeAtIndex( index )->data; } /// Return a reference to the first element in the array list. RIM_INLINE T& getFirst() { RIM_DEBUG_ASSERT_MESSAGE( numElements != Size(0), "Cannot get first element from empty linked list." ); return head->data; } /// Return a const reference to the first element in the array list. RIM_INLINE const T& getFirst() const { RIM_DEBUG_ASSERT_MESSAGE( numElements != Size(0), "Cannot get first element from empty linked list." ); return head->data; } /// Return a reference to the last element in the array list. RIM_INLINE T& getLast() { RIM_DEBUG_ASSERT_MESSAGE( numElements != Size(0), "Cannot get last element from empty linked list." ); return tail->data; } /// Return a const reference to the last element in the array list. RIM_INLINE const T& getLast() const { RIM_DEBUG_ASSERT_MESSAGE( numElements != Size(0), "Cannot get last element from empty linked list." ); return tail->data; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Element Accessor Operators /// Return the element at the specified index. /** * If the specified index is not within the valid bounds * of the linked list, then an exception is thrown indicating * an index out of bounds error occurred. This is the const version * of the operator (), disallowing modification of the element. * * @param index - the index of the desired element. * @return a const reference to the element at the index specified by the parameter. */ RIM_INLINE T& operator () ( Index index ) { RIM_DEBUG_ASSERT_MESSAGE( index < numElements, "Linked list index out-of-bounds" ); return getNodeAtIndex( index )->data; } /// Return the element at the specified index. /** * If the specified index is not within the valid bounds * of the linked list, then an exception is thrown indicating * an index out of bounds error occurred. This is the const version * of the operator (), disallowing modification of the element. * * @param index - the index of the desired element. * @return a const reference to the element at the index specified by the parameter. */ RIM_INLINE const T& operator () ( Index index ) const { RIM_DEBUG_ASSERT_MESSAGE( index < numElements, "Linked list index out-of-bounds" ); return getNodeAtIndex( index )->data; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Contains Method /// Return whether or not the specified element is in this list. RIM_INLINE Bool contains( const T& anElement ) const { return getNodeWithData( anElement ) != NULL; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Size Accessor Methods /// Return whether or not the linked list has any elements /** * @return whether or not the linked list has any elements */ RIM_INLINE Bool isEmpty() const { return numElements == 0; } /// Get the number of elements in the linked list. /** * @return the number of elements in the linked list */ RIM_INLINE Size getSize() const { return numElements; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Linked List Node Class /// The class for a linked list node. /** * This class is used to implement a doubly-linked list, * such that each node has a reference to it's previous node * and it's next node. This makes adding and removing elements more * efficient. */ class Node { public: //**************************************************** // Constructors /// Create a new Node. /** * The user must specifiy the node data, the previous node, * and the next node. * * @param newData - the data for the node * @param newPrevious - the previous node in the list * @param newNext - the next node in the list */ RIM_INLINE Node( const T& newData, Node* newPrevious, Node* newNext ) : data( newData ), previous( newPrevious ), next( newNext ) { } //**************************************************** // Data Members /// The data contained by the list node. T data; /// The previous node for the list node Node* previous; /// The next node for the list node Node* next; }; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Linked List Iterator Class /// Iterator class for a linked list. /** * It's purpose is to efficiently iterate through all * or some of the elements in the linked list, making changes as * necessary. It avoids the O(n) time of removing or adding elements * to the list under ordinary situations. */ class Iterator { public: //**************************************************** // Constructor /// create a new linked list iterator from a reference to a list. RIM_INLINE Iterator( LinkedList<T>& newList ) : list( newList ), currentNode( newList.head ) { } //**************************************************** // Public Methods /// Return whether or not the iterator is at the end of the list. /** * If the iterator is at the end of the list, return FALSE. * Otherwise, return TRUE. * * @return FALSE if at the end of list, otherwise TRUE */ RIM_INLINE operator Bool () const { return currentNode != NULL; } /// Prefix increment operator. RIM_INLINE void operator ++ () { currentNode = currentNode->next; } /// Postfix increment operator. RIM_INLINE void operator ++ ( int ) { currentNode = currentNode->next; } /// Return a reference to the current iterator element. RIM_INLINE T& operator * () { return currentNode->data; } /// Access the current iterator element. RIM_INLINE T* operator -> () { return &currentNode->data; } /// Remove the current element from the list. /** * This method removes an element in constant time. */ RIM_INLINE void remove() { list.removeNode( currentNode ); } /// Insert a data element before the current iterator element. /** * This method inserts an element in constant time. */ RIM_INLINE void insertBefore( const T& data ) { list.insertBefore( data, currentNode ); } /// Insert a data element after the current iterator element. /** * This method inserts an element in constant time. */ RIM_INLINE void insertAfter( const T& data ) { list.insertAfter( data, currentNode ); } /// Reset the iterator to the beginning of the list. RIM_INLINE void reset() { currentNode = list.head; } private: //**************************************************** // Private Data Members /// The list we are iterating through. LinkedList& list; /// The current node of the iterator. Node* currentNode; /// Make the const iterator class a friend. friend class LinkedList<T>::ConstIterator; }; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Const Linked List Iterator Class /// Iterator class for a linked list which can't modify it. /** * It's purpose is to efficiently iterate through all * or some of the elements in the linked list, making changes as * necessary. It avoids the O(n) time of removing or adding elements * to the list under ordinary situations. */ class ConstIterator { public: //**************************************************** // Constructor /// Create a new linked list iterator from a reference to a list. RIM_INLINE ConstIterator( const LinkedList<T>& newList ) : list( newList ), currentNode( newList.head ) { } /// Create a new const linked list iterator from a non-const iterator. RIM_INLINE ConstIterator( const Iterator& iterator ) : list( iterator.list ), currentNode( iterator.currentNode ) { } //**************************************************** // Public Methods /// Return whether or not the iterator is at the end of the list. /** * If the iterator is at the end of the list, return FALSE. * Otherwise, return TRUE. * * @return FALSE if at the end of list, otherwise TRUE */ RIM_INLINE operator Bool () const { return currentNode != NULL; } /// Prefix increment operator. RIM_INLINE void operator ++ () { currentNode = currentNode->next; } /// Postfix increment operator. RIM_INLINE void operator ++ ( int ) { currentNode = currentNode->next; } /// Return a reference to the current iterator element. RIM_INLINE const T& operator * () { return currentNode->data; } /// Access the current iterator element. RIM_INLINE const T* operator -> () { return &currentNode->data; } /// Reset the iterator to the beginning of the list. RIM_INLINE void reset() { currentNode = list.head; } private: //**************************************************** // Private Data Members /// The list we are iterating through. const LinkedList& list; /// The current node of the iterator. const Node* currentNode; }; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Iterator Method /// Return an iterator for the linked list. /** * The iterator serves to provide a way to efficiently iterate * over the elements of the linked list and to perform modifications * to the structure without incurring O(n) overhead for inserting or * removing elements. * * @return an iterator for the linked list. */ RIM_INLINE Iterator getIterator() { return Iterator(*this); } /// Return a const iterator for the linked list. /** * The iterator serves to provide a way to efficiently iterate * over the elements of the linked list without incurring O(n) overhead. * The returned iterator cannot modify the linked list. * * @return an iterator for the linked list. */ RIM_INLINE ConstIterator getIterator() const { return ConstIterator(*this); } private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Methods /// Get the node at the specified index. /** * If index is out of bounds, * then return NULL. Otherwise, return a pointer to the node * at the specified index. * * @param index - the index of the node to retrieve * @return the node at the specified index, or NULL if index is out of bounds */ RIM_INLINE Node* getNodeAtIndex( Index index ) { if ( index < numElements ) { Node* current = head; Index currentIndex = 0; while ( current != NULL && currentIndex < index ) { current = current->next; currentIndex++; } return current; } else return NULL; } /// Get the first node whose data is equal to the specified element. /** * If a node meets these conditions, then a pointer to it is returned. * Otherwise, NULL is returned. * * @param element - the element to find in the list * @return the first node with data equal to the specified element */ RIM_INLINE Node* getNodeWithData( const T& element ) { Node* current = head; while ( current != NULL && !(current->data == element) ) current = current->next; return current; } /// Remove the specified node from the linked list. RIM_INLINE Bool removeNode( Node* node ) { if ( !node ) return false; else { if ( node == head ) { // We are removing the head of the list. if ( node == tail ) tail = NULL; node = node->next; util::destruct( head ); head = node; } else if ( node == tail ) { // We are removing the tail of the list. node->previous->next = NULL; tail = node->previous; util::destruct( node ); } else { // We are removing from the middle of the list. node->previous->next = node->next; node->next->previous = node->previous; util::destruct( node ); } numElements--; return true; } } /// Insert a data element before the specified node. /** * This method inserts an element in constant time. */ RIM_INLINE void insertBefore( const T& data, Node* node ) { if ( !node ) { head = tail = util::construct<Node>( data, NULL, NULL ); } else if ( node == head ) { head = util::construct<Node>( data, NULL, node ); node->previous = head; } else { node->previous->next = util::construct<Node>( data, node->previous, node ); node->previous = node->previous->next; } numElements++; } /// Insert a data element after the specified node. /** * This method inserts an element in constant time. */ RIM_INLINE void insertAfter( const T& data, Node* node ) { if ( !node ) { head = tail = util::construct<Node>( data, NULL, NULL ); } else if ( node == tail ) { tail = util::construct<Node>( data, node, NULL ); node->previous = tail; } else { node->next->previous = util::construct<Node>( data, node, node->next ); node->next = node->next->previous; } numElements++; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Members /// The head of the linked list. Node* head; /// The tail of the linked list. Node* tail; /// The number of elements in the linked list. Size numElements; }; //########################################################################################## //*************************** End Rim Framework Namespace ******************************** RIM_UTILITIES_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_LINKED_LIST_H <file_sep>/* * rimGUISaveDialog.h * Rim Software * * Created by <NAME> on 6/29/14. * Copyright 2014 __MyCompanyName__. All rights reserved. * */ #ifndef INCLUDE_RIM_GUI_SAVE_DIALOG_H #define INCLUDE_RIM_GUI_SAVE_DIALOG_H #include "rimGUIConfig.h" #include "rimGUIElement.h" #include "rimGUISaveDialogDelegate.h" //########################################################################################## //*************************** Start Rim GUI Namespace ****************************** RIM_GUI_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class which represents a user dialog for saving files. class SaveDialog : public GUIElement { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructors /// Create a save dialog with the default starting path, the root directory of the system drive. SaveDialog(); /// Create a save dialog with the specified starting path. SaveDialog( const UTF8String& startingPath ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Destructor /// Destroy a save dialog, closing it if is visible and releasing all resources used. ~SaveDialog(); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Delegate (Event Handler) Accessor Methods /// Block the calling thread until the user selects a file. /** * The selected file path is sent to the delegate for the dialog. * The method returns whether or not the file was successfully * opened by the delegate. * * If the method returns TRUE, the path of the file can be accessed * by calling getPath(). */ Bool run(); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Path Accessor Methods /// Return the current user-selected save file path. Path getPath() const; /// Return a path representing the current directory of the save dialog. /** * This path is the parent of the file that the user has * selected to be saved. */ Path getSearchPath() const; /// Set the path for the current directory of the save dialog. /** * The method returns whether or not the path was able to be set. */ Bool setSearchPath( const Path& newPath ); /// Set the path for the current directory of the save dialog. /** * The method returns whether or not the path was able to be set. */ RIM_INLINE Bool setSearchPath( const UTF8String& newPath ) { return this->setSearchPath( Path( newPath ) ); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** File Type Accessor Methods /// Return the number of allowed file types for this save dialog. /** * If there are no types specified, any file type is allowed. */ Size getTypeCount() const; /// Return the file type extension string for the type at the specified index in this dialog. const UTF8String& getType( Index typeIndex ) const; /// Return the file type display name for the type at the specified index in this dialog. const UTF8String& getTypeName( Index typeIndex ) const; /// Add a new file type to this save dialog. /** * The method returns whether or not the new type was able to be added. */ Bool addType( const UTF8String& extension ); /// Add a new file type to this save dialog with the specified display name. /** * The method returns whether or not the new type was able to be added. */ Bool addType( const UTF8String& extension, const UTF8String& displayName ); /// Remove the specified file type string from this save dialog. /** * The method returns whether or not the new type was able to be removed. */ Bool removeType( const UTF8String& extension ); /// Remove all file types from this save dialog. /** * After this operation, any file type is allowed. */ Bool clearTypes(); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Title Accessor Methods /// Return the title string for this save dialog. /** * On most platforms, this string will be placed at the top of the window in * a title bar. */ UTF8String getTitle() const; /// Set the title string for this save dialog. /** * The method returns whether or not the title change operation was successful. */ Bool setTitle( const UTF8String& newTitle ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Hidden File Accessor Methods /// Return whether or not this open dialog can see hidden files. Bool getHiddenFiles() const; /// Set whether or not this open dialog can see hidden files. Bool setHiddenFiles( Bool newHiddenFiles ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Delegate (Event Handler) Accessor Methods /// Get a reference to the delegate object associated with this save dialog. const SaveDialogDelegate& getDelegate() const; /// Set the delegate object to which this save dialog sends events. void setDelegate( const SaveDialogDelegate& delegate ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Platform-Specific Pointer Accessor Method /// Get a pointer to this save dialog's platform-specific internal representation. /** * On Mac OS X, this method returns a pointer to a subclass of NSSavePanel * which represents the save dialog. * * On Windows, this method returns an HWND indicating a handle to the save dialog window. */ virtual void* getInternalPointer() const; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Static Shared Construction Methods /// Create a shared-pointer save dialog object, calling the constructor with the same arguments. RIM_INLINE static Pointer<SaveDialog> construct() { return Pointer<SaveDialog>( util::construct<SaveDialog>() ); } /// Create a shared-pointer save dialog object, calling the constructor with the same arguments. RIM_INLINE static Pointer<SaveDialog> construct( const UTF8String& startingPath ) { return Pointer<SaveDialog>( util::construct<SaveDialog>( startingPath ) ); } private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Save Dialog Wrapper Class Declaration /// A class which encapsulates internal platform-specific state. class Wrapper; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Members /// A pointer to internal implementation-specific data. Wrapper* wrapper; }; //########################################################################################## //*************************** End Rim GUI Namespace ******************************** RIM_GUI_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_GUI_SAVE_DIALOG_H <file_sep>/* * rimSoundMIDIInputStream.h * Rim Sound * * Created by <NAME> on 5/30/13. * Copyright 2013 __MyCompanyName__. All rights reserved. * */ #ifndef INCLUDE_RIM_SOUND_MIDI_INPUT_STREAM_H #define INCLUDE_RIM_SOUND_MIDI_INPUT_STREAM_H #include "rimSoundUtilitiesConfig.h" #include "rimSoundMIDIMessage.h" #include "rimSoundMIDIEvent.h" #include "rimSoundMIDIBuffer.h" //########################################################################################## //*********************** Start Rim Sound Utilities Namespace **************************** RIM_SOUND_UTILITIES_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class which represents a stream-readable source for MIDI data. class MIDIInputStream { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Destructor /// Destroy this MIDI input stream and release any resourcees associated with it. virtual ~MIDIInputStream() { } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** MIDI Reading Methods /// Read the specified number of MIDI events from the input stream into the output buffer. /** * This method attempts to read the specified number of MIDI events from the * stream into the buffer and then returns the total number of events that * were successfully read. The stream's current position is incremented by the * return value. * * The timestamps of the returned MIDI events are specified relative to the start * of the stream. */ RIM_INLINE Size read( MIDIBuffer& buffer, Size numEvents ) { return this->readEvents( buffer, numEvents ); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Public Seek Status Accessor Methods /// Return whether or not seeking is allowed in this input stream. virtual Bool canSeek() const = 0; /// Return whether or not this input stream's current position can be moved by the specified signed event offset. /** * This event offset is specified as the signed number of MIDI events to move * in the stream. */ virtual Bool canSeek( Int64 relativeEventOffset ) const = 0; /// Move the current event position in the stream by the specified signed amount of events. /** * This method attempts to seek the position in the stream by the specified amount of MIDI events. * The method returns the signed amount that the position in the stream was changed * by. Thus, if seeking is not allowed, 0 is returned. Otherwise, the stream should * seek as far as possible in the specified direction and return the actual change * in position. */ virtual Int64 seek( Int64 relativeEventOffset ) = 0; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Stream Size Accessor Methods /// Return the number of MIDI events remaining in the MIDI input stream. /** * The value returned must only be a lower bound on the total number of MIDI * events in the stream. For instance, if there are events remaining, the method * should return at least 1. If there are no events remaining, the method should * return 0. This behavior is allowed in order to support never-ending streams * which might not have a defined endpoint. */ virtual Size getEventsRemaining() const = 0; /// Return whether or not this MIDI input stream has any events remaining in the stream. RIM_INLINE Bool hasEventsRemaining() const { return this->getEventsRemaining() > Size(0); } /// Return the current position of the stream in events relative to the start of the stream. /** * The returned value indicates the event index of the current read * position within the MIDI stream. For unbounded streams, this indicates * the number of samples that have been read by the stream since it was opened. */ virtual Index getPosition() const = 0; protected: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Protected MIDI Stream Methods /// Read the specified number of MIDI events from the input stream into the output buffer. /** * This method attempts to read the specified number of MIDI events from the * stream into the buffer and then returns the total number of events that * were successfully read. The stream's current position is incremented by the * return value. * * The timestamps of the returned MIDI events are specified relative to the start * of the stream. */ virtual Size readEvents( MIDIBuffer& buffer, Size numEvents ) = 0; }; //########################################################################################## //*********************** End Rim Sound Utilities Namespace ****************************** RIM_SOUND_UTILITIES_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_SOUND_MIDI_INPUT_STREAM_H <file_sep>/* * rimAtomics.h * Rim Software * * Created by <NAME> on 4/1/14. * Copyright 2014 __MyCompanyName__. All rights reserved. * */ #ifndef INCLUDE_RIM_ATOMICS_H #define INCLUDE_RIM_ATOMICS_H #include "rimThreadsConfig.h" //########################################################################################## //*************************** Start Rim Threads Namespace ******************************** RIM_THREADS_NAMESPACE_START //****************************************************************************************** //########################################################################################## namespace atomic { //########################################################################################## //########################################################################################## //############ //############ Operate-Then-Read Method Declarations //############ //########################################################################################## //########################################################################################## template < typename T > T addAndRead( T& operand, T value ); template < typename T > T incrementAndRead( T& operand ); template < typename T > T subAndRead( T& operand, T value ); template < typename T > T decrementAndRead( T& operand ); template < typename T > T orAndRead( T& operand, T value ); template < typename T > T andAndRead( T& operand, T value ); template < typename T > T xorAndRead( T& operand, T value ); template < typename T > T nandAndRead( T& operand, T value ); //########################################################################################## //########################################################################################## //############ //############ Read-Then-Operate Method Declarations //############ //########################################################################################## //########################################################################################## template < typename T > T readAndIncrement( T& operand ); template < typename T > T readAndDecrement( T& operand ); template < typename T > T readAndAdd( T& operand, T value ); template < typename T > T readAndSub( T& operand, T value ); template < typename T > T readAndOr( T& operand, T value ); template < typename T > T readAndAnd( T& operand, T value ); template < typename T > T readAndXor( T& operand, T value ); template < typename T > T readAndNand( T& operand, T value ); //########################################################################################## //########################################################################################## //############ //############ Operate-Then-Read Methods (GCC) //############ //########################################################################################## //########################################################################################## #if defined(RIM_COMPILER_GCC) template < typename T > RIM_INLINE T addAndRead( T& operand, T value ) { return __sync_add_and_fetch( &operand, value ); } template < typename T > RIM_INLINE T incrementAndRead( T& operand ) { return __sync_add_and_fetch( &operand, T(1) ); } template < typename T > RIM_INLINE T subAndRead( T& operand, T value ) { return __sync_sub_and_fetch( &operand, value ); } template < typename T > RIM_INLINE T decrementAndRead( T& operand ) { return __sync_sub_and_fetch( &operand, T(1) ); } template < typename T > RIM_INLINE T orAndRead( T& operand, T value ) { return __sync_or_and_fetch( &operand, value ); } template < typename T > RIM_INLINE T andAndRead( T& operand, T value ) { return __sync_and_and_fetch( &operand, value ); } template < typename T > RIM_INLINE T xorAndRead( T& operand, T value ) { return __sync_xor_and_fetch( &operand, value ); } template < typename T > RIM_INLINE T nandAndRead( T& operand, T value ) { return __sync_nand_and_fetch( &operand, value ); } #elif defined(RIM_COMPILER_MSVC) template < typename T > RIM_INLINE T subAndRead( T& operand, T value ) { return addAndRead( operand, -value ); } #endif //########################################################################################## //########################################################################################## //############ //############ Operate-Then-Read Methods (GCC) //############ //########################################################################################## //########################################################################################## #if defined(RIM_COMPILER_GCC) template < typename T > RIM_INLINE T readAndIncrement( T& operand ) { return __sync_fetch_and_add( &operand, T(1) ); } template < typename T > RIM_INLINE T readAndAdd( T& operand, T value ) { return __sync_fetch_and_add( &operand, value ); } template < typename T > RIM_INLINE T readAndSub( T& operand, T value ) { return __sync_fetch_and_sub( &operand, value ); } template < typename T > RIM_INLINE T readAndDecrement( T& operand ) { return __sync_fetch_and_sub( &operand, T(1) ); } template < typename T > RIM_INLINE T readAndOr( T& operand, T value ) { return __sync_fetch_and_or( &operand, value ); } template < typename T > RIM_INLINE T readAndAnd( T& operand, T value ) { return __sync_fetch_and_and( &operand, value ); } template < typename T > RIM_INLINE T readAndXor( T& operand, T value ) { return __sync_fetch_and_xor( &operand, value ); } template < typename T > RIM_INLINE T readAndNand( T& operand, T value ) { return __sync_fetch_and_nand( &operand, value ); } #elif defined(RIM_COMPILER_MSVC) template < typename T > RIM_INLINE T readAndSub( T& operand, T value ) { return readAndAdd( operand, -value ); } #endif //########################################################################################## //########################################################################################## //############ //############ Atomic Class Declaration //############ //########################################################################################## //########################################################################################## /// A class that wraps a primitive-type value in atomic operations. template < typename T > class Atomic { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructors /// Create a new atomic variable with the default initial value. RIM_FORCE_INLINE Atomic() : value() { } /// Create a new atomic variable with the specified initial value. RIM_FORCE_INLINE Atomic( T newValue ) : value( newValue ) { } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Conversion Operators /// Get the currently stored atomic value. RIM_FORCE_INLINE operator T () const { return value; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Increment Operators /// Prefix increment operator. RIM_INLINE T operator ++ () { return incrementAndRead( value ); } /// Postfix increment operator. RIM_INLINE T operator ++ ( int ) { return readAndIncrement( value ); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Decrement Operators /// Prefix increment operator. RIM_INLINE T operator -- () { return decrementAndRead( value ); } /// Postfix increment operator. RIM_INLINE T operator -- ( int ) { return readAndDecrement( value ); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Add and Subtract Operators /// Add the specified value to this atomic value, returning the result. RIM_INLINE T operator += ( T a ) { return addAndRead( value, a ); } /// Subtract the specified value from this atomic value, returning the result. RIM_INLINE T operator -= ( T a ) { return subAndRead( value, a ); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Bitwise Operators /// Bitwise AND the specified value and this atomic value, returning the result. RIM_INLINE T operator &= ( T a ) { return andAndRead( value, a ); } /// Bitwise OR the specified value and this atomic value, returning the result. RIM_INLINE T operator |= ( T a ) { return orAndRead( value, a ); } /// Bitwise XOR the specified value and this atomic value, returning the result. RIM_INLINE T operator ^= ( T a ) { return orAndRead( value, a ); } private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Members /// The primitive-typed value stored by this atomic object. T value; }; }; //########################################################################################## //*************************** End Rim Threads Namespace ********************************** RIM_THREADS_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_ATOMICS_H <file_sep>/* * rimLanguage.h * Rim Framework * * Created by <NAME> on 12/28/08. * Copyright 2008 Rim Software. All rights reserved. * */ #ifndef INCLUDE_RIM_LANGUAGE_H #define INCLUDE_RIM_LANGUAGE_H #include "lang/rimLanguageConfig.h" #include "lang/rimFunction.h" #include "lang/rimFunctionCall.h" #include "lang/rimPointer.h" #include "lang/rimAny.h" #include "lang/rimType.h" #include "lang/rimPrimitiveType.h" #include "lang/rimOptional.h" #include "lang/rimTuple.h" #include "lang/rimHalfFloat.h" #include "lang/rimBigFloat.h" #ifdef RIM_LANGUAGE_NAMESPACE_START #undef RIM_LANGUAGE_NAMESPACE_START #endif #ifdef RIM_LANGUAGE_NAMESPACE_END #undef RIM_LANGUAGE_NAMESPACE_END #endif #ifdef RIM_LANGUAGE_DETAIL_NAMESPACE_START #undef RIM_LANGUAGE_DETAIL_NAMESPACE_START #endif #ifdef RIM_LANGUAGE_DETAIL_NAMESPACE_END #undef RIM_LANGUAGE_DETAIL_NAMESPACE_END #endif #endif // INCLUDE_RIM_LANGUAGE_H <file_sep>/* * rimSoundCrossover.h * Rim Sound * * Created by <NAME> on 11/30/12. * Copyright 2012 __MyCompanyName__. All rights reserved. * */ #ifndef INCLUDE_RIM_SOUND_CROSSOVER_H #define INCLUDE_RIM_SOUND_CROSSOVER_H #include "rimSoundFiltersConfig.h" #include "rimSoundFilter.h" #include "rimSoundCutoffFilter.h" //########################################################################################## //************************ Start Rim Sound Filters Namespace ***************************** RIM_SOUND_FILTERS_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class which is used to filter input audio data into an arbitrary number of frequency band outputs. /** * The Crossover class uses a series of Linkwitz-Riley order crossover filters to * split a stream of input audio into an arbitrary number of frequency bands whose * corner frequencies can be between 0Hz and the Nyquist Frequency for the current operating * sample rate. * * Each crossover filter (a high-pass, low-pass pair) can have any even order N. * Special care is taken to keep the outputs of the crossover in phase and all-pass * at all frequencies. * * The crossover keeps an internal list of the crossover filters, sorted by * frequency. Therefore, if you add filters to the crossover in arbitrary order, they * are automatically sorted, so don't expect the filters to be stored in the order * in which they were added. */ class Crossover : public SoundFilter { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructors /// Create a default crossover with no split frequencies and one full-range frequency band output. Crossover(); /// Create an exact copy of the specified crossover. Crossover( const Crossover& newCrossover ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Destructor /// Destroy a crossover and release all of its resources. ~Crossover(); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Assignment Operator /// Assign the state of the specified crossover object to this crossover. Crossover& operator = ( const Crossover& other ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Crossover Filter Accessor Methods /// Return the total number of crossover frequencies that this crossover has. /** * This value is 0 for a crossover with no crossover points and is * equal to (n-1) for a crossover with (n) frequency bands. */ RIM_INLINE Size getFilterCount() const { return points.getSize(); } /// Add a new crossover frequency to this Crossover, specifying the filter order. /** * If the specified frequency is not within the valid range of 0 to the * Nyquist Frequency, this method has no effect and FALSE is returned. Otherwise, * the frequency is added to the Crossover and TRUE is returned. If the method * succeeds, the resulting Crossover will have one more output frequency band * than it had before. * * This version of this method allows the user to specify the filter * order used for the new crossover filter. Order values are clamped to the range [2,8]. * Since Linkwitz-Riley crossover filters are used, the actual filter order will be * the next even number greater than or equal to the specified filter order. * * @param newCrossoverFrequency - the crossover frequency to add to this Crossover. * @param newFilterOrder - the crossover filter order to use. * @return whether or not the specified crossover frequency was added successfully. */ Bool addFilter( Float newFrequency, Size newFilterOrder = Size(4) ); /// Remove the crossover point filter at the specified index in this Crossover. /** * If the specified filter index is valid, the crossover filter at that index * is removed and the number of output frequency bands for the crossover is reduced * by one. Otherwise, the method has no effect. */ void removeFilter( Index filterIndex ); /// Remove all crossover filters from this Crossover. /** * This method resets the Crossover to its initial state with * only one full-range output. */ void clearFilters(); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Frequency Band Accessor Methods /// Return the total number of frequency bands that this crossover produces. /** * This value is 1 for a crossover with no crossover points, with one additional * band for each crossover split frequency. */ RIM_INLINE Size getBandCount() const { return points.getSize() + 1; } /// Return a 1D range value indicating the range of frequencies for the specified frequency band index. RIM_INLINE AABB1f getBandRange( Index bandIndex ) const { if ( bandIndex > points.getSize() ) return AABB1f(); else if ( bandIndex == 0 ) return AABB1f( 0, points[bandIndex].frequency ); else if ( bandIndex == points.getSize() ) return AABB1f( points[bandIndex - 1].frequency, math::max<Float>() ); else return AABB1f( points[bandIndex - 1].frequency, points[bandIndex].frequency ); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Crossover Filter Frequency Accessor Methods /// Return the frequency in hertz of the crossover filter at the specified index. RIM_INLINE Float getFilterFrequency( Index filterIndex ) const { if ( filterIndex < points.getSize() ) return points[filterIndex].frequency; else return Float(0); } /// Set the frequency in hertz of the crossover filter at the specified index. /** * This method resorts the crossover points based on the specified frequency * change so that they remain sorted. * * The method returns whether or not the filter frequency was able to be changed. * It can fail if the given filter index or frequency is invalid. */ Bool setFilterFrequency( Index filterIndex, Float newFrequency ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Crossover Filter Order Accessor Methods /// Return the order of the crossover filter at the specified index. RIM_INLINE Size getFilterOrder( Index filterIndex ) const { if ( filterIndex < points.getSize() ) return points[filterIndex].order; else return 0; } /// Set the order of the crossover filter at the specified index. Bool setFilterOrder( Index filterIndex, Size newOrder ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Input Type Accessor Methods /// Return a boolean value indicating whether or not the crossover is given a multiband multi-input format. /** * If this value is TRUE, the crossover will use the audio from each input for the corresponding output, * rather than using only the first input. The number of inputs in this case will be the same as the number * of outputs. If this value is FALSE, the first input is used to feed all frequency band outputs. */ RIM_INLINE Bool getIsMultiInput() const { return multibandInput; } /// Return a boolean value indicating whether or not the crossover is given a multiband multi-input format. /** * If this value is TRUE, the crossover will use the audio from each input for the corresponding output, * rather than using only the first input. The number of inputs in this case will be the same as the number * of outputs. If this value is FALSE, the first input is used to feed all frequency band outputs. */ Bool setIsMultiInput( Bool newIsMultiInput ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Input and Output Name Accessor Methods /// Return a human-readable name of the crossover filter output at the specified index. /** * This method returns the string "Output N" where N is the index of the frequency * band, starting at 0. */ virtual UTF8String getOutputName( Index outputIndex ) const; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Filter Attribute Accessor Methods /// Return a human-readable name for this cutoff filter. /** * The method returns the string "Crossover". */ virtual UTF8String getName() const; /// Return the manufacturer name of this crossover filter. /** * The method returns the string "Headspace Sound". */ virtual UTF8String getManufacturer() const; /// Return an object representing the version of this crossover filter. virtual SoundFilterVersion getVersion() const; /// Return an object which describes the category of effect that this filter implements. /** * This method returns the value SoundFilterCategory::EQUALIZER. */ virtual SoundFilterCategory getCategory() const; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Public Static Property Objects /// A string indicating the human-readable name of this crossover filter. static const UTF8String NAME; /// A string indicating the manufacturer name of this crossover filter. static const UTF8String MANUFACTURER; /// An object indicating the version of this crossover filter. static const SoundFilterVersion VERSION; private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Crossover Filter Class Declaration /// A class which contains information related to a single crossover point. class CrossoverPoint { public: /// Create a new crossover point object with the specified split frequency and filter order. RIM_INLINE CrossoverPoint( Float newFrequency, Size newOrder ) : frequency( newFrequency ), order( newOrder ) { } /// The corner frequency of this crossover filter. Float frequency; /// The filter order of this crossover point, usually an even integer betwee 2 and 8. Size order; }; /// A class which stores information for a single crossover output frequency band. class FrequencyBand { public: /// Create a new frequency band object with no crossover filters. RIM_INLINE FrequencyBand() { } /// A list of filters that are applied to the input to produce this frequency band. ArrayList<CutoffFilter*> filters; }; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Stream Reset Method /// A method which is called whenever the filter's stream of audio is being reset. /** * This method allows the filter to reset all parameter interpolation * and processing to its initial state to avoid coloration from previous * audio or parameter values. */ virtual void resetStream(); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Filter Processing Methods /// Apply this crossover to the samples in the input frame and place them in the output frame. virtual SoundFilterResult processFrame( const SoundFilterFrame& inputFrame, SoundFilterFrame& outputFrame, Size numSamples ); /// Return whether or not the specified CutoffFilter has an odd order and needs frequency band inversion. RIM_INLINE static Bool filterNeedsInversion( const CutoffFilter& filter ) { return filter.getDirection() == CutoffFilter::HIGH_PASS && ((math::nextMultiple( filter.getOrder(), Size(2) ) / 2) % 2) == 1; } /// Update the frequency bands for the crossover so that they have the correct filters. void updateFrequencyBands(); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Members /// A list of the crossover frequency split points and filter orders for this crossover. ArrayList<CrossoverPoint> points; /// A list of information for each output frequency band of this crossover. ArrayList<FrequencyBand> frequencyBands; /// A boolean value indicating whether or not the crossover is given a multiband multi-input format. /** * If this value is TRUE, the crossover will use the audio from each input for the corresponding output, * rather than using only the first input. The number of inputs in this case will be the same as the number * of outputs. If this value is FALSE, the first input is used to feed all frequency band outputs. */ Bool multibandInput; }; //########################################################################################## //************************ End Rim Sound Filters Namespace ******************************* RIM_SOUND_FILTERS_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_SOUND_CROSSOVER_H <file_sep>/* * rimGraphicsPixelFormat.h * Rim Graphics * * Created by <NAME> on 3/1/13. * Copyright 2013 __MyCompanyName__. All rights reserved. * */ #ifndef INCLUDE_RIM_GRAPHICS_PIXEL_FORMAT_H #define INCLUDE_RIM_GRAPHICS_PIXEL_FORMAT_H #include "rimGraphicsDevicesConfig.h" //########################################################################################## //*********************** Start Rim Graphics Devices Namespace *************************** RIM_GRAPHICS_DEVICES_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class which describes the attributes of a framebuffer pixel format when creating a GraphicsContext. class RenderedPixelFormat { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructor /// Create a pixel format object with the specified attributes. RIM_INLINE RenderedPixelFormat( Size newNumBitsPerChannel = 8, Size newNumDepthBits = 24, Size newNumStencilBits = 0, Size newNumBitsPerAccumulationChannel = 0, Size newNumAASamples = 0 ) : numBitsPerChannel( newNumBitsPerChannel ), numDepthBits( newNumDepthBits ), numStencilBits( newNumStencilBits ), numBitsPerAccumulationChannel( newNumBitsPerAccumulationChannel ), numAASamples( newNumAASamples ) { } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Public Data Members /// The number of bits to use for each channel of the pixel format. Size numBitsPerChannel; /// The number of bits to use for each pixel of the depth buffer. Size numDepthBits; /// The number of bits to use for each pixel of the stencil buffer. Size numStencilBits; /// The number of bits to use for each channel of the accumulation buffer. Size numBitsPerAccumulationChannel; /// The number of anti-aliasing samples to use. Size numAASamples; }; //########################################################################################## //*********************** End Rim Graphics Devices Namespace ***************************** RIM_GRAPHICS_DEVICES_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_GRAPHICS_PIXEL_FORMAT_H <file_sep>/* * rimGraphicsTextureVariable.h * Rim Graphics * * Created by <NAME> on 9/12/10. * Copyright 2010 Rim Software. All rights reserved. * */ #ifndef INCLUDE_RIM_GRAPHICS_TEXTURE_VARIABLE_H #define INCLUDE_RIM_GRAPHICS_TEXTURE_VARIABLE_H #include "rimGraphicsShadersConfig.h" //########################################################################################## //*********************** Start Rim Graphics Shaders Namespace *************************** RIM_GRAPHICS_SHADERS_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class which represents a shader texture input variable. /** * A TextureVariable object contains a description of a texture input * variable in a shader's source code. The description consists of the variable's * name, the type of the texture variable, and an integral identifier for the texture * variable within the shader. */ class TextureVariable { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructors /// Create a texture variable with the specified name, type, and identifier. RIM_INLINE TextureVariable( const String& newName, const TextureType& newType, ShaderVariableLocation newLocation, Size newArraySize = Size(1) ) : name( newName ), type( newType ), location( newLocation ), arraySize( (UByte)newArraySize ) { } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Attribute Accessor Methods /// Get the name of the texture variable in the shader source code. RIM_INLINE const String& getName() const { return name; } /// Get the type of this texture variable within the shader. RIM_INLINE const TextureType& getType() const { return type; } /// Return the implementation-defined location for the texture variable within the shader. RIM_INLINE ShaderVariableLocation getLocation() const { return location; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Array Accessor Methods /// Return the number of elements that are in the array starting at this variable. /** * For shader variables that are declared as arrays, this function will return the * size of the static variable array. For shader variables that are not arrays, this * function returns 1. */ RIM_INLINE Size getArraySize() const { return arraySize; } /// Return whether or not this shader variable denotes the start of its array. RIM_INLINE Bool isArray() const { return arraySize > 1; } private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Members /// The name of the texture attribute variable in the shader's source code. String name; /// The type of the texture variable within the shader source code. TextureType type; /// The size of the array starting at this constant variable. /** * This valid is equal to 1 for variables that are not arrays and will be * the size of the array for array variables. */ UByte arraySize; /// The implementation-defined location for the texture variable within the shader. ShaderVariableLocation location; }; //########################################################################################## //*********************** End Rim Graphics Shaders Namespace ***************************** RIM_GRAPHICS_SHADERS_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_GRAPHICS_TEXTURE_VARIABLE_H <file_sep>/* * rimGraphicsShaderParameterFlags.h * Rim Software * * Created by <NAME> on 1/30/14. * Copyright 2014 __MyCompanyName__. All rights reserved. * */ #ifndef INCLUDE_RIM_GRAPHICS_SHADER_PARAMETER_FLAGS_H #define INCLUDE_RIM_GRAPHICS_SHADER_PARAMETER_FLAGS_H #include "rimGraphicsShadersConfig.h" //########################################################################################## //*********************** Start Rim Graphics Shaders Namespace *************************** RIM_GRAPHICS_SHADERS_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class which encapsulates the different flags that a shader paramter can have. /** * These flags provide boolean information about a shader parameter. Flags * are indicated by setting a single bit of a 32-bit unsigned integer to 1. * * Enum values for the different flags are defined as members of the class. Typically, * the user would bitwise-OR the flag enum values together to produce a final set * of set flags. */ class ShaderParameterFlags { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Shader Parameter Flags Enum Declaration /// An enum which specifies the different shader parameter flags. typedef enum Flag { /// A flag indicating whether or not the parameter allows reading its value. READ_ACCESS = 1, /// A flag indicating whether or not the parameter allows setting its value. WRITE_ACCESS = 1 << 1, /// The flag value when all flags are not set. UNDEFINED = 0 }; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructors /// Create a new shader parameter flags object with no flags set. RIM_INLINE ShaderParameterFlags() : flags( UNDEFINED ) { } /// Create a new shader parameter flags object with the specified flag value initially set. RIM_INLINE ShaderParameterFlags( Flag flag ) : flags( flag ) { } /// Create a new shader parameter flags object with the specified initial combined flags value. RIM_INLINE ShaderParameterFlags( UInt32 newFlags ) : flags( newFlags ) { } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Integer Cast Operator /// Convert this shader parameter flags object to an integer value. /** * This operator is provided so that the ShaderParameterFlags object * can be used as an integer value for bitwise logical operations. */ RIM_INLINE operator UInt32 () const { return flags; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Flag Status Accessor Methods /// Return whether or not the specified flag value is set for this flags object. RIM_INLINE Bool isSet( Flag flag ) const { return (flags & flag) != UNDEFINED; } /// Set whether or not the specified flag value is set for this flags object. RIM_INLINE void set( Flag flag, Bool newIsSet ) { if ( newIsSet ) flags |= flag; else flags &= ~flag; } private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Members /// A value indicating the flags that are set for a shader parameter. UInt32 flags; }; //########################################################################################## //*********************** End Rim Graphics Shaders Namespace ***************************** RIM_GRAPHICS_SHADERS_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_GRAPHICS_SHADER_PARAMETER_FLAGS_H <file_sep>/* * rimEntityEvent.h * Rim Entities * * Created by <NAME> on 5/13/12. * Copyright 2012 __MyCompanyName__. All rights reserved. * */ #ifndef INCLUDE_RIM_ENTITY_EVENT_H #define INCLUDE_RIM_ENTITY_EVENT_H #include "rimEntitiesConfig.h" //########################################################################################## //************************** Start Rim Entities Namespace ******************************** RIM_ENTITIES_NAMESPACE_START //****************************************************************************************** //########################################################################################## class Entity; class EntitySystem; /// The type to use for event types. typedef String EventType; //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class that encapsulates an entity event. /** * An event consists of a string-based event type, a time when the event * occurred, a time-out period for the event, and a value of arbitrary type * that the user an use to pass any kind of data with an event. */ class Event { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructors /// Create an event with the specified type and timeout period. /** * If not specified, the timeout period has a default value of 60 seconds. */ Event( const EventType& newType, const Entity* entitySender = NULL, const EntitySystem* systemSender = NULL, const Time newTimeoutPeriod = 60.0 ); /// Create an event with the specified type, value, and timeout period. /** * If not specified, the timeout period has a default value of 60 seconds. */ template < typename ValueType > Event( const EventType& newType, ValueType newValue, const Entity* entitySender = NULL, const EntitySystem* systemSender = NULL, Time newTimeoutPeriod = 60.0 ); /// Create a copy of the specified event. Event( const Event& other ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Destructor /// Destroy this event and all of its state. virtual ~Event(); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Assignment Operator /// Assign the state of another event to this event. Event& operator = ( const Event& other ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Event Type Accessor Methods /// Return a reference to a string representing the type of this event. RIM_INLINE const EventType& getType() const { return type; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Event Time Accessor Methods /// Return a reference to a Time object which represents the moment that this event was created. RIM_INLINE const Time& getTime() const { return time; } /// Return a reference to a Time object which represents the time that this event is valid. RIM_INLINE const Time& getTimeoutPeriod() const { return timeoutPeriod; } /// Return whether or not this event has timed out yet. /** * If the current time is later than the event's creation time plus * its timeout period, the event is no longer considered valid. */ RIM_INLINE Bool isValid() const { return Time::getCurrent() >= time + timeoutPeriod; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Event Value Accessor Methods /// Return whether or not this event has a value associated with it. RIM_INLINE Bool hasValue() const { return value != NULL; } /// Return a pointer to this event's value. /** * If the event does not have a value or if the requested templated * type is incompatible with the event's value, NULL is returned. */ template < typename ValueType > RIM_INLINE const ValueType* getValue() const; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Event Sender Accessor Methods /// Return a pointer to entity that produced this event, or NULL if there is no entity sender. RIM_INLINE const Entity* getEntity() const { return entitySender; } /// Return a pointer to entity system that produced this event, or NULL if there is no system sender. RIM_INLINE const EntitySystem* getSystem() const { return systemSender; } private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Class Declarations /// The base class for classes that hold event values of arbitrary type. class EventValueBase; /// A class which holds an event value of the specified value type. template < typename ValueType > class EventValue; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Members /// A string representing the type of this event. EventType type; /// The time at which this event was created. Time time; /// The amount of time that can pass before this event becomes invalid. Time timeoutPeriod; /// The value for this event. This value is used to carry arbitrary information about the event. EventValueBase* value; /// A pointer to the entity which produced this event. const Entity* entitySender; /// A pointer to the entity system which produced this event. const EntitySystem* systemSender; }; //########################################################################################## //########################################################################################## //############ //############ Base Event Value Class Defintion //############ //########################################################################################## //########################################################################################## class Event:: EventValueBase { public: virtual ~EventValueBase() { } /// Return a pointer to the value stored in this event value. /** * If there is no value or the type is incompatible, the method * returns NULL. */ template < typename ValueType > RIM_INLINE ValueType* getValue(); /// Return a const pointer to the value stored in this event value. /** * If there is no value or the type is incompatible, the method * returns NULL. */ template < typename ValueType > RIM_INLINE const ValueType* getValue() const; /// Construct and return a copy of this event value. virtual EventValueBase* copy() const = 0; }; //########################################################################################## //########################################################################################## //############ //############ Event Value Class Defintion //############ //########################################################################################## //########################################################################################## template < typename ValueType > class Event:: EventValue : public EventValueBase { public: /// Create a new event value object which stores a copy of the specified value. RIM_INLINE EventValue( const ValueType& newValue ) : value( newValue ) { } /// Return a pointer to the value stored in this event value. /** * If there is no value or the type is incompatible, the method * returns NULL. */ RIM_INLINE ValueType* getValue() { return &value; } /// Return a const pointer to the value stored in this event value. /** * If there is no value or the type is incompatible, the method * returns NULL. */ RIM_INLINE const ValueType* getValue() const { return &value; } /// Construct and return a copy of this event value. virtual EventValueBase* copy() const { return util::construct<EventValue<ValueType> >( *this ); } private: /// The user-defined value object associated with this event value. ValueType value; }; //########################################################################################## //########################################################################################## //############ //############ Event Constructors //############ //########################################################################################## //########################################################################################## template < typename ValueType > Event:: Event( const EventType& newType, ValueType newValue, const Entity* newEntitySender, const EntitySystem* newSystemSender, Time newTimeoutPeriod ) : type( newType ), time( Time::getCurrent() ), timeoutPeriod( newTimeoutPeriod ) { value = util::construct<EventValue<ValueType> >( newValue ); } //########################################################################################## //########################################################################################## //############ //############ Event Value Accessor Methods //############ //########################################################################################## //########################################################################################## template < typename ValueType > ValueType* Event::EventValueBase:: getValue() { EventValue<ValueType>* array = dynamic_cast<EventValue<ValueType>*>( this ); if ( array != NULL ) return array->getComponents(); else return NULL; } template < typename ValueType > const ValueType* Event::EventValueBase:: getValue() const { const EventValue<ValueType>* value = dynamic_cast<const EventValue<ValueType>*>( this ); if ( value != NULL ) return value->getValue(); else return NULL; } template < typename ValueType > const ValueType* Event:: getValue() const { if ( value != NULL ) return value->getValue<ValueType>(); else return NULL; } //########################################################################################## //************************** End Rim Entities Namespace ********************************** RIM_ENTITIES_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_ENTITY_EVENT_H <file_sep>/* * rimSoundTranscoder.h * Rim Software * * Created by <NAME> on 6/8/14. * Copyright 2014 __MyCompanyName__. All rights reserved. * */ #ifndef INCLUDE_RIM_SOUND_TRANSCODER_H #define INCLUDE_RIM_SOUND_TRANSCODER_H #include "rimSoundIOConfig.h" #include "rimSoundFormat.h" //########################################################################################## //*************************** Start Rim Sound IO Namespace ******************************* RIM_SOUND_IO_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class which provides the interface for objects that encode and decode sound data. class SoundTranscoder : public ResourceTranscoder<SoundResource> { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Format Accessor Methods /// Return an object which represents the resource type that this transcoder can read and write. virtual ResourceType getResourceType() const; /// Return an object which represents the format that this transcoder can encode and decode. virtual SoundFormat getFormat() const = 0; }; //########################################################################################## //*************************** End Rim Sound IO Namespace ********************************* RIM_SOUND_IO_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_SOUND_TRANSCODER_H <file_sep>/* * rimSoundInputStream.h * Rim Sound * * Created by <NAME> on 7/26/12. * Copyright 2012 __MyCompanyName__. All rights reserved. * */ #ifndef INCLUDE_RIM_SOUND_INPUT_STREAM_H #define INCLUDE_RIM_SOUND_INPUT_STREAM_H #include "rimSoundUtilitiesConfig.h" #include "rimSoundBuffer.h" #include "rimSoundSampleType.h" //########################################################################################## //*********************** Start Rim Sound Utilities Namespace **************************** RIM_SOUND_UTILITIES_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class which abstracts a read-only source of sound samples. /** * This class serves as an interface for things like sound file input, * streaming input, etc. Reading from a SoundInputStream is very similar to reading * from a file. */ class SoundInputStream { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Destructor /// Destroy this sound input stream and release any resources associated with it. virtual ~SoundInputStream() { } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Sound Reading Methods /// Read the specified number of samples from the input stream into the output buffer. /** * This method attempts to read the specified number of samples from the stream * into the input buffer. It then returns the total number of valid samples which * were read into the output buffer. The samples are converted to the format * stored in the input buffer (Sample32f). The input position in the stream * is advanced by the number of samples that are read. * * This method enlarges the buffer to be at least as large as the number of requested * samples, as well as makes sure it has as many channels as the stream has. */ Size read( SoundBuffer& inputBuffer, Size numSamples ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Public Seek Status Accessor Methods /// Return whether or not seeking is allowed in this input stream. virtual Bool canSeek() const = 0; /// Return whether or not this input stream's current position can be moved by the specified signed sample offset. /** * This sample offset is specified as the number of sample frames to move * in the stream - a frame is equal to one sample for each channel in the stream. */ virtual Bool canSeek( Int64 relativeSampleOffset ) const = 0; /// Move the current sample frame position in the stream by the specified signed amount. /** * This method attempts to seek the position in the stream by the specified amount. * The method returns the signed amount that the position in the stream was changed * by. Thus, if seeking is not allowed, 0 is returned. Otherwise, the stream should * seek as far as possible in the specified direction and return the actual change * in position. */ virtual Int64 seek( Int64 relativeSampleOffset ) = 0; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Stream Size Accessor Methods /// Return the number of samples remaining in the sound input stream. /** * The value returned must only be a lower bound on the total number of sample * frames in the stream. For instance, if there are samples remaining, the method * should return at least 1. If there are no samples remaining, the method should * return 0. This behavior is allowed in order to support never-ending streams * which might not have a defined endpoint. */ virtual SoundSize getSamplesRemaining() const = 0; /// Return whether or not this sound input stream has any samples remaining in the stream. RIM_INLINE Bool hasSamplesRemaining() const { return this->getSamplesRemaining() > SoundSize(0); } /// Return the current position of the stream in samples relative to the start of the stream. /** * The returned value indicates the sample index of the current read * position within the sound stream. For unbounded streams, this indicates * the number of samples that have been read by the stream since it was opened. */ virtual SampleIndex getPosition() const = 0; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Stream Format Accessor Methods /// Return the number of channels that are in the sound input stream. /** * This is the number of channels that will be read with each read call * to the stream's read method. */ virtual Size getChannelCount() const = 0; /// Return the sample rate of the sound input stream's source audio data. /** * Since some types of streams support variable sampling rates, this value * is not necessarily the sample rate of all audio that is read from the stream. * However, for most streams, this value represents the sample rate of the entire * stream. One should always test the sample rate of the buffers returned by the * stream to see what their sample rates are before doing any operations that assume * a sampling rate. */ virtual SampleRate getSampleRate() const = 0; /// Return the actual sample type used in the stream. /** * This is the format of the stream's source data. For instance, a file * might be encoded with 8-bit, 16-bit or 24-bit samples. This value * indicates that sample type. For formats that don't have a native sample type, * such as those which use frequency domain encoding, this function should * return SampleType::SAMPLE_32F, indicating that the stream's native format * is 32-bit floating point samples. */ virtual SampleType getNativeSampleType() const = 0; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Stream Status Accessor Method /// Return whether or not the stream has a valid source of sound data. /** * This method should return TRUE if everything is OK, but might return * FALSE if the input stream is not valid (file not found, etc) or * if the stream's data has improper format. */ virtual Bool isValid() const = 0; protected: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Protected Sound Input Method /// Read the specified number of samples from the input stream into the output buffer. /** * This method attempts to read the specified number of samples from the stream * into the input buffer. It then returns the total number of valid samples which * were read into the output buffer. The samples are converted to the format * stored in the input buffer (Sample32f). The input position in the stream * is advanced by the number of samples that are read. * * The implementor of this method should make sure to set the sample rate of the * buffer to be the correct output sample rate. */ virtual Size readSamples( SoundBuffer& inputBuffer, Size numSamples ) = 0; }; //########################################################################################## //*********************** End Rim Sound Utilities Namespace ****************************** RIM_SOUND_UTILITIES_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_SOUND_INPUT_STREAM_H <file_sep>/* * rimGraphicsIO.h * Rim Software * * Created by <NAME> on 2/17/14. * Copyright 2014 __MyCompanyName__. All rights reserved. * */ #ifndef INCLUDE_RIM_GRAPHICS_IO_H #define INCLUDE_RIM_GRAPHICS_IO_H #include "io/rimGraphicsIOConfig.h" #include "io/rimGraphicsConverter.h" #include "io/rimGraphicsOBJTranscoder.h" #endif // INCLUDE_RIM_GRAPHICS_IO_H <file_sep>#pragma once /** * This class represents the transformation state of the vehicle and includes fields for * position, <code>Orientation</code>, and velocity. * <p> * The <code>TransformState</code> is only a data holder and values within it are * public and may be accessed and changed by anyone with a reference. If a safe * copy needs to be shared be sure to provide a deep copy instead of simply * passing the reference. * </p> * * Author: <NAME> * */ #include "Orientation.h" #include "AngularVelocity.h" #include "rim/rimEngine.h" using namespace rim; using namespace rim::math; class TransformState { public: /** * A <code>Vector3f</code> object containing the position of the object. * <ul> * <li>The global x coordinate is stored in <code>x</code>.</li> * <li>The global y coordinate is stored in <code>y</code>.</li> * <li>The global z coordinate is stored in <code>z</code>.</li> * </ul> */ Vector3f position; /** * An <code>Orientation</code> object containing the roll, pitch, and yaw of * the object. * * <p> * The roll, pitch, and yaw are accessed with their respective getters and * are in radians. * </p> */ //Orientation orientation; /// A 3x3 orthonormal rotation matrix indicating the rotation from body to world space. Matrix3f rotation; /** * A <code>Vector3f</code> object containing the velocity of the object. * <ul> * <li>The global x velocity is stored in <code>x</code>.</li> * <li>The global y velocity is stored in <code>y</code>.</li> * <li>The global z velocity is stored in <code>z</code>.</li> * </ul> */ Vector3f velocity; /// The angular velocity of the object in world space. Vector3f angularVelocity; /** * Blank constructor which constructs a new <code>TransformState</code> object * having position (0,0,0), orientation (0,0,0), and velocity, (0,0,0). */ TransformState() : position(), rotation( Matrix3f::IDENTITY ), velocity(), angularVelocity() { } /** * Constructor for building a new <code>TransformState</code> object with the * passed position, orientation, and velocity. * * @param position * A <code>Vector3f</code> object containing the position of the * object. * @param orientation * An <code>Orientation</code> object containing the roll, pitch, * and yaw of the object. * @param velocity * A <code>Vector3f</code> object containing the velocity of the * object. */ TransformState( const Vector3f& pos, const Matrix3f& rot, const Vector3f& vel, const Vector3f& angularVel ) : position( pos ), rotation( rot ), velocity( vel ), angularVelocity( angularVel ) { } /// Transform a point in body space into world space. Vector3f transformToWorld( const Vector3f& point ) const { return position + rotation*point; } /// Transform a point in world space into body space. Vector3f transformToBody( const Vector3f& point ) const { // Reverse multiply is the same as multiply by the transpose. return (point - position)*rotation; } /// Rotate a vector in body space into world space. Vector3f rotateVectorToWorld( const Vector3f& point ) const { return rotation*point; } /// Rotate a vector in world space into body space. Vector3f rotateVectorToBody( const Vector3f& point ) const { // Reverse multiply is the same as multiply by the transpose. return point*rotation; } }; <file_sep>/* * rimGraphicsConstantVariable.h * Rim Graphics * * Created by <NAME> on 9/12/10. * Copyright 2010 Rim Software. All rights reserved. * */ #ifndef INCLUDE_RIM_GRAPHICS_CONSTANT_VARIABLE_H #define INCLUDE_RIM_GRAPHICS_CONSTANT_VARIABLE_H #include "rimGraphicsShadersConfig.h" //########################################################################################## //*********************** Start Rim Graphics Shaders Namespace *************************** RIM_GRAPHICS_SHADERS_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class which provides a desciption of a constant shader input variable. /** * A ConstantVariable object contains a description of a constant input * variable from a shader's source code. These are variables that are constant across * an entire draw call. The description consists of the variable's * name, the type of the variable, and an integral location for the * variable within the shader. */ class ConstantVariable { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructor /// Create a shader attribute variable with the specified name, type, and identifier, and array size. /** * This attribute variable represents a variable which is the start of an array of attributes * under the same array name. */ RIM_INLINE ConstantVariable( const String& newName, const AttributeType& newType, ShaderVariableLocation newLocation, Size newArraySize = Size(1) ) : name( newName ), type( newType ), location( newLocation ), arraySize( (UByte)newArraySize ) { } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Variable Information Accessor Methods /// Return the name of the constant variable in the shader source code. RIM_INLINE const String& getName() const { return name; } /// Return an object which describes the type of the constant variable. RIM_INLINE const AttributeType& getType() const { return type; } /// Return the implementation-defined location for the constant variable within the shader. RIM_INLINE ShaderVariableLocation getLocation() const { return location; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Array Accessor Methods /// Return the number of elements that are in the array starting at this variable. /** * For shader variables that are declared as arrays, this function will return the * size of the static variable array. For shader variables that are not arrays, this * function returns 1. */ RIM_INLINE Size getArraySize() const { return arraySize; } /// Return whether or not this shader variable denotes the start of its array. RIM_INLINE Bool isArray() const { return arraySize > 1; } private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Members /// The name of the constant variable in a shader's source code. String name; /// The type of the constant variable. AttributeType type; /// The size of the array starting at this constant variable. /** * This valid is equal to 1 for variables that are not arrays and will be * the size of the array for array variables. */ UByte arraySize; /// The implementation-defined location for the constant variable within the shader. ShaderVariableLocation location; }; //########################################################################################## //*********************** End Rim Graphics Shaders Namespace ***************************** RIM_GRAPHICS_SHADERS_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_GRAPHICS_CONSTANT_VARIABLE_H <file_sep>/* * rimGraphicsShaderProgram.h * Rim Graphics * * Created by <NAME> on 2/11/10. * Copyright 2010 Rim Software. All rights reserved. * */ #ifndef INCLUDE_RIM_GRAPHICS_SHADER_PROGRAM_H #define INCLUDE_RIM_GRAPHICS_SHADER_PROGRAM_H #include "rimGraphicsShadersConfig.h" #include "rimGraphicsShader.h" #include "rimGraphicsConstantVariable.h" #include "rimGraphicsVertexVariable.h" #include "rimGraphicsTextureVariable.h" //########################################################################################## //*********************** Start Rim Graphics Shaders Namespace *************************** RIM_GRAPHICS_SHADERS_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class which represents the interface for a hardware-executed shading program. /** * A shader program is made up of one or more Shader objects that describe * the different stages of a shading pipeline. A ShaderProgram presents an * interface of shader variables that can be used to control the output of the * shader. Shader variables can correspond to constants, per-vertex attributes, * or textures. A shader program must be successfully linked before it can be used. */ class ShaderProgram : public ContextObject { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Shader Accessor Methods /// Return the total number of shaders that are attached to this shader program. virtual Size getShaderCount() const = 0; /// Return a pointer to the shader object attached at the specified index to the shader program. /** * Shader indices range from 0 for the first attached shader to N for the * Nth attached shader. */ virtual Pointer<Shader> getShader( Index shaderIndex ) const = 0; /// Attach the specified shader to this shader program. /** * The method returns whether or not the new shader was able to be attached. * The method can fail if the shader pointer is NULL, the shader was not able * to be compiled, or if there was an internal error. * * If the method succeeds, the shader program will need to be re-linked * before it can be used. */ virtual Bool addShader( const Pointer<Shader>& newShader ) = 0; /// Detach the shader at the specified index from this shader program. /** * The method returns whether or not the shader was able to be removed. * * If the method succeeds, the shader program will need to be re-linked * before it can be used. */ virtual Bool removeShader( Index shaderIndex ) = 0; /// Detach the shader with the specified address from this shader program. /** * The method returns whether or not the shader was able to be removed. * * If the method succeeds, the shader program will need to be re-linked * before it can be used. */ virtual Bool removeShader( const Shader* shader ) = 0; /// Remove all shaders that are attached to this shader program. /** * Shaders will need to be attatched to an empty program before * it can be used again. */ virtual void clearShaders() = 0; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Shader Program Link Method /// Link the vertex and fragment shaders into a useable shader program. /** * The return value indicates wether or not the link operation was successful. */ virtual Bool link() = 0; /// Link the vertex and fragment shaders into a useable shader program. /** * The return value indicates wether or not the link operation was successful. * If an error was encountered during the link process, the linker's output * is written to the link log parameter. */ virtual Bool link( String& linkLog ) = 0; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Program Status Accessor Method /// Return whether or not a link operation has been attempted on this shader program. /** * The method does not return whether or not the link operation was successful, * use the isValid() method instead to determine that. */ virtual Bool isLinked() const = 0; /// Return whether or not the shader program was linked successfully and is ready for use. /** * If the shader program has not yet been linked, FALSE is returned. */ virtual Bool isValid() const = 0; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constant Variable Accessor Methods /// Return the total number of constant variables that are part of this shader program. virtual Size getConstantVariableCount() const = 0; /// Return a pointer to the constant variable for this shader program at the given index. /** * Variable indices range from 0 up to the number of constant variables minus one. * If an invalid variable index is specified, NULL is returned. */ virtual const ConstantVariable* getConstantVariable( Index variableIndex ) const = 0; /// Get the constant variable that is part of this shader program with the specified name. /** * The constant variable, if found, is placed in the output reference parameter. * The method returns whether or not this shader program has a variable with * the given variable name. */ virtual Bool getConstantVariable( const String& variableName, const ConstantVariable*& variable ) const = 0; /// Get the constant variable index for this shader program with the specified name. /** * The constant variable's index, if found, is placed in the output reference parameter. * The method returns whether or not this shader program has a variable with * the given variable name. */ virtual Bool getConstantVariableIndex( const String& variableName, Index& variableIndex ) const = 0; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Texture Variable Accessor Methods /// Return the total number of texture variables that are part of this shader program. virtual Size getTextureVariableCount() const = 0; /// Return a pointer to the texture variable for this shader program at the given index. /** * Variable indices range from 0 up to the number of texture variables minus one. * If an invalid variable index is specified, NULL is returned. */ virtual const TextureVariable* getTextureVariable( Index variableIndex ) const = 0; /// Get the texture variable that is part of this shader program with the specified name. /** * The texture variable, if found, is placed in the output reference parameter. * The method returns whether or not this shader program has a variable with * the given variable name. */ virtual Bool getTextureVariable( const String& variableName, const TextureVariable*& variable ) const = 0; /// Get the texture variable index for this shader program with the specified name. /** * The texture variable's index, if found, is placed in the output reference parameter. * The method returns whether or not this shader program has a variable with * the given variable name. */ virtual Bool getTextureVariableIndex( const String& variableName, Index& variableIndex ) const = 0; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Vertex Variable Accessor Methods /// Return the total number of vertex variables that are part of this shader program. virtual Size getVertexVariableCount() const = 0; /// Return a pointer to the vertex variable for this shader program at the given index. /** * Variable indices range from 0 up to the number of vertex variables minus one. * If an invalid variable index is specified, NULL is returned. */ virtual const VertexVariable* getVertexVariable( Index variableIndex ) const = 0; /// Get the vertex variable that is part of this shader program with the specified name. /** * The vertex variable, if found, is placed in the output reference parameter. * The method returns whether or not this shader program has a variable with * the given variable name. */ virtual Bool getVertexVariable( const String& variableName, const VertexVariable*& variable ) const = 0; /// Get the vertex variable index for this shader program with the specified name. /** * The vertex variable's index, if found, is placed in the output reference parameter. * The method returns whether or not this shader program has a variable with * the given variable name. */ virtual Bool getVertexVariableIndex( const String& variableName, Index& variableIndex ) const = 0; protected: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Protected Constructors /// Create a new shader program for the specified graphics context. RIM_INLINE ShaderProgram( const devices::GraphicsContext* context ) : ContextObject( context ) { } }; //########################################################################################## //*********************** End Rim Graphics Shaders Namespace ***************************** RIM_GRAPHICS_SHADERS_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_GRAPHICS_SHADER_PROGRAM_H <file_sep>/* * rimSoundOggDecoder.h * Rim Sound * * Created by <NAME> on 8/4/12. * Copyright 2012 __MyCompanyName__. All rights reserved. * */ #ifndef INCLUDE_RIM_SOUND_OGG_DECODER_H #define INCLUDE_RIM_SOUND_OGG_DECODER_H #include "rimSoundIOConfig.h" //########################################################################################## //*************************** Start Rim Sound IO Namespace ******************************* RIM_SOUND_IO_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class which handles streaming decoding of the compresed .ogg audio format. /** * This class uses an abstract data stream for input, allowing it to decode * .ogg data from a file, network source, or other source. */ class OggDecoder : public SoundInputStream { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructors /// Create a new ogg decoder which should decode the .WAV file at the specified path string. OggDecoder( const UTF8String& pathToOggFile ); /// Create a new ogg decoder which should decode the specified .WAV file. OggDecoder( const File& oggFile ); /// Create a new ogg decoder which is decoding from the specified data input stream. /** * The stream must already be open for reading and should point to the first byte of the ogg * file information. Otherwise, reading from the .ogg file will fail. */ OggDecoder( const Pointer<DataInputStream>& oggStream ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Destructor /// Release all resources associated with this OggDecoder object. ~OggDecoder(); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** .ogg File Length Accessor Methods /// Get the length in samples of the .ogg file which is being decoded. RIM_INLINE SoundSize getLengthInSamples() const { return lengthInSamples; } /// Get the length in seconds of the .ogg file which is being decoded. RIM_INLINE Double getLengthInSeconds() const { return lengthInSeconds; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Current Time Accessor Methods /// Get the index of the sample currently being read from the .ogg file. RIM_INLINE SampleIndex getCurrentSampleIndex() const { return currentSampleIndex; } /// Get the time in seconds within the .ogg file of the current read position of this decoder. RIM_INLINE Double getCurrentTime() const { return Double(currentSampleIndex / sampleRate); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Public Seek Status Accessor Methods /// Return whether or not seeking is allowed in this input stream. virtual Bool canSeek() const; /// Return whether or not this input stream's current position can be moved by the specified signed sample offset. /** * This sample offset is specified as the number of sample frames to move * in the stream - a frame is equal to one sample for each channel in the stream. */ virtual Bool canSeek( Int64 relativeSampleOffset ) const; /// Move the current sample frame position in the stream by the specified signed amount. /** * This method attempts to seek the position in the stream by the specified amount. * The method returns the signed amount that the position in the stream was changed * by. Thus, if seeking is not allowed, 0 is returned. Otherwise, the stream should * seek as far as possible in the specified direction and return the actual change * in position. */ virtual Int64 seek( Int64 relativeSampleOffset ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Stream Size Accessor Method /// Return the number of samples remaining in the sound input stream. /** * The value returned must only be a lower bound on the total number of sample * frames in the stream. For instance, if there are samples remaining, the method * should return at least 1. If there are no samples remaining, the method should * return 0. */ virtual SoundSize getSamplesRemaining() const; /// Return the current position of the stream within itself. /** * The returned value indicates the sample index of the current read * position within the sound stream. For unbounded streams, this indicates * the number of samples that have been read by the stream since it was opened. */ virtual SampleIndex getPosition() const; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Decoder Format Accessor Methods /// Return the number of channels that are in the sound input stream. /** * This is the number of channels that will be read with each read call * to the stream's read method. */ virtual Size getChannelCount() const; /// Return the sample rate of the sound input stream's source audio data. /** * Since some types of streams support variable sampling rates, this value * is not necessarily the sample rate of all audio that is read from the stream. * However, for most streams, this value represents the sample rate of the entire * stream. One should always test the sample rate of the buffers returned by the * stream to see what their sample rates are before doing any operations that assume * a sampling rate. */ virtual SampleRate getSampleRate() const; /// Return the actual sample type used in the stream. /** * This is the format of the stream's source data. For instance, a file * might be encoded with 8-bit, 16-bit or 24-bit samples. This value * indicates that sample type. For formats that don't have a native sample type, * such as those which use frequency domain encoding, this function should * return SampleType::SAMPLE_32F, indicating that the stream's native format * is 32-bit floating point samples. */ virtual SampleType getNativeSampleType() const; /// Return a value indicating the average bitrate for the currently decoded ogg file. /** * This method returns the average bitrate if the file is valid, or 0 if * the file is invalid. */ RIM_INLINE Float getAverageBitrate() const { return averageBitrate; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Decoder Status Accessor Method /// Return whether or not this ogg decoder is reading a valid .ogg file. Bool isValid() const; private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Class Declaration /// A class which wraps any internal ogg decoding state. class OggDecoderWrapper; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Copy Operations /// Create a copy of the specified ogg decoder. OggDecoder( const OggDecoder& other ); /// Assign the current state of another OggDecoder object to this OggDecoder object. OggDecoder& operator = ( const OggDecoder& other ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Sound Reading Method /// Read the specified number of samples from the input stream into the output buffer. /** * This method attempts to read the specified number of samples from the stream * into the input buffer. It then returns the total number of valid samples which * were read into the output buffer. The samples are converted to the format * stored in the input buffer (Sample32f). The input position in the stream * is advanced by the number of samples that are read. */ virtual Size readSamples( SoundBuffer& inputBuffer, Size numSamples ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Helper Methods /// Read the header of the ogg file, starting from the current position. /** * This method should only be called when the data input stream is first initialized * and points to the first byte of the ogg header. */ void openOggFile(); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Members /// A pointer to a class containing all ogg decoder internal data. OggDecoderWrapper* wrapper; /// A mutex object which provides thread synchronization for this ogg decoder. /** * This thread protects access to decoding parameters such as the current decoding * position so that they are never accessed while audio is being decoded. */ mutable threads::Mutex decodingMutex; /// The number of channels in the ogg file. Size numChannels; /// The sample rate of the ogg file. SampleRate sampleRate; /// The average bitrate of the ogg file. Float averageBitrate; /// The length in samples of the ogg file. SoundSize lengthInSamples; /// The total length in seconds of the ogg file. Double lengthInSeconds; /// The current decoding position of the ogg decoder within the ogg file. SampleIndex currentSampleIndex; /// A boolean flag indicating whether or not this ogg decoder is decoding a valid ogg file. Bool validFile; }; //########################################################################################## //*************************** End Rim Sound IO Namespace ********************************* RIM_SOUND_IO_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_SOUND_.ogg_DECODER_H <file_sep>/* * rimGraphicsRenderFlags.h * Rim Graphics * * Created by <NAME> on 3/14/13. * Copyright 2013 __MyCompanyName__. All rights reserved. * */ #ifndef INCLUDE_RIM_GRAPHICS_RENDER_FLAGS_H #define INCLUDE_RIM_GRAPHICS_RENDER_FLAGS_H #include "rimGraphicsUtilitiesConfig.h" //########################################################################################## //********************** Start Rim Graphics Utilities Namespace ************************** RIM_GRAPHICS_UTILITIES_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class which encapsulates different boolean parameters that a RenderState has. /** * These flags provide boolean information about a rendering state. Flags * are indicated by setting a single bit of a 32-bit unsigned integer to 1. * * Enum values for the different flags are defined as members of the class. Typically, * the user would bitwise-OR the flag enum values together to produce a final set * of set flags. */ class RenderFlags { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Graphics Context Flags Enum Declaration /// An enum which specifies the different render flags. typedef enum Flag { /// The flag value when all flags are not set. UNDEFINED = 0, /// A flag indicating that color writing to red channel is enabled. RED_WRITE = 1, /// A flag indicating that color writing to green channel is enabled. GREEN_WRITE = 1 << 1, /// A flag indicating that color writing to blue channel is enabled. BLUE_WRITE = 1 << 2, /// A flag indicating that color writing to alpha channel is enabled. ALPHA_WRITE = 1 << 3, /// A flag indicating that color writing to all channels is enabled. COLOR_WRITE = RED_WRITE | GREEN_WRITE | BLUE_WRITE | ALPHA_WRITE, /// A flag indicating that depth buffer writing is enabled. DEPTH_WRITE = 1 << 4, /// A flag indicating that the depth test should be performed and depth buffer updated. DEPTH_TEST = 1 << 5, /// A flag indicating that the stencil test should be performed and stencil buffer updated. STENCIL_TEST = 1 << 6, /// A flag indicating that the alpha test should be performed. ALPHA_TEST = 1 << 7, /// A flag indicating that blending should be performed. BLENDING = 1 << 8, /// A flag indicating that the shader needs to be drawn in back-to-front order. TRANSPARENCY_DEPTH_SORT = 1 << 9, /// A flag indicating that back-face culling should be performed. /** * If a face's normal points away from the camera, it is not drawn * if this flag is set. */ BACK_FACE_CULLING = 1 << 10, /// A flag indicating that front-face culling should be performed. /** * If a face's normal points toward the camera, it is not drawn * if this flag is set. */ FRONT_FACE_CULLING = 1 << 11, /// A flag that indicates that slope-scaled depth biasing should be applied. SLOPE_SCALED_DEPTH_BIAS = 1 << 12, /// A flag that indicates that the color values written to the framebuffer are in linear space and should have gamma applied. /** * This means that color values are raised to the power of (1/2.2) in order to convert * them from a linear to sRGB color space for correct monitor output. In order for * this rendering to look correct, textures must be supplied in the correct * color space for the shader (usually linear). */ GAMMA_CORRECTION = 1 << 13 }; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructors /// Create a new render flags object with no flags set. RIM_INLINE RenderFlags() : flags( UNDEFINED ) { } /// Create a new render flags object with the specified flag value initially set. RIM_INLINE RenderFlags( Flag flag ) : flags( flag ) { } /// Create a new render flags object with the specified initial combined flags value. RIM_INLINE RenderFlags( UInt32 newFlags ) : flags( newFlags ) { } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Integer Cast Operator /// Convert this render flags object to an integer value. /** * This operator is provided so that the RenderFlags object * can be used as an integer value for bitwise logical operations. */ RIM_INLINE operator UInt32 () const { return flags; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Flag Status Accessor Methods /// Return whether or not the specified flag value is set for this flags object. RIM_INLINE Bool isSet( Flag flag ) const { return (flags & flag) != UNDEFINED; } /// Set whether or not the specified flag value is set for this flags object. RIM_INLINE void set( Flag flag, Bool newIsSet = true ) { if ( newIsSet ) flags |= flag; else flags &= ~flag; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Flag String Accessor Methods /// Return the flag for the specified literal string representation. static Flag fromEnumString( const String& enumString ); /// Convert the specified flag to its literal string representation. static String toEnumString( Flag flag ); /// Convert the specified flag to human-readable string representation. static String toString( Flag flag ); private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Members /// A value indicating the flags that are set for a the rendering state. UInt32 flags; }; //########################################################################################## //********************** End Rim Graphics Utilities Namespace **************************** RIM_GRAPHICS_UTILITIES_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_GRAPHICS_RENDER_FLAGS_H <file_sep>/* * rimGraphicsAnimationSampler.h * Rim Software * * Created by <NAME> on 6/24/14. * Copyright 2014 __MyCompanyName__. All rights reserved. * */ #ifndef INCLUDE_RIM_GRAPHICS_ANIMATION_SAMPLER_H #define INCLUDE_RIM_GRAPHICS_ANIMATION_SAMPLER_H #include "rimGraphicsAnimationConfig.h" #include "rimGraphicsAnimationTrack.h" //########################################################################################## //********************** Start Rim Graphics Animation Namespace ************************** RIM_GRAPHICS_ANIMATION_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class that interpolates a sampled animation track based on its interpolation type. /** * The sampler supports random-access sampling of an animation track and also * uses caching of previous samples to efficiently interpolate a stream of sample points. */ class AnimationSampler { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructors /// Create a default animation sampler with no animation track to interpolate. AnimationSampler(); /// Create an animation sampler for the specified animation track. AnimationSampler( const Pointer<AnimationTrack>& newTrack ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Track Accessor Methods /// Return a pointer to the animation track that this sampler is interpolating. RIM_INLINE const Pointer<AnimationTrack>& getTrack() const { return track; } /// Set a pointer to the animation track that this sampler is interpolating. RIM_INLINE void setTrack( const Pointer<AnimationTrack>& newTrack ) { track = newTrack; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Sampling Methods /// Sample the animation track at the specified time offset from the beginning the animation track. /** * If supported, the animation track is interpolated using its declared * interpolation type. If the interpolation type is undefined or not supported * by the sampler, InterpolationType::LINEAR interpolation is used as a fallback. * * The method returns whether or not the animation sampling operation was successful. */ Bool sample( const Time& time, AttributeValue& value ); private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Linear Interpolation Methods /// Interpolate the specified generic type components using linear interpolation. template < typename T > RIM_FORCE_INLINE static void interpolateLinearComponents( Size numComponents, Float a, const T* v1, const T* v2, T* v ); /// Interpolate the specified samples using linear interpolation to compute the output value. static Bool interpolateLinear( const Time& t1, const AttributeValue& v1, const Time& t2, const AttributeValue& v2, const Time& t, AttributeValue& v ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Members /// A pointer to the animation track that this sampler is sampling. Pointer<AnimationTrack> track; /// The index of the previously queried sample point for this animation. /** * This allows the animation sampler to cache intermediate interpolation data * and improve the interpolation speed. */ Index lastSampleIndex; /// The time value of the last sample. Time lastSampleTime; // The time value of the next sample after the last sample that is before the requested time. Time nextSampleTime; /// The animated value of the last sample. AttributeValue lastSampleValue; /// The animated value of the next sample. AttributeValue nextSampleValue; }; //########################################################################################## //********************** End Rim Graphics Animation Namespace **************************** RIM_GRAPHICS_ANIMATION_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_GRAPHICS_ANIMATION_SAMPLER_H <file_sep>/* * rimGraphicsOBJTranscoder.h * Rim Graphics * * Created by <NAME> on 9/19/13. * Copyright 2013 __MyCompanyName__. All rights reserved. * */ #ifndef INCLUDE_RIM_GRAPHICS_OBJ_TRANSCODER_H #define INCLUDE_RIM_GRAPHICS_OBJ_TRANSCODER_H #include "rimGraphicsIOConfig.h" //########################################################################################## //************************** Start Rim Graphics IO Namespace ***************************** RIM_GRAPHICS_IO_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class which reads and writes Wavefront OBJ format shapes. class OBJTranscoder : public ResourceTranscoder<GraphicsShape> { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructor /// Create a new OBJ transcoder. OBJTranscoder(); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Destructor /// Destroy this OBJ transcoder and release all associated resources. virtual ~OBJTranscoder(); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Model Format Accessor Methods /// Return an object which represents the resource type that this transcoder can read and write. virtual ResourceType getResourceType() const; /// Return an object which represents the resource format that this transcoder can read and write. virtual ResourceFormat getResourceFormat() const; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Encoding Methods /// Return whether or not this OBJ transcoder is able to encode the specified resource. virtual Bool canEncode( const GraphicsShape& shape ) const; /// Encode the specified generic shape to the file at the specified path. /** * If the method fails, FALSE is returned. */ virtual Bool encode( const ResourceID& resourceID, const GraphicsShape& shape ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Decoding Methods /// Return whether or not the specified identifier refers to a valid OBJ file for this transcoder. virtual Bool canDecode( const ResourceID& identifier ) const; /// Decode the OBJ file at the specified path and return a pointer to the decoded shape. /** * If the method fails, a NULL pointer is returned. */ virtual Pointer<GraphicsShape> decode( const ResourceID& resourceID, ResourceManager* manager = NULL ); private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Class Declaration /// A class used to hold temporary information about a raw OBJ material. class OBJMaterial { public: RIM_INLINE OBJMaterial( const UTF32String& newName ) : name( newName ), ambientColor( Color3f::BLACK ), diffuseColor( Color3f::WHITE ), specularColor( Color3f::WHITE ), specularExponent( 16.0f ), indexOfRefraction( 1 ), transparency( 1 ), illuminationModel( 0 ), soundR( 0.95f ), soundS( 0.5f ), soundT( 0.0f ) { } UTF32String name; Color3f ambientColor; Color3f diffuseColor; Color3f specularColor; Float specularExponent; Float indexOfRefraction; Float transparency; Int illuminationModel; Resource<GenericTexture> diffuseTexture; Resource<GenericTexture> ambientTexture; Resource<GenericTexture> specularTexture; StaticArray<Float,8> soundR; StaticArray<Float,8> soundS; StaticArray<Float,8> soundT; }; /// A class used to hold temporary information about a raw OBJ vertex. class OBJVertex { public: RIM_INLINE OBJVertex() : v( 0 ), t( 0 ), n( 0 ) { } RIM_INLINE OBJVertex( Index newV, Index newT, Index newN ) : v( newV ), t( newT ), n( newN ) { } RIM_INLINE Bool operator == ( const OBJVertex& other ) const { return v == other.v && t == other.t && n == other.n; } RIM_INLINE Hash getHashCode() const { return Hash((v*Hash(0x8DA6B343)) ^ (t*Hash(0xD8163841)) ^ (n*Hash(0xCB1AB31F))); } /// The index of this vertex's position. Index v; /// The index of this vertex's texture coordinate. Index t; /// The index of this vertex's normal. Index n; }; /// A class used to represent an OBJ primitive (point, line, face). class OBJPrimitive { public: /// A list of vertices to use for this OBJ primitive. ShortArrayList<OBJVertex,4> indices; }; class OBJMaterialGroup { public: RIM_INLINE OBJMaterialGroup( const Pointer<OBJMaterial>& newMaterial ) : material( newMaterial ), numPrimitives( 0 ) { } /// A string representing the name of the material group. Pointer<OBJMaterial> material; /// A list of the primitives that are part of this material group. ArrayList< OBJPrimitive > primitives; /// A temporary counter which counts the total number of primitives that will be stored in the index buffer. Size numPrimitives; }; class OBJGroup { public: RIM_INLINE OBJGroup( const UTF32String& newName ) : name( newName ) { } RIM_INLINE void setCurrentMaterialGroup( const Pointer<OBJMaterial>& m ) { const Size numMaterialGroups = materialGroups.getSize(); for ( Index i = 0; i < numMaterialGroups; i++ ) { if ( materialGroups[i]->material == m ) { currentMaterialGroup = materialGroups[i]; return; } } // Didn't find a group for this material, so create one. currentMaterialGroup = Pointer<OBJMaterialGroup>::construct( m ); materialGroups.add( currentMaterialGroup ); } /// A string representing the name of the obj group. UTF32String name; /// A list of the material groups that are part of this group. ArrayList<Pointer<OBJMaterialGroup> > materialGroups; /// A pointer to the current material group for this group. Pointer<OBJMaterialGroup> currentMaterialGroup; }; /// An enum contain values for all legal OBJ keywords. typedef enum OBJKeywordType { UNDEFINED_OBJ_KEYWORD = 0, /// Vertex declaration. V = 1, /// Vertex texture coordiante declaration. VT, /// Vertex normal declaration. VN, /// A point in the parameter space of a curve or surface. VP, DEG, BMAT, STEP, CSTYPE, /// Point declaration. P, /// Line declaration. L, /// Face declaration. F, /// 1D curve specification. CURV, /// 2D curve specification. CURV2, /// Surface specification. SURF, PARM, TRIM, HOLE, SCRV, SP, END, CON, G, S, MG, O, BEVEL, C_INTERP, D_INTERP, LOD, COMMENT, /// Material usage declaration. USEMTL, /// Material library import. MTLLIB, SHADOW_OBJ, TRACE_OBJ, CTECH, STECH }; /// An enum that defines the different types of .mtl file keywords. typedef enum MTLKeywordType { UNDEFINED_MTL_KEYWORD = 0, /// New material keyword. NEWMTL = 1, /// Ambient color. KA, /// Diffuse color. KD, /// Specular color. KS, /// Index of refraction. NI, /// Specular coefficient. NS, /// Dissolve amount (transparency). D, /// Illumination model number. ILLUM, /// Diffuse color texture map. MAP_KD, /// Specular color texture map. MAP_KS, /// Ambient color texture map. MAP_KA, /// Specular coefficient texture map. MAP_NS, /// Alpha texture map. MAP_D, /// Bump map. MAP_BUMP, /// Displacement texture map. MAP_DISP, /// Decal stencil texture map. MAP_DECAL, /// Reflection texture map. MAP_REFL, /// 'sound_r' Sound material reflectivity. SOUND_R, /// 'sound_s' Sound material scattering. SOUND_S, /// 'sound_t' Sound material transmission. SOUND_T }; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Helper Methods void readMTLFile( const Path& pathToFile, ResourceManager* resourceManager ) const; Resource<GenericTexture> readTexture( const Path& path, ResourceManager* resourceManager ) const; Bool readFloat( UTF8StringIterator& iterator, Float& value ) const; Bool readVector3( UTF8StringIterator& iterator, Vector3f& vector ) const; Bool readVector2( UTF8StringIterator& iterator, Vector2f& vector ) const; Bool readVector8( UTF8StringIterator& iterator, StaticArray<Float,8>& vector ) const; RIM_INLINE Bool readPosition( UTF8StringIterator& iterator, Vector3f& position ) const { return readVector3( iterator, position ); } RIM_INLINE Bool readNormal( UTF8StringIterator& iterator, Vector3f& normal ) const { return readVector3( iterator, normal ); } RIM_INLINE Bool readUV( UTF8StringIterator& iterator, Vector2f& uv ) const { return readVector2( iterator, uv ); } RIM_INLINE Bool readColor( UTF8StringIterator& iterator, Color3f& color ) const { return readVector3( iterator, *(Vector3f*)&color ); } RIM_INLINE Bool readIndex( UTF8StringIterator& iterator, Index lastVertexIndex, Index& index ) const { // Read the index into a buffer. stringBuffer.clear(); UTF32Char c; Size n = 0; while ( iterator && !isWhitespace(c = *iterator) && c != '/' ) { stringBuffer << c; iterator++; n++; } if ( n == 0 ) return false; // Convert the component from a string to a number. UTF32String number = stringBuffer.toString(); Int64 i; if ( !number.toInt64( i ) ) return false; // If the index is negative (i.e. relative to the last vertex), adjust the index. if ( i < Int64(0) ) index = Index(Int64(lastVertexIndex) + i); else index = Index(i - 1); return true; } Bool readVertex( UTF8StringIterator& iterator, OBJVertex& vertex ) const; Bool readFace( UTF8StringIterator& iterator, OBJPrimitive& primitive ) const; void setCurrentGroup( const UTF32String& groupName ) const { const Size numGroups = groups.getSize(); for ( Index i = 0; i < numGroups; i++ ) { if ( groups[i]->name == groupName ) { currentGroup = groups[i]; return; } } // Didn't find an existing group, so create a new one. currentGroup = Pointer<OBJGroup>::construct( groupName ); groups.add( currentGroup ); } Bool setCurrentMaterial( const UTF32String& materialName ) const { const Size numMaterials = materials.getSize(); for ( Index i = 0; i < numMaterials; i++ ) { if ( materials[i]->name == materialName ) { currentMaterial = materials[i]; return true; } } currentMaterial = Pointer<OBJMaterial>(); return false; } const Pointer<OBJMaterial>& addMaterial( const UTF32String newMaterialName ) const { // Make sure that a material with this name doesn't already exist. const Size numMaterials = materials.getSize(); for ( Index i = 0; i < numMaterials; i++ ) { if ( materials[i]->name == newMaterialName ) return materials[i]; } materials.add( Pointer<OBJMaterial>::construct( newMaterialName ) ); return materials.getLast(); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Parsing Helper Methods static void skipWhitespace( UTF8StringIterator& iterator ) { while ( iterator && isWhitespace(*iterator) ) iterator++; } static void skipLine( UTF8StringIterator& iterator ) { while ( iterator && *iterator != '\n' && *iterator != '\r' ) iterator++; // We are at the character, so skip to next character. while ( iterator && (*iterator == '\n' || *iterator == '\r') ) iterator++; } static void skipToAfterNext( UTF8StringIterator& iterator, UTF32Char c ) { while ( iterator && *iterator != c ) iterator++; // We are at the character, so skip to next character. if ( iterator ) iterator++; } static Size readLine( UTF8StringIterator& iterator, UTF32StringBuffer& buffer ) { UTF32Char c; Size numRead = 0; while ( iterator && (c = *iterator) != '\n' && c != '\r' ) { buffer << c; iterator++; } // We are on the newline, so skip to next character (in the next line). skipLine( iterator ); return numRead; } /// Read a single word from the iterator into the buffer, returning the number of characters read. static Size readWord( UTF8StringIterator& iterator, UTF32Char* output, Size maxLength ) { Size n = 0; UTF32Char c; while ( iterator && n < maxLength && isWordCharacter(c = *iterator) ) { *output = c; output++; iterator++; n++; } return n; } /// Read a single non-whitespace word from the iterator into the buffer, returning the number of characters read. static Size readNonWhitespace( UTF8StringIterator& iterator, UTF32StringBuffer& buffer ) { Size n = 0; UTF32Char c; while ( iterator && !isWhitespace(c = *iterator) ) { buffer << c; iterator++; n++; } return n; } static OBJKeywordType readKeyword( UTF8StringIterator& iterator, UTF32Char* output, Size maxLength ) { Size n = readWord( iterator, output, maxLength ); return getKeywordType( output, n ); } static MTLKeywordType readMTLKeyword( UTF8StringIterator& iterator, UTF32Char* output, Size maxLength ) { Size n = readWord( iterator, output, maxLength ); return getMTLKeywordType( output, n ); } static OBJKeywordType getKeywordType( const UTF32Char* k, Size n ); static MTLKeywordType getMTLKeywordType( const UTF32Char* k, Size n ); /// Return whether or not the specified character is a whitespace character. RIM_INLINE static Bool isWordCharacter( UTF32Char c ) { return UTF32String::isALetter(c) || UTF32String::isADigit(c) || c == '_' || c == '#'; } /// Return whether or not the specified character is a whitespace character. RIM_INLINE static Bool isWhitespace( UTF32Char c ) { return c == ' ' || c == '\t' || c == '\n' || c == '\r'; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Members /// A pointer to a temporary buffer containing the vertex positions for the model being read. mutable Pointer<GenericBuffer> temporaryPositions; mutable Size numPositions; /// A pointer to a temporary buffer containing the vertex normals for the model being read. mutable Pointer<GenericBuffer> temporaryNormals; mutable Size numNormals; /// A pointer to a temporary buffer containing the vertex texture coordinates for the model being read. mutable Pointer<GenericBuffer> temporaryUVs; mutable Size numUVs; /// A list of the different groups that are part of the object being currently read. mutable ArrayList< Pointer<OBJGroup> > groups; /// A pointer to the current primitive group for the parser. mutable Pointer<OBJGroup> currentGroup; /// A list of the different materials that are part of the object being currently read. mutable ArrayList< Pointer<OBJMaterial> > materials; /// A pointer to the current material group for the parser. mutable Pointer<OBJMaterial> currentMaterial; /// A string buffer used to hold intermediate input values; mutable UTF32StringBuffer stringBuffer; mutable HashMap< OBJVertex, Index > vertexMap; mutable HashMap< Pointer<OBJMaterial>, Pointer<GenericMaterial> > materialMap; }; //########################################################################################## //************************** End Rim Graphics IO Namespace ******************************* RIM_GRAPHICS_IO_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_GRAPHICS_OBJ_TRANSCODER_H <file_sep>/* * rimGraphicsGenericCylinderShape.h * Rim Software * * Created by <NAME> on 6/22/14. * Copyright 2014 __MyCompanyName__. All rights reserved. * */ #ifndef INCLUDE_RIM_GRAPHICS_GENERIC_CYLINDER_SHAPE_H #define INCLUDE_RIM_GRAPHICS_GENERIC_CYLINDER_SHAPE_H #include "rimGraphicsShapesConfig.h" #include "rimGraphicsShapeBase.h" //########################################################################################## //*********************** Start Rim Graphics Shapes Namespace **************************** RIM_GRAPHICS_SHAPES_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class which represents a generic cylinder shape. /** * A cylinder can have different radii that cause it to instead be a * truncated cone. * It has an associated generic material for use in drawing. */ class GenericCylinderShape : public GraphicsShapeBase<GenericCylinderShape> { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructors /// Create a cylinder shape centered at the origin with a radius and height of 1. GenericCylinderShape(); /// Create a cylinder shape with the specified endpoints and radius. GenericCylinderShape( const Vector3& newEndpoint1, const Vector3& newEndpoint2, Real newRadius ); /// Create a cylinder shape with the specified endpoints and radii. GenericCylinderShape( const Vector3& newEndpoint1, const Vector3& newEndpoint2, Real newRadius1, Real newRadius2 ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Endpoint Accessor Methods /// Return a const reference to the center of this cylinder shape's first endcap in local coordinates. RIM_FORCE_INLINE const Vector3& getEndpoint1() const { return endpoint1; } /// Set the center of this cylinder shape's first endcap in local coordinates. void setEndpoint1( const Vector3& newEndpoint1 ); /// Return a const reference to the center of this cylinder shape's second endcap in local coordinates. RIM_FORCE_INLINE const Vector3& getEndpoint2() const { return endpoint2; } /// Set the center of this cylinder shape's second endcap in local coordinates. void setEndpoint2( const Vector3& newEndpoint2 ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Axis Accessor Methods /// Return a normalized axis vector for this cylinder, directed from endpoint 1 to endpoint 2. RIM_FORCE_INLINE const Vector3& getAxis() const { return axis; } /// Set a normalized axis vector for this cylinder, directed from endpoint 1 to endpoint 2. /** * Setting this cylinder's axis keeps the cylinder's first endpoint stationary in shape * space and moves the second endpoint based on the new axis and cylinder's height. */ void setAxis( const Vector3& newAxis ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Height Accessor Methods /// Get the distance between the endpoints of this cylinder shape in local coordinates. RIM_FORCE_INLINE Real getHeight() const { return height; } /// Set the distance between the endpoints of this cylinder shape in local coordinates. /** * The value is clamed to the range of [0,+infinity). Setting this height value * causes the cylilnder's second endpoint to be repositioned, keeping the first * endpoint stationary, based on the cylinder's current axis vector. */ void setHeight( Real newHeight ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Radius Accessor Methods /// Get the first endcap radius of this cylinder shape in local coordinates. RIM_FORCE_INLINE Real getRadius1() const { return radius1; } /// Set the first endcap radius of this cylinder shape in local coordinates. /** * The radius is clamed to the range of [0,+infinity). */ void setRadius1( Real newRadius1 ); /// Get the second endcap radius of this cylinder shape in local coordinates. RIM_FORCE_INLINE Real getRadius2() const { return radius2; } /// Set the second endcap radius of this cylinder shape in local coordinates. /** * The radius is clamed to the range of [0,+infinity). */ void setRadius2( Real newRadius2 ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Material Accessor Methods /// Get the material of this generic cylinder shape. RIM_INLINE Pointer<GenericMaterial>& getMaterial() { return material; } /// Get the material of this generic cylinder shape. RIM_INLINE const Pointer<GenericMaterial>& getMaterial() const { return material; } /// Set the material of this generic cylinder shape. RIM_INLINE void setMaterial( const Pointer<GenericMaterial>& newMaterial ) { material = newMaterial; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Bounding Cylinder Update Method /// Update the shape's bounding cylinder based on its current geometric representation. virtual void updateBoundingBox(); private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Helper Methods /// Return the point on this cylinder that is farthest in the specified direction. Vector3 getSupportPoint( const Vector3& direction ) const; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Members /// The center of the first circular cap of this cylinder in shape coordinates. Vector3 endpoint1; /// The center of the second circular cap of this cylinder in shape coordiantes. Vector3 endpoint2; /// The normalized axis vector for this cylinder in shape coordinates. Vector3 axis; /// The radius of the first endcap of this sphere in shape coordinates. Real radius1; /// The radius of the second endcap of this sphere in shape coordinates. Real radius2; /// The distance from one endpoint to another. Real height; /// A pointer to the material to use when rendering this generic cylinder shape. Pointer<GenericMaterial> material; }; //########################################################################################## //*********************** End Rim Graphics Shapes Namespace ****************************** RIM_GRAPHICS_SHAPES_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_GRAPHICS_GENERIC_CYLINDER_SHAPE_H <file_sep>/* * rimGraphicsGenericBuffer.h * Rim Graphics * * Created by <NAME> on 2/10/10. * Copyright 2010 Rim Software. All rights reserved. * */ #ifndef INCLUDE_RIM_GRAPHICS_GENERIC_BUFFER_H #define INCLUDE_RIM_GRAPHICS_GENERIC_BUFFER_H #include "rimGraphicsBuffersConfig.h" //########################################################################################## //*********************** Start Rim Graphics Buffers Namespace *************************** RIM_GRAPHICS_BUFFERS_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class which represents a buffer of shader attributes stored in CPU memory. class GenericBuffer { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructors /// Create an empty generic buffer with the specified data type and zero capacity. RIM_FORCE_INLINE GenericBuffer() : buffer( NULL ), capacityInBytes( 0 ), size( 0 ), type() { } /// Create an empty generic buffer with the specified data type and zero capacity. RIM_FORCE_INLINE GenericBuffer( AttributeType newType ) : buffer( NULL ), capacityInBytes( 0 ), size( 0 ), type( newType ) { } /// Create an empty generic buffer containing the specified data type and with the specified capacity. GenericBuffer( AttributeType newType, Size capacity ); /// Create a copy of another generic buffer. GenericBuffer( const GenericBuffer& other ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Destructor /// Destroy an generic buffer. RIM_INLINE ~GenericBuffer() { if ( buffer != NULL ) util::deallocate( buffer ); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Assignment Operator /// Copy the contents of one generic buffer to this one. GenericBuffer& operator = ( const GenericBuffer& other ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Buffer Size Accessor Methods /// Get the number of attributes stored in the buffer. RIM_FORCE_INLINE Size getSize() const { return size; } /// Change the size of the buffer to hold the specified number of attributes. /** * If the new size is greater than the previous size, the new attribute * values at the end of the buffer are undefined. This method avoids * reallocating the internal buffer array if possible. */ RIM_INLINE void setSize( Size newSize ) { if ( newSize > capacityInBytes ) reallocateBuffer( newSize*type.getSizeInBytes() ); size = newSize; } /// Get the total size of all data in the buffer in bytes. RIM_FORCE_INLINE Size getSizeInBytes() const { return size*type.getSizeInBytes(); } /// Get the number of elements that this generic buffer can hold. RIM_INLINE Size getCapacity() const { return capacityInBytes / type.getSizeInBytes(); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Buffer Attribute Type Accessor Methods /// Get the type of element this buffer holds. RIM_FORCE_INLINE const AttributeType& getAttributeType() const { return type; } /// Set the type of element this buffer holds. /** * This method has the effect of invalidating the contents of the buffer, * setting its size (but not capacity) to 0. */ RIM_INLINE void setAttributeType( const AttributeType& newAttributeType ) { type = newAttributeType; size = 0; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Buffer Information Accessor Methods /// Get a pointer to the start of the internal buffer of attributes. RIM_FORCE_INLINE void* getPointer() { return buffer; } /// Get a const pointer to the start of the internal buffer of attributes. RIM_FORCE_INLINE const void* getPointer() const { return buffer; } /// Get the number of bytes between successive elements in the buffer. RIM_FORCE_INLINE Size getStride() const { return 0; } /// Return whether or not this generic buffer has data. RIM_FORCE_INLINE Bool hasData() const { return buffer != NULL && size != 0; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Buffer Element Accessor Methods /// Return the attribute stored at the specified index in this generic buffer. /** * The method will not compile if an invalid output type is specified. A * debug assertion is raised if the output type is incompatible with the buffer * attribute type or if the specified index is invalid. */ template < typename T > RIM_INLINE T get( Index index ) const { // Statically check to make sure the attribute has a valid attribute type. AttributeType::check<T>(); // Do dynamic debug checks on the type and index. RIM_DEBUG_ASSERT_MESSAGE( typeIsValid<T>(), "Invalid output type for generic buffer attribute get method" ); RIM_DEBUG_ASSERT_MESSAGE( index < size, "Invalid index for generic buffer attribute get method" ); return ((T*)buffer)[index]; } /// Get the attribute stored at the specified index in this generic buffer. /** * The value is stored in the output value parameter. The method returns * whether or not the value was able to be accessed. */ Bool getAttribute( Index index, AttributeValue& value ) const; /// Set the attribute stored at the specified index in this generic buffer. /** * The method will not compile if an invalid output type is specified. A * debug assertion is raised if the input type is incompatible with the buffer * attribute type or if the specified index is invalid. */ template < typename T > RIM_INLINE void set( Index index, const T& element ) { // Statically check to make sure the attribute has a valid attribute type. AttributeType::check<T>(); // Do dynamic debug checks on the type and index. RIM_DEBUG_ASSERT_MESSAGE( typeIsValid<T>(), "Invalid input type for generic buffer attribute set method" ); RIM_DEBUG_ASSERT_MESSAGE( index < size, "Invalid index for generic buffer attribute set method" ); ((T*)buffer)[index] = element; } /// Set the attribute stored at the specified index in this generic buffer. /** * The value is copied from the value parameter. * The method returns whether or not the value was able to be set. * The method can fail if the index is invalid or the value's type * does not match the buffer's type. */ Bool setAttribute( Index index, const AttributeValue& value ) const; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Buffer Add Methods /// Add the specified attribute to the end of the buffer. /** * If the type of the argument is incompatable with the current type of the buffer * then FALSE is returned. Otherwise TRUE is returned. */ Bool addAttribute( const AttributeValue& newAttribute ); /// Add the specified attribute to the end of the buffer. /** * If the type of the argument is incompatable with the current type of the buffer * then FALSE is returned. Otherwise TRUE is returned. */ template < typename T > RIM_INLINE Bool add( const T& newAttribute ) { // Statically check to make sure the attribute has a valid attribute type. AttributeType::check<T>(); // If the type of the buffer was previously undefined, replace the type of the buffer. if ( type == AttributeType::UNDEFINED ) type = AttributeType::get<T>(); else if ( !typeIsValid<T>() ) return false; // If the type of the new attribute is the same as the current type of the buffer, add it. addToBuffer( newAttribute ); return true; } /// Add the specified array list of attributes to the buffer's end. /** * If the type of the argument elements is incompatable with the current type of the buffer * then FALSE is returned. Otherwise TRUE is returned. */ template < typename T > RIM_INLINE Bool add( const ArrayList<T>& newAttributes ) { return add( newAttributes.getArrayPointer(), newAttributes.getSize() ); } /// Add the specified array of attributes to the buffer's end. /** * If the type of the argument elements is incompatable with the current type of the buffer * then FALSE is returned. Otherwise TRUE is returned. */ template < typename T > RIM_INLINE Bool add( const Array<T>& newAttributes ) { return add( newAttributes.getPointer(), newAttributes.getSize() ); } /// Add the specified number of attributes from the given array to the buffer's end. /** * If the type of the argument elements is incompatable with the current type of the buffer * then FALSE is returned. Otherwise TRUE is returned. */ template < typename T > RIM_INLINE Bool add( const T* newAttributes, Size number ) { // Statically check to make sure the attribute has a valid attribute type. AttributeType::check<T>(); // If the type of the buffer was previously undefined, replace the type of the buffer. if ( type == AttributeType::UNDEFINED ) type = AttributeType::get<T>(); else if ( !typeIsValid<T>() ) return false; // If the type of the new attributes is the same as the current type of the buffer, add it. addToBuffer( newAttributes, number ); return true; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Buffer Fill Methods /// Replace the current buffer contents with those in the given array list. /** * If the type of the argument is incompatable with the current type of the buffer * then FALSE is returned and the buffer is unchanged. Otherwise TRUE is returned * and the data from the specified attribute array list is written to the buffer at the * given attribute start index. */ template < typename T > RIM_FORCE_INLINE Bool fill( const ArrayList<T>& newAttributes, Index startIndex = 0 ) { return fill( newAttributes.getPointer(), newAttributes.getSize(), startIndex ); } /// Replace the current buffer contents with those in the given array. /** * If the type of the argument is incompatable with the current type of the buffer * then FALSE is returned and the buffer is unchanged. Otherwise TRUE is returned * and the data from the specified attribute array is written to the buffer at the * given attribute start index. */ template < typename T > RIM_FORCE_INLINE Bool fill( const Array<T>& newAttributes, Index startIndex = 0 ) { return fill( newAttributes.getPointer(), newAttributes.getSize(), startIndex ); } /// Replace the current buffer contents with the specified number from the given array. /** * If the type of the argument is incompatable with the current type of the buffer * then FALSE is returned and the buffer is unchanged. Otherwise TRUE is returned * and the data from the specified attribute pointer is written to the buffer at the * given attribute start index. */ template < typename T > RIM_INLINE Bool fill( const T* newAttributes, Size number, Index startIndex = 0 ) { // Statically check to make sure the attribute has a valid attribute type. AttributeType::check<T>(); // If the type of the buffer was previously undefined, replace the type of the buffer. if ( type == AttributeType::UNDEFINED ) type = AttributeType::get<T>(); else if ( !typeIsValid<T>() ) return false; fillBuffer( newAttributes, number, startIndex ); return true; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Buffer Remove Methods /// Remove the element at the specified index in this buffer. /** * This method maintains the order of the buffer elements and copies them * to fill the space left by the removed element. */ Bool remove( Index index ); /// Remove the element at the specified index in this buffer. /** * This method moves the last element in the buffer to fill the space * left by the removed element. */ Bool removeUnordered( Index index ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Buffer Clear Methods /// Clear all entries and the associated attribute type type from the buffer. /** * This method doesn't release any of the buffer's data, allowing the buffer's * data to be reused again. */ RIM_INLINE void clear() { size = 0; type = AttributeType::UNDEFINED; } private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Helper Functions void addAttributeToBuffer( const UByte* attribute ); template < typename T > RIM_INLINE void addToBuffer( const T& attribute ) { // If the buffer is too small, double its capacity if ( sizeof(T)*(size + 1) >= capacityInBytes ) reallocateBuffer( 2*sizeof(T)*(size + 1) ); ((T*)buffer)[size] = attribute; size++; } template < typename T > RIM_INLINE void addToBuffer( const T* attributes, Size number ) { Size newSizeInBytes = sizeof(T)*(number + size); // If the buffer is too small, increase its capacity to the smallest that will // hold the given attributes. if ( newSizeInBytes > capacityInBytes ) reallocateBuffer( newSizeInBytes ); util::copy( (T*)buffer + size, attributes, number ); size += number; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Buffer Fill Functions template < typename T > RIM_INLINE void fillBuffer( const T* attributes, Size number, Index startIndex ) { // Compute the required size in bytes of the buffer. Size newSize = math::max( size, number + startIndex ); Size newSizeInBytes = sizeof(T)*newSize; // If the buffer is too small, increase its capacity to the smallest that will // hold the given attributes. if ( newSizeInBytes > capacityInBytes ) reallocateBuffer( newSizeInBytes ); // Copy the attributes. util::copy( (T*)buffer + startIndex, attributes, number ); size = newSize; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Buffer Reallocation Method /// Reallocate the internal data for the generic buffer to have the specified capacity in bytes. void reallocateBuffer( Size requestedCapacityInBytes ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Type Validity Checking Functions /// Return whether or not the specified template attribute type is compatible with this buffer. template < typename T > RIM_FORCE_INLINE Bool typeIsValid() const { return AttributeType::get<T>() == type; } /// Return whether or not the specified attribute type is compatible with this buffer. RIM_FORCE_INLINE Bool typeIsValid( const AttributeType& aType ) const { return type == aType; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Members /// An generic buffer of attributes. UByte* buffer; /// The number of attributes stored in the buffer. Size size; /// The number of bytes consumed by the attribute buffer. Size capacityInBytes; /// The type of the attributes that are stored in the generic buffer. AttributeType type; }; //########################################################################################## //*********************** End Rim Graphics Buffers Namespace ***************************** RIM_GRAPHICS_BUFFERS_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_GRAPHICS_GENERIC_BUFFER_H <file_sep>/* * rimAABB2D.h * Rim Math * * Created by <NAME> on 11/10/07. * Copyright 2007 Rim Software. All rights reserved. * */ #ifndef INCLUDE_RIM_AABB_2D_H #define INCLUDE_RIM_AABB_2D_H #include "rimMathConfig.h" #include "../data/rimBasicString.h" #include "../data/rimBasicStringBuffer.h" #include "rimAABB1D.h" #include "rimVector2D.h" //########################################################################################## //***************************** Start Rim Math Namespace ********************************* RIM_MATH_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class which represents a range of values in 2D space. /** * This class contains two data members: min and max. These indicate the minimum * and maximum coordinates that this axis-aligned bounding box represents. The class * invariant is that min is less than max (on at least one dimension), though this * is not enforced. The class supports union, containment, and intersection operations. */ template < typename T > class AABB2D { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructors /// Create a 2D axis-aligned bounding box with no extent centered about the origin. RIM_FORCE_INLINE AABB2D() : min(), max() { } /// Create a 2D axis-aligned bounding box with the specified minimum and maximum coodinates. RIM_FORCE_INLINE AABB2D( T newXMin, T newXMax, T newYMin, T newYMax ) : min( newXMin, newYMin ), max( newXMax, newYMax ) { } /// Create a 2D axis-aligned bounding box with the minimum and maximum coordinates equal to the specified vector. RIM_FORCE_INLINE AABB2D( const Vector2D<T>& center ) : min( center ), max( center ) { } /// Create a 2D axis-aligned bounding box with the specified minimum and maximum coodinates. RIM_FORCE_INLINE AABB2D( const Vector2D<T>& newMin, const Vector2D<T>& newMax ) : min( newMin ), max( newMax ) { } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** AABB Cast Operator /// Cast this bounding box to a bounding box with a different underlying primitive type. template < typename U > RIM_FORCE_INLINE operator AABB2D<U> () const { return AABB2D<U>( (U)min.x, (U)max.x, (U)min.y, (U)max.y ); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** AABB Comparison Methods /// Return whether or not this bounding box completely contains another. RIM_FORCE_INLINE Bool contains( const AABB2D& bounds ) const { return min.x <= bounds.min.x && max.x >= bounds.max.x && min.y <= bounds.min.y && max.y >= bounds.max.y; } /// Return whether or not this bounding box contains the specified coordinate. RIM_FORCE_INLINE Bool contains( const Vector2D<T>& coordinate ) const { return coordinate.x >= min.x && coordinate.x <= max.x && coordinate.y >= min.y && coordinate.y <= max.y; } /// Return whether or not this bounding box intersects another. RIM_FORCE_INLINE Bool intersects( const AABB2D& bounds ) const { return (min.x < bounds.max.x) && (max.x > bounds.min.x) && (min.y < bounds.max.y) && (max.y > bounds.min.y); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Accessor Methods /// Set the minimum and maximum coordinates of the axis-aligned bounding box. RIM_FORCE_INLINE void set( T newXMin, T newXMax, T newYMin, T newYMax ) { min.set( newXMin, newYMin ); max.set( newXMax, newYMax ); } /// Get the different between the maximum and minimum X coordinates. RIM_FORCE_INLINE T getWidth() const { return max.x - min.x; } /// Get the different between the maximum and minimum Y coordinates. RIM_FORCE_INLINE T getHeight() const { return max.y - min.y; } /// Return a vector indicating the axial distances between the minimum and maximum coordinate. RIM_FORCE_INLINE Vector2D<T> getSize() const { return max - min; } /// Get the vector from the minimum coordinate to the maximum. RIM_FORCE_INLINE Vector2D<T> getDiagonal() const { return max - min; } /// Get the center of the bounding box. RIM_FORCE_INLINE Vector2D<T> getCenter() const { return math::midpoint( min, max ); } /// Get the area in square units enclosed by this 3D range. RIM_FORCE_INLINE T getArea() const { return this->getWidth()*this->getHeight(); } /// Return either the minimal or maximal vertex of this AABB. /** * If the index parameter is 0, the minimal vertex is returned, if the * index parameter is 1, the maximal vertex is returned. Otherwise the * result is undefined. */ RIM_FORCE_INLINE const Vector2D<T>& getMinMax( Index i ) const { return (&min)[i]; } /// Return a 1D AABB for the X coordinate range of this AABB. RIM_FORCE_INLINE AABB1D<T> getX() const { return AABB1D<T>( min.x, max.x ); } /// Return a 1D AABB for the Y coordinate range of this AABB. RIM_FORCE_INLINE AABB1D<T> getY() const { return AABB1D<T>( min.y, max.y ); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Enlargement Methods /// Modify the current bounding box such that it encloses the specified point. RIM_FORCE_INLINE void enlargeFor( const Vector2D<T>& point ) { min = math::min( min, point ); max = math::max( max, point ); } /// Modify the current bounding box such that it encloses the specified box. RIM_FORCE_INLINE void enlargeFor( const AABB2D& bounds ) { min = math::min( min, bounds.min ); max = math::max( max, bounds.max ); } /// Modify the current bounding box such that it encloses the specified point. RIM_FORCE_INLINE AABB2D<T>& operator |= ( const Vector2D<T>& point ) { min = math::min( min, point ); max = math::max( max, point ); return *this; } /// Return the bounding box necessary to enclose a point and the current bounding box. RIM_FORCE_INLINE AABB2D<T> operator | ( const Vector2D<T>& point ) const { return AABB2D<T>( math::min( min, point ), math::max( max, point ) ); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Union Methods /// Return the union of this bounding box and another. RIM_FORCE_INLINE AABB2D<T> getUnion( const AABB2D<T>& bounds ) const { return AABB2D<T>( math::min( min, bounds.min ), math::max( max, bounds.max ) ); } /// Modify this bounding box such that it contains the specified bounding box. RIM_FORCE_INLINE AABB2D<T>& operator |= ( const AABB2D<T>& bounds ) { min = math::min( min, bounds.min ); max = math::max( max, bounds.max ); return *this; } /// Return the union of this bounding box and another. RIM_FORCE_INLINE AABB2D<T> operator | ( const AABB2D<T>& bounds ) const { return this->getUnion( bounds ); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Intersection Methods /// Return the intersection of this bounding box and another. RIM_FORCE_INLINE AABB2D<T> getIntersection( const AABB2D<T>& bounds ) const { return AABB2D<T>( math::max( min, bounds.min ), math::min( max, bounds.max ) ); } /// Return the intersection of this bounding box and another. RIM_FORCE_INLINE AABB2D<T>& operator &= ( const AABB2D<T>& bounds ) { min = math::max( min, bounds.min ); max = math::min( max, bounds.max ); return *this; } /// Return the intersection of this bounding box and another. RIM_FORCE_INLINE AABB2D<T> operator & ( const AABB2D<T>& bounds ) const { return this->getIntersection( bounds ); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Comparison Operators /// Return whether or not this bounding box is exactly the same as another. RIM_INLINE Bool operator == ( const AABB2D<T>& other ) const { return min == other.min && max == other.max; } /// Return whether or not this bounding box is different than another. RIM_INLINE Bool operator != ( const AABB2D<T>& other ) const { return min != other.min || max != other.max; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** String Conversion Methods /// Convert this 2D range into a human-readable string representation. RIM_NO_INLINE data::String toString() const { data::StringBuffer buffer; buffer << "[ " << min.x << " < " << max.x; buffer << ", " << min.y << " < " << max.y << " ]"; return buffer.toString(); } /// Convert this 2D range into a human-readable string representation. RIM_FORCE_INLINE operator data::String () const { return this->toString(); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Public Data Members /// The minumum coordinate of the bounding box. Vector2D<T> min; /// The maximum coordinate of the bounding box. Vector2D<T> max; }; //########################################################################################## //***************************** End Rim Math Namespace *********************************** RIM_MATH_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_AABB_2D_H <file_sep>/* * rimSoundInt24.h * Rim Sound * * Created by <NAME> on 6/7/08. * Copyright 2008 Rim Software. All rights reserved. * */ #ifndef INCLUDE_RIM_SOUND_INT_24_H #define INCLUDE_RIM_SOUND_INT_24_H #include "rimSoundUtilitiesConfig.h" //########################################################################################## //*********************** Start Rim Sound Utilities Namespace **************************** RIM_SOUND_UTILITIES_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class used to represent a 24-bit integer number. /** * This class helps facilitate operations on 24-bit sound samples * by providing methods which pack and unpack a 24-bit sound sample * from/to a 32-bit integer sound sample. This class should be exactly * 24 bits wide, allowing its use in arrays of samples. */ class Int24 { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructors /// Create a 24-bit sample equal to 0. RIM_FORCE_INLINE Int24() { data[0] = data[1] = data[2] = 0; } /// Create a 24-bit sample from the specified 32-bit integer sample, discarding the lower bits. RIM_FORCE_INLINE Int24( Int32 value ) { pack( value ); } /// Cast this 24-bit sample to a 32-bit integer sample. RIM_FORCE_INLINE operator Int32 () const { return unpack(); } private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Helper Methods /// Unpack this 24-bit sample into a 32-bit integer sample. RIM_INLINE Int32 unpack() const { return Int32(data[0] << 24) | Int32(data[1] << 16) | Int32(data[2] << 8); } /// Pack the specified 32-bit integer sample into this 24-bit sample, discarding the lower bits. RIM_INLINE void pack( Int32 value ) { value = math::clamp( value, -Int32(1 << 23), Int32(1 << 23) - 1 ); data[0] = (UInt8)((value & 0xFF000000) >> 24); data[1] = (UInt8)((value & 0x00FF0000) >> 16); data[2] = (UInt8)((value & 0x0000FF00) >> 8); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Members /// An array of 3 bytes representing the 3 bytes of a 24-bit word. UInt8 data[3]; }; //########################################################################################## //*********************** End Rim Sound Utilities Namespace ****************************** RIM_SOUND_UTILITIES_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_SOUND_INT_24_H <file_sep>/* * rimGraphicsTexturesConfig.h * Rim Graphics * * Created by <NAME> on 11/28/11. * Copyright 2011 __MyCompanyName__. All rights reserved. * */ #ifndef INCLUDE_RIM_GRAPHICS_TEXTURES_CONFIG_H #define INCLUDE_RIM_GRAPHICS_TEXTURES_CONFIG_H #include "../rimGraphicsConfig.h" #include "../rimGraphicsUtilities.h" #include "../devices/rimGraphicsContextObject.h" //########################################################################################## //########################################################################################## //############ //############ Library Namespace Configuration //############ //########################################################################################## //########################################################################################## #ifndef RIM_GRAPHICS_TEXTURES_NAMESPACE_START #define RIM_GRAPHICS_TEXTURES_NAMESPACE_START RIM_GRAPHICS_NAMESPACE_START namespace textures { #endif #ifndef RIM_GRAPHICS_TEXTURES_NAMESPACE_END #define RIM_GRAPHICS_TEXTURES_NAMESPACE_END }; RIM_GRAPHICS_NAMESPACE_END #endif //########################################################################################## //********************** Start Rim Graphics Textures Namespace *************************** RIM_GRAPHICS_TEXTURES_NAMESPACE_START //****************************************************************************************** //########################################################################################## using rim::images::Image; using rim::images::PixelFormat; using rim::graphics::devices::ContextObject; //########################################################################################## //********************** End Rim Graphics Textures Namespace ***************************** RIM_GRAPHICS_TEXTURES_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_GRAPHICS_TEXTURES_CONFIG_H <file_sep>/* * rimGraphicsTextures.h * Rim Graphics * * Created by <NAME> on 11/28/11. * Copyright 2011 __MyCompanyName__. All rights reserved. * */ #ifndef INCLUDE_RIM_GRAPHICS_TEXTURES_H #define INCLUDE_RIM_GRAPHICS_TEXTURES_H #include "textures/rimGraphicsTexturesConfig.h" #include "textures/rimGraphicsTextureFace.h" #include "textures/rimGraphicsTextureFilterType.h" #include "textures/rimGraphicsTextureFormat.h" #include "textures/rimGraphicsTextureWrapType.h" #include "textures/rimGraphicsTextureType.h" #include "textures/rimGraphicsTextureUsage.h" #include "textures/rimGraphicsTexture.h" #include "textures/rimGraphicsGenericTexture.h" #include "textures/rimGraphicsShadowMap.h" #include "textures/rimGraphicsFramebuffer.h" #include "textures/rimGraphicsFramebufferAttachment.h" #endif // INCLUDE_RIM_GRAPHICS_TEXTURES_H <file_sep>/* * rimGraphicsGUIStyle.h * Rim Software * * Created by <NAME> on 11/4/14. * Copyright 2014 __MyCompanyName__. All rights reserved. * */ #ifndef INCLUDE_RIM_GRAPHICS_GUI_STYLE_H #define INCLUDE_RIM_GRAPHICS_GUI_STYLE_H #include "rimGraphicsGUIBase.h" //########################################################################################## //************************ Start Rim Graphics GUI Namespace ****************************** RIM_GRAPHICS_GUI_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class which represents the style to use when drawing a GUI object. /** * A style object contains a set of shader passes that are used to draw * different parts of GUI elements. */ class GUIStyle { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructors /// Create a new GUI style without any shaders set. RIM_INLINE GUIStyle() { } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Public Data Members /// The default shader to use to draw a border area of a rectangle. Pointer<ShaderPass> border; /// The shader to use to draw a solid border area of a rectangle. Pointer<ShaderPass> borderSolid; /// The shader to use to draw a raised border area of a rectangle. Pointer<ShaderPass> borderRaised; /// The shader to use to draw a sunken border area of a rectangle. Pointer<ShaderPass> borderSunken; /// The shader to use to draw the background of a rectangular content area. Pointer<ShaderPass> content; /// The shader to use to draw raster images. Pointer<ShaderPass> image; /// The shader to use to draw text glyphs. Pointer<ShaderPass> text; }; //########################################################################################## //************************ End Rim Graphics GUI Namespace ******************************** RIM_GRAPHICS_GUI_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_GRAPHICS_GUI_STYLE_H <file_sep>/* * rimDefaultSoundDevice.h * Rim Sound * * Created by <NAME> on 7/25/12. * Copyright 2012 __MyCompanyName__. All rights reserved. * */ #ifndef INCLUDE_RIM_DEFAULT_SOUND_DEVICE_H #define INCLUDE_RIM_DEFAULT_SOUND_DEVICE_H #include "rimSoundDevicesConfig.h" #include "rimSoundDeviceID.h" #include "rimSoundDeviceManager.h" #include "rimSoundDevice.h" //########################################################################################## //************************ Start Rim Sound Devices Namespace ***************************** RIM_SOUND_DEVICES_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class which maintains a default input and output device abstraction layer. /** * This class automatically keeps track of the current default system input and * output devices and acts as a wrapper for those devices with the same interface * as the SoundDevice class. This allows the user to not have to manage this information * themselves and simplifies basic audio application development. */ class DefaultSoundDevice { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructors /// Create a new default sound device with the current default input and output devices. DefaultSoundDevice(); /// Create a copy of the specified default sound device. DefaultSoundDevice( const DefaultSoundDevice& other ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Destructor /// Destroy a DefaultSoundDevice object, stopping the input/output of any audio. ~DefaultSoundDevice(); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Assignment Operator /// Assign the state from one DefaultSoundDevice to this object. DefaultSoundDevice& operator = ( const DefaultSoundDevice& other ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Sound IO Start/Stop Methods /// Start sending audio to the device. /** * If this device has no output callback, zeroes are sent to the device until * a callback function is bound to the device. If the device is invalid, * this method has no effect. * * This method has the effect of starting a new audio rendering thread which * will then handle requesting audio data from the output callback function * until the callback function is changed or removed or the device's output * is stopped using the stop() method. */ void start(); /// Stop sending/receiving audio data to the device. /** * If the device is currently outputing audio, the output of further audio * is stopped. Otherwise, the method has no effect. If the device is invalid, * this method has no effect. * * This method has the effect of stopping the audio rendering thread that was * started in the start() method. */ void stop(); /// Return whether or not the device is currently sending/receiving audio. /** * If audio is currently being requested and sent to the device, TRUE is returned. * Otherwise, FALSE is returned. If the device is invalid, FALSE is always * returned. * * @return whether or not the device is currently outputing audio. */ Bool isRunning() const; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Device Input Channel Accessor Methods /// Get the number of input channels that this device has. /** * If the device is invalid, this method always returns 0. */ Size getInputChannelCount() const; /// Return a human-readable name for the input channel at the specified index. /** * This is a string provided by the device driver which names the input channel * with the given index. If an invalid channel index is specified, an empty * string is returned. */ UTF8String getInputChannelName( Index inputChannelIndex ) const; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Device Output Channel Accessor Methods /// Get the number of output channels that this device has. /** * If the device is invalid, this method always returns 0. */ Size getOutputChannelCount() const; /// Return a human-readable name for the output channel at the specified index. /** * This is a string provided by the device driver which names the output channel * with the given index. If an invalid channel index is specified, an empty * string is returned. */ UTF8String getOutputChannelName( Index outputChannelIndex ) const; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Sample Rate Accessor Methods /// Get the current sampling rate for the default input device. /** * This is the sample rate of the device's clock. * * @return the current sample rate of the default input device's clock. */ SampleRate getInputSampleRate() const; /// Get the current sampling rate for the default output device. /** * This is the sample rate of the device's clock. * * @return the current sample rate of the default output device's clock. */ SampleRate getOutputSampleRate() const; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Latency Accessor Methods /// Return the one-way input latency in seconds of this sound device. /** * This is the total time that it takes for the sound device to * preset input, given an analogue input signal. */ Time getInputLatency() const; /// Return the one-way output latency in seconds of this sound device. /** * This is the total time that it takes for the sound device to * produce output, given input audio data. */ Time getOutputLatency() const; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Device Name Accessor Method /// Get a string representing the name of the default input device. UTF8String getInputName() const; /// Get a string representing the name of the default input device's manufacturer. UTF8String getInputManufacturer() const; /// Get a string representing the name of the default input device. UTF8String getOutputName() const; /// Get a string representing the name of the default input device's manufacturer. UTF8String getOutputManufacturer() const; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Delegate Accessor Methods /// Return a reference to the delegate object which is responding to events for this device manager. RIM_INLINE const SoundDeviceDelegate& getDelegate() const { return delegate; } /// Replace the delegate object which is responding to events for this device manager. void setDelegate( const SoundDeviceDelegate& newDelegate ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Device Status Accessor Method /// Return whether or not this device represents a valid device. /** * If a SoundDevice is created with a SoundDeviceID that does not * represent a valid system audio device or if a device is removed after * it is created, the SoundDevice is marked as invalid and this * method will return FALSE. Otherwise, if the device is valid, the method * returns TRUE. * * If a device is invalid, the output callback method will not be called anymore * and the application should switch to a different device. The application * should periodically check the return value of this function to see if the * device has been removed. */ Bool isValid() const; /// Return whether or not this device is an input device. /** * If this is true, the device will have at least one output channel. * Otherwise, the device should have 0 output channels. */ Bool isInput() const; /// Return whether or not this device is an output device. /** * If this is true, the device will have at least one output channel. * Otherwise, the device should have 0 output channels. */ Bool isOutput() const; /// Return whether or not this device represents the current default system input device. /** * This method will return TRUE unless there is no default input device or * if the default input device has no channels. */ RIM_INLINE Bool isDefaultInput() const { return this->isInput(); } /// Return whether or not this device represents the current default system output device. /** * This method will return TRUE unless there is no default output device or * if the default output device has no channels. */ RIM_INLINE Bool isDefaultOutput() const { return this->isOutput(); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** CPU Usage Accessor Methods /// Return a value indicating the fraction of available CPU time being used to process audio for the last frame. /** * This value lies in the range [0,1] where 0 indicates that no time is used, and 1 indicates * that 100% of the available time is used. Going over 100% of the available time means * that the audio processing thread has stalled, producing clicks or pops in the audio * due to dropped frames. * * This is the CPU usage amount for the last processed frame of audio. Use this value * to obtain an instantaneous usage metric. */ Float getCurrentCPUUsage() const; /// Return a value indicating the average fraction of available CPU time being used to process audio. /** * This value lies in the range [0,1] where 0 indicates that no time is used, and 1 indicates * that 100% of the available time is used. Going over 100% of the available time means * that the audio processing thread has stalled, producing clicks or pops in the audio * due to dropped frames. * * This average value is computed using an envelope filter with a fast attack time and a * release time of half a second. This value is computed to give a long-time indication of the * CPU usage over many processing frames. */ Float getAverageCPUUsage() const; private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Helper Methods /// Start the system polling thread and initialize other class data. void initialize(); /// Stop the system polling thread and clean up other class data. void deinitialize(); /// The function called when starting a new default device system polling thread. void pollingThreadEntryPoint(); /// The callback function called by the device manager whenever a device is removed. void deviceRemoved( SoundDeviceManager& manager, const SoundDeviceID& oldID ); /// Refresh the current default input device. This method is not synchronized, so sync it elsewhere! void refreshDefaultInput(); /// Refresh the current default output device. This method is not synchronized, so sync it elsewhere! void refreshDefaultOutput(); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Members /// An object which manages the list of devices. SoundDeviceManager deviceManager; /// A pointer to a SoundDevice object for the default audio input device. SoundDevice* input; /// A pointer to a SoundDevice object for the default audio output device. SoundDevice* output; /// A delegate object which responds to events for this sound device. SoundDeviceDelegate delegate; /// A thread object for the thread which polls the system to see if the default devices have changed. threads::Thread pollingThread; /// A mutex which synchronizes changes to the input and output devices. mutable threads::Mutex deviceChangeMutex; /// Whether or not the IO thread is currently running. Bool running; /// A boolean flag which allows the system polling thread to know when to stop. Bool shouldStopPolling; }; //########################################################################################## //************************ End Rim Sound Devices Namespace ******************************* RIM_SOUND_DEVICES_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_DEFAULT_SOUND_DEVICE_H <file_sep>/* * rimEntityComponent.h * Rim Entity * * Created by <NAME> on 11/19/13. * Copyright 2013 __MyCompanyName__. All rights reserved. * */ #ifndef INCLUDE_RIM_ENTITY_COMPONENT_H #define INCLUDE_RIM_ENTITY_COMPONENT_H #include "rimEntitiesConfig.h" //########################################################################################## //************************** Start Rim Entities Namespace ******************************** RIM_ENTITIES_NAMESPACE_START //****************************************************************************************** //########################################################################################## /// A class which encapsulates a named object. template < typename ComponentType > class Component { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructors /// Create a new unnnamed component with the specified value. RIM_INLINE Component( const Pointer<ComponentType>& newValue ) : name(), value( newValue ) { } /// Create a new component with the specified value and name. RIM_INLINE Component( const Pointer<ComponentType>& newValue, const String& newName ) : name( newName ), value( newValue ) { } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Component Name Accessor Methods /// Return a reference to a string representing the name of this component. RIM_INLINE const String& getName() const { return name; } /// Return a reference to a string representing the name of this component. RIM_INLINE void setName( const String& newName ) { name = newName; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Event Value Accessor Methods /// Return a reference to the value object stored by this component. RIM_INLINE Pointer<ComponentType>& getValue() { return value; } /// Return a const reference to the value object stored by this component. RIM_INLINE const Pointer<ComponentType>& getValue() const { return value; } /// Set the value object stored by this component. RIM_INLINE void setValue( const Pointer<ComponentType>& newValue ) { value = newValue; } private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Members /// A string representing the name of this component. String name; /// The value of this component, the object that it stores. Pointer<ComponentType> value; }; //########################################################################################## //************************** End Rim Entities Namespace ********************************** RIM_ENTITIES_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_ENTITY_COMPONENT_H <file_sep>/* * rimSoundParametricEqualizer.h * Rim Sound * * Created by <NAME> on 11/30/12. * Copyright 2012 __MyCompanyName__. All rights reserved. * */ #ifndef INCLUDE_RIM_SOUND_PARAMETRIC_EQUALIZER_H #define INCLUDE_RIM_SOUND_PARAMETRIC_EQUALIZER_H #include "rimSoundFiltersConfig.h" #include "rimSoundFilter.h" #include "rimSoundParametricFilter.h" #include "rimSoundCutoffFilter.h" #include "rimSoundShelfFilter.h" #include "rimSoundGainFilter.h" //########################################################################################## //************************ Start Rim Sound Filters Namespace ***************************** RIM_SOUND_FILTERS_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class that provides a basic 5-band parametric EQ with additional high/low shelf/pass filters. class ParametricEqualizer : public SoundFilter { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructors /// Create a default parametric equalizer with 5 parametric filter bands. ParametricEqualizer(); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Output Gain Accessor Methods /// Return the linear output gain for this parametric equalizer. RIM_INLINE Gain getOutputGain() const { return gainFilter.getGain(); } /// Return the output gain in decibels for this parametric equalizer. RIM_INLINE Gain getOutputGainDB() const { return gainFilter.getGainDB(); } /// Set the linear output gain for this parametric equalizer. RIM_INLINE void setOutputGain( Gain newGain ) { lockMutex(); gainFilter.setGain( newGain ); unlockMutex(); } /// Set the output gain in decibels for this parametric equalizer. RIM_INLINE void setOutputGainDB( Gain newGain ) { lockMutex(); gainFilter.setGainDB( newGain ); unlockMutex(); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Parametric Filter Accessor Methods /// Return the number of parametric EQ filters that make up this parametric equalizer. RIM_INLINE Size getParametricCount() const { return parametrics.getSize(); } /// Set the number of parametric EQ filters that make up this parametric equalizer. /** * If the specified new number of parametric filters is less than the old number, * the unnecessary filters are removed and deleted. If the new number is greater, * the new frequency bands are initialzed to have the center frequency of 1000Hz. */ RIM_INLINE void setParametricCount( Size newNumberOfParametrics ) { lockMutex(); parametrics.setSize( newNumberOfParametrics ); unlockMutex(); } /// Return whether or not the parametric filter within this equalizer at the specified index is enabled. RIM_INLINE Bool getParametricIsEnabled( Index parametricIndex ) const { if ( parametricIndex < parametrics.getSize() ) return parametrics[parametricIndex].isEnabled; else return false; } /// Set whether or not the parametric filter within this equalizer at the specified index is enabled. RIM_INLINE void setParametricIsEnabled( Index parametricIndex, Bool newIsEnabled ) { lockMutex(); if ( parametricIndex < parametrics.getSize() ) parametrics[parametricIndex].isEnabled = newIsEnabled; unlockMutex(); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Parametric Filter Gain Accessor Methods /// Return the linear gain of the parametric filter within this equalizer at the specified index. RIM_INLINE Gain getParametricGain( Index parametricIndex ) const { if ( parametricIndex < parametrics.getSize() ) return parametrics[parametricIndex].filter.getGain(); else return Gain(0); } /// Return the gain in decibels of the parametric filter within this equalizer at the specified index. RIM_INLINE Gain getParametricGainDB( Index parametricIndex ) const { if ( parametricIndex < parametrics.getSize() ) return parametrics[parametricIndex].filter.getGainDB(); else return math::negativeInfinity<Gain>(); } /// Set the linear gain of the parametric filter within this equalizer at the specified index. RIM_INLINE void setParametricGain( Index parametricIndex, Gain newGain ) { lockMutex(); if ( parametricIndex < parametrics.getSize() ) parametrics[parametricIndex].filter.setGain( newGain ); unlockMutex(); } /// Set the gain in decibels of the parametric filter within this equalizer at the specified index. RIM_INLINE void setParametricGainDB( Index parametricIndex, Gain newGain ) { lockMutex(); if ( parametricIndex < parametrics.getSize() ) parametrics[parametricIndex].filter.setGainDB( newGain ); unlockMutex(); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Parametric Filter Frequency Accessor Methods /// Return the center frequency of the parametric filter within this equalizer at the specified index. RIM_INLINE Float getParametricFrequency( Index parametricIndex ) const { if ( parametricIndex < parametrics.getSize() ) return parametrics[parametricIndex].filter.getFrequency(); else return Float(0); } /// Set the center frequency of the parametric filter within this equalizer at the specified index. RIM_INLINE void setParametricFrequency( Index parametricIndex, Float newFrequency ) { lockMutex(); if ( parametricIndex < parametrics.getSize() ) parametrics[parametricIndex].filter.setFrequency( newFrequency ); unlockMutex(); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Parametric Filter Bandwidth Accessor Methods /// Return the Q factor of the parametric filter within this equalizer at the specified index. RIM_INLINE Float getParametricQ( Index parametricIndex ) const { if ( parametricIndex < parametrics.getSize() ) return parametrics[parametricIndex].filter.getQ(); else return Float(0); } /// Set the Q factor of the parametric filter within this equalizer at the specified index. RIM_INLINE void setParametricQ( Index parametricIndex, Float newQ ) { lockMutex(); if ( parametricIndex < parametrics.getSize() ) parametrics[parametricIndex].filter.setQ( newQ ); unlockMutex(); } /// Return the bandwidth in octaves of the parametric filter within this equalizer at the specified index. RIM_INLINE Float getParametricBandwidth( Index parametricIndex ) const { if ( parametricIndex < parametrics.getSize() ) return parametrics[parametricIndex].filter.getBandwidth(); else return Float(0); } /// Set the bandwidth in octaves of the parametric filter within this equalizer at the specified index. RIM_INLINE void setParametricBandwidth( Index parametricIndex, Float newBandwidth ) { lockMutex(); if ( parametricIndex < parametrics.getSize() ) parametrics[parametricIndex].filter.setBandwidth( newBandwidth ); unlockMutex(); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** High-Pass Filter Frequency Accessor Methods /// Return the corner frequency of this parametric equalizer's high pass filter. RIM_INLINE Float getHighPassFrequency() const { return highPass.getFrequency(); } /// Set the corner frequency of this parametric equalizer's high pass filter. RIM_INLINE void setHighPassFrequency( Float newFrequency ) { lockMutex(); highPass.setFrequency( newFrequency ); unlockMutex(); } /// Return the order of this parametric equalizer's high pass filter. RIM_INLINE Size getHighPassOrder() const { return highPass.getOrder(); } /// Set the order of this parametric equalizer's high pass filter. RIM_INLINE void setHighPassOrder( Size newOrder ) { lockMutex(); highPass.setOrder( newOrder ); unlockMutex(); } /// Return whether or not the high pass filter of this parametric equalizer is enabled. RIM_INLINE Bool getHighPassIsEnabled() const { return highPassEnabled; } /// Set whether or not the high pass filter of this parametric equalizer is enabled. RIM_INLINE void setHighPassIsEnabled( Bool newIsEnabled ) { lockMutex(); highPassEnabled = newIsEnabled; unlockMutex(); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Low-Pass Filter Attribute Accessor Methods /// Return the corner frequency of this parametric equalizer's low pass filter. RIM_INLINE Float getLowPassFrequency() const { return lowPass.getFrequency(); } /// Set the corner frequency of this parametric equalizer's low pass filter. RIM_INLINE void setLowPassFrequency( Float newFrequency ) { lockMutex(); lowPass.setFrequency( newFrequency ); unlockMutex(); } /// Return the order of this parametric equalizer's low pass filter. RIM_INLINE Size getLowPassOrder() const { return lowPass.getOrder(); } /// Set the order of this parametric equalizer's low pass filter. RIM_INLINE void setLowPassOrder( Size newOrder ) { lockMutex(); lowPass.setOrder( newOrder ); unlockMutex(); } /// Return whether or not the low pass filter of this parametric equalizer is enabled. RIM_INLINE Bool getLowPassIsEnabled() const { return lowPassEnabled; } /// Set whether or not the low pass filter of this parametric equalizer is enabled. RIM_INLINE void setLowPassIsEnabled( Bool newIsEnabled ) { lockMutex(); lowPassEnabled = newIsEnabled; unlockMutex(); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Low Shelf Filter Attribute Accessor Methods /// Return the corner frequency of this parametric equalizer's low shelf filter. RIM_INLINE Float getLowShelfFrequency() const { return lowShelf.getFrequency(); } /// Set the corner frequency of this parametric equalizer's low shelf filter. RIM_INLINE void setLowShelfFrequency( Float newFrequency ) { lockMutex(); lowShelf.setFrequency( newFrequency ); unlockMutex(); } /// Return the linear gain of this parametric equalizer's low shelf filter. RIM_INLINE Gain getLowShelfGain() const { return lowShelf.getGain(); } /// Return the gain in decibels of this parametric equalizer's low shelf filter. RIM_INLINE Gain getLowShelfGainDB() const { return lowShelf.getGainDB(); } /// Set the linear gain of this parametric equalizer's low shelf filter. RIM_INLINE void setLowShelfGain( Gain newGain ) { lockMutex(); lowShelf.setGain( newGain ); unlockMutex(); } /// Set the gain in decibels of this parametric equalizer's low shelf filter. RIM_INLINE void setLowShelfGainDB( Gain newGain ) { lockMutex(); lowShelf.setGainDB( newGain ); unlockMutex(); } /// Return the slope of this parametric equalizer's low shelf filter. RIM_INLINE Float getLowShelfSlope() const { return lowShelf.getGain(); } /// Set the slope of this parametric equalizer's low shelf filter. RIM_INLINE void setLowShelfSlope( Float newSlope ) { lockMutex(); lowShelf.setSlope( newSlope ); unlockMutex(); } /// Return whether or not the low shelf filter of this parametric equalizer is enabled. RIM_INLINE Bool getLowShelfIsEnabled() const { return lowShelfEnabled; } /// Set whether or not the low shelf filter of this parametric equalizer is enabled. RIM_INLINE void setLowShelfIsEnabled( Bool newIsEnabled ) { lockMutex(); lowShelfEnabled = newIsEnabled; unlockMutex(); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** High Shelf Filter Attribute Accessor Methods /// Return the corner frequency of this parametric equalizer's high shelf filter. RIM_INLINE Float getHighShelfFrequency() const { return highShelf.getFrequency(); } /// Set the corner frequency of this parametric equalizer's high shelf filter. RIM_INLINE void setHighShelfFrequency( Float newFrequency ) { lockMutex(); highShelf.setFrequency( newFrequency ); unlockMutex(); } /// Return the linear gain of this parametric equalizer's high shelf filter. RIM_INLINE Gain getHighShelfGain() const { return highShelf.getGain(); } /// Return the gain in decibels of this parametric equalizer's high shelf filter. RIM_INLINE Gain getHighShelfGainDB() const { return highShelf.getGainDB(); } /// Set the linear gain of this parametric equalizer's high shelf filter. RIM_INLINE void setHighShelfGain( Gain newGain ) { lockMutex(); highShelf.setGain( newGain ); unlockMutex(); } /// Set the gain in decibels of this parametric equalizer's high shelf filter. RIM_INLINE void setHighShelfGainDB( Gain newGain ) { lockMutex(); highShelf.setGainDB( newGain ); unlockMutex(); } /// Return the slope of this parametric equalizer's high shelf filter. RIM_INLINE Float getHighShelfSlope() const { return highShelf.getGain(); } /// Set the slope of this parametric equalizer's high shelf filter. RIM_INLINE void setHighShelfSlope( Float newSlope ) { lockMutex(); highShelf.setSlope( newSlope ); unlockMutex(); } /// Return whether or not the high shelf filter of this parametric equalizer is enabled. RIM_INLINE Bool getHighShelfIsEnabled() const { return highShelfEnabled; } /// Set whether or not the high shelf filter of this parametric equalizer is enabled. RIM_INLINE void setHighShelfIsEnabled( Bool newIsEnabled ) { lockMutex(); highShelfEnabled = newIsEnabled; unlockMutex(); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Filter Attribute Accessor Methods /// Return a human-readable name for this parametric equalizer. /** * The method returns the string "Parametric Equalizer". */ virtual UTF8String getName() const; /// Return the manufacturer name of this parametric equalizer. /** * The method returns the string "Headspace Sound". */ virtual UTF8String getManufacturer() const; /// Return an object representing the version of this parametric equalizer. virtual SoundFilterVersion getVersion() const; /// Return an object which describes the category of effect that this filter implements. /** * This method returns the value SoundFilterCategory::EQUALIZER. */ virtual SoundFilterCategory getCategory() const; /// Return whether or not this parametric equalizer can process audio data in-place. /** * This method always returns TRUE, parameteric equalizers can process audio data in-place. */ virtual Bool allowsInPlaceProcessing() const; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Filter Parameter Accessor Methods /// Return the total number of generic accessible parameters this filter has. virtual Size getParameterCount() const; /// Get information about the parameter at the specified index. virtual Bool getParameterInfo( Index parameterIndex, FilterParameterInfo& info ) const; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Public Static Property Objects /// A string indicating the human-readable name of this parametric equalizer. static const UTF8String NAME; /// A string indicating the manufacturer name of this parametric equalizer. static const UTF8String MANUFACTURER; /// An object indicating the version of this parametric equalizer. static const SoundFilterVersion VERSION; private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Members /// A class which holds information about a single band of parametric EQ. class ParametricFilterBand { public: /// Create a new parametric filter band, enabled by default. RIM_INLINE ParametricFilterBand() : filter(), isEnabled( true ) { } /// The parametric filter associated with this frequency band. ParametricFilter filter; /// A boolean value indicating whether or not this frequency band is enabled. Bool isEnabled; }; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Filter Parameter Value Accessor Methods /// Place the value of the parameter at the specified index in the output parameter. virtual Bool getParameterValue( Index parameterIndex, FilterParameter& value ) const; /// Attempt to set the parameter value at the specified index. virtual Bool setParameterValue( Index parameterIndex, const FilterParameter& value ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Stream Reset Method /// A method which is called whenever the filter's stream of audio is being reset. /** * This method allows the filter to reset all parameter interpolation * and processing to its initial state to avoid coloration from previous * audio or parameter values. */ virtual void resetStream(); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Filter Processing Methods /// Apply this parametric filter to the samples in the input frame and place them in the output frame. virtual SoundFilterResult processFrame( const SoundFilterFrame& inputFrame, SoundFilterFrame& outputFrame, Size numSamples ); /// Return whether or not the specified linear gain value is very close to unity gain. RIM_INLINE static Bool gainIsUnity( Gain linearGain ) { return math::abs( Gain(1) - linearGain ) < 2*math::epsilon<Gain>(); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Static Data Members /// Define the default number of parametric filters that should make up a parametric equalizer. static const Size DEFAULT_NUMBER_OF_PARAMETRIC_FILTERS = 5; /// Define the default center frequencies of the parametric filters that make up this equalizer. static const Float DEFAULT_PARAMETRIC_FREQUENCIES[DEFAULT_NUMBER_OF_PARAMETRIC_FILTERS]; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Members /// A high pass filter for this parametric equalizer. CutoffFilter highPass; /// A low shelf filter for this parametric equalizer. ShelfFilter lowShelf; /// An array of the parametric filters that make up this parametric equalizer. Array<ParametricFilterBand> parametrics; /// A high shelf filter for this parametric equalizer. ShelfFilter highShelf; /// A low pass filter for this parametric equalizer. CutoffFilter lowPass; /// A master gain filter for this parametric equalizer. GainFilter gainFilter; /// A boolean value indicating whether or not the high pass filter is enabled. Bool highPassEnabled; /// A boolean value indicating whether or not the low pass filter is enabled. Bool lowPassEnabled; /// A boolean value indicating whether or not the low shelf filter is enabled. Bool lowShelfEnabled; /// A boolean value indicating whether or not the high shelf filter is enabled. Bool highShelfEnabled; }; //########################################################################################## //************************ End Rim Sound Filters Namespace ******************************* RIM_SOUND_FILTERS_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_SOUND_PARAMETRIC_EQUALIZER_H <file_sep>/* * rimGraphicsShapeBase.h * Rim Graphics * * Created by <NAME> on 2/27/13. * Copyright 2013 __MyCompanyName__. All rights reserved. * */ #ifndef INCLUDE_RIM_GRAPHICS_SHAPE_BASE_H #define INCLUDE_RIM_GRAPHICS_SHAPE_BASE_H #include "rimGraphicsShapesConfig.h" #include "rimGraphicsShape.h" //########################################################################################## //*********************** Start Rim Graphics Shapes Namespace **************************** RIM_GRAPHICS_SHAPES_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class from which all shape subclasses should derive that simplifies shape typing. /** * This class simplifies Shape subclassing by automatically providing * ShapeType information to the parent Shape based on the * SubType template parameter. */ template < typename SubType > class GraphicsShapeBase : public GraphicsShape { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructors /// Create a base shape object. RIM_FORCE_INLINE GraphicsShapeBase() : GraphicsShape( &type ) { } /// Create a base shape object with the specified 3D transformation. RIM_FORCE_INLINE GraphicsShapeBase( const Transform3& newTransform ) : GraphicsShape( &type, newTransform ) { } private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Members /// A ShapeType object representing the type of this base collision shape. /** * The type object is created directly from the SubType template parameter. */ static const ShapeType type; }; template < typename SubType > const ShapeType GraphicsShapeBase<SubType>:: type = ShapeType::of<SubType>(); //########################################################################################## //*********************** End Rim Graphics Shapes Namespace ****************************** RIM_GRAPHICS_SHAPES_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_GRAPHICS_SHAPE_BASE_H <file_sep>/* * rimPhysicsForceFieldGravitySimple.h * Rim Physics * * Created by <NAME> on 11/28/09. * Copyright 2009 Rim Software. All rights reserved. * */ #ifndef INCLUDE_RIM_PHYSICS_FORCE_FIELD_GRAVITY_SIMPLE_H #define INCLUDE_RIM_PHYSICS_FORCE_FIELD_GRAVITY_SIMPLE_H #include "rimPhysicsForcesConfig.h" #include "rimPhysicsForceField.h" //########################################################################################## //************************ Start Rim Physics Forces Namespace **************************** RIM_PHYSICS_FORCES_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// An implementation of the ForceField interface that provides a simple model for gravity. /** * This class assumes that gravity can be modeled as a uniform force field * that is specified by a single gravitational acceleration vector. This kind of * gravity models how gravity appears to work on the earth's surface, * but would be unsuitable for n-body planetary-scale gravitation. */ class ForceFieldGravitySimple : public ForceField { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructors /// Create a default simple gravitational field with earth-like gravity. /** * This gravitational acceleration is equal to 9.81 m/s and is pointed * in the negative Y direction, resulting in a gravity vector of (0,-9.81,0). */ RIM_INLINE ForceFieldGravitySimple() : gravityVector( Real(0), Real(-9.81), Real(0) ) { } /// Create a gravitational field with the specified gravitational acceleration. RIM_INLINE ForceFieldGravitySimple( const Vector3& newGravityVector ) : gravityVector( newGravityVector ) { } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Force Application Method /// Apply force vectors to all objects that this simple gravity field effects. /** * These force vectors should be based on the internal configuration * of the force system. If this force field contains an object, * the force field calculates the force on that object and applies it. * These forces may be caused by or affected by the objects in the * ForceField system. */ virtual void applyForces( Real dt ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Rigid Object Accessor Methods /// Add the specified rigid object to this ForceField. /** * If the specified rigid object pointer is NULL, the * force field is unchanged. */ virtual void addRigidObject( RigidObject* newRigidObject ); /// Remove the specified rigid object from this ForceField. /** * If this ForceField contains the specified rigid object, the * object is removed from the force system and TRUE is returned. * Otherwise, if the rigid object is not found, FALSE is returned * and the force field is unchanged. */ virtual Bool removeRigidObject( RigidObject* newRigidObject ); /// Remove all rigid objects from this ForceField. virtual void removeRigidObjects(); /// Return whether or not the specified rigid object is contained in this ForceField. /** * If this ForceField contains the specified rigid object, TRUE is returned. * Otherwise, if the rigid object is not found, FALSE is returned. */ virtual Bool containsRigidObject( RigidObject* newRigidObject ) const; /// Return the number of rigid objects that are contained in this ForceField. virtual Size getRigidObjectCount() const; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Gravity Vector Accessor Methods /// Return the gravitational acceleration vector that is being applied to all objects. RIM_INLINE const Vector3& getGravityVector() const { return gravityVector; } /// Set the gravitational acceleration vector that should be applied to all objects. RIM_INLINE void setGravityVector( const Vector3& newGravityVector ) { gravityVector = newGravityVector; } private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Members /// A list of all of the objects in this simple gravitational field. ArrayList<RigidObject*> rigidObjects; /// The gravitational acceleration vector that is being applied to all objects. Vector3 gravityVector; }; //########################################################################################## //************************ End Rim Physics Forces Namespace ****************************** RIM_PHYSICS_FORCES_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_PHYSICS_FORCE_FIELD_GRAVITY_SIMPLE_H <file_sep>/* * rimGraphicsGUISliderDelegate.h * Rim Graphics GUI * * Created by <NAME> on 2/8/13. * Copyright 2013 Headspace Systems. All rights reserved. * */ #ifndef INCLUDE_RIM_GRAPHICS_GUI_SLIDER_DELEGATE_H #define INCLUDE_RIM_GRAPHICS_GUI_SLIDER_DELEGATE_H #include "rimGraphicsGUIConfig.h" //########################################################################################## //************************ Start Rim Graphics GUI Namespace ****************************** RIM_GRAPHICS_GUI_NAMESPACE_START //****************************************************************************************** //########################################################################################## class Slider; //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class which contains function objects that recieve Slider events. /** * Any slider-related event that might be processed has an appropriate callback * function object. Each callback function is called by the slider * whenever such an event is received. If a callback function in the delegate * is not initialized, a slider simply ignores it. */ class SliderDelegate { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Slider Delegate Callback Functions /// A function object which is called whenever an attached slider has started to be changed by the user. Function<void ( Slider& slider )> startEdit; /// A function object which is called whenever an attached slider has finished being changed by the user. Function<void ( Slider& slider )> endEdit; /// A function object which is called whenever an attached slider is changed by the user. /** * The delegate function has the option to allow or disallow the change to the * slider's value by returning TRUE to allow or FALSE to not allow the change. */ Function<Bool ( Slider& slider, Float newValue )> edit; }; //########################################################################################## //************************ End Rim Graphics GUI Namespace ******************************** RIM_GRAPHICS_GUI_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_GRAPHICS_GUI_SLIDER_DELEGATE_H <file_sep>/* * rimType.h * Rim Framework * * Created by <NAME> on 10/31/08. * Copyright 2008 Rim Software. All rights reserved. * */ #ifndef INCLUDE_RIM_TYPE_H #define INCLUDE_RIM_TYPE_H #include <typeinfo> #include "rimLanguageConfig.h" #include "../data/rimBasicString.h" //########################################################################################## //*************************** Start Rim Language Namespace ******************************* RIM_LANGUAGE_NAMESPACE_START //****************************************************************************************** //########################################################################################## using rim::data::String; //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class which represents a C++ type. /** * The class consists of a string uniquely identifying the type * it represents. This string is retrieved from a C++ type_info * object. This allows a C++ type to be used as a first-class object. * Type objects can be created from both a statically defined type * via the templatized method Type::of<>() or from the dynamic type * of an object via a constructor or the Type::of() method. In order * for the dynamic type of an object to be determined, at least one class * in its inheritance hierarchy must have a virtual method. */ class Type { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructors /// Create a new empty type object. RIM_INLINE Type() : typeString() { } /// Create a type object from the type of the parameter. template < typename T > RIM_INLINE Type( const T& object ) : typeString( unmangle( typeid(object).name() ) ) { } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Static Factory Methods /// Get a type object representing the templatized type of this method. template < typename T > RIM_INLINE static Type of() { return Type( typeid(T).name() ); } /// Get a type object representing the type of the parameter. template < typename T > RIM_INLINE static Type of( const T& object ) { return Type( object ); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Type String Accessor Methods /// Return a string representing the unique name of this type. RIM_INLINE operator const String& () const { return typeString; } /// Return a string representing the unique name of this type. RIM_INLINE const String& toString() const { return typeString; } /// Return a string representing the unique name of this type. RIM_INLINE const String& getName() const { return typeString; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** ID Accessor Methods /// Return an unsigned integer for this type. Different types may have the same ID. RIM_INLINE Hash getID() const { return typeString.getHashCode(); } /// Return an integer hash code for this type. RIM_INLINE Hash getHashCode() const { return typeString.getHashCode(); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Equality Comparison Operators /// Return whether or not this type is equal to another. RIM_INLINE Bool operator == ( const Type& type ) const { return typeString == type.typeString; } /// Return whether or not this type is not equal to another. RIM_INLINE Bool operator != ( const Type& type ) const { return typeString != type.typeString; } private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Constructor /// Create a new type object from a type string and boolean attributes. RIM_INLINE Type( const char* newTypeString ) : typeString( unmangle( newTypeString ) ) { } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Helper Methods /// Unmangle the specified raw type name. /** * If the method fails, the original string may be returned. */ static String unmangle( const char* mangledName ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Members /// A string representing the type, implementation defined. String typeString; }; //########################################################################################## //*************************** End Rim Language Namespace ********************************* RIM_LANGUAGE_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_TYPE_H <file_sep>/* * rimGraphicsStencilTest.h * Rim Graphics * * Created by <NAME> on 3/13/13. * Copyright 2013 __MyCompanyName__. All rights reserved. * */ #ifndef INCLUDE_RIM_GRAPHICS_STENCIL_TEST_H #define INCLUDE_RIM_GRAPHICS_STENCIL_TEST_H #include "rimGraphicsUtilitiesConfig.h" //########################################################################################## //********************** Start Rim Graphics Utilities Namespace ************************** RIM_GRAPHICS_UTILITIES_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class which specifies the operation performed when testing a new stencil fragment. /** * If the stencil test succeeds, the fragment is rendered. Otherwise, the fragment * is discarded and rendering for the fragment stops. */ class StencilTest { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Stencil Test Enum Definition /// An enum type which represents the type of stencil test. typedef enum Enum { /// A test where the test never succeeds (no fragments ever pass or update the stencil buffer). NEVER = 0, /// A test where the test always succeeds (all fragments pass and update the stencil buffer). ALWAYS = 1, /// A test where the test succeeds if the source and destination stencils are equal. EQUAL = 2, /// A test where the test succeeds if the source and destination stencils are not equal. NOT_EQUAL = 3, /// A test where the test succeeds if the new stencil value is less than the existing stencil value. LESS_THAN = 4, /// A test where it succeeds if the new stencil value is less than or equal to the existing stencil value. LESS_THAN_OR_EQUAL = 5, /// A test where the test succeeds if the new stencil value is greater than the existing stencil value. GREATER_THAN = 6, /// A test where it succeeds if the new stencil value is greater than or equal to the existing stencil value. GREATER_THAN_OR_EQUAL = 7 }; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructors /// Create a new stencil test with the specified stencil test enum value. RIM_INLINE StencilTest( Enum newTest ) : test( newTest ) { } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Enum Cast Operator /// Convert this stencil test type to an enum value. RIM_INLINE operator Enum () const { return (Enum)test; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** String Representation Accessor Methods /// Return a stencil test enum which corresponds to the given enum string. static StencilTest fromEnumString( const String& enumString ); /// Return a unique string for this stencil test that matches its enum value name. String toEnumString() const; /// Return a string representation of the stencil test. String toString() const; /// Convert this stencil test into a string representation. RIM_FORCE_INLINE operator String () const { return this->toString(); } private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Members /// An enum value which indicates the type of stencil test. UByte test; }; //########################################################################################## //********************** End Rim Graphics Utilities Namespace **************************** RIM_GRAPHICS_UTILITIES_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_GRAPHICS_STENCIL_TEST_H <file_sep>/* * rimPhysicsObjectsConfig.h * Rim Physics * * Created by <NAME> on 6/7/08. * Copyright 2008 Rim Software. All rights reserved. * */ #ifndef INCLUDE_RIM_PHYSICS_OBJECTS_CONFIG_H #define INCLUDE_RIM_PHYSICS_OBJECTS_CONFIG_H #include "../rimPhysicsConfig.h" #include "../rimPhysicsUtilities.h" #include "../rimPhysicsShapes.h" //########################################################################################## //########################################################################################## //############ //############ Library Namespace Configuration //############ //########################################################################################## //########################################################################################## #ifndef RIM_PHYSICS_OBJECTS_NAMESPACE_START #define RIM_PHYSICS_OBJECTS_NAMESPACE_START RIM_PHYSICS_NAMESPACE_START namespace objects { #endif #ifndef RIM_PHYSICS_OBJECTS_NAMESPACE_END #define RIM_PHYSICS_OBJECTS_NAMESPACE_END }; RIM_PHYSICS_NAMESPACE_END #endif //########################################################################################## //*********************** Start Rim Physics Objects Namespace **************************** RIM_PHYSICS_OBJECTS_NAMESPACE_START //****************************************************************************************** //########################################################################################## using rim::physics::shapes::CollisionShape; using rim::physics::shapes::CollisionShapeInstance; using rim::physics::shapes::CollisionShapeType; using rim::physics::shapes::CollisionShapeTypeID; //########################################################################################## //*********************** End Rim Physics Objects Namespace ****************************** RIM_PHYSICS_OBJECTS_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_PHYSICS_OBJECTS_CONFIG_H <file_sep>/* * rimHalfFloat.h * Rim Framework * * Created by <NAME> on 1/6/11. * Copyright 2011 Rim Software. All rights reserved. * */ #ifndef INCLUDE_RIM_HALF_FLOAT_H #define INCLUDE_RIM_HALF_FLOAT_H #include "rimLanguageConfig.h" //########################################################################################## //*************************** Start Rim Language Namespace ******************************* RIM_LANGUAGE_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class which emulates a 16-bit floating-point number. /** * The class includes operator overloads for all standard arithmetic operators, * though the performance of these may be undesirable for intensive calculations * because they are emulated in software. */ class HalfFloat { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructors /// Create a HalfFloat object with the value 0. RIM_FORCE_INLINE HalfFloat() : data( HalfFloat::ZERO ) { } /// Create a HalfFloat object with the value of the specified byte. RIM_FORCE_INLINE HalfFloat( Byte value ) : data( floatToHalfFloat( Float(value) ) ) { } /// Create a HalfFloat object with the value of the specified short number. RIM_FORCE_INLINE HalfFloat( Short value ) : data( floatToHalfFloat( Float(value) ) ) { } /// Create a HalfFloat object with the value of the specified int number. RIM_FORCE_INLINE HalfFloat( Int value ) : data( floatToHalfFloat( Float(value) ) ) { } /// Create a HalfFloat object with the value of the specified long number. RIM_FORCE_INLINE HalfFloat( Long value ) : data( floatToHalfFloat( Float(value) ) ) { } /// Create a HalfFloat object with the value of the specified long-long number. RIM_FORCE_INLINE HalfFloat( LongLong value ) : data( floatToHalfFloat( Float(value) ) ) { } /// Create a HalfFloat object with the value of the specified float number. RIM_FORCE_INLINE HalfFloat( Float value ) : data( floatToHalfFloat( value ) ) { } /// Create a HalfFloat object with the value of the specified double number. RIM_FORCE_INLINE HalfFloat( Double value ) : data( floatToHalfFloat( Float(value) ) ) { } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Arithmetic Assignment Operators /// Add another HalfFloat to this half float's value. RIM_FORCE_INLINE HalfFloat& operator += ( const HalfFloat& other ) { *this = HalfFloat( Float(*this) + Float(other) ); return *this; } /// Subtract another HalfFloat from this half float's value. RIM_FORCE_INLINE HalfFloat& operator -= ( const HalfFloat& other ) { *this = HalfFloat( Float(*this) - Float(other) ); return *this; } /// Multiply this half float's value by another HalfFloat. RIM_FORCE_INLINE HalfFloat& operator *= ( const HalfFloat& other ) { *this = HalfFloat( Float(*this) * Float(other) ); return *this; } /// Divide this half float's value by another HalfFloat. RIM_FORCE_INLINE HalfFloat& operator /= ( const HalfFloat& other ) { *this = HalfFloat( Float(*this) / Float(other) ); return *this; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Arithmetic Operators /// Add another HalfFloat to this half float's value. RIM_FORCE_INLINE HalfFloat operator + ( const HalfFloat& other ) { return HalfFloat( Float(*this) + Float(other) ); } /// Subtract another HalfFloat from this half float's value. RIM_FORCE_INLINE HalfFloat operator - ( const HalfFloat& other ) { return HalfFloat( Float(*this) - Float(other) ); } /// Multiply this half float's value by another HalfFloat. RIM_FORCE_INLINE HalfFloat operator * ( const HalfFloat& other ) { return HalfFloat( Float(*this) * Float(other) ); } /// Divide this half float's value by another HalfFloat. RIM_FORCE_INLINE HalfFloat operator / ( const HalfFloat& other ) { return HalfFloat( Float(*this) / Float(other) ); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Cast Operator /// Cast the half float object to a single-precision floating point number. RIM_FORCE_INLINE operator Float () const { return halfFloatToFloat( data ); } private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Static Helper Methods /// Convert the specified single precision float number to a half precision float number. RIM_NO_INLINE static UInt16 floatToHalfFloat( Float floatValue ) { // Catch special case floating point values. if ( math::isNAN( floatValue ) ) return NOT_A_NUMBER; else if ( math::isInfinity( floatValue ) ) return POSITIVE_INFINITY; else if ( math::isNegativeInfinity( floatValue ) ) return NEGATIVE_INFINITY; UInt32 value = *((UInt32*)&floatValue); if ( floatValue == Float(0) ) return UInt16( value >> 16 ); else { // Start by computing the significand in half precision format. UInt16 output = UInt16((value & FLOAT_SIGNIFICAND_MASK) >> 13); register UInt32 exponent = ((value & FLOAT_EXPONENT_MASK) >> 23); // Check for subnormal numbers. if ( exponent != 0 ) { // Check for overflow when converting large numbers, returning positive or negative infinity. if ( exponent > 142 ) return UInt16((value & FLOAT_SIGN_MASK) >> 16) | UInt16(0x7C00); // Add the exponent of the half float, converting the offset binary formats of the representations. output |= (((exponent - 112) << 10) & HALF_FLOAT_EXPONENT_MASK); } // Add the sign bit. output |= UInt16((value & FLOAT_SIGN_MASK) >> 16); return output; } } /// Convert the specified half float number to a single precision float number. RIM_NO_INLINE static Float halfFloatToFloat( UInt16 halfFloat ) { // Catch special case half floating point values. switch ( halfFloat ) { case NOT_A_NUMBER: return math::nan<Float>(); case POSITIVE_INFINITY: return math::infinity<Float>(); case NEGATIVE_INFINITY: return math::negativeInfinity<Float>(); } // Start by computing the significand in single precision format. UInt32 value = UInt32(halfFloat & HALF_FLOAT_SIGNIFICAND_MASK) << 13; register UInt32 exponent = UInt32(halfFloat & HALF_FLOAT_EXPONENT_MASK) >> 10; if ( exponent != 0 ) { // Add the exponent of the float, converting the offset binary formats of the representations. value |= (((exponent - 15 + 127) << 23) & FLOAT_EXPONENT_MASK); } // Add the sign bit. value |= UInt32(halfFloat & HALF_FLOAT_SIGN_MASK) << 16; return *((Float*)&value); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Members /// The 16-bit data member that holds the half float's data. UInt16 data; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Static Constant Data Members /// A static constant for a half float with a value of zero. static const UInt16 ZERO = 0x0000; /// A static constant for a half float with a value of not-a-number. static const UInt16 NOT_A_NUMBER = 0xFFFF; /// A static constant for a half float with a value of positive infinity. static const UInt16 POSITIVE_INFINITY = 0x7C00; /// A static constant for a half float with a value of negative infinity. static const UInt16 NEGATIVE_INFINITY = 0xFC00; /// A mask which isolates the sign of a half float number. static const UInt16 HALF_FLOAT_SIGN_MASK = 0x8000; /// A mask which isolates the exponent of a half float number. static const UInt16 HALF_FLOAT_EXPONENT_MASK = 0x7C00; /// A mask which isolates the significand of a half float number. static const UInt16 HALF_FLOAT_SIGNIFICAND_MASK = 0x03FF; /// A mask which isolates the sign of a single precision float number. static const UInt32 FLOAT_SIGN_MASK = 0x80000000; /// A mask which isolates the exponent of a single precision float number. static const UInt32 FLOAT_EXPONENT_MASK = 0x7F800000; /// A mask which isolates the significand of a single precision float number. static const UInt32 FLOAT_SIGNIFICAND_MASK = 0x007FFFFF; }; //########################################################################################## //*************************** End Rim Language Namespace ********************************* RIM_LANGUAGE_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_HALF_FLOAT_H <file_sep>/* * rimGraphicsFramebuffer.h * Rim Graphics * * Created by <NAME> on 10/8/12. * Copyright 2012 __MyCompanyName__. All rights reserved. * */ #ifndef INCLUDE_RIM_GRAPHICS_FRAMEBUFFER_H #define INCLUDE_RIM_GRAPHICS_FRAMEBUFFER_H #include "rimGraphicsTexturesConfig.h" #include "rimGraphicsTexture.h" #include "rimGraphicsTextureFace.h" #include "rimGraphicsFramebufferAttachment.h" //########################################################################################## //********************** Start Rim Graphics Textures Namespace *************************** RIM_GRAPHICS_TEXTURES_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class which enables render-to-texture by specifying textures and their attachment points. /** * A Framebuffer object contains a set of associations between rendering framebuffer * attachment points and textures which are to be used for render-to-texture. This * framebuffer object can then be used as a render target, where the output of rendering * will be sent to the texture targets specified here rather than the main screen. */ class Framebuffer : public ContextObject { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Target Texture Accessor Methods /// Return the total number of attached target textures for this framebuffer. virtual Size getTargetCount() const = 0; /// Return the total number of attached target textures with the specified attachment type for this framebuffer. virtual Size getTargetCount( FramebufferAttachment::Type attachmentType ) const = 0; /// Return the texture which is attached at the specified framebuffer attachment point. /** * If there is no target texture for that attachment point, a NULL texture resource * is returned. */ virtual Resource<Texture> getTarget( const FramebufferAttachment& attachment ) const = 0; /// Return whether or not this framebuffer has a valid texture attached to the specified attachment point. virtual Bool hasTarget( const FramebufferAttachment& attachment ) const = 0; /// Set the target texture for the specified framebuffer attachment point. /** * If the specified Texture is valid and supports the specified texture face, * and if the specified attachment point is supported and valid, the texture * is used as the target for the specified attachment point and TRUE is returned * indicating success. Otherwise, FALSE is returned indicating failure, leaving * the framebuffer unchanged. */ virtual Bool setTarget( const FramebufferAttachment& attachment, const Resource<Texture>& newTarget, TextureFace face = TextureFace::FRONT ) = 0; /// Remove any previously attached texture from the specified framebuffer attachment point. /** * If a texture was successfully removed, TRUE is returned. Otherwise, FALSE is * returned, indicating that no texture target was removed. */ virtual Bool removeTarget( const FramebufferAttachment& attachment ) = 0; /// Remove all attached target textures with the specified attachment type from this framebuffer. virtual void removeTargets( FramebufferAttachment::Type attachmentType ) = 0; /// Remove all attached target textures from this framebuffer. virtual void clearTargets() = 0; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Target Texture Face Accessor Methods /// Return an object representing which face of the texture at the specified attachment point is being used. /** * If there is no texture at that attachment point, and UNDEFINED texture face * is returned. Otherwise, the texture face that is being used is returned. * This will be FRONT, unless the texture is a cube map. */ virtual TextureFace getTargetFace( const FramebufferAttachment& attachment ) = 0; /// Set the face of the texture at the specified attachment point that is being used. /** * If there is no texture at that attachment point or if the attached texture * doesn't support the specified face type, FALSE is returned and the target * face is not changed. Otherwise, the framebuffer uses the specified texture * face for the attachment point and returns TRUE. */ virtual Bool setTargetFace( const FramebufferAttachment& attachment, TextureFace newFace ) = 0; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Framebuffer Size Accessor Methods /// Return the minimum size of the framebuffer in pixels along the X direction. /** * This method finds the smallest size of the attached textures along the X direction. * * If there are no attached textures, 0 is returned. */ RIM_INLINE Size getWidth() const { return this->getSize( 0 ); } /// Return the minimum size of the framebuffer in pixels along the Y direction. /** * This method finds the smallest size of the attached textures along the Y direction. * * If there are no attached textures, 0 is returned. */ RIM_INLINE Size getHeight() const { return this->getSize( 1 ); } /// Return the minimum size of the framebuffer in pixels along the specified dimension index. /** * This method finds the smallest size of the attached textures along the given dimension. * Indices start from 0 and count to d-1 for a framebuffer with d dimensions. * Since framebuffers are almost always 1D or 2D, dimension indices greater than 1 will * result in a size of 1 being returned, since even a 1x1 framebuffer has a 3D depth * of 1 pixel. * * If there are no attached textures, 0 is returned. */ RIM_INLINE Size getSize( Index dimension ) const { return this->getMinimumSize( dimension ); } /// Return the minimum size of the framebuffer in pixels along the specified dimension index. /** * This method finds the smallest size of the attached textures along the given dimension. * Indices start from 0 and count to d-1 for a framebuffer with d dimensions. * Since framebuffers are almost always 1D or 2D, dimension indices greater than 1 will * result in a size of 1 being returned, since even a 1x1 framebuffer has a 3D depth * of 1 pixel. * * If there are no attached textures, 0 is returned. */ virtual Size getMinimumSize( Index dimension ) const = 0; /// Return the maximum size of the framebuffer in pixels along the specified dimension index. /** * This method finds the largest size of the attached textures along the given dimension. * Indices start from 0 and count to d-1 for a framebuffer with d dimensions. * Since framebuffers are almost always 1D or 2D, dimension indices greater than 1 will * result in a size of 1 being returned, since even a 1x1 framebuffer has a 3D depth * of 1 pixel. * * If there are no attached textures, 0 is returned. */ virtual Size getMaximumSize( Index dimension ) const = 0; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Framebuffer Viewport Accessor Methods /// Return a 2D AABB object which covers the rectangular screen area shared by all target textures. /** * If some of the target textures have different sizes, it uses the largest * viewport, starting the lower left corner of all textures, where all textures * have texels. */ RIM_INLINE AABB2f getViewport() const { return AABB2f( Float(0), Float(this->getWidth()), Float(0), Float(this->getHeight()) ); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Framebuffer Validity Accessor Method /// Return whether or not the framebuffer is valid and can be used as a render target. /** * A framebuffer may not be valid if it has no target textures, has an incomplete * set of target textures (missing a required attachment), or if some of the target textures * have an unsupported format. */ virtual Bool isValid() const = 0; protected: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Protected Constructor /// Create an empty framebuffer for the given context with no attached textures. RIM_INLINE Framebuffer( const devices::GraphicsContext* context ) : ContextObject( context ) { } }; //########################################################################################## //********************** End Rim Graphics Textures Namespace ***************************** RIM_GRAPHICS_TEXTURES_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_GRAPHICS_FRAMEBUFFER_H <file_sep>/* * rimPhysicsForceField.h * Rim Physics * * Created by <NAME> on 11/28/09. * Copyright 2009 Rim Software. All rights reserved. * */ #ifndef INCLUDE_RIM_PHYSICS_FORCE_FIELD_H #define INCLUDE_RIM_PHYSICS_FORCE_FIELD_H #include "rimPhysicsForcesConfig.h" #include "rimPhysicsForce.h" //########################################################################################## //************************ Start Rim Physics Forces Namespace **************************** RIM_PHYSICS_FORCES_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// An extension of the Force interface which can apply forces to a collection of objects. /** * By deriving from this class, one can simulate various global or n-body force fields * such as gravity, magnetism, etc. */ class ForceField : public Force { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Force Application Method /// Apply force vectors to all objects that this ForceField effects. /** * These force vectors should be based on the internal configuration * of the force system. If this force field contains an object, * the force field calculates the force on that object and applies it. * These forces may be caused by or affected by the objects in the * ForceField system. */ virtual void applyForces( Real dt ) = 0; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Rigid Object Accessor Methods /// Add the specified rigid object to this ForceField. /** * If the specified rigid object pointer is NULL, the * force field is unchanged. */ virtual void addRigidObject( RigidObject* newRigidObject ) = 0; /// Remove the specified rigid object from this ForceField. /** * If this ForceField contains the specified rigid object, the * object is removed from the force system and TRUE is returned. * Otherwise, if the rigid object is not found, FALSE is returned * and the force field is unchanged. */ virtual Bool removeRigidObject( RigidObject* newRigidObject ) = 0; /// Remove all rigid objects from this ForceField. virtual void removeRigidObjects() = 0; /// Return whether or not the specified rigid object is contained in this ForceField. /** * If this ForceField contains the specified rigid object, TRUE is returned. * Otherwise, if the rigid object is not found, FALSE is returned. */ virtual Bool containsRigidObject( RigidObject* newRigidObject ) const = 0; /// Return the number of rigid objects that are contained in this ForceField. virtual Size getRigidObjectCount() const = 0; }; //########################################################################################## //************************ End Rim Physics Forces Namespace ****************************** RIM_PHYSICS_FORCES_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_PHYSICS_FORCE_FIELD_H <file_sep>/* * rimTransform3D.h * Rim Math * * Created by <NAME> on 6/4/07. * Copyright 2007 Rim Software. All rights reserved. * */ #ifndef INCLUDE_RIM_TRANSFORM_3D_H #define INCLUDE_RIM_TRANSFORM_3D_H #include "rimMathConfig.h" #include "rimVector3D.h" #include "rimMatrix3D.h" #include "rimMatrix4D.h" #include "rimRay3D.h" #include "rimPlane3D.h" #include "rimAABB3D.h" //########################################################################################## //***************************** Start Rim Math Namespace ********************************* RIM_MATH_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class which represents a 3-dimensional transformation. /** * The transformation is composed of translation, rotation, and scaling. * The components are assumed to be in the following order: translation, rotation, * and scaling. Thus, when transforming a point from world to object space by the * transformation, translation is first applied, followed by scaling, and finally * rotation. The reverse holds true for transformations from object to world space. */ template < typename T > class Transform3D { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructors /// Create an identity transformation that doesn't modify transformed points. RIM_FORCE_INLINE Transform3D() : position( Vector3D<T>() ), orientation( Matrix3D<T>::IDENTITY ), scale( 1 ) { } /// Create a transformation with the specified translation and no rotation or scaling. RIM_FORCE_INLINE Transform3D( const Vector3D<T>& newPosition ) : position( newPosition ), orientation( Matrix3D<T>::IDENTITY ), scale( 1 ) { } /// Create a transformation with the specified translation, rotation, and no scaling. RIM_FORCE_INLINE Transform3D( const Vector3D<T>& newPosition, const Matrix3D<T>& newOrientation ) : position( newPosition ), orientation( newOrientation ), scale( 1 ) { } /// Create a transformation with the specified translation, rotation, and uniform scaling. RIM_FORCE_INLINE Transform3D( const Vector3D<T>& newPosition, const Matrix3D<T>& newOrientation, T newScale ) : position( newPosition ), orientation( newOrientation ), scale( newScale ) { } /// Create a transformation with the specified translation, rotation, and uniform scaling. RIM_FORCE_INLINE Transform3D( const Vector3D<T>& newPosition, const Matrix3D<T>& newOrientation, const Vector3D<T>& newScale ) : position( newPosition ), orientation( newOrientation ), scale( newScale ) { } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Object Space Transforms /// Transform the specified scalar value to object space. /** * This will perform any scaling necessary to satisfy the transformation. */ RIM_FORCE_INLINE Vector3D<T> transformToObjectSpace( T original ) const { return original/scale; } /// Transform the specified position vector to object space. RIM_FORCE_INLINE Vector3D<T> transformToObjectSpace( const Vector3D<T>& original ) const { return ((original - position)*orientation)/scale; } /// Transform the specified matrix to object space. /** * This returns what the specified matrix would be in this transformation's * coordinate frame. This method does not perform any scaling on the input * matrix. The input matrix is assumed to be an orthonormal rotation matrix. */ RIM_FORCE_INLINE Matrix3D<T> transformToObjectSpace( const Matrix3D<T>& original ) const { return original*orientation; } /// Transform the specified ray into object space. /** * This method performs a standard vector transformation for the ray origin * and only rotates the ray direction, preserving the length of the ray's direction * vector. */ RIM_FORCE_INLINE Ray3D<T> transformToObjectSpace( const Ray3D<T>& ray ) const { return Ray3D<T>( ((ray.origin - position)*orientation)/scale, ray.direction*orientation ); } /// Transform the specified plane into object space. /** * This method rotates the normal of the plane into the new coordinate frame * and calculates a new offset for the plane based on the projection of the origin * onto the plane in world space transformed to object space. */ RIM_FORCE_INLINE Plane3D<T> transformToObjectSpace( const Plane3D<T>& plane ) const { return Plane3D<T>( plane.normal*orientation, this->transformToObjectSpace(-plane.offset*plane.normal) ); } /// Transform the specified axis-aligned box into object space, producing another axis-aligned box that encloses the original. RIM_FORCE_INLINE AABB3D<T> transformToObjectSpace( const AABB3D<T>& box ) const { AABB3D<T> result( this->transformToObjectSpace( Vector3D<T>( box.min.x, box.min.y, box.min.z ) ) ); result.enlargeFor( this->transformToObjectSpace( Vector3D<T>( box.min.x, box.min.y, box.max.z ) ) ); result.enlargeFor( this->transformToObjectSpace( Vector3D<T>( box.min.x, box.max.y, box.min.z ) ) ); result.enlargeFor( this->transformToObjectSpace( Vector3D<T>( box.max.x, box.min.y, box.min.z ) ) ); result.enlargeFor( this->transformToObjectSpace( Vector3D<T>( box.max.x, box.min.y, box.max.z ) ) ); result.enlargeFor( this->transformToObjectSpace( Vector3D<T>( box.max.x, box.max.y, box.min.z ) ) ); result.enlargeFor( this->transformToObjectSpace( Vector3D<T>( box.max.x, box.max.y, box.max.z ) ) ); result.enlargeFor( this->transformToObjectSpace( Vector3D<T>( box.min.x, box.max.y, box.max.z ) ) ); return result; /* AABB3D<T> translatedBox( box.min - position, box.max - position ); Vector3D<T> center = translatedBox.getCenter(); translatedBox.min -= center; translatedBox.max -= center; AABB3D<T> result( center*orientation ); for ( Index i = 0; i < 3; i++ ) { for ( Index j = 0; j < 3; j++ ) { T a = orientation[j][i]*translatedBox.min[j]; T b = orientation[j][i]*translatedBox.max[j]; if ( a < b ) { result.min[j] += a; result.max[j] += b; } else { result.min[j] += b; result.max[j] += a; } } } result.min /= scale; result.max /= scale; return result;*/ } /// Rotate the specified vector to object space. /** * This method does not perform any translation or scaling on the * input point. This function is ideal for transforming directional * quantities like surface normal vectors. */ RIM_FORCE_INLINE Vector3D<T> rotateToObjectSpace( const Vector3D<T>& original ) const { return original*orientation; } /// Scale a vector to object space. RIM_FORCE_INLINE Vector3D<T> scaleToObjectSpace( const Vector3D<T>& original ) const { return original/scale; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** World Space Transforms /// Transform the specified scalar value to world space. /** * This will perform any scaling necessary to satisfy the transformation. */ RIM_FORCE_INLINE Vector3D<T> transformToWorldSpace( T original ) const { return original*scale; } /// Transform the specified position vector from object to world space. RIM_FORCE_INLINE Vector3D<T> transformToWorldSpace( const Vector3D<T>& original ) const { return position + orientation*(original*scale); } /// Transform the specified matrix from object to world space. /** * This returns what the specified matrix would be in this transformation's * coordinate frame. This method does not perform any scaling on the input * matrix. The input matrix is assumed to be an orthonormal rotation matrix. */ RIM_FORCE_INLINE Matrix3D<T> transformToWorldSpace( const Matrix3D<T>& original ) const { return orientation*original; } /// Transform the specified ray into world space. /** * This method performs a standard vector transformation for the ray origin * and only rotates the ray direction, preserving the length of the ray's direction * vector. */ RIM_FORCE_INLINE Ray3D<T> transformToWorldSpace( const Ray3D<T>& ray ) const { return Ray3D<T>( position + orientation*(ray.origin*scale), orientation*ray.direction ); } /// Transform the specified plane into world space. /** * This method rotates the normal of the plane into the new coordinate frame * and calculates a new offset for the plane based on the projection of the origin * onto the plane in object space transformed to world space. */ RIM_FORCE_INLINE Plane3D<T> transformToWorldSpace( const Plane3D<T>& plane ) const { return Plane3D<T>( orientation*plane.normal, this->transformToWorldSpace(-plane.offset*plane.normal) ); } /// Transform the specified axis-aligned box into world space, producing another axis-aligned box that encloses the original. RIM_FORCE_INLINE AABB3D<T> transformToWorldSpace( const AABB3D<T>& box ) const { AABB3D<T> result( this->transformToWorldSpace( Vector3D<T>( box.min.x, box.min.y, box.min.z ) ) ); result.enlargeFor( this->transformToWorldSpace( Vector3D<T>( box.min.x, box.min.y, box.max.z ) ) ); result.enlargeFor( this->transformToWorldSpace( Vector3D<T>( box.min.x, box.max.y, box.min.z ) ) ); result.enlargeFor( this->transformToWorldSpace( Vector3D<T>( box.max.x, box.min.y, box.min.z ) ) ); result.enlargeFor( this->transformToWorldSpace( Vector3D<T>( box.max.x, box.min.y, box.max.z ) ) ); result.enlargeFor( this->transformToWorldSpace( Vector3D<T>( box.max.x, box.max.y, box.min.z ) ) ); result.enlargeFor( this->transformToWorldSpace( Vector3D<T>( box.max.x, box.max.y, box.max.z ) ) ); result.enlargeFor( this->transformToWorldSpace( Vector3D<T>( box.min.x, box.max.y, box.max.z ) ) ); return result; /* // Move the box to the origin. Vector3D<T> center = box.getCenter(); AABB3D<T> scaledBox( box.min - center, box.max - center ); // Scale the box. scaledBox.min *= scale; scaledBox.max *= scale; // Rotate the box. AABB3D<T> result; for ( Index i = 0; i < 3; i++ ) { Vector3D<T> a = orientation[i]*scaledBox.min; Vector3D<T> b = orientation[i]*scaledBox.max; for ( Index j = 0; j < 3; j++ ) { if ( a[j] < b[j] ) { result.min[j] += a[j]; result.max[j] += b[j]; } else { result.min[j] += b[j]; result.max[j] += a[j]; } } } // Position the box. result.min += position + orientation*center*scale; result.max += position + orientation*center*scale; return result;*/ } /// Rotate the specified vector to world space. /** * This method does not perform any translation or scaling on the * input point. This function is ideal for transforming directional * quantities like surface normal vectors. */ RIM_FORCE_INLINE Vector3D<T> rotateToWorldSpace( const Vector3D<T>& original ) const { return orientation*original; } /// Scale a vector to world space. RIM_FORCE_INLINE Vector3D<T> scaleToWorldSpace( const Vector3D<T>& original ) const { return original*scale; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Transform Multiplication Operators /// Scale the specified value to world space with this transformation. RIM_FORCE_INLINE T operator * ( T value ) const { return this->transformToWorldSpace( value ); } /// Transform the specified vector to world space with this transformation. RIM_FORCE_INLINE Vector3D<T> operator * ( const Vector3D<T>& vector ) const { return this->transformToWorldSpace( vector ); } /// Transform the specified matrix to world space with this transformation. RIM_FORCE_INLINE Matrix3D<T> operator * ( const Matrix3D<T>& matrix ) const { return this->transformToWorldSpace( matrix ); } /// Transform the specified ray to world space with this transformation. RIM_FORCE_INLINE Ray3D<T> operator * ( const Ray3D<T>& ray ) const { return this->transformToWorldSpace( ray ); } /// Transform the specified plane to world space with this transformation. RIM_FORCE_INLINE Plane3D<T> operator * ( const Plane3D<T>& plane ) const { return this->transformToWorldSpace( plane ); } /// Concatenate this transformation with another and return the combined transformation. /** * This transformation represents the total transformation from object space of the * other, into this transformation's object space, and then to world space. */ RIM_FORCE_INLINE Transform3D<T> operator * ( const Transform3D<T>& other ) const { return Transform3D<T>( this->transformToWorldSpace( other.position ), this->transformToWorldSpace( other.orientation ), scale*other.scale ); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Transform Inversion Method /// Return the inverse of this transformations that applys the opposite transformation. RIM_FORCE_INLINE Transform3D<T> invert() const { Vector3D<T> inverseScale = T(1)/scale; return Transform3D<T>( (position*(-inverseScale))*orientation, orientation.transpose(), inverseScale ); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Matrix Conversion Methods /// Convert this transformation into a 4x4 homogeneous-coordinate matrix. RIM_FORCE_INLINE Matrix4D<T> toMatrix() const { return Matrix4D<T>( scale.x*orientation.x.x, scale.y*orientation.y.x, scale.z*orientation.z.x, position.x, scale.x*orientation.x.y, scale.y*orientation.y.y, scale.z*orientation.z.y, position.y, scale.x*orientation.x.z, scale.y*orientation.y.z, scale.z*orientation.z.z, position.z, T(0), T(0), T(0), T(1) ); } /// Convert the inverse of this transformation into a 4x4 homogeneous-coordinate matrix. RIM_FORCE_INLINE Matrix4D<T> toMatrixInverse() const { Vector3D<T> inverseScale = T(1)/scale; T wx = -( position.x*orientation.x.x + position.y*orientation.x.y + position.z*orientation.x.z ); T wy = -( position.x*orientation.y.x + position.y*orientation.y.y + position.z*orientation.y.z ); T wz = -( position.x*orientation.z.x + position.y*orientation.z.y + position.z*orientation.z.z ); return Matrix4D<T>( inverseScale.x*orientation.x.x, inverseScale.x*orientation.x.y, inverseScale.x*orientation.x.z, wx, inverseScale.y*orientation.y.x, inverseScale.y*orientation.y.y, inverseScale.y*orientation.y.z, wy, inverseScale.z*orientation.z.x, inverseScale.z*orientation.z.y, inverseScale.z*orientation.z.z, wz, T(0), T(0), T(0), T(1) ); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Public Data Members /// The translation component of the rigid transformation. Vector3D<T> position; /// The rotation component of the rigid transformation. Matrix3D<T> orientation; /// The scaling component of the rigid transformation. Vector3D<T> scale; }; //########################################################################################## //########################################################################################## //############ //############ Inverse Transform Multiplication Operators //############ //########################################################################################## //########################################################################################## /// Scale the specified scalar value to object space with the inverse of the specified transformation. template < typename T > RIM_FORCE_INLINE T operator * ( T value, const Transform3D<T>& transform ) { return transform.transformToWorldSpace( value ); } /// Transform the specified vector to object space with the inverse of the specified transformation. template < typename T > RIM_FORCE_INLINE Vector3D<T> operator * ( const Vector2D<T>& vector, const Transform3D<T>& transform ) { return transform.transformToObjectSpace( vector ); } /// Transform the specified matrix to object space with the inverse of the specified transformation. template < typename T > RIM_FORCE_INLINE Matrix3D<T> operator * ( const Matrix2D<T>& matrix, const Transform3D<T>& transform ) { return transform.transformToObjectSpace( matrix ); } /// Transform the specified ray to object space with the inverse of the specified transformation. template < typename T > RIM_FORCE_INLINE Ray3D<T> operator * ( const Ray3D<T>& ray, const Transform3D<T>& transform ) { return transform.transformToObjectSpace( ray ); } /// Transform the specified plane to object space with the inverse of the specified transformation. template < typename T > RIM_FORCE_INLINE Plane3D<T> operator * ( const Plane3D<T>& plane, const Transform3D<T>& transform ) { return transform.transformToObjectSpace( plane ); } //########################################################################################## //########################################################################################## //############ //############ 3D Transform Type Definitions //############ //########################################################################################## //########################################################################################## typedef Transform3D<int> Transform3i; typedef Transform3D<float> Transform3f; typedef Transform3D<double> Transform3d; //########################################################################################## //***************************** End Rim Math Namespace *********************************** RIM_MATH_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_TRANSFORM_3D_H <file_sep>/* * rimMatrix3D.h * Rim Math * * Created by <NAME> on 10/5/06. * Copyright 2006 Rim Software. All rights reserved. * */ #ifndef INCLUDE_RIM_MATRIX_3D_H #define INCLUDE_RIM_MATRIX_3D_H #include "rimMathConfig.h" #include "../data/rimBasicString.h" #include "../data/rimBasicStringBuffer.h" #include "rimVector3D.h" //########################################################################################## //***************************** Start Rim Math Namespace ********************************* RIM_MATH_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class which represents a 3x3 matrix. /** * Elements in the matrix are stored in column-major order. */ template < typename T> class Matrix3D { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructors /// Create a 3x3 matrix with all elements equal to zero. RIM_FORCE_INLINE Matrix3D<T>() : x( 0, 0, 0 ), y( 0, 0, 0 ), z( 0, 0, 0 ) { } /// Create a 3x3 matrix from three column vectors. RIM_FORCE_INLINE Matrix3D<T>( const Vector3D<T>& column1, const Vector3D<T>& column2, const Vector3D<T>& column3 ) : x( column1 ), y( column2 ), z( column3 ) { } /// Create a 3x3 matrix with elements specified in row-major order. RIM_FORCE_INLINE Matrix3D<T>( T a, T b, T c, T d, T e, T f, T g, T h, T i ) : x( a, d, g ), y( b, e, h ), z( c, f, i ) { } /// Create a 3x3 matrix from a pointer to an array of elements in column-major order. RIM_FORCE_INLINE explicit Matrix3D<T>( const T* array ) : x( array[0], array[3], array[6] ), y( array[1], array[4], array[7] ), z( array[2], array[5], array[8] ) { } /// Create an identity matrx with the specified 2x2 matrix in the upper-left corner. template < typename U > RIM_FORCE_INLINE explicit Matrix3D( const Matrix2D<U>& other ) : x( other.x, T(0) ), y( other.y, T(0) ), z( T(0), T(0), T(1) ) { } /// Create a copy of the specified 3x3 matrix with different template parameter type. template < typename U > RIM_FORCE_INLINE Matrix3D( const Matrix3D<U>& other ) : x( other.x ), y( other.y ), z( other.z ) { } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Static Matrix Constructors /// Return a skew-symmetric matrix using the elements of the specified vector. RIM_FORCE_INLINE static Matrix3D<T> skewSymmetric( const Vector3D<T>& vector ) { return Matrix3D<T>( 0, -vector.z, vector.y, vector.z, 0, -vector.x, -vector.y, vector.x, 0 ); } /// Return an orthogonal matrix defining a basis for the coordinate frame of a plane with the specified normal. /** * TODO: Fix this so that it handles zero vectors gracefully. */ RIM_FORCE_INLINE static Matrix3D<T> planeBasis( const Vector3D<T>& normal ) { Vector3D<T> binormal; Vector3D<T> n = math::abs(normal); if ( n.x <= n.y && n.x <= n.z ) binormal = Vector3D<T>( T(0), -normal.z, normal.y ).normalize(); if ( n.y <= n.x && n.y <= n.z ) binormal = Vector3D<T>( -normal.z, T(0), normal.x ).normalize(); if ( n.z <= n.x && n.z <= n.y ) binormal = Vector3D<T>( -normal.y, normal.x, T(0) ).normalize(); return Matrix3D<T>( math::cross( binormal, normal ), binormal, normal ); } /// Create a 3x3 rotation matrix about the X-axis with the angle in radians. RIM_FORCE_INLINE static Matrix3D<T> rotationX( T xRotation ) { return Matrix3D<T>( 1, 0, 0, 0, math::cos(xRotation), math::sin(xRotation), 0, -math::sin(xRotation), math::cos(xRotation) ); } /// Create a 3x3 rotation matrix about the Y-axis with the angle in radians. RIM_FORCE_INLINE static Matrix3D<T> rotationY( T yRotation ) { return Matrix3D<T>( math::cos(yRotation), 0, -math::sin(yRotation), 0, 1, 0, math::sin(yRotation), 0, math::cos(yRotation) ); } /// Create a 3x3 rotation matrix about the Z-axis with the angle in radians. RIM_FORCE_INLINE static Matrix3D<T> rotationZ( T zRotation ) { return Matrix3D<T>( math::cos(zRotation), math::sin(zRotation), 0, -math::sin(zRotation), math::cos(zRotation), 0, 0, 0, 1 ); } /// Create a 3x3 rotation matrix about the X-axis with the angle in degrees. RIM_FORCE_INLINE static Matrix3D<T> rotationXDegrees( T xRotation ) { return rotationX( math::degreesToRadians(xRotation) ); } /// Create a 3x3 rotation matrix about the Y-axis with the angle in degrees. RIM_FORCE_INLINE static Matrix3D<T> rotationYDegrees( T yRotation ) { return rotationY( math::degreesToRadians(yRotation) ); } /// Create a 3x3 rotation matrix about the Z-axis with the angle in degrees. RIM_FORCE_INLINE static Matrix3D<T> rotationZDegrees( T zRotation ) { return rotationZ( math::degreesToRadians(zRotation) ); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Accessor Methods /// Return a pointer to the matrix's elements in colunn-major order. /** * Since matrix elements are stored in column-major order, * no allocation is performed and the elements are accessed directly. */ RIM_FORCE_INLINE T* toArrayColumnMajor() { return (T*)&x; } /// Return a pointer to the matrix's elements in colunn-major order. /** * Since matrix elements are stored in column-major order, * no allocation is performed and the elements are accessed directly. */ RIM_FORCE_INLINE const T* toArrayColumnMajor() const { return (T*)&x; } /// Place the elements of the matrix at the location specified in row-major order. /** * The output array must be at least 9 elements long. */ RIM_FORCE_INLINE void toArrayRowMajor( T* outputArray ) const { outputArray[0] = x.x; outputArray[1] = y.x; outputArray[2] = z.x; outputArray[3] = x.y; outputArray[4] = y.y; outputArray[5] = z.y; outputArray[6] = x.z; outputArray[7] = y.z; outputArray[8] = z.z; } /// Get the column at the specified index in the matrix. RIM_FORCE_INLINE Vector3D<T>& getColumn( Index columnIndex ) { RIM_DEBUG_ASSERT( columnIndex < 3 ); return (&x)[columnIndex]; } /// Get the column at the specified index in the matrix. RIM_FORCE_INLINE const Vector3D<T>& getColumn( Index columnIndex ) const { RIM_DEBUG_ASSERT( columnIndex < 3 ); return (&x)[columnIndex]; } /// Get the column at the specified index in the matrix. RIM_FORCE_INLINE Vector3D<T>& operator () ( Index columnIndex ) { RIM_DEBUG_ASSERT( columnIndex < 3 ); return (&x)[columnIndex]; } /// Get the column at the specified index in the matrix. RIM_FORCE_INLINE const Vector3D<T>& operator () ( Index columnIndex ) const { RIM_DEBUG_ASSERT( columnIndex < 3 ); return (&x)[columnIndex]; } /// Get the column at the specified index in the matrix. RIM_FORCE_INLINE Vector3D<T>& operator [] ( Index columnIndex ) { RIM_DEBUG_ASSERT( columnIndex < 3 ); return (&x)[columnIndex]; } /// Get the column at the specified index in the matrix. RIM_FORCE_INLINE const Vector3D<T>& operator [] ( Index columnIndex ) const { RIM_DEBUG_ASSERT( columnIndex < 3 ); return (&x)[columnIndex]; } /// Get the row at the specified index in the matrix. RIM_FORCE_INLINE Vector3D<T> getRow( Index rowIndex ) const { RIM_DEBUG_ASSERT( rowIndex < 3 ); switch ( rowIndex ) { case 0: return Vector3D<T>( x.x, y.x, z.x ); case 1: return Vector3D<T>( x.y, y.y, z.y ); case 2: return Vector3D<T>( x.z, y.z, z.z ); default: return Vector3D<T>::ZERO; } } /// Get the element at the specified (column, row) index in the matrix. RIM_FORCE_INLINE T& get( Index columnIndex, Index rowIndex ) { RIM_DEBUG_ASSERT( columnIndex < 3 && rowIndex < 3 ); return (&x)[columnIndex][rowIndex]; } /// Get the element at the specified (column, row) index in the matrix. RIM_FORCE_INLINE const T& get( Index columnIndex, Index rowIndex ) const { RIM_DEBUG_ASSERT( columnIndex < 3 && rowIndex < 3 ); return (&x)[columnIndex][rowIndex]; } /// Get the element at the specified (column, row) index in the matrix. RIM_FORCE_INLINE T& operator () ( Index columnIndex, Index rowIndex ) { RIM_DEBUG_ASSERT( columnIndex < 3 && rowIndex < 3 ); return (&x)[columnIndex][rowIndex]; } /// Get the element at the specified (column, row) index in the matrix. RIM_FORCE_INLINE const T& operator () ( Index columnIndex, Index rowIndex ) const { RIM_DEBUG_ASSERT( columnIndex < 3 && rowIndex < 3 ); return (&x)[columnIndex][rowIndex]; } /// Set the element in the matrix at the specified (row, column) index. RIM_FORCE_INLINE void set( Index rowIndex, Index columnIndex, T value ) { RIM_DEBUG_ASSERT( rowIndex < 3 && columnIndex < 3 ); return (&x)[columnIndex][rowIndex] = value; } /// Set the column in the matrix at the specified index. RIM_FORCE_INLINE void setColumn( Index columnIndex, const Vector3D<T>& newColumn ) { RIM_DEBUG_ASSERT( columnIndex < 3 ); (&x)[columnIndex] = newColumn; } /// Set the row in the matrix at the specified index. RIM_FORCE_INLINE void setRow( Index rowIndex, const Vector3D<T>& newRow ) { RIM_DEBUG_ASSERT( rowIndex < 3 ); switch ( rowIndex ) { case 0: x.x = newRow.x; y.x = newRow.y; z.x = newRow.z; return; case 1: x.y = newRow.x; y.y = newRow.y; z.y = newRow.z; return; case 2: x.z = newRow.x; y.z = newRow.y; z.z = newRow.z; return; } } /// Return the diagonal vector of this matrix. RIM_FORCE_INLINE Vector3D<T> getDiagonal() const { return Vector3D<T>( x.x, y.y, z.z ); } /// Return the upper-left 2x2 submatrix of this matrix. RIM_FORCE_INLINE Matrix2D<T> getXY() const { return Matrix2D<T>( x.getXY(), y.getXY() ); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Matrix Operation Methods /// Return the determinant of this matrix. RIM_FORCE_INLINE T getDeterminant() const { return x.x*( y.y*z.z - z.y*y.z ) - y.x*( x.y*z.z - z.y*x.z ) + z.x*( x.y*y.z - y.y*x.z ); } /// Return the inverse of this matrix, or the zero matrix if the matrix has no inverse. /** * Whether or not the matrix is invertable is determined by comparing the determinant * to a threshold - if the absolute value of the determinant is less than the threshold, * the matrix is not invertable. */ RIM_FORCE_INLINE Matrix3D<T> invert( T threshold = 0 ) const { T det = getDeterminant(); if ( math::abs(det) <= threshold ) return Matrix3D<T>::ZERO; T detInv = T(1)/det; return Matrix3D<T>( (y.y*z.z - z.y*y.z)*detInv, (z.x*y.z - y.x*z.z)*detInv, (y.x*z.y - z.x*y.y)*detInv, (z.y*x.z - x.y*z.z)*detInv, (x.x*z.z - z.x*x.z)*detInv, (z.x*x.y - x.x*z.y)*detInv, (x.y*y.z - y.y*x.z)*detInv, (y.x*x.z - x.x*y.z)*detInv, (x.x*y.y - y.x*x.y)*detInv ); } /// Compute the inverse of this matrix, returning the result in the output parameter. /** * The method returns whether or not the matrix was able to be inverted. This propery * is determined by comparing the determinant to a threshold - if the absolute value of * the determinant is less than the threshold, the matrix is not invertable. */ RIM_FORCE_INLINE Bool invert( Matrix3D<T>& inverse, T threshold = 0 ) const { T det = getDeterminant(); if ( math::abs(det) <= threshold ) return false; T detInv = T(1)/det; inverse = Matrix3D<T>( (y.y*z.z - z.y*y.z)*detInv, (z.x*y.z - y.x*z.z)*detInv, (y.x*z.y - z.x*y.y)*detInv, (z.y*x.z - x.y*z.z)*detInv, (x.x*z.z - z.x*x.z)*detInv, (z.x*x.y - x.x*z.y)*detInv, (x.y*y.z - y.y*x.z)*detInv, (y.x*x.z - x.x*y.z)*detInv, (x.x*y.y - y.x*x.y)*detInv ); return true; } /// Return the orthonormalization of this matrix. /** * This matrix that is returned has all column vectors of unit * length and perpendicular to each other. */ RIM_FORCE_INLINE Matrix3D<T> orthonormalize() const { Vector3D<T> newX = x.normalize(); Vector3D<T> newZ = cross( newX, y ).normalize(); return Matrix3D( newX, cross( newZ, newX ).normalize(), newZ ); } /// Return the transposition of this matrix. RIM_FORCE_INLINE Matrix3D<T> transpose() const { return Matrix3D( x.x, x.y, x.z, y.x, y.y, y.z, z.x, z.y, z.z ); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Comparison Operators /// Compare two matrices component-wise for equality. RIM_FORCE_INLINE Bool operator == ( const Matrix3D<T>& m ) const { return x == m.x && y == m.y && z == m.z; } /// Compare two matrices component-wise for inequality. RIM_FORCE_INLINE Bool operator != ( const Matrix3D<T>& m ) const { return x != m.x || y != m.y || z != m.z; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Matrix Negation/Positivation Operators /// Negate every element of this matrix and return the resulting matrix. RIM_FORCE_INLINE Matrix3D<T> operator - () const { return Matrix3D<T>( -x, -y, -z ); } /// 'Positivate' every element of this matrix, returning a copy of the original matrix. RIM_FORCE_INLINE Matrix3D<T> operator + () const { return Matrix3D<T>( x, y, z ); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Arithmetic Operators /// Add this matrix to another and return the resulting matrix. RIM_FORCE_INLINE Matrix3D<T> operator + ( const Matrix3D<T>& matrix ) const { return Matrix3D<T>( x + matrix.x, y + matrix.y, z + matrix.z ); } /// Add a scalar to the elements of this matrix and return the resulting matrix. RIM_FORCE_INLINE Matrix3D<T> operator + ( const T& value ) const { return Matrix3D<T>( x + value, y + value, z + value ); } /// Subtract a matrix from this matrix and return the resulting matrix. RIM_FORCE_INLINE Matrix3D<T> operator - ( const Matrix3D<T>& matrix ) const { return Matrix3D<T>( x - matrix.x, y - matrix.y, z - matrix.z ); } /// Subtract a scalar from the elements of this matrix and return the resulting matrix. RIM_FORCE_INLINE Matrix3D<T> operator - ( const T& value ) const { return Matrix3D<T>( x - value, y - value, z - value ); } /// Multiply a matrix by this matrix and return the result. RIM_FORCE_INLINE Matrix3D<T> operator * ( const Matrix3D<T>& matrix ) const { return Matrix3D<T>( x.x*matrix.x.x + y.x*matrix.x.y + z.x*matrix.x.z, x.x*matrix.y.x + y.x*matrix.y.y + z.x*matrix.y.z, x.x*matrix.z.x + y.x*matrix.z.y + z.x*matrix.z.z, x.y*matrix.x.x + y.y*matrix.x.y + z.y*matrix.x.z, x.y*matrix.y.x + y.y*matrix.y.y + z.y*matrix.y.z, x.y*matrix.z.x + y.y*matrix.z.y + z.y*matrix.z.z, x.z*matrix.x.x + y.z*matrix.x.y + z.z*matrix.x.z, x.z*matrix.y.x + y.z*matrix.y.y + z.z*matrix.y.z, x.z*matrix.z.x + y.z*matrix.z.y + z.z*matrix.z.z ); } /// Multiply a vector/point by this matrix and return the result. RIM_FORCE_INLINE Vector3D<T> operator * ( const Vector3D<T>& vector ) const { return Vector3D<T>( x.x*vector.x + y.x*vector.y + z.x*vector.z, x.y*vector.x + y.y*vector.y + z.y*vector.z, x.z*vector.x + y.z*vector.y + z.z*vector.z ); } /// Multiply the elements of this matrix by a scalar and return the resulting matrix. RIM_FORCE_INLINE Matrix3D<T> operator * ( const T& value ) const { return Matrix3D<T>( x*value, y*value, z*value ); } /// Divide the elements of this matrix by a scalar and return the resulting matrix. RIM_FORCE_INLINE Matrix3D<T> operator / ( const T& value ) const { return Matrix3D<T>( x/value, y/value, z/value ); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Arithmetic Assignment Operators /// Add the elements of another matrix to this matrix. RIM_FORCE_INLINE Matrix3D<T>& operator += ( const Matrix3D<T>& matrix ) { x += matrix.x; y += matrix.y; z += matrix.z; return *this; } /// Add a scalar value to the elements of this matrix. RIM_FORCE_INLINE Matrix3D<T>& operator += ( const T& value ) { x += value; y += value; z += value; return *this; } /// Subtract the elements of another matrix from this matrix. RIM_FORCE_INLINE Matrix3D<T>& operator -= ( const Matrix3D<T>& matrix ) { x -= matrix.x; y -= matrix.y; z -= matrix.z; return *this; } /// Subtract a scalar value from the elements of this matrix. RIM_FORCE_INLINE Matrix3D<T>& operator -= ( const T& value ) { x -= value; y -= value; z -= value; return *this; } /// Multiply the elements of this matrix by a scalar value. RIM_FORCE_INLINE Matrix3D<T>& operator *= ( const T& value ) { x *= value; y *= value; z *= value; return *this; } /// Divide the elements of this matrix by a scalar value. RIM_FORCE_INLINE Matrix3D<T>& operator /= ( const T& value ) { x /= value; y /= value; z /= value; return *this; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** String Conversion Methods /// Convert this 3x3 matrix into a human-readable string representation. RIM_NO_INLINE data::String toString() const { data::StringBuffer buffer; buffer << "[ " << x.x << ", " << y.x << ", " << z.x << " ]\n"; buffer << "[ " << x.y << ", " << y.y << ", " << z.y << " ]\n"; buffer << "[ " << x.z << ", " << y.z << ", " << z.z << " ]"; return buffer.toString(); } /// Convert this 3x3 matrix into a human-readable string representation. RIM_FORCE_INLINE operator data::String () const { return this->toString(); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Public Data Members /// The first column vector of the matrix. Vector3D<T> x; /// The second column vector of the matrix. Vector3D<T> y; /// The third column vector of the matrix. Vector3D<T> z; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Public Static Data Members /// Constant matrix with all elements equal to zero. static const Matrix3D<T> ZERO; /// Constant matrix with diagonal elements equal to one and all others equal to zero. static const Matrix3D<T> IDENTITY; }; template < typename T > const Matrix3D<T> Matrix3D<T>:: ZERO( T(0), T(0), T(0), T(0), T(0), T(0), T(0), T(0), T(0) ); template < typename T > const Matrix3D<T> Matrix3D<T>:: IDENTITY( T(1), T(0), T(0), T(0), T(1), T(0), T(0), T(0), T(1) ); //########################################################################################## //########################################################################################## //############ //############ Reverse Matrix Arithmetic Operators //############ //########################################################################################## //########################################################################################## /// Add a sclar value to a matrix's elements and return the resulting matrix template < typename T > RIM_FORCE_INLINE Matrix3D<T> operator + ( const T& value, const Matrix3D<T>& matrix ) { return Matrix3D<T>( matrix.x + value, matrix.y + value, matrix.z + value ); } /// 'Reverse' multiply a vector/point by matrix: multiply it by the matrix's transpose. template < typename T > RIM_FORCE_INLINE Vector3D<T> operator * ( const Vector3D<T>& vector, const Matrix3D<T>& matrix ) { return Vector3D<T>( matrix.x.x * vector.x + matrix.x.y * vector.y + matrix.x.z * vector.z, matrix.y.x * vector.x + matrix.y.y * vector.y + matrix.y.z * vector.z, matrix.z.x * vector.x + matrix.z.y * vector.y + matrix.z.z * vector.z ); } /// Multiply a matrix's elements by a scalar and return the resulting matrix template < typename T > RIM_FORCE_INLINE Matrix3D<T> operator * ( const T& value, const Matrix3D<T>& matrix ) { return Matrix3D<T>( matrix.x*value, matrix.y*value, matrix.z*value ); } //########################################################################################## //########################################################################################## //############ //############ Other Matrix Functions //############ //########################################################################################## //########################################################################################## /// Return the absolute value of the specified matrix, such that the every component is positive. template < typename T > RIM_FORCE_INLINE Matrix3D<T> abs( const Matrix3D<T>& matrix ) { return Matrix3D<T>( math::abs(matrix.x.x), math::abs(matrix.y.x), math::abs(matrix.z.x), math::abs(matrix.x.y), math::abs(matrix.y.y), math::abs(matrix.z.y), math::abs(matrix.x.z), math::abs(matrix.y.z), math::abs(matrix.z.z) ); } //########################################################################################## //***************************** End Rim Math Namespace *********************************** RIM_MATH_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_MATRIX_3D_H <file_sep>/* * rimGraphicsGUISplitViewDelegate.h * Rim Graphics GUI * * Created by <NAME> on 2/13/13. * Copyright 2013 Headspace Systems. All rights reserved. * */ <file_sep>/* * rimSoundUtilitiesConfig.h * Rim Sound * * Created by <NAME> on 6/7/08. * Copyright 2008 Rim Software. All rights reserved. * */ #ifndef INCLUDE_RIM_SOUND_UTILITIES_CONFIG_H #define INCLUDE_RIM_SOUND_UTILITIES_CONFIG_H #include "../rimSoundConfig.h" //########################################################################################## //########################################################################################## //############ //############ Library Namespace Configuration //############ //########################################################################################## //########################################################################################## #ifndef RIM_SOUND_UTILITIES_NAMESPACE #define RIM_SOUND_UTILITIES_NAMESPACE util #endif #ifndef RIM_SOUND_UTILITIES_NAMESPACE_START #define RIM_SOUND_UTILITIES_NAMESPACE_START RIM_SOUND_NAMESPACE_START namespace RIM_SOUND_UTILITIES_NAMESPACE { #endif #ifndef RIM_SOUND_UTILITIES_NAMESPACE_END #define RIM_SOUND_UTILITIES_NAMESPACE_END }; RIM_SOUND_NAMESPACE_END #endif RIM_SOUND_NAMESPACE_START /// A namespace containing basic DSP framework classes for samples, buffers, and others types. namespace RIM_SOUND_UTILITIES_NAMESPACE { }; RIM_SOUND_NAMESPACE_END //########################################################################################## //*********************** Start Rim Sound Utilities Namespace **************************** RIM_SOUND_UTILITIES_NAMESPACE_START //****************************************************************************************** //########################################################################################## /// Define the type used to represent a sound sample that is a complex number. typedef math::Complex<Float32> ComplexSample; //########################################################################################## //*********************** End Rim Sound Utilities Namespace ****************************** RIM_SOUND_UTILITIES_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_SOUND_UTILITIES_CONFIG_H <file_sep>/* * rimSoundStreamRecorder.h * Rim Sound * * Created by <NAME> on 7/31/12. * Copyright 2012 __MyCompanyName__. All rights reserved. * */ #ifndef INCLUDE_RIM_SOUND_STREAM_RECORDER_H #define INCLUDE_RIM_SOUND_STREAM_RECORDER_H #include "rimSoundFiltersConfig.h" #include "rimSoundFilter.h" //########################################################################################## //************************ Start Rim Sound Filters Namespace ***************************** RIM_SOUND_FILTERS_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class that handles recording audio data to a streaming sound destination. /** * This class takes a pointer to a SoundOutputStream and then records sound * to that stream when the recorder is set to the 'record' mode. */ class StreamRecorder : public SoundFilter { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructors /// Create a default sound stream recorder without any stream to record to. /** * The constructed object will not do any recording until it has a valid * stream object. */ StreamRecorder(); /// Create a sound stream recorder which records to the specified sound output stream. /** * If the supplied stream is NULL or invalid, the stream recorder records no sound. * All recording occurs relative to the initial position within the stream. */ StreamRecorder( const Pointer<SoundOutputStream>& newStream ); /// Create a copy of the specified stream recorder and its state. StreamRecorder( const StreamRecorder& other ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Destructor /// Destroy a sound stream recorder and release all resources associated with it. ~StreamRecorder(); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Assignment Operator /// Assign the contents of another stream recorder to this one. StreamRecorder& operator = ( const StreamRecorder& other ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Stream Accessor Methods /// Return a const pointer to the SoundOutputStream which is being written to. /** * If there is no sound output stream set or if the stream is not valid, a NULL * pointer is returned, indicating the problem. */ const SoundOutputStream* getStream() const; /// Set the SoundOutputStream which this recorder should use as a sound destination. /** * If the supplied pointer is NULL, the sound recorder is deactivated and doesn't * record any more audio. Otherwise, the recorder resets its current recording * position and starts recording to the current position in the stream. * Thus, all recording occurs relative to the initial position * within the stream. */ void setStream( const Pointer<SoundOutputStream>& newStream ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Recording Accessor Methods /// Return whether or not this sound recorder is current recording audio. Bool isRecording() const; /// Set whether or not this sound recorder should be recording its input sound. /** * The method returns whether or not recording will occurr, based on the type * of SoundOutputSream which this player has and the requested playback * state. */ Bool setIsRecording( Bool newIsRecording ); /// Tell the sound recorder to start recording sound from the current position. /** * The method returns whether or not recording will occurr, based on the type * of SoundInputStream that this player has. */ Bool record(); /// Stop recording sound and keep the record head at the last position. void stop(); /// Reset the recording position to the first position within the stream. /** * The method returns whether or not the rewind operation was successul. * For SoundOutputStream objects that don't allow seeking, this method * will always fail. This method does not affect the recording state of the * recorder, thus rewinding will cause the recording to jump to the beginning * of the stream if the recorder is currently recording. */ Bool rewind(); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Filter Attribute Accessor Methods /// Return a human-readable name for this stream recorder. /** * The method returns the string "Stream Recorder". */ virtual UTF8String getName() const; /// Return the manufacturer name of this stream recorder. /** * The method returns the string "Headspace Sound". */ virtual UTF8String getManufacturer() const; /// Return an object representing the version of this stream recorder. virtual SoundFilterVersion getVersion() const; /// Return an object which describes the category of effect that this filter implements. /** * This method returns the value SoundFilterCategory::RECORDING. */ virtual SoundFilterCategory getCategory() const; /// Return whether or not this stream recorder can process audio data in-place. /** * This method always returns TRUE, stream recorders can process audio data in-place. */ virtual Bool allowsInPlaceProcessing() const; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Public Static Property Objects /// A string indicating the human-readable name of this stream recorder. static const UTF8String NAME; /// A string indicating the manufacturer name of this stream recorder. static const UTF8String MANUFACTURER; /// An object indicating the version of this stream recorder. static const SoundFilterVersion VERSION; private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Filter Processing Methods /// Record the specified number of samples from the input frame to the sound output stream. virtual SoundFilterResult processFrame( const SoundFilterFrame& inputFrame, SoundFilterFrame& outputFrame, Size numSamples ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Members /// A pointer to the sound output stream to which this recorder is recording. Pointer<SoundOutputStream> stream; /// The current position within the stream, relative to the initial position within the stream. SampleIndex currentStreamPosition; /// The current maximum position that has been reached in the stream. /** * This value allows the recorder to determine the total size of the stream * indirectly by noting the positions within the sound stream where recording * started and ended. The difference is the total length of the sound and it * is used when rewinding in the stream. */ SoundSize currentStreamLength; /// A boolean value indicating whether or not the stream recorder should be recording input audio.. Bool recordingEnabled; /// A boolean value indicating whether or not the sound stream supports seeking. Bool seekingAllowed; }; //########################################################################################## //************************ End Rim Sound Filters Namespace ******************************* RIM_SOUND_FILTERS_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_SOUND_STREAM_RECORDER_H <file_sep>/* * rimGraphicsConstantAnimationTarget.h * Rim Software * * Created by <NAME> on 6/28/14. * Copyright 2014 __MyCompanyName__. All rights reserved. * */ #ifndef INCLUDE_RIM_GRAPHICS_CONSTANT_ANIMATION_TARGET_H #define INCLUDE_RIM_GRAPHICS_CONSTANT_ANIMATION_TARGET_H #include "rimGraphicsAnimationConfig.h" #include "rimGraphicsAnimationTarget.h" //########################################################################################## //********************** Start Rim Graphics Animation Namespace ************************** RIM_GRAPHICS_ANIMATION_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class that controls a shader pass constant value via animation input data. class ConstantAnimationTarget : public AnimationTarget { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructor /// Create a new constant animation target for the specified shader pass and constant index. ConstantAnimationTarget( const Pointer<ShaderPass>& newShaderPass, Index constantIndex ); /// Create a new constant animation target for the specified shader pass and constant usage. /** * This constructor finds the index of the constant binding in the shader pass with the * specified usage and uses that as the animation target. */ ConstantAnimationTarget( const Pointer<ShaderPass>& newShaderPass, const ConstantUsage& usage ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Target Methods /// Return whether or not this target is the same as another. virtual Bool operator == ( const AnimationTarget& other ) const; /// Return whether or not the specified attribute type is compatible with this animation target. virtual Bool isValidType( const AttributeType& type ) const; // Set the target to have the given value. virtual Bool setValue( const AttributeValue& value ); private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Members /// A pointer to the shader pass that is being animated. Pointer<ShaderPass> shaderPass; /// The index of the constant that should be controlled by this target. Index constantIndex; }; //########################################################################################## //********************** End Rim Graphics Animation Namespace **************************** RIM_GRAPHICS_ANIMATION_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_GRAPHICS_CONSTANT_ANIMATION_TARGET_H <file_sep>/* * rimGraphicsGUIKnob.h * Rim Graphics GUI * * Created by <NAME> on 2/16/13. * Copyright 2013 Headspace Systems. All rights reserved. * */ #ifndef INCLUDE_RIM_GRAPHICS_GUI_KNOB_H #define INCLUDE_RIM_GRAPHICS_GUI_KNOB_H #include "rimGraphicsGUIBase.h" #include "rimGraphicsGUIObject.h" #include "rimGraphicsGUIKnobDelegate.h" //########################################################################################## //************************ Start Rim Graphics GUI Namespace ****************************** RIM_GRAPHICS_GUI_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class which represents a rotating circular region that allows the user to modify a ranged value. class Knob : public GUIObject { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructors /// Create a new sizeless knob positioned at the origin of its coordinate system. Knob(); /// Create a new knob which has the specified radius, position, range, and value. Knob( Float radius, const Vector2f& newPosition = Vector2f(), const Origin& newPositionOrigin = Origin( Origin::LEFT, Origin::BOTTOM ), const AABB1f& newRange = AABB1f(0,1), Float newValue = 0 ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Size Accessor Methods /// Set the size of this knob. /** * Since knobs are inherently circular, this method will fail, returning * FALSE if the specified size is not square, i.e. both width and height * are the same. Otherwise, if the sizes are equal, the method succeeds. */ Bool setSize( const Vector2f& newSize ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Radius Accessor Methods /// Return the radius of this knob's circular area. RIM_INLINE Float getRadius() const { return Float(0.5)*this->getSize().x; } /// Set the radius of this knob's circular area. /** * The method returns whether or not the knob's radius was successfully changed. * If the method succeeds, the knob automatically updates the radius * of its border to match the knob's radius. */ Bool setRadius( Float newRadius ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Value Accessor Methods /// Return the current value for the knob. RIM_INLINE Float getValue() const { return value; } /// Set the current value for the knob. /** * The new knob value is clamped to lie within the knob's valid * range of values. */ void setValue( Float newValue ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Range Accessor Methods /// Return an object which describes the minimum and maximum allowed values for the knob. /** * The range's minimum value is placed at the minimum coordinate of the knob's major axis, * and the maximum value is placed at the maximum coordinate of the knob's major axis. * * The minimum and maximum values do not have to be properly ordered - they can be * reversed in order to reverse the effective direction of the knob. */ RIM_INLINE const AABB1f& getRange() const { return range; } /// Set an object which describes the minimum and maximum allowed values for the knob. /** * The range's minimum value is placed at the minimum coordinate of the knob's major axis, * and the maximum value is placed at the maximum coordinate of the knob's major axis. * * The minimum and maximum values do not have to be properly ordered - they can be * reversed in order to reverse the effective direction of the knob. * * The knob's value is clamped so that is lies within the new range. */ void setRange( const AABB1f& newRange ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Number Of Steps Accessor Methods /// Return the total number of value steps there are for this knob. /** * This allows the user to quantize the knob's allowed values to * a fixed number of evenly-spaced steps. * * If this value is 0, the default, the knob's resolution is unquantized * and can be used to represent any value in the valid range. */ RIM_INLINE Size getStepCount() const { return numSteps; } /// Set the total number of value steps there are for this knob. /** * This allows the user to quantize the knob's allowed values to * a fixed number of evenly-spaced steps. * * If this value is 0, the default, the knob's resolution is unquantized * and can be used to represent any value in the valid range. */ RIM_INLINE void setStepCount( Size newNumSteps ) { numSteps = newNumSteps; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Value Curve Accessor Methods /// Return an object representing the curve which is used to map from knob positions to values. RIM_INLINE ValueCurve getValueCurve() const { return valueCurve; } /// Set an object representing the curve which is used to map from knob positions to values. RIM_INLINE void setValueCurve( ValueCurve newCurve ) { valueCurve = newCurve; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Sensitivity Accessor Methods /// Return the current value for the knob. RIM_INLINE Float getSensitivity() const { return value; } /// Set the current value for the knob. /** * The new knob value is clamped to lie within the knob's valid * range of values. */ void setSensitivity( Float newSensitivity ) { sensitivity = math::max( newSensitivity, this->getSize().x ); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Border Accessor Methods /// Return a mutable object which describes this knob's border. RIM_INLINE Border& getBorder() { return border; } /// Return an object which describes this knob's border. RIM_INLINE const Border& getBorder() const { return border; } /// Set an object which describes this knob's border. /** * The new border is set to have the same radius as the knob to * preserve visual quality. */ RIM_INLINE void setBorder( const Border& newBorder ) { border = newBorder; border.setRadius( this->getRadius() ); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Knob Direction Accessor Method /// Return the normalized direction vector indicating the direction that the knob is turned. RIM_INLINE Vector2f getDirection() const { Float a = this->getKnobPosition(); Float angle = angleRange.min + a*angleRange.getSize(); return Vector2f( math::cos(angle), math::sin(angle) ); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Knob State Accessor Methods /// Return whether or not this knob is currently active. /** * An inactive knob may change its visual appearance to indicate that * it is not able to be changed by the user. */ RIM_INLINE Bool getIsEnabled() const { return isEnabled; } /// Set whether or not this knob is currently active. /** * An inactive knob may change its visual appearance to indicate that * it is not able to be changed by the user. */ RIM_INLINE void setIsEnabled( Bool newIsEnabled ) { isEnabled = newIsEnabled; } /// Return whether or not this knob is able to be edited by the user. RIM_INLINE Bool getIsEditable() const { return isEditable; } /// Return whether or not this knob is able to be edited by the user. RIM_INLINE void setIsEditable( Bool newIsEditable ) { isEditable = newIsEditable; } /// Return whether or not this knob is currently grabbed by the mouse. RIM_INLINE Bool getIsGrabbed() const { return isGrabbed; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Background Color Accessor Methods /// Return the background color for this knob's area. RIM_INLINE const Color4f& getBackgroundColor() const { return backgroundColor; } /// Set the background color for this knob's area. RIM_INLINE void setBackgroundColor( const Color4f& newBackgroundColor ) { backgroundColor = newBackgroundColor; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Border Color Accessor Methods /// Return the border color used when rendering a knob. RIM_INLINE const Color4f& getBorderColor() const { return borderColor; } /// Set the border color used when rendering a knob. RIM_INLINE void setBorderColor( const Color4f& newBorderColor ) { borderColor = newBorderColor; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Knob Color Accessor Methods /// Return the color used when rendering a knob's rotation indicator. RIM_INLINE const Color4f& getIndicatorColor() const { return indicatorColor; } /// Set the color used when rendering a knob's rotation indicator. RIM_INLINE void setIndicatorColor( const Color4f& newKnobIndicatorColor ) { indicatorColor = newKnobIndicatorColor; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Indicator Width Accessor Methods /// Return the width used when rendering a knob's rotation indicator. /** * This width is expressed here as a fraction of the knob's radius. */ RIM_INLINE Float getIndicatorWidth() const { return indicatorWidth; } /// Set the width used when rendering a knob's rotation indicator. /** * This width is expressed here as a fraction of the knob's radius. */ RIM_INLINE void setIndicatorWidth( Float newIndicatorWidth ) { indicatorWidth = math::clamp( newIndicatorWidth, Float(0), Float(1) ); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Update Method /// Update the current internal state of this knob for the specified time interval in seconds. virtual void update( Float dt ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Drawing Method /// Draw this object using the specified GUI renderer to the given parent coordinate system bounds. /** * The method returns whether or not the object was successfully drawn. * * The default implementation draws nothing and returns TRUE. */ virtual Bool drawSelf( GUIRenderer& renderer, const AABB3f& parentBounds ) const; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Input Handling Methods /// Handle the specified keyboard event that occured when this object had focus. virtual void keyEvent( const KeyboardEvent& event ); /// Handle the specified mouse motion event that occurred. virtual void mouseMotionEvent( const MouseMotionEvent& event ); /// Handle the specified mouse button event that occurred. virtual void mouseButtonEvent( const MouseButtonEvent& event ); /// Handle the specified mouse wheel event that occurred. virtual void mouseWheelEvent( const MouseWheelEvent& event ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Delegate Accessor Methods /// Return a reference to the delegate which responds to events for this knob. RIM_INLINE KnobDelegate& getDelegate() { return delegate; } /// Return a reference to the delegate which responds to events for this knob. RIM_INLINE const KnobDelegate& getDelegate() const { return delegate; } /// Return a reference to the delegate which responds to events for this knob. RIM_INLINE void setDelegate( const KnobDelegate& newDelegate ) { delegate = newDelegate; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Static Construction Methods /// Construct a smart-pointer-wrapped instance of this class using the constructor with the given arguments. RIM_INLINE static Pointer<Knob> construct() { return Pointer<Knob>::construct(); } /// Construct a smart-pointer-wrapped instance of this class using the constructor with the given arguments. RIM_INLINE static Pointer<Knob> construct( Float radius, const Vector2f& newPosition = Vector2f(), const Origin& newPositionOrigin = Origin( Origin::LEFT, Origin::BOTTOM ), const AABB1f& newRange = AABB1f(0,1), Float newValue = 0 ) { return Pointer<Knob>::construct( radius, newPosition, newPositionOrigin, newRange, newValue ); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Public Static Data Members /// The default valid angle range in radians for the knob's rotation. static const AABB1f DEFAULT_ANGLE_RANGE; /// The default border that is used for a knob. static const Border DEFAULT_BORDER; /// The default background color that is used for a knob's area. static const Color4f DEFAULT_BACKGROUND_COLOR; /// The default border color that is used for a knob. static const Color4f DEFAULT_BORDER_COLOR; /// The default border color that is used for a knob's indicator. static const Color4f DEFAULT_INDICATOR_COLOR; /// The default width used for the knob's indicator direction line, as a fraction of the knob radius. static const Float DEFAULT_INDICATOR_WIDTH; private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Helper Methods /// Return the position of the knob from [0,1], based on the current value within the knob's range. RIM_INLINE Float getKnobPosition() const { return this->getKnobPositionFromValue( value ); } /// Return the position of the knob from [0,1], based on the specified value within the knob's range. RIM_INLINE Float getKnobPositionFromValue( Float v ) const { if ( range.min <= range.max ) return valueCurve.evaluateInverse( v, range ); else return Float(1) - valueCurve.evaluateInverse( v, AABB1f( range.max, range.min ) ); } /// Return the position of the knob from [0,1], based on the current value within the knob's range. RIM_INLINE Float getValueFromKnobPosition( Float a ) const { if ( numSteps > 0 ) a = math::round( numSteps*a ) / numSteps; if ( range.min <= range.max ) return valueCurve.evaluate( a, range ); else return valueCurve.evaluate( Float(1) - a, AABB1f( range.max, range.min ) ); } /// Convert the specified knob value to a quantized value if this knob has a discrete number of steps. RIM_INLINE Float stepifyValue( Float newValue ) { return this->getValueFromKnobPosition( this->getKnobPositionFromValue( newValue ) ); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Members /// The range of allowed values for this knob. /** * The range's minimum value is placed at the minimum coordinate of the knob's major axis, * and the maximum value is placed at the maximum coordinate of the knob's major axis. * * The minimum and maximum values do not have to be properly ordered - they can be * reversed in order to reverse the effective direction of the knob. */ AABB1f range; /// The current value for the knob. Float value; /// The total number of value steps there are for this knob. /** * This allows the user to quantize the knob's allowed values to * a fixed number of evenly-spaced steps. * * If this value is 0, the default, the knob's resolution is unquantized * and can be used to represent any value in the valid range. */ Size numSteps; /// An object representing the curve which is used to map from knob positions to values. ValueCurve valueCurve; /// The valid angle range in radians for the knob's rotation. AABB1f angleRange; /// An object which describes the border for this knob. Border border; /// An object which contains function pointers that respond to knob events. KnobDelegate delegate; /// The sensitivity of this knob to mouse movement. /** * This value indicates how far the mouse must be moved vertically to go from * the knob's minimum value to the maximum value. */ Float sensitivity; /// The offset vector of the mouse location from the minimum knob bounding coordinate. /** * This value keeps the knob from warping to the mouse's location when it is * grabbed off-center. */ Vector2f grabOffset; // The starting value when the knob was last grabbed. Float grabValueFraction; /// The background color for the knob's area. Color4f backgroundColor; /// The border color for the knob's background area. Color4f borderColor; /// The color used for the moving part of the knob's area. Color4f indicatorColor; /// The width of the knob direction indicator line, in units of percentage of the knob's width. Float indicatorWidth; /// A boolean value indicating whether or not this knob is active. /** * If the knob is not enabled, it will not display its moving knob area * and will not indicate a value or allow the user to edit the knob. */ Bool isEnabled; /// A boolean value indicating whether or not this knob's value can be changed by the user. Bool isEditable; /// A boolean value which indicates whether or not this knob is currently grabbed by the mouse. Bool isGrabbed; }; //########################################################################################## //************************ End Rim Graphics GUI Namespace ******************************** RIM_GRAPHICS_GUI_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_GRAPHICS_GUI_KNOB_H <file_sep>/* * rimSoundShelfFilter.h * Rim Sound * * Created by <NAME> on 11/27/12. * Copyright 2012 __MyCompanyName__. All rights reserved. * */ #ifndef INCLUDE_RIM_SOUND_SHELF_FILTER_H #define INCLUDE_RIM_SOUND_SHELF_FILTER_H #include "rimSoundFiltersConfig.h" #include "rimSoundFilter.h" //########################################################################################## //************************ Start Rim Sound Filters Namespace ***************************** RIM_SOUND_FILTERS_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class that implements high-shelf and low-shelf EQ filters. class ShelfFilter : public SoundFilter { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Filter Direction Enum Declaration /// An enum type that specifies if a filter is a high shelf or low shelf. typedef enum Direction { /// A type of filter that changes the response of all frequencies below the filter frequency. LOW_SHELF = 0, /// A type of filter that changes the response of all frequencies above the filter frequency. HIGH_SHELF = 1, }; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructors /// Create a default low shelf filter with corner frequency at 100 Hz and 0dB gain. ShelfFilter(); /// Create a shelf filter with the specified direction, corner frequency, and gain. /** * The corner frequency is clamped to the range of [0,+infinity]. */ ShelfFilter( Direction newFilterDirection, Float newCornerFrequency, Gain newGain ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Filter Direction Accessor Methods /// Return the direction of the filter that is being used. /** * This value determines whether the filter behaves as a high-shelf * or low-shelf filter. */ RIM_INLINE Direction getDirection() const { return filterDirection; } /// Set the type of filter that is being used. /** * This value determines whether the filter behaves as a high-shelf * or low-shelf filter. */ RIM_INLINE void setDirection( Direction newFilterDirection ) { lockMutex(); filterDirection = newFilterDirection; recalculateCoefficients(); unlockMutex(); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Corner Frequency Accessor Methods /// Return the corner frequency of this shelving filter. /** * This is the frequency at which the frequency begins to be cut off by the * filter. This is usually the point at which the filter is -3dB down. */ RIM_INLINE Float getFrequency() const { return cornerFrequency; } /// Set the corner frequency of this shelving filter. /** * This is the frequency at which the frequency begins to be cut off by the * filter. This is usually the point at which the filter is -3dB down. * * The new corner frequency is clamped to be in the range [0,+infinity]. */ RIM_INLINE void setFrequency( Float newCornerFrequency ) { lockMutex(); cornerFrequency = math::max( newCornerFrequency, Float(0) ); recalculateCoefficients(); unlockMutex(); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Filter Gain Accessor Methods /// Return the linear gain of this shelving filter. RIM_INLINE Gain getGain() const { return gain; } /// Return the gain in decibels of this shelving filter. RIM_INLINE Gain getGainDB() const { return util::linearToDB( gain ); } /// Set the linear gain of this shelving filter. RIM_INLINE void setGain( Gain newGain ) { lockMutex(); gain = math::max( newGain, Float(0) ); recalculateCoefficients(); unlockMutex(); } /// Set the gain in decibels of this shelving filter. RIM_INLINE void setGainDB( Gain newGain ) { lockMutex(); gain = util::dbToLinear( newGain ); recalculateCoefficients(); unlockMutex(); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Filter Slope Accessor Methods /// Return the slope of this shelf filter. /** * This value controls the slope of the transition from the passband to the stopband. * The default slope of 1 indicates that the change is as fast as possible without filter * overshoot on either side of the transition. A value greater than 1 causes filter overshoot * but a faster transition, while a value less than 1 causes a slower filter transition. */ RIM_INLINE Float getSlope() const { return slope; } /// Set the slope of this shelf filter. /** * This value controls the slope of the transition from the passband to the stopband. * The default slope of 1 indicates that the change is as fast as possible without filter * overshoot on either side of the transition. A value greater than 1 causes filter overshoot * but a faster transition, while a value less than 1 causes a slower filter transition. * * The new slope value is clamped to the range [0, +infinity]. */ RIM_INLINE void setSlope( Float newSlope ) { lockMutex(); slope = math::max( newSlope, Float(0) ); recalculateCoefficients(); unlockMutex(); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Filter Attribute Accessor Methods /// Return a human-readable name for this shelving filter. /** * The method returns the string "High-Pass Filter". */ virtual UTF8String getName() const; /// Return the manufacturer name of this shelving filter. /** * The method returns the string "Headspace Sound". */ virtual UTF8String getManufacturer() const; /// Return an object representing the version of this shelving filter. virtual SoundFilterVersion getVersion() const; /// Return an object which describes the category of effect that this filter implements. /** * This method returns the value SoundFilterCategory::EQUALIZER. */ virtual SoundFilterCategory getCategory() const; /// Return whether or not this band filter can process audio data in-place. /** * This method always returns TRUE, band filters can process audio data in-place. */ virtual Bool allowsInPlaceProcessing() const; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Filter Parameter Accessor Methods /// Return the total number of generic accessible parameters this filter has. virtual Size getParameterCount() const; /// Get information about the parameter at the specified index. virtual Bool getParameterInfo( Index parameterIndex, FilterParameterInfo& info ) const; /// Get any special name associated with the specified value of an indexed parameter. virtual Bool getParameterValueName( Index parameterIndex, const FilterParameter& value, UTF8String& name ) const; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Public Static Property Objects /// A string indicating the human-readable name of this shelf filter. static const UTF8String NAME; /// A string indicating the manufacturer name of this shelf filter. static const UTF8String MANUFACTURER; /// An object indicating the version of this shelf filter. static const SoundFilterVersion VERSION; private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Filter Channel Class Declaration /// A class which contains a history of the last input and output sample for a 1st order filter. class ChannelHistory { public: RIM_INLINE ChannelHistory() : inputHistory( Sample32f(0) ), outputHistory( Sample32f(0) ) { } /// An array of the last 2 input samples for a filter with order 2. StaticArray<Sample32f,2> inputHistory; /// An array of the last 2 output samples for a filter with order 2. StaticArray<Sample32f,2> outputHistory; }; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Filter Parameter Value Accessor Methods /// Place the value of the parameter at the specified index in the output parameter. virtual Bool getParameterValue( Index parameterIndex, FilterParameter& value ) const; /// Attempt to set the parameter value at the specified index. virtual Bool setParameterValue( Index parameterIndex, const FilterParameter& value ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Stream Reset Method /// A method which is called whenever the filter's stream of audio is being reset. /** * This method allows the filter to reset all parameter interpolation * and processing to its initial state to avoid coloration from previous * audio or parameter values. */ virtual void resetStream(); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Filter Processing Methods /// Apply this shelving filter to the samples in the input frame and place them in the output frame. virtual SoundFilterResult processFrame( const SoundFilterFrame& inputFrame, SoundFilterFrame& outputFrame, Size numSamples ); /// Apply a second order filter to the specified sample arrays. RIM_FORCE_INLINE void process2ndOrderFilter( const Sample32f* input, Sample32f* output, Size numSamples, const Float* a, const Float* b, Sample32f* inputHistory, Sample32f* outputHistory ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Filter Coefficient Calculation Methods /// Recalculate the filter coefficients for the current filter direction, frequency, and sample rate. void recalculateCoefficients(); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Members /// An enum representing the direction of this shelving filter. /** * This value specifies whether the filter is a high self or low shelf filter. */ Direction filterDirection; /// The frequency in hertz of the corner frequency of the shelving filter. /** * This is the frequency at which the frequency begins to be cut off by the * filter. This is usually the point at which the filter is -3dB down, but * can be -6dB or other for some filter types. */ Float cornerFrequency; /// The slope of this shelf filter. /** * This value controls the slope of the transition from the passband to the stopband. * The default slope of 1 indicates that the change is as fast as possible without filter * overshoot on either side of the transition. A value greater than 1 causes filter overshoot * but a faster transition, while a value less than 1 causes a slower filter transition. */ Float slope; /// The linear gain of the shelf filter. Gain gain; /// The sample rate of the last sample buffer processed. /** * This value is used to detect when the sample rate of the audio stream has changed, * and thus recalculate filter coefficients. */ SampleRate sampleRate; /// The 'a' (numerator) coefficients of the z-domain transfer function. StaticArray<Float,3> a; /// The 'b' (denominator) coefficients of the z-domain transfer function. StaticArray<Float,2> b; /// An array of input and output history information for each channel of this filter. Array<ChannelHistory> channelHistory; }; //########################################################################################## //************************ End Rim Sound Filters Namespace ******************************* RIM_SOUND_FILTERS_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_SOUND_SHELF_FILTER_H <file_sep>/* * rimSoundMIDITime.h * Rim Sound * * Created by <NAME> on 6/5/13. * Copyright 2013 __MyCompanyName__. All rights reserved. * */ #ifndef INCLUDE_RIM_SOUND_MIDI_TIME_H #define INCLUDE_RIM_SOUND_MIDI_TIME_H #include "rimSoundUtilitiesConfig.h" #include "rimSoundTimeSignature.h" //########################################################################################## //*********************** Start Rim Sound Utilities Namespace **************************** RIM_SOUND_UTILITIES_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class which represents a musical position within a MIDI sequence. /** * This position is used for MIDI playback and sequencing, as well as synchronizing * audio effects with MIDI data. * * The MIDI time is represented by a tempo, measure index, time signature, and * fractional number of beats since the beginning of the measure. */ class MIDITime { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructors /// Create a new default MIDI time object with the default tempo of 120 quarter notes per minute. RIM_INLINE MIDITime() : tempo( 120.0f ), beat( 0.0f ), measure( 0 ), timeSignature() { } /// Create a new MIDI Time object with the specified tempo, measure index, beat number, and time signature. RIM_INLINE MIDITime( Float newTempo, Index newMeasure, Float newBeat, TimeSignature newTimeSignature ) : tempo( newTempo ), beat( newBeat ), measure( (UByte)newMeasure ), timeSignature( newTimeSignature ) { } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Tempo Accessor Methods /// Return the number of quarter notes per minutes for the current position in the MIDI sequence. /** * This value can be used to convert the beat value into a time in seconds. */ RIM_INLINE Float getTempo() const { return tempo; } /// Return the number of quarter notes per minutes for the current position in the MIDI sequence. /** * This value can be used to convert the beat value into a time in seconds. * * The new tempo is clamped to be greater than or equal to 0. */ RIM_INLINE void setTempo( Float newTempo ) { tempo = math::max( newTempo, Float(0) ); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Measure Accessor Methods /// The index of the current measure within the MIDI sequence. /** * This value should not be used to compute the current time position * within the MIDI sequence (along with the time signature and tempo), because * the time signature and tempo may change throughout a given sequence, making * a simple computation of the current time impossible given only the measure * index. */ RIM_INLINE Index getMeasure() const { return (Index)measure; } /// Set the index of the current measure within the MIDI sequence. /** * This value should not be used to compute the current time position * within the MIDI sequence (along with the time signature and tempo), because * the time signature and tempo may change throughout a given sequence, making * a simple computation of the current time impossible given only the measure * index. */ RIM_INLINE void setMeasure( Index newMeasure ) { measure = (UByte)newMeasure; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Beat Accessor Methods /// Return the fractional number of time signature beats since the beginning of the measure. /** * This value is represented in units of the time signature, * so if the time signature is 6/8, the beat value can be in the * range from 0 to 5.99999 and indicates the number of eigth notes * since the start of the measure. */ RIM_INLINE Float getBeat() const { return beat; } /// Set the fractional number of time signature beats since the beginning of the measure. /** * This value is represented in units of the time signature, * so if the time signature is 6/8, the beat value can be in the * range from 0 to 5.99999 and indicates the number of eigth notes * since the start of the measure. * * The new beat value is clamped to be greater than 0. */ RIM_INLINE void setBeat( Float newBeat ) { beat = math::max( newBeat, Float(0) ); } private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Members /// The number of quarter notes per minute for the current position in the MIDI sequence. Float tempo; /// The fractional number of time signature beats since the beginning of the measure. /** * This value is represented in units of the time signature, * so if the time signature is 6/8, the beat value can be in the * range from 0 to 5.99999 and indicates the number of eigth notes * since the start of the measure. */ Float beat; /// The index of the current measure within the MIDI sequence. UInt32 measure; /// The time signature for the current measure. TimeSignature timeSignature; }; //########################################################################################## //*********************** End Rim Sound Utilities Namespace ****************************** RIM_SOUND_UTILITIES_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_SOUND_MIDI_TIME_H <file_sep>/* * rimGraphicsTransformable.h * Rim Software * * Created by <NAME> on 7/3/14. * Copyright 2014 __MyCompanyName__. All rights reserved. * */ #ifndef INCLUDE_RIM_GRAPHICS_TRANSFORMABLE_H #define INCLUDE_RIM_GRAPHICS_TRANSFORMABLE_H #include "rimGraphicsUtilitiesConfig.h" //########################################################################################## //********************** Start Rim Graphics Utilities Namespace ************************** RIM_GRAPHICS_UTILITIES_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class which represents an object that has a 3D transformation from object to world space. /** * This is the base class for other types that have a transformation, such as * objects, shapes, and cameras. It gives them a common interface for graphics * systems like animation. */ class Transformable { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructors /// Create a new transformable with the identity transformation. Transformable(); /// Create a new transformable with the specified transformation. Transformable( const Transform3& newTransform ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Destructor /// Destroy this transformable, releasing all associated resources. virtual ~Transformable(); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Position Accessor Methods /// Return the position of this transformable. /** * This position is specifid relative to the origin of the * enclosing coordinate space. */ RIM_INLINE const Vector3& getPosition() const { return transform.position; } /// Set the position of this transformable. /** * This position is specifid relative to the origin of the * enclosing coordinate space. */ RIM_INLINE void setPosition( const Vector3& newPosition ) { transform.position = newPosition; boundingBoxNeedsUpdate = true; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Orientation Accessor Methods /// Return the orientation of this transformable. RIM_INLINE const Matrix3& getOrientation() const { return transform.orientation; } /// Set the orientation of this transformable. void setOrientation( const Matrix3& newOrientation ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Scale Accessor Methods /// Get the scale of the transformable. RIM_INLINE const Vector3& getScale() const { return transform.scale; } /// Set the scale of the transformable uniformly for all dimensions. RIM_INLINE void setScale( Real newScale ) { transform.scale = Vector3(newScale); boundingBoxNeedsUpdate = true; } /// Set the scale of the transformable. RIM_INLINE void setScale( const Vector3& newScale ) { transform.scale = newScale; boundingBoxNeedsUpdate = true; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Transform Accessor Methods /// Return the transformation for this transformable between its local and parent coordinate frame. RIM_INLINE const Transform3& getTransform() const { return transform; } /// Set the transformation for this transformable between its local and parent coordinate frame. /** * This method ensures that the transformable's new orientation matrix is orthonormal. */ void setTransform( const Transform3& newTransform ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Transform Matrix Accessor Methods /// Return a 4x4 matrix representing the transformation from object to world space. Matrix4 getTransformMatrix() const; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Bounding Volume Accessor Method /// Return an axis-aligned bounding box that encompases this entire transformable in its parent coordinate space. RIM_FORCE_INLINE const AABB3& getBoundingBox() const { if ( boundingBoxNeedsUpdate ) updateBoundingBoxFromLocal(); return boundingBox; } /// Return an axis-aligned bounding box that encompases this entire transformable in its local coordinate space. RIM_FORCE_INLINE const AABB3& getLocalBoundingBox() const { return localBoundingBox; } /// Update the transformable's bounding box based on its current geometric representation. virtual void updateBoundingBox(); protected: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Bounding Box Accessor Method /// Set the local axis-aligned bounding box for this shape. /** * Shape subclasses should call this method to set the bounding box of their * geometry in their local coordinate frames (before applying the shape's own transformation). */ RIM_INLINE void setLocalBoundingBox( const AABB3& newLocalBoundingBox ) { localBoundingBox = newLocalBoundingBox; boundingBoxNeedsUpdate = true; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Protected Data Members /// The transformation for this transformable between its local and parent coordinate frame. Transform3 transform; private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Helper Methods /// Update the shape's parent-space bounding box from its local-space bounding box. void updateBoundingBoxFromLocal() const; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Members /// An axis-aligned bounding box for this transformable in its local coordinate frame. AABB3 localBoundingBox; /// An axis-aligned bounding box for this transformable in its parent coordinate frame. mutable AABB3 boundingBox; /// A boolean value indicating whether or not this shape's parent-space bounding box needs updating. mutable Bool boundingBoxNeedsUpdate; }; //########################################################################################## //********************** End Rim Graphics Utilities Namespace **************************** RIM_GRAPHICS_UTILITIES_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_GRAPHICS_TRANSFORMABLE_H <file_sep>/* * rimURL.h * Rim IO * * Created by <NAME> on 10/30/08. * Copyright 2008 __MyCompanyName__. All rights reserved. * */ #ifndef INCLUDE_RIM_URL_H #define INCLUDE_RIM_URL_H #include "rimFileSystemConfig.h" //########################################################################################## //************************* Start Rim File System Namespace ****************************** RIM_FILE_SYSTEM_NAMESPACE_START //****************************************************************************************** //########################################################################################## /* class URL { public: RIM_INLINE URL( const String& URLString ) : port( -1 ) { parseURL( URLString ); } RIM_INLINE URL( const String& newProtocol, const String& newHost, Int newPort, const String& newPath, const String& newRequest ) : protocol( newProtocol.getLength() > 0 ? newProtocol : defaultProtocol ), host( newHost ), port( newPort < -1 ? -1 : newPort ), request( newRequest ) { parsePath( newPath ); } RIM_INLINE const String& getName() const { return path[ path.getSize() - 1 ]; } RIM_INLINE String toString() const { StringBuffer buffer; buffer.append( protocol ).append( "://" ).append( host ); if ( port != -1 ) buffer.append(':').append(port); for ( Index i = 0; i < path.getSize(); i++ ) buffer.append( '/' ).append( path[i] ); if ( request.getLength() > 0 ) buffer.append('?').append(request); return buffer.toString(); } private: RIM_INLINE static Bool isAPathSeparator( Char character ) { return character == '/' || character == '\\'; } void parseURL( const String& URLString ); void parsePath( const String& pathString ); String protocol; String host; Int port; ArrayList<String> path; String request; static String defaultProtocol; }; */ //########################################################################################## //************************* End Rim File System Namespace ******************************** RIM_FILE_SYSTEM_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_URL_H <file_sep>/* * rimGraphicsBone.h * Rim Software * * Created by <NAME> on 7/3/14. * Copyright 2014 __MyCompanyName__. All rights reserved. * */ #ifndef INCLUDE_RIM_GRAPHICS_BONE_H #define INCLUDE_RIM_GRAPHICS_BONE_H #include "rimGraphicsShapesConfig.h" //########################################################################################## //*********************** Start Rim Graphics Shapes Namespace **************************** RIM_GRAPHICS_SHAPES_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class that stores information about a bone that makes up a skeleton. class Bone : public Transformable { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructors /// Create a new root bone with the specified name and bind transform. Bone( const String& newName, const Transform3& newBindTransform ); /// Create a new bone with the specified name, bind transform, and parent bone index. Bone( const String& newName, const Transform3& newBindTransform, Index parentIndex ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Bind Transform Accessor Methods /// Return a reference to the parent-relative bind transformation of this bone. RIM_INLINE const Transform3& getBindTransform() const { return bindTransform; } /// Set the parent-relative bind transformation of this bone. /** * The method returns whether or not the operation was successful. */ RIM_INLINE Bool setBindTransform( const Transform3& newBindTransform ) { bindTransform = newBindTransform; return true; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Bone Name Accessor Methods /// Return a reference to the name of this bone. RIM_INLINE const String& getName() const { return name; } /// Set the name of this bone. /** * The method returns whether or not the operation was successful. */ RIM_INLINE Bool setName(const String& newName ) { name = newName; return true; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Bone Parent Accessor Methods /// Return the index of the parent of the bone at the specified index. /** * The method returns INVALID_BONE_INDEX if there is no parent for that bone. */ RIM_INLINE Index getParentIndex() const { return parentIndex; } /// Set the index of the parent of the bone at the specified index in this skeleton. /** * The method returns whether or not the operation was successful. */ RIM_INLINE Bool setParentIndex( Index newParentIndex ) { parentIndex = newParentIndex; return true; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Public Static Data Members /// The index used to indicate an invalid bone. static const Index INVALID_BONE_INDEX = Index(-1); private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Members /// The index of this parent of this bone in the skeleton. Index parentIndex; /// A string that stores the human-readable name of this bone. String name; /// The bind-pose transformation of this bone. Transform3 bindTransform; }; //########################################################################################## //*********************** End Rim Graphics Shapes Namespace ****************************** RIM_GRAPHICS_SHAPES_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_GRAPHICS_BONE_H <file_sep>/* * rimGraphicsGUIBase.h * Rim Graphics GUI * * Created by <NAME> on 2/11/13. * Copyright 2013 Headspace Systems. All rights reserved. * */ #ifndef INCLUDE_RIM_GRAPHICS_GUI_BASE_H #define INCLUDE_RIM_GRAPHICS_GUI_BASE_H #include "rimGraphicsGUIConfig.h" // Include basic utility classes which most GUI elements need. #include "rimGraphicsGUIUtilities.h" // Include font classes which most GUI elements need. #include "rimGraphicsGUIFonts.h" //########################################################################################## //************************ Start Rim Graphics GUI Namespace ****************************** RIM_GRAPHICS_GUI_NAMESPACE_START //****************************************************************************************** //########################################################################################## using fonts::Font; using fonts::FontStyle; using util::Origin; using util::Orientation; using util::Direction; using util::Rectangle; using util::Margin; using util::BorderType; using util::Border; using util::GUIImage; using util::TextureImage; using util::ValueCurve; //########################################################################################## //************************ End Rim Graphics GUI Namespace ******************************** RIM_GRAPHICS_GUI_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_GRAPHICS_GUI_BASE_H <file_sep>/* * rimGraphicsDeviceType.h * Rim Graphics * * Created by <NAME> on 3/2/13. * Copyright 2013 __MyCompanyName__. All rights reserved. * */ #ifndef INCLUDE_RIM_GRAPHICS_DEVICE_TYPE_H #define INCLUDE_RIM_GRAPHICS_DEVICE_TYPE_H #include "rimGraphicsDevicesConfig.h" //########################################################################################## //*********************** Start Rim Graphics Devices Namespace *************************** RIM_GRAPHICS_DEVICES_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class which enumerates the different possible types of GraphicsDevice that may exist. /** * A GraphicsDevice represents a particular interface to the system's graphics * hardware, such as OpenGL or Direct3D. This class indicates the type of interface * that a device uses. This allows the user to determine which device to use when * rendering graphics on a given system platform. */ class GraphicsDeviceType { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Public Enum Declaration /// An enum type which represents the different graphics device types. typedef enum Enum { /// A graphics device type that uses the OpenGL API to draw graphics. OPENGL, /// A graphics device type that uses the Direct3D 9 API to draw graphics. DIRECT3D_9, /// A graphics device type that uses the Direct3D 10 API to draw graphics. DIRECT3D_10, /// A graphics device type that uses the Direct3D 11 API to draw graphics. DIRECT3D_11, /// An undefined or unknown graphics device type. UNDEFINED }; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructors /// Create a new graphics device type with the specified device type enum value. RIM_INLINE GraphicsDeviceType( Enum newType ) : type( newType ) { } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Enum Cast Operator /// Convert this graphics device type to an enum value. RIM_INLINE operator Enum () const { return type; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** String Representation Accessor Methods /// Return a string representation of the graphics device type. String toString() const; /// Convert this graphics device type into a string representation. RIM_INLINE operator String () const { return this->toString(); } private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Members /// An enum representing the graphics device type. Enum type; }; //########################################################################################## //*********************** End Rim Graphics Devices Namespace ***************************** RIM_GRAPHICS_DEVICES_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_GRAPHICS_DEVICE_TYPE_H <file_sep>/* * rimGraphicsGUIOrientation.h * Rim Graphics GUI * * Created by <NAME> on 2/7/13. * Copyright 2013 Headspace Systems. All rights reserved. * */ #ifndef INCLUDE_RIM_GRAPHICS_GUI_ORIENTATION_H #define INCLUDE_RIM_GRAPHICS_GUI_ORIENTATION_H #include "rimGraphicsGUIUtilitiesConfig.h" //########################################################################################## //******************* Start Rim Graphics GUI Utilities Namespace ************************* RIM_GRAPHICS_GUI_UTILITIES_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class which represents a 2D axis direction. /** * This class can be used to specify how certain GUI elements are rotated, * allowing them to specify either a horizontal or vertical orientation. */ class Orientation { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Public Enum Declaration /// An enum which specifies the different kinds of orientations. typedef enum Enum { /// A horizontal orientation, where the major axis is the X axis. HORIZONTAL, /// A vertical orientation, where the major axis is the Y axis. VERTICAL }; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructors /// Create a new orientation using the specified orientation type enum value. RIM_INLINE Orientation( Enum newType ) : type( newType ) { } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Enum Cast Operator /// Convert this orientation type to an enum value. RIM_INLINE operator Enum () const { return type; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** String Representation Accessor Methods /// Return a string representation of the orientation type. String toString() const; /// Convert this orientation type into a string representation. RIM_INLINE operator String () const { return this->toString(); } private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Members /// An enum value indicating the type of orientation this object represents. Enum type; }; //########################################################################################## //******************* End Rim Graphics GUI Utilities Namespace *************************** RIM_GRAPHICS_GUI_UTILITIES_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_GRAPHICS_GUI_ORIENTATION_H <file_sep>/* * rimAssetType.h * Rim Software * * Created by <NAME> on 6/11/14. * Copyright 2014 __MyCompanyName__. All rights reserved. * */ #ifndef INCLUDE_RIM_ASSET_TYPE_H #define INCLUDE_RIM_ASSET_TYPE_H #include "rimAssetsConfig.h" //########################################################################################## //**************************** Start Rim Assets Namespace ******************************** RIM_ASSETS_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class which represents the type of a generic asset. /** * An asset type is defined by a unique string. */ class AssetType { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructor /// Create a new asset type with an empty type string. RIM_INLINE AssetType() : typeString() { } /// Create a new asset type with the specified constant NULL-terminated type string. RIM_INLINE AssetType( const Char* newTypeString ) : typeString( newTypeString ) { } /// Create a new asset type with the specified type string. RIM_INLINE AssetType( const String& newTypeString ) : typeString( newTypeString ) { } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Name Accessor Methods /// Return a string representing the name of this asset type. RIM_INLINE const String& getName() const { return typeString; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Comparison Operators /// Return whether or not this asset type is equal to another. RIM_INLINE Bool operator == ( const AssetType& other ) const { return typeString == other.typeString; } /// Return whether or not this asset type is equal to another. RIM_INLINE Bool operator != ( const AssetType& other ) const { return typeString != other.typeString; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Hash Code Accessor Methods /// Return an integer hash code for this asset type. RIM_INLINE Hash getHashCode() const { return typeString.getHashCode(); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Asset Type Determination Method template < typename DataType > RIM_INLINE static const AssetType& of() { return UNDEFINED; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Public Asset Type Declarations /// The asset type to use for an undefined object type. static const AssetType UNDEFINED; /// The asset type to use for a 8-bit signed integer. static const AssetType INT8; /// The asset type to use for a 8-bit unsigned integer. static const AssetType UINT8; /// The asset type to use for a 16-bit signed integer. static const AssetType INT16; /// The asset type to use for a 16-bit unsigned integer. static const AssetType UINT16; /// The asset type to use for a 32-bit signed integer. static const AssetType INT32; /// The asset type to use for a 32-bit unsigned integer. static const AssetType UINT32; /// The asset type to use for a 64-bit signed integer. static const AssetType INT64; /// The asset type to use for a 64-bit unsigned integer. static const AssetType UINT64; /// The asset type to use for a floating point number. static const AssetType FLOAT32; /// The asset type to use for a double floating point number. static const AssetType FLOAT64; /// The asset type to use for a 2-component 32-bit float vector. static const AssetType VECTOR2_F32; /// The asset type to use for a 2-component 64-bit float vector. static const AssetType VECTOR2_F64; /// The asset type to use for a 3-component 32-bit float vector. static const AssetType VECTOR3_F32; /// The asset type to use for a 3-component 64-bit float vector. static const AssetType VECTOR3_F64; /// The asset type to use for a 4-component 32-bit float vector. static const AssetType VECTOR4_F32; /// The asset type to use for a 4-component 64-bit float vector. static const AssetType VECTOR4_F64; /// The asset type to use for a 2x2 32-bit float matrix. static const AssetType MATRIX2_F32; /// The asset type to use for a 2x2 64-bit float matrix. static const AssetType MATRIX2_F64; /// The asset type to use for a 3x3 32-bit float matrix. static const AssetType MATRIX3_F32; /// The asset type to use for a 3x3 64-bit float matrix. static const AssetType MATRIX3_F64; /// The asset type to use for a 4x4 32-bit float matrix. static const AssetType MATRIX4_F32; /// The asset type to use for a 4x4 64-bit float matrix. static const AssetType MATRIX4_F64; private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Members /// A string which represents this asset type. String typeString; }; template <> RIM_INLINE const AssetType& AssetType::of<Int8>() { return AssetType::INT8; } template <> RIM_INLINE const AssetType& AssetType::of<UInt8>() { return AssetType::UINT8; } template <> RIM_INLINE const AssetType& AssetType::of<Int16>() { return AssetType::INT16; } template <> RIM_INLINE const AssetType& AssetType::of<UInt16>() { return AssetType::UINT16; } template <> RIM_INLINE const AssetType& AssetType::of<Int32>() { return AssetType::INT32; } template <> RIM_INLINE const AssetType& AssetType::of<UInt32>() { return AssetType::UINT32; } template <> RIM_INLINE const AssetType& AssetType::of<Int64>() { return AssetType::INT64; } template <> RIM_INLINE const AssetType& AssetType::of<UInt64>() { return AssetType::UINT64; } template <> RIM_INLINE const AssetType& AssetType::of<Float32>() { return AssetType::FLOAT32; } template <> RIM_INLINE const AssetType& AssetType::of<Float64>() { return AssetType::FLOAT64; } template <> RIM_INLINE const AssetType& AssetType::of< math::Vector2D<Float32> >() { return AssetType::VECTOR2_F32; } template <> RIM_INLINE const AssetType& AssetType::of< math::Vector2D<Float64> >() { return AssetType::VECTOR2_F64; } template <> RIM_INLINE const AssetType& AssetType::of< math::Vector3D<Float32> >() { return AssetType::VECTOR3_F32; } template <> RIM_INLINE const AssetType& AssetType::of< math::Vector3D<Float64> >() { return AssetType::VECTOR3_F64; } template <> RIM_INLINE const AssetType& AssetType::of< math::Vector4D<Float32> >() { return AssetType::VECTOR4_F32; } template <> RIM_INLINE const AssetType& AssetType::of< math::Vector4D<Float64> >() { return AssetType::VECTOR4_F64; } template <> RIM_INLINE const AssetType& AssetType::of< math::Matrix2D<Float32> >() { return AssetType::MATRIX2_F32; } template <> RIM_INLINE const AssetType& AssetType::of< math::Matrix2D<Float64> >() { return AssetType::MATRIX2_F64; } template <> RIM_INLINE const AssetType& AssetType::of< math::Matrix3D<Float32> >() { return AssetType::MATRIX3_F32; } template <> RIM_INLINE const AssetType& AssetType::of< math::Matrix3D<Float64> >() { return AssetType::MATRIX3_F64; } template <> RIM_INLINE const AssetType& AssetType::of< math::Matrix4D<Float32> >() { return AssetType::MATRIX4_F32; } template <> RIM_INLINE const AssetType& AssetType::of< math::Matrix4D<Float64> >() { return AssetType::MATRIX4_F64; } //########################################################################################## //**************************** End Rim Assets Namespace ********************************** RIM_ASSETS_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_ASSET_TYPE_H <file_sep>/* * rimGraphicsHardwareBufferUsage.h * Rim Graphics * * Created by <NAME> on 1/8/11. * Copyright 2011 Rim Software. All rights reserved. * */ #ifndef INCLUDE_RIM_GRAPHICS_HARDWARE_BUFFER_USAGE_H #define INCLUDE_RIM_GRAPHICS_HARDWARE_BUFFER_USAGE_H #include "rimGraphicsBuffersConfig.h" //########################################################################################## //*********************** Start Rim Graphics Buffers Namespace *************************** RIM_GRAPHICS_BUFFERS_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class which specifies how a GPU-side attribute buffer should be used. /** * The usage specified here is used as a hint to the GPU to how the * hardware attribute buffer is handled. The usage hints at how often * a buffer will be updated and used to draw. */ class HardwareBufferUsage { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Vertex Attribute Buffer Usage Enum Definition /// An enum type which represents the usage for a hardware attribute buffer. typedef enum Enum { /// A usage where the buffer contents are set once and used to draw many times. STATIC = 1, /// A usage where the buffer contents are set and used to draw many times. DYNAMIC = 2, /// A usage where the buffer contents are set once and used to draw only a few times. STREAM = 3 }; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructors /// Create a new hardware attribute buffer usage with the specified usage enum value. RIM_INLINE HardwareBufferUsage( Enum newUsage ) : usage( newUsage ) { } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Enum Cast Operator /// Convert this hardware attribute buffer usage to an enum value. RIM_INLINE operator Enum () const { return (Enum)usage; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** String Representation Accessor Methods /// Return a string representation of the hardware attribute buffer usage. String toString() const; /// Convert this hardware attribute buffer usage into a string representation. RIM_INLINE operator String () const { return this->toString(); } private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Members /// An enum for the hardware attribute buffer usage. UByte usage; }; //########################################################################################## //*********************** End Rim Graphics Buffers Namespace ***************************** RIM_GRAPHICS_BUFFERS_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_GRAPHICS_HARDWARE_BUFFER_USAGE_H <file_sep>/* * rimFileSystem.h * Rim IO * * Created by <NAME> on 3/18/08. * Copyright 2008 __MyCompanyName__. All rights reserved. * */ #ifndef INCLUDE_RIM_FILE_SYSTEM_H #define INCLUDE_RIM_FILE_SYSTEM_H #include "fs/rimFileSystemConfig.h" //******************************************************************************** //******************************************************************************** //******************************************************************************** // File System Classes #include "fs/rimPath.h" #include "fs/rimURL.h" #include "fs/rimFileSystemNode.h" #include "fs/rimFile.h" #include "fs/rimDirectory.h" #ifdef RIM_FILE_SYSTEM_NAMESPACE_START #undef RIM_FILE_SYSTEM_NAMESPACE_START #endif #ifdef RIM_FILE_SYSTEM_NAMESPACE_END #undef RIM_FILE_SYSTEM_NAMESPACE_END #endif #endif // INCLUDE_RIM_FILE_SYSTEM_H <file_sep>/* * rimBVHConfig.h * Rim BVH * * Created by <NAME> on 12/28/08. * Copyright 2008 Rim Software. All rights reserved. * */ #ifndef INCLUDE_RIM_BVH_CONFIG_H #define INCLUDE_RIM_BVH_CONFIG_H #include "rim/rimFramework.h" //########################################################################################## //########################################################################################## //############ //############ Library Namespace Configuration //############ //########################################################################################## //########################################################################################## #ifndef RIM_BVH_NAMESPACE_START #define RIM_BVH_NAMESPACE_START RIM_NAMESPACE_START namespace bvh { #endif #ifndef RIM_BVH_NAMESPACE_END #define RIM_BVH_NAMESPACE_END }; RIM_NAMESPACE_END #endif //########################################################################################## //***************************** Start Rim BVH Namespace ********************************** RIM_BVH_NAMESPACE_START //****************************************************************************************** //########################################################################################## using rim::math::Vector2D; using rim::math::Vector2f; using rim::math::Vector2d; using rim::math::Vector3D; using rim::math::Vector3f; using rim::math::Vector3d; using rim::math::Transform3f; using rim::math::AABB1D; using rim::math::AABB1f; using rim::math::AABB1d; using rim::math::AABB2D; using rim::math::AABB2f; using rim::math::AABB2d; using rim::math::AABB3D; using rim::math::AABB3f; using rim::math::AABB3d; using rim::math::Ray3D; using rim::math::Ray3f; using rim::math::SIMDFloat4; using rim::math::SIMDInt4; typedef rim::math::SIMDVector3D<Float32,4> SIMDVector3f; typedef rim::math::SIMDRay3D<Float32,4> SIMDRay3f; typedef rim::math::SIMDAABB3D<Float32,4> SIMDAABB3f; typedef rim::math::SIMDTriangle3D<Float32,4> SIMDTriangle3f; typedef rim::math::SIMDPlane3D<Float32,4> SIMDPlane3f; //########################################################################################## //***************************** End Rim BVH Namespace ************************************ RIM_BVH_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_BVH_CONFIG_H <file_sep>/* * rimGraphicsGUISplitView.h * Rim Graphics GUI * * Created by <NAME> on 2/13/13. * Copyright 2013 Headspace Systems. All rights reserved. * */ <file_sep>/* * rimSoundAIFFDecoder.h * Rim Sound * * Created by <NAME> on 8/22/12. * Copyright 2012 __MyCompanyName__. All rights reserved. * */ #ifndef INCLUDE_RIM_SOUND_AIFF_DECODER_H #define INCLUDE_RIM_SOUND_AIFF_DECODER_H #include "rimSoundIOConfig.h" //########################################################################################## //*************************** Start Rim Sound IO Namespace ******************************* RIM_SOUND_IO_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class which handles streaming decoding of the PCM .AIFF audio format. /** * This class uses an abstract data stream for input, allowing it to decode * .AIFF data from a file, network source, or other source. */ class AIFFDecoder : public SoundInputStream { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructors /// Create a new AIFF decoder which should decode the .AIFF file at the specified path string. AIFFDecoder( const UTF8String& pathToAiffFile ); /// Create a new AIFF decoder which should decode the specified .WAV file. AIFFDecoder( const File& aiffFile ); /// Create a new AIFF decoder which is decoding from the specified data input stream. /** * The stream must already be open for reading and should point to the first byte of the wave * file information. Otherwise, reading from the AIFF file will fail. */ AIFFDecoder( const Pointer<DataInputStream>& waveStream ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Destructor /// Release all resources associated with this AIFFDecoder object. ~AIFFDecoder(); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** AIFF File Length Accessor Methods /// Get the length in samples of the AIFF file which is being decoded. RIM_INLINE SoundSize getLengthInSamples() const { return lengthInSamples; } /// Get the length in seconds of the AIFF file which is being decoded. RIM_INLINE Double getLengthInSeconds() const { return lengthInSamples*sampleRate; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Current Time Accessor Methods /// Get the index of the sample currently being read from the AIFF file. RIM_INLINE SampleIndex getCurrentSampleIndex() const { return currentSampleIndex; } /// Get the time in seconds within the AIFF file of the current read position of this decoder. RIM_INLINE Double getCurrentTime() const { return Double(currentSampleIndex / sampleRate); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Public Seek Status Accessor Methods /// Return whether or not seeking is allowed in this input stream. virtual Bool canSeek() const; /// Return whether or not this input stream's current position can be moved by the specified signed sample offset. /** * This sample offset is specified as the number of sample frames to move * in the stream - a frame is equal to one sample for each channel in the stream. */ virtual Bool canSeek( Int64 relativeSampleOffset ) const; /// Move the current sample frame position in the stream by the specified signed amount. /** * This method attempts to seek the position in the stream by the specified amount. * The method returns the signed amount that the position in the stream was changed * by. Thus, if seeking is not allowed, 0 is returned. Otherwise, the stream should * seek as far as possible in the specified direction and return the actual change * in position. */ virtual Int64 seek( Int64 relativeSampleOffset ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Stream Size Accessor Method /// Return the number of samples remaining in the sound input stream. /** * The value returned must only be a lower bound on the total number of sample * frames in the stream. For instance, if there are samples remaining, the method * should return at least 1. If there are no samples remaining, the method should * return 0. */ virtual SoundSize getSamplesRemaining() const; /// Return the current position of the stream within itself. /** * The returned value indicates the sample index of the current read * position within the sound stream. For unbounded streams, this indicates * the number of samples that have been read by the stream since it was opened. */ virtual SampleIndex getPosition() const; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Decoder Format Accessor Methods /// Return the number of channels that are in the sound input stream. /** * This is the number of channels that will be read with each read call * to the stream's read method. */ virtual Size getChannelCount() const; /// Return the sample rate of the sound input stream's source audio data. /** * Since some types of streams support variable sampling rates, this value * is not necessarily the sample rate of all audio that is read from the stream. * However, for most streams, this value represents the sample rate of the entire * stream. One should always test the sample rate of the buffers returned by the * stream to see what their sample rates are before doing any operations that assume * a sampling rate. */ virtual SampleRate getSampleRate() const; /// Return the actual sample type used in the stream. /** * This is the format of the stream's source data. For instance, a file * might be encoded with 8-bit, 16-bit or 24-bit samples. This value * indicates that sample type. For formats that don't have a native sample type, * such as those which use frequency domain encoding, this function should * return SampleType::SAMPLE_32F, indicating that the stream's native format * is 32-bit floating point samples. */ virtual SampleType getNativeSampleType() const; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Decoder Status Accessor Method /// Return whether or not this AIFF decoder is reading a valid AIFF file. Bool isValid() const; private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Copy Operations /// Create a copy of the specified AIFF decoder. AIFFDecoder( const AIFFDecoder& other ); /// Assign the current state of another AIFFDecoder object to this AIFFDecoder object. AIFFDecoder& operator = ( const AIFFDecoder& other ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Sound Reading Method /// Read the specified number of samples from the input stream into the output buffer. /** * This method attempts to read the specified number of samples from the stream * into the input buffer. It then returns the total number of valid samples which * were read into the output buffer. The samples are converted to the format * stored in the input buffer (Sample32f). The input position in the stream * is advanced by the number of samples that are read. */ virtual Size readSamples( SoundBuffer& inputBuffer, Size numSamples ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Helper Methods /// Find the common chunk of the AIFF file, starting from the current position. /** * This method should only be called when the data input stream is first initialized * and points to the first byte of the AIFF file. */ void openFile(); /// Return the number of bytes per sample (stored on disk) for the compression scheme. Size getBytesPerSample() const; /// Convert an 80-bit IEEE 754 extended floating point number to a 64-bit double floating point number. static Float64 convertFP80ToFP64( const UByte* fp80 ); static Int16 decodeALaw( UInt8 aLaw ); static Int16 decodeMuLaw( UInt8 muLaw ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Members /// A pointer to the data input stream from which we are decoding .WAV data. Pointer<DataInputStream> stream; /// A mutex object which provides thread synchronization for this AIFF decoder. /** * This thread protects access to decoding parameters such as the current decoding * position so that they are never accessed while audio is being decoded. */ mutable threads::Mutex decodingMutex; /// The number of channels in the AIFF file. Size numChannels; /// The sample rate of the AIFF file. SampleRate sampleRate; /// The type of sample in which the AIFF file is encoded. /** * For PCM types this value is equal to the actual type of the encoded samples. * For A-law and Mu-law encodings, this value indicates the size of the encoded, * not the decoded samples. */ SampleType sampleType; /// The AIFF file encoding format. Index compressionType; /// The length in samples of the AIFF file. SoundSize lengthInSamples; /// The index within the AIFF file of the current sample being read. SampleIndex currentSampleIndex; /// A boolean value indicating whether or not the decoded file is in the AIFF or AIFC format. Bool isAIFC; /// A boolean value indicating whether or not this file is little-endian. Bool isLittleEndian; /// A boolean flag indicating whether or not this AIFF decoder is decoding a valid AIFF file. Bool validFile; }; //########################################################################################## //*************************** End Rim Sound IO Namespace ********************************* RIM_SOUND_IO_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_SOUND_AIFF_DECODER_H <file_sep>/* * rimGraphicsConstantBinding.h * Rim Graphics * * Created by <NAME> on 1/17/11. * Copyright 2011 Rim Software. All rights reserved. * */ #ifndef INCLUDE_RIM_GRAPHICS_CONSTANT_BINDING_H #define INCLUDE_RIM_GRAPHICS_CONSTANT_BINDING_H #include "rimGraphicsShadersConfig.h" #include "rimGraphicsConstantUsage.h" #include "rimGraphicsConstantVariable.h" //########################################################################################## //*********************** Start Rim Graphics Shaders Namespace *************************** RIM_GRAPHICS_SHADERS_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class used to represent the binding between a constant shader variable and its value and usage. class ConstantBinding { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Shader Attribute Variable Accessor Methods /// Get the shader attribute variable to which a value is bound. RIM_FORCE_INLINE const ConstantVariable& getVariable() const { return *variable; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Shader Attribute Usage Accessor Methods /// Return the semantic usage for this shader attribute binding. RIM_FORCE_INLINE const ConstantUsage& getUsage() const { return usage; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Byte Offset Accessor Methods /// Return the offset in bytes for this binding's value in its shader pass's constant storage buffer. RIM_FORCE_INLINE UInt getByteOffset() const { return byteOffset; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Input Status Accessor Methods /// Return whether or not this constant binding is a dynamic input to a shader pass. /** * If so, the renderer can provide dynamic scene information for this binding * (such as nearby lights, textures, etc) that aren't explicitly part of this * binding. By default, all bindings are inputs. */ RIM_INLINE Bool getIsInput() const { return isInput; } private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Friend Class Declarations /// Declare the ShaderPass class a friend so that it can manipulate internal data easily. friend class ShaderPass; /// Declare the ShaderBindingSet class a friend so that it can manipulate internal data easily. friend class ShaderBindingSet; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Constructors /// Create a constant binding for the specified variable and usage with the given byte offset and input status. RIM_INLINE ConstantBinding( const ConstantVariable* newVariable, const ConstantUsage& newUsage, UInt newByteOffset, Bool newIsInput ) : variable( newVariable ), usage( newUsage ), byteOffset( newByteOffset ), isInput( newIsInput ) { RIM_DEBUG_ASSERT_MESSAGE( newVariable != NULL, "Cannot create ConstantBinding with NULL constant variable." ); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Members /// The constant variable which is bound. const ConstantVariable* variable; /// The semantic usage for this shader attribute binding. /** * This object allows the creator to specify the semantic usage for the shader attribute * variable. For instance, the usage could be to specify a light's position. This * allows the rendering system to automatically update certain shader parameters * that are environmental. */ ConstantUsage usage; /// An offset in bytes for this binding's value in its shader pass's constant storage buffer. UInt byteOffset; /// A boolean value indicating whether or not this binding represents a dynamic input. Bool isInput; }; //########################################################################################## //*********************** End Rim Graphics Shaders Namespace ***************************** RIM_GRAPHICS_SHADERS_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_GRAPHICS_CONSTANT_BINDING_H <file_sep>/* * rimGraphicsShaderParameterValue.h * Rim Software * * Created by <NAME> on 1/30/14. * Copyright 2014 __MyCompanyName__. All rights reserved. * */ #ifndef INCLUDE_RIM_GRAPHICS_SHADER_PARAMETER_VALUE_H #define INCLUDE_RIM_GRAPHICS_SHADER_PARAMETER_VALUE_H #include "rimGraphicsShadersConfig.h" //########################################################################################## //*********************** Start Rim Graphics Shaders Namespace *************************** RIM_GRAPHICS_SHADERS_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class which stores a value for a shader parameter. /** * A shader parameter value is a signed integer. */ class ShaderParameterValue { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructors /// Create a new shader parameter value object with the default value of 0. RIM_INLINE ShaderParameterValue() : value( 0 ) { } /// Create a new shader parameter value object with the specified value. RIM_INLINE ShaderParameterValue( Int newValue ) : value( newValue ) { } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Value Accessor Methods /// Return the integer value stored by this shader parameter value. RIM_INLINE Int getValue() const { return value; } /// Set the integer value stored by this shader parameter value. RIM_INLINE void setValue( Int newValue ) { value = newValue; } private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Members /// An integer value for this shader parameter. Int value; }; //########################################################################################## //*********************** End Rim Graphics Shaders Namespace ***************************** RIM_GRAPHICS_SHADERS_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_GRAPHICS_SHADER_PARAMETER_VALUE_H <file_sep>/* * rimSoundDevices.h * Rim Sound * * Created by <NAME> on 7/21/12. * Copyright 2012 __MyCompanyName__. All rights reserved. * */ #ifndef INCLUDE_RIM_SOUND_DEVICES_H #define INCLUDE_RIM_SOUND_DEVICES_H #include "devices/rimSoundDevicesConfig.h" // Sound Device Classes #include "devices/rimSoundDeviceID.h" #include "devices/rimSoundDeviceManager.h" #include "devices/rimSoundDeviceManagerDelegate.h" #include "devices/rimSoundDevice.h" #include "devices/rimSoundDeviceDelegate.h" #include "devices/rimDefaultSoundDevice.h" // MIDI Device Classes #include "devices/rimSoundMIDIDeviceID.h" #include "devices/rimSoundMIDIDeviceManager.h" #include "devices/rimSoundMIDIDeviceManagerDelegate.h" #include "devices/rimSoundMIDIDevice.h" #include "devices/rimSoundMIDIDeviceDelegate.h" #endif // INCLUDE_RIM_SOUND_DEVICES_H <file_sep>/* * rimGUIView.h * Rim GUI * * Created by <NAME> on 5/24/08. * Copyright 2008 __MyCompanyName__. All rights reserved. * */ #ifndef INCLUDE_RIM_GUI_VIEW_H #define INCLUDE_RIM_GUI_VIEW_H #include "rimGUIConfig.h" #include "rimGUIWindowElement.h" //########################################################################################## //*************************** Start Rim GUI Namespace ****************************** RIM_GUI_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class which represents a rectangular content region that is part of a window. class View : public WindowElement { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Displaying Methods /// Tell the view to redraw its contents (if applicable). /** * This method should be called whenever the user wishes to force the view * to redraw itself. This forces a call to the view's drawing function. */ //virtual void display() = 0; }; //########################################################################################## //*************************** End Rim GUI Namespace ******************************** RIM_GUI_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_GUI_VIEW_H <file_sep>/* * rimEntities.h * Rim Entities * * Created by <NAME> on 2/2/08. * Copyright 2008 Rim Software. All rights reserved. * */ #ifndef INCLUDE_RIM_ENTITIES_H #define INCLUDE_RIM_ENTITIES_H #include "entities/rimEntitiesConfig.h" #include "entities/rimEntityComponent.h" #include "entities/rimEntity.h" #include "entities/rimEntityEvent.h" #include "entities/rimEntitySystem.h" #include "entities/rimEntityEngine.h" //########################################################################################## //************************** Start Rim Entities Namespace ******************************** RIM_ENTITIES_NAMESPACE_START //****************************************************************************************** //########################################################################################## //########################################################################################## //************************** End Rim Entities Namespace ********************************** RIM_ENTITIES_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_ENTITIES_H <file_sep>/* * rimGraphicsTextureType.h * Rim Graphics * * Created by <NAME> on 9/12/10. * Copyright 2010 Rim Software. All rights reserved. * */ #ifndef INCLUDE_RIM_GRAPHICS_TEXTURE_TYPE_H #define INCLUDE_RIM_GRAPHICS_TEXTURE_TYPE_H #include "rimGraphicsTexturesConfig.h" //########################################################################################## //********************** Start Rim Graphics Textures Namespace *************************** RIM_GRAPHICS_TEXTURES_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class which specifies the high-level type of a texture. /** * A texture type consists of the dimensionality of the texture, whether * or not it is a depth map (i.e. shadow map), and whether or not it is a cube * map. */ class TextureType { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructors /// Create a texture type with the specified dimensionality and attributes. RIM_INLINE TextureType( Size newNumDimensions, Bool newIsAShadowMap, Bool newIsACubeMap ) : numDimensions( (UByte)newNumDimensions ), isShadowMap( newIsAShadowMap ), isCubeMap( newIsACubeMap ) { } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Attribute Accessor Methods /// Get the number of dimensions in this texture type (usually 1, 2, or 3). RIM_INLINE Size getDimensionCount() const { return numDimensions; } /// Return whether or not this texture type represents a shadow map. RIM_INLINE Bool isAShadowMap() const { return isShadowMap != 0; } /// Return whether or not this texture type represents a cube map. RIM_INLINE Bool isACubeMap() const { return isCubeMap != 0; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Equality Comparison Operators /// Return whether or not this texture type is exactly equal to another. RIM_INLINE Bool operator == ( const TextureType& other ) const { return numDimensions == other.numDimensions && isShadowMap == other.isShadowMap && isCubeMap == other.isCubeMap; } /// Return whether or not this texture type is not equal to another. RIM_INLINE Bool operator != ( const TextureType& other ) const { return numDimensions != other.numDimensions || isShadowMap != other.isShadowMap || isCubeMap != other.isCubeMap; } private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Members /// The number of dimensions of the texture map. UByte numDimensions; /// Whether or not this texture type is a shadow (depth) map. UByte isShadowMap; /// Whether or not this texture type is a cube map. UByte isCubeMap; }; //########################################################################################## //********************** End Rim Graphics Textures Namespace ***************************** RIM_GRAPHICS_TEXTURES_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_GRAPHICS_TEXTURE_TYPE_H <file_sep>/* * rimSoundMIDIEvent.h * Rim Sound * * Created by <NAME> on 5/25/13. * Copyright 2013 __MyCompanyName__. All rights reserved. * */ #ifndef INCLUDE_RIM_SOUND_MIDI_EVENT_H #define INCLUDE_RIM_SOUND_MIDI_EVENT_H #include "rimSoundUtilitiesConfig.h" #include "rimSoundMIDIMessage.h" //########################################################################################## //*********************** Start Rim Sound Utilities Namespace **************************** RIM_SOUND_UTILITIES_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class which represents a single MIDI message that fires at an absolute moment in time. /** * This class consists of a MIDIMessage object and a relative time at which that * event occurs. */ class MIDIEvent { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructors /// Create a default MIDI event with an undefined message and time. RIM_INLINE MIDIEvent() : message(), time() { } /// Create a MIDI event for the specified message. /** * The time for the event is default-initialized to be 0, indicating * it coincided with the Epoch, 1970-01-01 00:00:00 +0000 (UTC). */ RIM_INLINE MIDIEvent( const MIDIMessage& newMessage ) : message( newMessage ), time() { } /// Create a MIDI event for the specified message at the specified time. /** * This time is measured relative to the Epoch, 1970-01-01 00:00:00 +0000 (UTC). */ RIM_INLINE MIDIEvent( const MIDIMessage& newMessage, const Time& newTime ) : message( newMessage ), time( newTime ) { } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Message Accessor Methods /// Return a reference to the MIDI message associated with this event. RIM_INLINE const MIDIMessage& getMessage() const { return message; } /// Set the MIDI message which is associated with this event. RIM_INLINE void setMessage( const MIDIMessage& newMessage ) { message = newMessage; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Time Accessor Methods /// Return the relative time at which this MIDI event occurred. /** * This time is measured relative to some reference time. For absolute-time * MIDI events (real-time), the reference time is the Epoch, 1970-01-01 00:00:00 +0000 (UTC). * For other events, such as those that are part of a SoundFilterFrame, the * time is specified relative to the frame's time. */ RIM_INLINE const Time& getTime() const { return time; } /// Set the absolute time at which this MIDI event occurred. /** * This time is measured relative to some reference time. For absolute-time * MIDI events (real-time), the reference time is the Epoch, 1970-01-01 00:00:00 +0000 (UTC). * For other events, such as those that are part of a SoundFilterFrame, the * time is specified relative to the frame's time. */ RIM_INLINE void setTime( const Time& newTime ) { time = newTime; } private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Members /// The MIDI message associated with this MIDI event. MIDIMessage message; /// The relative offset in time when the associated MIDI message occurred from some reference point. /** * This time is measured relative to some reference time. For absolute-time * MIDI events (real-time), the reference time is the Epoch, 1970-01-01 00:00:00 +0000 (UTC). * For other events, such as those that are part of a SoundFilterFrame, the * time is specified relative to the frame's time. */ Time time; }; //########################################################################################## //*********************** End Rim Sound Utilities Namespace ****************************** RIM_SOUND_UTILITIES_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_SOUND_MIDI_EVENT_H <file_sep>/* * rimHashSet.h * Rim Framework * * Created by <NAME> on 3/3/11. * Copyright 2011 Rim Software. All rights reserved. * */ #ifndef INCLUDE_RIM_HASH_SET_H #define INCLUDE_RIM_HASH_SET_H #include "rimUtilitiesConfig.h" #include "../math/rimPrimes.h" #include "rimAllocator.h" //########################################################################################## //*************************** Start Rim Utilities Namespace ****************************** RIM_UTILITIES_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A container class which uses a hash table to keep track of a set of values. template < typename T, typename HashType = Hash > class HashSet { private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Entry Class class Entry { public: RIM_INLINE Entry( HashType newHash, const T& newValue ) : next( NULL ), hash( newHash ), value( newValue ) { } RIM_INLINE Entry( const Entry& other ) : hash( other.hash ), value( other.value ) { if ( other.next ) next = HashSet::newEntry(*other.next); else next = NULL; } ~Entry() { if ( next ) delete next; } Entry* next; HashType hash; T value; }; public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructors /// Create a hash set with the default load factor and number of buckets. RIM_INLINE HashSet() : loadFactor( DEFAULT_LOAD_FACTOR ), loadThreshold( Size(DEFAULT_LOAD_FACTOR*DEFAULT_NUMBER_OF_BUCKETS) ), numElements( 0 ), numBuckets( DEFAULT_NUMBER_OF_BUCKETS ), buckets( util::allocate<Entry*>(DEFAULT_NUMBER_OF_BUCKETS) ) { nullBuckets(); } /// Create a hash set with the specified load factor and default number of buckets. RIM_INLINE HashSet( Float newLoadFactor ) : loadFactor( math::clamp( newLoadFactor, 0.1f, 2.0f ) ), numElements( 0 ), numBuckets( DEFAULT_NUMBER_OF_BUCKETS ), buckets( util::allocate<Entry*>(DEFAULT_NUMBER_OF_BUCKETS) ) { loadThreshold = Size(loadFactor*DEFAULT_NUMBER_OF_BUCKETS); nullBuckets(); } /// Create a hash set with the default load factor and specified number of buckets. RIM_INLINE HashSet( HashType newNumBuckets ) : loadFactor( DEFAULT_LOAD_FACTOR ), numElements( 0 ), numBuckets( math::nextPowerOf2Prime(newNumBuckets) ) { buckets = util::allocate<Entry*>(numBuckets); loadThreshold = Size(DEFAULT_LOAD_FACTOR*numBuckets); nullBuckets(); } /// Create a hash set with the specified load factor and number of buckets. RIM_INLINE HashSet( HashType newNumBuckets, Float newLoadFactor ) : loadFactor( math::clamp( newLoadFactor, 0.1f, 2.0f ) ), numElements( 0 ), numBuckets( math::nextPowerOf2Prime(newNumBuckets) ) { buckets = util::allocate<Entry*>(numBuckets); loadThreshold = Size(loadFactor*numBuckets); nullBuckets(); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Copy Constructor /// Create a hash set with the specified load factor and number of buckets. RIM_INLINE HashSet( const HashSet& other ) : loadFactor( other.loadFactor ), numElements( other.numElements ), numBuckets( other.numBuckets ), buckets( util::allocate<Entry*>(other.numBuckets) ) { // Copy the hash table buckets const Entry* const * otherBucket = other.buckets; const Entry* const * const otherBucketsEnd = otherBucket + numBuckets; Entry** bucket = buckets; while ( otherBucket != otherBucketsEnd ) { if ( *otherBucket ) *bucket = HashSet::newEntry(**otherBucket); else *bucket = NULL; otherBucket++; bucket++; } } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Assignment Operator /// Copy the contents of one hash set into another. RIM_INLINE HashSet& operator = ( const HashSet& other ) { if ( this != &other ) { deleteBuckets( buckets, numBuckets ); // Copy the parameters from the other hash set. numBuckets = other.numBuckets; loadFactor = other.loadFactor; numElements = other.numElements; buckets = util::allocate<Entry*>(numBuckets); { // Copy the hash table buckets const Entry* const * otherBucket = other.buckets; const Entry* const * const otherBucketsEnd = otherBucket + numBuckets; Entry** bucket = buckets; while ( otherBucket != otherBucketsEnd ) { if ( *otherBucket ) *bucket = HashSet::newEntry(**otherBucket); else *bucket = NULL; otherBucket++; bucket++; } } } return *this; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Destructor /// Destroy a hash set and it's contents, deallocating all memory used. RIM_INLINE ~HashSet() { deleteBuckets( buckets, numBuckets ); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Add Method /// Add a new element to the hash set if it does not already exist. /** * If the element did not previously exist in the set, return TRUE. * Otherwise return FALSE. */ RIM_INLINE Bool add( HashType hash, const T& value ) { // Compute the bucket for the new element. Entry** bucket = buckets + hash % numBuckets; if ( *bucket == NULL ) *bucket = HashSet::newEntry( hash, value ); else { Entry* entry = *bucket; if ( entry->value == value ) return false; while ( entry->next ) { entry = entry->next; if ( entry->value == value ) return false; } entry->next = HashSet::newEntry( hash, value ); } numElements++; return true; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Remove Methods /// Remove the specified value from the hash set if it exists. /** * If the value does not exist in the hash set, then FALSE is returned, * otherwise TRUE is returned. */ RIM_INLINE Bool remove( HashType hash, const T& value ) { // Compute the bucket for the new element. Entry** bucket = buckets + hash % numBuckets; Entry* entry = *bucket; if ( !entry ) return false; if ( entry->value == value ) { *bucket = entry->next; entry->next = NULL; delete entry; numElements--; return true; } Entry* lastEntry = *bucket; entry = entry->next; while ( entry ) { if ( entry->value == value ) { lastEntry->next = entry->next; entry->next = NULL; delete entry; numElements--; return true; } lastEntry = entry; entry = entry->next; } return false; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Clear Method /// Clear all elements from the hash set. RIM_INLINE void clear() { // Delete all entries Entry** bucket = buckets; const Entry* const * const bucketsEnd = bucket + numBuckets; while ( bucket != bucketsEnd ) { if ( *bucket ) { delete (*bucket); *bucket = NULL; } bucket++; } numElements = 0; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Contains Methods /// Query whether or not the specified value is contained in a hash set. RIM_INLINE Bool contains( HashType hash, const T& value ) const { // Compute the bucket for the query. Entry* entry = *(buckets + hash % numBuckets); // Look for the value in the bucket. while ( entry ) { if ( entry->value == value ) return true; entry = entry->next; } return false; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Size Accessor Methods /// Return the number of setpings in a hash set. RIM_INLINE Size getSize() const { return numElements; } /// Return whether or not a hash set is empty. RIM_INLINE Bool isEmpty() const { return numElements == Size(0); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Iterator Class /// A class which iterates over hash set elements. class Iterator { public: //******************************************** // Constructor /// Create a new hash set iterator for the specified hash set. RIM_INLINE Iterator( HashSet& newHashSet ) : hashSet( newHashSet ), currentBucket( newHashSet.buckets ), bucketsEnd( newHashSet.buckets + newHashSet.numBuckets ) { // advance until the first element advanceToNextFullBucket(); } //******************************************** // Destructor /// Destroy a hash set iterator. RIM_INLINE ~Iterator() { } //******************************************** // Public Methods /// Increment the location of a hash set iterator by one element. RIM_INLINE void operator ++ () { currentEntry = currentEntry->next; if ( currentEntry == NULL ) { currentBucket++; advanceToNextFullBucket(); } } /// Increment the location of a hash set iterator by one element. RIM_INLINE void operator ++ ( int ) { this->operator++(); } /// Test whether or not the current element is valid. /** * This will return FALSE when the last element of the hash set * has been iterated over. */ RIM_INLINE operator Bool () const { return currentEntry != NULL; } /// Return the value of the value-value pair pointed to by the iterator. RIM_INLINE T& operator * () const { return currentEntry->value; } /// Access the current iterator element value RIM_INLINE T* operator -> () const { return &currentEntry->value; } /// Get the value hash of the value-value pair pointed to by the iterator. RIM_INLINE HashType getHash() const { return currentEntry->hash; } /// Remove the current element from the hash table and advance to the next element. void remove() { // Backup in the bucket so that we can remove the current element. // This is potentially inefficient, it would be best if the buckets // would use a doublely linked list, but this might add extra overhead // elsewhere. // Handle removing from the start of a bucket separately. if ( currentEntry == *currentBucket ) { *currentBucket = currentEntry->next; if ( *currentBucket != NULL ) { currentEntry->next = NULL; delete currentEntry; currentEntry = *currentBucket; } else { delete currentEntry; currentBucket++; advanceToNextFullBucket(); } } else { // Otherwise, iterate through the bucket until we find the element // before this one. Entry* previousEntry = *currentBucket; while ( previousEntry && previousEntry->next != currentEntry ) previousEntry = previousEntry->next; previousEntry->next = currentEntry->next; Entry* temp = currentEntry; operator++(); temp->next = NULL; delete temp; } hashSet.numElements--; } /// Reset the iterator to the beginning of the hash set. RIM_INLINE void reset() { currentBucket = hashSet.buckets; // advance until the first element advanceToNextFullBucket(); } private: //******************************************** // Private Methods /// Advance the iterator to the next non-empty bucket. RIM_INLINE void advanceToNextFullBucket() { while ( *currentBucket == NULL && currentBucket != bucketsEnd ) currentBucket++; if ( currentBucket == bucketsEnd ) currentEntry = NULL; else currentEntry = *currentBucket; } //******************************************** // Private Data Members /// The HashSet that is being iterated over. HashSet& hashSet; /// The current bucket in the HashSet. Entry** currentBucket; /// The last bucket in the HashSet. const Entry* const * const bucketsEnd; /// The current entry in the hash set that the iterator is pointing to. Entry* currentEntry; /// Make the const iterator class a friend. friend class HashSet::ConstIterator; }; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** ConstIterator Class /// A class which iterates over hash set elements without the ability to modify them. class ConstIterator { public: //******************************************** // Constructor /// Create a new hash set iterator for the specified hash set. RIM_INLINE ConstIterator( const HashSet<T>& newHashSet ) : hashSet( newHashSet ), currentBucket( newHashSet.buckets ), bucketsEnd( newHashSet.buckets + newHashSet.numBuckets ) { // advance until the first element advanceToNextFullBucket(); } /// Create a new const hash set iterator from a non-const iterator. RIM_INLINE ConstIterator( const Iterator& iterator ) : hashSet( iterator.hashSet ), currentBucket( iterator.currentBucket ), bucketsEnd( iterator.bucketsEnd ), currentEntry( iterator.currentEntry ) { } //******************************************** // Destructor /// Destroy a hash set iterator. RIM_INLINE ~ConstIterator() { } //******************************************** // Public Methods /// Increment the location of a hash set iterator by one element. RIM_INLINE void operator ++ () { currentEntry = currentEntry->next; if ( currentEntry == NULL ) { currentBucket++; advanceToNextFullBucket(); } } /// Increment the location of a hash set iterator by one element. RIM_INLINE void operator ++ ( int ) { this->operator++(); } /// Test whether or not the current element is valid. /** * This will return FALSE when the last element of the hash set * has been iterated over. */ RIM_INLINE operator Bool () const { return currentEntry != NULL; } /// Return the value of the value-value pair pointed to by the iterator. RIM_INLINE const T& operator * () const { return currentEntry->value; } /// Access the current iterator element RIM_INLINE const T* operator -> () const { return &currentEntry->value; } /// Get the hash of the element pointed to by the iterator. RIM_INLINE HashType getHash() const { return currentEntry->valueHash; } /// Reset the iterator to the beginning of the hash set. RIM_INLINE void reset() { currentBucket = hashSet.buckets; // advance until the first element. advanceToNextFullBucket(); } private: //******************************************** // Private Methods /// Advance the iterator to the next non-empty bucket. RIM_INLINE void advanceToNextFullBucket() { while ( *currentBucket == NULL && currentBucket != bucketsEnd ) currentBucket++; if ( currentBucket == bucketsEnd ) currentEntry = NULL; else currentEntry = *currentBucket; } //******************************************** // Private Data Members /// The HashSet that is being iterated over. const HashSet<T>& hashSet; /// The current bucket in the HashSet. const Entry* const * currentBucket; /// The last bucket in the HashSet. const Entry* const * bucketsEnd; /// The current entry in the hash set that the iterator is pointing to. const Entry* currentEntry; }; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Iterator Method /// Get a const-iterator for the hash set. RIM_INLINE ConstIterator getIterator() const { return ConstIterator(*this); } /// Get an iterator for the hash set that can modify the hash set. RIM_INLINE Iterator getIterator() { return Iterator(*this); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Load Factor Accessor Methods RIM_INLINE void setLoadFactor( Float newLoadFactor ) { loadFactor = math::clamp( newLoadFactor, 0.1f, 5.0f ); loadThreshold = Size(loadFactor*numBuckets); // Check the load constraint, if necessary, increase the size of the table. if ( numElements > loadThreshold ) resize( math::nextPowerOf2Prime( numBuckets + 1 ) ); } RIM_INLINE Float getLoadFactor() const { return loadFactor; } private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Methods void resize( HashType newNumBuckets ) { Entry** oldBuckets = buckets; HashType oldNumBuckets = numBuckets; // initialize all buckets and resize the array numBuckets = newNumBuckets; loadThreshold = Size(loadFactor*numBuckets); buckets = util::allocate<Entry*>(numBuckets); nullBuckets(); // add old elements to the hash set. Entry** oldBucket = oldBuckets; const Entry* const * const oldBucketsEnd = oldBucket + oldNumBuckets; while ( oldBucket != oldBucketsEnd ) { Entry* oldEntry = *oldBucket; while ( oldEntry ) { Entry** bucket = buckets + oldEntry->hash % numBuckets; // Add the new element. if ( *bucket == NULL ) *bucket = HashSet::newEntry( oldEntry->hash, oldEntry->value ); else { Entry* entry = *bucket; while ( entry->next ) entry = entry->next; entry->next = HashSet::newEntry( oldEntry->hash, oldEntry->value ); } oldEntry = oldEntry->next; } oldBucket++; } // deallocate all memory currently used by the old buckets deleteBuckets( oldBuckets, oldNumBuckets ); } RIM_INLINE void nullBuckets() { Entry** bucket = buckets; const Entry* const * const bucketsEnd = bucket + numBuckets; while ( bucket != bucketsEnd ) { *bucket = NULL; bucket++; } } RIM_INLINE static void deleteBuckets( Entry** buckets, HashType numBuckets ) { // Delete all entries Entry** entry = buckets; const Entry* const * const entryEnd = entry + numBuckets; while ( entry != entryEnd ) { if ( *entry ) delete (*entry); entry++; } // Delete the bucket array. util::deallocate( buckets ); } RIM_INLINE static Entry* newEntry( const Entry& other ) { Entry* result = util::allocate<Entry>(); new (result) Entry( other ); return result; } RIM_INLINE static Entry* newEntry( HashType hash, const T& value ) { Entry* result = util::allocate<Entry>(); new (result) Entry( hash, value ); return result; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Members Entry** buckets; HashType numBuckets; Size numElements; Float loadFactor; Size loadThreshold; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Static Data Members static const HashType DEFAULT_NUMBER_OF_BUCKETS = 19; static const Float DEFAULT_LOAD_FACTOR; }; template < typename T, typename HashType > const Float HashSet<T,HashType>:: DEFAULT_LOAD_FACTOR = 0.5f; //########################################################################################## //*************************** End Rim Utilities Namespace ******************************** RIM_UTILITIES_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_HASH_SET_H <file_sep>/* * rimGUIElement.h * Rim GUI * * Created by <NAME> on 5/25/08. * Copyright 2008 __MyCompanyName__. All rights reserved. * */ #ifndef INCLUDE_RIM_GUI_ELEMENT_H #define INCLUDE_RIM_GUI_ELEMENT_H #include "rimGUIConfig.h" //########################################################################################## //*************************** Start Rim GUI Namespace ****************************** RIM_GUI_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class which serves as the superclass for all OS-specific GUI elements. /** * It defines a basic interface that all of these classes should adhere to. It * allows other GUI elements to access platform-specific data through a generic * pointer interface. */ class GUIElement { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Destructor /// Destroy a GUI element and release all resources associated with it. virtual ~GUIElement(); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Platform-Specific Element Pointer Accessor Method /// Return a pointer to the OS-specific object which represents this element. /** * If there is no such object, NULL may be returned. */ virtual void* getInternalPointer() const = 0; protected: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Protected Event Thread Accessor Method #if defined(RIM_PLATFORM_WINDOWS) /// Return an integer which inidicates the ID of the thread which is handling this GUI element's events. UInt getEventThreadID() const; #endif }; //########################################################################################## //*************************** End Rim GUI Namespace ******************************** RIM_GUI_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_GUI_ELEMENT_H <file_sep>/* * rimGraphicsGUIDirection.h * Rim Graphics GUI * * Created by <NAME> on 3/31/13. * Copyright 2013 __MyCompanyName__. All rights reserved. * */ #ifndef INCLUDE_RIM_GRAPHICS_GUI_DIRECTION_H #define INCLUDE_RIM_GRAPHICS_GUI_DIRECTION_H #include "rimGraphicsGUIUtilitiesConfig.h" //########################################################################################## //******************* Start Rim Graphics GUI Utilities Namespace ************************* RIM_GRAPHICS_GUI_UTILITIES_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class which represents a 2D cardinal direction. /** * This class can be used to specify the direction in which a GUI element * is pointing, or the direction in which text is renderered, for example. */ class Direction { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Public Enum Declaration /// An enum which specifies the different kinds of directions. typedef enum Enum { /// The negative X axis direction. LEFT, /// The positive X axis direction. RIGHT, /// The positive Y axis direction. UP, /// The negative Y axis direction. DOWN }; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructors /// Create a new direction using the specified direction type enum value. RIM_INLINE Direction( Enum newType ) : type( newType ) { } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Enum Cast Operator /// Convert this direction type to an enum value. RIM_INLINE operator Enum () const { return type; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Vector Accessor Method /// Return a 2D unit vector indicating the vector for this direction. RIM_INLINE Vector2f getVector() const { switch ( type ) { case LEFT: return Vector2f(-1,0); case RIGHT: return Vector2f(1,0); case UP: return Vector2f(0,1); case DOWN: return Vector2f(0,-1); default: return Vector2f(0,0); } } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** String Representation Accessor Methods /// Return a string representation of the orientation type. String toString() const; /// Convert this orientation type into a string representation. RIM_INLINE operator String () const { return this->toString(); } private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Members /// An enum value indicating the type of orientation this object represents. Enum type; }; //########################################################################################## //******************* End Rim Graphics GUI Utilities Namespace *************************** RIM_GRAPHICS_GUI_UTILITIES_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_GRAPHICS_GUI_DIRECTION_H <file_sep>/* * rimGraphicsGUIMenuDelegate.h * Rim Graphics GUI * * Created by <NAME> on 2/18/13. * Copyright 2013 Headspace Systems. All rights reserved. * */ #ifndef INCLUDE_RIM_GRAPHICS_GUI_MENU_DELEGATE_H #define INCLUDE_RIM_GRAPHICS_GUI_MENU_DELEGATE_H #include "rimGraphicsGUIConfig.h" //########################################################################################## //************************ Start Rim Graphics GUI Namespace ****************************** RIM_GRAPHICS_GUI_NAMESPACE_START //****************************************************************************************** //########################################################################################## class Menu; //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class which contains function objects that recieve menu events. /** * Any menu-related event that might be processed has an appropriate callback * function object. Each callback function is called by the menu * whenever such an event is received. If a callback function in the delegate * is not initialized, a menu simply ignores it. */ class MenuDelegate { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Menu Delegate Callback Functions /// A function object which is called whenever an attached menu is opened by the user. Function<void ( Menu& menu )> open; /// A function object which is called whenever an attached menu is closed by the user. Function<void ( Menu& menu )> close; /// A function object which is called whenever an item with the given index is selected by the user. Function<void ( Menu& menu, Index itemIndex )> selectItem; }; //########################################################################################## //************************ End Rim Graphics GUI Namespace ******************************** RIM_GRAPHICS_GUI_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_GRAPHICS_GUI_MENU_DELEGATE_H <file_sep>/* * rimSoundToneGenerator.h * Rim Sound * * Created by <NAME> on 7/30/12. * Copyright 2012 __MyCompanyName__. All rights reserved. * */ #ifndef INCLUDE_RIM_SOUND_TONE_GENERATOR_H #define INCLUDE_RIM_SOUND_TONE_GENERATOR_H #include "rimSoundFiltersConfig.h" #include "rimSoundFilter.h" #include "rimSoundBandFilter.h" //########################################################################################## //************************ Start Rim Sound Filters Namespace ***************************** RIM_SOUND_FILTERS_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class that generates a small set of different types of test tones. /** * These tones are common signals used in testing audio equipment such * as white noise, pink noise, sine waves, and other types of repeating waves. * These tones can also be used as an oscilation source for a synthesizer or * other virtual instrument. * * All of the tones that are generated by a ToneGenerator are peak-normalized * to just under 0dBFS when the output gain of the generator is 0dB. */ class ToneGenerator : public SoundFilter { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Tone Type Enum /// An enum type which describes the various types of tones that a ToneGenerator can produce. typedef enum ToneType { /// A pure sinusoidal tone at the generator's frequency and output gain. SINE = 0, /// A square-wave tone at the generator's frequency and output gain. SQUARE = 1, /// A saw-wave tone at the generator's frequency and output gain. SAW = 2, /// A triangle-wave tone at the generator's frequency and output gain. TRIANGLE = 3, /// Noise with equal power at all frequencies at the given output gain. WHITE_NOISE = 4, /// Noise where the power at a given frequency is inversely proportional to that frequency. PINK_NOISE = 5, /// Pink noise that has been band-pass filtered so that it covers a small frequency range. /** * The tone generator uses an 8th order band-pass filter to filter a pink noise signal * to a small bandwidth. This setting is useful when checking the response of a * system over a narrow frequency band, rather than the full spectrum (pink noise), * or a single frequency (sine wave). */ PINK_NOISE_BAND = 6 }; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructors /// Create a tone generator which generates a sine wave at 1000 Hz. ToneGenerator(); /// Create a tone generator with the specified tone type at 1000 Hz. /** * This constructor can be used to create tone generators for tone types * that don't specify a frequency (white noise, pink noise). */ ToneGenerator( ToneType newType ); /// Create a tone generator with the specified tone type and output gain with frequency at 1000Hz. /** * This constructor can be used to create tone generators for tone types * that don't specify a frequency (white noise, pink noise). */ ToneGenerator( ToneType newType, Gain newOutputGain ); /// Create a tone generator with the specified tone type, output gain, and frequency. ToneGenerator( ToneType newType, Gain newOutputGain, Float newFrequency ); /// Create a copy of the specified tone generator. ToneGenerator( const ToneGenerator& other ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Destructor /// Destory this tone generator and release all of its resources. ~ToneGenerator(); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Assignment Operator /// Assign the state of one tone generator to this one. ToneGenerator& operator = ( const ToneGenerator& other ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Tone Type Accessor Methods /// Return the type of tone that this tone generator is generating. /** * The tone type can be one of several types of audio test tones * (sine waves, square waves, saw waves, triangle waves, white noise, * pink noise, etc.). */ RIM_INLINE ToneType getType() const { return type; } /// Set the type of tone that this tone generator is generating. /** * The tone type can be one of several types of audio test tones * (sine waves, square waves, saw waves, triangle waves, white noise, * pink noise, etc.). */ RIM_INLINE void setType( ToneType newType ) { lockMutex(); type = newType; unlockMutex(); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Tone Frequency Accessor Methods /// Return the frequency of this tone generator in hertz. /** * For frequency-local tones (i.e. not full-spectrum noise), this value * indicates the dominant frequency of the generated tone. For most wave types * (sine, square, saw, triangle) this is the frequency of the generated wave. * * This value has no effect for other noise types that contain information across * the entire frequency spectrum (pink noise, white noise, etc.). */ RIM_INLINE Float getFrequency() const { return targetFrequency; } /// Set the frequency of this tone generator in hertz. /** * For frequency-local tones (i.e. not full-spectrum noise), this value * indicates the dominant frequency of the generated tone. For most wave types * (sine, square, saw, triangle) this is the frequency of the generated wave. * * This value has no effect for other noise types that contain information across * the entire frequency spectrum (pink noise, white noise, etc.). */ RIM_INLINE void setFrequency( Float newFrequency ) { lockMutex(); targetFrequency = math::max( newFrequency, Float(0) ); unlockMutex(); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Frequency Bandwidth Accessor Methods /// Return the frequency bandwidth of this tone generator in octaves. /** * This value is used to determine the width of the tone generator's noise * band pass filter. The default value is 0.33333, or 1/3 of an octave. */ RIM_INLINE Float getBandwidth() const { return bandwidth; } /// Return the frequency bandwidth of this tone generator in octaves. /** * This value is used to determine the width of the tone generator's noise * band pass filter. The default value is 0.33333, or 1/3 of an octave. * * The new bandwidth is clamped to the range [0,10]. */ RIM_INLINE void setBandwidth( Float newBandwidth ) { lockMutex(); bandwidth = math::clamp( newBandwidth, Float(0), Float(10) ); unlockMutex(); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Tone Output Gain Accessor Methods /// Return the linear output gain of this tone generator. /** * This is gain scaling factor which is applied to the output of whatever * tone is being currently generated. The different tones are normalized * to 0 dBFS, or as close as is possible. This factor adjusts their output * level relative to that baseline. The default value is 0.5. */ RIM_INLINE Gain getOutputGain() const { return targetOutputGain; } /// Return the output gain of this tone generator in decibels. /** * This is gain scaling factor which is applied to the output of whatever * tone is being currently generated. The different tones are normalized * to 0 dBFS, or as close as is possible. This factor adjusts their output * level relative to that baseline. The default value is -6dB. */ RIM_INLINE Gain getOutputGainDB() const { return util::linearToDB( targetOutputGain ); } /// Set the linear output gain of this tone generator. /** * This is gain scaling factor which is applied to the output of whatever * tone is being currently generated. The different tones are normalized * to 0 dBFS, or as close as is possible. This factor adjusts their output * level relative to that baseline. The default value is 0.5. */ RIM_INLINE void setOutputGain( Gain newOutputGain ) { lockMutex(); targetOutputGain = newOutputGain; unlockMutex(); } /// Set the output gain of this tone generator in decibels. /** * This is gain scaling factor which is applied to the output of whatever * tone is being currently generated. The different tones are normalized * to 0 dBFS, or as close as is possible. This factor adjusts their output * level relative to that baseline. The default value is -6dB. */ RIM_INLINE void setOutputGainDB( Gain newDBOutputGain ) { lockMutex(); targetOutputGain = util::dbToLinear( newDBOutputGain ); unlockMutex(); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Filter Attribute Accessor Methods /// Return a human-readable name for this tone generator. /** * The method returns the string "Tone Generator". */ virtual UTF8String getName() const; /// Return the manufacturer name of this tone generator. /** * The method returns the string "Headspace Sound". */ virtual UTF8String getManufacturer() const; /// Return an object representing the version of this tone generator. virtual SoundFilterVersion getVersion() const; /// Return an object which describes the category of effect that this filter implements. /** * This method returns the value SoundFilterCategory::ANALYSIS. */ virtual SoundFilterCategory getCategory() const; /// Return whether or not this tone generator can process audio data in-place. /** * This method always returns TRUE, tone generators can process audio data in-place. */ virtual Bool allowsInPlaceProcessing() const; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Filter Parameter Accessor Methods /// Return the total number of generic accessible parameters this filter has. virtual Size getParameterCount() const; /// Get information about the filter parameter at the specified index. virtual Bool getParameterInfo( Index parameterIndex, FilterParameterInfo& info ) const; /// Get any special name associated with the specified value of an indexed parameter. virtual Bool getParameterValueName( Index parameterIndex, const FilterParameter& value, UTF8String& name ) const; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Public Static Property Objects /// A string indicating the human-readable name of this tone generator. static const UTF8String NAME; /// A string indicating the manufacturer name of this tone generator. static const UTF8String MANUFACTURER; /// An object indicating the version of this tone generator. static const SoundFilterVersion VERSION; private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Filter Parameter Value Accessor Methods /// Place the value of the parameter at the specified index in the output parameter. virtual Bool getParameterValue( Index parameterIndex, FilterParameter& value ) const; /// Attempt to set the parameter value at the specified index. virtual Bool setParameterValue( Index parameterIndex, const FilterParameter& value ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Stream Reset Method /// A method which is called whenever the filter's stream of audio is being reset. /** * This method allows the filter to reset all parameter interpolation * and processing to its initial state to avoid coloration from previous * audio or parameter values. */ virtual void resetStream(); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Filter Processing Methods /// Fill the output frame with the specified number of samples of the tone which is being generated. virtual SoundFilterResult processFrame( const SoundFilterFrame& inputFrame, SoundFilterFrame& outputFrame, Size numSamples ); /// Generate the specified number of samples of a wave and place them in the output buffer. /** * The wave is computed by evaluating the given wave function using a current phase, * given in radians. The wave function should have a period of 2 pi radians and should * be valid over at least the range [0,+infinity]. */ template < Sample32f (*waveFunction)( Float ) > void generateWave( SoundBuffer& outputBuffer, Size numSamples, Float frequencyChangePerSample, Gain outputGainChangePerSample ); /// Generate the specified number of samples of white noise and place them in the output buffer. void generateWhiteNoise( SoundBuffer& outputBuffer, Size numSamples, Gain outputGainChangePerSample ); /// Generate the specified number of samples of pink noise and place them in the output buffer. void generatePinkNoise( SoundBuffer& outputBuffer, Size numSamples, Gain outputGainChangePerSample ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Wave Generation Methods /// Compute the value of a sine wave, given the specified phase value in radians. RIM_FORCE_INLINE static Sample32f sine( Float phase ) { return math::sin( phase ); } /// Compute the value of a square wave, given the specified phase value in radians. RIM_FORCE_INLINE static Sample32f square( Float phase ) { return math::mod( phase, Float(2)*math::pi<Float>() ) <= math::pi<Float>() ? Sample32f(1) : Sample32f(-1); } /// Compute the value of a saw wave, given the specified phase value in radians. RIM_FORCE_INLINE static Sample32f saw( Float phase ) { Float phaseOverTwoPi = phase / (Float(2)*math::pi<Float>()); return Float(2)*(phaseOverTwoPi - math::floor(phaseOverTwoPi + Float(0.5))); } /// Compute the value of a triangle wave, given the specified phase value in radians. RIM_FORCE_INLINE static Sample32f triangle( Float phase ) { Float phaseOverTwoPi = phase / (Float(2)*math::pi<Float>()) + Float(0.25); Float saw = (phaseOverTwoPi - math::floor(phaseOverTwoPi + Float(0.5))); return Float(4)*math::abs(saw) - Float(1); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Members /// An enum value indicating the type of tone to generate with this tone generator. ToneType type; /// The gain that is applied to the output of the tone generator. /** * This is gain scaling factor which is applied to the output of whatever * tone is being currently generated. The different tones are normalized * to 0 dBFS, or as close as is possible. This factor adjusts their output * level relative to that baseline. */ Gain outputGain; /// The target output gain for this tone generator. /** * This value allows the tone generator to do smooth transitions between * different output gains. */ Gain targetOutputGain; /// The frequency of the generated tone in hertz. /** * For frequency-local tones (i.e. not full-spectrum noise), this value * indicates the dominant frequency of the generated tone. For most wave types * (sine, square, saw, triangle) this is the frequency of the generated wave. * * This value has no effect for other noise types that contain information across * the entire frequency spectrum (pink noise, white noise, etc.). */ Float frequency; /// The target frequency of the generated tone in hertz. /** * This value allows the tone generator to do smooth transitions between * different frequencies. */ Float targetFrequency; /// The current phase of the generated wave (in radians). Float phase; /// An array of values indicating the sample histories for the 7 1st order pink noise approximation filters. StaticArray<Float,7> pinkNoiseHistory; /// The bandwidth of this tone generator's noise band in octaves. Float bandwidth; /// A band pass filter used to filter noise signals. BandFilter* bandFilter; }; //########################################################################################## //************************ End Rim Sound Filters Namespace ******************************* RIM_SOUND_FILTERS_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_SOUND_TONE_GENERATOR_H <file_sep>/* * rimXMLDOMParser.h * Rim XML * * Created by <NAME> on 9/18/13. * Copyright 2013 __MyCompanyName__. All rights reserved. * */ #ifndef INCLUDE_RIM_XML_DOM_PARSER_H #define INCLUDE_RIM_XML_DOM_PARSER_H #include "rimXMLConfig.h" #include "rimXMLDocument.h" //########################################################################################## //****************************** Start Rim XML Namespace ********************************* RIM_XML_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class which loads an entire XML document into memory and returns a tree of XML nodes. /** * This XML parser is suitable for small-scale XML file parsing or where access * to the entire document is necessary by the end user. However, the document * returned by this parser may require large amounts of memory if the XML * file is large, since each element in the file must have an associated * XMLNode object. If an XML file may be large (i.e. > 100MB), consider * using the XMLSAXParser which is more memory efficient. */ class XMLDOMParser { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructors //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Document Input Methods /// Parse an XML file located at the specified path location in the local file system. /** * If the parsing succeeds, the method returns a pointer to an object * representing the XML document. Otherwise, if the parsing fails, a NULL * pointer is returned. */ Pointer<XMLDocument> readFile( const UTF8String& pathToFile ) const; /// Parse a memory-resident XML document string. /** * If the parsing succeeds, the method returns a pointer to an object * representing the XML document. Otherwise, if the parsing fails, a NULL * pointer is returned. */ Pointer<XMLDocument> readString( const UTF8String& documentString ) const; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Document Output Methods /// Write the specified XML document to a file at the specified path in the local file system. /** * The method returns whether or not the operation was successful. */ Bool writeFile( const Pointer<XMLDocument>& document, const UTF8String& pathToFile ) const; /// Convert the specified XML document to a string, returned in the output parameter. /** * The method returns whether or not the operation was successful. */ Bool writeString( const Pointer<XMLDocument>& document, UTF8String& string ) const; private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** XML Input Helper Methods Pointer<XMLDocument> parseUTF8Document( const UTF8String& documentString ) const; Bool parseElement( UTF8StringIterator& iterator, Pointer<XMLNode>& node ) const; Bool parseAttribute( UTF8StringIterator& iterator, UTF8String& name, UTF8String& value ) const; Bool parseIdentifier( UTF8StringIterator& iterator, UTF8String& identifier ) const; static Bool skipWhitespace( UTF8StringIterator& iterator ); /// Return whether or not the specified character is a whitespace character. RIM_INLINE static Bool isWhitespace( UTF32Char c ) { return c == ' ' || c == '\t' || c == '\n' || c == '\r'; } /// Return whether or not the specified character is a whitespace character. RIM_INLINE static Bool isWordCharacter( UTF32Char c ) { return UTF32String::isALetter(c) || UTF32String::isADigit(c) || c == '_'; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** XML Output Helper Methods Bool writeDocument( const Pointer<XMLDocument>& document ) const; Bool writeNode( const Pointer<XMLNode>& node ) const; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Members /// A string buffer used to accumulate a series of input characters. mutable UTF32StringBuffer buffer; /// A string buffer used to accumulate a series of output characters. mutable UTF8StringBuffer outputBuffer; }; //########################################################################################## //****************************** End Rim XML Namespace *********************************** RIM_XML_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_XML_DOM_PARSER_H <file_sep>/* * rimPhysicsTriangle.h * Rim Physics * * Created by <NAME> on 7/9/12. * Copyright 2012 __MyCompanyName__. All rights reserved. * */ #ifndef INCLUDE_RIM_PHYSICS_TRIANGLE_H #define INCLUDE_RIM_PHYSICS_TRIANGLE_H #include "rimPhysicsUtilitiesConfig.h" //########################################################################################## //********************** Start Rim Physics Utilities Namespace *************************** RIM_PHYSICS_UTILITIES_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class which represents an indexed triangle used for physics simulation. /** * This triangle class is used as the input format for the engine's mesh * algorithms which then preprocess the triangle data into a format more suitable * for physics simulation or collision detection. */ class PhysicsTriangle { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructors /// Create a physics triangle with the specified vertex indices and default material index (0). RIM_INLINE PhysicsTriangle( Index v1, Index v2, Index v3 ) : materialIndex( 0 ) { v[0] = v1; v[1] = v2; v[2] = v3; } /// Create a physics triangle with the specified vertex indices and material index. RIM_INLINE PhysicsTriangle( Index v1, Index v2, Index v3, Index newMaterialIndex ) : materialIndex( newMaterialIndex ) { v[0] = v1; v[1] = v2; v[2] = v3; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Equality Comparison Operators /// Return whether or not the vertex and material indices of this triangle are equal to another's. /** * Order of the indicies is not important: any two triangles with the same vertex * and material indices, regardless of their order, are equal. */ RIM_INLINE Bool operator == ( const PhysicsTriangle& other ) const { if ( materialIndex != other.materialIndex ) return false; if ( v[0] == other.v[0] ) return (v[1] == other.v[1] && v[2] == other.v[2]) || (v[1] == other.v[2] && v[2] == other.v[1]); else if ( v[0] == other.v[1] ) return (v[1] == other.v[0] && v[2] == other.v[2]) || (v[1] == other.v[2] && v[2] == other.v[0]); else if ( v[0] == other.v[2] ) return (v[1] == other.v[0] && v[2] == other.v[1]) || (v[1] == other.v[1] && v[2] == other.v[0]); return false; } /// Return whether or not the vertex and material indices of this triangle are not equal to another's. /** * Order of the indicies is not important: any two triangles without the same vertex * and material indices, regardless of their order, are not equal. */ RIM_INLINE Bool operator != ( const PhysicsTriangle& other ) const { return !(*this == other); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Public Data Members /// The indices of the three vertices that make up this triangle. Index v[3]; /// The index of the material to use for this triangle. Index materialIndex; }; //########################################################################################## //********************** End Rim Physics Utilities Namespace ***************************** RIM_PHYSICS_UTILITES_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_PHYSICS_TRIANGLE_H <file_sep>/* * rimSoundFilterFrame.h * Rim Sound * * Created by <NAME> on 8/15/12. * Copyright 2012 __MyCompanyName__. All rights reserved. * */ #ifndef INCLUDE_RIM_SOUND_FILTER_FRAME_H #define INCLUDE_RIM_SOUND_FILTER_FRAME_H #include "rimSoundFiltersConfig.h" //########################################################################################## //************************ Start Rim Sound Filters Namespace ***************************** RIM_SOUND_FILTERS_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class which provides all of the information needed for a SoundFilter to process sound data. /** * Primarily, a filter frame holds an internal array of pointers to SoundBuffer objects * which represent the buffers for each filter input or output. These buffers are allowed * to be NULL, indicating that either the input at that index was not provided or * the output at that index is not needed. * * A filter frame uses a fixed-size internal array of pointers to SoundBuffer objects * but can also allocate a variable-sized array of buffer pointers if the capacity of * the fixed size array is exceeded. This is done for performance, so that an allocation * is not performed in most cases when using multiple buffers. * * A similar buffer scheme is used for MIDI data. All MIDI events that are part of a * frame are specified with their timestamp relative to the main frame absolute timestamp, * rather than as absolute timestamps. * * Each filter frame has an associated absolute timestamp, measured relative to the * Epoch, 1970-01-01 00:00:00 +0000 (UTC). This allows the filter to detect breaks * in the sound timeline and react accordingly, or to synchronize sound processing, * such as with video. */ class SoundFilterFrame { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructors /// Create a new sound filter frame which has no buffers and the default capacity. RIM_INLINE SoundFilterFrame() : buffers( bufferArray ), numBuffers( 0 ), bufferCapacity( FIXED_BUFFER_ARRAY_SIZE ), midiBuffers( midiBufferArray ), numMIDIBuffers( 0 ), midiBufferCapacity( FIXED_MIDI_BUFFER_ARRAY_SIZE ), time() { } /// Create a new sound filter frame which has the specified number of buffers (initially all NULL). RIM_INLINE SoundFilterFrame( Size newNumBuffers ) : numBuffers( (UInt16)newNumBuffers ), bufferCapacity( (UInt16)math::max( newNumBuffers, FIXED_BUFFER_ARRAY_SIZE ) ), midiBuffers( midiBufferArray ), numMIDIBuffers( 0 ), midiBufferCapacity( FIXED_MIDI_BUFFER_ARRAY_SIZE ), time() { if ( bufferCapacity > FIXED_BUFFER_ARRAY_SIZE ) buffers = rim::util::allocate<SoundBuffer*>( bufferCapacity ); else buffers = bufferArray; this->setBuffersToNull(); } /// Create a new sound filter frame which wraps a single SoundBuffer object pointer. RIM_INLINE SoundFilterFrame( SoundBuffer* newBuffer ) : buffers( bufferArray ), numBuffers( 1 ), bufferCapacity( FIXED_BUFFER_ARRAY_SIZE ), midiBuffers( midiBufferArray ), numMIDIBuffers( 0 ), midiBufferCapacity( FIXED_MIDI_BUFFER_ARRAY_SIZE ), time() { buffers[0] = newBuffer; } /// Create a new sound filter frame which wraps two SoundBuffer object pointers. RIM_INLINE SoundFilterFrame( SoundBuffer* newBuffer1, SoundBuffer* newBuffer2 ) : buffers( bufferArray ), numBuffers( 2 ), bufferCapacity( FIXED_BUFFER_ARRAY_SIZE ), midiBuffers( midiBufferArray ), numMIDIBuffers( 0 ), midiBufferCapacity( FIXED_MIDI_BUFFER_ARRAY_SIZE ), time() { buffers[0] = newBuffer1; buffers[1] = newBuffer2; } /// Create an exact copy of the specified filter frame, copying all of its buffer pointers. SoundFilterFrame( const SoundFilterFrame& other ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Destructor /// Destroy a sound filter frame and release all of its resources. RIM_INLINE ~SoundFilterFrame() { // Deallocate the buffer array if necessary. if ( buffers != bufferArray ) rim::util::deallocate( buffers ); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Assignment Operator /// Assign the contents of the specified filter frame, including its buffer pointers. SoundFilterFrame& operator = ( const SoundFilterFrame& other ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Buffer Accessor Methods /// Get the number of buffers that this filter frame contains. RIM_INLINE Size getBufferCount() const { return numBuffers; } /// Change the size of the internal buffer array, padding any new buffer pointers with NULL. /** * If the number of buffers is increasing, the new buffer pointers for the * filter frame are set to NULL. Otherwise, if the number is decreasing, the extra * buffer pointers are discarded. */ RIM_INLINE void setBufferCount( Size newNumBuffers ) { // Resize the buffer array if necessary. if ( newNumBuffers > bufferCapacity ) this->reallocateBuffers( newNumBuffers ); // Set all extra buffer pointers to NULL. for ( Index i = numBuffers; i < newNumBuffers; i++ ) buffers[i] = NULL; numBuffers = (UInt16)newNumBuffers; } /// Get the SoundBuffer within this filter frame at the specified index. /** * If the specified buffer index is greater than or equal to the number * of buffers in this filter frame, NULL is returned. * * @param bufferIndex - the index of the buffer in this frame to access. * @return a reference to the SoundBuffer at the specified index. */ RIM_INLINE SoundBuffer* getBuffer( Index bufferIndex ) { if ( bufferIndex < numBuffers ) return buffers[bufferIndex]; else return NULL; } /// Get the SoundBuffer within this filter frame at the specified index. /** * If the specified buffer index is greater than or equal to the number * of buffers in this filter frame, NULL is returned. * * @param bufferIndex - the index of the buffer in this frame to access. * @return a reference to the SoundBuffer at the specified index. */ RIM_INLINE const SoundBuffer* getBuffer( Index bufferIndex ) const { if ( bufferIndex < numBuffers ) return buffers[bufferIndex]; else return NULL; } /// Replace the SoundBuffer pointer at the specified index with a new pointer. /** * If the specified buffer index is invalid, the method has no effect. */ RIM_INLINE void setBuffer( Index bufferIndex, SoundBuffer* newBuffer ) { if ( bufferIndex < numBuffers ) buffers[bufferIndex] = newBuffer; } /// Add the specified buffer pointer to the end of this frame's list of buffers. RIM_INLINE void addBuffer( SoundBuffer* newBuffer ) { if ( numBuffers == bufferCapacity ) this->reallocateBuffers( bufferCapacity*2 ); buffers[numBuffers] = newBuffer; numBuffers++; } /// Insert the specified buffer pointer at the specified index in this frame's list of buffers. RIM_INLINE void insertBuffer( Index newBufferIndex, SoundBuffer* newBuffer ) { if ( numBuffers == bufferCapacity ) this->reallocateBuffers( bufferCapacity*2 ); for ( Index i = numBuffers; i > newBufferIndex; i-- ) buffers[i] = buffers[i - 1]; buffers[newBufferIndex] = newBuffer; numBuffers++; } /// Remove the buffer from this filter frame at the specified index. /** * This method shifts all buffer pointers after the specified index * back by one index to replace the removed buffer. If the specified * buffer index is invalid, the method has no effect. */ RIM_INLINE void removeBuffer( Index bufferIndex ) { if ( bufferIndex >= numBuffers ) return; numBuffers--; for ( Index i = bufferIndex; i < numBuffers; i++ ) buffers[i] = buffers[i + 1]; } /// Remove all buffers from this filter frame. RIM_INLINE void clearBuffers() { numBuffers = 0; } /// Keep the current number of valid buffers the same, but set all buffer pointers to NULL. RIM_INLINE void setBuffersToNull() { for ( Index i = 0; i < numBuffers; i++ ) buffers[i] = NULL; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** MIDI Buffer Accessor Methods /// Get the number of MIDI buffers that this filter frame contains. RIM_INLINE Size getMIDIBufferCount() const { return numMIDIBuffers; } /// Change the size of the internal MIDI buffer array, padding any new buffer pointers with NULL. /** * If the number of MIDI buffers is increasing, the new buffer pointers for the * filter frame are set to NULL. Otherwise, if the number is decreasing, the extra * buffer pointers are discarded. */ RIM_INLINE void setMIDIBufferCount( Size newNumBuffers ) { // Resize the buffer array if necessary. if ( newNumBuffers > midiBufferCapacity ) this->reallocateMIDIBuffers( newNumBuffers ); // Set all extra buffer pointers to NULL. for ( Index i = numMIDIBuffers; i < newNumBuffers; i++ ) midiBuffers[i] = NULL; numMIDIBuffers = (UInt16)newNumBuffers; } /// Get the MIDI buffer within this filter frame at the specified index. /** * If the specified buffer index is greater than or equal to the number * of MIDI buffers in this filter frame, NULL is returned. * * @param bufferIndex - the index of the MIDI buffer in this frame to access. * @return a pointer to the MIDIBuffer at the specified index. */ RIM_INLINE MIDIBuffer* getMIDIBuffer( Index bufferIndex ) { if ( bufferIndex < numMIDIBuffers ) return midiBuffers[bufferIndex]; else return NULL; } /// Get the MIDI buffer within this filter frame at the specified index. /** * If the specified buffer index is greater than or equal to the number * of MIDI buffers in this filter frame, NULL is returned. * * @param bufferIndex - the index of the MIDI buffer in this frame to access. * @return a pointer to the MIDIBuffer at the specified index. */ RIM_INLINE const MIDIBuffer* getMIDIBuffer( Index bufferIndex ) const { if ( bufferIndex < numMIDIBuffers ) return midiBuffers[bufferIndex]; else return NULL; } /// Replace the MIDI buffer pointer at the specified index with a new pointer. /** * If the specified buffer index is invalid, the method has no effect. */ RIM_INLINE void setMIDIBuffer( Index bufferIndex, MIDIBuffer* newBuffer ) { if ( bufferIndex < numMIDIBuffers ) midiBuffers[bufferIndex] = newBuffer; } /// Add the specified MIDI buffer pointer to the end of this frame's list of MIDI buffers. RIM_INLINE void addMIDIBuffer( MIDIBuffer* newBuffer ) { if ( numMIDIBuffers == midiBufferCapacity ) this->reallocateMIDIBuffers( midiBufferCapacity*2 ); midiBuffers[numMIDIBuffers] = newBuffer; numMIDIBuffers++; } /// Insert the specified MIDI buffer pointer at the specified index in this frame's list of MIDI buffers. RIM_INLINE void insertMIDIBuffer( Index newBufferIndex, MIDIBuffer* newBuffer ) { if ( numMIDIBuffers == midiBufferCapacity ) this->reallocateMIDIBuffers( midiBufferCapacity*2 ); for ( Index i = numMIDIBuffers; i > newBufferIndex; i-- ) midiBuffers[i] = midiBuffers[i - 1]; midiBuffers[newBufferIndex] = newBuffer; numMIDIBuffers++; } /// Remove the MIDI buffer from this filter frame at the specified index. /** * This method shifts all MIDI buffer pointers after the specified index * back by one index to replace the removed buffer. If the specified * buffer index is invalid, the method has no effect. */ RIM_INLINE void removeMIDIBuffer( Index bufferIndex ) { if ( bufferIndex >= numMIDIBuffers ) return; numMIDIBuffers--; for ( Index i = bufferIndex; i < numMIDIBuffers; i++ ) midiBuffers[i] = midiBuffers[i + 1]; } /// Remove all MIDI buffers from this filter frame. RIM_INLINE void clearMIDIBuffers() { numMIDIBuffers = 0; } /// Keep the current number of valid MIDI buffers the same, but set all buffer pointers to NULL. RIM_INLINE void setMIDIBuffersToNull() { for ( Index i = 0; i < numMIDIBuffers; i++ ) midiBuffers[i] = NULL; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** MIDI Copy Method /// Copy this sound filter frame's MIDI data to another frame, replacing its MIDI data. /** * This method is provided as a convenient way to pass through MIDI from an input * frame to an output frame if the filter doesn't need to modify the MIDI data. * * The method iterates over the MIDI buffers in this frame and copies their contents * to the corresponding MIDI buffer of the other frame if it exists, replacing * the previous contents of the other buffer. */ void copyMIDITo( SoundFilterFrame& other ) const; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Frame Time Accessor Methods /// Return the absolute time of the start of this filter frame. /** * This is measured relative to the Epoch, 1970-01-01 00:00:00 +0000 (UTC). */ RIM_INLINE const Time& getTime() const { return time; } /// Set the absolute time of the start of this filter frame. /** * This is measured relative to the Epoch, 1970-01-01 00:00:00 +0000 (UTC). */ RIM_INLINE void setTime( const Time& newTime ) { time = newTime; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Frame Limit Accessor Methods /// Return the maximum number of sound buffers that a sound filter frame can have. RIM_INLINE static Size getMaximumNumberOfBuffers() { return Size(math::max<UInt16>()); } /// Return the maximum number of MIDI buffers that a sound filter frame can have. RIM_INLINE static Size getMaximumNumberOfMIDIBuffers() { return Size(math::max<UInt16>()); } private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Helper Method /// Double the capacity of the internal buffer array, copying the old buffer pointers. void reallocateBuffers( Size newCapacity ); /// Double the capacity of the internal MIDI buffer array, copying the old buffer pointers. void reallocateMIDIBuffers( Size newCapacity ); /// A helper method which copies all of the MIDI data to another filter frame. /** * This allows the fast parts of copyMIDITo() to be inlined, while the longer * code for copying (if there are any MIDI events) is in this method. */ void copyMIDIToInternal( SoundFilterFrame& other ) const; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Static Data Members /// Define the size of the fixed-size array of sound buffers that is part of a SoundFilterFrame. static const Size FIXED_BUFFER_ARRAY_SIZE = 2; /// Define the size of the fixed-size array of MIDI buffers that is part of a SoundFilterFrame. static const Size FIXED_MIDI_BUFFER_ARRAY_SIZE = 1; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Members /// A pointer to an array of SoundBuffer pointers which represent the buffers for this frame. SoundBuffer** buffers; /// A pointer to an array of MIDIBuffer pointers which represent the MIDI buffers for this frame. MIDIBuffer** midiBuffers; /// The number of buffers that this filter frame has. UInt16 numBuffers; /// The maximum number of buffers that this filter frame can hold. UInt16 bufferCapacity; /// The number of MIDI buffers that this filter frame has. UInt16 numMIDIBuffers; /// The maximum number of MIDI buffers that this filter frame can hold. UInt16 midiBufferCapacity; /// The absolute time of the start of this filter frame. /** * This is measured relative to the Epoch, 1970-01-01 00:00:00 +0000 (UTC). */ Time time; /// A fixed-size array of buffers that are part of the frame object to avoid excessive allocations. SoundBuffer* bufferArray[FIXED_BUFFER_ARRAY_SIZE]; /// A fixed-size array of MIDI buffers that are part of the frame object to avoid excessive allocations. MIDIBuffer* midiBufferArray[FIXED_MIDI_BUFFER_ARRAY_SIZE]; }; //########################################################################################## //************************ End Rim Sound Filters Namespace ******************************* RIM_SOUND_FILTERS_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_SOUND_FILTER_FRAME_H <file_sep>/* * rimPhysicsCollisionShapeMaterial.h * Rim Physics * * Created by <NAME> on 3/9/08. * Copyright 2008 Rim Software. All rights reserved. * */ #ifndef INCLUDE_RIM_PHYSICS_COLLISION_SHAPE_MATERIAL_H #define INCLUDE_RIM_PHYSICS_COLLISION_SHAPE_MATERIAL_H #include "rimPhysicsShapesConfig.h" //########################################################################################## //************************ Start Rim Physics Shapes Namespace **************************** RIM_PHYSICS_SHAPES_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class which describes the physical and simulated properties of a type of material. class CollisionShapeMaterial { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructors /// Create a material with the default material parameters. CollisionShapeMaterial(); /// Create a material object with the specified material parameters. CollisionShapeMaterial( Real newElasticity, Real newKineticFriction, Real newStaticFriction, Real newStaticFrictionThreshold, Real newDensity, Real newAllowedPenetration, Real newHardness ); /// Create a combined collision shape material from the specified two material objects. /** * This constructor combines the properties of the two specified materials * into a single material object that approximates the material properties * for those two materials interacting. */ CollisionShapeMaterial( const CollisionShapeMaterial& material1, const CollisionShapeMaterial& material2 ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Density Accessor Methods /// Return the density of this material in mass units (kg) over length units (m) cubed. RIM_FORCE_INLINE Real getDensity() const { return density; } /// Set the density of this material in mass units (kg) over length units (m) cubed. /** * The density of the material is clamped to the range [0,+infinity). */ RIM_INLINE void setDensity( Real newDensity ) { density = math::max( newDensity, Real(0) ); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Elasticity Accessor Methods /// Get the coefficient of restitution of this material. /** * A value of 0 indicates that this material undergoes totally inelastic * collisions, while a value of 1 indicates that collisions are highly elastic. */ RIM_FORCE_INLINE Real getElasticity() const { return elasticity; } /// Set the coefficient of restitution of this material. /** * This value is clamped to the range [0,1]. A value of 0 indicates * that this material undergoes totally inelastic collisions, while a * value of 1 indicates that collisions are perfectly elastic. */ RIM_INLINE void setElasticity( Real newElasticity ) { elasticity = math::clamp( newElasticity, Real(0), Real(1) ); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Kinetic Friction Coefficient Accessor Methods /// Return the coefficient of kinetic friction for this material. /** * This value indicates the coefficient of friction to be used when * the relative speed between two objects is greater than the static * friction threshold. */ RIM_FORCE_INLINE Real getKineticFriction() const { return kineticFriction; } /// Set the coefficient of kinetic friction for this material. /** * This value indicates the coefficient of friction to be used when * the relative speed between two objects is greater than the static * friction threshold. This value is clamped to the range of [0,+infinity). */ RIM_INLINE void setKineticFriction( Real newKineticFriction ) { kineticFriction = math::max( newKineticFriction, Real(0) ); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Static Friction Coefficient Accessor Methods /// Return the coefficient of static friction for this material. /** * This value indicates the coefficient of friction to be used when * the relative speed between two objects is less than the static * friction threshold. */ RIM_FORCE_INLINE Real getStaticFriction() const { return staticFriction; } /// Set the coefficient of static friction for this material. /** * This value indicates the coefficient of friction to be used when * the relative speed between two objects is less than the static * friction threshold. This value is clamped to the range of [0,+infinity). */ RIM_INLINE void setStaticFriction( Real newStaticFriction ) { staticFriction = math::max( newStaticFriction, Real(0) ); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Static Friction Threshold Accessor Methods /// Get the relative speed threshold below which static friction is in effect. /** * This value indicates the maximum relative speed at the point of collision * between two objects where static friction has effect. If the relative * speed is greater than this value, kinetic friction is observed. */ RIM_FORCE_INLINE Real getStaticFrictionThreshold() const { return staticFrictionThreshold; } /// Set the relative speed threshold below which static friction is in effect. /** * This value indicates the maximum relative speed at the point of collision * between two objects where static friction has effect. If the relative * speed is greater than this value, kinetic friction is observed. This * value is clamped to the range of [0,+infinity). */ RIM_INLINE void setStaticFrictionThreshold( Real newStaticFrictionThreshold ) { staticFrictionThreshold = math::max( newStaticFrictionThreshold, Real(0) ); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Allowed Penetration Accessor Methods /// Return the amount of allowed penetration for this material in length units (m). /** * This value indicates the amount of allowed penetration between two * colliding objects. It exists to make simulations more stable when * there are many colliding objects by relaxing the constraints for * object interpenetrations. It is wise to set this value to be the same as * the smallest detail size in the scene (mm or cm). */ RIM_FORCE_INLINE Real getAllowedPenetration() const { return allowedPenetration; } /// Set the amount of allowed penetration for this material in length units (m). /** * This value indicates the amount of allowed penetration between two * colliding objects. It exists to make simulations more stable when * there are many colliding objects by relaxing the constraints for * object interpenetrations. It is wise to set this value to be the same as * the smallest detail size in the scene (mm or cm). */ RIM_INLINE void setAllowedPenetration( Real newAllowedPenetration ) { allowedPenetration = newAllowedPenetration; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Hardness Accessor Methods /// Return the 'hardness' of this material. /** * This value indicates how quickly the physics collision resolution * system should correct object interpenetrations that are above the * allowed threshold. A value of 0 indicates that interpenetrations are * not corrected, while a value of 1 indicates that interpenetrations are * corrected immediately. It is unwise to use a value of 1 because it can * cause the simulation to become unstable when there are many colliding * objects. */ RIM_FORCE_INLINE Real getHardness() const { return hardness; } /// Set the 'hardness' of this material. /** * This value indicates how quickly the physics collision resolution * system should correct object interpenetrations that are above the * allowed threshold. A value of 0 indicates that interpenetrations are * not corrected, while a value of 1 indicates that interpenetrations are * corrected immediately. It is unwise to use a value of 1 because it can * cause the simulation to become unstable when there are many colliding * objects. This value is clamped to the range of [0,1]. */ RIM_INLINE void setHardness( Real newHardness ) { hardness = math::clamp( newHardness, Real(0), Real(1) ); } private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Members /// The density of this material in mass units (kg) over length units (m) cubed. Real density; /// The coefficient of restitution for this material, the amount that collisions are elastic. /** * A value of 0 indicates that this material undergoes totally inelastic * collisions, while a value of 1 indicates that collisions are perfectly * elastic (no energy is lost). */ Real elasticity; /// The coefficient of kinetic friction for this material. /** * This value indicates the coefficient of friction to be used when * the relative speed between two objects is greater than the static * friction threshold. */ Real kineticFriction; /// The coefficient of static friction for this material. /** * This value indicates the coefficient of friction to be used when * the relative speed between two objects is less than the static * friction threshold. */ Real staticFriction; /// The relative speed threshold below which static friction is in effect. /** * This value indicates the maximum relative speed at the point of collision * between two objects where static friction has effect. If the relative * speed is greater than this value, kinetic friction is observed. */ Real staticFrictionThreshold; /// The amount of allowed penetration for this material in length units (m). /** * This value indicates the amount of allowed penetration between two * colliding objects. It exists to make simulations more stable when * there are many colliding objects by relaxing the constraints for * object interpenetrations. It is wise to set this value to be the same as * the smallest detail size in the scene (mm or cm). */ Real allowedPenetration; /// The 'hardness' of this material. /** * This value indicates how quickly the physics collision resolution * system should correct object interpenetrations that are above the * allowed threshold. A value of 0 indicates that interpenetrations are * not corrected, while a value of 1 indicates that interpenetrations are * corrected immediately. It is unwise to use a value of 1 because it can * cause the simulation to become unstable when there are many colliding * objects. */ Real hardness; }; //########################################################################################## //************************ End Rim Physics Shapes Namespace ****************************** RIM_PHYSICS_SHAPES_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_PHYSICS_COLLISION_SHAPE_MATERIAL_H <file_sep>/* * rimGraphicsOrthographicCamera.h * Rim Graphics * * Created by <NAME> on 9/7/09. * Copyright 2009 Rim Software. All rights reserved. * */ #ifndef INCLUDE_RIM_GRAPHICS_ORTHOGRAPHIC_CAMERA_H #define INCLUDE_RIM_GRAPHICS_ORTHOGRAPHIC_CAMERA_H #include "rimGraphicsCamerasConfig.h" #include "rimGraphicsCamera.h" //########################################################################################## //*********************** Start Rim Graphics Cameras Namespace *************************** RIM_GRAPHICS_CAMERAS_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class which represents a camera which uses an orthographic projection transformation. class OrthographicCamera : public Camera { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructors /// Create a camera which uses orthographic projection with the specified viewport. OrthographicCamera(); /// Create an othographic camera with the specified viewport, position, and orientation. OrthographicCamera( const Vector3& newPosition, const Matrix3& newOrientation, const Viewport& newViewport = Viewport() ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** View Width Accessor Methods /// Return the camera-space bounding box of the camera's viewport. RIM_INLINE const AABB2& getViewportBounds() const { return viewportBounds; } /// Set the camera-space bounding box of the camera's viewport. RIM_INLINE void setViewportBounds( const AABB2& newViewportBounds ) { viewportBounds = newViewportBounds; } /// Set the camera-space bounding box of the camera's view volume. RIM_INLINE void setViewBounds( const AABB3& newViewBounds ) { viewportBounds = AABB2( newViewBounds.min.x, newViewBounds.max.x, newViewBounds.min.y, newViewBounds.max.y ); nearPlaneDistance = newViewBounds.min.z; farPlaneDistance = newViewBounds.max.z; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Transform Matrix Accessor Methods /// Get a matrix which projects points in camera space onto the near plane of the camera. virtual Matrix4 getProjectionMatrix() const; /// Return a depth-biased projection matrix for this camera for the given depth and bias distance. virtual Matrix4 getDepthBiasProjectionMatrix( Real depth, Real bias ) const; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** View Volume Accessor Method /// Return an object specifying the volume of this camera's view. virtual ViewVolume getViewVolume() const; /// Compute the 8 corners of this camera's view volume and place them in the output array. virtual void getViewVolumeCorners( StaticArray<Vector3,8>& corners ) const; /// Return whether or not the specified direction is within the camera's field of view. virtual Bool canViewDirection( const Vector3f& direction ) const; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Screen-Space Size Accessor Methods /// Return the screen-space radius in pixels of the specified world-space bounding sphere. virtual Real getScreenSpaceRadius( const BoundingSphere& sphere ) const; /// Return the distance to the center of the specified bounding sphere along the view direction. virtual Real getDepth( const Vector3f& position ) const; private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Members /// The horizontal and vertical bounds of the viewport in camera-space coordinates. AABB2 viewportBounds; }; //########################################################################################## //*********************** End Rim Graphics Cameras Namespace ***************************** RIM_GRAPHICS_CAMERAS_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_GRAPHICS_ORTHOGRAPHIC_CAMERA_H <file_sep>/* * rimGraphicsIOConfig.h * Rim Graphics * * Created by <NAME> on 5/16/12. * Copyright 2012 __MyCompanyName__. All rights reserved. * */ #ifndef INCLUDE_RIM_GRAPHICS_IO_CONFIG_H #define INCLUDE_RIM_GRAPHICS_IO_CONFIG_H #include "../rimGraphicsConfig.h" #include "../rimGraphicsUtilities.h" #include "../rimGraphicsBase.h" #include "../rimGraphicsObjects.h" #include "../rimGraphicsScenes.h" //########################################################################################## //########################################################################################## //############ //############ Library Namespace Configuration //############ //########################################################################################## //########################################################################################## #ifndef RIM_GRAPHICS_IO_NAMESPACE_START #define RIM_GRAPHICS_IO_NAMESPACE_START RIM_GRAPHICS_NAMESPACE_START namespace io { #endif #ifndef RIM_GRAPHICS_IO_NAMESPACE_END #define RIM_GRAPHICS_IO_NAMESPACE_END }; RIM_GRAPHICS_NAMESPACE_END #endif //########################################################################################## //************************** Start Rim Graphics IO Namespace ***************************** RIM_GRAPHICS_IO_NAMESPACE_START //****************************************************************************************** //########################################################################################## using namespace rim::graphics::shapes; using rim::graphics::objects::GraphicsObject; using rim::graphics::objects::ObjectCuller; using rim::graphics::lights::Light; using rim::graphics::lights::LightCuller; using rim::graphics::cameras::Camera; using rim::graphics::scenes::GraphicsScene; using rim::graphics::devices::GraphicsContext; //########################################################################################## //************************** End Rim Graphics IO Namespace ******************************* RIM_GRAPHICS_IO_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_GRAPHICS_IO_CONFIG_H <file_sep>/* * rimData.h * Rim Framework * * Created by <NAME> on 3/24/08. * Copyright 2008 Rim Software. All rights reserved. * */ #ifndef INCLUDE_RIM_DATA_H #define INCLUDE_RIM_DATA_H #include "rimDataConfig.h" #include "../util/rimArray.h" #include "rimHashCode.h" //########################################################################################## //******************************* Start Data Namespace ********************************* RIM_DATA_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class which represents an immutable array of unsigned byte data. /** * The Data class is the data-oriented analogue to the BasicString class. It is * designed to hold an opaque block of data resident in memory. A Data object could * be used to hold anything: images, audio, even text. The internal array of data * is reference-counted in order to reduce unintended copying. */ class Data { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructors /// Create an empty Data object that doesn't hold any data. RIM_INLINE Data() : data( NULL ), size( 0 ), referenceCount( NULL ), haveCalculatedHash( false ) { } /// Create a Data object which contains only the specified unsigned byte. RIM_INLINE Data( const UByte& newData ) : data( util::construct<UByte>(newData) ), size( 1 ), referenceCount( util::construct<Size>(1) ), haveCalculatedHash( false ) { } /// Create a Data object by copying the specified number of bytes from the given data pointer. Data( const UByte* newData, Size number ); /// Create a Data object by copying the specified data array. Data( const util::Array<UByte>& array ); /// Create a Data object by copying the specified number of bytes from the given data array. Data( const util::Array<UByte>& array, Size number ); RIM_INLINE Data( const Data& other ) : data( other.data ), size( other.size ), referenceCount( other.referenceCount ), hashCode( other.hashCode ), haveCalculatedHash( other.haveCalculatedHash ) { if ( referenceCount ) (*referenceCount)++; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Static Factory Methods /// Create a data object from the specified byte array with the specified size. /** * Once this method completes, it is expected that the Data object now owns * the data array pointer and will free it upon destruction. */ RIM_INLINE static Data shallow( UByte* array, Size size ) { return Data( array, size, 0 ); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Destructor /// Destroy a Data object, deallocating the internal data array if the reference count reaches zero. ~Data(); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Assignment Operator /// Assign the contents of another Data object to this object. Data& operator = ( const Data& other ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Size Accessor Methods /// Return the number of bytes of data that this Data object holds. RIM_INLINE Size getSize() const { return size; } /// Return the number of bytes of data that this Data object holds. RIM_INLINE Size getSizeInBytes() const { return size; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Data Accessor Methods /// Get a pointer to the internal array of bytes that this Data object holds. RIM_INLINE const UByte* getPointer() const { return data; } /// Get a pointer to the internal array of bytes that this Data object holds. RIM_INLINE operator const UByte* () const { return data; } /// Access the byte at the specified index in the Data object's internal array. RIM_INLINE const UByte& operator () ( Index index ) const { RIM_DEBUG_ASSERT_MESSAGE( index < size, "Cannot access invalid byte index in data array" ); return data[index]; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Data Comparison Operators /// Return whether or not the data contained in this Data object is identical to another's. Bool equals( const Data& other ) const; /// Return whether or not the data contained in this Data object is identical to another's. RIM_INLINE Bool operator == ( const Data& other ) const { return this->equals( other ); } /// Return whether or not the data contained in this Data object is not identical to another's. RIM_INLINE Bool operator != ( const Data& other ) const { return !this->equals( other ); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Data Concatentation Methods /// Return a Data object containing the concatenation of this data and the specified data. Data concatenate( const Data& other ) const; /// Return a Data object containing the concatenation of this data and the specified data. RIM_INLINE Data operator + ( const Data& other ) const { return this->concatenate( other ); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Hash Code Accessor Method /// Get a hash code for this Data object. RIM_INLINE Hash getHashCode() const { if ( haveCalculatedHash ) return hashCode; else { hashCode = HashCode( data, size ); return hashCode; } } private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Constructor /// Shallowly create a Data object from a raw pointer. RIM_INLINE Data( UByte* newData, Size newSize, int ) : data( newData ), size( newSize ), referenceCount( util::construct<Size>( 1 ) ), haveCalculatedHash( false ) { } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Members /// A pointer to the array of bytes that this Data object holds. UByte* data; /// The number of bytes of data that this Data object holds. Size size; /// A pointer to the location of the data object's reference count. Size* referenceCount; /// The hash code of this data mutable Hash hashCode; /// Whether or not the hash code for this data has been calculated already. mutable Bool haveCalculatedHash; }; //########################################################################################## //******************************* End Data Namespace *********************************** RIM_DATA_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_DATA_H <file_sep>/* * rimGraphicsGUIScrollView.h * Rim Graphics GUI * * Created by <NAME> on 2/11/13. * Copyright 2013 Headspace Systems. All rights reserved. * */ #ifndef INCLUDE_RIM_GRAPHICS_GUI_SCROLL_VIEW_H #define INCLUDE_RIM_GRAPHICS_GUI_SCROLL_VIEW_H #include "rimGraphicsGUIBase.h" #include "rimGraphicsGUIObject.h" #include "rimGraphicsGUISlider.h" //########################################################################################## //************************ Start Rim Graphics GUI Namespace ****************************** RIM_GRAPHICS_GUI_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class which provides a scrolling content area that allows viewing of large scale GUI objects. class ScrollView : public GUIObject { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructors /// Create a new sizeless scroll view positioned at the origin of its coordinate system. ScrollView(); /// Create a new scroll view which occupies the specified rectangle. ScrollView( const Rectangle& newRectangle ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Slider Width Accessor Methods /// Return the width in vertical screen coordinates of each scoll bar for this scroll view. RIM_INLINE Float getSliderWidth() const { return sliderWidth; } /// Set the width in vertical screen coordinates of each scoll bar for this scroll view. RIM_INLINE void setSliderWidth( Float newSliderWidth ) { sliderWidth = newSliderWidth; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Slider Accessor Methods /// Return a reference to the horizontal slider for this scroll view. RIM_INLINE const Slider& getHorizontalSlider() const { return horizontalSlider; } /// Return a reference to the vertical slider for this scroll view. RIM_INLINE const Slider& getVerticalSlider() const { return verticalSlider; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Slider Alignment Accessor Methods /// Return an enum value indicating the vertical alignment of the scroll view's horizontal slider. RIM_INLINE Origin::YOrigin getHorizontalSliderAlignment() const { return horizontalSlider.getOrigin().getY(); } /// Set an enum value indicating the vertical alignment of the scroll view's horizontal slider. /** * This alignment must be either Origin::TOP or Origin::BOTTOM. Any other alignment * will not be accepted and the method will return FALSE, indicating failure. */ Bool setHorizontalSliderAlignment( Origin::YOrigin newAlignment ); /// Return an enum value indicating the horizontal alignment of the scroll view's vertical slider. RIM_INLINE Origin::XOrigin getVerticalSliderAlignment() const { return verticalSlider.getOrigin().getX(); } /// Set an enum value indicating the horizontal alignment of the scroll view's vertical slider. /** * This alignment must be either Origin::LEFT or Origin::RIGHT. Any other alignment * will not be accepted and the method will return FALSE, indicating failure. */ Bool setVerticalSliderAlignment( Origin::XOrigin newAlignment ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Border Accessor Methods /// Return a mutable object which describes this scroll view's border. RIM_INLINE Border& getBorder() { return border; } /// Return an object which describes this scroll view's border. RIM_INLINE const Border& getBorder() const { return border; } /// Set an object which describes this scroll view's border. RIM_INLINE void setBorder( const Border& newBorder ) { border = newBorder; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Object Accessor Methods /// Return the total number of GUIObjects that are part of this scroll view. RIM_INLINE Size getObjectCount() const { return objects.getSize(); } /// Return a pointer to the object at the specified index in this scroll view. /** * Objects are stored in back-to-front sorted order, such that the object * with index 0 is the furthest toward the back of the object ordering. */ RIM_INLINE const Pointer<GUIObject>& getObject( Index objectIndex ) const { return objects[objectIndex]; } /// Add the specified object to this scroll view. /** * If the specified object pointer is NULL, the method fails and FALSE * is returned. Otherwise, the object is inserted in the front-to-back order * of the scroll view's objects and TRUE is returned. */ Bool addObject( const Pointer<GUIObject>& newObject ); /// Remove the specified object from this scroll view. /** * If the given object is part of this scroll view, the method removes it * and returns TRUE. Otherwise, if the specified object is not found, * the method doesn't modify the scroll view and FALSE is returned. */ Bool removeObject( const GUIObject* oldObject ); /// Remove all objects from this scroll view. void clearObjects(); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Content Bounding Box Accessor Methods /// Return the 3D bounding box for the content view's content display area in its local coordinate frame. RIM_INLINE AABB3f getLocalContentBounds() const { return AABB3f( this->getLocalContentBoundsXY(), AABB1f( Float(0), this->getSize().z ) ); } /// Return the bounding box for the scroll view's content display area in its local coordinate frame. AABB2f getLocalContentBoundsXY() const; /// Return the total 3D bounding box of this scroll view's content in its local coordinate system. RIM_INLINE AABB3f getLocalContentBoundsTotal() const { return AABB3f( this->getLocalContentBoundsTotalXY(), AABB1f( Float(0), this->getSize().z ) ); } /// Return the total bounding box of this scroll view's content in its local coordinate system. AABB2f getLocalContentBoundsTotalXY() const; /// Return the visible 3D bounding box of this scroll view's content in its local coordinate system. RIM_INLINE AABB3f getLocalContentBoundsVisible() const { return AABB3f( this->getLocalContentBoundsVisibleXY(), AABB1f( Float(0), this->getSize().z ) ); } /// Return the visible bounding box of this scroll view's content in its local coordinate system. /** * The returned bounding box depends on the positioning of the scroll view's sliders * and the total size of the content. */ AABB2f getLocalContentBoundsVisibleXY() const; /// Return the bounding box for the scroll view's dragable corner. AABB2f getLocalCornerBoundsXY() const; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Color Accessor Methods /// Return the background color for this scroll view's area. RIM_INLINE const Color4f& getBackgroundColor() const { return backgroundColor; } /// Set the background color for this scroll view's area. RIM_INLINE void setBackgroundColor( const Color4f& newBackgroundColor ) { backgroundColor = newBackgroundColor; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Border Color Accessor Methods /// Return the border color used when rendering a scroll view. RIM_INLINE const Color4f& getBorderColor() const { return borderColor; } /// Set the border color used when rendering a scroll view. RIM_INLINE void setBorderColor( const Color4f& newBorderColor ) { borderColor = newBorderColor; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Update Method /// Update the current internal state of this scroll view for the specified time interval in seconds. virtual void update( Float dt ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Drawing Method /// Draw this object using the specified GUI renderer to the given parent coordinate system bounds. /** * The method returns whether or not the object was successfully drawn. * * The default implementation draws nothing and returns TRUE. */ virtual Bool drawSelf( GUIRenderer& renderer, const AABB3f& parentBounds ) const; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Input Handling Methods /// Handle the specified keyboard event that occured when this object had focus. virtual void keyEvent( const KeyboardEvent& event ); /// Handle the specified mouse motion event that occurred. virtual void mouseMotionEvent( const MouseMotionEvent& event ); /// Handle the specified mouse button event that occurred. virtual void mouseButtonEvent( const MouseButtonEvent& event ); /// Handle the specified mouse wheel event that occurred. virtual void mouseWheelEvent( const MouseWheelEvent& event ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Static Construction Methods /// Construct a smart-pointer-wrapped instance of this class using the constructor with the given arguments. RIM_INLINE static Pointer<ScrollView> construct() { return Pointer<ScrollView>::construct(); } /// Construct a smart-pointer-wrapped instance of this class using the constructor with the given arguments. RIM_INLINE static Pointer<ScrollView> construct( const Rectangle& newRectangle ) { return Pointer<ScrollView>::construct( newRectangle ); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Public Static Data Members /// The default width that is used for a scroll view's sliders. static const Float DEFAULT_SLIDER_WIDTH; /// The default border that is used for a scroll view. static const Border DEFAULT_BORDER; /// The default background color that is used for a scroll view's area. static const Color4f DEFAULT_BACKGROUND_COLOR; /// The default border color that is used for a scroll view. static const Color4f DEFAULT_BORDER_COLOR; private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Helper Methods /// Make sure that the list of objects is in sorted order based on their depths. void sortObjectsByDepth(); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Members /// A list of all of the objects that are children of this scroll view. ArrayList< Pointer<GUIObject> > objects; /// An object which describes the border for this scroll view. Border border; /// An object which represents the horizontal scroll bar for this scroll view. Slider horizontalSlider; /// An object which represents the vertical scroll bar for this scroll view. Slider verticalSlider; /// The width of each scroll bar along its minor axis. Float sliderWidth; /// The background color for the scroll view's area. Color4f backgroundColor; /// The border color for the scroll view's background area. Color4f borderColor; }; //########################################################################################## //************************ End Rim Graphics GUI Namespace ******************************** RIM_GRAPHICS_GUI_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_GRAPHICS_GUI_SCROLL_VIEW_H <file_sep>/* * ThreadPool.h * Rim Threads * * Created by <NAME> on 10/31/08. * Copyright 2008 __MyCompanyName__. All rights reserved. * */ #ifndef INCLUDE_RIM_THREAD_POOL_H #define INCLUDE_RIM_THREAD_POOL_H #include "rimThreadsConfig.h" #include "rimBasicThread.h" #include "rimMutex.h" #include "rimSemaphore.h" #include "rimAtomics.h" //########################################################################################## //*************************** Start Rim Threads Namespace ******************************** RIM_THREADS_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class which executes jobs on a set of worker threads. class ThreadPool { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructors /// Create a thread pool which has no threads and no jobs queued. ThreadPool(); /// Create a new thread pool which has the specified number of execution threads. ThreadPool( Size newNumberOfThreads ); /// Create a thread pool with the same queued jobs and number of threads as another thread pool. ThreadPool( const ThreadPool& other ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Destructor /// Finish the current job being processed by each worker thread then destroy the thread pool. ~ThreadPool(); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Assignment Operator /// Assign the queued jobs of another thread pool and copy the number of threads to this thread pool. ThreadPool& operator = ( const ThreadPool& other ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Thread Management Methods /// Return the number of threads that are currently executing as part of this thread pool. Size getThreadCount() const; /// Set the desired number of threads that should be in this thread pool. void setThreadCount( Size numThreads ); /// Add a new worker thread to this thread pool. void addThread(); /// Wait for a thread to finish processing and remove it from the queue. void removeThread(); /// Return the index of the thread in this thread pool corresponding to the calling thread, or -1 if no match found. Index getCurrentThreadIndex() const; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Job Management Methods /// Return the total number of jobs that are queued to be executed by this thread pool. Size getJobCount() const; /// Add the specified job function call to this thread pool, executing with the given priority. /** * The method allows the user to specify an integer ID for the job, that is * used to differentiate between different job sets that have different deadlines * on separate threads. The user can then wait for all jobs or just jobs with that ID to finish. */ template < typename Signature > void addJob( const lang::FunctionCall<Signature>& job, Index jobID = 0, Int priority = 1 ) { jobMutex.lock(); // Find the index of this job ID in the list of of job IDs. Index jobIDIndex = createJobIDIndex( jobID ); // Add the new job to the job queue. jobs.add( SortableJob( lang::Pointer<JobBase>( util::construct<Job<Signature> >( job, jobIDIndex, priority ) ) ) ); // Atomically update the number of unfinished jobs. atomic::incrementAndRead( jobIDs[jobIDIndex].numUnfinishedJobs ); atomic::incrementAndRead( numUnfinishedJobs ); jobMutex.unlock(); // Notify a worker that there is a job ready. jobSemaphore.up(); } /// Wait for all of the jobs queued in this thread pool for the specified job ID to finish. void finishJob( Index jobID ); /// Wait for all of the jobs queued in this thread pool to finish before returning. void finishJobs(); /// Remove all currently queued jobs from this thread pool. void clearJobs(); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Thread Priority Accessor Methods /// Return the thread priority that is used for all of the threads in this pool. RIM_INLINE ThreadPriority getPriority() const { return priority; } /// Set the thread priority that is used for all of the threads in this pool. /** * The method returns whether or not the priority was successfully changed. */ Bool setPriority( const ThreadPriority& newPriority ); private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Class Declarations /// A class which represents a single worker thread that is a part of this pool. class Worker; /// A class which represents the base class a single generic job for this thread pool. class JobBase { public: /// Create a new thread job object with the given priority. RIM_INLINE JobBase( Index newJobIDIndex, Int newPriority ) : jobIDIndex( newJobIDIndex ), priority( newPriority ) { } /// Destroy this job. virtual ~JobBase() { } /// Execute this job on the calling thread. virtual void execute() = 0; /// Return whether or not this job has a higher priority than another job. RIM_INLINE Bool operator < ( const JobBase& other ) const { return priority < other.priority; } /// The priority of this job. /** * A higher priority means that the job will preempt other jobs with lower * priorities. */ Int priority; /// The index of this job's ID, used to group it with other jobs. Index jobIDIndex; }; /// A class which encapsulates a single job for this thread pool. template < typename Signature > class Job : public JobBase { public: /// Create a new thread job object which runs the given function call with its priority. RIM_INLINE Job( const lang::FunctionCall<Signature>& newJob, Index newJobIDIndex, Int newPriority ) : JobBase( newJobIDIndex, newPriority ), job( newJob ) { } /// Execute this job on the calling thread. virtual void execute() { job(); } /// A function call object specifying what job to perform on the thread. lang::FunctionCall<Signature> job; }; /// A proxy object which stores a pointer to a generic job and allows sorting based on job priority. class SortableJob { public: /// Create a new sortable job object corresponding to the specified job. RIM_INLINE SortableJob( const lang::Pointer<JobBase>& newJob ) : job( newJob ) { } /// Return whether or not this job has a higher priority than another job. RIM_INLINE Bool operator < ( const SortableJob& other ) const { return (*job) < (*other.job); } /// A pointer to the job which this sortable job is a part of. lang::Pointer<JobBase> job; }; /// A class that keeps track of information needed for a particular job ID. class JobID { public: RIM_INLINE JobID( Index newJobID ) : jobID( newJobID ), numUnfinishedJobs( 0 ) { } /// The ID of the job. Index jobID; /// The number of unfinished jobs there are for this job ID. Size numUnfinishedJobs; }; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Helper Methods /// Find and return the index of the JobID object with the given job ID, creating a new one if necessary. Index createJobIDIndex( Index jobID ); /// Find and return the index of the JobID object with the given job ID. /** * If no such job ID is found, the method returns -1. */ Index findJobIDIndex( Index jobID ) const; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Members /// A list of the threads that are currently part of this thread pool and are executing jobs. util::ArrayList<Worker*> threads; /// A queue of jobs to be performed by the thread pool. util::PriorityQueue<SortableJob> jobs; /// A list of the currently pending job IDs. util::ArrayList<JobID> jobIDs; /// A semaphore which counts the number of jobs that are currently queued and synchronizes job access. Semaphore jobSemaphore; /// A mutex that sychronizes access to the queue of jobs for this thread pool. mutable Mutex jobMutex; /// A mutex that sychronizes access to the list of worker threads for this thread pool. mutable Mutex threadMutex; /// The total number of queued jobs that have not yet completed. Size numUnfinishedJobs; /// The thread priority to use for all of the threads in this pool. ThreadPriority priority; }; //########################################################################################## //*************************** End Rim Threads Namespace ********************************** RIM_THREADS_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_THREAD_POOL_H <file_sep>/* * rimTraversalStack.h * Rim Software * * Created by <NAME> on 11/27/13. * Copyright 2013 __MyCompanyName__. All rights reserved. * */ #ifndef INCLUDE_RIM_TRAVERSAL_STACK_H #define INCLUDE_RIM_TRAVERSAL_STACK_H #include "rimBVHConfig.h" //########################################################################################## //***************************** Start Rim BVH Namespace ********************************** RIM_BVH_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class which stores a stack of node pointers used by an iterative traversal. /** * When traversing a BVH, the user passes in a stack object to use for node pointer * storage during tree traversal. This allows for easier multithreaded traversal, * since each thread can use a different stack object. */ class TraversalStack { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructors /// Create a new traversal stack with the default stack size of 32. RIM_INLINE TraversalStack() : stack( util::allocate<const void*>( DEFAULT_STACK_SIZE ) ), size( DEFAULT_STACK_SIZE ) { } /// Create a new traversal stack with the specified size. /** * The stack size is clamped so that it is at least 1. */ RIM_INLINE TraversalStack( Size newSize ) : size( math::max( newSize, Size(1) ) ) { stack = util::allocate<const void*>( newSize ); } /// Create a new traversal stack with the same size as another stack. /** * The entries of the stack are not copied. */ RIM_INLINE TraversalStack( const TraversalStack& other ) : stack( util::allocate<const void*>( other.size ) ), size( other.size ) { } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Destructor /// Destroy this traversal stack. RIM_INLINE ~TraversalStack() { util::deallocate( stack ); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Assignment Operator /// Make sure that this stack has size greater than or equal to another stack's size. /** * The entries of the stack are not copied. */ RIM_INLINE TraversalStack& operator = ( const TraversalStack& other ) { if ( size < other.size ) { // Reallocate the stack if it needs to be bigger. util::deallocate( stack ); stack = util::allocate<const void*>( other.size ); size = other.size; } return *this; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Stack Accessor Methods /// Return a pointer to the root of the stack. /** * The stack is an array of pointers that are stored contiguously after the root. */ RIM_INLINE const void** getRoot() const { return stack; } /// Return the total size of this traversal stack, the number of entries it has. RIM_INLINE Size getSize() const { return size; } /// Ensure that the stack has size greater than or equal to the specified size. RIM_INLINE void resize( Size newSize ) { if ( size < newSize ) { // Reallocate the stack if it needs to be bigger. util::deallocate( stack ); stack = util::allocate<const void*>( newSize ); size = newSize; } } private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Static Data Members /// A constant indicating the default stack size used when no size is specified. static const Size DEFAULT_STACK_SIZE = 32; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Members /// An array of pointers, indicating the stack entries. const void** stack; /// The total size of this traversal stack, the number of entries it has. Size size; }; //########################################################################################## //***************************** End Rim BVH Namespace ************************************ RIM_BVH_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_TRAVERSAL_STACK_H <file_sep>/* * rimResourceType.h * Rim Software * * Created by <NAME> on 2/24/14. * Copyright 2014 __MyCompanyName__. All rights reserved. * */ #ifndef INCLUDE_RIM_RESOURCE_TYPE_H #define INCLUDE_RIM_RESOURCE_TYPE_H #include "rimResourcesConfig.h" //########################################################################################## //************************** Start Rim Resources Namespace ******************************* RIM_RESOURCES_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// An enum class which specifies a kind of resource. class ResourceType { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Resource Type Enum Definition /// An enum type which represents the type of resource type. typedef enum Enum { /// An undefined resource type. UNDEFINED = 0, //******************************************************************************** // High-Level Types /// A resource type that corresponds to a multi-media scene with graphics, physics, and sound data, etc. ASSET_SCENE, //******************************************************************************** // Graphics Types /// A resource type that corresponds to a graphics scene: a collection of objects, cameras, lights, etc. GRAPHICS_SCENE, /// A resource type that correponds to an object or object hierarchy. GRAPHICS_OBJECT, /// A resource type that corresponds to a camera/viewport. GRAPHICS_CAMERA, /// A resource type that corresponds to a light. GRAPHICS_LIGHT, /// A resource type that corresponds to a renderable shape. GRAPHICS_SHAPE, /// A resource type that corresponds to a visual material. GRAPHICS_MATERIAL, /// A resource type that corresponds to a material rendering technique. GRAPHICS_TECHNIQUE, /// A resource type that corresponds to a shader pass. SHADER_PASS, /// A resource type that corresponds to a specific shader pass implementation. SHADER_PASS_VERSION, /// A resource type that corresponds to a shader source code. SHADER_SOURCE, /// A resource type that corresponds to a configuration for a shader pass. SHADER_CONFIGURATION, /// A resource type that corresponds to a shader constant binding. SHADER_CONSTANT_BINDING, /// A resource type that corresponds to a shader texture binding. SHADER_TEXTURE_BINDING, /// A resource type that corresponds to a shader vertex binding. SHADER_VERTEX_BINDING, /// A resource type that corresponds to a texture: an image plus sampling characteristics. TEXTURE, /// A resource type that corresponds to the type of a texture. TEXTURE_TYPE, /// A resource type that corresponds to an image. IMAGE, /// A resource type that corresponds to a buffer of shader attributes. ATTRIBUTE_BUFFER, /// A resource type that corresponds to the rendering state configuration for a shader pass. RENDER_MODE, /// A resource type that describes how alpha testing should be performed. ALPHA_TEST, /// A resource type that describes how blending should be performed. BLEND_MODE, /// A resource type that describes how depth testing should be performed. DEPTH_MODE, /// A resource type that describes how stencil testing should be performed. STENCIL_MODE, //******************************************************************************** // Sound Types /// A resource type that corresponds to a buffer of sound sample data. SOUND, /// A resource type that corresponds to a sequence of musical notes and control information. MIDI }; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructors /// Create a new resource type with the UNDEFINED resource type. RIM_INLINE ResourceType() : type( UNDEFINED ) { } /// Create a new resource type with the specified resource type enum value. RIM_INLINE ResourceType( Enum newType ) : type( newType ) { } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Enum Cast Operator /// Convert this resource type type to an enum value. RIM_INLINE operator Enum () const { return type; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** String Representation Accessor Methods /// Return a unique string for this resource format that matches its enum value name. data::String toEnumString() const; /// Return a resource type which corresponds to the given enum string. static ResourceType fromEnumString( const data::String& enumString ); /// Return a string representation of the resource type. data::String toString() const; /// Convert this resource type into a string representation. RIM_FORCE_INLINE operator data::String () const { return this->toString(); } private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Members /// An enum value which indicates the type of resource type. Enum type; }; //########################################################################################## //************************** End Rim Resources Namespace ********************************* RIM_RESOURCES_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_RESOURCE_TYPE_H <file_sep>/* * rimGraphicsGUIFontsConfig.h * Rim Graphics GUI * * Created by <NAME> on 1/15/13. * Copyright 2013 Headspace Systems. All rights reserved. * */ #ifndef INCLUDE_RIM_GRAPHICS_GUI_FONTS_CONFIG_H #define INCLUDE_RIM_GRAPHICS_GUI_FONTS_CONFIG_H #include "../rimGraphicsGUIConfig.h" //########################################################################################## //########################################################################################## //############ //############ Library Namespace Configuration //############ //########################################################################################## //########################################################################################## #ifndef RIM_GRAPHICS_GUI_FONTS_NAMESPACE_START #define RIM_GRAPHICS_GUI_FONTS_NAMESPACE_START RIM_GRAPHICS_GUI_NAMESPACE_START namespace fonts { #endif #ifndef RIM_GRAPHICS_GUI_FONTS_NAMESPACE_END #define RIM_GRAPHICS_GUI_FONTS_NAMESPACE_END }; RIM_GRAPHICS_GUI_NAMESPACE_END #endif //########################################################################################## //********************* Start Rim Graphics GUI Fonts Namespace *************************** RIM_GRAPHICS_GUI_FONTS_NAMESPACE_START //****************************************************************************************** //########################################################################################## //########################################################################################## //********************* End Rim Graphics GUI Fonts Namespace ***************************** RIM_GRAPHICS_GUI_FONTS_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_GRAPHICS_GUI_FONTS_CONFIG_H <file_sep>#include "Global_planner.h" Global_planner::Global_planner(void) { } Global_planner::~Global_planner(void) { } <file_sep> #ifndef INCLUDE_RIM_SIMD_SCALAR_H #define INCLUDE_RIM_SIMD_SCALAR_H #include "rimMathConfig.h" #include "rimScalarMath.h" #include "rimSIMDConfig.h" #include "rimSIMDTypes.h" //########################################################################################## //***************************** Start Rim Math Namespace ********************************* RIM_MATH_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// The prototype for the SIMDScalar class. /** * Since only certain types and widths are supported on SIMD hardware, this class, * forward-declared here is specialized for different types and widths that are * hardware compliant. Using another type or width will produce an error because * a class with those invalid arguments will not be defined. */ template < typename T, Size width > class SIMDScalar; //########################################################################################## //***************************** End Rim Math Namespace *********************************** RIM_MATH_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_SIMD_SCALAR_H <file_sep>/* * rimGUIElementWindowDelegate.h * Rim GUI * * Created by <NAME> on 6/2/09. * Copyright 2009 Rim Software. All rights reserved. * */ #ifndef INCLUDE_RIM_GUI_ELEMENT_WINDOW_DELEGATE_H #define INCLUDE_RIM_GUI_ELEMENT_WINDOW_DELEGATE_H #include "rimGUIConfig.h" #include "rimGUIInput.h" //########################################################################################## //*************************** Start Rim GUI Namespace ****************************** RIM_GUI_NAMESPACE_START //****************************************************************************************** //########################################################################################## class Window; //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class which contains function objects that recieve window events. /** * Any window-related event that might be processed has an appropriate callback * function object. Each callback function is called by the GUI event thread * whenever such an event is received. If a callback function in the delegate * is not initialized, a window simply ignores it. * * It must be noted that the callback functions are asynchronous and * not thread-safe. Thus, it is necessary to perform any additional synchronization * externally. */ class WindowDelegate { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Visibility Callback Functions /// A function object which is called whenever an attached window is made visible programmatically. /** * The delegate function may choose to return either a value of TRUE, indicating * that the open operation is allowed, or a value of FALSE, indicating that the * open operation should be ignored. */ Function<Bool ( Window& )> open; /// A function object which is called whenever an attached window attempts to be closed. /** * The delegate function may choose to return either a value of TRUE, indicating * that the close operation is allowed, or a value of FALSE, indicating that the * close operation should be ignored. */ Function<Bool ( Window& )> close; /// A function object which is called whenever an attached window gains or loses focus. /** * The boolean parameter indicates whether or not the window now has focus. A value * of TRUE indicates that the window just gained focus. A value of FALSE indicates * that the window just lost focus. */ Function<void ( Window&, Bool )> setFocus; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Sizing Callback Functions /// A function object which is called whenever an attached window is resized programmatically. /** * The delegate function may choose to return either a value of TRUE, indicating * that the change in size is allowed, or a value of FALSE, indicating that the * change in size should be ignored. * * The window provides the desired new size of the window as a (width, height) pair. */ Function<Bool ( Window&, const Size2D& )> resize; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Positioning Callback Functions /// A function object which is called whenever an attached window is moved programmatically. /** * The delegate function may choose to return either a value of TRUE, indicating * that the change in position is allowed, or a value of FALSE, indicating that the * change in position should be ignored. * * The window provides the desired new position of the window as a 2D vector. */ Function<Bool ( Window&, const Vector2i& )> move; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** User Input Callback Functions /// A function object called whenever an attached window receives a keyboard event. Function<void ( Window&, const input::KeyboardEvent& )> keyEvent; /// A function object called whenever an attached window receives a mouse-motion event. Function<void ( Window&, const input::MouseMotionEvent& )> mouseMotionEvent; /// A function object called whenever an attached window receives a mouse-button event. Function<void ( Window&, const input::MouseButtonEvent& )> mouseButtonEvent; /// A function object called whenever an attached window receives a mouse-wheel event. Function<void ( Window&, const input::MouseWheelEvent& )> mouseWheelEvent; }; //########################################################################################## //*************************** End Rim GUI Namespace ******************************** RIM_GUI_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_GUI_ELEMENT_WINDOW_DELEGATE_H <file_sep>/* * rimGraphicsHardwareBufferAccessType.h * Rim Graphics * * Created by <NAME> on 1/9/11. * Copyright 2011 Rim Software. All rights reserved. * */ #ifndef INCLUDE_RIM_GRAPHICS_HARDWARE_BUFFER_ACCESS_TYPE_H #define INCLUDE_RIM_GRAPHICS_HARDWARE_BUFFER_ACCESS_TYPE_H #include "rimGraphicsBuffersConfig.h" //########################################################################################## //*********************** Start Rim Graphics Buffers Namespace *************************** RIM_GRAPHICS_BUFFERS_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class which specifies the allowed type of access to a HardwareBuffer. /** * An instance of this class is used as a hint to the GPU indicating how * a HardwareBuffer can be accessed. For instance, READ access allows the * GPU to continue to use the buffer for rendering when it is being accessed. It * is best to specify the minimum necessary access privilages, only use READ or * WRITE access unless you need to read from and write to the buffer simultaneously. */ class HardwareBufferAccessType { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Hardware Attribute Buffer Access Type Enum Definition /// An enum type which specifies the type of HardwareBuffer access. typedef enum Enum { /// An access type which allows read-only access to a HardwareBuffer. READ = (1 << 0), /// An access type which allows write-only access to a HardwareBuffer. WRITE = (1 << 1), /// An access type which allows read and write access to a HardwareBuffer. READ_WRITE = READ | WRITE }; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructors /// Create a new hardware attribute buffer access type with the specified access type enum value. RIM_INLINE HardwareBufferAccessType( Enum newAccessType ) : type( newAccessType ) { } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Read/Write Status Accessor Method /// Return whether or not this access type object allows read access to a buffer. RIM_INLINE Bool canRead() const { return (type & READ) != 0; } /// Return whether or not this access type object allows write access to a buffer. RIM_INLINE Bool canWrite() const { return (type & WRITE) != 0; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Enum Cast Operator /// Convert this hardware attribute buffer access type to an enum value. RIM_INLINE operator Enum () const { return (Enum)type; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** String Representation Accessor Methods /// Return a string representation of the hardware attribute buffer access type. String toString() const; /// Convert this hardware attribute buffer access type into a string representation. RIM_FORCE_INLINE operator String () const { return this->toString(); } private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Members /// An enum for the hardware attribute buffer access type. UByte type; }; //########################################################################################## //*********************** End Rim Graphics Buffers Namespace ***************************** RIM_GRAPHICS_BUFFERS_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_GRAPHICS_HARDWARE_BUFFER_ACCESS_TYPE_H <file_sep>/* * rimMemberFunction.h * Rim Framework * * Created by <NAME> on 6/22/08. * Copyright 2008 Rim Software. All rights reserved. * */ #ifndef INCLUDE_RIM_MEMBER_FUNCTION_H #define INCLUDE_RIM_MEMBER_FUNCTION_H #include "../rimLanguageConfig.h" #include "rimFunctionDefinition.h" //########################################################################################## //*********************** Start Rim Language Internal Namespace ************************** RIM_LANGUAGE_INTERNAL_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class which wraps a member function pointer and object pointer of runtime type. /** * A MemberFunction object inherits from FunctionDefinition which defines a generic * interface for functions. This allows a MemberFunction to wrap objects of runtime * or virtual type and allow them to be handled as a standard non-member function. */ template < typename ObjectType, typename SignatureType, typename R, typename T1 = NullType, typename T2 = NullType, typename T3 = NullType, typename T4 = NullType, typename T5 = NullType, typename T6 = NullType, typename T7 = NullType, typename T8 = NullType, typename T9 = NullType, typename T10 = NullType > class MemberFunction : public FunctionDefinition< R, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10 > { private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Type Definitions /// The type of this member function's superclass. typedef FunctionDefinition< R, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10 > DefinitionType; /// The type of this member function class, defined here for brevity elsewhere. typedef MemberFunction< ObjectType, SignatureType, R, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10 > ThisType; public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructors /// Create a new member function object with the specified object and function pointer. RIM_INLINE MemberFunction( SignatureType newFunctionPointer, ObjectType* objectPointer ) : object( objectPointer ), functionPointer( newFunctionPointer ) { } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Function Call Operators /// Call a member function object with 0 parameters. RIM_INLINE R operator () () const { return (object->*functionPointer)(); } /// Call a member function object with 1 parameter. RIM_INLINE R operator () ( T1 p1 ) const { return (object->*functionPointer)( p1 ); } /// Call a member function object with 2 parameters. RIM_INLINE R operator () ( T1 p1, T2 p2 ) const { return (object->*functionPointer)( p1, p2 ); } /// Call a member function object with 3 parameters. RIM_INLINE R operator () ( T1 p1, T2 p2, T3 p3 ) const { return (object->*functionPointer)( p1, p2, p3 ); } /// Call a member function object with 4 parameters. RIM_INLINE R operator () ( T1 p1, T2 p2, T3 p3, T4 p4 ) const { return (object->*functionPointer)( p1, p2, p3, p4 ); } /// Call a member function object with 5 parameters. RIM_INLINE R operator () ( T1 p1, T2 p2, T3 p3, T4 p4, T5 p5 ) const { return (object->*functionPointer)( p1, p2, p3, p4, p5 ); } /// Call a member function object with 6 parameters. RIM_INLINE R operator () ( T1 p1, T2 p2, T3 p3, T4 p4, T5 p5, T6 p6 ) const { return (object->*functionPointer)( p1, p2, p3, p4, p5, p6 ); } /// Call a member function object with 7 parameters. RIM_INLINE R operator () ( T1 p1, T2 p2, T3 p3, T4 p4, T5 p5, T6 p6, T7 p7 ) const { return (object->*functionPointer)( p1, p2, p3, p4, p5, p6, p7 ); } /// Call a member function object with 8 parameters. RIM_INLINE R operator () ( T1 p1, T2 p2, T3 p3, T4 p4, T5 p5, T6 p6, T7 p7, T8 p8 ) const { return (object->*functionPointer)( p1, p2, p3, p4, p5, p6, p7, p8 ); } /// Call a member function object with 9 parameters. RIM_INLINE R operator () ( T1 p1, T2 p2, T3 p3, T4 p4, T5 p5, T6 p6, T7 p7, T8 p8, T9 p9 ) const { return (object->*functionPointer)( p1, p2, p3, p4, p5, p6, p7, p8, p9 ); } /// Call a member function object with 10 parameters. RIM_INLINE R operator () ( T1 p1, T2 p2, T3 p3, T4 p4, T5 p5, T6 p6, T7 p7, T8 p8, T9 p9, T10 p10 ) const { return (object->*functionPointer)( p1, p2, p3, p4, p5, p6, p7, p8, p9, p10 ); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Equality Comparison Operator /// Return whether or not this member function is exactly equal to another member function. /** * This method compares both the destination object pointer and the function * pointer when testing for equality. If both are equal for both objects, * the member functions are considered equal. */ virtual Bool equals( const DefinitionType& other ) const { const ThisType* memberFunction = (const ThisType*)&other; return functionPointer == memberFunction->functionPointer && object == memberFunction->object; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Clone Method /// Create and return a deep copy of this member function object. /** * This allows member functions to be copied constructed without knowing * the type of the destination object or function signature. */ virtual DefinitionType* clone() const { return util::construct<ThisType>( functionPointer, object ); } private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Members /// A pointer to the member function which this object is wrapping. SignatureType functionPointer; /// A pointer to the object for which the member function pointer will be called. ObjectType* object; }; //########################################################################################## //*********************** End Rim Language Internal Namespace **************************** RIM_LANGUAGE_INTERNAL_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_MEMBER_FUNCTION_H <file_sep>/* * rimPhysicsShapes.h * Rim Physics * * Created by <NAME> on 5/8/08. * Copyright 2008 Rim Software. All rights reserved. * */ #ifndef INCLUDE_RIM_PHYSICS_SHAPES_H #define INCLUDE_RIM_PHYSICS_SHAPES_H #include "rimPhysicsConfig.h" #include "shapes/rimPhysicsShapesConfig.h" #include "shapes/rimPhysicsCollisionShapeType.h" #include "shapes/rimPhysicsCollisionShapeMaterial.h" #include "shapes/rimPhysicsCollisionShape.h" #include "shapes/rimPhysicsCollisionShapeBase.h" #include "shapes/rimPhysicsCollisionShapeInstance.h" #include "shapes/rimPhysicsCollisionShapeSphere.h" #include "shapes/rimPhysicsCollisionShapeCylinder.h" #include "shapes/rimPhysicsCollisionShapeCapsule.h" #include "shapes/rimPhysicsCollisionShapeBox.h" #include "shapes/rimPhysicsCollisionShapeConvex.h" #include "shapes/rimPhysicsCollisionShapePlane.h" #include "shapes/rimPhysicsCollisionShapeMesh.h" #endif // INCLUDE_RIM_PHYSICS_SHAPES_H <file_sep>/* * rimPhysicsCollisionShapeConcave.h * Rim Physics * * Created by <NAME> on 7/6/12. * Copyright 2012 __MyCompanyName__. All rights reserved. * */ <file_sep>/* * rimBoundingSphere.h * Rim BVH * * Created by <NAME> on 5/19/10. * Copyright 2010 Rim Software. All rights reserved. * */ #ifndef INCLUDE_RIM_BOUNDING_SPHERE_H #define INCLUDE_RIM_BOUNDING_SPHERE_H #include "rimBVHConfig.h" //########################################################################################## //***************************** Start Rim BVH Namespace ********************************** RIM_BVH_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class which represents a sphere that bounds a more complex geometric structure. /** * Typically, this class will be used as part of a bounding volume hierarchy to * bound complex point or triangle data. */ template < typename T > class BoundingSphere { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructors /// Create a BoundingSphere object that has a radius of 0 and a position centered at the origin. RIM_INLINE BoundingSphere() : position(), radius( 0 ) { } /// Create a BoundingSphere object with the specified center position and radius. /** * @param newPosition - the position of the center of the BoundingSphere in 3D space. * @param newRadius - the radius of the BoundingSphere. */ RIM_INLINE BoundingSphere( const Vector3D<T>& newPosition, T newRadius ) : position( newPosition ), radius( newRadius ) { } /// Create a BoundingSphere object which tightly bounds the specified 3 points in space. /** * Typically, this constructor is used to easily create a bounding sphere for a triangle * when constructing a bounding volume hierarchy. * * @param a - a point that should be enclosed by the BoundingSphere. * @param b - a point that should be enclosed by the BoundingSphere. * @param c - a point that should be enclosed by the BoundingSphere. */ BoundingSphere( const Vector3D<T>& a, const Vector3D<T>& b, const Vector3D<T>& c ); /// Create a BoundingSphere object which encloses all of the points in the specified list. /** * This constructor uses an implementation-defined method of generating a bounding sphere * for an arbitrary set of points in 3D space. The resulting sphere is not guaranteed to * be a minimal bounding sphere but should offer a reasonably-tight fit of the input * point set. If the number of input points is 0, the resulting BoundingSphere will * be a sphere of 0 radius centered at the origin. * * @param points - the points which this bounding sphere should enclose. */ BoundingSphere( const ArrayList< Vector3D<T> >& points ); /// Create a BoundingSphere object which encloses all of the points in the specified array. /** * This constructor uses an implementation-defined method of generating a bounding sphere * for an arbitrary set of points in 3D space. The resulting sphere is not guaranteed to * be a minimal bounding sphere but should offer a reasonably-tight fit of the input * point set. The constructor uses numPoints sequential points from the array of input points * to construct the bounding sphere. If the number of input points is 0 or the point array * is NULL, the resulting BoundingSphere will be a sphere of 0 radius centered at the origin. * * @param points - a pointer to an array of input point data. * @param numPoints - the number of sequential points to use from the point array. */ BoundingSphere( const Vector3D<T>* points, Size numPoints ); /// Create a BoundingSphere object which encloses the two given bounding spheres. /** * This constructor uses an implementation-defined method of generating a bounding sphere * for an arbitrary set of points in 3D space. The resulting sphere is not guaranteed to * be a minimal bounding sphere but should offer a reasonably-tight fit of the input * point set. The constructor uses numPoints sequential points from the array of input points * to construct the bounding sphere. If the number of input points is 0 or the point array * is NULL, the resulting BoundingSphere will be a sphere of 0 radius centered at the origin. * * @param points - a pointer to an array of input point data. * @param numPoints - the number of sequential points to use from the point array. */ RIM_INLINE BoundingSphere( const BoundingSphere& sphere1, const BoundingSphere& sphere2 ) { BoundingSphere both = sphere1 + sphere2; position = both.position; radius = both.radius; } /// Create a copy of a BoundingSphere object with another templated type. /** * @param other - the bounding sphere object which should be copied. */ template < typename U > RIM_INLINE BoundingSphere( const BoundingSphere<U>& other ) : radius( other.radius ), position( other.position ) { } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Assignment Operator /// Assign a BoundingSphere object with another templated type to this bounding sphere. /** * @param other - the bounding sphere object which should be copied. */ template < typename U > RIM_INLINE BoundingSphere& operator = ( const BoundingSphere<U>& other ) { position = other.position; radius = (T)other.radius; return *this; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Intersection Test Method /// Return whether or not this BoundingSphere intersects another. /** * If the spheres intersect, TRUE is returned. Otherwise, FALSE is * returned. * * @param sphere - the sphere to test for intersection with this BoundingSphere. * @return whether or not this BoundingSphere intersects another. */ RIM_FORCE_INLINE Bool intersects( const BoundingSphere& sphere ) const { register T distanceSquared = position.getDistanceToSquared( sphere.position ); register T radii = radius + sphere.radius; return distanceSquared < radii*radii; } /// Return whether or not this bounding sphere is intersected by the specified ray. RIM_FORCE_INLINE Bool intersects( const Ray3D<T>& ray ) const { Vector3D<T> d = position - ray.origin; T dSquared = d.getMagnitudeSquared(); T rSquared = radius*radius; if ( dSquared < rSquared ) { // The ray starts inside the sphere and therefore we have an intersection. return true; } else { // Find the closest point on the ray to the sphere's center. T t1 = math::dot( d, ray.direction ); if ( t1 < T(0) ) { // The ray points away from the sphere so there is no intersection. return false; } // Find the distance from the closest point to the sphere's surface. T t2Squared = rSquared - dSquared + t1*t1; if ( t2Squared < T(0) ) return false; return true; } } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Bounding Sphere Enlargement Methods /// Enlarge this bounding sphere so that it encloses both its original volume and the new sphere. RIM_INLINE void enlargeFor( const BoundingSphere& other ) { // Compute the vector from the child's bounding sphere to current bounding sphere. Vector3D<T> v = other.position - position; T distanceSquared = v.getMagnitudeSquared(); T radiusDiff = other.radius - radius; if ( distanceSquared < radiusDiff*radiusDiff ) { // The other bounding sphere completely contains the previous bounding sphere. if ( other.radius > radius ) { position = other.position; radius = other.radius; } } else { // the other sphere is outside the previous bounding sphere. Resize the bounding // sphere to fit the other sphere. T distance = math::sqrt( distanceSquared ); T newRadius = (distance + other.radius + radius)*T(0.5); if ( distance > math::epsilon<T>() ) position += v*((newRadius - radius) / distance); radius = newRadius; } } /// Enlarge this bounding sphere so that it encloses both its original volume and the given point. RIM_INLINE void enlargeFor( const Vector3D<T>& point ) { // Compute the vector from the child's bounding sphere to current bounding sphere. Vector3D<T> v = point - position; T distanceSquared = v.getMagnitudeSquared(); if ( distanceSquared > radius*radius ) { // the point is outside the previous bounding sphere. Resize the bounding // sphere to enclose the point. T distance = math::sqrt( distanceSquared ); T newRadius = (distance + radius)*T(0.5); position += v*((newRadius - radius) / distance); radius = newRadius; } } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Bounding Sphere Union Operator /// Compute the union of this bounding sphere with another. /** * The resulting BoundingSphere object is guaranteed to tightly * bound both the L-value BoundingSphere object as well as the R-value * BoundingSphere. * * @param sphere - the sphere to union with this BoundingSphere. * @return a BoundingSphere which encloses both spheres. */ BoundingSphere operator + ( const BoundingSphere& sphere ) const { // Compute the squared distance between the sphere centers. Vector3D<T> d = sphere.position - position; T distanceSquared = d.getMagnitudeSquared(); T radiusDiff = sphere.radius - radius; if ( radiusDiff*radiusDiff > distanceSquared ) { // The sphere with the larger radius encloses the other. // Return the larger of these two spheres. if ( sphere.radius > radius ) return sphere; else return *this; } else { // The spheres are partially overlapping or disjoint. T distance = math::sqrt(distanceSquared); T newRadius = (distance + radius + sphere.radius) * T(0.5); return BoundingSphere( distance > math::epsilon<T>() ? position + ((newRadius - radius) / distance)*d : position, newRadius ); } } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Public Data Members /// The position of the center of this BoundingSphere. Vector3D<T> position; /// The radius of this BoundingSphere. T radius; private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Helper Methods /// Compute the approximate bounding sphere for the specified array of points. RIM_FORCE_INLINE static void computeApproximateBoundingSphere( const Vector3D<T>* points, Size numPoints, Vector3D<T>& position, T& radius ); /// Compute the exact bounding sphere for three points. RIM_FORCE_INLINE static void computeTriangleBoundingSphere( const Vector3D<T>& a, const Vector3D<T>& b, const Vector3D<T>& c, Vector3D<T>& position, T& radius ); }; //########################################################################################## //***************************** End Rim BVH Namespace ************************************ RIM_BVH_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_BOUNDING_SPHERE_H <file_sep>/* * rimGraphicsSystem.h * Rim Software * * Created by <NAME> on 6/21/14. * Copyright 2014 __MyCompanyName__. All rights reserved. * */ #ifndef INCLUDE_RIM_ENGINE_GRAPHICS_SYSTEM_H #define INCLUDE_RIM_ENGINE_GRAPHICS_SYSTEM_H #include "rimEngineConfig.h" //########################################################################################## //*************************** Start Rim Engine Namespace ********************************* RIM_ENGINE_NAMESPACE_START //****************************************************************************************** //########################################################################################## class GraphicsSystem : public EntitySystem { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructors /// Create a new empty graphics system with no entities and no rendering pipeline. GraphicsSystem(); /// Create a new empty graphics system that uses the specified graphics pipeline for rendering. GraphicsSystem( const Pointer<GraphicsPipeline>& newPipeline ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Update Method /// Update the state of all entities in this system for the specified time interval. virtual void update( const Time& dt, EntityEngine* engine = NULL ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Pipeline Accessor Methods /// Return a pointer to the graphics pipeline that this system is using. RIM_INLINE const Pointer<GraphicsPipeline>& getPipeline() const { return pipeline; } /// Set the graphics pipeline that this system is using. RIM_INLINE void setPipeline( const Pointer<GraphicsPipeline>& newPipeline ) { pipeline = newPipeline; } private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Members /// A pointer to the graphics pipeline that this system is using. Pointer<GraphicsPipeline> pipeline; }; //########################################################################################## //*************************** End Rim Engine Namespace *********************************** RIM_ENGINE_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_ENGINE_GRAPHICS_SYSTEM_H <file_sep>/* * rimImageTranscoder.h * Rim Engine * * Created by <NAME> on 2/2/08. * Copyright 2008 Rim Software. All rights reserved. * */ #ifndef INCLUDE_RIM_IMAGE_TRANSCODER_H #define INCLUDE_RIM_IMAGE_TRANSCODER_H #include "rimImageIOConfig.h" #include "rimImageFormat.h" #include "rimImageEncodingParameters.h" //########################################################################################## //*************************** Start Rim Image IO Namespace ******************************* RIM_IMAGE_IO_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// An interface for an object which decodes and encodes images. /** * The purpose of this interface is to provide a common interface * for classes which provide functionality to encode and decode * images to and from their format and a simpler representation in memory. * * In general, one uses the encoding functionality by passing in a * reference to an image object already existing in memory to the encode() function. * The job of the encoder is then to covert the image object to an encoded * stream of bytes, represented by a Data object. * * Similarly, the decode() method takes a data object and outputs an image object. * Finally, the last method, canDecode(), takes as a parameter a reference to a * data object and returns whether or not this data represents an encoded image that * the decoder can decode. */ class ImageTranscoder : public ResourceTranscoder<Image> { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Format Accessor Methods /// Return an object which represents the resource type that this transcoder can read and write. virtual ResourceType getResourceType() const; /// Return an object which represents the format that this transcoder can encode and decode. virtual ImageFormat getFormat() const = 0; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Image Encoding Methods /// Return whether or not this transcoder is able to encode the specified image. virtual Bool canEncode( const Image& image ) const; /// Return whether or not the specified image can be encoded using this transcoder. /** * If TRUE is returned, the image is in a format that is compatible with this * transcoder. Otherwise, the image is not compatible and cannot be encoded. */ RIM_INLINE Bool canEncode( const Image& image, const ImageEncodingParameters& parameters ) const { if ( !image.isValid() ) return false; return this->canEncode( image.getPixelData().getPointer(), image.getPixelFormat(), image.getWidth(), image.getHeight(), parameters ); } /// Return whether or not the specified image can be encoded using this transcoder. /** * The image is specified by a pointer to pixel data, dimensions, and pixel type. * * If TRUE is returned, the image is in a format that is compatible with this * transcoder. Otherwise, the image is not compatible and cannot be encoded. */ virtual Bool canEncode( const UByte* pixelData, const PixelFormat& pixelType, Size width, Size height, const ImageEncodingParameters& parameters = ImageEncodingParameters() ) const = 0; /// Encode the specified image and send the output to the specified data output stream. /** * If the encoding succeeds, the encoded image data is sent to the * data output stream and TRUE is returned. Otherwise, FALSE is returned * and no data is sent to the stream. */ RIM_INLINE Bool encode( const Image& image, DataOutputStream& stream, const ImageEncodingParameters& parameters = ImageEncodingParameters() ) const { if ( !image.isValid() ) return false; return this->encode( image.getPixelData().getPointer(), image.getPixelFormat(), image.getWidth(), image.getHeight(), stream, parameters ); } /// Encode the specified image and place the output in the specified Data object. /** * If the encoding succeeds, the encoded image data is placed in the * Data object and TRUE is returned. Otherwise, FALSE is returned * and no data is placed in the Data object. */ Bool encode( const Image& image, Data& data, const ImageEncodingParameters& parameters = ImageEncodingParameters() ) const; /// Encode the specified image and place the output in the specified data pointer. /** * If the encoding succeeds, the function allocates the necessary output data * array and places the pointer to that array in the output data pointer reference, * the number of bytes in the output array is placed in the numBytes output reference, * and TRUE is returned. Otherwise, FALSE is returned and no data is * placed in the output references. */ RIM_INLINE Bool encode( const Image& image, UByte*& outputData, Size& numBytes, const ImageEncodingParameters& parameters = ImageEncodingParameters() ) const { if ( !image.isValid() ) return false; return this->encode( image.getPixelData().getPointer(), image.getPixelFormat(), image.getWidth(), image.getHeight(), outputData, numBytes, parameters ); } /// Encode the specified image and place the output in the specified data pointer. /** * The image is specified by a pointer to pixel data, dimensions, and pixel type. * * If the encoding succeeds, the function allocates the necessary output data * array and places the pointer to that array in the output data pointer reference, * the number of bytes in the output array is placed in the numBytes output reference, * and TRUE is returned. Otherwise, FALSE is returned and no data is * placed in the output references. */ virtual Bool encode( const UByte* pixelData, const PixelFormat& pixelType, Size width, Size height, UByte*& outputData, Size& numBytes, const ImageEncodingParameters& parameters = ImageEncodingParameters() ) const = 0; /// Encode the specified image and send the output to the specified data output stream. /** * The image is specified by a pointer to pixel data, dimensions, and pixel type. * * If the encoding succeeds, the encoded image data is sent to the * data output stream and TRUE is returned. Otherwise, FALSE is returned * and no data is sent to the stream. */ virtual Bool encode( const UByte* pixelData, const PixelFormat& pixelType, Size width, Size height, DataOutputStream& stream, const ImageEncodingParameters& parameters = ImageEncodingParameters() ) const = 0; /// Save the specified image at the specified ID location. /** * The method returns whether or not the resource was successfully written. */ virtual Bool encode( const ResourceID& identifier, const Image& image ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Image Decoding Methods /// Return whether or not the specified identifier refers to a valid image format for this transcoder. /** * If the identifier represents a valid image format, TRUE is returned. Otherwise, * if the resource is not valid, FALSE is returned. */ virtual Bool canDecode( const ResourceID& identifier ) const; /// Return whether or not the specified data can be decode using this transcoder. /** * The transcoder examines the specified data and determines if the data specifies * a valid image in the transcoder's format. If so, TRUE is returned. * Otherwise, FALSE is returned. */ RIM_INLINE Bool canDecode( const Data& data ) const { return this->canDecode( data.getPointer(), data.getSizeInBytes() ); } /// Return whether or not the specified data can be decode using this transcoder. /** * The transcoder examines the specified data and determines if the data specifies * a valid image in the transcoder's format. If so, TRUE is returned. * Otherwise, FALSE is returned. */ virtual Bool canDecode( const UByte* inputData, Size inputDataSizeInBytes ) const = 0; /// Decode the specified data and return an image. /** * The image is returned in the specified output image reference. * * If the decoding succeeds, the function creates an image and places * it in the image output reference paramter and TRUE is returned. * Otherwise, if the decoding fails, FALSE is returned. */ RIM_INLINE Bool decode( const Data& data, Image& image ) const { return this->decode( data.getPointer(), data.getSizeInBytes(), image ); } /// Decode the specified data and return an image. /** * The image is returned as a pointer to pixel data, dimensions, and * pixel type, all given as reference parameters. * * If the decoding succeeds, the function creates an image and places * it in the image output reference paramter and TRUE is returned. * Otherwise, if the decoding fails, FALSE is returned. */ RIM_INLINE Bool decode( const Data& data, UByte*& pixelData, PixelFormat& pixelType, Size& width, Size& height ) const { return this->decode( data.getPointer(), data.getSizeInBytes(), pixelData, pixelType, width, height ); } /// Decode the data from the specified data pointer and return an image. /** * The image is returned in the specified output image reference. * * If the decoding succeeds, the function creates an image and places * it in the image output reference paramter and TRUE is returned. * Otherwise, if the decoding fails, FALSE is returned. */ Bool decode( const UByte* inputData, Size inputDataSizeInBytes, Image& image ) const; /// Decode the data from the specified data pointer and return an image. /** * The image is returned as a pointer to pixel data, dimensions, and * pixel type, all given as reference parameters. * * The decoding method can use the in/out parameter pixelType to hint at the * desired pixel format for the output image. The decoder should try to match * this format as closely as possible without degrading image quality. * * If the decoding succeeds, the function allocates the necessary space * for the image's pixel data and places the pointer to that data * in the output pixel data reference, along with the image's dimensions * and pixel type, and TRUE is returned. Otherwise, if the decoding fails, * FALSE is returned. */ virtual Bool decode( const UByte* inputData, Size inputDataSizeInBytes, UByte*& pixelData, PixelFormat& pixelType, Size& width, Size& height ) const = 0; /// Decode the data from the specified DataInputStream and return an image. /** * The image is returned in the specified output image reference. * * If the decoding succeeds, the function creates an image and places * it in the image output reference paramter and TRUE is returned. * Otherwise, if the decoding fails, FALSE is returned. */ Bool decode( DataInputStream& stream, Image& image ) const; /// Decode the data from the specified DataInputStream and return an image. /** * The image is returned as a pointer to pixel data, dimensions, and * pixel type, all given as reference parameters. * * The decoding method can use the in/out parameter pixelType to hint at the * desired pixel format for the output image. The decoder should try to match * this format as closely as possible without degrading image quality. * * If the decoding succeeds, the function allocates the necessary space * for the image's pixel data and places the pointer to that data * in the output pixel data reference, along with the image's dimensions * and pixel type, and TRUE is returned. Otherwise, if the decoding fails, * FALSE is returned. */ virtual Bool decode( DataInputStream& stream, UByte*& pixelData, PixelFormat& pixelType, Size& width, Size& height ) const = 0; /// Load the image pointed to by the specified identifier. /** * The caller can supply a pointer to a resource manager which can be used * to manage the creation of child resources. * * If the method fails, the return value will be NULL. */ virtual Pointer<Image> decode( const ResourceID& identifier, ResourceManager* manager = NULL ); private: }; //########################################################################################## //*************************** End Rim Image IO Namespace ********************************* RIM_IMAGE_IO_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_IMAGE_TRANSCODER_H <file_sep>/* * rimGraphicsGUIOptionMenuDelegate.h * Rim Graphics GUI * * Created by <NAME> on 2/18/13. * Copyright 2013 Headspace Systems. All rights reserved. * */ #ifndef INCLUDE_RIM_GRAPHICS_GUI_OPTION_MENU_DELEGATE_H #define INCLUDE_RIM_GRAPHICS_GUI_OPTION_MENU_DELEGATE_H #include "rimGraphicsGUIConfig.h" //########################################################################################## //************************ Start Rim Graphics GUI Namespace ****************************** RIM_GRAPHICS_GUI_NAMESPACE_START //****************************************************************************************** //########################################################################################## class OptionMenu; //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class which contains function objects that recieve option menu events. /** * Any option-menu-related event that might be processed has an appropriate callback * function object. Each callback function is called by the option menu * whenever such an event is received. If a callback function in the delegate * is not initialized, an option menu simply ignores it. */ class OptionMenuDelegate { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Menu Delegate Callback Functions /// A function object which is called whenever an attached option menu is opened by the user. Function<void ( OptionMenu& menu )> open; /// A function object which is called whenever an attached option menu is closed by the user. Function<void ( OptionMenu& menu )> close; /// A function object which is called whenever an item with the given index is selected by the user. Function<void ( OptionMenu& menu, Index itemIndex )> selectItem; }; //########################################################################################## //************************ End Rim Graphics GUI Namespace ******************************** RIM_GRAPHICS_GUI_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_GRAPHICS_GUI_OPTION_MENU_DELEGATE_H <file_sep>/* * rimGraphicsDepthTest.h * Rim Graphics * * Created by <NAME> on 3/13/13. * Copyright 2013 __MyCompanyName__. All rights reserved. * */ #ifndef INCLUDE_RIM_GRAPHICS_DEPTH_TEST_H #define INCLUDE_RIM_GRAPHICS_DEPTH_TEST_H #include "rimGraphicsUtilitiesConfig.h" //########################################################################################## //********************** Start Rim Graphics Utilities Namespace ************************** RIM_GRAPHICS_UTILITIES_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class which specifies the operation performed when testing a new depth fragment. /** * If the depth test succeeds, the fragment is rendered. Otherwise, the fragment * is discarded and rendering for the fragment stops. */ class DepthTest { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Depth Test Enum Definition /// An enum type which represents the type of depth test. typedef enum Enum { /// A depth test where the test never succeeds (no fragments ever pass or update the depth buffer). NEVER = 0, /// A depth test where the test always succeeds (all fragments pass and update the depth buffer). ALWAYS = 1, /// A depth test where the test succeeds if the source and destination depths are equal. EQUAL = 2, /// A depth test where the test succeeds if the source and destination depths are not equal. NOT_EQUAL = 3, /// A depth test where the test succeeds if the new depth is less than the existing depth. LESS_THAN = 4, /// A depth test where the test succeeds if the new depth is less than or equal to the existing depth. LESS_THAN_OR_EQUAL = 5, /// A depth test where the test succeeds if the new depth is greater than the existing depth. GREATER_THAN = 6, /// A depth test where the test succeeds if the new depth is greater than or equal to the existing depth. GREATER_THAN_OR_EQUAL = 7 }; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructors /// Create a new depth test with the specified depth test enum value. RIM_INLINE DepthTest( Enum newTest ) : test( newTest ) { } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Enum Cast Operator /// Convert this depth test type to an enum value. RIM_INLINE operator Enum () const { return (Enum)test; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** String Representation Accessor Methods /// Return a depth test enum which corresponds to the given enum string. static DepthTest fromEnumString( const String& enumString ); /// Return a unique string for this depth test that matches its enum value name. String toEnumString() const; /// Return a string representation of the depth test. String toString() const; /// Convert this depth test into a string representation. RIM_FORCE_INLINE operator String () const { return this->toString(); } private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Members /// An enum value which indicates the type of depth test. UByte test; }; //########################################################################################## //********************** End Rim Graphics Utilities Namespace **************************** RIM_GRAPHICS_UTILITIES_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_GRAPHICS_DEPTH_TEST_H <file_sep>/* * rimGraphicsAnimation.h * Rim Software * * Created by <NAME> on 3/19/14. * Copyright 2014 __MyCompanyName__. All rights reserved. * */ #ifndef INCLUDE_RIM_GRAPHICS_ANIMATION_H #define INCLUDE_RIM_GRAPHICS_ANIMATION_H #include "animation/rimGraphicsAnimationConfig.h" #include "animation/rimGraphicsInterpolationType.h" #include "animation/rimGraphicsAnimationTrackUsage.h" #include "animation/rimGraphicsAnimationTrack.h" #include "animation/rimGraphicsAnimationSampler.h" #include "animation/rimGraphicsAnimationTarget.h" #include "animation/rimGraphicsAnimationController.h" // Animation Targets #include "animation/rimGraphicsConstantAnimationTarget.h" #include "animation/rimGraphicsTransformableAnimationTarget.h" #endif // INCLUDE_RIM_GRAPHICS_ANIMATION_H <file_sep>/* * rimPhysicsCollision.h * Rim Physics * * Created by <NAME> on 5/8/08. * Copyright 2008 Rim Software. All rights reserved. * */ #ifndef INCLUDE_RIM_PHYSICS_COLLISION_H #define INCLUDE_RIM_PHYSICS_COLLISION_H #include "rimPhysicsConfig.h" #include "collision/rimPhysicsCollisionConfig.h" #include "collision/rimPhysicsCollisionAlgorithm.h" #include "collision/rimPhysicsCollisionAlgorithmBase.h" #include "collision/rimPhysicsCollisionAlgorithmDispatcher.h" #include "collision/rimPhysicsCollisionPair.h" #include "collision/rimPhysicsCollisionManifold.h" #include "collision/rimPhysicsCollisionResultSet.h" #include "collision/rimPhysicsCollisionDetector.h" #include "collision/rimPhysicsCollisionDetectorSimple.h" #include "collision/rimPhysicsCollisionDetectorOctree.h" #include "collision/rimPhysicsCollisionAlgorithmSphereVsSphere.h" #include "collision/rimPhysicsCollisionAlgorithmGJK.h" #include "collision/rimPhysicsCollisionAlgorithmsGJK.h" #include "collision/rimPhysicsCollisionAlgorithmFunction.h" #include "collision/rimPhysicsCollisionAlgorithmFunctions.h" #include "collision/rimPhysicsCollisionAlgorithmSphereVsMesh.h" //########################################################################################## //********************** Start Rim Physics Collision Namespace *************************** RIM_PHYSICS_COLLISION_NAMESPACE_START //****************************************************************************************** //########################################################################################## //########################################################################################## //********************** End Rim Physics Collision Namespace ***************************** RIM_PHYSICS_COLLISION_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_PHYSICS_COLLISION_H <file_sep>/* * rimPhysicsCollisionAlgorithmFunctions.h * Rim Physics * * Created by <NAME> on 7/6/12. * Copyright 2012 __MyCompanyName__. All rights reserved. * */ #ifndef INCLUDE_RIM_PHYSICS_COLLISION_ALGORITHM_FUNCTIONS_H #define INCLUDE_RIM_PHYSICS_COLLISION_ALGORITHM_FUNCTIONS_H #include "rimPhysicsCollisionConfig.h" #include "rimPhysicsCollisionAlgorithmFunction.h" #include "rimPhysicsCollisionAlgorithmsGJK.h" //########################################################################################## //********************** Start Rim Physics Collision Namespace *************************** RIM_PHYSICS_COLLISION_NAMESPACE_START //****************************************************************************************** //########################################################################################## //########################################################################################## //########################################################################################## //############ //############ Plane vs Sphere Intersection Detection Functions //############ //########################################################################################## //########################################################################################## RIM_INLINE Bool getPlaneVsSphereIntersection( const CollisionShapePlane::Instance* plane, const CollisionShapeSphere::Instance* sphere, IntersectionPoint& point ) { // Get the projection of the sphere's position onto the plane. Vector3 projection = plane->getPlane().getProjectionNormalized( sphere->getPosition() ); // The vector from the plane projection to the sphere's center. Vector3 d = sphere->getPosition() - projection; // The squared distance from the sphere's center to the plane projection. Real distanceSquared = d.getMagnitudeSquared(); if ( distanceSquared < sphere->getRadius()*sphere->getRadius() ) { Real distance = math::sqrt( distanceSquared ); point.point1 = projection; point.point2 = sphere->getPosition() - plane->getNormal()*sphere->getRadius(); point.normal = plane->getNormal(); point.penetrationDistance = sphere->getRadius() - distance; return true; } return false; } RIM_INLINE Bool getSphereVsPlaneIntersection( const CollisionShapeSphere::Instance* sphere, const CollisionShapePlane::Instance* plane, IntersectionPoint& point ) { Bool result = getPlaneVsSphereIntersection( plane, sphere, point ); if ( result ) point.reverse(); return result; } //########################################################################################## //########################################################################################## //############ //############ Plane vs Capsule Intersection Detection Functions //############ //########################################################################################## //########################################################################################## RIM_INLINE Bool getPlaneVsCapsuleIntersection( const CollisionShapePlane::Instance* plane, const CollisionShapeCapsule::Instance* capsule, IntersectionPoint& point ) { // Compute the closest point on the capsule to the plane. Vector3 closestPoint = getCapsuleSupportPoint( -plane->getNormal(), capsule ); // Compute the distance to the closest capsule point. Real distance = plane->getPlane().getSignedDistanceTo( closestPoint ); if ( distance < Real(0) ) { point.point1 = plane->getPlane().getProjectionNormalized( closestPoint ); point.point2 = closestPoint; point.normal = plane->getNormal(); point.penetrationDistance = -distance; return true; } return false; } RIM_INLINE Bool getCapsuleVsPlaneIntersection( const CollisionShapeCapsule::Instance* capsule, const CollisionShapePlane::Instance* plane, IntersectionPoint& point ) { Bool result = getPlaneVsCapsuleIntersection( plane, capsule, point ); if ( result ) point.reverse(); return result; } //########################################################################################## //########################################################################################## //############ //############ Plane vs Cylinder Intersection Detection Functions //############ //########################################################################################## //########################################################################################## RIM_INLINE Bool getPlaneVsCylinderIntersection( const CollisionShapePlane::Instance* plane, const CollisionShapeCylinder::Instance* cylinder, IntersectionPoint& point ) { // Compute the closest point on the cylinder to the plane. Vector3 closestPoint = getCylinderSupportPoint( -plane->getNormal(), cylinder ); // Compute the distance to the closest cylinder point. Real distance = plane->getPlane().getSignedDistanceTo( closestPoint ); if ( distance < Real(0) ) { point.point1 = plane->getPlane().getProjectionNormalized( closestPoint ); point.point2 = closestPoint; point.normal = plane->getNormal(); point.penetrationDistance = -distance; return true; } return false; } RIM_INLINE Bool getCylinderVsPlaneIntersection( const CollisionShapeCylinder::Instance* cylinder, const CollisionShapePlane::Instance* plane, IntersectionPoint& point ) { Bool result = getPlaneVsCylinderIntersection( plane, cylinder, point ); if ( result ) point.reverse(); return result; } //########################################################################################## //########################################################################################## //############ //############ Plane vs Box Intersection Detection Functions //############ //########################################################################################## //########################################################################################## RIM_INLINE Bool getPlaneVsBoxIntersection( const CollisionShapePlane::Instance* plane, const CollisionShapeBox::Instance* box, IntersectionPoint& point ) { // Compute the closest point on the box to the plane. Vector3 closestPoint = getBoxSupportPoint( -plane->getNormal(), box ); // Compute the distance to the closest box point. Real distance = plane->getPlane().getSignedDistanceTo( closestPoint ); if ( distance < Real(0) ) { point.point1 = plane->getPlane().getProjectionNormalized( closestPoint ); point.point2 = closestPoint; point.normal = plane->getNormal(); point.penetrationDistance = -distance; return true; } return false; } RIM_INLINE Bool getBoxVsPlaneIntersection( const CollisionShapeBox::Instance* box, const CollisionShapePlane::Instance* plane, IntersectionPoint& point ) { Bool result = getPlaneVsBoxIntersection( plane, box, point ); if ( result ) point.reverse(); return result; } //########################################################################################## //########################################################################################## //############ //############ Plane vs Convex Intersection Detection Functions //############ //########################################################################################## //########################################################################################## RIM_INLINE Bool getPlaneVsConvexIntersection( const CollisionShapePlane::Instance* plane, const CollisionShapeConvex::Instance* convex, IntersectionPoint& point ) { // Compute the closest point on the convex shape to the plane. Vector3 closestPoint = getConvexSupportPoint( -plane->getNormal(), convex ); // Compute the distance to the closest convex shape point. Real distance = plane->getPlane().getSignedDistanceTo( closestPoint ); if ( distance < Real(0) ) { point.point1 = plane->getPlane().getProjectionNormalized( closestPoint ); point.point2 = closestPoint; point.normal = plane->getNormal(); point.penetrationDistance = -distance; return true; } return false; } RIM_INLINE Bool getConvexVsPlaneIntersection( const CollisionShapeConvex::Instance* convex, const CollisionShapePlane::Instance* plane, IntersectionPoint& point ) { Bool result = getPlaneVsConvexIntersection( plane, convex, point ); if ( result ) point.reverse(); return result; } //########################################################################################## //########################################################################################## //############ //############ Sphere vs Box Intersection Detection Functions //############ //########################################################################################## //########################################################################################## RIM_INLINE Bool getSphereVsBoxIntersection( const CollisionShapeSphere::Instance* sphere, const CollisionShapeBox::Instance* box, IntersectionPoint& point ) { return util::sphereIntersectsBox( sphere->getPosition(), sphere->getRadius(), box->getPosition(), box->getOrientation(), box->getSize(), point ); } RIM_INLINE Bool getBoxVsSphereIntersection( const CollisionShapeBox::Instance* box, const CollisionShapeSphere::Instance* sphere, IntersectionPoint& point ) { Bool result = util::sphereIntersectsBox( sphere->getPosition(), sphere->getRadius(), box->getPosition(), box->getOrientation(), box->getSize(), point ); if ( result ) point.reverse(); return result; } //########################################################################################## //########################################################################################## //############ //############ Sphere vs Cylinder Intersection Detection Functions //############ //########################################################################################## //########################################################################################## RIM_INLINE Bool getSphereVsCylinderIntersection( const CollisionShapeSphere::Instance* sphere, const CollisionShapeCylinder::Instance* cylinder, IntersectionPoint& point ) { return util::sphereIntersectsCylinder( sphere->getPosition(), sphere->getRadius(), cylinder->getEndpoint1(), cylinder->getAxis(), cylinder->getHeight(), cylinder->getRadius1(), cylinder->getRadius2(), point ); } RIM_INLINE Bool getCylinderVsSphereIntersection( const CollisionShapeCylinder::Instance* cylinder, const CollisionShapeSphere::Instance* sphere, IntersectionPoint& point ) { Bool result = util::sphereIntersectsCylinder( sphere->getPosition(), sphere->getRadius(), cylinder->getEndpoint1(), cylinder->getAxis(), cylinder->getHeight(), cylinder->getRadius1(), cylinder->getRadius2(), point ); if ( result ) point.reverse(); return result; } //########################################################################################## //########################################################################################## //############ //############ Plane Vs. Shape Algorithm Declarations //############ //########################################################################################## //########################################################################################## /// A class which detects collisions between two Rigid Objects with plane and sphere shapes. typedef CollisionAlgorithmFunction<CollisionShapePlane,CollisionShapeSphere, CollisionShapePlane::Instance,CollisionShapeSphere::Instance, getPlaneVsSphereIntersection> CollisionAlgorithmPlaneVsSphere; /// A class which detects collisions between two Rigid Objects with plane and capsule shapes. typedef CollisionAlgorithmFunction<CollisionShapePlane,CollisionShapeCapsule, CollisionShapePlane::Instance,CollisionShapeCapsule::Instance, getPlaneVsCapsuleIntersection> CollisionAlgorithmPlaneVsCapsule; /// A class which detects collisions between two Rigid Objects with plane and cylinder shapes. typedef CollisionAlgorithmFunction<CollisionShapePlane,CollisionShapeCylinder, CollisionShapePlane::Instance,CollisionShapeCylinder::Instance, getPlaneVsCylinderIntersection> CollisionAlgorithmPlaneVsCylinder; /// A class which detects collisions between two Rigid Objects with plane and box shapes. typedef CollisionAlgorithmFunction<CollisionShapePlane,CollisionShapeBox, CollisionShapePlane::Instance,CollisionShapeBox::Instance, getPlaneVsBoxIntersection> CollisionAlgorithmPlaneVsBox; /// A class which detects collisions between two Rigid Objects with plane and convex shapes. typedef CollisionAlgorithmFunction<CollisionShapePlane,CollisionShapeConvex, CollisionShapePlane::Instance,CollisionShapeConvex::Instance, getPlaneVsConvexIntersection> CollisionAlgorithmPlaneVsConvex; //########################################################################################## //########################################################################################## //############ //############ Sphere Vs. Shape Algorithm Declarations //############ //########################################################################################## //########################################################################################## /// A class which detects collisions between two Rigid Objects with sphere and plane shapes. typedef CollisionAlgorithmFunction<CollisionShapeSphere,CollisionShapePlane, CollisionShapeSphere::Instance,CollisionShapePlane::Instance, getSphereVsPlaneIntersection> CollisionAlgorithmSphereVsPlane; /// A class which detects collisions between two Rigid Objects with sphere and cylinder shapes. typedef CollisionAlgorithmFunction<CollisionShapeSphere,CollisionShapeCylinder, CollisionShapeSphere::Instance,CollisionShapeCylinder::Instance, getSphereVsCylinderIntersection> CollisionAlgorithmSphereVsCylinder; /// A class which detects collisions between two Rigid Objects with sphere and box shapes. typedef CollisionAlgorithmFunction<CollisionShapeSphere,CollisionShapeBox, CollisionShapeSphere::Instance,CollisionShapeBox::Instance, getSphereVsBoxIntersection> CollisionAlgorithmSphereVsBox; //########################################################################################## //########################################################################################## //############ //############ Capsule Vs. Shape Algorithm Declarations //############ //########################################################################################## //########################################################################################## /// A class which detects collisions between two Rigid Objects with plane and capsule shapes. typedef CollisionAlgorithmFunction<CollisionShapeCapsule,CollisionShapePlane, CollisionShapeCapsule::Instance,CollisionShapePlane::Instance, getCapsuleVsPlaneIntersection> CollisionAlgorithmCapsuleVsPlane; //########################################################################################## //########################################################################################## //############ //############ Cylinder Vs. Shape Algorithm Declarations //############ //########################################################################################## //########################################################################################## /// A class which detects collisions between two Rigid Objects with cylinder and plane shapes. typedef CollisionAlgorithmFunction<CollisionShapeCylinder,CollisionShapePlane, CollisionShapeCylinder::Instance,CollisionShapePlane::Instance, getCylinderVsPlaneIntersection> CollisionAlgorithmCylinderVsPlane; /// A class which detects collisions between two Rigid Objects with sphere and cylinder shapes. typedef CollisionAlgorithmFunction<CollisionShapeCylinder,CollisionShapeSphere, CollisionShapeCylinder::Instance,CollisionShapeSphere::Instance, getCylinderVsSphereIntersection> CollisionAlgorithmCylinderVsSphere; //########################################################################################## //########################################################################################## //############ //############ Box Vs. Shape Algorithm Declarations //############ //########################################################################################## //########################################################################################## /// A class which detects collisions between two Rigid Objects with box and sphere shapes. typedef CollisionAlgorithmFunction<CollisionShapeBox,CollisionShapeSphere, CollisionShapeBox::Instance,CollisionShapeSphere::Instance, getBoxVsSphereIntersection> CollisionAlgorithmBoxVsSphere; /// A class which detects collisions between two Rigid Objects with box and plane shapes. typedef CollisionAlgorithmFunction<CollisionShapeBox,CollisionShapePlane, CollisionShapeBox::Instance,CollisionShapePlane::Instance, getBoxVsPlaneIntersection> CollisionAlgorithmBoxVsPlane; //########################################################################################## //########################################################################################## //############ //############ Convex Vs. Shape Algorithm Declarations //############ //########################################################################################## //########################################################################################## /// A class which detects collisions between two Rigid Objects with plane and convex shapes. typedef CollisionAlgorithmFunction<CollisionShapeConvex,CollisionShapePlane, CollisionShapeConvex::Instance,CollisionShapePlane::Instance, getConvexVsPlaneIntersection> CollisionAlgorithmConvexVsPlane; //########################################################################################## //********************** End Rim Physics Collision Namespace ***************************** RIM_PHYSICS_COLLISION_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_PHYSICS_COLLISION_ALGORITHM_FUNCTIONS_H <file_sep>/* * rimGraphicsRenderersConfig.h * Rim Graphics * * Created by <NAME> on 5/16/12. * Copyright 2012 __MyCompanyName__. All rights reserved. * */ #ifndef INCLUDE_RIM_GRAPHICS_RENDERERS_CONFIG_H #define INCLUDE_RIM_GRAPHICS_RENDERERS_CONFIG_H #include "../rimGraphicsConfig.h" #include "../rimGraphicsBase.h" #include "../rimGraphicsScenes.h" //########################################################################################## //########################################################################################## //############ //############ Library Namespace Configuration //############ //########################################################################################## //########################################################################################## #ifndef RIM_GRAPHICS_RENDERERS_NAMESPACE_START #define RIM_GRAPHICS_RENDERERS_NAMESPACE_START RIM_GRAPHICS_NAMESPACE_START namespace renderers { #endif #ifndef RIM_GRAPHICS_RENDERERS_NAMESPACE_END #define RIM_GRAPHICS_RENDERERS_NAMESPACE_END }; RIM_GRAPHICS_NAMESPACE_END #endif //########################################################################################## //********************** Start Rim Graphics Renderers Namespace ************************** RIM_GRAPHICS_RENDERERS_NAMESPACE_START //****************************************************************************************** //########################################################################################## using rim::graphics::shapes::Skeleton; using rim::graphics::shapes::MeshChunk; using namespace rim::graphics::lights; using namespace rim::graphics::cameras; using namespace rim::graphics::scenes; using namespace rim::graphics::objects; using rim::graphics::devices::GraphicsContext; using rim::graphics::textures::ShadowMap; //########################################################################################## //********************** End Rim Graphics Renderers Namespace **************************** RIM_GRAPHICS_RENDERERS_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_GRAPHICS_RENDERERS_CONFIG_H <file_sep>/* * rimGraphicsScenesConfig.h * Rim Graphics * * Created by <NAME> on 5/16/12. * Copyright 2012 __MyCompanyName__. All rights reserved. * */ #ifndef INCLUDE_RIM_GRAPHICS_SCENES_CONFIG_H #define INCLUDE_RIM_GRAPHICS_SCENES_CONFIG_H #include "../rimGraphicsConfig.h" #include "../rimGraphicsUtilities.h" #include "../rimGraphicsCameras.h" #include "../rimGraphicsLights.h" #include "../rimGraphicsObjects.h" #include "../rimGraphicsAnimation.h" //########################################################################################## //########################################################################################## //############ //############ Library Namespace Configuration //############ //########################################################################################## //########################################################################################## #ifndef RIM_GRAPHICS_SCENES_NAMESPACE_START #define RIM_GRAPHICS_SCENES_NAMESPACE_START RIM_GRAPHICS_NAMESPACE_START namespace scenes { #endif #ifndef RIM_GRAPHICS_SCENES_NAMESPACE_END #define RIM_GRAPHICS_SCENES_NAMESPACE_END }; RIM_GRAPHICS_NAMESPACE_END #endif //########################################################################################## //************************ Start Rim Graphics Scenes Namespace *************************** RIM_GRAPHICS_SCENES_NAMESPACE_START //****************************************************************************************** //########################################################################################## using rim::graphics::objects::GraphicsObject; using rim::graphics::objects::ObjectCuller; using rim::graphics::lights::Light; using rim::graphics::lights::LightCuller; using rim::graphics::cameras::Camera; using rim::graphics::animation::AnimationController; //########################################################################################## //************************ End Rim Graphics Scenes Namespace ***************************** RIM_GRAPHICS_SCENES_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_GRAPHICS_SCENES_CONFIG_H <file_sep>/* * rimGraphicsScissorTest.h * Rim Graphics * * Created by <NAME> on 3/17/13. * Copyright 2013 __MyCompanyName__. All rights reserved. * */ #ifndef INCLUDE_RIM_GRAPHICS_SCISSOR_TEST_H #define INCLUDE_RIM_GRAPHICS_SCISSOR_TEST_H #include "rimGraphicsUtilitiesConfig.h" #include "rimGraphicsViewport.h" //########################################################################################## //********************** Start Rim Graphics Utilities Namespace ************************** RIM_GRAPHICS_UTILITIES_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class which specifies the configuration of the scissor test clipping pipeline. /** * A scissor test is defined by a rectangular region of the screen where rendering * should occur, excluding all other areas. Incoming primitives are clipped to the * region. */ class ScissorTest { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructors /// Create a default stencil test with an empty viewport and disabled status. RIM_INLINE ScissorTest() : viewport(), enabled( false ) { } /// Create a new scissor test with the specified viewport and enable status. RIM_INLINE ScissorTest( const Viewport& newViewport, Bool newIsEnabled = true ) : viewport( newViewport ), enabled( newIsEnabled ) { } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Viewport Accessor Methods /// Return a reference to the viewport which this scissor test is clipping geometry to. RIM_INLINE const Viewport& getViewport() const { return viewport; } /// Set the viewport which this scissor test is clipping geometry to. RIM_INLINE void setViewport( const Viewport& newViewport ) { viewport = newViewport; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Scissor Test Enable Status /// Return whether or not the scissor test is enabled. RIM_INLINE Bool getIsEnabled() const { return enabled; } /// SEt whether or not the scissor test is enabled. RIM_INLINE void setIsEnabled( Bool newIsEnabled ) { enabled = newIsEnabled; } private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Members /// The viewport which is being clipped to by the scissor test. Viewport viewport; /// A boolean value indicating whether or not the scissor test is enabled. Bool enabled; }; //########################################################################################## //********************** End Rim Graphics Utilities Namespace **************************** RIM_GRAPHICS_UTILITIES_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_GRAPHICS_SCISSOR_TEST_H <file_sep>/* * rimGraphicsAnimationTrack.h * Rim Software * * Created by <NAME> on 6/24/14. * Copyright 2014 __MyCompanyName__. All rights reserved. * */ #ifndef INCLUDE_RIM_GRAPHICS_ANIMATION_TRACK_H #define INCLUDE_RIM_GRAPHICS_ANIMATION_TRACK_H #include "rimGraphicsAnimationConfig.h" #include "rimGraphicsInterpolationType.h" #include "rimGraphicsAnimationTrackUsage.h" //########################################################################################## //********************** Start Rim Graphics Animation Namespace ************************** RIM_GRAPHICS_ANIMATION_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class that contains a sequence of animation samples. class AnimationTrack { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructors /// Create an empty animation track. AnimationTrack(); /// Create an animation track with the specified buffers, interpolation type, and usage. /** * The times and values buffers should be the same length and the time buffer should * be a floating point scalar format. */ AnimationTrack( const Pointer<GenericBuffer>& newTimes, const Pointer<GenericBuffer>& newValues, const InterpolationType& newInterpolationType = InterpolationType::LINEAR, const AnimationTrackUsage& newUsage = AnimationTrackUsage::UNDEFINED ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Track Length Accessor Methods /// Return the length of this animation track in seconds. /** * The length is determined by the time value of the last sample point * in the track. */ Time getLength() const; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Sample Accessor Methods /// Return the number of valid samples there are in this animation track. /** * The returned value is the minimum size of either the time value * buffer or the animated value buffer. */ RIM_INLINE Size getSampleCount() const { return math::min( times.isSet() ? times->getSize() : Size(0), values.isSet() ? values->getSize() : Size(0) ); } /// Return the time value at the specified sample index in this track. /** * The time is returned in the output parameter. * The method returns whether or not the time access operation was successful. * The method can fail if the sample index is invalid or if the time buffer is * not valid. */ Bool getTime( Index sampleIndex, Time& time ) const; /// Get the animation value at the specified index in this track. /** * The animated value is returned in the output parameter. * The method returns whether or not the value access operation was successful. * The method can fail if the sample index is invalid or if the value buffer is * not valid. */ Bool getValue( Index sampleIndex, AttributeValue& value ) const; /// Get the sample at the specified index in this track. /** * The time value and animated value are returned in the output parameters. * The method returns whether or not the sample access operation was successful. * The method can fail if the sample index is invalid or if the track buffers are * not valid. */ Bool getSample( Index sampleIndex, Time& time, AttributeValue& value ) const; /// Add a new sample to the end of this animation track. /** * In order for animation to work correctly, time values must be monotonically * increasing. If this is not the case, the user should call sortSamples() to * sort the samples after the track is finished. * * The new sample is added at the first unused index in the internal time and value buffers. * If one buffer is shorter than the other, the new sample is added at the first * unfilled index in either buffer. If either buffer is NULL, new buffers are created * to hold the sample data of the same type as the specified value. * * The method returns whether or not the sample add operation was successful. * The method can fail if the specified value does not have the same type as * this track. */ Bool addSample( const Time& time, const AttributeValue& value ); /// Add a new sample to the end of this animation track. /** * In order for animation to work correctly, time values must be monotonically * increasing. If this is not the case, the user should call sortSamples() to * sort the samples after the track is finished. * * The new sample is added at the first unused index in the internal time and value buffers. * If one buffer is shorter than the other, the new sample is added at the first * unfilled index in either buffer. If either buffer is NULL, new buffers are created * to hold the sample data of the same type as the specified value. * * The method returns whether or not the sample add operation was successful. * The method can fail if the specified value does not have the same type as * this track. */ template < typename ValueType > RIM_NO_INLINE Bool addSample( const Time& time, const ValueType& value ) { AttributeType::check<ValueType>(); // Create a new value buffer if necessary. if ( values.isNull() ) values = Pointer<GenericBuffer>::construct( AttributeType::get<ValueType>(), 8 ); else if ( values->getAttributeType() != AttributeType::get<ValueType>() ) return false; // Create a new time buffer if necessary. if ( times.isNull() ) times = Pointer<GenericBuffer>::construct( AttributeType::get<Float>(), 8 ); // Determine the index where the new sample should be placed. const Size index = this->getSampleCount(); // Add the time value. if ( times->getSize() == index ) times->add( Float(time) ); else times->set( index, Float(time) ); // Add the animated value. if ( values->getSize() == index ) values->add( value ); else values->set( index, value ); return true; } /// Remove the sample at the specified index in this animation track. /** * This method copies all samples after that index to the previous * index. The method returns whether or not the sample at that index was able to * be removed. */ Bool removeSample( Index sampleIndex ); /// Clear all samples from this animation track's buffers. void clearSamples(); /// Ensure that the samples are sorted by increasing time value if they are not already. void sortSamples(); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Usage Accessor Methods /// Return an object that indicates the semantic usage of this animation track. RIM_INLINE const AnimationTrackUsage& getUsage() const { return usage; } /// Set the semantic usage of this animation track. RIM_INLINE void setUsage( const AnimationTrackUsage& newUsage ) { usage = newUsage; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Interpolation Type Accessor Methods /// Return an object that indicates the interpolation type of this animation track. RIM_INLINE const InterpolationType& getInterpolationType() const { return interpolationType; } /// Set the interpolation type of this animation track. RIM_INLINE void setInterpolationType( const InterpolationType& newInterpolationType ) { interpolationType = newInterpolationType; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Attribute Type Accessor Methods /// Return an object that indicates the type of attributes that this track contains. RIM_INLINE const AttributeType& getAttributeType() const { return values.isSet() ? values->getAttributeType() : AttributeType::UNDEFINED; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Name Accessor Methods /// Return the name of this animation track. RIM_INLINE const String& getName() const { return name; } /// Set the name of this animation track. RIM_INLINE void setName( const String& newName ) { name = newName; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Track Status Accessor Methods /// Return whether or not this animation track has a valid state. /** * In order for a track to be valid, it must have sequences * of times and values, where the time values are scalar and have * a 1 to 1 correspondence with the animated values. */ Bool isValid() const; private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Helper Methods template < typename TimeType > void sortBuffers(); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Members /// A string representing the human-readable name of this animation track. String name; /// An enum object indicating the semantic usage of this animation track. AnimationTrackUsage usage; /// An enum object indicating how this track should be interpolated. InterpolationType interpolationType; /// A pointer to a buffer of time samples for this animation track. Pointer<GenericBuffer> times; /// A pointer to a buffer of animated values for this track. Pointer<GenericBuffer> values; }; //########################################################################################## //********************** End Rim Graphics Animation Namespace **************************** RIM_GRAPHICS_ANIMATION_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_GRAPHICS_ANIMATION_TRACK_H <file_sep>/* * rimGUIButton.h * Rim GUI * * Created by <NAME> on 9/25/12. * Copyright 2012 __MyCompanyName__. All rights reserved. * */ #ifndef INCLUDE_RIM_GUI_BUTTON_H #define INCLUDE_RIM_GUI_BUTTON_H #include "rimGUIConfig.h" #include "rimGUIWindowElement.h" #include "rimGUIButtonDelegate.h" //########################################################################################## //*************************** Start Rim GUI Namespace ****************************** RIM_GUI_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class which represents a rectangular region that responds to mouse click events. class Button : public WindowElement { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructors /// Create a new text field which uses the specified text label, size, and position. Button( const UTF8String& buttonText, const Size2D& newSize, const Vector2i& newPosition ); /// Create a new text field which uses the specified image label, size, and position. //Button( const Image& buttonImage, const Size2D& newSize, const Vector2i& newPosition ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Destructor /// Destroy a button, releasing all resources associated with it. ~Button(); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Text Accessor Methods /// Return a string that represents the text label for this button. UTF8String getText() const; /// Set a string that represents the text label for this button. /** * The method returns whether or not the text change operation was successful. */ Bool setText( const UTF8String& newText ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Size Accessor Methods /// Return a 2D vector indicating the size on the screen of this button in pixels. virtual Size2D getSize() const; /// Set the size on the screen of this text field in pixels. /** * The method returns whether or not the size change operation was * successful. */ virtual Bool setSize( const Size2D& size ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Position Accessor Methods /// Return the 2D position of this text field in pixels, relative to the bottom left corner. /** * The coordinate position is defined relative to its enclosing coordinate frame * where the origin will be the bottom left corner of the enclosing view or window. */ virtual Vector2i getPosition() const; /// Set the 2D position of this text field in pixels, relative to the bottom left corner. /** * The coordinate position is defined relative to its enclosing coordinate frame * where the origin will be the bottom left corner of the enclosing view or window. * * If the position change operation is successful, TRUE is returned and the text field is * moved. Otherwise, FALSE is returned and the text field is not moved. */ virtual Bool setPosition( const Vector2i& position ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** State Accessor Methods /// Return whether or not this button is currently pressed. Bool getIsPressed() const; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Delegate Accessor Methods /// Return a const reference to the object which responds to events for this button. const ButtonDelegate& getDelegate() const; /// Set the object to which button events should be delegated. void setDelegate( const ButtonDelegate& newDelegate ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Parent Window Accessor Methods /// Return the window which is a parent of this button. /** * If NULL is returned, it indicates that the button is not part of a window. */ virtual Window* getParentWindow() const; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Platform-Specific Element Pointer Accessor Method /// Return a pointer to platform-specific data for this button. /** * On Mac OS X, this method returns a pointer to a subclass of NSButton * which represents the button. * * On Windows, this method returns an HWND indicating the 'window' which * represents the button. */ virtual void* getInternalPointer() const; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Static Shared Construction Methods /// Create a shared-pointer button object, calling the constructor with the same arguments. RIM_INLINE static Pointer<Button> construct( const UTF8String& newText, const Size2D& newSize, const Vector2i& newPosition ) { return Pointer<Button>( util::construct<Button>( newText, newSize, newPosition ) ); } public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Wrapper Class Declaration /// A class which wraps platform-specific data for a button. class Wrapper; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Parent Accessor Methods /// Set the window which is going to be a parent of this button. /** * Setting this value to NULL should indicate that the button is no longer * part of a window. */ virtual void setParentWindow( Window* parentWindow ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Members /// A pointer to an object which wraps platform-specific data for this button. Wrapper* wrapper; }; //########################################################################################## //*************************** End Rim GUI Namespace ******************************** RIM_GUI_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_GUI_BUTTON_H <file_sep>/* * rimGUIInputKeyboardEvent.h * Rim GUI * * Created by <NAME> on 1/30/08. * Copyright 2008 __MyCompanyName__. All rights reserved. * */ #ifndef INCLUDE_RIM_GUI_INPUT_KEYBOARD_EVENT_H #define INCLUDE_RIM_GUI_INPUT_KEYBOARD_EVENT_H #include "rimGUIInputConfig.h" //########################################################################################## //************************ Start Rim GUI Input Namespace *************************** RIM_GUI_INPUT_NAMESPACE_START //****************************************************************************************** //########################################################################################## class Key; //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class which encapsulates an event that occurrs whenever a key's state is changed. class KeyboardEvent { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructor /// Create a new keyboard event for the specified key and pressed-state. RIM_INLINE KeyboardEvent( const Key& newKey, Bool newIsAPress ) : key( newKey ), pressed( newIsAPress ) { } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Event Key Accessor Methods /// Return a const reference to the key which this keyboard event is associated with. RIM_INLINE const Key& getKey() const { return key; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Event Status Accessor Methods /// Get whether or not the key was pressed. RIM_INLINE Bool isAPress() const { return pressed; } /// Get whether or not the key was released. RIM_INLINE Bool isARelease() const { return !pressed; } private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Members /// A const reference to a Key object that represents the key whose state was changed. const Key& key; /// A boolean flag indicating whether or not the keyboard event was a press or a release event. Bool pressed; }; //########################################################################################## //************************ End Rim GUI Input Namespace ***************************** RIM_GUI_INPUT_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_GUI_INPUT_KEYBOARD_EVENT_H <file_sep>/* * rimPhysicsForce.h * Rim Physics * * Created by <NAME> on 11/28/09. * Copyright 2009 Rim Software. All rights reserved. * */ #ifndef INCLUDE_RIM_PHYSICS_FORCE_H #define INCLUDE_RIM_PHYSICS_FORCE_H #include "rimPhysicsForcesConfig.h" //########################################################################################## //************************ Start Rim Physics Forces Namespace **************************** RIM_PHYSICS_FORCES_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// The interface for all classes that apply forces (and torques) to simulated objects. class Force { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Virtual Destructor /// Destory this force object. RIM_INLINE virtual ~Force() { } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Force Application Method /// Apply force vectors to all objects that this Force effects. /** * These force vectors should be based on the internal configuration * of the force system. */ virtual void applyForces( Real dt ) = 0; }; //########################################################################################## //************************ End Rim Physics Forces Namespace ****************************** RIM_PHYSICS_FORCES_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_PHYSICS_FORCE_H <file_sep>/* * rimGraphicsGenericBufferList.h * Rim Software * * Created by <NAME> on 11/28/13. * Copyright 2013 __MyCompanyName__. All rights reserved. * */ #ifndef INCLUDE_RIM_GRAPHICS_GENERIC_BUFFER_LIST_H #define INCLUDE_RIM_GRAPHICS_GENERIC_BUFFER_LIST_H #include "rimGraphicsBuffersConfig.h" #include "rimGraphicsGenericBuffer.h" #include "rimGraphicsVertexUsage.h" //########################################################################################## //*********************** Start Rim Graphics Buffers Namespace *************************** RIM_GRAPHICS_BUFFERS_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class which encapsulates a set of generic buffers associated with VertexUsage types. /** * This class allows the user to provide external vertex data to a ShaderPass * without having to modify the buffer bindings of the shader pass. This is useful when * a shader pass is shared among many objects that may each have different vertex * buffers. * * At render time, an object's generic buffer list is used to provide vertex data * to the shader pass with which it is being rendered by connecting the VertexUsage * of each buffer with shader inputs of the same usage types. */ class GenericBufferList { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructors /// Create a new empty generic buffer list. GenericBufferList(); /// Create an exact copy of the another generic buffer list. GenericBufferList( const GenericBufferList& other ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Destructor /// Destroy a generic buffer list and release all internal state. ~GenericBufferList(); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Assignment Operator /// Assign the contents of another generic buffer list to this one. GenericBufferList& operator = ( const GenericBufferList& other ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Vertex Buffer Accessor Methods /// Return the number of generic buffers in this generic buffer list. RIM_INLINE Size getBufferCount() const { return buffers.getSize(); } /// Return a pointer to the buffer with the specified index in this buffer list. /** * If an invalid index is specified, a NULL pointer is returned. */ RIM_INLINE Pointer<GenericBuffer> getBuffer( Index bufferIndex ) const { if ( bufferIndex < buffers.getSize() ) return buffers[bufferIndex].buffer; else return Pointer<GenericBuffer>(); } /// Return an object indicating the usage of the buffer with the specified index in this buffer list. /** * If an invalid index is specified, a VertexUsage::UNDEFINED is returned. */ RIM_INLINE VertexUsage getBufferUsage( Index bufferIndex ) const { if ( bufferIndex < buffers.getSize() ) return buffers[bufferIndex].usage; else return VertexUsage::UNDEFINED; } /// Return a pointer to the generic buffer with the specified usage in this generic buffer list. Pointer<GenericBuffer> getBufferWithUsage( const VertexUsage& usage ) const; /// Return whether or not there is a generic buffer with the specified usage in this generic buffer list. Bool hasBufferWithUsage( const VertexUsage& usage ) const; /// Add a generic buffer with the specified usage to this generic buffer list. Bool addBuffer( const Pointer<GenericBuffer>& newBuffer, const VertexUsage& newUsage = VertexUsage::UNDEFINED ); /// Add a generic buffer with the specified name and usage to this generic buffer list. Bool addBuffer( const Pointer<GenericBuffer>& newBuffer, const String& newName, const VertexUsage& newUsage ); /// Remove the first buffer with the specified address from this generic buffer list. /** * The method returns whether or not the buffer was successfully removed. */ Bool removeBuffer( const GenericBuffer* buffer ); /// Remove the first buffer with the specified usage from this generic buffer list. /** * The method returns whether or not the buffer was successfully removed. */ Bool removeBuffer( const VertexUsage& usage ); /// Clear all generic buffers from this generic buffer list. void clearBuffers(); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Size Accessor Methods /// Return the smallest capacity of the buffers within this generic buffer list. /** * This value is computed by taking the minimum capacity of all buffers * that the buffer list has which have data. If there are no buffers * in the list, the method returns 0. */ Size getMinimumCapacity() const; private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Vertex Buffer Enry Class Definition /// A class which stores information about a single generic buffer and its usage. class Entry { public: /// Create a new generic buffer entry with the specified buffer and usage. RIM_INLINE Entry( const Pointer<GenericBuffer>& newBuffer, const VertexUsage& newUsage ) : usage( newUsage ), buffer( newBuffer ), name() { } /// Create a new generic buffer entry with the specified buffer and usage. RIM_INLINE Entry( const Pointer<GenericBuffer>& newBuffer, const String& newName, const VertexUsage& newUsage ) : usage( newUsage ), buffer( newBuffer ), name( Pointer<String>::construct( newName ) ) { } /// An object representing the usage of this buffer. VertexUsage usage; /// A pointer to the buffer which this entry represents. Pointer<GenericBuffer> buffer; /// A pointer to a string representing the name of this buffer list entry. Pointer<String> name; }; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Members /// A list of the buffers that are part of this generic buffer. ArrayList<Entry> buffers; }; //########################################################################################## //*********************** End Rim Graphics Buffers Namespace ***************************** RIM_GRAPHICS_BUFFERS_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_GRAPHICS_GENERIC_BUFFER_LIST_H <file_sep>/* * rimSoundDeviceManagerDelegate.h * Rim Sound * * Created by <NAME> on 4/2/13. * Copyright 2013 __MyCompanyName__. All rights reserved. * */ #ifndef INCLUDE_RIM_SOUND_DEVICE_MANAGER_DELEGATE_H #define INCLUDE_RIM_SOUND_DEVICE_MANAGER_DELEGATE_H #include "rimSoundDevicesConfig.h" //########################################################################################## //************************ Start Rim Sound Devices Namespace ***************************** RIM_SOUND_DEVICES_NAMESPACE_START //****************************************************************************************** //########################################################################################## class SoundDeviceManager; class SoundDeviceID; //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class which contains function objects that recieve SoundDeviceManager events. /** * Any device-manager-related event that might be processed has an appropriate callback * function object. Each callback function is called by the device manager * whenever such an event is received. If a callback function in the delegate * is not initialized, the device manager simply ignores it. */ class SoundDeviceManagerDelegate { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Sound Device Manager Delegate Callback Functions /// A function object which is called whenever a new sound device is discovered by the system. /** * This callback is called whenever a new sound device is connected or added to the * system. This allows the user to use new sound devices as they are discovered. * * This method will be called from a separate thread (the audio processing thread) * so any data accessed in the callback function should use proper thread synchonization * to avoid unsafe access. */ Function<void ( SoundDeviceManager& manager, const SoundDeviceID& deviceID )> deviceAdded; /// A function object which is called whenever a sound device is removed from the system. /** * This callback is called whenever a sound device is disconnected or removed from the * system. This allows the user to know when devices are disconnected and to discontinue use * of those devices. * * This method will be called from a separate thread (the audio processing thread) * so any data accessed in the callback function should use proper thread synchonization * to avoid unsafe access. */ Function<void ( SoundDeviceManager& manager, const SoundDeviceID& deviceID )> deviceRemoved; }; //########################################################################################## //************************ End Rim Sound Devices Namespace ******************************* RIM_SOUND_DEVICES_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_SOUND_DEVICE_MANAGER_DELEGATE_H <file_sep>/* * rimPhysicsEPAResult.h * Rim Physics * * Created by <NAME> on 6/22/12. * Copyright 2012 __MyCompanyName__. All rights reserved. * */ #ifndef INCLUDE_RIM_PHYSICS_EPA_RESULT_H #define INCLUDE_RIM_PHYSICS_EPA_RESULT_H #include "rimPhysicsUtilitiesConfig.h" #include "rimPhysicsMinkowskiVertex.h" #include "rimPhysicsIntersectionPoint.h" //########################################################################################## //********************** Start Rim Physics Utilities Namespace *************************** RIM_PHYSICS_UTILITIES_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class which holds the results of the EPA algorithm. /** * The EPA algorithm returns the triangle that is closest to the surface of the * minkowski difference between the two convex shapes being tested. */ class EPAResult { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructor /// Create a new EPA result object with the specified triangle vertices and distance. RIM_INLINE EPAResult( const MinkowskiVertex3& newV1, const MinkowskiVertex3& newV2, const MinkowskiVertex3& newV3, Real newDistance ) : v1( newV1 ), v2( newV2 ), v3( newV3 ), distance( newDistance ) { } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Penetration Distance Accessor Method /// Return the positive penetration distance between the two shapes. RIM_INLINE Real getPenetrationDistance() const { return distance; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Collision Point Computation Method /// Return an intersection point, indicating the collision configuration of the two convex shapes in world space. /** * This method computes the points, normal, and distance of the intersection between * two convex shapes. * * These points are computed by projecting the origin in minkowski space * onto the closest EPA triangle and determining that point's barycentric * coordinates for the triangle. These barycentric coordinates are then * used to compute the resulting collision point on each object. */ IntersectionPoint getIntersectionPoint() const; private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Helper Methods /// Return the barycentric coordinates of the specified point for the given vertices. RIM_INLINE static Vector3 computeBarycentricCoordinates( const Vector3& v1, const Vector3& v2, const Vector3& v3, const Vector3& point ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Members /// The first vertex in the EPA result triangle. MinkowskiVertex3 v1; /// The first vertex in the EPA result triangle. MinkowskiVertex3 v2; /// The first vertex in the EPA result triangle. MinkowskiVertex3 v3; /// The distance of the resulting triangle from the origin in minkowski space. /** * This is also the positive penetration distance between the two convex shapes. */ Real distance; }; //########################################################################################## //********************** End Rim Physics Utilities Namespace ***************************** RIM_PHYSICS_UTILITES_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_PHYSICS_EPA_RESULT_H <file_sep>/* * rimGraphicsGUIImageView.h * Rim Graphics GUI * * Created by <NAME> on 2/13/13. * Copyright 2013 Headspace Systems. All rights reserved. * */ #ifndef INCLUDE_RIM_GRAPHICS_GUI_IMAGE_VIEW_H #define INCLUDE_RIM_GRAPHICS_GUI_IMAGE_VIEW_H #include "rimGraphicsGUIBase.h" #include "rimGraphicsGUIObject.h" //########################################################################################## //************************ Start Rim Graphics GUI Namespace ****************************** RIM_GRAPHICS_GUI_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class which represents a rectangular region that can be clicked on to perform an action. class ImageView : public GUIObject { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructors /// Create a new sizeless image view positioned at the origin of its coordinate system. ImageView(); /// Create a new image view which occupies the specified rectangle with no image. ImageView( const Rectangle& newRectangle ); /// Create a new image view which occupies the specified rectangle with the specified image. ImageView( const Rectangle& newRectangle, const Pointer<GUIImage>& newImage ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Image Accessor Methods /// Return a reference to the image which is displayed with this image view. RIM_INLINE const Pointer<GUIImage>& getImage() const { return image; } /// Set the image which is displayed with this image view. RIM_INLINE void setImage( const Pointer<GUIImage>& newImage ) { image = newImage; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Alignment Accessor Methods /// Return an object which describes how this image view's image is aligned within the view's area. RIM_INLINE const Origin& getAlignment() const { return alignment; } /// Set an object which describes how this image view's image is aligned within the view's area. RIM_INLINE void setAlignment( const Origin& newAlignment ) { alignment = newAlignment; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Border Accessor Methods /// Return a mutable object which describes this image view's border. RIM_INLINE Border& getBorder() { return border; } /// Return an object which describes this image view's border. RIM_INLINE const Border& getBorder() const { return border; } /// Set an object which describes this image view's border. RIM_INLINE void setBorder( const Border& newBorder ) { border = newBorder; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Content Bounding Box Accessor Methods /// Return the 3D bounding box for the image view's content display area in its local coordinate frame. RIM_INLINE AABB3f getLocalContentBounds() const { return AABB3f( this->getLocalContentBoundsXY(), AABB1f( Float(0), this->getSize().z ) ); } /// Return the 2D bounding box for the image view's content display area in its local coordinate frame. RIM_INLINE AABB2f getLocalContentBoundsXY() const { return border.getContentBounds( AABB2f( Vector2f(), this->getSizeXY() ) ); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Background Color Accessor Methods /// Return the background color for this image view's main area. RIM_INLINE const Color4f& getBackgroundColor() const { return backgroundColor; } /// Set the background color for this image view's main area. RIM_INLINE void setBackgroundColor( const Color4f& newBackgroundColor ) { backgroundColor = newBackgroundColor; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Border Color Accessor Methods /// Return the border color used when rendering an image view. RIM_INLINE const Color4f& getBorderColor() const { return borderColor; } /// Set the border color used when rendering an image view. RIM_INLINE void setBorderColor( const Color4f& newBorderColor ) { borderColor = newBorderColor; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Image Color Accessor Methods /// Return the tint color for this image view's image. RIM_INLINE const Color4f& getImageColor() const { return imageColor; } /// Set the tint color for this image view's image. RIM_INLINE void setImageColor( const Color4f& newImageColor ) { imageColor = newImageColor; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Drawing Method /// Draw this object using the specified GUI renderer to the given parent coordinate system bounds. /** * The method returns whether or not the object was successfully drawn. * * The default implementation draws nothing and returns TRUE. */ virtual Bool drawSelf( GUIRenderer& renderer, const AABB3f& parentBounds ) const; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Static Construction Methods /// Construct a smart-pointer-wrapped instance of this class using the constructor with the given arguments. RIM_INLINE static Pointer<ImageView> construct() { return Pointer<ImageView>::construct(); } /// Construct a smart-pointer-wrapped instance of this class using the constructor with the given arguments. RIM_INLINE static Pointer<ImageView> construct( const Rectangle& newRectangle ) { return Pointer<ImageView>::construct( newRectangle ); } /// Construct a smart-pointer-wrapped instance of this class using the constructor with the given arguments. RIM_INLINE static Pointer<ImageView> construct( const Rectangle& newRectangle, const Pointer<GUIImage>& newImage ) { return Pointer<ImageView>::construct( newRectangle, newImage ); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Public Static Data Members /// The default border that is used for a button. static const Border DEFAULT_BORDER; /// The default alignment that is used for an image view's image within its content area. static const Origin DEFAULT_ALIGNMENT; /// The default background color that is used for an image view's area. static const Color4f DEFAULT_BACKGROUND_COLOR; /// The default border color that is used for a image view. static const Color4f DEFAULT_BORDER_COLOR; /// The default color to use to shade the image (multiply). static const Color4f DEFAULT_IMAGE_COLOR; private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Members /// An image which is displayed within the content rectangle of this image view. Pointer<GUIImage> image; /// An object which describes how the image is aligned within the view's area. Origin alignment; /// An object which describes the appearance of this image view's border. Border border; /// The background color for the image view's area. Color4f backgroundColor; /// The border color for the image view's area. Color4f borderColor; /// A color which is used to multiplicatively tint an image. Color4f imageColor; }; //########################################################################################## //************************ End Rim Graphics GUI Namespace ******************************** RIM_GRAPHICS_GUI_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_GRAPHICS_GUI_IMAGE_VIEW_H <file_sep>/* * rimSoundMonoMixer.h * Rim Sound * * Created by <NAME> on 12/11/12. * Copyright 2012 __MyCompanyName__. All rights reserved. * */ #ifndef INCLUDE_RIM_SOUND_MONO_MIXER_H #define INCLUDE_RIM_SOUND_MONO_MIXER_H #include "rimSoundFiltersConfig.h" #include "rimSoundFilter.h" //########################################################################################## //************************ Start Rim Sound Filters Namespace ***************************** RIM_SOUND_FILTERS_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class that mixes multiple input channels of audio to a single output channel. /** * The mono mixer applies a linear gain factor to the channels equal to (1/N) where * N is the number of channels in the input buffer. This prevent signal overload * when the channels have lots of things in phase with each other. */ class MonoMixer : public SoundFilter { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructors /// Create a new mono mixer. RIM_INLINE MonoMixer() : SoundFilter( 1, 1 ) { } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Filter Attribute Accessor Methods /// Return a human-readable name for this mono mixer. /** * The method returns the string "Mono Mixer". */ virtual UTF8String getName() const; /// Return the manufacturer name of this mono mixer. /** * The method returns the string "Headspace Sound". */ virtual UTF8String getManufacturer() const; /// Return an object representing the version of this mono mixer. virtual SoundFilterVersion getVersion() const; /// Return an object which describes the category of effect that this filter implements. /** * This method returns the value SoundFilterCategory::IMAGING. */ virtual SoundFilterCategory getCategory() const; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Public Static Property Objects /// A string indicating the human-readable name of this mono mixer. static const UTF8String NAME; /// A string indicating the manufacturer name of this mono mixer. static const UTF8String MANUFACTURER; /// An object indicating the version of this mono mixer. static const SoundFilterVersion VERSION; private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Filter Processing Method /// Mix the sound in the input buffer channels to the first channel of the output buffer. virtual SoundFilterResult processFrame( const SoundFilterFrame& inputFrame, SoundFilterFrame& outputFrame, Size numSamples ); }; //########################################################################################## //************************ End Rim Sound Filters Namespace ******************************* RIM_SOUND_FILTERS_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_SOUND_MONO_MIXER_H <file_sep>/* * rimSoundFilterParameterType.h * Rim Sound * * Created by <NAME> on 8/16/12. * Copyright 2012 __MyCompanyName__. All rights reserved. * */ #ifndef INCLUDE_RIM_SOUND_FILTER_PARAMETER_TYPE_H #define INCLUDE_RIM_SOUND_FILTER_PARAMETER_TYPE_H #include "rimSoundFiltersConfig.h" //########################################################################################## //************************ Start Rim Sound Filters Namespace ***************************** RIM_SOUND_FILTERS_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class which represents the actual type of a SoundFilter parameter. class FilterParameterType { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Parameter Type Enum Declaration /// An enum which specifies the allowed SoundFilter parameter types. typedef enum Enum { /// A undefined filter parameter type. UNDEFINED = 0, /// A filter parameter type which indicates a boolean parameter value. BOOLEAN = 1, /// A filter parameter type which indicates an integral parameter value. INTEGER = 2, /// A filter parameter type which is an enumeration of possible integer values. ENUMERATION = 3, /// A filter parameter type which indicates a single-precision parameter value. FLOAT = 4, /// A filter parameter type which indicates a double-precision parameter value. DOUBLE = 5, }; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructors /// Create a new filter parameter type object with an UNDEFINED parameter type. RIM_INLINE FilterParameterType() : type( (UByte)UNDEFINED ) { } /// Create a new filter parameter type object with the specified type enum value. RIM_INLINE FilterParameterType( Enum newType ) : type( (UByte)newType ) { } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Enum Cast Operator /// Convert this filter parameter type to an enum value. /** * This operator is provided so that the FilterParameterType object can be used * directly in a switch statement without the need to explicitly access * the underlying enum value. * * @return the enum representation of this parameter type. */ RIM_INLINE operator Enum () const { return (Enum)type; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** String Representation Accessor Methods /// Return a string representation of the parameter type. UTF8String toString() const; /// Convert this parameter type into a string representation. RIM_INLINE operator UTF8String () const { return this->toString(); } private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Members /// An enum value indicating the concrete type of a SoundFilter parameter. UByte type; }; //########################################################################################## //************************ End Rim Sound Filters Namespace ******************************* RIM_SOUND_FILTERS_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_SOUND_FILTER_PARAMETER_TYPE_H <file_sep>/* * rimFramework.h * Rim Framework * * Created by <NAME> on 12/28/08. * Copyright 2008 Rim Software. All rights reserved. * */ #ifndef INCLUDE_RIM_FRAMEWORK_H #define INCLUDE_RIM_FRAMEWORK_H #include "rimConfig.h" #include "rimUtilities.h" #include "rimLanguage.h" #include "rimExceptions.h" #include "rimData.h" #include "rimIO.h" #include "rimMath.h" #include "rimThreads.h" #include "rimTime.h" #include "rimResources.h" #include "rimAssetsBase.h" //########################################################################################## //******************************** Start Rim Namespace *********************************** RIM_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** // Utilities: using rim::util::Array; using rim::util::AlignedArray; using rim::util::StaticArray; using rim::util::ShortArray; using rim::util::ArrayList; using rim::util::ShortArrayList; using rim::util::StaticArrayList; using rim::util::LinkedList; using rim::util::HashMap; using rim::util::HashSet; using rim::util::Queue; using rim::util::Stack; using rim::util::PriorityQueue; //******************************************************************************** //******************************************************************************** //******************************************************************************** // Language: using rim::lang::Function; using rim::lang::bind; using rim::lang::FunctionCall; using rim::lang::bindCall; using rim::lang::Pointer; using rim::lang::Any; using rim::lang::Type; using rim::lang::Optional; using rim::lang::Tuple; using rim::lang::HalfFloat; using rim::lang::BigFloat; using rim::lang::PrimitiveType; //******************************************************************************** //******************************************************************************** //******************************************************************************** // Exceptions: using rim::exceptions::Exception; using rim::exceptions::IOException; //******************************************************************************** //******************************************************************************** //******************************************************************************** // Data: using rim::data::Buffer; using rim::data::String; using rim::data::UTF8String; using rim::data::UTF16String; using rim::data::UTF32String; using rim::data::StringIterator; using rim::data::UTF8StringIterator; using rim::data::UTF16StringIterator; using rim::data::UTF32StringIterator; using rim::data::StringBuffer; using rim::data::UTF8StringBuffer; using rim::data::UTF16StringBuffer; using rim::data::UTF32StringBuffer; using rim::data::Data; using rim::data::DataBuffer; using rim::data::DataStore; using rim::data::HashCode; //******************************************************************************** //******************************************************************************** //******************************************************************************** // File System: using rim::fs::Path; using rim::fs::File; using rim::fs::Directory; //******************************************************************************** //******************************************************************************** //******************************************************************************** // Input and Output: using rim::io::DataInputStream; using rim::io::DataOutputStream; using rim::io::StringInputStream; using rim::io::StringOutputStream; using rim::io::FileReader; using rim::io::FileWriter; using rim::io::PrintStream; using rim::io::Log; using rim::io::Console; //******************************************************************************** //******************************************************************************** //******************************************************************************** // Resources: using rim::resources::ResourceType; using rim::resources::ResourceFormat; using rim::resources::ResourceID; using rim::resources::ResourceLocalID; using rim::resources::Resource; using rim::resources::ResourceTranscoder; using rim::resources::ResourceManager; //******************************************************************************** //******************************************************************************** //******************************************************************************** // Time: using rim::time::Time; using rim::time::Timer; using rim::time::Date; //******************************************************************************** //******************************************************************************** //******************************************************************************** // Threads: using namespace rim::threads; using rim::threads::atomic::Atomic; //########################################################################################## //******************************** End Rim Namespace ************************************* RIM_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_FRAMEWORK_H <file_sep>/* * rimGraphicsGenericMaterial.h * Rim Graphics * * Created by <NAME> on 9/24/13. * Copyright 2013 __MyCompanyName__. All rights reserved. * */ #ifndef INCLUDE_RIM_GRAPHICS_GENERIC_MATERIAL_H #define INCLUDE_RIM_GRAPHICS_GENERIC_MATERIAL_H #include "rimGraphicsMaterialsConfig.h" #include "rimGraphicsGenericMaterialTechnique.h" //########################################################################################## //********************** Start Rim Graphics Materials Namespace ************************** RIM_GRAPHICS_MATERIALS_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class which contains a set of techniques for drawing the visual appearance of an object. /** * Each technique represents a particular way of drawing an object. A material is * a set of techniques, where each technique is associated with a usage type. * The usage allows the renderer to pick the correct technique to render * an object. */ class GenericMaterial { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructors /// Create an empty default material with no material techniques. GenericMaterial(); /// Create an empty default material with no material techniques and the given name. GenericMaterial( const String& newName ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Name Accessor Methods /// Return the name of the material. RIM_INLINE const String& getName() const { return name; } /// Set the name of the material. RIM_INLINE void setName( const String& newName ) { name = newName; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Technique Accessor Methods /// Return the total number of material techniques that are part of this material. RIM_INLINE Size getTechniqueCount() const { return techniques.getSize(); } /// Return a pointer to the material technique at the specified index in this material. /** * If the specified technique index is invalid, a NULL pointer is returned. */ RIM_INLINE Pointer<GenericMaterialTechnique> getTechnique( Index index ) const { if ( index < techniques.getSize() ) return techniques[index]; else return Pointer<GenericMaterialTechnique>(); } /// Return a pointer to the technique with the specified name in this material. /** * If this material does not contain a technique with that name, * a NULL pointer is returned. */ Pointer<GenericMaterialTechnique> getTechnique( const String& name ) const; /// Return a pointer to the technique with the specified usage in this material. /** * If this material does not contain a technique with that usage, * a NULL pointer is returned. */ Pointer<GenericMaterialTechnique> getTechniqueWithUsage( const MaterialTechniqueUsage& usage ) const; /// Return a pointer to the technique with the specified name in this material. /** * If this material does not contain a technique with that name, * a NULL pointer is returned. */ Bool hasTechnique( const String& name ) const; /// Return a pointer to the technique with the specified usage in this material. /** * If this material does not contain a technique with that usage, * a NULL pointer is returned. */ Bool hasTechniqueWithUsage( const MaterialTechniqueUsage& usage ) const; /// Add a new material technique to this material with the specified usage. /** * If the technique pointer is NULL, the method fails and FALSE is returned. * Otherwise, the technique is added with the given attributes and TRUE is returned. */ Bool addTechnique( const Pointer<GenericMaterialTechnique>& newTechnique ); /// Remove the technique with the specified index from this material. /** * This causes all techniques stored after the given index to be moved one * index back in this internal list of techniques. The method returns * whether or not the remove operation was successful. */ Bool removeTechnique( Index index ); /// Remove the technique with the specified name from this material. /** * The method returns whether or not the remove operation was successful. */ Bool removeTechnique( const String& name ); /// Remove the technique with the specified usage from this material. /** * The method returns whether or not the remove operation was successful. */ Bool removeTechniqueWithUsage( const MaterialTechniqueUsage& usage ); /// Remove all material techniques from this material. void clearTechniques(); private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Members /// A list of the different techniques that can be used when rendering this material. ArrayList< Pointer<GenericMaterialTechnique> > techniques; /// A pointer to a string representing the name of this material. String name; }; //########################################################################################## //********************** End Rim Graphics Materials Namespace **************************** RIM_GRAPHICS_MATERIALS_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_GRAPHICS_GENERIC_MATERIAL_H <file_sep>/* * Simulation.h * Quadcopter * * Created by <NAME> on 11/20/14. * Copyright 2014 __MyCompanyName__. All rights reserved. * */ #ifndef INCLUDE_SIMULATION_H #define INCLUDE_SIMULATION_H #include "rim/rimEngine.h" using namespace rim; using namespace rim::math; #include "Quadcopter.h" /// A class that handles the physical simulation of multiple quadcopters in a virtual environment. class Simulation { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructor /// Create a new simulation with the default paratmers. Simulation(); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Update Method /// Update the current state of the simulation for the given timestep. void update( Float dt ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Quadcopter Accessor Methods /// Return the number of quadcopters in this simulation. RIM_INLINE Size getQuadcopterCount() const { return quadcopters.getSize(); } /// Return a pointer to the quadcopter at the given index or NULL if the index is invalid. RIM_INLINE Quadcopter* getQuadcopter( Index quadcopterIndex ) const { if ( quadcopterIndex < quadcopters.getSize() ) return quadcopters[quadcopterIndex]; else return NULL; } /// Add a new quadcopter to this simulation. RIM_INLINE Bool addQuadcopter( Quadcopter* quadcopter ) { if ( quadcopter == NULL ) return false; quadcopters.add( quadcopter ); return true; } /// Remove the quadcopter at the specified index in this simulation. RIM_INLINE Bool removeQuadcopter( Index quadcopterIndex ) { return quadcopters.removeAtIndex( quadcopterIndex ); } /// Remove all quadcopters from the simulation. RIM_INLINE void clearQuadcopters() { quadcopters.clear(); } private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Simulation Helper Methods /// Update the simulation using the Semi-Implicit Euler integration method for the given timestep. void integrateSemiImplicitEuler( Float dt ); /// Update the simulation using the RK4 integration method for the given timestep. void integrateRK4( Float dt ); /// Compute the COM acceleration for the given quadcopter with the specified position and velocity parameters. /** * The resulting linear and angular acceleration of the quadcopter's center of mass * is returned in the output reference parameters. */ void computeAcceleration( const Quadcopter& quadcopter, Float timeStep, const Vector3f& position, const Vector3f& velocity, const Matrix3f& rotation, const Vector3f& angularVelocity, Vector3f& linearAcceleration, Vector3f& angularAcceleration ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Data Members /// A list of the quadcopters that are part of this simulation. ArrayList< Quadcopter* > quadcopters; /// The 3D gravitational acceleration vector of the simulation. Vector3f gravity; /// The drag coefficient in the simulation. Float drag; }; #endif // INCLUDE_SIMULATION_H <file_sep>/* * rimGraphicsBlendFunction.h * Rim Graphics * * Created by <NAME> on 3/13/13. * Copyright 2013 __MyCompanyName__. All rights reserved. * */ #ifndef INCLUDE_RIM_GRAPHICS_BLEND_FUNCTION_H #define INCLUDE_RIM_GRAPHICS_BLEND_FUNCTION_H #include "rimGraphicsUtilitiesConfig.h" //########################################################################################## //********************** Start Rim Graphics Utilities Namespace ************************** RIM_GRAPHICS_UTILITIES_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class which specifies an operation performed between the source and destination blend factors when blending. /** * This operation is performed on a per-component basis and the result of the * function is the final color for the framebuffer for a given fragment. */ class BlendFunction { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Blend Function Enum Definition /// An enum type which represents the type of blend function. typedef enum Enum { /// An undefined blend function. UNDEFINED = 0, /// A blend function where the final color is the sum of the source and destination blend factors. /** * This blend function is useful for common things like antialiasing and transparency. */ ADD = 1, /// A blend function where the final color is the source blend factor minus the destination blend factor. SUBTRACT = 2, /// A blend function where the final color is the destination blend factor minus the source blend factor. REVERSE_SUBTRACT = 3, /// A blend function where the final color is the minimum of the source and destination blend factors. MIN = 4, /// A blend function where the final color is the maximum of the source and destination blend factors. MAX = 5 }; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructors /// Create a new default blend function with the UNDEFINED enum value. RIM_INLINE BlendFunction() : function( UNDEFINED ) { } /// Create a new blend function with the specified blend function enum value. RIM_INLINE BlendFunction( Enum newFunction ) : function( newFunction ) { } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Enum Cast Operator /// Convert this blend function type to an enum value. RIM_INLINE operator Enum () const { return (Enum)function; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** String Representation Accessor Methods /// Return a unique string for this blend function that matches its enum value name. String toEnumString() const; /// Return a blend function which corresponds to the given enum string. static BlendFunction fromEnumString( const String& enumString ); /// Return a string representation of the blend function. String toString() const; /// Convert this blend function into a string representation. RIM_FORCE_INLINE operator String () const { return this->toString(); } private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Members /// An enum value which indicates the blend function. UByte function; }; //########################################################################################## //********************** End Rim Graphics Utilities Namespace **************************** RIM_GRAPHICS_UTILITIES_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_GRAPHICS_BLEND_FUNCTION_H <file_sep>/* * rimResources.h * Rim Resources * * Created by <NAME> on 11/7/07. * Copyright 2007 __MyCompanyName__. All rights reserved. * */ #ifndef INCLUDE_RIM_RESOURCES_H #define INCLUDE_RIM_RESOURCES_H #include "resources/rimResourcesConfig.h" #include "resources/rimResourceFormat.h" #include "resources/rimResourceType.h" #include "resources/rimResourceID.h" #include "resources/rimResource.h" #include "resources/rimResourceTranscoder.h" #include "resources/rimResourcePool.h" #include "resources/rimResourceManager.h" #endif // INCLUDE_RIM_RESOURCES_H <file_sep>/* * rimGraphicsMaterialAssetTranscoder.h * Rim Software * * Created by <NAME> on 6/14/14. * Copyright 2014 __MyCompanyName__. All rights reserved. * */ #ifndef INCLUDE_RIM_GRAPHICS_MATERIAL_ASSET_TRANSCODER_H #define INCLUDE_RIM_GRAPHICS_MATERIAL_ASSET_TRANSCODER_H #include "rimGraphicsAssetsConfig.h" #include "rimGraphicsTechniqueAssetTranscoder.h" //########################################################################################## //*********************** Start Rim Graphics Assets Namespace **************************** RIM_GRAPHICS_ASSETS_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class which encodes and decodes graphics materials to the asset format. class GraphicsMaterialAssetTranscoder : public AssetTypeTranscoder<GenericMaterial> { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Destructor //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Text Encoding/Decoding Methods /// Decode an object from the specified string stream, returning a pointer to the final object. virtual Pointer<GenericMaterial> decodeText( const AssetType& assetType, const AssetObject& assetObject, ResourceManager* resourceManager = NULL ); /// Encode an object of this asset type into a text-based format. virtual Bool encodeText( UTF8StringBuffer& buffer, ResourceManager* resourceManager, const GenericMaterial& material ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Public Static Data Members /// An object indicating the asset type for a graphics material. static const AssetType MATERIAL_ASSET_TYPE; private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Type Declarations /// An enum describing the fields that a graphics material can have. typedef enum Field { /// An undefined field. UNDEFINED = 0, /// "name" The name of this graphics material. NAME, /// "techniques" A list of the graphics material techniques in this material. TECHNIQUES }; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Helper Methods /// Return an enum value indicating the field indicated by the given field name. static Field getFieldType( const AssetObject::String& name ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Members /// An object that helps transcode graphics material techniques that are part of a material. GraphicsTechniqueAssetTranscoder techniqueTranscoder; /// A temporary asset object used when parsing material child objects. AssetObject tempObject; }; //########################################################################################## //*********************** End Rim Graphics Assets Namespace ****************************** RIM_GRAPHICS_ASSETS_NAMESPACE_END //****************************************************************************************** //########################################################################################## //########################################################################################## //**************************** Start Rim Assets Namespace ******************************** RIM_ASSETS_NAMESPACE_START //****************************************************************************************** //########################################################################################## template <> RIM_INLINE const AssetType& AssetType::of<graphics::GenericMaterial>() { return rim::graphics::assets::GraphicsMaterialAssetTranscoder::MATERIAL_ASSET_TYPE; } //########################################################################################## //**************************** End Rim Assets Namespace ********************************** RIM_ASSETS_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_GRAPHICS_MATERIAL_ASSET_TRANSCODER_H <file_sep>/* * rimGraphicsProjectionType.h * Rim Software * * Created by <NAME> on 4/19/14. * Copyright 2014 __MyCompanyName__. All rights reserved. * */ #ifndef INCLUDE_RIM_GRAPHICS_PROJECTION_TYPE_H #define INCLUDE_RIM_GRAPHICS_PROJECTION_TYPE_H #include "rimGraphicsCamerasConfig.h" //########################################################################################## //*********************** Start Rim Graphics Cameras Namespace *************************** RIM_GRAPHICS_CAMERAS_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class that enumerates the different types of 3D->2D viewing projections. class ProjectionType { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Public Enum Declaration /// An enum type which represents the different projection types. typedef enum Enum { /// A projection where objects are the same size, no matter their distance. ORTHOGRAPHIC = 1, /// A projection where closer objects appear larger than farther away ones. PERSPECTIVE = 2, /// An orthographic projection with shearing applied. OBLIQUE = 3, /// An undefined or unknown projection type. UNDEFINED = 0 }; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructors /// Create a new projection type with the specified projection type enum value. RIM_INLINE ProjectionType( Enum newType ) : type( newType ) { } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Enum Cast Operator /// Convert this projection type to an enum value. RIM_INLINE operator Enum () const { return type; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** String Representation Accessor Methods /// Return a string representation of the projection type. String toString() const; /// Convert this projection type into a string representation. RIM_INLINE operator String () const { return this->toString(); } private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Members /// An enum representing the projection type. Enum type; }; //########################################################################################## //*********************** End Rim Graphics Cameras Namespace ***************************** RIM_GRAPHICS_CAMERAS_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_GRAPHICS_PROJECTION_TYPE_H <file_sep>/* * rimGraphicsBuffers.h * Rim Graphics * * Created by <NAME> on 11/28/11. * Copyright 2011 __MyCompanyName__. All rights reserved. * */ #ifndef INCLUDE_RIM_GRAPHICS_BUFFERS_H #define INCLUDE_RIM_GRAPHICS_BUFFERS_H #include "buffers/rimGraphicsGenericBuffer.h" #include "buffers/rimGraphicsGenericBufferList.h" #include "buffers/rimGraphicsHardwareBuffer.h" #include "buffers/rimGraphicsHardwareBufferAccessType.h" #include "buffers/rimGraphicsHardwareBufferIterator.h" #include "buffers/rimGraphicsHardwareBufferUsage.h" #include "buffers/rimGraphicsIndexedPrimitiveType.h" #include "buffers/rimGraphicsIndexBuffer.h" #include "buffers/rimGraphicsBufferRange.h" #include "buffers/rimGraphicsVertexUsage.h" #include "buffers/rimGraphicsVertexBuffer.h" #include "buffers/rimGraphicsVertexBufferList.h" #endif // INCLUDE_RIM_GRAPHICS_BUFFERS_H <file_sep>/* * rimGraphicsVertexUsage.h * Rim Graphics * * Created by <NAME> on 11/27/11. * Copyright 2011 __MyCompanyName__. All rights reserved. * */ #ifndef INCLUDE_RIM_GRAPHICS_VERTEX_USAGE_H #define INCLUDE_RIM_GRAPHICS_VERTEX_USAGE_H #include "rimGraphicsBuffersConfig.h" //########################################################################################## //*********************** Start Rim Graphics Buffers Namespace *************************** RIM_GRAPHICS_BUFFERS_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class which specifies how a vertex attribute is semantically used for rendering. /** * Each instance allows the user to specify an enum value indicating the * type of usage and also an integral index for that usage. For example, * this allows the user to specify multiple texture coordinate usages. */ class VertexUsage { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Vertex Usage Enum Definition /// An enum type which represents a type of vertex attribute usage. typedef enum Enum { /// An undefined vertex attribute usage. UNDEFINED = 0, /// A usage where the attribute is used to specify a vertex's position. POSITION = 1, /// A usage where the attribute is used to specify a vertex's normal vector. NORMAL = 2, /// A usage where the attribute is used to specify a vertex's binormal vector. BINORMAL = 3, /// A usage where the attribute is used to specify a vertex's tangent vector. TANGENT = 4, /// A usage where the attribute is used to specify a vertex's color. COLOR = 5, /// A usage where the attribute is used to specify a vertex's texture coordinate. TEXTURE_COORDINATE = 6, /// A usage where the attribute is used to represent one or more per-vertex bone indices. BONE_INDEX = 7, /// A usage where the attribute is used to represent one or more per-vertex bone weights. BONE_WEIGHT = 8 }; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructors /// Create a new vertex usage with the specified vertex attribute usage enum value. RIM_INLINE VertexUsage( Enum newUsage ) : usage( newUsage ), index( 0 ) { } /// Create a new vertex usage with the specified usage enum value and index. RIM_INLINE VertexUsage( Enum newUsage, Index newIndex ) : usage( newUsage ), index( (UInt16)newIndex ) { } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Enum Cast Operator /// Convert this vertex usage to an enum value. RIM_INLINE operator Enum () const { return (Enum)usage; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Equality Comparison Operators /// Return whether or not this vertex usage is the same as another. /** * This operator does not compare any usage index, just the usage type. */ RIM_INLINE Bool operator == ( const VertexUsage::Enum otherEnum ) const { return usage == otherEnum; } /// Return whether or not this vertex usage is the same as another. RIM_INLINE Bool operator == ( const VertexUsage& other ) const { return *((UInt32*)this) == *((UInt32*)&other); } /// Return whether or not this vertex usage is different than another. /** * This operator does not compare any usage index, just the usage type. */ RIM_INLINE Bool operator != ( const VertexUsage::Enum otherEnum ) const { return usage != otherEnum; } /// Return whether or not this vertex usage is different than another. RIM_INLINE Bool operator != ( const VertexUsage& other ) const { return *((UInt32*)this) != *((UInt32*)&other); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Vertex Attribute Type Accessor Method /// Return whether or not the specified vertex attribute type is a valid type for this usage. Bool isValidType( const AttributeType& type ) const; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Index Accessor Methods /// Return an index for the vertex usage. /** * This value allows the user to keep track of multiple distinct * usages separately (i.e. for multiple lights) that have the * same usage type. */ RIM_FORCE_INLINE Index getIndex() const { return index; } /// Return an index for the vertex usage. /** * This value allows the user to keep track of multiple distinct * usages separately (i.e. for multiple lights) that have the * same usage type. */ RIM_FORCE_INLINE void setIndex( Index newIndex ) { index = (UInt16)newIndex; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** String Representation Accessor Methods /// Return a unique string for this vertex usage that matches its enum value name. String toEnumString() const; /// Return a vertex usage which corresponds to the given enum string. static VertexUsage fromEnumString( const String& enumString ); /// Return a string representation of the vertex usage. String toString() const; /// Convert this vertex usage into a string representation. RIM_FORCE_INLINE operator String () const { return this->toString(); } private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Members /// An enum for the vertex usage. UInt16 usage; /// The index of the usage specified by the enum value. /** * This value allows the user to keep track of multiple distinct * usages separately (i.e. for multiple texture coordinates) that have the * same usage type. */ UInt16 index; }; //########################################################################################## //*********************** End Rim Graphics Buffers Namespace ***************************** RIM_GRAPHICS_BUFFERS_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_GRAPHICS_VERTEX_USAGE_H <file_sep>/* * rimGUIDisplay.h * Rim GUI * * Created by <NAME> on 8/31/12. * Copyright 2012 __MyCompanyName__. All rights reserved. * */ #ifndef INCLUDE_RIM_GUI_DISPLAY_H #define INCLUDE_RIM_GUI_DISPLAY_H #include "rimGUISystemConfig.h" #include "rimGUIDisplayID.h" #include "rimGUIDisplayMode.h" //########################################################################################## //************************ Start Rim GUI System Namespace ************************** RIM_GUI_SYSTEM_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class which represents an interface to a single connected video display. /** * This class allows the user to query available displays, their supported * modes, and allows the user to change display parameters such as size (resolution) * and bit depth. */ class Display { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructors /// Create a display object which interfaces with the physical display with the specified ID. Display( DisplayID newDisplayID ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Destructor /// Destroy this display object and release all state associated with it. /** * Destructing a display object does not effect the physical display device. */ ~Display(); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Display Mode Accessor Methods /// Return the number of valid modes there are for this display. Size getModeCount() const; /// Return the mode for this display at the specified index. DisplayMode getMode( Index modeIndex ) const; /// Return the current mode for this display. DisplayMode getCurrentMode() const; /// Attempt to change the display's current mode to the specified mode. /** * This method synchronously changes the mode of this display and won't * return until the mode change is complete. If the method can't find * a display mode for this display that matches the specified mode, * FALSE is returned and the display's mode is not changed. Otherwise, * TRUE is returned and the display's mode is changed to the specified mode. */ Bool setMode( const DisplayMode& newMode ); /// Attempt to change the display's current mode to the valid mode closest to the specified mode. /** * This method synchronously changes the mode of this display and won't * return until the mode change is complete. If the method can't find * a display mode for this display that is close to the specified mode, * FALSE is returned and the display's mode is not changed. Otherwise, * TRUE is returned and the display's mode is changed. */ Bool setBestMode( const DisplayMode& newMode ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Display Capturing Methods /// Attempt to capture this display for exclusive use by the application. /** * The method returns whether or not the capture operation was successful. * Capturing the display prevents other applications from detecting that the * display mode has changed and will keep their windows from being resized. * One should always call this method when changing the display's size as * a courtesy to other applications. */ Bool capture(); /// Release this display if it was previously captured by the application. /** * The method returns whether or not the capture operation was successful. */ void release(); /// Return whether or not this display is currently captured for exclusive use by the application. Bool isCaptured() const; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Size Accessor Methods /// Return the horizontal size in pixels of this display. RIM_INLINE Size getWidth() const { return this->getSize().x; } /// Return the vertical size in pixels of this display. RIM_INLINE Size getHeight() const { return this->getSize().y; } /// Return a 2D vector indicating the size in pixels of this display. Size2D getSize() const; /// Attempt to change the size in pixels of this display. /** * The display chooses the available display mode with the size closest * to the given size and changes the display to that size. If this operation * is successful, TRUE is returned. Otherwise, no size change is performed and * FALSE is returned. * * This method may change other display attributes like the refresh rate, but * it will use the display mode that most closely matches the current values of * those attributes while satisfying the size requirement. */ Bool setSize( const Size2D& newSize ); /// Attempt to change the size in pixels of this display. /** * The display chooses the available display mode with the size closest * to the given size and changes the display to that size. If this operation * is successful, TRUE is returned. Otherwise, no size change is performed and * FALSE is returned. * * This method may change other display attributes like the refresh rate, but * it will use the display mode that most closely matches the current values of * those attributes while satisfying the size requirement. */ RIM_INLINE Bool setSize( Size width, Size height ) { return this->setSize( Size2D( width, height ) ); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Refresh Rate Accessor Method /// Return the frequency of this display's refresh rate, in frames per second (Hz). Double getRefreshRate() const; /// Attempt to change the refresh rate of this display. /** * The display chooses the available display mode with the refresh rate closest * to the given one and changes the display to that refresh rate. If this operation * is successful, TRUE is returned. Otherwise, no refresh rate change is performed and * FALSE is returned. */ Bool setRefreshRate( Double newRefreshRate ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Bits Per Pixel Accessor Method /// Return number of bits used to represent each pixel of this display's current mode. Size getBitsPerPixel() const; /// Attempt to change the bit depth of this display. /** * The display chooses the available display mode with the bit depth closest * to the given one and changes the display to that bit depth. If this operation * is successful, TRUE is returned. Otherwise, no bit depth change is performed and * FALSE is returned. */ Bool setBitsPerPixel( Size newBitsPerPixel ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Display Status Accessor Method /// Return whether or not this display object represents a valid physical video display. Bool isValid() const; /// Return whether or not this display is the main display for the system. Bool isMain() const; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Display ID Accessor Method /// Return a display ID which uniquely identifies this display on this system. DisplayID getID() const; /// Return a human-readable name for this display. UTF8String getName() const; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Static Display Accessor Methods /// Return the total number of displays that are connected to the system. static Size getDisplayCount(); /// Return an ID representing the display connected to the system at the specified index. static DisplayID getDisplayID( Index displayIndex ); /// Return the ID of the display which represents the main video display for the system. static DisplayID getMain(); private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Helper Methods /// Refresh the cache of the valid modes for this display so that they can be reused efficiently. void refreshDisplayModes(); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Members /// A value which represents a unique identifier for this connected display. DisplayID displayID; /// A list of all of the valid display modes for this display. ArrayList<DisplayMode> modes; /// A boolean value indicating whether or not this display object has cached its valid modes. mutable Bool hasCachedModes; }; //########################################################################################## //************************ End Rim GUI System Namespace **************************** RIM_GUI_SYSTEM_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_GUI_ELEMENT_DISPLAY_H <file_sep>/* * rimGraphicsAnimationConfig.h * Rim Software * * Created by <NAME> on 3/19/14. * Copyright 2014 __MyCompanyName__. All rights reserved. * */ #ifndef INCLUDE_RIM_GRAPHICS_ANIMATION_CONFIG_H #define INCLUDE_RIM_GRAPHICS_ANIMATION_CONFIG_H #include "../rimGraphicsConfig.h" #include "../rimGraphicsUtilities.h" #include "../rimGraphicsCameras.h" #include "../rimGraphicsLights.h" #include "../rimGraphicsObjects.h" #include "../rimGraphicsShapes.h" //########################################################################################## //########################################################################################## //############ //############ Library Namespace Configuration //############ //########################################################################################## //########################################################################################## #ifndef RIM_GRAPHICS_ANIMATION_NAMESPACE_START #define RIM_GRAPHICS_ANIMATION_NAMESPACE_START RIM_GRAPHICS_NAMESPACE_START namespace animation { #endif #ifndef RIM_GRAPHICS_ANIMATION_NAMESPACE_END #define RIM_GRAPHICS_ANIMATION_NAMESPACE_END }; RIM_GRAPHICS_NAMESPACE_END #endif //########################################################################################## //********************** Start Rim Graphics Animation Namespace ************************** RIM_GRAPHICS_ANIMATION_NAMESPACE_START //****************************************************************************************** //########################################################################################## using rim::graphics::lights::Light; using rim::graphics::cameras::Camera; using rim::graphics::objects::GraphicsObject; using rim::graphics::shapes::GraphicsShape; //########################################################################################## //********************** End Rim Graphics Animation Namespace **************************** RIM_GRAPHICS_ANIMATION_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_GRAPHICS_ANIMATION_CONFIG_H <file_sep>/* * rimAsset.h * Rim Software * * Created by <NAME> on 6/11/14. * Copyright 2014 __MyCompanyName__. All rights reserved. * */ #ifndef INCLUDE_RIM_ASSET_H #define INCLUDE_RIM_ASSET_H #include "rimAssetsConfig.h" //########################################################################################## //**************************** Start Rim Assets Namespace ******************************** RIM_ASSETS_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class which encapsulates a named asset. template < typename DataType > class Asset { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructors /// Create a new unnnamed asset with the specified value. RIM_INLINE Asset( const Pointer<DataType>& newData ) : name(), data( newData ) { } /// Create a new asset with the specified value and name. RIM_INLINE Asset( const Pointer<DataType>& newData, const UTF8String& newName ) : name( newName ), data( newData ) { } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Asset Name Accessor Methods /// Return a reference to a string representing the name of this asset. RIM_INLINE const UTF8String& getName() const { return name; } /// Return a reference to a string representing the name of this asset. RIM_INLINE void setName( const UTF8String& newName ) { name = newName; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Asset Data Accessor Methods /// Return a const reference to the value object stored by this asset. RIM_INLINE const Pointer<DataType>& getData() const { return data; } /// Set the value object stored by this asset. RIM_INLINE void setData( const Pointer<DataType>& newData ) { data = newData; } private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Members /// The data of this asset, the object that it stores. Pointer<DataType> data; /// A string representing the name of this asset. UTF8String name; }; //########################################################################################## //**************************** End Rim Assets Namespace ********************************** RIM_ASSETS_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_ASSET_H <file_sep>/* * rimGraphicsVisibilityCullerSimple.h * Rim Graphics * * Created by <NAME> on 12/5/09. * Copyright 2009 Rim Software. All rights reserved. * */ #ifndef INCLUDE_RIM_GRAPHICS_OBJECT_CULLER_SIMPLE_H #define INCLUDE_RIM_GRAPHICS_OBJECT_CULLER_SIMPLE_H #include "rimGraphicsObjectsConfig.h" #include "rimGraphicsObjectCuller.h" //########################################################################################## //************************ Start Rim Graphics Objects Namespace ************************** RIM_GRAPHICS_OBJECTS_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A simple implementation of the ObjectCuller interface that provides O(n) performance. class ObjectCullerSimple : public ObjectCuller { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructor /// Create a new empty simple object culler. ObjectCullerSimple(); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Visibile Object Query Methods /// Add a pointer to each object that intersects the specified bounding sphere to the output list. virtual void getIntersectingObjects( const BoundingSphere& sphere, ArrayList< Pointer<GraphicsObject> >& outputList ) const; /// Add a pointer to each object that intersects the specified bounding cone to the output list. virtual void getIntersectingObjects( const BoundingCone& cone, ArrayList< Pointer<GraphicsObject> >& outputList ) const; /// Add a pointer to each object that intersects the specified view volume to the output list. virtual void getIntersectingObjects( const ViewVolume& viewVolume, ArrayList< Pointer<GraphicsObject> >& outputList ) const; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Visibile Mesh Chunk Query Methods /// Add each object's mesh chunks that intersect the specified camera's view volume to the output list. virtual void getIntersectingChunks( const Camera& camera, const ViewVolume* viewVolume, const Vector2D<Size>& viewportSize, const GraphicsObjectFlags& requiredFlags, ArrayList<MeshChunk>& outputList ) const; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Update Method /// Update the bounding volumes of all objects that are part of this object culler and any spatial data structures. virtual void update(); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Object Accessor Methods /// Return the number of objects that are in this object culler. virtual Size getObjectCount() const; /// Return whether or not this object culler contains the specified object. virtual Bool containsObject( const Pointer<GraphicsObject>& object ) const; /// Add the specified object to this object culler. virtual Bool addObject( const Pointer<GraphicsObject>& object ); /// Remove the specified object from this object culler and return whether or not it was removed. virtual Bool removeObject( const Pointer<GraphicsObject>& object ); /// Remove all objects from this object culler. virtual void clearObjects(); private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Helper Methods static void flattenHierarchy( const GraphicsObject& object, const GraphicsObjectFlags& requiredFlags, const Transform3& worldTransform, const Camera& camera, const ViewVolume* viewVolume, const Vector2D<Size>& viewportSize, ArrayList<MeshChunk>& chunks ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Members /// A list of all of the objects in this simple object culler. ArrayList< Pointer<GraphicsObject> > objects; }; //########################################################################################## //************************ End Rim Graphics Objects Namespace **************************** RIM_GRAPHICS_OBJECTS_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_GRAPHICS_OBJECT_CULLER_SIMPLE_H <file_sep>/* * rimGraphicsGUIMenuItem.h * Rim Graphics GUI * * Created by <NAME> on 2/18/13. * Copyright 2013 Headspace Systems. All rights reserved. * */ #ifndef INCLUDE_RIM_GRAPHICS_GUI_MENU_ITEM_H #define INCLUDE_RIM_GRAPHICS_GUI_MENU_ITEM_H #include "rimGraphicsGUIBase.h" #include "rimGraphicsGUIObject.h" #include "rimGraphicsGUIMenuItemDelegate.h" //########################################################################################## //************************ Start Rim Graphics GUI Namespace ****************************** RIM_GRAPHICS_GUI_NAMESPACE_START //****************************************************************************************** //########################################################################################## class Menu; //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class which represents a selectable item which is part of a Menu. /** * A menu item consists of an optional image, a text label, and a keyboard * shortcut. */ class MenuItem { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Menu Item Type Enum Declaration /// An enum type which specifies the different kinds of menu items. typedef enum Type { /// A menu item type that represents a normal menu item. NORMAL = 0, /// A menu item type that represents an item that has a submenu. MENU, /// A menu item type that represents a menu separator. /** * A menu item separator is a type of item that is usually drawn as a * horizontal line which is used to break up groups of menu items * in long menus. */ SEPARATOR }; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructors /// Create a new menu item with the specified specialized type. /** * This constructor allows one to create menu items that represent * special kinds of items - separators, etc - that aren't able to be * represented easily another way. */ MenuItem( Type newType = NORMAL ); /// Create a new normal menu item with the specified text and keyboard shortcut. MenuItem( const UTF8String& newText, const KeyboardShortcut& shortcut = KeyboardShortcut() ); /// Create a new normal menu item with the specified image, text and keyboard shortcut. MenuItem( const Pointer<GUIImage>& newImage, const UTF8String& newText, const KeyboardShortcut& shortcut = KeyboardShortcut() ); /// Create a new menu item which uses the specified menu as a child menu. /** * If the specified menu is NULL or if it already has a parent item or menu bar, * the menu is not used and the submenu is unitialized. */ MenuItem( const Pointer<Menu>& menu ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Text Accessor Methods /// Return a reference to a string representing the text label of this menu item. RIM_INLINE const UTF8String& getText() const { return text; } /// Set a string representing the text label of this menu item. RIM_INLINE void setText( const UTF8String& newText ) { text = newText; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Text Alignment Accessor Methods /// Return an object which describes how this menu item's text is aligned within the menu item's bounds. RIM_INLINE const Origin& getTextAlignment() const { return textAlignment; } /// Set an object which describes how this menu item's text is aligned within the menu item's bounds. RIM_INLINE void setTextAlignment( const Origin& newTextAlignment ) { textAlignment = newTextAlignment; } /// Set an object which describes how this menu item's text is aligned within the menu item's bounds. RIM_INLINE void setTextAlignment( Origin::XOrigin newXOrigin, Origin::YOrigin newYOrigin ) { textAlignment = Origin( newXOrigin, newYOrigin ); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Text Visibility Accessor Methods /// Return a boolean value indicating whether or not this menu item's text label is displayed. RIM_INLINE Bool getTextIsVisible() const { return textIsVisible; } /// Set a boolean value indicating whether or not this menu item's text label is displayed. RIM_INLINE void setTextIsVisible( Bool newTextIsVisible ) { textIsVisible = newTextIsVisible; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Image Accessor Methods /// Return a reference to the image which is displayed in the menu item's content area when in its normal state. RIM_INLINE const Pointer<GUIImage>& getImage() const { return image; } /// Set the image which is displayed in the menu item's content area when in its normal state. RIM_INLINE void setImage( const Pointer<GUIImage>& newImage ) { image = newImage; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Image Alignment Accessor Methods /// Return an object which describes how this menu item's image is aligned within the menu item's bounds. RIM_INLINE const Origin& getImageAlignment() const { return imageAlignment; } /// Set an object which describes how this menu item's image is aligned within the menu item's bounds. RIM_INLINE void setImageAlignment( const Origin& newImageAlignment ) { imageAlignment = newImageAlignment; } /// Set an object which describes how this menu item's image is aligned within the menu item's bounds. RIM_INLINE void setImageAlignment( Origin::XOrigin newXOrigin, Origin::YOrigin newYOrigin ) { imageAlignment = Origin( newXOrigin, newYOrigin ); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Image Visibility Accessor Methods /// Return a boolean value indicating whether or not this menu item's image is displayed. RIM_INLINE Bool getImageIsVisible() const { return imageIsVisible; } /// Set a boolean value indicating whether or not this menu item's image is displayed. RIM_INLINE void setImageIsVisible( Bool newImageIsVisible ) { imageIsVisible = newImageIsVisible; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Menu Accessor Methods /// Return whether or not this menu item has a child menu associated with it. /** * This method always returns FALSE is this menu item is a separator or a * normal menu item. */ RIM_INLINE Bool hasMenu() const { return menu.isSet(); } /// Return a pointer to the child menu associated with this menu item. /** * If there is no such menu, a NULL pointer is returned. */ RIM_INLINE const Pointer<Menu>& getMenu() const { return menu; } /// Set the child menu which should be associated with this menu item. /** * If the specified menu pointer is NULL, this has the effect of clearing * any existing child menu from this menu item. */ void setMenu( const Pointer<Menu>& newMenu ); /// Remove any child menu that was associated with this menu item. void removeMenu(); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Keyboard Shortcut Accessor Methods /// Return an object which describes the keyboard shortcut to use for this menu item. const KeyboardShortcut& getKeyboardShortcut() const { return shortcut; } /// Set an object which describes the keyboard shortcut to use for this menu item. void setKeyboardShortcut( const KeyboardShortcut& newShortcut ) { shortcut = newShortcut; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Type Accessor Methods /// Return an enum value indicating the type of menu item that this is. /** * The type of a menu item determines how it will be displayed and how * it may be interacted with by the user. Any item attributes that are * irrelevant for a given item type are simply ignored. */ RIM_INLINE Type getType() const { return type; } /// Set an enum value indicating the type of menu item that this is. /** * The type of a menu item determines how it will be displayed and how * it may be interacted with by the user. Any item attributes that are * irrelevant for a given item type are simply ignored. */ RIM_INLINE void setType( Type newType ) { type = newType; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** MenuItem State Accessor Methods /// Return whether or not this menu item is currently active. /** * An enabled menu item (the default) can be interacted with by the user * and is displayed normally. A disabled menu item can't be selected by the * user and displays more transparently, indicating its state. */ RIM_INLINE Bool getIsEnabled() const { return isEnabled && type != SEPARATOR; } /// Set whether or not this menu item is currently active. /** * An enabled menu item (the default) can be interacted with by the user * and is displayed normally. A disabled menu item can't be selected by the * user and displays more transparently, indicating its state. */ RIM_INLINE void setIsEnabled( Bool newIsEnabled ) { isEnabled = newIsEnabled; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Delegate Accessor Methods /// Return a reference to the delegate which responds to events for this menu item. RIM_INLINE MenuItemDelegate& getDelegate() { return delegate; } /// Return a reference to the delegate which responds to events for this menu item. RIM_INLINE const MenuItemDelegate& getDelegate() const { return delegate; } /// Return a reference to the delegate which responds to events for this menu item. RIM_INLINE void setDelegate( const MenuItemDelegate& newDelegate ) { delegate = newDelegate; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Static Construction Methods /// Construct a smart-pointer-wrapped instance of this class using the constructor with the given arguments. RIM_INLINE static Pointer<MenuItem> construct( Type newType = NORMAL ) { return Pointer<MenuItem>( rim::util::construct<MenuItem>( newType ) ); } /// Construct a smart-pointer-wrapped instance of this class using the constructor with the given arguments. RIM_INLINE static Pointer<MenuItem> construct( const UTF8String& newText, const KeyboardShortcut& newShortcut = KeyboardShortcut() ) { return Pointer<MenuItem>( rim::util::construct<MenuItem>( newText, newShortcut ) ); } /// Construct a smart-pointer-wrapped instance of this class using the constructor with the given arguments. RIM_INLINE static Pointer<MenuItem> construct( const Pointer<GUIImage>& newImage, const UTF8String& newText, const KeyboardShortcut& newShortcut = KeyboardShortcut() ) { return Pointer<MenuItem>( rim::util::construct<MenuItem>( newImage, newText, newShortcut ) ); } /// Construct a smart-pointer-wrapped instance of this class using the constructor with the given arguments. RIM_INLINE static Pointer<MenuItem> construct( const Pointer<Menu>& newMenu ) { return Pointer<MenuItem>( rim::util::construct<MenuItem>( newMenu ) ); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Public Static Data Members /// The default alignment that is used for a menu item's text label. static const Origin DEFAULT_TEXT_ALIGNMENT; /// The default alignment that is used for a menu item's image label. static const Origin DEFAULT_IMAGE_ALIGNMENT; private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Members /// An enum value which indicates the type of this menu item. Type type; /// A string representing the text label of this menu item. UTF8String text; /// An image which is displayed within the content rectangle of this menu item. Pointer<GUIImage> image; /// An object which describes how this menu item's text is aligned within the menu item. Origin textAlignment; /// An object which describes how this menu item's image is aligned within the menu item. Origin imageAlignment; /// A pointer to the menu which is a child menu of this menu item. Pointer<Menu> menu; /// An object which contains function pointers that respond to menu item events. MenuItemDelegate delegate; /// An object representing the keyboard shortcut to use for this menu item. KeyboardShortcut shortcut; /// A boolean value indicating whether or not this menu item's text label is visible. Bool textIsVisible; /// A boolean value indicating whether or not this menu item's image is visible. Bool imageIsVisible; /// A boolean value indicating whether or not this menu item is enabled and able to be selected. Bool isEnabled; }; //########################################################################################## //************************ End Rim Graphics GUI Namespace ******************************** RIM_GRAPHICS_GUI_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_GRAPHICS_GUI_MENU_ITEM_H <file_sep>/* * rimSound.h * Rim Sound * * Created by <NAME> on 5/8/08. * Copyright 2008 Rim Software. All rights reserved. * */ #ifndef INCLUDE_RIM_SOUND_H #define INCLUDE_RIM_SOUND_H #include "sound/rimSoundConfig.h" #include "sound/rimSoundUtilities.h" #include "sound/rimSoundDevices.h" #include "sound/rimSoundFilters.h" #include "sound/rimSoundIO.h" //########################################################################################## //**************************** Start Rim Sound Namespace ********************************* RIM_SOUND_NAMESPACE_START //****************************************************************************************** //########################################################################################## using namespace rim::sound::util; using namespace rim::sound::filters; using namespace rim::sound::devices; using namespace rim::sound::io; //########################################################################################## //**************************** End Rim Sound Namespace *********************************** RIM_SOUND_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_SOUND_H <file_sep>/* * rimGraphicsGUIObject.h * Rim Graphics GUI * * Created by <NAME> on 1/22/13. * Copyright 2013 Headspace Systems. All rights reserved. * */ #ifndef INCLUDE_RIM_GRAPHICS_GUI_OBJECT_H #define INCLUDE_RIM_GRAPHICS_GUI_OBJECT_H #include "rimGraphicsGUIBase.h" #include "rimGraphicsGUIObjectFlags.h" #include "rimGraphicsGUIStyle.h" //########################################################################################## //************************ Start Rim Graphics GUI Namespace ****************************** RIM_GRAPHICS_GUI_NAMESPACE_START //****************************************************************************************** //########################################################################################## class GUIRenderer; //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class which represents the base class for an interactive rectangular region within a GUI. class GUIObject { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructor /// Create a default visible GUI object positioned at the origin (0,0) with 0 width and 0 height. RIM_INLINE GUIObject() : rectangle(), flags( GUIObjectFlags::DEFAULT ) { } /// Create a visible GUI object which occupies the specified rectangle. RIM_INLINE GUIObject( const Rectangle& newRectangle ) : rectangle( newRectangle ), flags( GUIObjectFlags::DEFAULT ) { } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Destructor /// Destory the GUI object, releasing all internal resources. virtual ~GUIObject(); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Rectangle Accessor Methods /// Return a reference to this GUI object's rectangle. /** * This object represents the object's positioning and rotation relative to its * parent coordinate system. */ RIM_INLINE const Rectangle& getRectangle() const { return rectangle; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Size Accessor Methods /// Return a reference to the 3D size of this object along each of its local axes. RIM_INLINE const Vector3f& getSize() const { return rectangle.size; } /// Return a reference to the 2D scaling factor of this object along each of its local axes. RIM_INLINE const Vector2f& getSizeXY() const { return *reinterpret_cast<const Vector2f*>( &rectangle.size ); } /// Set the 3D size of this object along each of its local axes. /** * The method returns whether or not the size of the object was able to be changed. */ virtual Bool setSize( const Vector3f& newSize ); /// Set the 2D size of this object along the X and Y local axes. RIM_INLINE Bool setSize( const Vector2f& newSizeXY ) { return this->setSize( Vector3f( newSizeXY, rectangle.size.z ) ); } /// Set the 2D size of this object along the X and Y local axes. RIM_INLINE Bool setSize( Float newWidth, Float newHeight ) { return this->setSize( Vector3f( newWidth, newHeight, rectangle.size.z ) ); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Size Accessor Methods /// Return a reference to the 3D scaling factor of this object along each of its local axes. RIM_INLINE const Vector3f& getScale() const { return rectangle.transform.scale; } /// Return a reference to the 2D scaling factor of this object along each of its local axes. RIM_INLINE const Vector2f& getScaleXY() const { return *reinterpret_cast<const Vector2f*>( &rectangle.transform.scale ); } /// Set the 3D scaling factor of this object along each of its local axes. /** * The method returns whether or not the scale of the object was able to be changed. */ virtual Bool setScale( const Vector3f& newScale ); /// Set the 2D scaling factor of this object along the X and Y local axes. RIM_INLINE Bool setScale( const Vector2f& newSizeXY ) { return this->setScale( Vector3f( newSizeXY, rectangle.size.z ) ); } /// Set the 2D scaling factor of this object along the X and Y local axes. RIM_INLINE Bool setScale( Float newWidth, Float newHeight ) { return this->setScale( Vector3f( newWidth, newHeight, rectangle.size.z ) ); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Position Accessor Methods /// Return the position of this GUI object's origin relative to its parent's coordinate origin. RIM_INLINE const Vector3f& getPosition() const { return rectangle.transform.position; } /// Return the 2D position of this GUI object's origin relative to its parent's coordinate origin. RIM_INLINE const Vector2f& getPositionXY() const { return *reinterpret_cast<const Vector2f*>( &rectangle.transform.position ); } /// Set the position of this GUI object's origin relative to its parent's coordinate origin. RIM_INLINE Bool setPosition( const Vector2f& newPosition ) { return this->setPosition( Vector3f( newPosition, this->getPosition().x ) ); } /// Set the position of this GUI object's origin relative to its parent's coordinate origin. /** * The method returns whether or not the position and origin of the object was able to be changed. */ virtual Bool setPosition( const Vector3f& newPosition ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Rotation Accessor Methods /// Return a 3x3 orthonormal matrix indicating the basis of this object's coordinate frame. RIM_INLINE const Matrix3f& getRotation() const { return rectangle.transform.orientation; } /// Set a 3x3 orthonormal matrix indicating the basis of this object's coordinate frame. /** * The method returns whether or not the rotation of the object was able to be changed. */ virtual Bool setRotation( const Matrix3f& newRotation ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Origin Accessor Methods /// Return the alignment of the coordinate origin for this object. RIM_INLINE Origin& getOrigin() { return rectangle.origin; } /// Return the alignment of the coordinate origin for this object. RIM_INLINE const Origin& getOrigin() const { return rectangle.origin; } /// Set the alignment of the coordinate origin for this object. /** * The method returns whether or not the origin of the object was able to be changed. */ virtual Bool setOrigin( const Origin& newPositionOrigin ); /// Set the alignment of the coordinate origin for this object. RIM_INLINE void setOrigin( Origin::XOrigin newXOrigin, Origin::YOrigin newYOrigin ) { rectangle.origin.setX( newXOrigin ); rectangle.origin.setY( newYOrigin ); } /// Set the alignment of the coordinate origin for this object. RIM_INLINE void setOrigin( Origin::XOrigin newXOrigin, Origin::YOrigin newYOrigin, Origin::ZOrigin newZOrigin ) { rectangle.origin = Origin( newXOrigin, newYOrigin, newZOrigin ); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Bounding Box Accessor Methods /// Return the 2D bounding box of this object in the coordinate frame of the specified parent bounding box. RIM_INLINE AABB2f getBoundsInParent( const AABB2f& parentBounds ) const { return rectangle.getBoundsInParent( parentBounds ); } /// Return the 3D bounding box of this object in the coordinate frame of the specified parent bounding box. RIM_INLINE AABB3f getBoundsInParent( const AABB3f& parentBounds ) const { return rectangle.getBoundsInParent( parentBounds ); } /// Return the 2D bounding box of this object in its local coordinate frame. RIM_INLINE AABB2f getLocalBoundsXY() const { return AABB2f( Vector2f(), rectangle.size.getXY() ); } /// Return the 3D bounding box of this object in its local coordinate frame. RIM_INLINE AABB3f getLocalBounds() const { return AABB3f( Vector3f(), rectangle.size ); } /// Return the 2D center of this object's rectangle in its local coordinate frame. RIM_INLINE Vector2f getLocalCenterXY() const { return Float(0.5)*rectangle.size.getXY(); } /// Return the 3D center of this object's rectangle in its local coordinate frame. RIM_INLINE Vector3f getLocalCenter() const { return Float(0.5)*rectangle.size; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Transformation Matrix Accessor Methods /// Return the object-space-to-parent-space homogeneous transformation matrix for the given parent bounding box. RIM_INLINE Matrix4f getTransformMatrix( const AABB3f& parentBounds ) const { return rectangle.getTransformMatrix( parentBounds ); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Point Transformation Methods /// Transform a 3D point in the parent coordinate system into this object's coordinate system. RIM_INLINE Vector2f transformToLocal( const Vector2f& pointInParent, const AABB2f& parentBounds ) const { return rectangle.transformToLocal( pointInParent, parentBounds ); } /// Transform a 3D point in the parent coordinate system into this object's coordinate system. RIM_INLINE Vector3f transformToLocal( const Vector3f& pointInParent, const AABB3f& parentBounds ) const { return rectangle.transformToLocal( pointInParent, parentBounds ); } /// Transform a 2D point in this object's local coordinate system into its parent's coordinate system. RIM_INLINE Vector2f transformFromLocal( const Vector2f& localPoint, const AABB2f& parentBounds ) const { return rectangle.transformFromLocal( localPoint, parentBounds ); } /// Transform a 3D point in this object's local coordinate system into its parent's coordinate system. RIM_INLINE Vector3f transformFromLocal( const Vector3f& localPoint, const AABB3f& parentBounds ) const { return rectangle.transformFromLocal( localPoint, parentBounds ); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Vector Transformation Methods /// Transform a 3D vector in the parent coordinate system into this object's coordinate system. RIM_INLINE Vector2f transformVectorToLocal( const Vector2f& vectorInParent ) const { return rectangle.transformVectorToLocal( vectorInParent ); } /// Transform a 3D vector in the parent coordinate system into this object's coordinate system. RIM_INLINE Vector3f transformVectorToLocal( const Vector3f& vectorInParent ) const { return rectangle.transformVectorToLocal( vectorInParent ); } /// Transform a 2D vector in this object's local coordinate system into its parent's coordinate system. RIM_INLINE Vector2f transformVectorFromLocal( const Vector2f& localVector ) const { return rectangle.transformVectorFromLocal( localVector ); } /// Transform a 3D vector in this object's local coordinate system into its parent's coordinate system. RIM_INLINE Vector3f transformVectorFromLocal( const Vector3f& localVector ) const { return rectangle.transformVectorFromLocal( localVector ); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Point Containment Methods /// Return whether or not this GUI object contains the specified local point within its local bounds. RIM_INLINE Bool containsLocalPoint( const Vector2f& localPoint ) const { return rectangle.containsLocalPoint( localPoint ); } /// Return whether or not this GUI object contains the specified local point within its local bounds. RIM_INLINE Bool containsLocalPoint( const Vector3f& localPoint ) const { return rectangle.containsLocalPoint( localPoint ); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Style Accessor Methods /// Return a pointer to the style object to use when drawing this GUI object. RIM_INLINE const Pointer<GUIStyle>& getStyle() const { return style; } /// Set a pointer to the style object to use when drawing this GUI object. RIM_INLINE void setStyle( const Pointer<GUIStyle>& newStyle ) { style = newStyle; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Flags Accessor Methods /// Return a reference to the flags for this GUI object. RIM_INLINE GUIObjectFlags& getFlags() { return flags; } /// Return a const reference to the flags for this GUI object. RIM_INLINE const GUIObjectFlags& getFlags() const { return flags; } /// Set the flags for this GUI object. RIM_INLINE void setFlags( const GUIObjectFlags& newFlags ) { flags = newFlags; } /// Return whether or not the specified boolan flag is set for this GUI object. RIM_INLINE Bool flagIsSet( GUIObjectFlags::Flag flag ) const { return flags.isSet( flag ); } /// Set whether or not the specified boolan flag is set for this GUI object. RIM_INLINE void setFlag( GUIObjectFlags::Flag flag, Bool newIsSet = true ) { flags.set( flag, newIsSet ); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Visibility Accessor Methods /// Return whether or not this GUI object should be drawn to the screen. RIM_INLINE Bool getIsVisible() const { return flags.isSet( GUIObjectFlags::VISIBLE ); } /// Set whether or not this GUI object should be drawn to the screen. RIM_INLINE void setIsVisible( Bool newIsVisible ) { flags.set( GUIObjectFlags::VISIBLE, newIsVisible ); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Update Method /// Update the current internal state of this object for the specified time interval in seconds. /** * This method can be used to update animations or other time-based effects that * require a regular update interval. This method is usually called once for each frame * that is rendered, but could be called at a different rate if desired. * * Objects are responsible for calling update() with the same time parameter for all * child GUI objects that need to be updated. */ virtual void update( Float dt ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Drawing Method /// Draw this object using the specified GUI renderer to the given parent coordinate system bounds. /** * The method returns whether or not the object was successfully drawn. * * The default implementation draws nothing and returns TRUE. */ virtual Bool drawSelf( GUIRenderer& renderer, const AABB3f& parentBounds ) const; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Input Handling Methods /// Handle the specified keyboard event that occured when this object had focus. /** * The default implementation does nothing. */ virtual void keyEvent( const KeyboardEvent& event ); /// Handle the specified mouse motion event that occurred. /** * The default implementation does nothing. */ virtual void mouseMotionEvent( const MouseMotionEvent& event ); /// Handle the specified mouse button event that occurred. /** * The default implementation does nothing. */ virtual void mouseButtonEvent( const MouseButtonEvent& event ); /// Handle the specified mouse wheel event that occurred. /** * The default implementation does nothing. */ virtual void mouseWheelEvent( const MouseWheelEvent& event ); private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Members /// A rectangle indicating the position, orientation, scaling, and size of this object. Rectangle rectangle; /// An object containing boolean configuration flags for this GUI object. GUIObjectFlags flags; /// A pointer to a style object for this GUI obejct. Pointer<GUIStyle> style; }; //########################################################################################## //************************ End Rim Graphics GUI Namespace ******************************** RIM_GRAPHICS_GUI_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_GRAPHICS_GUI_OBJECT_H <file_sep>/* * rimRay2D.h * Rim Math * * Created by <NAME> on 10/15/10. * Copyright 2010 Rim Software. All rights reserved. * */ #ifndef INCLUDE_RIM_RAY_2D_H #define INCLUDE_RIM_RAY_2D_H #include "rimMathConfig.h" #include "rimVector2D.h" //########################################################################################## //***************************** Start Rim Math Namespace ********************************* RIM_MATH_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class which represents a ray in 2D space. /** * This class contains two data members: origin and direction. Origin represents * the starting position of the ray and direction represents the positively * parameterized direction along the ray. */ template < typename T > class Ray2D { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructors /// Create a ray starting at the origin pointing in the positive Y direction. RIM_FORCE_INLINE Ray2D() : origin( 0, 0 ), direction( 0, 1 ) { } /// Create a ray with the specified origin and direction. RIM_FORCE_INLINE Ray2D( const Vector2D<T>& newOrigin, const Vector2D<T>& newDirection ) : origin( newOrigin ), direction( newDirection ) { } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Ray Methods /// Get the position along the ray at the specified parameter value. /** * This position is calculated using the equation: * position = origin + parameter*direction. */ RIM_FORCE_INLINE Vector2D<T> getPositionAt( T parameter ) const { return origin + parameter*direction; } /// Return a new ray with a unit-length direction vector. RIM_FORCE_INLINE Vector2D<T> normalize() const { return Vector2D<T>( origin, direction.normalize() ); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Public Data Members /// The origin of the ray in 2D space; Vector2D<T> origin; /// The direction of the ray in 2D space. Vector2D<T> direction; }; //########################################################################################## //***************************** End Rim Math Namespace *********************************** RIM_MATH_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_RAY_3D_H <file_sep>/* * rimSoundVibrato.h * Rim Sound * * Created by <NAME> on 6/1/13. * Copyright 2013 __MyCompanyName__. All rights reserved. * */ #ifndef INCLUDE_RIM_SOUND_VIBRATO_H #define INCLUDE_RIM_SOUND_VIBRATO_H #include "rimSoundFiltersConfig.h" #include "rimSoundFilter.h" //########################################################################################## //************************ Start Rim Sound Filters Namespace ***************************** RIM_SOUND_FILTERS_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class that periodically varies the amplitude of an input signal. /** * A Vibrato filter takes the input sound and modulates the frequency of that * sound with a repeating wave function, LFO. */ class Vibrato : public SoundFilter { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructors /// Create a default sine-based vibrato filter with a depth of 6dB and frequency of 1Hz. Vibrato(); /// Create a vibrato with the specified modulation wave type, output gain, and frequency. Vibrato( Float newFrequency, Gain newDepth ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Vibrato Frequency Accessor Methods /// Return the frequency of this vibrato's modulation wave in hertz. RIM_INLINE Float getFrequency() const { return targetFrequency; } /// Set the frequency of this vibrato's modulation wave in hertz. RIM_INLINE void setFrequency( Float newFrequency ) { lockMutex(); targetFrequency = math::max( newFrequency, Float(0) ); unlockMutex(); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Vibrato Depth Accessor Methods /// Return the intensity of the vibrato modulation. /** * This is a value between 0 and 1 which indicates the unitless amount that the vibrato * effect should affect the input signal by. A higher depth affects the signal more * by producing more frequency modulation. */ RIM_INLINE Float getDepth() const { return targetDepth; } /// Set the maximum attenuation of the vibrato modulation in decibels. /** * This is a value between 0 and 1 which indicates the unitless amount that the vibrato * effect should affect the input signal by. A higher depth affects the signal more * by producing more frequency modulation. * * The new depth value is clamped to the range of [0,1]. */ RIM_INLINE void setDepth( Float newDepth ) { lockMutex(); targetDepth = math::clamp( newDepth, Float(0), Float(1) ); unlockMutex(); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Vibrato Frequency Accessor Methods /// Return the modulation phase offset of the channel with the specified index. /** * This value, specified in degrees, indicates how much the phase of the channel * should be shifted by. This parameter allows the creation of stereo (or higher) * modulation effects. For example, if the phase of the left channel is 0 and the phase * of the right channel is 180, the channels' modulation will be completely out-of-phase. */ RIM_INLINE Float getChannelPhase( Index channelIndex ) const { if ( channelIndex < channelPhase.getSize() ) return math::radiansToDegrees( channelPhase[channelIndex] ); else return math::radiansToDegrees( globalChannelPhase ); } /// Set the modulation phase offset of the channel with the specified index. /** * This value, specified in degrees, indicates how much the phase of the channel * should be shifted by. This parameter allows the creation of stereo (or higher) * modulation effects. For example, if the phase of the left channel is 0 and the phase * of the right channel is 180, the channels' modulation will be completely out-of-phase. * * The input phase value is clamped so that the new phase value lies between -180 and 180 degrees. */ void setChannelPhase( Index channelIndex, Float newPhase ); /// Set the modulation phase offset for all channels. /** * Doing this brings all channels into phase with each other (regardless of what phase that is). * * The input phase value is clamped so that the new phase value lies between -180 and 180 degrees. */ void setChannelPhase( Float newPhase ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Filter Attribute Accessor Methods /// Return a human-readable name for this vibrato. /** * The method returns the string "Vibrato". */ virtual UTF8String getName() const; /// Return the manufacturer name of this vibrato. /** * The method returns the string "Headspace Sound". */ virtual UTF8String getManufacturer() const; /// Return an object representing the version of this vibrato. virtual SoundFilterVersion getVersion() const; /// Return an object which describes the category of effect that this filter implements. /** * This method returns the value SoundFilterCategory::MODULATION. */ virtual SoundFilterCategory getCategory() const; /// Return whether or not this vibrato can process audio data in-place. /** * This method always returns TRUE, vibratos can process audio data in-place. */ virtual Bool allowsInPlaceProcessing() const; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Filter Latency Accessor Method /// Return a Time value indicating the latency of this vibrato effect in seconds. /** * The latency of the vibrato is equal to half the maximum delay amount of the * effect, usually just a few milliseconds. */ virtual Time getLatency() const; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Filter Parameter Accessor Methods /// Return the total number of generic accessible parameters this vibrato has. virtual Size getParameterCount() const; /// Get information about the vibrato parameter at the specified index. virtual Bool getParameterInfo( Index parameterIndex, FilterParameterInfo& info ) const; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Public Static Property Objects /// A string indicating the human-readable name of this vibrato. static const UTF8String NAME; /// A string indicating the manufacturer name of this vibrato. static const UTF8String MANUFACTURER; /// An object indicating the version of this vibrato. static const SoundFilterVersion VERSION; private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Filter Parameter Value Accessor Methods /// Place the value of the parameter at the specified index in the output parameter. virtual Bool getParameterValue( Index parameterIndex, FilterParameter& value ) const; /// Attempt to set the parameter value at the specified index. virtual Bool setParameterValue( Index parameterIndex, const FilterParameter& value ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Filter Processing Methods /// Fill the output frame with the amplitude modulated input sound. virtual SoundFilterResult processFrame( const SoundFilterFrame& inputFrame, SoundFilterFrame& outputFrame, Size numSamples ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Wave Generation Methods /// Compute the value of a cosine wave, given the specified phase value in radians. /** * The output of this function is biased so that the sine wave has minima * and maxima at y=0 and y=1. */ RIM_FORCE_INLINE static Sample32f cosine( Float phase ) { return Float(0.5)*(math::cos( phase + math::pi<Float>() ) + Float(1)); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Members /// The frequency of the vibrato's modulation wave in hertz. Float frequency; /// The target frequency of the vibrato's modulation wave in hertz. /** * This value allows the vibrato to do smooth transitions between * different modulation frequencies. */ Float targetFrequency; /// The intensity of the vibrato modulation. /** * This is a value between 0 and 1 which indicates the unitless amount that the vibrato * effect should affect the input signal by. A higher depth affects the signal more * by producing more frequency modulation. */ Gain depth; /// The target depth for this vibrato. /** * This value allows the vibrato to do smooth transitions between * different depths. */ Gain targetDepth; /// The modulation phase offset of each channel (in radians). /** * This allows different channels to be in different phases, * creating a stereo (or higher) vibrato effect. */ Array<Float> channelPhase; /// The channel phase offset to use for all channels for which the phase has not been set. Float globalChannelPhase; /// The current phase of the vibrato's modulation wave (in radians). Float phase; /// The maximum delay time in seconds that the vibrato effect can use. Float maxDelayTime; /// A buffer which is used to hold a delayed copy of the input sound so that it can be frequency modulated. SoundBuffer delayBuffer; /// The number of currently valid samples in the delay buffer. Size delayBufferSize; /// The current write position for input to the delay buffer. Index currentDelayWriteIndex; }; //########################################################################################## //************************ End Rim Sound Filters Namespace ******************************* RIM_SOUND_FILTERS_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_SOUND_VIBRATO_H <file_sep>/* * rimImagesConfig.h * Rim Images * * Created by <NAME> on 12/28/08. * Copyright 2008 Rim Software. All rights reserved. * */ #ifndef INCLUDE_RIM_IMAGES_CONFIG_H #define INCLUDE_RIM_IMAGES_CONFIG_H #include "rim/rimFramework.h" //########################################################################################## //########################################################################################## //############ //############ Library Namespace Configuration //############ //########################################################################################## //########################################################################################## #ifndef RIM_IMAGES_NAMESPACE_START #define RIM_IMAGES_NAMESPACE_START RIM_NAMESPACE_START namespace images { #endif #ifndef RIM_IMAGES_NAMESPACE_END #define RIM_IMAGES_NAMESPACE_END }; RIM_NAMESPACE_END #endif //########################################################################################## //**************************** Start Rim Images Namespace ******************************** RIM_IMAGES_NAMESPACE_START //****************************************************************************************** //########################################################################################## //########################################################################################## //**************************** End Rim Images Namespace ********************************** RIM_IMAGES_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_IMAGES_CONFIG_H <file_sep>/* * rimGraphicsGUIFont.h * Rim Graphics GUI * * Created by <NAME> on 1/15/13. * Copyright 2013 Headspace Systems. All rights reserved. * */ #ifndef INCLUDE_RIM_GRAPHICS_GUI_FONT_H #define INCLUDE_RIM_GRAPHICS_GUI_FONT_H #include "rimGraphicsGUIFontsConfig.h" #include "rimGraphicsGUIFontInfo.h" #include "rimGraphicsGUIFontMetrics.h" #include "rimGraphicsGUIGlyphMetrics.h" //########################################################################################## //********************* Start Rim Graphics GUI Fonts Namespace *************************** RIM_GRAPHICS_GUI_FONTS_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class which acts as an interface to a single font style. /** * The class provides ways to access sizing metrics globally and for each glyph, * glyph pair kerning, and can render bitmap images for each glyph that can be * used to do various kinds of font rendering. */ class Font { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructors /// Create a new font object for the font file located at the specified path string. Font( const UTF8String& fontPath ); /// Create a new font object for the font described by the specified font information. /** * This constructor uses the font info's path string to load the font from * mass storage. */ Font( const FontInfo& fontInfo ); /// Create a new font object for a font file with the specified data. /** * This constructor creates a font which uses a memory-resident block of font * data (previously read from a font file) to realize the font. */ Font( const Data& fontData ); /// Create a copy of another font object, obtaining a reference to its font. Font( const Font& other ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Destructor /// Destroy this font object and release all of its resources. ~Font(); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Assignment Operator /// Copy the state of another Font object to this one. Font& operator = ( const Font& other ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Font Info Accessor Methods /// Return a reference to an object which contains information about this font. RIM_INLINE const FontInfo& getInfo() const { return info; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Font Metrics Accessor Methods /// Get font metric information for the specified size of this font. /** * If the method succeeds, the metrics object is updated to reflect * the metrics for this font with the given size and TRUE is returned. * Otherwise, FALSE is returned indicating failure. The method can fail if * an invalid size (i.e. negative) is specified. */ Bool getMetrics( Float fontSize, FontMetrics& metrics ) const; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Font Glyph Accessor Methods /// Get sizing metrics for the glyph with the specified character code and font size. /** * If the metrics are successfully retrieved, they are placed in the output * metrics parameter and TRUE is returned. Otherwise, FALSE is returned and * no metrics are set. */ Bool getGlyphMetrics( Float fontSize, UTF32Char character, GlyphMetrics& metrics ) const; /// Render a bitmap for the glyph with the specified character code and font size. /** * If the glyph's image is successfully rendered, it is placed in the output glyph * image parameter and TRUE is returned. A glyph metrics object is initialized for * the glyph too. If the method fails, FALSE is returned and no image or metrics are * retrieved. */ Bool getGlyphImage( Float fontSize, UTF32Char character, Image& glyphImage, GlyphMetrics& metrics ) const; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Font Kerning Accessor Methods /// Get the kerning advance vector in pixels between the origins for the specified two characters. /** * This method uses the font's internal kerning information, scaled to the * specified font point size, to determine how far to advance * in pixels between the origins of the two specified characters. If the method * succeeds, it places the kerning vector in the output parameter and returns * TRUE. Otherwise, if the method fails, it returns FALSE. */ Bool getKerning( Float fontSize, UTF32Char character1, UTF32Char character2, Vector2f& kerning ) const; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Font Validity Accessor Method /// Return whether or not this font object represents a valid font. Bool isValid() const; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Default Font Accessor Method /// Return a shared pointer to an object representing the default system font. static const Pointer<Font>& getDefault(); private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Class Declaration /// A class which represents a pair of UTF-32 encoded characters used for kerning information access. class CharacterPair; /// A class which stores kerning information for a particular pair of characters. class KerningInfo; /// A class which encapsulates platform-specific information about this font. class FontWrapper; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Helper Methods /// A helper method which sets the size that should be used for the font. Bool setFontSize( Float newFontSize ) const; /// Update the font info structure with more detailed information from the font. void updateFontInfo(); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Members /// A pointer to an object which holds platform-specific information for this font. FontWrapper* wrapper; /// An object which stores information about this font. FontInfo info; /// The current nominal size of the font which allows the font to only be resized when needed. mutable Float currentFontSize; }; //########################################################################################## //********************* End Rim Graphics GUI Fonts Namespace ***************************** RIM_GRAPHICS_GUI_FONTS_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_GRAPHICS_GUI_FONT_H <file_sep>/* * rimSIMDConfig.h * Rim Software * * Created by <NAME> on 7/22/14. * Copyright 2014 __MyCompanyName__. All rights reserved. * */ #ifndef INCLUDE_RIM_SIMD_CONFIG_H #define INCLUDE_RIM_SIMD_CONFIG_H #include "rimMathConfig.h" #include "rimScalarMath.h" //########################################################################################## //########################################################################################## //############ //############ SIMD Configuration Macros //############ //########################################################################################## //########################################################################################## /// Determine whether or not SIMD code should be used. /** * If set to 1, many operations will be parallelized using SIMD vector operations. * This will generally increase performance but may not work on all hardware. If set to * 0, no SIMD operations will be used. If enabled but the hardware doesn't support SIMD * instructions, a serial fallback implementation will be used. */ #ifndef RIM_USE_SIMD #define RIM_USE_SIMD 1 #endif /// Define the newest major version of SSE that can be used by GSound. /** * This value can be used to limit the complexity of the SSE operations * performed when compiling for hardware that doesn't support newer SSE versions. * Only SSE versions up to this version (specified as an integer number) * can be used. */ #ifndef RIM_SSE_MAX_MAJOR_VERSION #define RIM_SSE_MAX_MAJOR_VERSION 4 #endif /// Define the newest minor version of SSE that can be used by GSound. /** * This value can be used to limit the complexity of the SSE operations * performed when compiling for hardware that doesn't support newer SSE versions. * Only SSE versions up to this version (specified as an integer number) * can be used. */ #ifndef RIM_SSE_MAX_MINOR_VERSION #define RIM_SSE_MAX_MINOR_VERSION 2 #endif #if RIM_USE_SIMD #if defined(RIM_CPU_POWER_PC) && defined(__ALTIVEC__) /// Define that Altivec instructions are available. #define RIM_SIMD_ALTIVEC 1 /// Redfine the keyword associated with an Altivec vector to avoid name collisions. #ifdef RIM_COMPILER_GCC #undef vector #define RIM_ALTIVEC_VECTOR __vector #endif /// A macro which produces a boolean value indicating whether the specified (major,minor) version of SSE is supported. #define RIM_SSE_VERSION_IS_SUPPORTED( majorVersion, minorVersion ) 0 #elif defined(RIM_CPU_INTEL) /// Define that SSE instructions are available. #define RIM_SIMD_SSE 1 /// Define a macro which determines whether a specified (major,minor) version of SSE is allowed by the user. #define RIM_SSE_VERSION_IS_ALLOWED( majorVersion, minorVersion ) \ (RIM_SSE_MAX_MAJOR_VERSION > majorVersion || \ (RIM_SSE_MAX_MAJOR_VERSION == majorVersion && RIM_SSE_MAX_MINOR_VERSION >= minorVersion)) // Determine the newest available version of SSE and include its header. #if defined(RIM_COMPILER_GCC) #if defined(__SSE4_2__) #define RIM_SSE_MAJOR_VERSION 4 #define RIM_SSE_MINOR_VERSION 2 #elif defined(__SSE4_1__) #define RIM_SSE_MAJOR_VERSION 4 #define RIM_SSE_MINOR_VERSION 1 #elif defined(__SSSE3__) #define RIM_SSE_MAJOR_VERSION 3 #define RIM_SSE_MINOR_VERSION 1 #elif defined(__SSE3__) #define RIM_SSE_MAJOR_VERSION 3 #define RIM_SSE_MINOR_VERSION 0 #elif defined(__SSE2__) #define RIM_SSE_MAJOR_VERSION 2 #define RIM_SSE_MINOR_VERSION 0 #elif defined(__SSE__) #define RIM_SSE_MAJOR_VERSION 1 #define RIM_SSE_MINOR_VERSION 0 #endif #elif defined(RIM_COMPILER_MSVC) // Assume the newest version because MSVC has no way to determine this. #define RIM_SSE_MAJOR_VERSION 4 #define RIM_SSE_MINOR_VERSION 2 #endif /// A macro which produces a boolean value indicating whether the specified (major,minor) version of SSE is supported. #define RIM_SSE_VERSION_IS_SUPPORTED( majorVersion, minorVersion ) \ (RIM_SSE_VERSION_IS_ALLOWED( majorVersion, minorVersion ) && \ ((majorVersion < RIM_SSE_MAJOR_VERSION) || \ (majorVersion == RIM_SSE_MAJOR_VERSION && minorVersion <= RIM_SSE_MINOR_VERSION))) #endif #else // !RIM_USE_SIMD /// A macro which produces a boolean value indicating whether the specified (major,minor) version of SSE is supported. #define RIM_SSE_VERSION_IS_SUPPORTED( majorVersion, minorVersion ) 0 #endif //########################################################################################## //########################################################################################## //############ //############ SIMD Header Includes //############ //########################################################################################## //########################################################################################## #if RIM_SSE_VERSION_IS_SUPPORTED(1,0) #if defined(RIM_COMPILER_MSVC) #include <intrin.h> // Include for extra intrinsics #endif #include <mmintrin.h> // Include for MMX intrinsics #include <xmmintrin.h> // Include for SSE intrinsics #endif #if RIM_SSE_VERSION_IS_SUPPORTED(2,0) #include <emmintrin.h> // Include for SSE2 intrinsics #endif #if RIM_SSE_VERSION_IS_SUPPORTED(3,0) #include <pmmintrin.h> // Include for SSE3 intrinsics #endif #if RIM_SSE_VERSION_IS_SUPPORTED(3,1) #include <tmmintrin.h> // Include for SSSE3 intrinsics #endif #if RIM_SSE_VERSION_IS_SUPPORTED(4,1) #include <smmintrin.h> // Include for SSE4.1 intrinsics #endif #if RIM_SSE_VERSION_IS_SUPPORTED(4,2) #include <nmmintrin.h> // Include for SSE4.2 intrinsics #endif //########################################################################################## //***************************** Start Rim Math Namespace ********************************* RIM_MATH_NAMESPACE_START //****************************************************************************************** //########################################################################################## //########################################################################################## //***************************** End Rim Math Namespace *********************************** RIM_MATH_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_SIMD_CONFIG_H <file_sep>/* * rimSoundResource.h * Rim Sound * * Created by <NAME> on 12/9/12. * Copyright 2012 __MyCompanyName__. All rights reserved. * */ #ifndef INCLUDE_RIM_SOUND_RESOURCE_H #define INCLUDE_RIM_SOUND_RESOURCE_H #include "rimSoundUtilitiesConfig.h" #include "rimSoundInputStream.h" //########################################################################################## //*********************** Start Rim Sound Utilities Namespace **************************** RIM_SOUND_UTILITIES_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class which represents either a streaming or memory-resident sound resource. /** * This class allows the user to reference a read-only source of sound data without * knowing its storage type. The source could be a memory-resident SoundBuffer which contains * the referenced sound data or the source could be a streaming source of data (i.e. * from a file). Thus, this allows both streaming and non-streaming sounds to be treated * the same. */ class SoundResource : public SoundInputStream { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructors /// Create a new sound resource for the specified memory-resident sound buffer. /** * This constructor copies the contents of the specified buffer into a new * internal buffer. */ SoundResource( const SoundBuffer& buffer ); /// Create a new sound resource for the specified memory-resident sound buffer. /** * This constructor copies the specified number of samples from the specified * buffer into a new internal buffer. */ SoundResource( const SoundBuffer& buffer, Size numSamples ); /// Create a new sound resource for the specified sound input stream. /** * This constructor allows the user to optionally specify if the data pointed * to by the stream should be read entirely into memory, rather than being * streamed in real time. The default is to use pure streaming. */ SoundResource( const Pointer<SoundInputStream>& stream, Bool memoryResident = false ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Public Stream Accessor Methods /// Return whether or not this resource has a streaming source of sound data. RIM_INLINE Bool hasStream() const { return !stream.isNull(); } /// Return a pointer to this sound resource's streaming source of sound data. RIM_INLINE const Pointer<SoundInputStream>& getStream() const { return stream; } /// Return whether or not this resource has a memory-resident buffer of sound data. RIM_INLINE Bool hasBuffer() const { return !buffer.isNull(); } /// Return a pointer to this sound resource's internal memory-resident buffer of sound data. RIM_INLINE const Pointer<SoundBuffer>& getBuffer() const { return buffer; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Resource Loading Methods /// Load this resource from its stream into a buffer, if possible. /** * The method returns whether or not the resource was able to be loaded. */ Bool load(); /// Destroy the buffer for this resource, and revert to using the stream. /** * The method returns whether or not the resource was able to be unloaded. * The method fails if there is no stream for the resource. */ Bool unload(); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Public Seek Status Accessor Methods /// Return whether or not seeking is allowed in this sound resource input stream. virtual Bool canSeek() const; /// Return whether or not this resource stream's current position can be moved by the specified signed sample offset. /** * This sample offset is specified as the number of sample frames to move * in the stream - a frame is equal to one sample for each channel in the stream. */ virtual Bool canSeek( Int64 relativeSampleOffset ) const; /// Move the current sample frame position in the resource stream by the specified signed amount. /** * This method attempts to seek the position in the stream by the specified amount. * The method returns the signed amount that the position in the stream was changed * by. Thus, if seeking is not allowed, 0 is returned. Otherwise, the stream should * seek as far as possible in the specified direction and return the actual change * in position. */ virtual Int64 seek( Int64 relativeSampleOffset ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Stream Size Accessor Methods /// Return the number of samples remaining in the sound resource input stream. /** * The value returned must only be a lower bound on the total number of sample * frames in the stream. For instance, if there are samples remaining, the method * should return at least 1. If there are no samples remaining, the method should * return 0. */ virtual SoundSize getSamplesRemaining() const; /// Return the current position of the stream within itself. /** * The returned value indicates the sample index of the current read * position within the sound stream. For unbounded streams, this indicates * the number of samples that have been read by the stream since it was opened. */ virtual SampleIndex getPosition() const; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Stream Format Accessor Methods /// Return the number of channels that are in the sound resource input stream. /** * This is the number of channels that will be read with each read call * to the stream's read method. */ virtual Size getChannelCount() const; /// Return the sample rate of the sound resource input stream's source audio data. /** * Since some types of streams support variable sampling rates, this value * is not necessarily the sample rate of all audio that is read from the stream. * However, for most streams, this value represents the sample rate of the entire * stream. One should always test the sample rate of the buffers returned by the * stream to see what their sample rates are before doing any operations that assume * a sampling rate. */ virtual SampleRate getSampleRate() const; /// Return the actual sample type used in the resource stream. /** * This is the format of the stream's source data. For instance, a file * might be encoded with 8-bit, 16-bit or 24-bit samples. This value * indicates that sample type. For formats that don't have a native sample type, * such as those which use frequency domain encoding, this function should * return SampleType::SAMPLE_32F, indicating that the stream's native format * is 32-bit floating point samples. */ virtual SampleType getNativeSampleType() const; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Stream Status Accessor Method /// Return whether or not the resource has a valid source of sound data. /** * This method should return TRUE if everything is OK, but might return * FALSE if the input stream is not valid (file not found, etc) or * if the stream's data has improper format. */ virtual Bool isValid() const; private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Sound Input Method /// Read the specified number of samples from the input stream into the output buffer. /** * This method attempts to read the specified number of samples from the stream * into the input buffer. It then returns the total number of valid samples which * were read into the output buffer. The samples are converted to the format * stored in the input buffer (Sample32f). The input position in the stream * is advanced by the number of samples that are read. */ virtual Size readSamples( SoundBuffer& inputBuffer, Size numSamples ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Members /// A pointer to a buffer which this resource is wrapping. Pointer<SoundBuffer> buffer; /// A pointer to a stream which this resource is wrapping. Pointer<SoundInputStream> stream; /// The current sample read index within the sound buffer which this resource is wrapping. Index currentPosition; }; //########################################################################################## //*********************** End Rim Sound Utilities Namespace ****************************** RIM_SOUND_UTILITIES_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_SOUND_RESOURCE_H <file_sep>/* * rimPhysicsCollisionAlgorithmDispatcher.h * Rim Physics * * Created by <NAME> on 11/28/09. * Copyright 2009 Rim Software. All rights reserved. * */ #ifndef INCLUDE_RIM_PHYSICS_COLLISION_ALGORITHM_DISPATCHER_H #define INCLUDE_RIM_PHYSICS_COLLISION_ALGORITHM_DISPATCHER_H #include "rimPhysicsCollisionConfig.h" #include "rimPhysicsCollisionAlgorithm.h" //########################################################################################## //********************** Start Rim Physics Collision Namespace *************************** RIM_PHYSICS_COLLISION_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class which performs collision double dispatch on the type of an object's shape. template < typename ObjectType1, typename ObjectType2 > class CollisionAlgorithmDispatcher { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Public Type Definitions /// Define the type to use for a collision algorithm in this algorithm dispatcher. typedef CollisionAlgorithm<ObjectType1,ObjectType2> AlgorithmType; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructors /// Create a default algorithm dispatcher with no algorithms. RIM_NO_INLINE CollisionAlgorithmDispatcher() : algorithmTable( rim::util::allocate<AlgorithmType*>( DEFAULT_HASH_TABLE_SIZE ) ), algorithmTableSize( DEFAULT_HASH_TABLE_SIZE ) { // Zero-out the buckets in the new algorithm table. for ( Index i = 0; i < algorithmTableSize; i++ ) algorithmTable[i] = NULL; } /// Create a copy of an algorithm dispatcher. RIM_NO_INLINE CollisionAlgorithmDispatcher( const CollisionAlgorithmDispatcher& other ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Destructor /// Destroy this algorithm dispatcher and all of the algorithms it contains. RIM_NO_INLINE ~CollisionAlgorithmDispatcher() { algorithms.clear(); // Deallocate the algorithm hash table. rim::util::deallocate( algorithmTable ); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Assignment Operator /// Assign the algorithms of one dispatcher to another. RIM_NO_INLINE CollisionAlgorithmDispatcher& operator = ( const CollisionAlgorithmDispatcher& other ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Collision Detection Methods /// Test the specified collider pair for collisions and add the results to the result set. /** * If a collision occurred, TRUE is returned and the resulting CollisionPoint(s) * are added to the CollisionManifold for the object pair in the specified * CollisionResultSet. If there was no collision detected or there was no * collision algorithm that was compatible with the specified colliders, * FALSE is returned and the result set is unmodified. */ RIM_INLINE Bool testForCollisions( const ObjectCollider<ObjectType1>& collider1, const ObjectCollider<ObjectType2>& collider2, CollisionResultSet<ObjectType1,ObjectType2>& resultSet ) { AlgorithmType* algorithm = getAlgorithmForShapeTypes( collider1.getType(), collider2.getType() ); if ( algorithm ) return algorithm->testForCollisions( collider1, collider2, resultSet ); else return false; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Collision Algorithm Accessor Methods /// Add the specified CollisionAlgorithm to this dispatcher. /** * If there already exists an algorithm for the specified algorithm's shape types, * the old algorithm is replaced. */ RIM_INLINE Bool addAlgorithm( const Pointer<AlgorithmType>& newAlgorithm ) { return this->addAlgorithmPrivate( newAlgorithm ); } /// Return a pointer to the algorithm for the specified template shape types. /** * If such an algorithm exists in this dispatcher, a pointer to it is * returned. Otherwise, NULL is returned. */ RIM_INLINE AlgorithmType* getAlgorithm( const CollisionShapeType& shapeType1, const CollisionShapeType& shapeType2 ) { return this->getAlgorithmForShapeTypes( shapeType1, shapeType2 ); } /// Return a pointer to the algorithm for the specified template shape types. /** * If such an algorithm exists in this dispatcher, a pointer to it is * returned. Otherwise, NULL is returned. */ RIM_INLINE const AlgorithmType* getAlgorithm( const CollisionShapeType& shapeType1, const CollisionShapeType& shapeType2 ) const { return this->getAlgorithmForShapeTypes( shapeType1, shapeType2 ); } /// Return a pointer to the algorithm for the specified template shape types. /** * If such an algorithm exists in this dispatcher, a pointer to it is * returned. Otherwise, NULL is returned. */ template < typename ShapeType1, typename ShapeType2 > RIM_INLINE AlgorithmType* getAlgorithm() { static const CollisionShapeType shapeType1 = CollisionShapeType::of<ShapeType1>(); static const CollisionShapeType shapeType2 = CollisionShapeType::of<ShapeType2>(); return this->getAlgorithmForShapeTypes( shapeType1, shapeType2 ); } /// Return a pointer to the algorithm for the specified template shape types. /** * If such an algorithm exists in this dispatcher, a pointer to it is * returned. Otherwise, NULL is returned. */ template < typename ShapeType1, typename ShapeType2 > RIM_INLINE const AlgorithmType* getAlgorithm() const { static const CollisionShapeType shapeType1 = CollisionShapeType::of<ShapeType1>(); static const CollisionShapeType shapeType2 = CollisionShapeType::of<ShapeType2>(); return this->getAlgorithmForShapeTypes( shapeType1, shapeType2 ); } /// Remove an algorithm with the specified templated shape types from this dispatcher. /** * If such an algorithm exists in this dispatcher, it is removed and TRUE is * returned. Otherwise, FALSE is returned and the dispatcher is unchanged. */ template < typename ShapeType1, typename ShapeType2 > RIM_NO_INLINE Bool removeAlgorithm() { static const CollisionShapeType shapeType1 = CollisionShapeType::of<ShapeType1>(); static const CollisionShapeType shapeType2 = CollisionShapeType::of<ShapeType2>(); AlgorithmType** algorithmBucket = algorithmTable + getBucketIndex( shapeType1.getID(), shapeType2.getID(), algorithmTableSize ); AlgorithmType* algorithm = *algorithmBucket; if ( algorithm ) { // Zero-out the hash table entry. *algorithmBucket = NULL; for ( Index i = 0; i < algorithms.getSize(); i++ ) { if ( algorithm == algorithms[i] ) { algorithms.removeAtIndexUnordered( i ); break; } } return true; } else return false; } /// Remove all algorithms from this CollisionAlgorithmDispatcher. RIM_NO_INLINE void clearAlgorihtms() { // Destroy each algorithm in this dispatcher. algorithms.clear(); // Zero-out the algorithm hash table. for ( Index i = 0; i < algorithmTableSize; i++ ) algorithmTable[i] = NULL; } /// Return the number of collision algorithms that this dispatcher has. RIM_FORCE_INLINE Size getAlgorithmCount() const { return algorithms.getSize(); } private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Helper Methods /// Add the specified algorithm pointer to this algorithm dispatcher RIM_NO_INLINE Bool addAlgorithmPrivate( const Pointer<AlgorithmType>& newAlgorithm ); /// Resize this dispatcher's algorithm hash table until it hashes perfectly. RIM_NO_INLINE void resizeAlgorithmHashTable(); /// Return a pointer to the algorithm for the specified shape types in this dispatcher. /** * If no such algorithm exists, NULL is returned. */ RIM_FORCE_INLINE AlgorithmType* getAlgorithmForShapeTypes( const CollisionShapeType& type1, const CollisionShapeType& type2 ) const { return algorithmTable[ this->getBucketIndex(type1.getID(), type2.getID(), algorithmTableSize) ]; } /// Return a hash code that is created by combining the specified hash code pair. RIM_FORCE_INLINE static Hash getBucketIndex( Hash hash1, Hash hash2, Hash tableSize ) { return getPairHashCode( hash1, hash2 ) % tableSize; } /// Return a hash code that is created by combining the specified hash code pair. RIM_FORCE_INLINE static Hash getPairHashCode( Hash hash1, Hash hash2 ) { return (hash1*Hash(2185031351ul)) ^ (hash2*Hash(4232417593ul)); } RIM_INLINE static Hash getNextPrime( Hash n ) { for ( Index i = 0; i < NUMBER_OF_PRIME_HASH_TABLE_SIZES; i++ ) { if ( PRIME_HASH_TABLE_SIZES[i] > n ) return PRIME_HASH_TABLE_SIZES[i]; } return n; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Members /// An array of pointers representing a hash table for the algorithms contained in this dispatcher. AlgorithmType** algorithmTable; /// The size of the collision algorithm hash table. Hash algorithmTableSize; /// A list of pointers to each algorithm in this dispatcher. ArrayList<Pointer<AlgorithmType> > algorithms; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Static Data Members /// The default size of a collision algorithm dispatcher hash table. static const Size DEFAULT_HASH_TABLE_SIZE = 11; /// The number of prime hash table sizes. static const Size NUMBER_OF_PRIME_HASH_TABLE_SIZES = 28; /// An array of prime hash table sizes. static const Hash PRIME_HASH_TABLE_SIZES[NUMBER_OF_PRIME_HASH_TABLE_SIZES]; }; //########################################################################################## //########################################################################################## //############ //############ Copy Constructor Implementation //############ //########################################################################################## //########################################################################################## template < typename ObjectType1, typename ObjectType2 > CollisionAlgorithmDispatcher<ObjectType1,ObjectType2>:: CollisionAlgorithmDispatcher( const CollisionAlgorithmDispatcher& other ) : algorithmTable( rim::util::allocate<AlgorithmType*>( other.algorithmTableSize ) ), algorithmTableSize( other.algorithmTableSize ), algorithms( other.algorithms.getCapacity() ) { // For each algorithm in the other dispatcher, copy the algorithm // and hash it into this algorithm dispatcher. Size numAlgorithms = other.algorithms.getSize(); for ( Index i = 0; i < numAlgorithms; i++ ) { const Pointer<AlgorithmType>& newAlgorithm = other.algorithms[i]; // Insert it in the hash table and list of algorithms. Hash bucketIndex = getBucketIndex( newAlgorithm->getShapeType1().getID(), newAlgorithm->getShapeType2().getID(), algorithmTableSize ); algorithmTable[bucketIndex] = newAlgorithm; // Add the algorithm to the list of algorithms. algorithms.add( newAlgorithm ); } } //########################################################################################## //########################################################################################## //############ //############ Assignment Operator Implementation //############ //########################################################################################## //########################################################################################## template < typename ObjectType1, typename ObjectType2 > CollisionAlgorithmDispatcher<ObjectType1,ObjectType2>& CollisionAlgorithmDispatcher<ObjectType1,ObjectType2>:: operator = ( const CollisionAlgorithmDispatcher& other ) { if ( this != &other ) { // Clear the old list of algorithms. algorithms.clear(); // Reallocate the algorithm hash table. rim::util::deallocate( algorithmTable ); algorithmTable = rim::util::allocate<AlgorithmType*>( other.algorithmTableSize ); algorithmTableSize = other.algorithmTableSize; // For each algorithm in the other dispatcher, copy the algorithm // and hash it into this algorithm dispatcher. const Size numAlgorithms = other.algorithms.getSize(); for ( Index i = 0; i < numAlgorithms; i++ ) { const Pointer<AlgorithmType>& newAlgorithm = other.algorithms[i]; // Insert it in the hash table. Hash bucketIndex = getBucketIndex( newAlgorithm->getShapeType1().getID(), newAlgorithm->getShapeType2().getID(), algorithmTableSize ); algorithmTable[bucketIndex] = newAlgorithm; // Add the algorithm to the list of algorithms. algorithms.add( newAlgorithm ); } } return *this; } //########################################################################################## //########################################################################################## //############ //############ Algorithm Add Method Implementation //############ //########################################################################################## //########################################################################################## template < typename ObjectType1, typename ObjectType2 > Bool CollisionAlgorithmDispatcher<ObjectType1,ObjectType2>:: addAlgorithmPrivate( const Pointer<AlgorithmType>& newAlgorithm ) { if ( newAlgorithm.isNull() ) return false; AlgorithmType** algorithmBucket = algorithmTable + getBucketIndex( newAlgorithm->getShapeTypeID1(), newAlgorithm->getShapeTypeID2(), algorithmTableSize ); if ( *algorithmBucket ) { // An algorithm already exists for this bucket. AlgorithmType* const existingAlgorithm = *algorithmBucket; // Test to see if the shape types for the new and old algorithms match. if ( newAlgorithm->getShapeType1() == existingAlgorithm->getShapeType1() && newAlgorithm->getShapeType2() == existingAlgorithm->getShapeType2() ) { // Replace the existing algorithm with the new algorithm. for ( Index i = 0; i < algorithms.getSize(); i++ ) { if ( existingAlgorithm == algorithms[i] ) { algorithms.removeAtIndexUnordered( i ); break; } } *algorithmBucket = newAlgorithm; algorithms.add( newAlgorithm ); } else { // The existing algorithm cannot be replaced. // Resize the algorithm hash table to accomodate the new algorithm. algorithms.add( newAlgorithm ); resizeAlgorithmHashTable(); } } else { // No algorithm already exists for this bucket. Add the new algorithm. *algorithmBucket = newAlgorithm; algorithms.add( newAlgorithm ); } return true; } //########################################################################################## //########################################################################################## //############ //############ Algorithm Hash Table Resize Method Implementation //############ //########################################################################################## //########################################################################################## template < typename ObjectType1, typename ObjectType2 > void CollisionAlgorithmDispatcher<ObjectType1,ObjectType2>:: resizeAlgorithmHashTable() { Hash newAlgorithmTableSize = algorithmTableSize; AlgorithmType** newAlgorithmTable; collisionAlgorithmDispatcherHashTableResizeLoop: { // Create a candidate hash table for the next largest prime number hash table size. newAlgorithmTableSize = getNextPrime( newAlgorithmTableSize ); newAlgorithmTable = rim::util::allocate<AlgorithmType*>( newAlgorithmTableSize ); // Zero-out the buckets in the new algorithm table. for ( Index i = 0; i < newAlgorithmTableSize; i++ ) newAlgorithmTable[i] = NULL; // For each existing algorithm, determine its algorithm bucket. Size numAlgorithms = algorithms.getSize(); for ( Index i = 0; i < numAlgorithms; i++ ) { AlgorithmType* algorithm = algorithms[i]; AlgorithmType** algorithmBucket = newAlgorithmTable + this->getBucketIndex( algorithm->getShapeType1().getID(), algorithm->getShapeType2().getID(), newAlgorithmTableSize ); if ( *algorithmBucket ) { // There is an algorithm table collision, deallocate this hash table attempt // and start the resizing process. rim::util::deallocate( newAlgorithmTable ); goto collisionAlgorithmDispatcherHashTableResizeLoop; } else { // Add the algorithm to the new table. *algorithmBucket = algorithm; } } } // Deallocate the old algorithm hash table and replace it with the new one. rim::util::deallocate( algorithmTable ); algorithmTable = newAlgorithmTable; algorithmTableSize = newAlgorithmTableSize; } //########################################################################################## //########################################################################################## //############ //############ Prime Hash Table Size Array Definition //############ //########################################################################################## //########################################################################################## template < typename ObjectType1, typename ObjectType2 > const Hash CollisionAlgorithmDispatcher<ObjectType1,ObjectType2>:: PRIME_HASH_TABLE_SIZES[] = { 11, // Between 2^3 and 2^4 23, // Between 2^4 and 2^5 53, // Between 2^5 and 2^6 97, // Between 2^6 and 2^7 193, // Between 2^7 and 2^8 389, // Between 2^8 and 2^9 769, // Between 2^9 and 2^10 1543, // Between 2^10 and 2^11 3079, // Between 2^11 and 2^12 6151, // Between 2^12 and 2^13 12289, // Between 2^13 and 2^14 24593, // Between 2^14 and 2^15 49157, // Between 2^15 and 2^16 98317, // Between 2^16 and 2^17 196613, // Between 2^17 and 2^18 393241, // Between 2^18 and 2^19 786433, // Between 2^19 and 2^20 1572869, // Between 2^20 and 2^21 3145739, // Between 2^21 and 2^22 6291469, // Between 2^22 and 2^23 12582917, // Between 2^23 and 2^24 25165843, // Between 2^24 and 2^25 50331653, // Between 2^25 and 2^26 100663319, // Between 2^26 and 2^27 201326611, // Between 2^27 and 2^28 402653189, // Between 2^28 and 2^29 805306457, // Between 2^29 and 2^30 1610612741, // Between 2^30 and 2^31 }; //########################################################################################## //********************** End Rim Physics Collision Namespace ***************************** RIM_PHYSICS_COLLISION_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_PHYSICS_COLLISION_ALGORITHM_DISPATCHER_H <file_sep>/* * rimSoundBufferQueue.h * Rim Sound * * Created by <NAME> on 12/8/12. * Copyright 2012 __MyCompanyName__. All rights reserved. * */ #ifndef INCLUDE_RIM_SOUND_BUFFER_QUEUE_H #define INCLUDE_RIM_SOUND_BUFFER_QUEUE_H #include "rimSoundUtilitiesConfig.h" #include "rimSoundBuffer.h" //########################################################################################## //*********************** Start Rim Sound Utilities Namespace **************************** RIM_SOUND_UTILITIES_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class which efficiently queues SoundBuffer objects in a first-in-first-out manner. /** * This class can be used to buffer sound data between a sound producer and sound * consumer, such as between threads. However, this queue is NOT threadsafe, so * thread synchronization should be performed externally. */ class SoundBufferQueue { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructors /// Create a new empty sound buffer queue. SoundBufferQueue(); /// Create an exact copy of the specified sound buffer queue. SoundBufferQueue( const SoundBufferQueue& other ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Destructor /// Destroy this sound buffer queue and release all associated resources. ~SoundBufferQueue(); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Assignment Operator /// Assign the state of another sound buffer queue to this queue. SoundBufferQueue& operator = ( const SoundBufferQueue& other ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Queue Accessor Methods /// Return the total number of buffers that are queued in this buffer queue, waiting to be read. RIM_INLINE Size getBufferCount() const { return numBuffersQueued; } /// Return whether or not this buffer queue has a next buffer to read from. RIM_INLINE Bool hasNextBuffer() const { return numBuffersQueued > 0; } /// Return a reference to the next buffer to be read in the queue. /** * The buffer's size corresponds to the number of valid samples in the buffer. */ SoundBuffer& getNextBuffer() { return *buffers[nextOutputBufferIndex]; } /// Return a reference to the next buffer to be read in the queue. /** * The buffer's size corresponds to the number of valid samples in the buffer. */ const SoundBuffer& getNextBuffer() const { return *buffers[nextOutputBufferIndex]; } /// Write the specified number of samples from the given buffer to the queue. void addBuffer( const SoundBuffer& buffer, Size numSamples ); /// Remove the next buffer from the buffer queue, indicating that it has been processed. RIM_INLINE void removeBuffer() { // If possible, increment the next buffer index. if ( this->hasNextBuffer() ) { nextOutputBufferIndex = (nextOutputBufferIndex + 1) % buffers.getSize(); numBuffersQueued--; } } private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Members /// An array of sound buffers which serves as the queue. ArrayList<SoundBuffer*> buffers; /// The index of the buffer in the array which corresponds to the next place to put input audio. Index nextInputBufferIndex; /// The index of the buffer in the array which corresponds to the next place to get output audio. Index nextOutputBufferIndex; /// The total number of valid buffers in the queue waiting to be read. Size numBuffersQueued; }; //########################################################################################## //*********************** End Rim Sound Utilities Namespace ****************************** RIM_SOUND_UTILITIES_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_SOUND_BUFFER_QUEUE_H <file_sep>/* * rimSoundPanner.h * Rim Sound * * Created by <NAME> on 12/13/12. * Copyright 2012 __MyCompanyName__. All rights reserved. * */ #ifndef INCLUDE_RIM_SOUND_PANNER_H #define INCLUDE_RIM_SOUND_PANNER_H #include "rimSoundFiltersConfig.h" #include "rimSoundFilter.h" //########################################################################################## //************************ Start Rim Sound Filters Namespace ***************************** RIM_SOUND_FILTERS_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class that pans input sound around a 360 degree sound panning field. /** * This class takes the input channel layout and pans that layout around * the output channel layout based on a 3D panning direction. */ class Panner : public SoundFilter { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructors /// Create a new sound panner with the default panning direction (forward). RIM_INLINE Panner() : SoundFilter( 1, 1 ), pan() { } /// Create a new sound panner with the specified panning direction. RIM_INLINE Panner( const PanDirection& newPan ) : SoundFilter( 1, 1 ), pan( newPan ) { } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Pan Accessor Methods /// Return the current panning direction of this sound panner. RIM_INLINE const PanDirection& getPan() const { return pan; } /// Set the current panning direction of this sound panner. RIM_INLINE void setPan( const PanDirection& newPan ) { lockMutex(); pan = newPan; unlockMutex(); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Filter Attribute Accessor Methods /// Return a human-readable name for this sound panner. /** * The method returns the string "Panner". */ virtual UTF8String getName() const; /// Return the manufacturer name of this sound panner. /** * The method returns the string "Headspace Sound". */ virtual UTF8String getManufacturer() const; /// Return an object representing the version of this sound panner. virtual SoundFilterVersion getVersion() const; /// Return an object which describes the category of effect that this filter implements. /** * This method returns the value SoundFilterCategory::IMAGING. */ virtual SoundFilterCategory getCategory() const; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Public Static Property Objects /// A string indicating the human-readable name of this panner. static const UTF8String NAME; /// A string indicating the manufacturer name of this panner. static const UTF8String MANUFACTURER; /// An object indicating the version of this panner. static const SoundFilterVersion VERSION; private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Filter Processing Method /// Pan the input channel layout to the output channel layout. virtual SoundFilterResult processFrame( const SoundFilterFrame& inputFrame, SoundFilterFrame& outputFrame, Size numSamples ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Members /// An object representing the current panning direction of this sound panner. PanDirection pan; /// An object which holds the current channel matrix mixing gains for each channel pairing. ChannelMixMatrix channelGains; /// An object which holds the target channel matrix mixing gains for each channel pairing. ChannelMixMatrix targetChannelGains; }; //########################################################################################## //************************ End Rim Sound Filters Namespace ******************************* RIM_SOUND_FILTERS_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_SOUND_PANNER_H <file_sep>/* * rimGraphicsIndexBuffer.h * Rim Graphics * * Created by <NAME> on 3/10/13. * Copyright 2013 __MyCompanyName__. All rights reserved. * */ #ifndef INCLUDE_RIM_GRAPHICS_INDEX_BUFFER_H #define INCLUDE_RIM_GRAPHICS_INDEX_BUFFER_H #include "rimGraphicsBuffersConfig.h" #include "rimGraphicsHardwareBuffer.h" #include "rimGraphicsIndexedPrimitiveType.h" //########################################################################################## //*********************** Start Rim Graphics Buffers Namespace *************************** RIM_GRAPHICS_BUFFERS_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A type of HardwareBuffer which is used for specifying indexed geometric primitives. /** * An IndexBuffer allows the user to specify the type of primitive specified (default, triangles), * as well as the way in which the buffer will be used (default, static). */ class IndexBuffer : public HardwareBuffer { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructors /// Create an empty index buffer for the specified context. RIM_INLINE IndexBuffer( const devices::GraphicsContext* context ) : HardwareBuffer( context, HardwareBufferType::INDEX_BUFFER ) { } }; //########################################################################################## //*********************** End Rim Graphics Buffers Namespace ***************************** RIM_GRAPHICS_BUFFERS_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_GRAPHICS_INDEX_BUFFER_H <file_sep>/* * rimColorSpace.h * Rim Software * * Created by <NAME> on 3/28/14. * Copyright 2014 __MyCompanyName__. All rights reserved. * */ #ifndef INCLUDE_RIM_COLOR_SPACE_H #define INCLUDE_RIM_COLOR_SPACE_H #include "rimImagesConfig.h" //########################################################################################## //**************************** Start Rim Images Namespace ******************************** RIM_IMAGES_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class representing the color space of a color. class ColorSpace { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Color Space Enum Declaration typedef enum Type { /// An undefined color space. UNDEFINED, //****************************************************************** // RGB Color Spaces. /// The RGB color space with unspecified gamma. /** * The user should usually interpret this as sRGB, since most images * are created to look good in that color space. However, the image * data for some applications may be specified in linear RGB space. */ RGB, /// The standard sRGB color space. sRGB, /// The RGB color space with values on a linear scale. /** * This is a color space where intensity values are spaced linearly * from dark to light. Unless your images are known to be in a linear * color space, it is best to use sRGB. */ LINEAR_RGB, /// The Adobe RGB color space. ADOBE_RGB, /// The CIE RGB color space. CIE_RGB, /// The scRGB color space. scRGB, //****************************************************************** // Other Color Spaces. /// The Cyan-Magenta-Yellow-Black color space for subtractive color mixing. CMYK, /// The Hue-Saturation-Value color space. HSV, /// The Hue-Saturation-Lightness color space. HSL, /// The YUV color space. YUV, /// THe YIQ color space. YIQ, /// The YPbPr color space YPbPr, /// The xvYCC color space. xvYCC, /// The CIE XYZ color space. CIE_XYZ, /// The CIE LAB color space. CIE_LAB, /// The CIE LUV color space. CIE_LUV, /// The CIE UVW color space. CIE_UVW }; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructors /// Create a color space object with an UNDEFINED color space. RIM_INLINE ColorSpace() : type( UNDEFINED ) { } /// Create a color space object from the specified color space Enum. RIM_INLINE ColorSpace( ColorSpace::Type newType ) : type( newType ) { } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Enum Cast Operator /// Convert this light type to an enum value. RIM_INLINE operator Type () const { return type; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Color Space String Conversion Methods /// Return a string representation of the color space. String toString() const; /// Convert this color space into a string representation. RIM_INLINE operator String () const { return this->toString(); } private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Members /// An enum value specifying the color space. Type type; }; //########################################################################################## //**************************** End Rim Images Namespace ********************************** RIM_IMAGES_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_COLOR_SPACE_H <file_sep>/* * rimGraphicsBufferRange.h * Rim Software * * Created by <NAME> on 7/3/14. * Copyright 2014 __MyCompanyName__. All rights reserved. * */ #ifndef INCLUDE_RIM_GRAPHICS_BUFFER_RANGE_H #define INCLUDE_RIM_GRAPHICS_BUFFER_RANGE_H #include "rimGraphicsBuffersConfig.h" #include "rimGraphicsIndexedPrimitiveType.h" //########################################################################################## //*********************** Start Rim Graphics Buffers Namespace *************************** RIM_GRAPHICS_BUFFERS_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class which specifies a range of primitives to render from either a vertex or index buffer. class BufferRange { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructors /// Create a new buffer range with the UNDEFINED primitive type and zero length. RIM_INLINE BufferRange() : primitiveType( IndexedPrimitiveType::UNDEFINED ), vertexCount( 0 ), startIndex( 0 ) { } /// Create a new buffer range with the specified primitive type, vertex count, and start index. RIM_INLINE BufferRange( const IndexedPrimitiveType& newPrimitiveType, Size newVertexCount, Index newStartIndex = 0 ) : primitiveType( newPrimitiveType ), vertexCount( newVertexCount ), startIndex( newStartIndex ) { } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Indexed Primitive Type Accessor Methods /// Return an object describing the type of primitive this buffer range corresponds to. RIM_INLINE const IndexedPrimitiveType& getPrimitiveType() const { return primitiveType; } /// Set the type of primitive this buffer range corresponds to. RIM_INLINE void setPrimitiveType( const IndexedPrimitiveType& newPrimitiveType ) { primitiveType = newPrimitiveType; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Start Index Accessor Methods /// Return the start index offset within the buffer. RIM_INLINE Index getStartIndex() const { return startIndex; } /// Set the start index offset within the buffer. RIM_INLINE void setStartIndex( Index newStartIndex ) { startIndex = newStartIndex; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Vertex Count Accessor Methods /// Return the number of vertices to draw from the buffer. RIM_INLINE Size getVertexCount() const { return vertexCount; } /// Set the number of vertices to draw from the buffer. RIM_INLINE void setVertexCount( Size newVertexCount ) { vertexCount = newVertexCount; } private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Members /// A the type of indexed primitive this buffer range corresponds to. IndexedPrimitiveType primitiveType; /// The start index offset within the buffer. Index startIndex; /// The number of vertices to draw from the buffer. Size vertexCount; }; //########################################################################################## //*********************** End Rim Graphics Buffers Namespace ***************************** RIM_GRAPHICS_BUFFERS_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_GRAPHICS_BUFFER_RANGE_H <file_sep>/* * rimGenericSoundBuffer.h * Rim Sound * * Created by <NAME> on 7/27/12. * Copyright 2012 __MyCompanyName__. All rights reserved. * */ <file_sep>/* * rimSoundDeviceID.h * Rim Sound * * Created by <NAME> on 6/7/08. * Copyright 2008 Rim Software. All rights reserved. * */ #ifndef INCLUDE_RIM_SOUND_DEVICE_ID_H #define INCLUDE_RIM_SOUND_DEVICE_ID_H #include "rimSoundDevicesConfig.h" //########################################################################################## //************************ Start Rim Sound Devices Namespace ***************************** RIM_SOUND_DEVICES_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class which is used to encapsulate a unique identifier for a system sound device. /** * This opaque type uses a platform-dependent internal representation which uniquelly * identifies a sound device. */ class SoundDeviceID { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Public Constants /// Define an instance of SoundDeviceID that represents an invalid device. static const SoundDeviceID INVALID_DEVICE; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Comparison Operators /// Return whether or not this device ID represents the same device as another. RIM_INLINE Bool operator == ( const SoundDeviceID& other ) const { return deviceID == other.deviceID; } /// Return whether or not this device ID represents a different device than another. RIM_INLINE Bool operator != ( const SoundDeviceID& other ) const { return deviceID != other.deviceID; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Device Status Accessor Method /// Return whether or not this SoundDeviceID represents a valid device. /** * This condition is met whenever the device ID is not equal to INVALID_DEVICE_ID. */ RIM_INLINE Bool isValid() const { return deviceID != INVALID_DEVICE_ID; } private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Constructor #if defined(RIM_PLATFORM_WINDOWS) /// Create a SoundDeviceID object which represents the device with the specified device ID. RIM_INLINE explicit SoundDeviceID( const UTF16String& newDeviceID ) : deviceID( newDeviceID ) { } #else /// Create a SoundDeviceID object which represents the device with the specified device ID. RIM_INLINE explicit SoundDeviceID( UInt newDeviceID ) : deviceID( newDeviceID ) { } #endif //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Conversion Methods #if defined(RIM_PLATFORM_WINDOWS) /// Return a const reference to the wide-character string uniquely representing a sound device. RIM_INLINE const UTF16String& getIDString() const { return deviceID; } #else /// Convert this SoundDeviceID object to an unsigned integer which uniquely represents a sound device. RIM_INLINE operator UInt () const { return deviceID; } #endif //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Members #if defined(RIM_PLATFORM_WINDOWS) /// The underlying representation of a SoundDeviceID on windows, a UTF-16 encoded ID string. UTF16String deviceID; /// The reserved ID used to indicate an invalid device. static const UTF16String INVALID_DEVICE_ID; #else /// The underlying representation of a SoundDeviceID, an unsigned integer. UInt deviceID; /// The reserved ID used to indicate an invalid device. static const UInt INVALID_DEVICE_ID = 0xFFFFFFFF; #endif //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Friend Declaration /// Declare the SoundDeviceManager a friend so that it can construct SoundDeviceID objects. friend class SoundDeviceManager; /// Declare the SoundDevice a friend so that it can construct SoundDeviceID objects. friend class SoundDevice; }; //########################################################################################## //************************ End Rim Sound Devices Namespace ******************************* RIM_SOUND_DEVICES_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_SOUND_DEVICE_ID_H <file_sep>/* * rimSoundFilters.h * Rim Sound * * Created by <NAME> on 7/21/12. * Copyright 2012 __MyCompanyName__. All rights reserved. * */ #ifndef INCLUDE_RIM_SOUND_FILTERS_H #define INCLUDE_RIM_SOUND_FILTERS_H #include "filters/rimSoundFiltersConfig.h" // Base Framework Classes #include "filters/rimSoundFilterVersion.h" #include "filters/rimSoundFilterFrame.h" #include "filters/rimSoundFilterParameterInfo.h" #include "filters/rimSoundFilterParameterType.h" #include "filters/rimSoundFilterParameterValue.h" #include "filters/rimSoundFilterParameterFlags.h" #include "filters/rimSoundFilterParameter.h" #include "filters/rimSoundFilterState.h" #include "filters/rimSoundFilterPreset.h" #include "filters/rimSoundFilter.h" // Routing and Mixing Filters #include "filters/rimSoundMixer.h" #include "filters/rimSoundSplitter.h" #include "filters/rimSoundFilterSeries.h" #include "filters/rimSoundFilterGraph.h" // Panning and Channel Mixing Filters #include "filters/rimSoundPanner.h" #include "filters/rimSoundMonoMixer.h" #include "filters/rimSoundMonoSplitter.h" // Equalization Filters #include "filters/rimSoundCutoffFilter.h" #include "filters/rimSoundBandFilter.h" #include "filters/rimSoundShelfFilter.h" #include "filters/rimSoundParametricFilter.h" #include "filters/rimSoundCrossover.h" #include "filters/rimSoundParametricEqualizer.h" #include "filters/rimSoundGraphicEqualizer.h" #include "filters/rimSoundConvolutionFilter.h" // Delay Filters #include "filters/rimSoundDelay.h" #include "filters/rimSoundMultichannelDelay.h" // Reverb Filters #include "filters/rimSoundReverbFilter.h" // Sound Sources/Destinations #include "filters/rimSoundToneGenerator.h" #include "filters/rimSoundStreamPlayer.h" #include "filters/rimSoundStreamRecorder.h" #include "filters/rimSoundThreadedStreamRecorder.h" #include "filters/rimSoundSampler.h" // Dynamics Filters #include "filters/rimSoundGainFilter.h" #include "filters/rimSoundCompressor.h" #include "filters/rimSoundLimiter.h" #include "filters/rimSoundExpander.h" // Distortion Filters #include "filters/rimSoundDistortion.h" #include "filters/rimSoundSaturator.h" #include "filters/rimSoundBitcrusher.h" // Modulation Filters #include "filters/rimSoundTremolo.h" #include "filters/rimSoundVibrato.h" #include "filters/rimSoundFlanger.h" // Sample Rate Conversion / Pitch Shift Filters #include "filters/rimSoundSampleRateConverter.h" #include "filters/rimSoundPitchShifter.h" #endif // INCLUDE_RIM_SOUND_FILTERS_H <file_sep>/* * rimAABB1D.h * Rim Math * * Created by <NAME> on 1/24/08. * Copyright 2008 Rim Software. All rights reserved. * */ #ifndef INCLUDE_RIM_AABB_1D_H #define INCLUDE_RIM_AABB_1D_H #include "rimMathConfig.h" #include "../data/rimBasicString.h" #include "../data/rimBasicStringBuffer.h" //########################################################################################## //***************************** Start Rim Math Namespace ********************************* RIM_MATH_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class which represents a range of values in 1D space. /** * This class contains two data members: min and max. These indicate the minimum * and maximum values that this axis-aligned bounding box represents. The class * invariant is that min is less than max, though this is not enforced. The class * supports union, containment, and intersection operations. */ template < typename T > class AABB1D { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructors /// Create a 1D axis-aligned bounding box with no extent centered about the origin. RIM_FORCE_INLINE AABB1D() : min(), max() { } /// Create a 1D axis-aligned bounding box with the minimum and maximum coordinates equal to the specified value. RIM_FORCE_INLINE AABB1D( T center ) : min( center ), max( center ) { } /// Create a 1D axis-aligned bounding box with the specified minimum and maximum coodinates. RIM_FORCE_INLINE AABB1D( T newMin, T newMax ) : min( newMin ), max( newMax ) { } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** AABB Cast Operator /// Cast this bounding box to a bounding box with a different underlying primitive type. template < typename U > RIM_FORCE_INLINE operator AABB1D<U> () const { return AABB1D<U>( (U)min, (U)max ); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** AABB Comparison Methods /// Return whether or not this bounding box completely contains another. RIM_FORCE_INLINE Bool contains( const AABB1D& bounds ) const { return min <= bounds.min && max >= bounds.max; } /// Return whether or not this bounding box contains the specified value. RIM_FORCE_INLINE Bool contains( T value ) const { return value >= min && value <= max; } /// Return whether or not this bounding box intersects another. RIM_FORCE_INLINE Bool intersects( const AABB1D& bounds ) const { return (min < bounds.max) && (max > bounds.min); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Accessor Methods /// Set the minimum and maximum values of the axis-aligned bounding box. RIM_FORCE_INLINE void set( T newMin, T newMax ) { min = newMin; max = newMax; } /// Get the difference between the maximum and minimum coordinates. RIM_FORCE_INLINE T getWidth() const { return max - min; } /// Get the difference between the maximum and minimum coordinates. RIM_FORCE_INLINE T getSize() const { return max - min; } /// Get the center of the bounding box. RIM_FORCE_INLINE T getCenter() const { return math::average( min, max ); } /// Return either the minimal or maximal vertex of this AABB. /** * If the index parameter is 0, the minimal vertex is returned, if the * index parameter is 1, the maximal vertex is returned. Otherwise the * result is undefined. */ RIM_FORCE_INLINE T getMinMax( Index i ) const { return (&min)[i]; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Enlargement Methods /// Modify the current bounding box such that it encloses the specified value. RIM_FORCE_INLINE void enlargeFor( T value ) { min = math::min( min, value ); max = math::max( max, value ); } /// Modify the current bounding box such that it encloses the specified box. RIM_FORCE_INLINE void enlargeFor( const AABB1D& box ) { min = math::min( min, box.min ); max = math::max( max, box.max ); } /// Modify the current bounding box such that it encloses the specified value. RIM_FORCE_INLINE AABB1D<T>& operator |= ( T value ) { min = math::min( min, value ); max = math::max( max, value ); return *this; } /// Return the bounding box necessary to enclose a value and the current bounding box. RIM_FORCE_INLINE AABB1D<T> operator | ( T value ) const { return AABB1D<T>( math::min( min, value ), math::max( max, value ) ); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Union Methods /// Return the union of this bounding box and another. RIM_FORCE_INLINE AABB1D<T> getUnion( const AABB1D<T>& bounds ) const { return AABB1D<T>( math::min( min, bounds.min ), math::max( max, bounds.max ) ); } /// Modify this bounding box such that it contains the specified bounding box. RIM_FORCE_INLINE AABB1D<T>& operator |= ( const AABB1D<T>& bounds ) { min = math::min( min, bounds.min ); max = math::max( max, bounds.max ); return *this; } /// Return the union of this bounding box and another. RIM_FORCE_INLINE AABB1D<T> operator | ( const AABB1D<T>& bounds ) const { return this->getUnion( bounds ); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Intersection Methods /// Return the intersection of this bounding box and another. RIM_FORCE_INLINE AABB1D<T> getIntersection( const AABB1D<T>& bounds ) const { return AABB1D<T>( math::max( min, bounds.min ), math::min( max, bounds.max ) ); } /// Return the intersection of this bounding box and another. RIM_FORCE_INLINE AABB1D<T>& operator &= ( const AABB1D<T>& bounds ) { min = math::max( min, bounds.min ); max = math::min( max, bounds.max ); return *this; } /// Return the intersection of this bounding box and another. RIM_FORCE_INLINE AABB1D<T> operator & ( const AABB1D<T>& bounds ) const { return this->getIntersection( bounds ); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Comparison Operators /// Return whether or not this bounding box is exactly the same as another. RIM_INLINE Bool operator == ( const AABB1D<T>& other ) const { return min == other.min && max == other.max; } /// Return whether or not this bounding box is different than another. RIM_INLINE Bool operator != ( const AABB1D<T>& other ) const { return min != other.min || max != other.max; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** String Conversion Methods /// Convert this 1D range into a human-readable string representation. RIM_NO_INLINE data::String toString() const { data::StringBuffer buffer; buffer << "[ " << min << " < " << max << " ]"; return buffer.toString(); } /// Convert this 1D range into a human-readable string representation. RIM_FORCE_INLINE operator data::String () const { return this->toString(); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Public Data Members /// The minumum coordinate of the bounding box. T min; /// The maximum coordinate of the bounding box. T max; }; //########################################################################################## //***************************** End Rim Math Namespace *********************************** RIM_MATH_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_AABB_1D_H <file_sep>/* * rimGUIInputConfig.h * Rim GUI * * Created by <NAME> on 10/28/08. * Copyright 2008 __MyCompanyName__. All rights reserved. * */ #ifndef INCLUDE_RIM_GUI_SYSTEM_CONFIG_H #define INCLUDE_RIM_GUI_SYSTEM_CONFIG_H #include "../rimGUIConfig.h" //########################################################################################## //########################################################################################## //############ //############ Library Namespace Configuration //############ //########################################################################################## //########################################################################################## #ifndef RIM_GUI_SYSTEM_NAMESPACE_START #define RIM_GUI_SYSTEM_NAMESPACE_START RIM_GUI_NAMESPACE_START namespace system { #endif #ifndef RIM_GUI_SYSTEM_NAMESPACE_END #define RIM_GUI_SYSTEM_NAMESPACE_END }; RIM_GUI_NAMESPACE_END #endif //########################################################################################## //************************ Start Rim GUI System Namespace ************************** RIM_GUI_SYSTEM_NAMESPACE_START //****************************************************************************************** //########################################################################################## //########################################################################################## //************************ End Rim GUI System Namespace **************************** RIM_GUI_SYSTEM_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_GUI_SYSTEM_CONFIG_H <file_sep>/* * rimGraphicsScreen.h * Rim Graphics GUI * * Created by <NAME> on 1/22/13. * Copyright 2013 Headspace Systems. All rights reserved. * */ #ifndef INCLUDE_RIM_GRAPHICS_GUI_SCREEN_H #define INCLUDE_RIM_GRAPHICS_GUI_SCREEN_H #include "rimGraphicsGUIBase.h" #include "rimGraphicsGUIObject.h" #include "rimGraphicsGUIScreenDelegate.h" //########################################################################################## //************************ Start Rim Graphics GUI Namespace ****************************** RIM_GRAPHICS_GUI_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class which contains a collection of scaled GUI objects positioned within a 2D rectangle. /** * The primary purpose of this class is to provide an adapter which allows resolution- * independent GUI rendering. It accomplishes this by applying a scaling factor to * its child coordinate system such that child objects are rendered and updated as * if they were at the scaled size. The default scaling factor is 1, indicating that all * child objects will be drawn at the same resolution as the screen. By varying the * scaling factor and the screen's size, a user can resize a GUI to be any on-screen size * in pixels. * * A screen delegates UI actions to the objects that it contains, as well * as maintains a sorted order for drawing objects based on their depth. */ class Screen : public GUIObject { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructors /// Create a new empty screen with no width or height positioned at the origin. Screen(); /// Create a new empty screen which occupies the specified rectangular region. Screen( const Rectangle& newRectangle ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Object Accessor Methods /// Return the total number of GUIObjects that are part of this screen. RIM_INLINE Size getObjectCount() const { return objects.getSize(); } /// Return a pointer to the object at the specified index in this screen. /** * Objects are stored in back-to-front sorted order, such that the object * with index 0 is the furthest toward the back of the object ordering. */ RIM_INLINE const Pointer<GUIObject>& getObject( Index objectIndex ) const { return objects[objectIndex]; } /// Add the specified object to this screen. /** * If the specified object pointer is NULL, the method fails and FALSE * is returned. Otherwise, the object is inserted in the front-to-back order * of the screen's objects and TRUE is returned. */ Bool addObject( const Pointer<GUIObject>& newObject ); /// Remove the specified object from this screen. /** * If the given object is part of this screen, the method removes it * and returns TRUE. Otherwise, if the specified object is not found, * the method doesn't modify the screen and FALSE is returned. */ Bool removeObject( const GUIObject* oldObject ); /// Remove all objects from this screen. void clearObjects(); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Border Accessor Methods /// Return a mutable object which describes this screen's border. RIM_INLINE Border& getBorder() { return border; } /// Return an object which describes this screen's border. RIM_INLINE const Border& getBorder() const { return border; } /// Set an object which describes this screen's border. RIM_INLINE void setBorder( const Border& newBorder ) { border = newBorder; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Content Bounding Box Accessor Methods /// Return the 3D bounding box for the screens's main area in its local coordinate frame. RIM_INLINE AABB3f getLocalContentBounds() const { return AABB3f( border.getContentBounds( AABB2f( Vector2f(), this->getSizeXY() ) ), AABB1f( Float(0), this->getSize().z ) ); } /// Return the 2D bounding box for the screens's main area in its local coordinate frame. RIM_INLINE AABB2f getLocalContentBoundsXY() const { return border.getContentBounds( AABB2f( Vector2f(), this->getSizeXY() ) ); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Color Accessor Methods /// Return the background color for this screen's main area. RIM_INLINE const Color4f& getBackgroundColor() const { return backgroundColor; } /// Set the background color for this screen's main area. RIM_INLINE void setBackgroundColor( const Color4f& newBackgroundColor ) { backgroundColor = newBackgroundColor; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Border Color Accessor Methods /// Return the border color used when rendering a screen. RIM_INLINE const Color4f& getBorderColor() const { return borderColor; } /// Set the border color used when rendering a screen. RIM_INLINE void setBorderColor( const Color4f& newBorderColor ) { borderColor = newBorderColor; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Update Method /// Update the current internal state of this screen for the specified time interval in seconds. /** * This method recursively calls the update() methods for all child GUI objects * so that they are updated. */ virtual void update( Float dt ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Drawing Method /// Draw this screen using the specified GUI renderer to the given parent coordinate system bounds. /** * The method returns whether or not the screen was successfully drawn. * * The default implementation calls the renderer's drawScreen() method to * draw the screen. */ virtual Bool drawSelf( GUIRenderer& renderer, const AABB3f& parentBounds ) const; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Input Handling Methods /// Handle the specified keyboard event for the entire screen. virtual void keyEvent( const KeyboardEvent& event ); /// Handle the specified mouse motion event for the entire screen. virtual void mouseMotionEvent( const MouseMotionEvent& event ); /// Handle the specified mouse button event for the entire screen. virtual void mouseButtonEvent( const MouseButtonEvent& event ); /// Handle the specified mouse wheel event for the entire screen. virtual void mouseWheelEvent( const MouseWheelEvent& event ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Delegate Accessor Methods /// Return a reference to the delegate which responds to events for this screen. RIM_INLINE ScreenDelegate& getDelegate() { return delegate; } /// Return a reference to the delegate which responds to events for this screen. RIM_INLINE const ScreenDelegate& getDelegate() const { return delegate; } /// Return a reference to the delegate which responds to events for this screen. RIM_INLINE void setDelegate( const ScreenDelegate& newDelegate ) { delegate = newDelegate; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Static Construction Methods /// Construct a smart-pointer-wrapped instance of this class using the constructor with the given arguments. RIM_INLINE static Pointer<Screen> construct() { return Pointer<Screen>::construct(); } /// Construct a smart-pointer-wrapped instance of this class using the constructor with the given arguments. RIM_INLINE static Pointer<Screen> construct( const Rectangle& newRectangle ) { return Pointer<Screen>::construct( newRectangle ); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Public Static Data Members /// The default border that is used for a screen. static const Border DEFAULT_BORDER; /// The default background color that is used for a screen's area. static const Color4f DEFAULT_BACKGROUND_COLOR; /// The default border color that is used for a screen. static const Color4f DEFAULT_BORDER_COLOR; private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Helper Methods /// Make sure that the list of objects is in sorted order based on their depths. void sortObjectsByDepth(); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Members /// A list of all of the objects that are part of this screen. ArrayList< Pointer<GUIObject> > objects; /// An object which describes the border for this screen. Border border; /// An object which contains function pointers that respond to screen events. ScreenDelegate delegate; /// The background color for the screen's area. Color4f backgroundColor; /// The border color for the screen's background area. Color4f borderColor; }; //########################################################################################## //************************ End Rim Graphics GUI Namespace ******************************** RIM_GRAPHICS_GUI_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_GRAPHICS_GUI_SCREEN_H <file_sep>/* * rimGraphicsAttributeType.h * Rim Graphics * * Created by <NAME> on 1/30/10. * Copyright 2010 Rim Software. All rights reserved. * */ #ifndef INCLUDE_RIM_GRAPHICS_ATTRIBUTE_TYPE_H #define INCLUDE_RIM_GRAPHICS_ATTRIBUTE_TYPE_H #include "rimGraphicsUtilitiesConfig.h" //########################################################################################## //********************** Start Rim Graphics Utilities Namespace ************************** RIM_GRAPHICS_UTILITIES_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class which represents the type of a shader attribute. /** * A AttributeType can represent either a scalar, vector, or matrix shader * attribute. It is specified by a primitive type enumeration indicating the type * of the elements of the attribute, plus the number of rows and columns of the * attribute type. For instance, a 3-component vector would have 3 rows and 1 column. */ class AttributeType { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructors /// Create an undefined attribute type with 0 rows and columns. RIM_FORCE_INLINE AttributeType() : primitiveType( PrimitiveType::UNDEFINED ), numRows( 0 ), numColumns( 0 ), padding( 0 ) { } /// Create a scalar attribute type for the specified primitive type. RIM_FORCE_INLINE AttributeType( PrimitiveType::Enum newPrimitiveType ) : primitiveType( newPrimitiveType ), numRows( 1 ), numColumns( 1 ), padding( 0 ) { } /// Create a vector attribute type for the specified primitive type and number of components (rows). RIM_INLINE AttributeType( PrimitiveType::Enum newPrimitiveType, Size newNumberOfRows ) : primitiveType( newPrimitiveType ), numRows( (UByte)math::clamp( newNumberOfRows, Size(1), Size(math::max<UByte>()) ) ), numColumns( 1 ), padding( 0 ) { } /// Create a matrix attribute type for the specified primitive type and number of rows/columns. RIM_INLINE AttributeType( PrimitiveType::Enum newPrimitiveType, Size newNumberOfRows, Size newNumberOfColumns ) : primitiveType( newPrimitiveType ), numRows( (UByte)math::clamp( newNumberOfRows, Size(1), Size(math::max<UByte>()) ) ), numColumns( (UByte)math::clamp( newNumberOfColumns, Size(1), Size(math::max<UByte>()) ) ), padding( 0 ) { } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Static Shader Attribute Type Templated Accessor Method /// Return an AttributeType object for the specified templated type. /** * This method returns a valid attribute type for all standard * scalar/vector/matrix/color types. For all other types, an undefined * attribute type is returned. */ template < typename T > RIM_FORCE_INLINE static AttributeType get() { if ( PrimitiveType::get<T>() == PrimitiveType::UNDEFINED ) return AttributeType::UNDEFINED; else return AttributeType( PrimitiveType::get<T>() ); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Attribute Type Validity Accessor Method /// Check to see if the templated type is a supported attribute type. /** * Calling this empty method will produce a compiler error if the * templated type is not a supported attribute type. */ template < typename T > RIM_FORCE_INLINE static void check(); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Comparison Operators /// Return whether or not this attribute type is equal to another. RIM_FORCE_INLINE Bool operator == ( const AttributeType& other ) const { return fullType == other.fullType; } /// Return whether or not this attribute type is not equal to another. RIM_FORCE_INLINE Bool operator != ( const AttributeType& other ) const { return !(*this == other); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Primitive Type Accessor Methods /// Return whether or not this attribute's primitive type is a floating-point format (32 or 64-bit). RIM_FORCE_INLINE Bool isFloatingPoint() const { return primitiveType == PrimitiveType::FLOAT || primitiveType == PrimitiveType::DOUBLE; } /// Get the primitive type of this attribute type. RIM_FORCE_INLINE PrimitiveType getPrimitiveType() const { return PrimitiveType( (PrimitiveType::Enum)primitiveType ); } /// Set the primitive type of this attribute type. RIM_FORCE_INLINE void setPrimitiveType( PrimitiveType newPrimitiveType ) { primitiveType = (UInt8)newPrimitiveType; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Row and Column Count Accessor Methods /// Get the number of rows of this attribute type. RIM_FORCE_INLINE Size getRowCount() const { return (Size)numRows; } /// Set the number of rows of this attribute type. RIM_FORCE_INLINE void setRowCount( Size newNumRows ) { numRows = (UInt8)math::clamp( newNumRows, Size(1), Size(4) ); } /// Get the number of columns of this attribute type. RIM_FORCE_INLINE Size getColumnCount() const { return (Size)numColumns; } /// Set the number of columns of this attribute type. RIM_FORCE_INLINE void setColumnCount( Size newNumColumns ) { numColumns = (UInt8)math::clamp( newNumColumns, Size(1), Size(4) ); } /// Return the total number of components that are part of this attribute type (#rows * #columns). RIM_FORCE_INLINE Size getComponentCount() const { return Size(numColumns)*Size(numRows); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Shader Attribute Type Accessor Methods /// Return whether or not this attribute type represents a scalar type. RIM_FORCE_INLINE Bool isAScalar() const { return numRows == numColumns == Size(1); } /// Return whether or not this attribute type represents a vector type. RIM_FORCE_INLINE Bool isAVector() const { return numRows > 1 && numColumns == Size(1); } /// Return whether or not this attribute type represents a matrix type. RIM_FORCE_INLINE Bool isAMatrix() const { return numRows > 1 && numColumns > 1; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Byte Size Accessor Method /// Return the size of an attribute with this type in bytes. RIM_FORCE_INLINE Size getSizeInBytes() const { Size numComponents = (Size)numRows*(Size)numColumns; return getPrimitiveType().getSizeInBytes()*numComponents; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** String Representation Accessor Methods /// Return a string representation of the attribute type. String toString() const; /// Convert this attribute type into a string representation. RIM_FORCE_INLINE operator String () const { return this->toString(); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Predefined Shader Attribute Type Object Constants static const AttributeType UNDEFINED; static const AttributeType BOOLEAN; static const AttributeType BYTE; static const AttributeType UNSIGNED_BYTE; static const AttributeType SHORT; static const AttributeType UNSIGNED_SHORT; static const AttributeType INT; static const AttributeType UNSIGNED_INT; static const AttributeType HALF_FLOAT; static const AttributeType FLOAT; static const AttributeType DOUBLE; private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Members union { /// A 32-bit integer UInt32 fullType; struct { /// The primitive type of this attribute type. UInt8 primitiveType; /// The number of rows of this attribute type. UInt8 numRows; /// The number of columns of this attribute type. UInt8 numColumns; /// A reserved padding value. UInt8 padding; }; }; }; //########################################################################################## //########################################################################################## //############ //############ 2D Vector Shader Attribute Type Get Methods //############ //########################################################################################## //########################################################################################## template <> RIM_INLINE AttributeType AttributeType:: get< Vector2D<Bool> >() { return AttributeType( PrimitiveType::BOOLEAN, 2 ); } template <> RIM_INLINE AttributeType AttributeType:: get< Vector2D<Byte> >() { return AttributeType( PrimitiveType::BYTE, 2 ); } template <> RIM_INLINE AttributeType AttributeType:: get< Vector2D<UByte> >() { return AttributeType( PrimitiveType::UNSIGNED_BYTE, 2 ); } template <> RIM_INLINE AttributeType AttributeType:: get< Vector2D<Short> >() { return AttributeType( PrimitiveType::SHORT, 2 ); } template <> RIM_INLINE AttributeType AttributeType:: get< Vector2D<UShort> >() { return AttributeType( PrimitiveType::UNSIGNED_SHORT, 2 ); } template <> RIM_INLINE AttributeType AttributeType:: get< Vector2D<Int> >() { return AttributeType( PrimitiveType::INT, 2 ); } template <> RIM_INLINE AttributeType AttributeType:: get< Vector2D<UInt> >() { return AttributeType( PrimitiveType::UNSIGNED_INT, 2 ); } template <> RIM_INLINE AttributeType AttributeType:: get< Vector2D<Float> >() { return AttributeType( PrimitiveType::FLOAT, 2 ); } template <> RIM_INLINE AttributeType AttributeType:: get< Vector2D<HalfFloat> >() { return AttributeType( PrimitiveType::HALF_FLOAT, 2 ); } template <> RIM_INLINE AttributeType AttributeType:: get< Vector2D<Double> >() { return AttributeType( PrimitiveType::DOUBLE, 2 ); } //########################################################################################## //########################################################################################## //############ //############ 3D Vector Shader Attribute Type Get Methods //############ //########################################################################################## //########################################################################################## template <> RIM_INLINE AttributeType AttributeType:: get< Vector3D<Bool> >() { return AttributeType( PrimitiveType::BOOLEAN, 3 ); } template <> RIM_INLINE AttributeType AttributeType:: get< Vector3D<Byte> >() { return AttributeType( PrimitiveType::BYTE, 3 ); } template <> RIM_INLINE AttributeType AttributeType:: get< Vector3D<UByte> >() { return AttributeType( PrimitiveType::UNSIGNED_BYTE, 3 ); } template <> RIM_INLINE AttributeType AttributeType:: get< Vector3D<Short> >() { return AttributeType( PrimitiveType::SHORT, 3 ); } template <> RIM_INLINE AttributeType AttributeType:: get< Vector3D<UShort> >() { return AttributeType( PrimitiveType::UNSIGNED_SHORT, 3 ); } template <> RIM_INLINE AttributeType AttributeType:: get< Vector3D<Int> >() { return AttributeType( PrimitiveType::INT, 3 ); } template <> RIM_INLINE AttributeType AttributeType:: get< Vector3D<UInt> >() { return AttributeType( PrimitiveType::UNSIGNED_INT, 3 ); } template <> RIM_INLINE AttributeType AttributeType:: get< Vector3D<HalfFloat> >() { return AttributeType( PrimitiveType::HALF_FLOAT, 3 ); } template <> RIM_INLINE AttributeType AttributeType:: get< Vector3D<Float> >() { return AttributeType( PrimitiveType::FLOAT, 3 ); } template <> RIM_INLINE AttributeType AttributeType:: get< Vector3D<Double> >() { return AttributeType( PrimitiveType::DOUBLE, 3 ); } //########################################################################################## //########################################################################################## //############ //############ 4D Vector Shader Attribute Type Get Methods //############ //########################################################################################## //########################################################################################## template <> RIM_INLINE AttributeType AttributeType:: get< Vector4D<Bool> >() { return AttributeType( PrimitiveType::BOOLEAN, 4 ); } template <> RIM_INLINE AttributeType AttributeType:: get< Vector4D<Byte> >() { return AttributeType( PrimitiveType::BYTE, 4 ); } template <> RIM_INLINE AttributeType AttributeType:: get< Vector4D<UByte> >() { return AttributeType( PrimitiveType::UNSIGNED_BYTE, 4 ); } template <> RIM_INLINE AttributeType AttributeType:: get< Vector4D<Short> >() { return AttributeType( PrimitiveType::SHORT, 4 ); } template <> RIM_INLINE AttributeType AttributeType:: get< Vector4D<UShort> >() { return AttributeType( PrimitiveType::UNSIGNED_SHORT, 4 ); } template <> RIM_INLINE AttributeType AttributeType:: get< Vector4D<Int> >() { return AttributeType( PrimitiveType::INT, 4 ); } template <> RIM_INLINE AttributeType AttributeType:: get< Vector4D<UInt> >() { return AttributeType( PrimitiveType::UNSIGNED_INT, 4 ); } template <> RIM_INLINE AttributeType AttributeType:: get< Vector4D<HalfFloat> >() { return AttributeType( PrimitiveType::HALF_FLOAT, 4 ); } template <> RIM_INLINE AttributeType AttributeType:: get< Vector4D<Float> >() { return AttributeType( PrimitiveType::FLOAT, 4 ); } template <> RIM_INLINE AttributeType AttributeType:: get< Vector4D<Double> >() { return AttributeType( PrimitiveType::DOUBLE, 4 ); } //########################################################################################## //########################################################################################## //############ //############ Quaternion Shader Attribute Type Get Methods //############ //########################################################################################## //########################################################################################## template <> RIM_INLINE AttributeType AttributeType:: get< Quaternion<Bool> >() { return AttributeType( PrimitiveType::BOOLEAN, 4 ); } template <> RIM_INLINE AttributeType AttributeType:: get< Quaternion<Byte> >() { return AttributeType( PrimitiveType::BYTE, 4 ); } template <> RIM_INLINE AttributeType AttributeType:: get< Quaternion<UByte> >() { return AttributeType( PrimitiveType::UNSIGNED_BYTE, 4 ); } template <> RIM_INLINE AttributeType AttributeType:: get< Quaternion<Short> >() { return AttributeType( PrimitiveType::SHORT, 4 ); } template <> RIM_INLINE AttributeType AttributeType:: get< Quaternion<UShort> >() { return AttributeType( PrimitiveType::UNSIGNED_SHORT, 4 ); } template <> RIM_INLINE AttributeType AttributeType:: get< Quaternion<Int> >() { return AttributeType( PrimitiveType::INT, 4 ); } template <> RIM_INLINE AttributeType AttributeType:: get< Quaternion<UInt> >() { return AttributeType( PrimitiveType::UNSIGNED_INT, 4 ); } template <> RIM_INLINE AttributeType AttributeType:: get< Quaternion<HalfFloat> >() { return AttributeType( PrimitiveType::HALF_FLOAT, 4 ); } template <> RIM_INLINE AttributeType AttributeType:: get< Quaternion<Float> >() { return AttributeType( PrimitiveType::FLOAT, 4 ); } template <> RIM_INLINE AttributeType AttributeType:: get< Quaternion<Double> >() { return AttributeType( PrimitiveType::DOUBLE, 4 ); } //########################################################################################## //########################################################################################## //############ //############ 2D Matrix Shader Attribute Type Get Methods //############ //########################################################################################## //########################################################################################## template <> RIM_INLINE AttributeType AttributeType:: get< Matrix2D<Bool> >() { return AttributeType( PrimitiveType::BOOLEAN, 2, 2 ); } template <> RIM_INLINE AttributeType AttributeType:: get< Matrix2D<Byte> >() { return AttributeType( PrimitiveType::BYTE, 2, 2 ); } template <> RIM_INLINE AttributeType AttributeType:: get< Matrix2D<UByte> >() { return AttributeType( PrimitiveType::UNSIGNED_BYTE, 2, 2 ); } template <> RIM_INLINE AttributeType AttributeType:: get< Matrix2D<Short> >() { return AttributeType( PrimitiveType::SHORT, 2, 2 ); } template <> RIM_INLINE AttributeType AttributeType:: get< Matrix2D<UShort> >() { return AttributeType( PrimitiveType::UNSIGNED_SHORT, 2, 2 ); } template <> RIM_INLINE AttributeType AttributeType:: get< Matrix2D<Int> >() { return AttributeType( PrimitiveType::INT, 2, 2 ); } template <> RIM_INLINE AttributeType AttributeType:: get< Matrix2D<UInt> >() { return AttributeType( PrimitiveType::UNSIGNED_INT, 2, 2 ); } template <> RIM_INLINE AttributeType AttributeType:: get< Matrix2D<HalfFloat> >() { return AttributeType( PrimitiveType::HALF_FLOAT, 2, 2 ); } template <> RIM_INLINE AttributeType AttributeType:: get< Matrix2D<Float> >() { return AttributeType( PrimitiveType::FLOAT, 2, 2 ); } template <> RIM_INLINE AttributeType AttributeType:: get< Matrix2D<Double> >() { return AttributeType( PrimitiveType::DOUBLE, 2, 2 ); } //########################################################################################## //########################################################################################## //############ //############ 3D Matrix Shader Attribute Type Get Methods //############ //########################################################################################## //########################################################################################## template <> RIM_INLINE AttributeType AttributeType:: get< Matrix3D<Bool> >() { return AttributeType( PrimitiveType::BOOLEAN, 3, 3 ); } template <> RIM_INLINE AttributeType AttributeType:: get< Matrix3D<Byte> >() { return AttributeType( PrimitiveType::BYTE, 3, 3 ); } template <> RIM_INLINE AttributeType AttributeType:: get< Matrix3D<UByte> >() { return AttributeType( PrimitiveType::UNSIGNED_BYTE, 3, 3 ); } template <> RIM_INLINE AttributeType AttributeType:: get< Matrix3D<Short> >() { return AttributeType( PrimitiveType::SHORT, 3, 3 ); } template <> RIM_INLINE AttributeType AttributeType:: get< Matrix3D<UShort> >() { return AttributeType( PrimitiveType::UNSIGNED_SHORT, 3, 3 ); } template <> RIM_INLINE AttributeType AttributeType:: get< Matrix3D<Int> >() { return AttributeType( PrimitiveType::INT, 3, 3 ); } template <> RIM_INLINE AttributeType AttributeType:: get< Matrix3D<UInt> >() { return AttributeType( PrimitiveType::UNSIGNED_INT, 3, 3 ); } template <> RIM_INLINE AttributeType AttributeType:: get< Matrix3D<HalfFloat> >() { return AttributeType( PrimitiveType::HALF_FLOAT, 3, 3 ); } template <> RIM_INLINE AttributeType AttributeType:: get< Matrix3D<Float> >() { return AttributeType( PrimitiveType::FLOAT, 3, 3 ); } template <> RIM_INLINE AttributeType AttributeType:: get< Matrix3D<Double> >() { return AttributeType( PrimitiveType::DOUBLE, 3, 3 ); } //########################################################################################## //########################################################################################## //############ //############ 4D Matrix Shader Attribute Type Get Methods //############ //########################################################################################## //########################################################################################## template <> RIM_INLINE AttributeType AttributeType:: get< Matrix4D<Bool> >() { return AttributeType( PrimitiveType::BOOLEAN, 4, 4 ); } template <> RIM_INLINE AttributeType AttributeType:: get< Matrix4D<Byte> >() { return AttributeType( PrimitiveType::BYTE, 4, 4 ); } template <> RIM_INLINE AttributeType AttributeType:: get< Matrix4D<UByte> >() { return AttributeType( PrimitiveType::UNSIGNED_BYTE, 4, 4 ); } template <> RIM_INLINE AttributeType AttributeType:: get< Matrix4D<Short> >() { return AttributeType( PrimitiveType::SHORT, 4, 4 ); } template <> RIM_INLINE AttributeType AttributeType:: get< Matrix4D<UShort> >() { return AttributeType( PrimitiveType::UNSIGNED_SHORT, 4, 4 ); } template <> RIM_INLINE AttributeType AttributeType:: get< Matrix4D<Int> >() { return AttributeType( PrimitiveType::INT, 4, 4 ); } template <> RIM_INLINE AttributeType AttributeType:: get< Matrix4D<UInt> >() { return AttributeType( PrimitiveType::UNSIGNED_INT, 4, 4 ); } template <> RIM_INLINE AttributeType AttributeType:: get< Matrix4D<HalfFloat> >() { return AttributeType( PrimitiveType::HALF_FLOAT, 4, 4 ); } template <> RIM_INLINE AttributeType AttributeType:: get< Matrix4D<Float> >() { return AttributeType( PrimitiveType::FLOAT, 4, 4 ); } template <> RIM_INLINE AttributeType AttributeType:: get< Matrix4D<Double> >() { return AttributeType( PrimitiveType::DOUBLE, 4, 4 ); } //########################################################################################## //########################################################################################## //############ //############ 3D Color Shader Attribute Type Get Methods //############ //########################################################################################## //########################################################################################## template <> RIM_INLINE AttributeType AttributeType:: get< Color3D<Bool> >() { return AttributeType( PrimitiveType::BOOLEAN, 3 ); } template <> RIM_INLINE AttributeType AttributeType:: get< Color3D<Byte> >() { return AttributeType( PrimitiveType::BYTE, 3 ); } template <> RIM_INLINE AttributeType AttributeType:: get< Color3D<UByte> >() { return AttributeType( PrimitiveType::UNSIGNED_BYTE, 3 ); } template <> RIM_INLINE AttributeType AttributeType:: get< Color3D<Short> >() { return AttributeType( PrimitiveType::SHORT, 3 ); } template <> RIM_INLINE AttributeType AttributeType:: get< Color3D<UShort> >() { return AttributeType( PrimitiveType::UNSIGNED_SHORT, 3 ); } template <> RIM_INLINE AttributeType AttributeType:: get< Color3D<Int> >() { return AttributeType( PrimitiveType::INT, 3 ); } template <> RIM_INLINE AttributeType AttributeType:: get< Color3D<UInt> >() { return AttributeType( PrimitiveType::UNSIGNED_INT, 3 ); } template <> RIM_INLINE AttributeType AttributeType:: get< Color3D<HalfFloat> >() { return AttributeType( PrimitiveType::HALF_FLOAT, 3 ); } template <> RIM_INLINE AttributeType AttributeType:: get< Color3D<Float> >() { return AttributeType( PrimitiveType::FLOAT, 3 ); } template <> RIM_INLINE AttributeType AttributeType:: get< Color3D<Double> >() { return AttributeType( PrimitiveType::DOUBLE, 3 ); } //########################################################################################## //########################################################################################## //############ //############ 4D Color Shader Attribute Type Get Methods //############ //########################################################################################## //########################################################################################## template <> RIM_INLINE AttributeType AttributeType:: get< Color4D<Bool> >() { return AttributeType( PrimitiveType::BOOLEAN, 4 ); } template <> RIM_INLINE AttributeType AttributeType:: get< Color4D<Byte> >() { return AttributeType( PrimitiveType::BYTE, 4 ); } template <> RIM_INLINE AttributeType AttributeType:: get< Color4D<UByte> >() { return AttributeType( PrimitiveType::UNSIGNED_BYTE, 4 ); } template <> RIM_INLINE AttributeType AttributeType:: get< Color4D<Short> >() { return AttributeType( PrimitiveType::SHORT, 4 ); } template <> RIM_INLINE AttributeType AttributeType:: get< Color4D<UShort> >() { return AttributeType( PrimitiveType::UNSIGNED_SHORT, 4 ); } template <> RIM_INLINE AttributeType AttributeType:: get< Color4D<Int> >() { return AttributeType( PrimitiveType::INT, 4 ); } template <> RIM_INLINE AttributeType AttributeType:: get< Color4D<UInt> >() { return AttributeType( PrimitiveType::UNSIGNED_INT, 4 ); } template <> RIM_INLINE AttributeType AttributeType:: get< Color4D<HalfFloat> >() { return AttributeType( PrimitiveType::HALF_FLOAT, 4 ); } template <> RIM_INLINE AttributeType AttributeType:: get< Color4D<Float> >() { return AttributeType( PrimitiveType::FLOAT, 4 ); } template <> RIM_INLINE AttributeType AttributeType:: get< Color4D<Double> >() { return AttributeType( PrimitiveType::DOUBLE, 4 ); } //########################################################################################## //########################################################################################## //############ //############ Scalar Shader Attribute Type Check Methods //############ //########################################################################################## //########################################################################################## template <> RIM_INLINE void AttributeType:: check< Bool >() {} template <> RIM_INLINE void AttributeType:: check< Byte >() {} template <> RIM_INLINE void AttributeType:: check< UByte >() {} template <> RIM_INLINE void AttributeType:: check< Short >() {} template <> RIM_INLINE void AttributeType:: check< UShort >() {} template <> RIM_INLINE void AttributeType:: check< Int >() {} template <> RIM_INLINE void AttributeType:: check< UInt >() {} template <> RIM_INLINE void AttributeType:: check< HalfFloat >() {} template <> RIM_INLINE void AttributeType:: check< Float >() {} template <> RIM_INLINE void AttributeType:: check< Double >() {} //########################################################################################## //########################################################################################## //############ //############ 2D Vector Shader Attribute Type Check Methods //############ //########################################################################################## //########################################################################################## template <> RIM_INLINE void AttributeType:: check< Vector2D<Bool> >() {} template <> RIM_INLINE void AttributeType:: check< Vector2D<Byte> >() {} template <> RIM_INLINE void AttributeType:: check< Vector2D<UByte> >() {} template <> RIM_INLINE void AttributeType:: check< Vector2D<Short> >() {} template <> RIM_INLINE void AttributeType:: check< Vector2D<UShort> >() {} template <> RIM_INLINE void AttributeType:: check< Vector2D<Int> >() {} template <> RIM_INLINE void AttributeType:: check< Vector2D<UInt> >() {} template <> RIM_INLINE void AttributeType:: check< Vector2D<HalfFloat> >() {} template <> RIM_INLINE void AttributeType:: check< Vector2D<Float> >() {} template <> RIM_INLINE void AttributeType:: check< Vector2D<Double> >() {} //########################################################################################## //########################################################################################## //############ //############ 3D Vector Shader Attribute Type Check Methods //############ //########################################################################################## //########################################################################################## template <> RIM_INLINE void AttributeType:: check< Vector3D<Bool> >() {} template <> RIM_INLINE void AttributeType:: check< Vector3D<Byte> >() {} template <> RIM_INLINE void AttributeType:: check< Vector3D<UByte> >() {} template <> RIM_INLINE void AttributeType:: check< Vector3D<Short> >() {} template <> RIM_INLINE void AttributeType:: check< Vector3D<UShort> >() {} template <> RIM_INLINE void AttributeType:: check< Vector3D<Int> >() {} template <> RIM_INLINE void AttributeType:: check< Vector3D<UInt> >() {} template <> RIM_INLINE void AttributeType:: check< Vector3D<HalfFloat> >() {} template <> RIM_INLINE void AttributeType:: check< Vector3D<Float> >() {} template <> RIM_INLINE void AttributeType:: check< Vector3D<Double> >() {} //########################################################################################## //########################################################################################## //############ //############ 4D Vector Shader Attribute Type Check Methods //############ //########################################################################################## //########################################################################################## template <> RIM_INLINE void AttributeType:: check< Vector4D<Bool> >() {} template <> RIM_INLINE void AttributeType:: check< Vector4D<Byte> >() {} template <> RIM_INLINE void AttributeType:: check< Vector4D<UByte> >() {} template <> RIM_INLINE void AttributeType:: check< Vector4D<Short> >() {} template <> RIM_INLINE void AttributeType:: check< Vector4D<UShort> >() {} template <> RIM_INLINE void AttributeType:: check< Vector4D<Int> >() {} template <> RIM_INLINE void AttributeType:: check< Vector4D<UInt> >() {} template <> RIM_INLINE void AttributeType:: check< Vector4D<HalfFloat> >() {} template <> RIM_INLINE void AttributeType:: check< Vector4D<Float> >() {} template <> RIM_INLINE void AttributeType:: check< Vector4D<Double> >() {} //########################################################################################## //########################################################################################## //############ //############ Quaternion Shader Attribute Type Check Methods //############ //########################################################################################## //########################################################################################## template <> RIM_INLINE void AttributeType:: check< Quaternion<Bool> >() {} template <> RIM_INLINE void AttributeType:: check< Quaternion<Byte> >() {} template <> RIM_INLINE void AttributeType:: check< Quaternion<UByte> >() {} template <> RIM_INLINE void AttributeType:: check< Quaternion<Short> >() {} template <> RIM_INLINE void AttributeType:: check< Quaternion<UShort> >() {} template <> RIM_INLINE void AttributeType:: check< Quaternion<Int> >() {} template <> RIM_INLINE void AttributeType:: check< Quaternion<UInt> >() {} template <> RIM_INLINE void AttributeType:: check< Quaternion<HalfFloat> >() {} template <> RIM_INLINE void AttributeType:: check< Quaternion<Float> >() {} template <> RIM_INLINE void AttributeType:: check< Quaternion<Double> >() {} //########################################################################################## //########################################################################################## //############ //############ 2D Matrix Shader Attribute Type Check Methods //############ //########################################################################################## //########################################################################################## template <> RIM_INLINE void AttributeType:: check< Matrix2D<Bool> >() {} template <> RIM_INLINE void AttributeType:: check< Matrix2D<Byte> >() {} template <> RIM_INLINE void AttributeType:: check< Matrix2D<UByte> >() {} template <> RIM_INLINE void AttributeType:: check< Matrix2D<Short> >() {} template <> RIM_INLINE void AttributeType:: check< Matrix2D<UShort> >() {} template <> RIM_INLINE void AttributeType:: check< Matrix2D<Int> >() {} template <> RIM_INLINE void AttributeType:: check< Matrix2D<UInt> >() {} template <> RIM_INLINE void AttributeType:: check< Matrix2D<HalfFloat> >() {} template <> RIM_INLINE void AttributeType:: check< Matrix2D<Float> >() {} template <> RIM_INLINE void AttributeType:: check< Matrix2D<Double> >() {} //########################################################################################## //########################################################################################## //############ //############ 3D Matrix Shader Attribute Type Check Methods //############ //########################################################################################## //########################################################################################## template <> RIM_INLINE void AttributeType:: check< Matrix3D<Bool> >() {} template <> RIM_INLINE void AttributeType:: check< Matrix3D<Byte> >() {} template <> RIM_INLINE void AttributeType:: check< Matrix3D<UByte> >() {} template <> RIM_INLINE void AttributeType:: check< Matrix3D<Short> >() {} template <> RIM_INLINE void AttributeType:: check< Matrix3D<UShort> >() {} template <> RIM_INLINE void AttributeType:: check< Matrix3D<Int> >() {} template <> RIM_INLINE void AttributeType:: check< Matrix3D<UInt> >() {} template <> RIM_INLINE void AttributeType:: check< Matrix3D<HalfFloat> >() {} template <> RIM_INLINE void AttributeType:: check< Matrix3D<Float> >() {} template <> RIM_INLINE void AttributeType:: check< Matrix3D<Double> >() {} //########################################################################################## //########################################################################################## //############ //############ 4D Matrix Shader Attribute Type Check Methods //############ //########################################################################################## //########################################################################################## template <> RIM_INLINE void AttributeType:: check< Matrix4D<Bool> >() {} template <> RIM_INLINE void AttributeType:: check< Matrix4D<Byte> >() {} template <> RIM_INLINE void AttributeType:: check< Matrix4D<UByte> >() {} template <> RIM_INLINE void AttributeType:: check< Matrix4D<Short> >() {} template <> RIM_INLINE void AttributeType:: check< Matrix4D<UShort> >() {} template <> RIM_INLINE void AttributeType:: check< Matrix4D<Int> >() {} template <> RIM_INLINE void AttributeType:: check< Matrix4D<UInt> >() {} template <> RIM_INLINE void AttributeType:: check< Matrix4D<HalfFloat> >() {} template <> RIM_INLINE void AttributeType:: check< Matrix4D<Float> >() {} template <> RIM_INLINE void AttributeType:: check< Matrix4D<Double> >() {} //########################################################################################## //########################################################################################## //############ //############ 3D Color Shader Attribute Type Check Methods //############ //########################################################################################## //########################################################################################## template <> RIM_INLINE void AttributeType:: check< Color3D<Bool> >() {} template <> RIM_INLINE void AttributeType:: check< Color3D<Byte> >() {} template <> RIM_INLINE void AttributeType:: check< Color3D<UByte> >() {} template <> RIM_INLINE void AttributeType:: check< Color3D<Short> >() {} template <> RIM_INLINE void AttributeType:: check< Color3D<UShort> >() {} template <> RIM_INLINE void AttributeType:: check< Color3D<Int> >() {} template <> RIM_INLINE void AttributeType:: check< Color3D<UInt> >() {} template <> RIM_INLINE void AttributeType:: check< Color3D<HalfFloat> >() {} template <> RIM_INLINE void AttributeType:: check< Color3D<Float> >() {} template <> RIM_INLINE void AttributeType:: check< Color3D<Double> >() {} //########################################################################################## //########################################################################################## //############ //############ 4D Color Shader Attribute Type Check Methods //############ //########################################################################################## //########################################################################################## template <> RIM_INLINE void AttributeType:: check< Color4D<Bool> >() {} template <> RIM_INLINE void AttributeType:: check< Color4D<Byte> >() {} template <> RIM_INLINE void AttributeType:: check< Color4D<UByte> >() {} template <> RIM_INLINE void AttributeType:: check< Color4D<Short> >() {} template <> RIM_INLINE void AttributeType:: check< Color4D<UShort> >() {} template <> RIM_INLINE void AttributeType:: check< Color4D<Int> >() {} template <> RIM_INLINE void AttributeType:: check< Color4D<UInt> >() {} template <> RIM_INLINE void AttributeType:: check< Color4D<HalfFloat> >() {} template <> RIM_INLINE void AttributeType:: check< Color4D<Float> >() {} template <> RIM_INLINE void AttributeType:: check< Color4D<Double> >() {} //########################################################################################## //********************** End Rim Graphics Utilities Namespace **************************** RIM_GRAPHICS_UTILITIES_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_GRAPHICS_ATTRIBUTE_TYPE_H <file_sep>/* * rimGraphicsShaderPass.h * Rim Graphics * * Created by <NAME> on 1/6/11. * Copyright 2011 Rim Software. All rights reserved. * */ #ifndef INCLUDE_RIM_GRAPHICS_SHADER_PASS_H #define INCLUDE_RIM_GRAPHICS_SHADER_PASS_H #include "rimGraphicsShadersConfig.h" #include "rimGraphicsConstantBinding.h" #include "rimGraphicsConstantUsage.h" #include "rimGraphicsTextureBinding.h" #include "rimGraphicsVertexBinding.h" #include "rimGraphicsShaderBindingData.h" #include "rimGraphicsShaderProgram.h" #include "rimGraphicsShaderPassSource.h" //########################################################################################## //*********************** Start Rim Graphics Shaders Namespace *************************** RIM_GRAPHICS_SHADERS_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class which contains all information necessary to do a single rendering pass. class ShaderPass : public ContextObject { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Destructor /// Destroy this shader pass, releasing all resources. ~ShaderPass(); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Shader Program Accessor Methods /// Get the shader program used to render this shader pass. RIM_INLINE const Pointer<ShaderProgram>& getProgram() const { return program; } /// Set the shader program used to render this shader pass. /** * When this method is called, all attribute and texture bindings * are rebound for the new shader if there exist variables with the * same names in the new shader. All bindings that are no longer valid * are discarded. If the specified shader program is not valid, the * method returns FALSE and has no effect. Otherwise, the method succeeds * and TRUE is returned. */ Bool setProgram( const Pointer<ShaderProgram>& newProgram ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Source Code Accessor Method /// Return a pointer to an object which contains the source code and original bindings for this shader pass. /** * This pointer may be NULL if the shader pass does not support dynamic recompilation. */ RIM_INLINE const Pointer<ShaderPassSource>& getSource() const { return source; } /// Set a pointer to an object which contains the source code and original bindings for this shader pass. /** * This pointer may be NULL if the shader pass does not support dynamic recompilation. */ RIM_INLINE void setSource( const Pointer<ShaderPassSource>& newSource ) { source = newSource; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Binding Data Accessor Methods /// Return a reference to the internal shader binding data for this shader pass. RIM_FORCE_INLINE const ShaderBindingData& getBindingData() const { return bindingData; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constant Binding Accessor Methods /// Get the number of constant bindings associated with this shader pass. RIM_FORCE_INLINE Size getConstantBindingCount() const { return constantBindings.getSize(); } /// Return a reference to the ConstantBinding at the specified index in this shader pass. /** * Binding indices range from 0 to the number of constant bindings minus one. */ RIM_FORCE_INLINE const ConstantBinding& getConstantBinding( Index bindingIndex ) const { return constantBindings[bindingIndex]; } /// Return a pointer to the first constant binding in this shader pass associated with the specified usage. /** * If there is no binding for that usage, NULL is returned. */ const ConstantBinding* getConstantBindingWithUsage( const ConstantUsage& usage ) const; /// Get the index of the binding for the constant variable with the specified name. /** * This method does an expensive linear search through the array of bindings * until it finds the variable with the specified name and places its index * in the output reference parameter. * * The method returns whether or not there was a binding for a variable with that name. */ Bool getConstantBindingIndex( const String& variableName, Index& bindingIndex ) const; /// Get the index of the binding for the constant variable with the specified usage. /** * This method does a linear search through the array of bindings * until it finds the variable with the specified usage and places its index * in the output reference parameter. * * The method returns whether or not there was a binding for a variable with that usage. */ Bool getConstantBindingIndexWithUsage( const ConstantUsage& usage, Index& bindingIndex ) const; /// Add a constant binding for the variable with the given name to this shader pass. /** * If there is no shader for this shader pass, or the shader doesn't have a * variable with the specified name, or the specified usage has an incompatible * type with the shader variable, the method call fails and FALSE is returned. * Otherwise, a new binding is added to the shader pass with the given attributes * and TRUE is returned. The binding's value is zero-initialized. */ Bool addConstantBinding( const String& variableName, const ConstantUsage& usage ); /// Add a constant binding for the variable with the given name to this shader pass. /** * If there is no shader for this shader pass, or the shader doesn't have a * variable with the specified name, or the specified constant or usage has an incompatible * type with the shader variable, the method call fails and FALSE is returned. * Otherwise, a new binding is added to the shader pass with the given attributes * and TRUE is returned. */ template < typename T > RIM_INLINE Bool addConstantBinding( const String& variableName, const T& value, const ConstantUsage& usage = ConstantUsage::UNDEFINED, Bool isInput = true ) { const ConstantVariable* variable; if ( program.isSet() && program->getConstantVariable( variableName, variable ) && (usage == ConstantUsage::UNDEFINED || usage.isValidType( variable->getType() )) ) { ConstantBinding* binding = allocateConstantBinding( variable, usage, isInput ); if ( binding != NULL ) { setConstantValues( *binding, AttributeType::get<T>(), 1, &value ); return true; } } return false; } /// Add a constant binding for the variable with the given name to this shader pass. /** * If there is no shader for this shader pass, or the shader doesn't have a * variable with the specified name, or the specified constant or usage has an incompatible * type with the shader variable, the method call fails and FALSE is returned. * Otherwise, a new binding is added to the shader pass with the given attributes * and TRUE is returned. */ Bool addConstantBinding( const String& variableName, const AttributeValue& value, const ConstantUsage& usage = ConstantUsage::UNDEFINED, Bool isInput = true ); /// Set the constant binding for this shader pass at the specified index, replacing any previous binding. /** * If there is no shader for this shader pass, or the shader doesn't have a * binding with the specified index, or the specified constant or usage has an incompatible * type with the shader variable, the method call fails and FALSE is returned. * Otherwise, the previously existing binding is updated with the given attributes * and TRUE is returned. */ template < typename T > Bool setConstantBinding( Index bindingIndex, const T& value, const ConstantUsage& usage = ConstantUsage::UNDEFINED, Bool isInput = true ) { if ( bindingIndex >= constantBindings.getSize() ) return false; ConstantBinding& binding = constantBindings[bindingIndex]; const ConstantVariable& variable = binding.getVariable(); // Check to see if the described usage is compatible with the variable's type. if ( usage == ConstantUsage::UNDEFINED || usage.isValidType( variable.getType() ) ) { binding.usage = usage; setConstantValues( binding, AttributeType::get<T>(), 1, &value ); return true; } return false; } /// Set the constant binding for this shader pass at the specified index, replacing any previous binding. /** * If there is no shader for this shader pass, or the shader doesn't have a * binding with the specified index, or the specified constant or usage has an incompatible * type with the shader variable, the method call fails and FALSE is returned. * Otherwise, the previously existing binding is updated with the given attributes * and TRUE is returned. */ Bool setConstantBinding( Index bindingIndex, const AttributeValue& value, const ConstantUsage& usage = ConstantUsage::UNDEFINED, Bool isInput = true ); /// Set the constant usage for this shader pass at the specified binding index, replacing any previous usage. /** * If there is no shader for this shader pass, or the shader doesn't have a * binding with the specified index, or the specified usage has an incompatible * type with the shader variable, the method call fails and FALSE is returned. * Otherwise, the previously existing binding is updated with the given constant usage * and TRUE is returned. */ Bool setConstantUsage( Index bindingIndex, const ConstantUsage& usage ); /// Remove the constant binding with the specified index in this shader pass. /** * If the constant binding is successfully removed, TRUE is returned. * Otherwise FALSE is returned and the shader pass is unmodified. This method * removes the constant binding and replaces it with the shader pass's last * constant binding (if there is one) in the list order. */ Bool removeConstantBinding( Index bindingIndex ); /// Clear all constant bindings from this shader pass. void clearConstantBindings(); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constant Value Accessor Methods /// Get the value of the constant with the specified binding and array indices in this shader pass. /** * If a binding exists with that index, TRUE is returned and the value of * the constant's specified array element is written to the output value parameter. * Otherwise, FALSE is returned and the value parameter is unmodified. */ Bool getConstantValue( Index bindingIndex, Index arrayIndex, AttributeValue& value ) const; /// Get the value of the constant with the specified binding index in this shader pass. /** * If a binding exists with that index, TRUE is returned and the value of * the constant's first array element is written to the output value parameter. * Otherwise, FALSE is returned and the value parameter is unmodified. */ template < typename T > RIM_INLINE Bool getConstantValue( Index bindingIndex, T& value ) const { return this->getConstantValue( bindingIndex, 0, value ); } /// Get the value of the constant with the specified binding and array indices in this shader pass. /** * If a binding exists with that index, TRUE is returned and the value of * the constant's specified array element is written to the output value parameter. * Otherwise, FALSE is returned and the value parameter is unmodified. */ template < typename T > RIM_NO_INLINE Bool getConstantValue( Index bindingIndex, Index arrayIndex, T& value ) const { if ( bindingIndex < constantBindings.getSize() ) { const ConstantBinding& binding = constantBindings[bindingIndex]; const ConstantVariable& variable = binding.getVariable(); const AttributeType& variableType = variable.getType(); if ( arrayIndex < variable.getArraySize() && AttributeType::get<T>() == variableType ) return getConstantValue( binding, arrayIndex, &value ); } return false; } /// Set the value of the constant with the specified binding index in this shader pass. /** * The method returns whether or not the value was able to be set. */ Bool setConstantValue( Index bindingIndex, const AttributeValue& value ); /// Set the value of the constant with the specified binding index in this shader pass. /** * The method returns whether or not the value was able to be set. */ Bool setConstantValue( Index bindingIndex, Index arrayIndex, const AttributeValue& value ); /// Set the value of the constant with the specified binding index in this shader pass. /** * The method returns whether or not the value was able to be set. */ template < typename T > RIM_NO_INLINE Bool setConstantValue( Index bindingIndex, const T& value ) { if ( bindingIndex < constantBindings.getSize() ) { ConstantBinding& binding = constantBindings[bindingIndex]; return setConstantValues( binding, AttributeType::get<T>(), 1, &value ); } return false; } /// Set the value of the constant with the specified binding and array indices in this shader pass. /** * The method returns whether or not the value was able to be set. */ template < typename T > RIM_NO_INLINE Bool setConstantValue( Index bindingIndex, Index arrayIndex, const T& value ) { if ( bindingIndex < constantBindings.getSize() ) { ConstantBinding& binding = constantBindings[bindingIndex]; return setConstantValue( binding, arrayIndex, AttributeType::get<T>(), 1, &value ); } return false; } template < typename T > RIM_NO_INLINE Bool getConstantValueForUsage( const ConstantUsage& usage, T& value ) { return this->getConstantValueForUsage( usage, 0, value ); } template < typename T > RIM_INLINE Bool getConstantValueForUsage( const ConstantUsage& usage, Index arrayIndex, T& value ) { const Size numConstants = constantBindings.getSize(); for ( Index i = 0; i < numConstants; i++ ) { ConstantBinding& binding = constantBindings[i]; if ( binding.getUsage() == usage ) return getConstantValue( binding, arrayIndex, &value ); } return false; } template < typename T > RIM_NO_INLINE Bool setConstantValueForUsage( const ConstantUsage& usage, const T& value ) { const Size numConstants = constantBindings.getSize(); for ( Index i = 0; i < numConstants; i++ ) { ConstantBinding& binding = constantBindings[i]; if ( binding.getUsage() == usage ) return setConstantValues( binding, AttributeType::get<T>(), 1, &value ); } return false; } template < typename T > RIM_NO_INLINE Bool setConstantValueForUsage( const ConstantUsage& usage, Index arrayIndex, const T& value ) { const Size numConstants = constantBindings.getSize(); for ( Index i = 0; i < numConstants; i++ ) { ConstantBinding& binding = constantBindings[i]; if ( binding.getUsage() == usage ) return setConstantValue( binding, arrayIndex, AttributeType::get<T>(), 1, &value ); } return false; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Texture Binding Accessor Methods /// Get the number of texture bindings associated with this shader pass. RIM_FORCE_INLINE Size getTextureBindingCount() const { return textureBindings.getSize(); } /// Return a reference to the TextureBinding at the specified index in this shader pass. /** * Binding indices range from 0 to the number of texture bindings minus one. */ RIM_FORCE_INLINE const TextureBinding& getTextureBinding( Index bindingIndex ) const { return textureBindings[bindingIndex]; } /// Return a pointer to the first texture binding in this shader pass associated with the specified usage. /** * If there is no binding for that usage, NULL is returned. */ const TextureBinding* getTextureBindingForUsage( const TextureUsage& usage ) const; /// Get the index of the binding for the texture variable with the specified name. /** * This method does an expensive linear search through the array of bindings * until it finds the variable with the specified name and places its index * in the output reference parameter. * * The method returns whether or not there was a binding for a variable with that name. */ Bool getTextureBindingIndex( const String& variableName, Index& bindingIndex ) const; /// Add a texture binding for the variable with the given name to this shader pass. /** * If there is no shader for this shader pass, or the shader doesn't have a * variable with the specified name, or the specified usage has an incompatible * type with the shader variable, the method call fails and FALSE is returned. * Otherwise, a new binding is added to the shader pass with the given attributes * and TRUE is returned. */ Bool addTextureBinding( const String& variableName, const TextureUsage& usage ); /// Add a texture binding for the variable with the given name to this shader pass. /** * If there is no shader for this shader pass, or the shader doesn't have a * variable with the specified name, or the specified texture or usage has an incompatible * type with the shader variable, the method call fails and FALSE is returned. * Otherwise, a new binding is added to the shader pass with the given attributes * and TRUE is returned. */ Bool addTextureBinding( const String& variableName, const Resource<Texture>& texture, const TextureUsage& usage = TextureUsage::UNDEFINED, Bool isInput = true ); /// Set the texture binding for this shader pass at the specified index, replacing any previous binding. /** * If there is no shader for this shader pass, or the shader doesn't have a * binding with the specified index, or the specified texture or usage has an incompatible * type with the shader variable, the method call fails and FALSE is returned. * Otherwise, the previously existing binding is updated with the given attributes * and TRUE is returned. */ Bool setTextureBinding( Index bindingIndex, const Resource<Texture>& texture, const TextureUsage& usage = TextureUsage::UNDEFINED, Bool isInput = true ); /// Set the texture usage for this shader pass at the specified binding index, replacing any previous usage. /** * If there is no shader for this shader pass, or the shader doesn't have a * binding with the specified index, or the specified usage has an incompatible * type with the shader variable, the method call fails and FALSE is returned. * Otherwise, the previously existing binding is updated with the given texture usage * and TRUE is returned. */ Bool setTextureUsage( Index bindingIndex, const TextureUsage& usage ); /// Remove the texture binding with the specified index in this shader pass. /** * If the texture binding is successfully removed, TRUE is returned. * Otherwise FALSE is returned and the shader pass is unmodified. */ Bool removeTextureBinding( Index bindingIndex ); /// Clear all texture bindings from this shader pass. void clearTextureBindings(); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Texture Accessor Methods /// Get the first texture for this shader pass at the specified binding index. Bool getTexture( Index bindingIndex, Resource<Texture>& texture ) const; /// Get the texture for this shader pass at the specified binding and array index. Bool getTexture( Index bindingIndex, Index arrayIndex, Resource<Texture>& texture ) const; /// Set the texture for this shader pass at the specified binding index, replacing any previous texture. /** * If there is no shader for this shader pass, or the shader doesn't have a * binding with the specified index, or the specified texture has an incompatible * type with the shader variable, the method call fails and FALSE is returned. * Otherwise, the previously existing binding is updated with the given texture * and TRUE is returned.. */ Bool setTexture( Index bindingIndex, const Resource<Texture>& texture ); /// Set the texture for this shader pass at the specified binding index, replacing any previous texture. /** * If there is no shader for this shader pass, or the shader doesn't have a * binding with the specified index, or the specified texture has an incompatible * type with the shader variable, the method call fails and FALSE is returned. * Otherwise, the previously existing binding is updated with the given texture * and TRUE is returned.. */ Bool setTexture( Index bindingIndex, Index arrayIndex, const Resource<Texture>& texture ); /// Get the texture to use for the specified usage in this shader pass. Bool getTextureForUsage( const TextureUsage& usage, Resource<Texture>& texture ); /// Set the texture to use for the specified usage in this shader pass. Bool setTextureForUsage( const TextureUsage& usage, const Resource<Texture>& texture ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Vertex Binding Accessor Methods /// Get the number of vertex bindings associated with this shader pass. RIM_FORCE_INLINE Size getVertexBindingCount() const { return vertexBindings.getSize(); } /// Return a reference to the VertexBinding at the specified index in this shader pass. /** * Binding indices range from 0 to the number of vertex bindings minus one. */ RIM_FORCE_INLINE const VertexBinding& getVertexBinding( Index bindingIndex ) const { return vertexBindings[bindingIndex]; } /// Return a pointer to the first vertex binding in this shader pass associated with the specified usage. /** * If there is no binding for that usage, NULL is returned. */ const VertexBinding* getVertexBindingForUsage( const VertexUsage& usage ) const; /// Get the index of the binding for the vertex variable with the specified name. /** * This method does an expensive linear search through the array of bindings * until it finds the variable with the specified name and places its index * in the output reference parameter. * * The method returns whether or not there was a binding for a variable with that name. */ Bool getVertexBindingIndex( const String& variableName, Index& bindingIndex ) const; /// Add a vertex binding for the variable with the given name to this shader pass. /** * If there is no shader for this shader pass, or the shader doesn't have a * variable with the specified name, or the specified vertex or usage has an incompatible * type with the shader variable, the method call fails and FALSE is returned. * Otherwise, a new binding is added to the shader pass with the given attributes * and TRUE is returned. */ Bool addVertexBinding( const String& variableName, const VertexUsage& usage ); /// Add a vertex binding for the variable with the given name to this shader pass. /** * If there is no shader for this shader pass, or the shader doesn't have a * variable with the specified name, or the specified vertex or usage has an incompatible * type with the shader variable, the method call fails and FALSE is returned. * Otherwise, a new binding is added to the shader pass with the given attributes * and TRUE is returned. */ Bool addVertexBinding( const String& variableName, const Pointer<VertexBuffer>& buffer, const VertexUsage& usage = VertexUsage::UNDEFINED, Bool isInput = true ); /// Set the vertex binding for this shader pass at the specified index, replacing any previous binding. /** * If there is no shader for this shader pass, or the shader doesn't have a * binding with the specified index, or the specified vertex or usage has an incompatible * type with the shader variable, the method call fails and FALSE is returned. * Otherwise, the previously existing binding is updated with the given attributes * and TRUE is returned. */ Bool setVertexBinding( Index bindingIndex, const Pointer<VertexBuffer>& buffer, const VertexUsage& usage = VertexUsage::UNDEFINED, Bool isInput = true ); /// Set the vertex usage for this shader pass at the specified binding index, replacing any previous usage. /** * If there is no shader for this shader pass, or the shader doesn't have a * binding with the specified index, or the specified usage has an incompatible * type with the shader variable, the method call fails and FALSE is returned. * Otherwise, the previously existing binding is updated with the given vertex usage * and TRUE is returned. */ Bool setVertexUsage( Index bindingIndex, const VertexUsage& usage ); /// Remove the vertex binding with the specified index in this shader pass. /** * If the vertex binding is successfully removed, TRUE is returned. * Otherwise FALSE is returned and the shader pass is unmodified. */ Bool removeVertexBinding( Index bindingIndex ); /// Clear all vertex bindings from this shader pass. void clearVertexBindings(); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Vertex Buffer Accessor Methods /// Set the vertex buffer for this shader pass at the specified binding index, replacing any previous buffer. /** * If there is no shader for this shader pass, or the shader doesn't have a * binding with the specified index, or the specified vertex buffer has an incompatible * type with the shader variable, the method call fails and FALSE is returned. * Otherwise, the previously existing binding is updated with the given vertex buffer * and TRUE is returned.. */ Bool setVertexBuffer( Index bindingIndex, const Pointer<VertexBuffer>& buffer ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Minimum Vertex Buffer Size Accessor Method /// Return the smallest number of elements that are in any vertex buffer that is part of this shader pass. /** * If there are no vertex buffers attached, 0 is returned. This method * can be used to make sure that a shader pass has enough vertex data * for a particular draw call or index buffer. */ Size getMinimumVertexBufferCapacity() const; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Transparency Accessor Methods /// Get whether or not this shader pass produces pixels which are transparent. /** * A shader pass is deemed to be transparent if blending and transparency depth sorting * is enabled by the shader pass's render mode. */ RIM_INLINE Bool getIsTransparent() const { return renderMode.flagIsSet( RenderFlags::BLENDING ) && renderMode.flagIsSet( RenderFlags::TRANSPARENCY_DEPTH_SORT ); } /// Set whether or not this shader pass produces pixels which are transparent. /** * A shader pass is deemed to be transparent if blending and transparency depth sorting * is enabled by the shader pass's render mode. Calling this method causes blending * and transparency sorting to be enabled or disabled. */ RIM_INLINE void setIsTransparent( Bool newIsTransparent ) { renderMode.setFlag( RenderFlags::BLENDING, newIsTransparent ); renderMode.setFlag( RenderFlags::TRANSPARENCY_DEPTH_SORT, newIsTransparent ); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Render Mode Accessor Methods /// Return a reference to the object that determines the fixed-function rendering mode for this shader pass. RIM_INLINE RenderMode& getRenderMode() { return renderMode; } /// Return a const reference to the object that determines the fixed-function rendering mode for this shader pass. RIM_INLINE const RenderMode& getRenderMode() const { return renderMode; } /// Set an object that determines the fixed-function rendering mode for this shader pass. RIM_INLINE void setRenderMode( const RenderMode& newRenderMode ) { renderMode = newRenderMode; } protected: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructors /// Create a new shader pass which doesn't have an associated shader program. ShaderPass( const devices::GraphicsContext* context ); /// Create a new shader pass which uses the specified shader program and the default render mode. ShaderPass( const devices::GraphicsContext* context, const Pointer<ShaderProgram>& newProgram ); /// Create a new shader pass which uses the specified shader program and render mode. ShaderPass( const devices::GraphicsContext* context, const Pointer<ShaderProgram>& newProgram, const RenderMode& newRenderMode ); private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Constant Variable Binding Helper Methods /// Add a new constant binding to this shader pass for the variable. /** * If there is no variable with that name or if the specified usage is incompatible * with the variable, the method fails and NULL is returned. Otherwise, the method * returns a pointer to the new constant binding and allocates storage for * its value. */ ConstantBinding* allocateConstantBinding( const ConstantVariable* variable, const ConstantUsage& usage, Bool isInput ); /// Zero the memory for the specified constant binding. void zeroConstantValues( const ConstantBinding& binding ); /// Write the value for the specified binding and array index to the output parameter. Bool getConstantValue( const ConstantBinding& binding, Index arrayIndex, void* value ) const; /// Initialize the memory for the specified constant binding with the given value. Bool setConstantValues( const ConstantBinding& binding, const AttributeType& valueType, Size valueArraySize, const void* value ); /// Initialize the memory for the specified constant binding with the given value. Bool setConstantValue( const ConstantBinding& binding, Index arrayIndex, const AttributeType& valueType, Size valueArraySize, const void* value ); /// Return whether or not the specified shader variable supports the given attribute type. RIM_INLINE static Bool constantVariableSupportsType( const ConstantVariable& variable, const AttributeType& type ) { const AttributeType& variableType = variable.getType(); return variableType.getRowCount() == type.getRowCount() && variableType.getColumnCount() == type.getColumnCount(); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Texture Variable Binding Helper Methods /// Add a new texture binding to this shader pass for the variable with the given name. /** * If there is no variable with that name or if the specified usage is incompatible * with the variable, the method fails and NULL is returned. Otherwise, the method * returns a pointer to the new texture binding and allocates storage for * its textures. */ TextureBinding* allocateTextureBinding( const TextureVariable* variable, const TextureUsage& usage, Bool isInput ); /// Zero the memory for the specified texture binding. void zeroTextures( const TextureBinding& binding ); /// Set all textures that the specified texture binding uses to the specified texture. Bool setTextures( const TextureBinding& binding, const Resource<Texture>& texture ); /// Set the texture with the specified array index for the given texture binding. Bool setTexture( const TextureBinding& binding, Index arrayIndex, const Resource<Texture>& texture ); /// Return whether or not the specified shader variable supports the given attribute type. RIM_INLINE static Bool textureVariableSupportsTexture( const TextureVariable& variable, const Resource<Texture>& texture ) { if ( texture.isNull() ) return false; const TextureType& textureType = variable.getType(); // Make sure that the texture variable's type is compatable with the texture. if ( textureType.getDimensionCount() != texture->getDimensionCount() ) return false; else if ( textureType.isAShadowMap() && texture->getFormat() != TextureFormat::DEPTH ) return false; else return textureType.isACubeMap() == texture->isACubeMap(); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Vertex Binding Helper Methods /// Add a new vertex binding to this shader pass for the variable with the given name. /** * If there is no variable with that name or if the specified usage is incompatible * with the variable, the method fails and NULL is returned. Otherwise, the method * returns a pointer to the new vertex binding and allocates storage for * its buffers. */ VertexBinding* allocateVertexBinding( const VertexVariable* variable, const VertexUsage& usage, Bool isInput ); /// Zero the memory for the specified vertex binding. void zeroVertexBuffers( const VertexBinding& binding ); /// Set all buffers that the specified vertex binding uses to the specified buffer. Bool setVertexBuffers( const VertexBinding& binding, const Pointer<VertexBuffer>& buffer ); /// Set the buffer with the specified array index for the given vertex binding. Bool setVertexBuffer( const VertexBinding& binding, const Pointer<VertexBuffer>& buffer, Index arrayIndex ); /// Return whether or not the specified shader variable supports the given attribute type. RIM_INLINE static Bool vertexVariableSupportsBuffer( const VertexVariable& variable, const Pointer<VertexBuffer>& buffer ) { if ( buffer.isNull() ) return false; const AttributeType& variableType = variable.getType(); const AttributeType& bufferType = buffer->getAttributeType(); return variableType.getRowCount() == bufferType.getRowCount() && variableType.getColumnCount() == bufferType.getColumnCount(); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Shader Data Members /// A pointer to the shader program which is used to render this shader pass. Pointer<ShaderProgram> program; /// A pointer to an object which contains the source code and original bindings for this shader pass. /** * This pointer may be NULL if the shader pass does not support dynamic recompilation. */ Pointer<ShaderPassSource> source; /// A pointer to an object that specifies the compile-time configuration of this shader pass's shader program. Pointer<ShaderConfiguration> configuration; /// An object which encapsulates the configuration of this shader pass's rendering pipeline. RenderMode renderMode; /// A list of the constant variable bindings for this shader pass. ArrayList<ConstantBinding> constantBindings; /// A list of the texture variable bindings for this shader pass. ArrayList<TextureBinding> textureBindings; /// A list of the vertex variable bindings for this shader pass. ArrayList<VertexBinding> vertexBindings; /// A set of binding data for this shader pass. ShaderBindingData bindingData; }; //########################################################################################## //*********************** End Rim Graphics Shaders Namespace ***************************** RIM_GRAPHICS_SHADERS_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_GRAPHICS_SHADER_PASS_H <file_sep>/* * rimGraphicsGUIButtonType.h * Rim Graphics GUI * * Created by <NAME> on 2/5/13. * Copyright 2013 Headspace Systems. All rights reserved. * */ #ifndef INCLUDE_RIM_GRAPHICS_GUI_BUTTON_TYPE_H #define INCLUDE_RIM_GRAPHICS_GUI_BUTTON_TYPE_H #include "rimGraphicsGUIBase.h" //########################################################################################## //************************ Start Rim Graphics GUI Namespace ****************************** RIM_GRAPHICS_GUI_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class which represents the type of a button. class ButtonType { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Public Enum Declaration /// An enum which specifies the different kinds of buttons. typedef enum Enum { /// A button type where the button selection event is sent when the button is released after being pressed. /** * The button sends a 'select' message when the button is pressed * and then released. The button is then immediatedly set to be unselected. * * This button type should be used to perform an action when it is selected. * Since the button is not selected until released over the button's area, * it gives the user the ability to confirm their choice. */ ACTION, /// A button type where the button is only selected while it is pressed. /** * The button sends a 'select' message when the button is first pressed * and an 'unselect' message when the button is released. */ MOMENTARY, /// A button type where the button is either in an 'on' or 'off' state. /** * The button sends a 'select' message when the button is pressed * and then released, turning the button to the 'on' state. An 'unselect' * message is sent when the button is pressed again and released, * turning it to the 'off' state. */ SWITCH }; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructors /// Create a new button type using the specified button type enum value. RIM_INLINE ButtonType( Enum newType ) : type( newType ) { } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Enum Cast Operator /// Convert this button type to an enum value. RIM_INLINE operator Enum () const { return type; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** String Representation Accessor Methods /// Return a string representation of the button type. String toString() const; /// Convert this button type into a string representation. RIM_INLINE operator String () const { return this->toString(); } private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Members /// An enum value indicating the type of button this object represents. Enum type; }; //########################################################################################## //************************ End Rim Graphics GUI Namespace ******************************** RIM_GRAPHICS_GUI_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_GRAPHICS_GUI_BUTTON_TYPE_H <file_sep>/* * rimEngine.h * Rim Engine * * Created by <NAME> on 2/2/08. * Copyright 2008 Rim Software. All rights reserved. * */ #ifndef INCLUDE_RIM_ENGINE_H #define INCLUDE_RIM_ENGINE_H #include "engine/rimEngineConfig.h" #include "engine/rimSimpleDemo.h" #endif // INCLUDE_RIM_ENGINE_H <file_sep>/* * rimSoundDevice.h * Rim Sound * * Created by <NAME> on 6/7/08. * Copyright 2008 Rim Software. All rights reserved. * */ #ifndef INCLUDE_RIM_SOUND_DEVICE_H #define INCLUDE_RIM_SOUND_DEVICE_H #include "rimSoundDevicesConfig.h" #include "rimSoundDeviceID.h" #include "rimSoundDeviceDelegate.h" #include "../filters/rimSoundSampleRateConverter.h" //########################################################################################## //************************ Start Rim Sound Devices Namespace ***************************** RIM_SOUND_DEVICES_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class which represents a system sound device. /** * A SoundDevice provides an easy-to-use platform-independent interface for * sending audio to an audio device. It allows the user to access commonly * needed parameters such as the device's sample rate and name. * * The class also provides automatic sample rate conversion if the input audio * sample rate is not the same as the device's current sample rate. If one does not * wish to incurr a performance penalty from the sample rate conversion, the class * also allows the user to attempt to set the device's sample rate. */ class SoundDevice { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructors /// Create a SoundDevice for the specified SoundDeviceID. SoundDevice( const SoundDeviceID& newDeviceID ); /// Create a copy of the specified SoundDevice object. SoundDevice( const SoundDevice& other ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Destructor /// Destroy a SoundDevice object, stopping the input/output of any audio. ~SoundDevice(); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Assignment Operator /// Assign the state from one SoundDevice to this object. SoundDevice& operator = ( const SoundDevice& other ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Sound Output Start/Stop Methods /// Start sending audio to the device. /** * If this device has no output callback, zeroes are sent to the device until * a callback function is bound to the device. If the device is invalid or * if an error occurs, FALSE is returned indicating that the method had no effect. * If TRUE is returned, the device was started successfully. * * This method has the effect of starting a new audio rendering thread which * will then handle requesting audio data from the output callback function * until the callback function is changed or removed or the device's output * is stopped using the stop() method. */ Bool start(); /// Stop sending/receiving audio data to the device. /** * If the device is currently outputing audio, the output of further audio * is stopped. Otherwise, the method has no effect. If the device is invalid, * this method has no effect. * * This method has the effect of stopping the audio rendering thread that was * started in the start() method. */ Bool stop(); /// Return whether or not the device is currently sending/receiving audio. /** * If audio is currently being requested and sent to the device, TRUE is returned. * Otherwise, FALSE is returned. If the device is invalid, FALSE is always * returned. * * @return whether or not the device is currently outputing audio. */ RIM_INLINE Bool isRunning() const { return running; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Device Input Channel Accessor Methods /// Get the number of input channels that this device has. /** * If the device is invalid, this method always returns 0. */ RIM_INLINE Size getInputChannelCount() const { return numInputChannels; } /// Return a human-readable name for the input channel at the specified index. /** * This is a string provided by the device driver which names the input channel * with the given index. If an invalid channel index is specified, an empty * string is returned. */ UTF8String getInputChannelName( Index inputChannelIndex ) const; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Device Output Channel Accessor Methods /// Get the number of output channels that this device has. /** * If the device is invalid, this method always returns 0. */ RIM_INLINE Size getOutputChannelCount() const { return numOutputChannels; } /// Return a human-readable name for the output channel at the specified index. /** * This is a string provided by the device driver which names the output channel * with the given index. If an invalid channel index is specified, an empty * string is returned. */ UTF8String getOutputChannelName( Index outputChannelIndex ) const; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Sample Rate Accessor Methods /// Get the current sample rate at which audio is being sent to the device. /** * This is the sample rate of the device's clock. Any input audio that doesn't * match this sample rate is automatically converted to this sample rate. * If the device is invalid, a sample rate of 0 is returned. * * @return the current sample rate of the device's clock. */ SampleRate getSampleRate() const; /// Set the current sample rate at which audio should be sent to the device. /** * This method sets the sample rate of the device's clock. If the specified * new sample rate is not a natively supported sample rate or if there was an * error in setting the new sample rate, FALSE is returned and this method has * no effect on the device's state. Otherwise, if the sample rate is a native format, * TRUE is returned and the device's output sample rate is changed. * If the device is invalid, FALSE is returned and the method has no effect. * * @param newSampleRate - the sample rate to which the device's clock will be set to. * @return whether or not the sample rate change operation was successful. */ Bool setSampleRate( SampleRate newSampleRate ); /// Return whether or not the specified sample rate is a native sample rate for this device. /** * For a sample rate to be native, no sample rate conversion is necessary before * sending the audio to the device if it is of that sampling rate. * * @param sampleRate - the sample rate to test to see if it is a native format. * @return whether or not the specified sample rate is a native format for this device. */ RIM_INLINE Bool isNativeSampleRate( SampleRate sampleRate ) { return nativeSampleRates.contains( sampleRate ); } /// Return a list of the native sampling rates for this output audio device. /** * For a sample rate to be native, no sample rate conversion is necessary before * sending the audio to the device if it is of that sampling rate. */ RIM_INLINE const ArrayList<SampleRate>& getNativeSampleRates() const { return nativeSampleRates; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Latency Accessor Methods /// Return the one-way input latency in seconds of this sound device. /** * This is the total time that it takes for the sound device to * preset input, given an analogue input signal. */ Time getInputLatency() const; /// Return the one-way output latency in seconds of this sound device. /** * This is the total time that it takes for the sound device to * produce output, given input audio data. */ Time getOutputLatency() const; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Device Name Accessor Method /// Get a string representing the name of this device. /** * This name is usually specified by the hardware driver as a human-readable * identifier for the device. If the device is not valid, the empty string * is returned. * * @return the name of this device. */ RIM_INLINE const UTF8String& getName() const { return name; } /// Get a string representing the name of this device's manufacturer. /** * This name is usually specified by the hardware driver as a human-readable * identifier for the device's manufacturer. If the device is not valid, the empty string * is returned. * * @return the name of this device's manufacturer. */ RIM_INLINE const UTF8String& getManufacturer() const { return manufacturer; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Device ID Accessor Method /// Return an object which uniquely identifies this sound device. /** * If the device is not valid, SoundDeviceID::INVALID_DEVICE is returned. */ RIM_INLINE SoundDeviceID getID() const { return valid ? deviceID : SoundDeviceID::INVALID_DEVICE; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Device Status Accessor Method /// Return whether or not this device represents a valid device. /** * If a SoundDevice is created with a SoundDeviceID that does not * represent a valid system audio device or if a device is removed after * it is created, the SoundDevice is marked as invalid and this * method will return FALSE. Otherwise, if the device is valid, the method * returns TRUE. * * If a device is invalid, the output callback method will not be called anymore * and the application should switch to a different device. The application * should periodically check the return value of this function to see if the * device has been removed. */ RIM_INLINE Bool isValid() const { return valid; } /// Return whether or not this device is an input device. /** * If this is true, the device will have at least one output channel. * Otherwise, the device should have 0 output channels. */ RIM_INLINE Bool isInput() const { return numInputChannels > 0; } /// Return whether or not this device is an output device. /** * If this is true, the device will have at least one output channel. * Otherwise, the device should have 0 output channels. */ RIM_INLINE Bool isOutput() const { return numOutputChannels > 0; } /// Return whether or not this device represents the current default system input device. Bool isDefaultInput() const; /// Return whether or not this device represents the current default system output device. Bool isDefaultOutput() const; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** CPU Usage Accessor Method /// Return a value indicating the fraction of available CPU time being used to process audio for the last frame. /** * This value lies in the range [0,1] where 0 indicates that no time is used, and 1 indicates * that 100% of the available time is used. Going over 100% of the available time means * that the audio processing thread has stalled, producing clicks or pops in the audio * due to dropped frames. * * This is the CPU usage amount for the last processed frame of audio. Use this value * to obtain an instantaneous usage metric. */ RIM_INLINE Float getCurrentCPUUsage() const { return currentCPUUsage; } /// Return a value indicating the average fraction of available CPU time being used to process audio. /** * This value lies in the range [0,1] where 0 indicates that no time is used, and 1 indicates * that 100% of the available time is used. Going over 100% of the available time means * that the audio processing thread has stalled, producing clicks or pops in the audio * due to dropped frames. * * This average value is computed using an envelope filter with a fast attack time and a * release time of half a second. This value is computed to give a long-time indication of the * CPU usage over many processing frames. */ RIM_INLINE Float getAverageCPUUsage() const { return averageCPUUsage; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Delegate Accessor Methods /// Return a reference to the delegate object which is responding to events for this device manager. RIM_INLINE const SoundDeviceDelegate& getDelegate() const { return delegate; } /// Replace the delegate object which is responding to events for this device manager. void setDelegate( const SoundDeviceDelegate& newDelegate ); private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Wrapper Class Declaration /// A class which encapsulates internal data needed by the SoundDevice object. class Wrapper; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Helper Methods /// Initialize a newly created device. Bool initializeDeviceData(); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Platform-Specific Methods /// Initialize up any platform-specific data for a newly-created device. Bool createDevice(); /// Clean up any platform-specific data before a device is destroyed. Bool destroyDevice(); /// Register callback functions that tell the device when its attributes change. Bool registerDeviceUpdateCallbacks(); /// Unregister callback functions that tell the device when its attributes change. Bool unregisterDeviceUpdateCallbacks(); /// Determine whether or not this sound device is still valid. Bool refreshDeviceStatus(); /// Refresh the configuration of the device's input stream. Bool refreshInputStreamConfiguration(); /// Refresh the configuration of the device's output stream. Bool refreshOutputStreamConfiguration(); /// Refresh the native sample rates of this device. Bool refreshNativeSampleRates(); /// Refresh the name of the sound device. Bool refreshName(); /// Refresh the manufacturer name of the sound device. Bool refreshManufacturer(); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Members /// An object which represents a unique identifier for this sound device. SoundDeviceID deviceID; /// An object that handles events for this sound device. SoundDeviceDelegate delegate; /// A list of the natively supported sample rates of this SoundDevice. ArrayList<SampleRate> nativeSampleRates; /// The device-provided name of this SoundDevice. UTF8String name; /// The device-provided manufacturer name of this SoundDevice. UTF8String manufacturer; /// A mutex object which handles output synchronization with device parameter changes. mutable threads::Mutex ioMutex; /// A class which handles sample rate conversion for this device. filters::SampleRateConverter sampleRateConverter; /// A buffer of audio data that holds audio data requested from the client. SoundBuffer ioBuffer; /// A buffer of audio data that is used hold the results of (possible) sample rate conversion. SoundBuffer sampleRateConversionBuffer; /// The number of input channels that this device has. Size numInputChannels; /// The number of output channels that this device has. Size numOutputChannels; /// The index of the first valid sample in the sample rate conversion buffer. Index converterBufferStart; /// The number of samples of valid audio that are buffered in the sample rate conversion buffer. Size samplesInConverterBuffer; /// A value indicating the fraction of available CPU time being used to process audio for the last frame. Float currentCPUUsage; /// A value indicating the average fraction of available CPU time being used to process audio on the rendering thread. /** * This average value is computed using an envelope filter with a fast attack time and a * release time of half a second. This value is computed to give a long-time indication of the * CPU usage over many processing frames. */ Float averageCPUUsage; /// A pointer to a class which wraps internal state of this SoundDevice. Wrapper* wrapper; /// A boolean value indicating whether or not the device is currently valid for use. Bool valid; /// A boolean value indicating whether or not the device is currently outputing audio. Bool running; }; //########################################################################################## //************************ End Rim Sound Devices Namespace ******************************* RIM_SOUND_DEVICES_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_SOUND_DEVICE_H <file_sep>/* * rimBasicThread.h * Rim Threads * * Created by <NAME> on 10/31/08. * Copyright 2008 __MyCompanyName__. All rights reserved. * */ #ifndef INCLUDE_RIM_BASIC_THREAD_H #define INCLUDE_RIM_BASIC_THREAD_H #include "rimThreadsConfig.h" #include "../rimLanguage.h" #include "../rimUtilities.h" #include "rimThreadPriority.h" //########################################################################################## //*************************** Start Rim Threads Namespace ******************************** RIM_THREADS_NAMESPACE_START //****************************************************************************************** //########################################################################################## typedef PointerInt ThreadID; //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class that provides a system-independent abstraction for a thread of execution. /** * This is the base class for a platform-independent thread. Subclasses implement the * run() method, providing a better user interface to thread initialization. They can * provide more complex functionality (such as a worker thread). */ class BasicThread { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructor /// Create a default thread which is not yet running. BasicThread(); /// Create a new thread that is a copy of another thread. /** * This merely copies any attributes of the other thread, the * new thread object still refers to a different OS thread than * the copied object. */ BasicThread( const BasicThread& other ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Destructor /// Destroy this thread object. /** * This doesn't stop the thread if it is currently running, only destroys any * way of controlling or joining the thread - it is orphaned and will continue * until it returns on its own. */ virtual ~BasicThread(); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Assignment Operator /// Copy the attributes of one thread to this thread. /** * This doesn't stop the thread if it is currently running, only destroys any * way of controlling or joining the thread - it is orphaned and will continue * until it returns on its own. This operator initializes the thread object with * any attributes of the other thread. The newly assigned thread is not running. */ BasicThread& operator = ( const BasicThread& other ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Thread Instance Control /// Forcibly end the execution of a thread. /** * This method forcibly stops the execution of a thread object if it is * currently running. The use of this method is not recommended in general. * Calling this method can result in memory not being correctly freed and * other undefinend behavior. */ Bool stop(); /// Get whether or not a thread is currently running. RIM_INLINE Bool isRunning() const { return threadIsRunning; } /// Return the ID of this thread. ThreadID getID() const; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Thread Priority Accessor Methods /// Return an object describing the current scheduling priority for this thread. ThreadPriority getPriority( const ThreadPriority& newPriority ); /// Set the scheduling priority for this thread. /** * The method returns whether or not the thread's priority was * successfully changed. */ Bool setPriority( const ThreadPriority& newPriority ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Current Thread Control Methods /// Sleep the calling thread for the specified number of milliseconds. /** * The calling thread yeilds it's position in the operating system's * process queue to another thread and halts execution until the * specified number of milliseconds has elapsed. * * @param milliseconds - the number of milliseconds until execution will resume. */ static void sleepMs( int milliseconds ); /// Sleep this thread for the specified number of seconds /** * The calling thread yeilds it's position in the operating system's * process queue to another thread and halts execution until the * specified number of seconds has elapsed. * * @param seconds - the number of seconds until execution will resume. */ static void sleep( double seconds ); /// Relinquish the calling thread's CPU time until is it rescheduled. /** * The calling thread yeilds it's position in the operating system's * process queue to another thread and halts execution until it is * again rescheduled for execution. */ static void yield(); /// Terminate the current calling thread. /** * This method prematurely terminates the calling thread. */ static void exit(); /// Return the ID of the calling thread. static ThreadID getCurrentID(); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** System Thread Info Methods /// Return the total number of available hardware threads on this system. static Size getCPUCount(); protected: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Protected Virtual Run Function /// Start this thread object's execution. /** * The method returns whether or not starting the thread was successful. */ Bool startThread(); /// Wait indefinitely to join a thread when it dies. /** * This method stops the execution of the calling thread indefinitely * until the thread object has finished running. Use this with caution, * as it can cause a program to lock up while it waits for the thread to * finish. * * The method returns whether or not joining the thread was successful. */ Bool joinThread(); /// Start the execution of subclass client code on a new thread. /** * This virtual method is called by the BasicThread class when a new thread * is started using the startThread() method. A subclass should override this * method and provide its own custom hook into the new thread. */ virtual void run() = 0; private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Class Declaration /// A class which holds platform-specific data for this thread object. class ThreadWrapper; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Members /// A class which wraps platform-specific thread functionality. ThreadWrapper* wrapper; /// A boolean value indicating whether or not the thread is currently running. Bool threadIsRunning; }; //########################################################################################## //*************************** End Rim Threads Namespace ********************************** RIM_THREADS_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_BASIC_THREAD_H <file_sep>/* * rimGraphicsShaderPassLibrary.h * Rim Software * * Created by <NAME> on 1/30/14. * Copyright 2014 __MyCompanyName__. All rights reserved. * */ #ifndef INCLUDE_RIM_GRAPHICS_SHADER_PASS_LIBRARY_H #define INCLUDE_RIM_GRAPHICS_SHADER_PASS_LIBRARY_H #include "rimGraphicsShadersConfig.h" #include "rimGraphicsGenericShaderPass.h" //########################################################################################## //*********************** Start Rim Graphics Shaders Namespace *************************** RIM_GRAPHICS_SHADERS_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A library which contains GenericShaderPass objects for different ShaderUsage types. class ShaderPassLibrary { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructors /// Create a new shader pass library that contains no shader passes. ShaderPassLibrary(); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Destructor /// Destroy this shader pass library, releasing all associated resources. virtual ~ShaderPassLibrary(); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Shader Pass Accessor Methods /// Return the number of generic shader passes that this shader pass library has. RIM_INLINE Size getPassCount() const { return passes.getSize(); } /// Return a pointer to the generic shader pass at the specified index in this shader pass library. RIM_INLINE const Pointer<GenericShaderPass>& getPass( Index passIndex ) const { return passes[passIndex]; } /// Return a pointer to a generic shader pass in this shader pass library with the specified usage. /** * If there is no generic shader pass with that usage, a NULL pointer is returned. */ Pointer<GenericShaderPass> getPassWithUsage( const ShaderPassUsage& usage ) const; /// Return a pointer to a generic shader pass in this shader pass library with the specified usage and shader language. /** * If there is no generic shader pass with that usage and shader language, a NULL pointer is returned. */ Pointer<ShaderPassSource> getPassWithUsageAndLanguage( const ShaderPassUsage& usage, const ShaderLanguage& language ) const; /// Add a new generic shader pass to the end of this shader pass library's list of passes. /** * If the specified generic shader pass is NULL, the method fails and returns FALSE. * Otherwise, the new pass is added and TRUE is returned. */ RIM_INLINE Bool addPass( const Pointer<GenericShaderPass>& newPass ) { if ( newPass.isNull() ) return false; passes.add( newPass ); return true; } /// Remove the generic shader pass at the specified index in this shader pass library. /** * This method maintains the order of the remaining shader passes. */ RIM_INLINE void removePass( Index passIndex ) { passes.removeAtIndex( passIndex ); } /// Clear all generic shader passes from this shader pass library. RIM_INLINE void clearPasses() { passes.clear(); } private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Members /// A list of the different shader classes for this shader library. ArrayList< Pointer<GenericShaderPass> > passes; }; //########################################################################################## //*********************** End Rim Graphics Shaders Namespace ***************************** RIM_GRAPHICS_SHADERS_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_GRAPHICS_SHADER_PASS_LIBRARY_H <file_sep>/* * rimIOException.h * Rim IO * * Created by <NAME> on 3/18/08. * Copyright 2008 __MyCompanyName__. All rights reserved. * */ #ifndef INCLUDE_RIM_IO_EXCEPTION_H #define INCLUDE_RIM_IO_EXCEPTION_H #include "rimExceptionsConfig.h" #include "rimException.h" //########################################################################################## //*************************** Start Rim Exceptions Namespace ***************************** RIM_EXCEPTIONS_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// An exception to be thrown when an error occurs while reading or writing with a stream. /** * It is meant to be thrown from the location of an error * and then to be caught by error correcting code somewhere * in the calling stack. Each exception provides a means to * encapsulate a message in the exception, so as to give the * exception catcher a better idea of why the error occurred. * * This subclass of rimException indicates that an error * has occurred while reading or writing with a rimInputStream * or rimOutputStream. Check the message for more detail. */ class IOException : public Exception { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructors /// Create a default IO exception with no message. RIM_INLINE IOException() : Exception() { } /// Create a IO exception with a character array message. /** * The message lets the thrower of the exception * tell the catcher the reason for the throw of the * exception. */ RIM_INLINE IOException( const char* newMessage ) : Exception( newMessage ) { } /// Create a new IO exception with a message from a string. /** * The message lets the thrower of the exception * tell the catcher the reason for the throw of the * exception. */ RIM_INLINE IOException( const String& newMessage ) : Exception( newMessage ) { } /// Create a copy of an IO exception (copy constructor). /** * This copy contructor duplicates the message of the * parameter exception by doing a deep copy. */ RIM_INLINE IOException( const IOException& exception ) : Exception( exception ) { } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Type Accessors /// Get a string representing the type of this exception virtual const String& getType() const { return *type; } /// Get a string representing the type of this exception (static version) static const String& getStaticType() { return *type; } private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Static Data Members /// A string representing the type of this exception static const String* type; }; //########################################################################################## //*************************** End Rim Exceptions Namespace ******************************* RIM_EXCEPTIONS_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_IO_EXCEPTION_H <file_sep>/* * rimSoundIOConfig.h * Rim Sound * * Created by <NAME> on 7/31/12. * Copyright 2012 __MyCompanyName__. All rights reserved. * */ #ifndef INCLUDE_RIM_SOUND_IO_CONFIG_H #define INCLUDE_RIM_SOUND_IO_CONFIG_H #include "../rimSoundConfig.h" #include "../rimSoundUtilities.h" #include "../filters/rimSoundSampleRateConverter.h" //########################################################################################## //########################################################################################## //############ //############ Library Namespace Configuration //############ //########################################################################################## //########################################################################################## #ifndef RIM_SOUND_IO_NAMESPACE #define RIM_SOUND_IO_NAMESPACE io #endif #ifndef RIM_SOUND_IO_NAMESPACE_START #define RIM_SOUND_IO_NAMESPACE_START RIM_SOUND_NAMESPACE_START namespace RIM_SOUND_IO_NAMESPACE { #endif #ifndef RIM_SOUND_IO_NAMESPACE_END #define RIM_SOUND_IO_NAMESPACE_END }; RIM_SOUND_NAMESPACE_END #endif RIM_SOUND_NAMESPACE_START /// A namespace containing classes which encode and decode sound from various sound file types. namespace RIM_SOUND_IO_NAMESPACE { }; RIM_SOUND_NAMESPACE_END //########################################################################################## //*************************** Start Rim Sound IO Namespace ******************************* RIM_SOUND_IO_NAMESPACE_START //****************************************************************************************** //########################################################################################## using rim::sound::util::Sample8; using rim::sound::util::Sample16; using rim::sound::util::Sample24; using rim::sound::util::Sample32; using rim::sound::util::Sample64; using rim::sound::util::Sample32f; using rim::sound::util::Sample64f; using rim::sound::util::Gain; using rim::sound::util::SampleRate; using rim::sound::util::SampleType; using rim::sound::util::SoundBuffer; using rim::sound::util::SharedSoundBuffer; using rim::sound::util::SharedBufferPool; using rim::sound::util::SoundResource; using rim::sound::util::SoundInputStream; using rim::sound::util::SoundOutputStream; using rim::sound::util::MIDIMessage; using rim::sound::util::MIDIEvent; using rim::sound::util::MIDIBuffer; using rim::sound::util::MIDIInputStream; using rim::sound::util::MIDIOutputStream; using rim::sound::filters::SampleRateConverter; //########################################################################################## //*************************** End Rim Sound IO Namespace ********************************* RIM_SOUND_IO_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_SOUND_IO_CONFIG_H <file_sep>/* * rimGraphicsGUIButtonDelegate.h * Rim Graphics GUI * * Created by <NAME> on 2/5/13. * Copyright 2013 Headspace Systems. All rights reserved. * */ #ifndef INCLUDE_RIM_GRAPHICS_GUI_BUTTON_DELEGATE_H #define INCLUDE_RIM_GRAPHICS_GUI_BUTTON_DELEGATE_H #include "rimGraphicsGUIConfig.h" //########################################################################################## //************************ Start Rim Graphics GUI Namespace ****************************** RIM_GRAPHICS_GUI_NAMESPACE_START //****************************************************************************************** //########################################################################################## class Button; //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class which contains function objects that recieve button events. /** * Any button-related event that might be processed has an appropriate callback * function object. Each callback function is called by the button * whenever such an event is received. If a callback function in the delegate * is not initialized, a button simply ignores it. */ class ButtonDelegate { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Button Delegate Callback Functions /// A function object which is called whenever an attached button is selected by the user. /** * This means that the user has put the button into its 'on' state. */ Function<void ( Button& )> select; /// A function object which is called whenever an attached button is unselected by the user. /** * This means that the user has put the button into its 'off' state. */ Function<void ( Button& )> unselect; /// A function object which is called whenever an attached button is pressed by the user. Function<void ( Button& )> press; /// A function object which is called whenever an attached button is released by the user. Function<void ( Button& )> release; }; //########################################################################################## //************************ End Rim Graphics GUI Namespace ******************************** RIM_GRAPHICS_GUI_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_GRAPHICS_GUI_BUTTON_DELEGATE_H <file_sep>/* * rimAABBTree4.h * Rim BVH * * Created by <NAME> on 12/28/08. * Copyright 2008 Rim Software. All rights reserved. * */ #ifndef INCLUDE_RIM_BVH_AABB_TREE_4_H #define INCLUDE_RIM_BVH_AABB_TREE_4_H #include "rimBVHConfig.h" #include "./rimBVH.h" //########################################################################################## //***************************** Start Rim BVH Namespace ********************************** RIM_BVH_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class that implements a SIMD-accelerated 4-ary bounding volume hierarchy. class AABBTree4 : public BVH { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructors /// Create a new quad AABB tree with no primitives. AABBTree4(); /// Create a new quad AABB tree with the specified primitive set. AABBTree4( const Pointer<const PrimitiveInterface>& newPrimitives ); /// Create a copy of the specified quad AABB tree, using the same primitives. AABBTree4( const AABBTree4& other ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Destructor /// Destroy this quad AABB tree. virtual ~AABBTree4(); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Assignment Operator /// Assign a copy of another quad AABB tree to this one, using the same primitives. AABBTree4& operator = ( const AABBTree4& other ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** BVH Primitive Accessor Methods /// Set the primitive interface that this BVH should use. /** * Calling this method invalidates the current BVH, requiring it * to be rebuilt before it can be used. */ virtual void setPrimitives( const Pointer<const PrimitiveInterface>& newPrimitives ); /// Return a pointer to the primitive interface used by this BVH. virtual const Pointer<const PrimitiveInterface>& getPrimitives() const; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** BVH Attribute Accessor Methods /// Return the maximum depth of this BVH's hierarchy. /** * This value can be used to pre-allocate traversal stacks to prevent overflow. */ virtual Size getMaxDepth() const; /// Return whether or not this BVH is built, valid, and ready for use. virtual Bool isValid() const; /// Return the approximate total amount of memory in bytes allocated for this BVH. virtual Size getSizeInBytes() const; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** BVH Building Methods /// Rebuild the BVH using the current set of primitives. virtual void rebuild(); /// Do a quick update of the BVH by refitting the bounding volumes without changing the hierarchy. virtual void refit(); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Ray Tracing Methods /// Trace the specified ray through this BVH up to a maximum distance. /** * The method returns whether or not an intersection was found. If so, the distance * along the ray and the intersected primitive index are placed in the output parameters. */ virtual Bool traceRay( const Ray3f& ray, Float maxDistance, const void** stack, Float& closestIntersection, Index& closestPrimitiveID ) const; /// Trace the specified ray through this BVH up to a maximum distance. /** * The method returns whether or not an intersection was found. */ virtual Bool traceRay( const Ray3f& ray, Float maxDistance, const void** stack ) const; private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Class Declarations /// A class which represents a single node in the quad AABB tree. class Node; /// A class which stores the AABB of a single primitive used during tree construction. class PrimitiveAABB; /// A class used to keep track of surface-area-heuristic paritioning data. class SplitBin; /// A class which represents an internally cached triangle that has an efficient storage layout. class CachedTriangle; /// A SIMD ray class with extra data used to speed up intersection tests. class FatSIMDRay; /// Define the type to use for offsets in the BVH. typedef Index IndexType; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Ray Tracing Methods /// Trace a ray through the BVH for generic-typed primitives. RIM_FORCE_INLINE Bool traceRayVsGeneric( const Ray3f& ray, Float maxDistance, const void** stack, Float& closestIntersection, Index& closestPrimitiveID ) const; /// Trace a ray through the BVH for cached triangle primitives. RIM_FORCE_INLINE Bool traceRayVsTriangles( const Ray3f& ray, Float maxDistance, const void** stack, Float& closestIntersection, Index& closestPrimitiveID ) const; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Intersection Methods /// Trace a ray through the BVH for cached triangle primitives. RIM_FORCE_INLINE static SIMDInt4 rayIntersectsTriangles( const SIMDRay3f& ray, const CachedTriangle& triangle, SIMDFloat4& distance ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Tree Bulding Methods /// Build a tree starting at the specified node using the specified objects. /** * This method returns the number of nodes in the tree created. */ static Size buildTreeRecursive( Node* node, PrimitiveAABB* primitiveAABBs, Index start, Size numPrimitives, SplitBin* splitBins, Size numSplitCandidates, Size maxNumObjectsPerLeaf, Size depth, Size& maxDepth ); /// Partition the specified list of objects into two sets based on the given split plane. /** * The objects are sorted so that the first N objects in the list are deemed "less" than * the split plane along the split axis, and the next M objects are the remainder. * The number of "lesser" objects is placed in the output variable. */ static void partitionPrimitivesSAH( PrimitiveAABB* primitiveAABBs, Size numPrimitives, SplitBin* splitBins, Size numSplitCandidates, Index& axis, Size& numLesserObjects, AABB3f& lesserVolume, AABB3f& greaterVolume ); /// Partition the specified list of objects into two sets based on their median along the given axis. static void partitionPrimitivesMedian( PrimitiveAABB* objectAABBs, Size numObjects, Index splitAxis, Size& numLesserTriangles, AABB3f& lesserVolume, AABB3f& greaterVolume ); /// Compute the axis-aligned bounding box for the specified list of objects. static AABB3f computeAABBForPrimitives( const PrimitiveAABB* primitiveAABBs, Size numPrimitives ); /// Compute the axis-aligned bounding box for the specified list of objects' centroids. static AABB3f computeAABBForPrimitiveCentroids( const PrimitiveAABB* primitiveAABBs, Size numPrimitives ); /// Get the surface area of a 3D axis-aligned bounding box specified by 2 SIMD min-max vectors. RIM_FORCE_INLINE static float getAABBSurfaceArea( const math::SIMDFloat4& min, const math::SIMDFloat4& max ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Tree Refitting Methods /// Refit the bounding volume for the specified node and return the final bounding box. AABB3f refitTreeGeneric( Node* node ); /// Refit the bounding volume for the specified node and return the final bounding box. AABB3f refitTreeTriangles( Node* node ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Primitive List Building Methods /// Fill the list of objects indices with the final indices. static void fillPrimitiveIndices( Index* primitiveIndices, const PrimitiveAABB* primitiveAABBs, Size numPrimitives ); Size getTriangleArraySize( const Node* node ) const; Size fillTriangleArray( CachedTriangle* triangles, const PrimitiveInterface* primitiveInterface, const PrimitiveAABB* aabbs, Node* node, Size numFilled ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Other Helper Methods /// Return a deep copy of this tree's cached primitive data. UByte* copyPrimitiveData( Size& newCapacity ) const; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Static Data Members /// The default intial number of splitting plane candidates that are considered when building the tree. static const Size DEFAULT_NUM_SPLIT_CANDIDATES = 32; /// The default maximum number of primitives that can be in a leaf node. static const Size DEFAULT_MAX_PRIMITIVES_PER_LEAF = 4; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Members /// A pointer to a flat array of nodes that make up this tree. Node* nodes; /// A packed list of primitive data that are organized by node. UByte* primitiveData; /// The capacity in bytes of the primitive data allocation. Size primitiveDataCapacity; /// An opaque set of the primitives used by this tree. Pointer<const PrimitiveInterface> primitiveSet; /// An enum value which indicates the type of the cached primitives, or UNDEFINED if not cached. PrimitiveInterfaceType cachedPrimitiveType; /// The number of primitives that are part of this qaud AABB tree. Size numPrimitives; /// The number of nodes that are in this quad AABB tree. Size numNodes; /// The maximum depth of the hierarchy of this quad AABB tree. Size maxDepth; /// The maximum number of primitives that this quad AABB tree can have per leaf node. Size maxNumPrimitivesPerLeaf; /// The number of Surface Area Heuristic split plane candidates to consider when building the tree. Size numSplitCandidates; }; //########################################################################################## //***************************** End Rim BVH Namespace ************************************ RIM_BVH_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_BVH_AABB_TREE_4_H <file_sep>/* * rimGraphicsGUIFontManager.h * Rim Graphics GUI * * Created by <NAME> on 1/15/13. * Copyright 2013 Headspace Systems. All rights reserved. * */ #ifndef INCLUDE_RIM_GRAPHICS_GUI_FONT_MANAGER_H #define INCLUDE_RIM_GRAPHICS_GUI_FONT_MANAGER_H #include "rimGraphicsGUIFontsConfig.h" #include "rimGraphicsGUIFontInfo.h" //########################################################################################## //********************* Start Rim Graphics GUI Fonts Namespace *************************** RIM_GRAPHICS_GUI_FONTS_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class which allows the user to enumerate and search through the installed system fonts. /** * When the information is first needed, the font manager automatically caches * the system's available fonts by searching system directories for font files, * then saving each valid file's path and information so that it can be later used. * Keep in mind that this this caching can take a few seconds to occur. * * The font manager then allows the user to search for fonts with a certain font family * and style name within the cached fonts. */ class FontManager { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructor /// Create a default font manager which hasn't yet cached the system's available fonts. RIM_INLINE FontManager() : hasCachedFonts( false ) { } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Font Accessor Methods /// Return the total number of system fonts that are available for use. RIM_INLINE Size getFontCount() const { if ( !hasCachedFonts ) const_cast<FontManager*>(this)->cacheFonts(); return cachedFonts.getSize(); } /// Find a system font which has the specified font family name. /** * The method attempts to match the family name when determining the font to retrieve. * The font information is placed in the output font information object. * If the method finds a suitable font, TRUE is returned. * Otherwise, if the method fails, FALSE is returned indicating that no * font with those names was found. */ RIM_INLINE Bool findFont( const UTF8String& familyName, const FontInfo*& fontInfo ) const { return this->findFont( familyName, NULL, fontInfo ); } /// Find a system font which has the specified font family name and specified style name. /** * The method attempts to match both the family name * and style name when determining the font to retrieve. The font information is placed * in the output font information object. If the method finds a suitable font, TRUE * is returned. Otherwise, if the method fails, FALSE is returned indicating that no * font with those names was found. */ RIM_INLINE Bool findFont( const UTF8String& familyName, const UTF8String& styleName, const FontInfo*& fontInfo ) const { return this->findFont( familyName, &styleName, fontInfo ); } /// Find a system font which has the specified font family name and optionally specified style name. /** * If the style name pointer is not NULL, the method attempts to match both the family name * and style name when determining the font to retrieve. The font information is placed * in the output font information object. If the method finds a suitable font, TRUE * is returned. Otherwise, if the method fails, FALSE is returned indicating that no * font with those names was found. */ Bool findFont( const UTF8String& familyName, const UTF8String* styleName, const FontInfo*& fontInfo ) const; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Font Caching Method /// Search the system for valid font files and cache their locations and names. /** * Calling this method replaces all previously cached fonts with the current * set of available system fonts. Beware, calling this method may take a significant * time to execute (on the order of a few seconds) if there are a large number * of fonts installed because the font manager has to examine every font file * to determine the font's name and style name. */ void cacheFonts(); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Default Font Accessor Method /// Return a reference to information about the default font. /** * This font will be a valid font file, chosen to match the system's * default font. */ static const FontInfo* getDefaultFont(); private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Class Declaration /// A class which wraps a string so that it can be compare case-insensitively using operator ==. class CaselessString { public: /// Create a new caseless string which wraps the specified string. RIM_INLINE CaselessString( const UTF8String& newString ) : string( newString.toLowerCase() ) { } /// Return whether or not this caseless string equals another (case insensitively). RIM_INLINE Bool operator == ( const CaselessString& other ) const { return string.equalsIgnoreCase( other.string ); } /// Return a hash code for this caseless string. RIM_INLINE Hash getHashCode() const { return string.getHashCode(); } /// A pointer to a string which is being wrapped by this case-insensitive string. UTF8String string; }; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Helper Methods /// Cache any fonts contained in the specified directory. This may be called recursively. void cacheFontDirectory( const Directory& directory ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Static Data Members /// The total number of font search paths where the font manager looks for fonts. #if defined(RIM_PLATFORM_APPLE) static const Size NUM_SEARCH_PATHS = 2; #elif defined(RIM_PLATFORM_WINDOWS) static const Size NUM_SEARCH_PATHS = 1; #endif /// An array of the paths that the font manager is searching on this system static const UTF8String DEFAULT_SEARCH_PATHS[NUM_SEARCH_PATHS]; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Members /// A cached map from font family name to a list of font styles for that family. HashMap< CaselessString, ArrayList<FontInfo> > cachedFonts; /// A boolean value indicating whether or not this font manager has cached the available fonts. Bool hasCachedFonts; }; //########################################################################################## //********************* End Rim Graphics GUI Fonts Namespace ***************************** RIM_GRAPHICS_GUI_FONTS_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_GRAPHICS_GUI_FONT_MANAGER_H <file_sep>/* * rimGraphicsHardwareBufferIterator.h * Rim Graphics * * Created by <NAME> on 1/9/11. * Copyright 2011 Rim Software. All rights reserved. * */ #ifndef INCLUDE_RIM_GRAPHICS_HARDWARE_BUFFER_ITERATOR_H #define INCLUDE_RIM_GRAPHICS_HARDWARE_BUFFER_ITERATOR_H #include "rimGraphicsBuffersConfig.h" #include "rimGraphicsHardwareBuffer.h" #include "rimGraphicsHardwareBufferAccessType.h" //########################################################################################## //*********************** Start Rim Graphics Buffers Namespace *************************** RIM_GRAPHICS_BUFFERS_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class which allows the user to iterate over a hardware attribute buffer. /** * It does this by mapping the buffer's data to the main memory's address space * which allows the buffer's contents to be iterated over normally. Iterators * can be created to be either read-only, write-only, or read-write. * * Important: The iterated buffer object must not be destroyed until the * iterator is also destroyed or the behavior is undefined. In addition, * a buffer cannot be used again by the GPU until the iterator object is destroyed, * unmapping the buffer data. */ template < typename T > class HardwareBufferIterator { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructors /// Create a new buffer iterator which doesn't iterator over any buffer. RIM_INLINE HardwareBufferIterator() : buffer(), accessType( HardwareBufferAccessType::READ ), bufferStart( NULL ), bufferEnd( NULL ), bufferElement( NULL ) { // Statically check the attribute type of the template type. AttributeType::check<T>(); } /// Create a new buffer iterator for the specified buffer and access type. /** * The constructor maps the buffer's data store to main memory and allows the * iterator to iterate over the data using the specified access type. The * buffer object must not be destroyed until the iterator is also destroyed * or the behavior is undefined. In addition, the buffer cannot be used again * by the GPU until the iterator object is destroyed, unmapping the buffer data. */ HardwareBufferIterator( const Pointer<HardwareBuffer>& newBuffer, HardwareBufferAccessType newAccessType = HardwareBufferAccessType::READ ) : buffer( newBuffer ), accessType( newAccessType ) { // Statically check the attribute type of the template type. AttributeType::check<T>(); // Try mapping the buffer if ( newBuffer.isSet() && newBuffer->getAttributeType() == AttributeType::get<T>() && (bufferStart = (T*)newBuffer->mapBuffer( newAccessType )) != NULL ) { bufferElement = bufferStart; bufferEnd = bufferStart + buffer->getCapacityInBytes(); } else { buffer = Pointer<HardwareBuffer>(); bufferElement = NULL; bufferEnd = NULL; } } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Destructor /// Destroy a hardware attribute buffer iterator, releasing the buffer back to the GPU. /** * Once an iterator for an attribute buffer is created, the buffer is unable to be used * until the iterator is destroyed, unmapping the buffer's data. Therefore, it is * important to destroy an iterator when one is done with it. */ RIM_INLINE ~HardwareBufferIterator() { if ( buffer.isSet() ) buffer->unmapBuffer(); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Position Increment Methods /// Increment the buffer iterator by one element. RIM_INLINE void next() { RIM_DEBUG_ASSERT_MESSAGE( bufferElement != NULL, "Cannot iterate with invalid hardware attribute buffer iterator" ); RIM_DEBUG_ASSERT_MESSAGE( bufferElement < bufferEnd, "Cannot iterate past end of hardware attribute buffer" ); bufferElement++; } /// Increment the buffer iterator by one element. RIM_INLINE void operator ++ () { RIM_DEBUG_ASSERT_MESSAGE( bufferElement != NULL, "Cannot iterate with invalid hardware attribute buffer iterator" ); RIM_DEBUG_ASSERT_MESSAGE( bufferElement < bufferEnd, "Cannot iterate past end of hardware attribute buffer" ); bufferElement++; } /// Increment the buffer iterator by one element. RIM_INLINE void operator ++ ( int ) { RIM_DEBUG_ASSERT_MESSAGE( bufferElement != NULL, "Cannot iterate with invalid hardware attribute buffer iterator" ); RIM_DEBUG_ASSERT_MESSAGE( bufferElement < bufferEnd, "Cannot iterate past end of hardware attribute buffer" ); bufferElement++; } /// Increment the buffer iterator by the specified number of elements. RIM_INLINE void operator += ( Size numElements ) { RIM_DEBUG_ASSERT_MESSAGE( bufferElement != NULL, "Cannot iterate with invalid hardware attribute buffer iterator" ); RIM_DEBUG_ASSERT_MESSAGE( numElements < bufferEnd - bufferElement, "Cannot iterate past end of hardware attribute buffer" ); bufferElement += numElements; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Iteration Status Methods /// Return whether or not this iterator has any more elements to iterate over. RIM_INLINE operator Bool () const { return bufferElement != NULL && bufferElement < bufferEnd; } /// Return whether or not this iterator has any more elements to iterate over. RIM_INLINE Bool hasNext() const { return bufferElement != NULL && bufferElement < bufferEnd; } /// Return the current attribute index which is being iterated over. RIM_INLINE Index getIndex() const { RIM_DEBUG_ASSERT_MESSAGE( bufferElement != NULL, "Cannot get element index of invalid hardware attribute buffer iterator" ); return bufferElement - bufferStart; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Element Accessor Operators /// Return a reference to the value of the attribute at the current iterator position. /** * This method returns the attribute at the current iterator position in the * class's templated type. */ RIM_INLINE T& operator * () const { RIM_DEBUG_ASSERT_MESSAGE( bufferElement != NULL, "Cannot get element of invalid hardware attribute buffer iterator" ); return *bufferElement; } /// Return a reference to the value of the attribute at the current iterator position. /** * This method returns the attribute at the current iterator position in the * class's templated type. */ RIM_INLINE T& operator [] ( Index index ) const { RIM_DEBUG_ASSERT_MESSAGE( bufferElement != NULL, "Cannot get element of invalid hardware attribute buffer iterator" ); RIM_DEBUG_ASSERT_MESSAGE( index < bufferEnd - bufferElement, "Cannot get out-of-bounds element of hardware attribute buffer iterator" ); return bufferElement[index]; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Element Accessor Methods /// Return a reference to the value of the attribute at the current iterator position. /** * This method returns the attribute at the current iterator position in the * class's templated type. */ RIM_FORCE_INLINE const T& get() const { RIM_DEBUG_ASSERT_MESSAGE( bufferElement != NULL, "Cannot get element of invalid hardware attribute buffer iterator" ); return *bufferElement; } /// Set the value of the attribute at the current iterator position. /** * This method set the attribute at the current iterator position in the * specified templated type. If the templated attribute type is not a valid * attribute type, a compile-time error is generated. A debug assertion is * raised if the attribute type doesn't match the underlying buffer's attribute type * or if writing to the buffer is not supported. */ RIM_FORCE_INLINE void set( const T& newAttribute ) { RIM_DEBUG_ASSERT_MESSAGE( bufferElement != NULL, "Cannot set element of invalid hardware attribute buffer iterator" ); *bufferElement = newAttribute; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Buffer Release Method /// Unmap the buffer's memory and invalidate the iterator. RIM_INLINE void releaseBuffer() { if ( buffer.isSet() ) buffer->unmapBuffer(); buffer = Pointer<HardwareBuffer>(); bufferEnd = bufferElement = bufferStart = NULL; } /// Reset the iterator and map the specified buffer's contents using the given access type. /** * If the method succeeds, the iterator can iterate over the buffer's contents and * TRUE is returned. Otherwise, the method fails and FALSE is returned. */ Bool setBuffer( const Pointer<HardwareBuffer>& newBuffer, HardwareBufferAccessType newAccessType ) { // Release the previous buffer. if ( buffer.isSet() ) buffer->unmapBuffer(); // Try mapping the buffer if ( newBuffer.isSet() && newBuffer->getAttributeType() == AttributeType::get<T>() && (bufferStart = (T*)newBuffer->mapBuffer( newAccessType )) != NULL ) { buffer = newBuffer; accessType = newAccessType; bufferElement = bufferStart; bufferEnd = bufferStart + buffer->getCapacityInBytes(); return true; } else { buffer = Pointer<HardwareBuffer>(); bufferElement = NULL; bufferEnd = NULL; return false; } } private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Friend Class Declaration /// Declare the hardware attribute class a friend so that it can create instance of this class. friend class HardwareBuffer; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Copy Operations /// Create a copy of the specified iterator's state. /** * This copy constructor is declared private so that copies of this object * cannot be made (only created and destroyed). */ HardwareBufferIterator( const HardwareBufferIterator& other ); /// Assign the state of the specified iterator to this one. /** * This operator is declared private so that copies of this object * cannot be made (only created and destroyed). */ HardwareBufferIterator& operator = ( const HardwareBufferIterator& other ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Members /// A pointer to the current iterated element of the memory-mapped data store for the buffer. T* bufferElement; /// A pointer to the memory-mapped data store for the buffer. T* bufferStart; /// A pointer to just past the last byte of the buffer's mapped data store. const T* bufferEnd; /// A pointer to the hardware attribute buffer object which is being iterated over. Pointer<HardwareBuffer> buffer; /// An object which describes the allowed access type for the buffer iterator. HardwareBufferAccessType accessType; }; //########################################################################################## //*********************** End Rim Graphics Buffers Namespace ***************************** RIM_GRAPHICS_BUFFERS_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_GRAPHICS_HARDWARE_BUFFER_ITERATOR_H <file_sep>/* * rimSoundMIDIDeviceDelegate.h * Rim Sound * * Created by <NAME> on 4/2/13. * Copyright 2013 __MyCompanyName__. All rights reserved. * */ #ifndef INCLUDE_RIM_SOUND_MIDI_DEVICE_DELEGATE_H #define INCLUDE_RIM_SOUND_MIDI_DEVICE_DELEGATE_H #include "rimSoundDevicesConfig.h" //########################################################################################## //************************ Start Rim Sound Devices Namespace ***************************** RIM_SOUND_DEVICES_NAMESPACE_START //****************************************************************************************** //########################################################################################## class MIDIDevice; /// Define a short name for the type of the function object that is used to recieve MIDI from MIDIDevice objects. /** * The implementor of the function can then use the given MIDI messages to perform some action. */ typedef Function<void ( MIDIDevice& device, const MIDIBuffer& messages )> MIDIInputCallback; //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class which contains function objects that recieve MIDIDevice events. /** * Any device-related event that might be processed has an appropriate callback * function object. Each callback function is called by the device * whenever such an event is received. If a callback function in the delegate * is not initialized, the device simply ignores it. */ class MIDIDeviceDelegate { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** MIDI Device Delegate Callback Functions /// A function object which is called whenever the device provides input MIDI messages. MIDIInputCallback inputCallback; /// A function object which is called whenever the MIDI device is added to the system. Function<void ( MIDIDevice& device )> added; /// A function object which is called whenever the MIDI device is removed from the system. Function<void ( MIDIDevice& device )> removed; }; //########################################################################################## //************************ End Rim Sound Devices Namespace ******************************* RIM_SOUND_DEVICES_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_SOUND_MIDI_DEVICE_DELEGATE_H <file_sep>/* * rimGraphicsBoxShape.h * Rim Graphics * * Created by <NAME> on 6/8/12. * Copyright 2012 __MyCompanyName__. All rights reserved. * */ #ifndef INCLUDE_RIM_GRAPHICS_BOX_SHAPE_H #define INCLUDE_RIM_GRAPHICS_BOX_SHAPE_H #include "rimGraphicsShapesConfig.h" #include "rimGraphicsShapeBase.h" #include "rimGraphicsMeshShape.h" //########################################################################################## //*********************** Start Rim Graphics Shapes Namespace **************************** RIM_GRAPHICS_SHAPES_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class which provides a simple means to draw a 3D oriented rectangular box. /** * A box is specified by its width, height, and depth, as well as the position * of its center and the 3 orthonormal axis that define its orientation. * * This class handles all vertex and index buffer generation automatically, * simplifying the visualization of boxes, such as for collision geometry. */ class BoxShape : public GraphicsShapeBase<BoxShape> { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructors /// Create a box shape for the given graphics context centered at the origin with width, height and depth = 1. BoxShape( const Pointer<GraphicsContext>& context ); /// Create a box shape for the given graphics context with the specified local width, height, and depth. BoxShape( const Pointer<GraphicsContext>& context, Real width, Real height, Real depth ); /// Create a box shape for the given graphics context with the specified position, width, height, and depth. BoxShape( const Pointer<GraphicsContext>& context, Real width, Real height, Real depth, const Vector3& newPosition ); /// Create a box shape for the given graphics context with the specified position, orientation, width, height, and depth. BoxShape( const Pointer<GraphicsContext>& context, Real width, Real height, Real depth, const Vector3& newPosition, const Matrix3& newOrientation ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Size Accessor Methods /// Set the 3D dimensions of this box in its local coordinate frame. RIM_FORCE_INLINE const Vector3& getSize() const { return size; } /// Set the 3D dimensions of this box in its local coordinate frame. RIM_INLINE void setSize( const Vector3& newSize ) { size.x = math::max( newSize.x, Real(0) ); size.y = math::max( newSize.y, Real(0) ); size.z = math::max( newSize.z, Real(0) ); updateMesh(); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Width Accessor Methods /// Return the width (X size) of this box in its local coordinate frame. RIM_FORCE_INLINE Real getWidth() const { return size.x; } /// Set the width (X size) of this box in its local coordinate frame. /** * This width value is clamped to the range of [0,+infinity]. */ RIM_INLINE void setWidth( Real newWidth ) { size.x = math::max( newWidth, Real(0) ); updateMesh(); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Height Accessor Methods /// Return the height (Y size) of this box in its local coordinate frame. RIM_FORCE_INLINE Real getHeight() const { return size.y; } /// Set the height (Y size) of this box in its local coordinate frame. /** * This height value is clamped to the range of [0,+infinity]. */ RIM_INLINE void setHeight( Real newHeight ) { size.y = math::max( newHeight, Real(0) ); updateMesh(); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Depth Accessor Methods /// Return the depth (Z size) of this box in its local coordinate frame. RIM_FORCE_INLINE Real getDepth() const { return size.z; } /// Set the depth (Z size) of this box in its local coordinate frame. /** * This depth value is clamped to the range of [0,+infinity]. */ RIM_INLINE void setDepth( Real newDepth ) { size.z = math::max( newDepth, Real(0) ); updateMesh(); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Material Accessor Methods /// Get the material of this cylinder shape. RIM_INLINE Pointer<Material>& getMaterial() { return material; } /// Get the material of this cylinder shape. RIM_INLINE const Pointer<Material>& getMaterial() const { return material; } /// Set the material of this cylinder shape. RIM_INLINE void setMaterial( const Pointer<Material>& newMaterial ) { material = newMaterial; updateMesh(); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Context Accessor Methods /// Return a pointer to the graphics contet which is being used to create this box shape. RIM_INLINE const Pointer<GraphicsContext>& getContext() const { return context; } /// Change the graphics context which is used to create this box shape. /** * Calling this method causes the previously generated box geometry to * be discarded and regenerated using the new context. */ void setContext( const Pointer<GraphicsContext>& newContext ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Mesh Accessor Methods /// Return a pointer to the mesh representation of this box. RIM_FORCE_INLINE const Pointer<MeshShape>& getMesh() const { return mesh; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Bounding Volume Accessor Methods /// Update the box's axis-aligned bounding box. virtual void updateBoundingBox(); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Shape Chunk Accessor Method /// Process the shape into a flat list of mesh chunk objects. /** * This method flattens the shape hierarchy and produces mesh chunks * for rendering from the specified camera's perspective. The method * converts its internal representation into one or more MeshChunk * objects which it appends to the specified output list of mesh chunks. * * The method returns whether or not the shape was successfully flattened * into chunks. */ virtual Bool getChunks( const Transform3& worldTransform, const Camera& camera, const ViewVolume* viewVolume, const Vector2D<Size>& viewportSize, ArrayList<MeshChunk>& chunks ) const; private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Helper Methods /// Update the triangle mesh currently used for this box shape from its current state. void updateMesh(); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Members /// The size of this box along each local coordinate axis. Vector3 size; /// The graphics context which is used to create this box shape. Pointer<GraphicsContext> context; /// A pointer to the material to use when rendering this box shape. Pointer<Material> material; /// A pointer to a mesh shape which contains the visual representation for this box. Pointer<MeshShape> mesh; }; //########################################################################################## //*********************** End Rim Graphics Shapes Namespace ****************************** RIM_GRAPHICS_SHAPES_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_GRAPHICS_BOX_SHAPE_H <file_sep>/* * rimSoundThreadedStreamPlayer.h * Rim Sound * * Created by <NAME> on 8/16/12. * Copyright 2012 __MyCompanyName__. All rights reserved. * */ <file_sep>/* * rimGraphicsShaderBindingData.h * Rim Software * * Created by <NAME> on 2/7/14. * Copyright 2014 __MyCompanyName__. All rights reserved. * */ #ifndef INCLUDE_RIM_GRAPHICS_SHADER_BINDING_DATA_H #define INCLUDE_RIM_GRAPHICS_SHADER_BINDING_DATA_H #include "rimGraphicsShadersConfig.h" //########################################################################################## //*********************** Start Rim Graphics Shaders Namespace *************************** RIM_GRAPHICS_SHADERS_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class that stores the input data for a shader pass. class ShaderBindingData { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructors /// Create a new shader binding data object with no allocated data. ShaderBindingData(); /// Create a new shader binding data object with the specified initial capacity for each data type. ShaderBindingData( Size constantDataCapacity, Size textureCapacity, Size vertexBufferCapacity ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constant Accessor Methods /// Return an pointer to the internal array of shader constant data. RIM_FORCE_INLINE Size getConstantDataSize() const { return numConstantBytes; } /// Return a pointer to the internal array of shader constant data. RIM_FORCE_INLINE UByte* getConstantData() { return constants.getPointer(); } /// Return a const pointer to the internal array of shader constant data. RIM_FORCE_INLINE const UByte* getConstantData() const { return constants.getPointer(); } /// Allocate a new constant for this shader binding data and return a pointer to the constant storage. RIM_INLINE UByte* allocateConstant( Size sizeInBytes ) { // Compute the new size of the constant buffer. Index byteOffset = alignConstantAddress( numConstantBytes ); Size newNumConstantBytes = byteOffset + sizeInBytes; // Reallocate the constant buffer if necessary. if ( newNumConstantBytes > constants.getSize() ) constants.setSize( newNumConstantBytes*2 ); // Compute the pointer to the constant's storage buffer. UByte* storage = constants.getPointer() + byteOffset; numConstantBytes = newNumConstantBytes; return storage; } /// Remove all stored constants from this shader binding data object. RIM_INLINE void clearConstants() { numConstantBytes = 0; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Texture Accessor Methods /// Return an pointer to the internal array of shader textures. RIM_FORCE_INLINE Size getTextureCount() const { return numTextures; } /// Return a pointer to the internal array of shader textures. RIM_FORCE_INLINE Resource<Texture>* getTextures() { return textures.getPointer(); } /// Return a const pointer to the internal array of shader textures. RIM_FORCE_INLINE const Resource<Texture>* getTextures() const { return textures.getPointer(); } /// Allocate the specified number of textures for this shader binding data and return a pointer to the texture storage. RIM_INLINE Resource<Texture>* allocateTextures( Size texturesToAdd ) { // Compute the new size of the texture buffer. Size newNumTextures = numTextures + texturesToAdd; // Reallocate the constant buffer if necessary. if ( newNumTextures > textures.getSize() ) textures.setSize( newNumTextures*2 ); // Compute the pointer to the constant's storage buffer. Resource<Texture>* storage = textures.getPointer() + numTextures; numTextures = newNumTextures; return storage; } /// Remove all stored textures from this shader binding data object. RIM_INLINE void clearTextures() { numTextures = 0; textures.setAll( Resource<Texture>() ); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Vertex Buffer Accessor Methods /// Return an pointer to the internal array of shader vertex buffers. RIM_FORCE_INLINE Size getVertexBufferCount() const { return numBuffers; } /// Return a pointer to the internal array of shader vertex buffers. RIM_FORCE_INLINE Pointer<VertexBuffer>* getVertexBuffers() { return buffers.getPointer(); } /// Return a const pointer to the internal array of shader vertex buffers. RIM_FORCE_INLINE const Pointer<VertexBuffer>* getVertexBuffers() const { return buffers.getPointer(); } /// Allocate the specified number of vertex buffers for this shader binding data and return a pointer to the buffer storage. RIM_INLINE Pointer<VertexBuffer>* allocateVertexBuffers( Size buffersToAdd ) { // Compute the new size of the texture buffer. Size newNumBuffers = numBuffers + buffersToAdd; // Reallocate the constant buffer if necessary. if ( newNumBuffers > buffers.getSize() ) buffers.setSize( newNumBuffers*2 ); // Compute the pointer to the constant's storage buffer. Pointer<VertexBuffer>* storage = buffers.getPointer() + numBuffers; numBuffers = newNumBuffers; return storage; } /// Remove all stored vertex buffers from this shader binding data object. RIM_INLINE void clearVertexBuffers() { numBuffers = 0; buffers.setAll( Pointer<VertexBuffer>() ); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Minimum Vertex Buffer Size Accessor Method /// Return the smallest number of elements that are in any vertex buffer that is part of this shader pass. /** * If there are no vertex buffers attached, 0 is returned. This method * can be used to make sure that a shader pass has enough vertex data * for a particular draw call or index buffer. */ RIM_INLINE Size getMinimumVertexBufferCapacity() const { Size result = math::max<Size>(); for ( Index i = 0; i < numBuffers; i++ ) { const Pointer<VertexBuffer>& buffer = buffers[i]; if ( buffer.isSet() ) result = math::min( result, buffer->getCapacity() ); } if ( result == math::max<Size>() ) return 0; else return result; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Data Set Method /// Copy all data from the other shader binding data object into this one. void setData( const ShaderBindingData& other ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Static Constant Data Members /// The default size of a shader pass's constant buffer in bytes. static const Size DEFAULT_CONSTANT_BUFFER_SIZE = 64; /// The default size of a shader pass's texture array. static const Size DEFAULT_TEXTURE_ARRAY_SIZE = 4; /// The default size of a shader pass's buffer array. static const Size DEFAULT_BUFFER_ARRAY_SIZE = 2; private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Helper Methods /// Align the specified address to a 4-byte boundary. RIM_FORCE_INLINE static Index alignConstantAddress( Index address ) { return (address + (DEFAULT_CONSTANT_ALIGNMENT - 1)) & -(SignedIndex)DEFAULT_CONSTANT_ALIGNMENT; } /// The default alignment requirement in bytes for allocated constants. static const Index DEFAULT_CONSTANT_ALIGNMENT = 4; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Members /// An array of bytes that stores the values for all constants that are part of this shader pass. Array<UByte> constants; /// A list of the textures that are bound as part of this shader pass. Array< Resource<Texture> > textures; /// A list of the vertex buffers that are bound as part of this shader pass. Array< Pointer<VertexBuffer> > buffers; /// The total number of bytes used for current bindings in the constant data buffer. Size numConstantBytes; /// The number of valid textures allcated in the texture array. Size numTextures; /// The number of valid textures allcated in the texture array. Size numBuffers; }; //########################################################################################## //*********************** End Rim Graphics Shaders Namespace ***************************** RIM_GRAPHICS_SHADERS_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_GRAPHICS_SHADER_BINDING_DATA_H <file_sep>/* * rimGraphicsInterpolationType.h * Rim Software * * Created by <NAME> on 4/20/14. * Copyright 2014 __MyCompanyName__. All rights reserved. * */ #ifndef INCLUDE_RIM_GRAPHICS_INTERPOLATION_TYPE_H #define INCLUDE_RIM_GRAPHICS_INTERPOLATION_TYPE_H #include "rimGraphicsAnimationConfig.h" //########################################################################################## //********************** Start Rim Graphics Animation Namespace ************************** RIM_GRAPHICS_ANIMATION_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class that enumerates the different types of sampling interpolation. class InterpolationType { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Public Enum Declaration /// An enum type which represents the different interpolation types. typedef enum Enum { /// An undefined or unknown interpolation type. UNDEFINED = 0, /// An interpolation type where no interpolation is performed. /** * The nearest sample value is used to determine the final interpolated value. */ NONE = 1, /// An interpolation type where basic linear interpolation is used between end points. LINEAR = 2, /// An interpolation type where cubic interpolation is used to interpolate between end points + control points. /** * This type of interpolation requires an additional control point for each end point * that determines the shape of the curve. */ BEZIER = 3, /// An interpolation type where cubic interpolation is used to interpolate between end points + tangents. /** * This type of interpolation requires an additional tangent values for each end point * that determines the shape of the curve. */ HERMITE = 4, /// An interpolation type which only guarantees to go through the start and end points, but not necessarily the middle ones. B_SPLINE = 5, /// An interpolation type which uses a sinc low-pass filter to interpolate control points. SINC = 6, /// An interpolation type which uses spherical linear interpolation for correct rotation interpolation. /** * This animation type is only valid for quaternion attribute types (4-component vectors). */ SLERP = 7 }; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructors /// Create a new interpolation type with the UNDEFINED enum value. RIM_INLINE InterpolationType() : type( UNDEFINED ) { } /// Create a new interpolation type with the specified interpolation type enum value. RIM_INLINE InterpolationType( Enum newType ) : type( newType ) { } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Enum Cast Operator /// Convert this interpolation type to an enum value. RIM_INLINE operator Enum () const { return type; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** String Representation Accessor Methods /// Return a unique string for this interpolation type that matches its enum value name. String toEnumString() const; /// Return an interpolation type which corresponds to the given enum string. static InterpolationType fromEnumString( const String& enumString ); /// Return a string representation of the interpolation type. String toString() const; /// Convert this interpolation type into a string representation. RIM_INLINE operator String () const { return this->toString(); } private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Members /// An enum representing the interpolation type. Enum type; }; //########################################################################################## //********************** End Rim Graphics Animation Namespace **************************** RIM_GRAPHICS_ANIMATION_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_GRAPHICS_INTERPOLATION_TYPE_H <file_sep>/* * rimStringInputStream.h * Rim IO * * Created by <NAME> on 10/29/08. * Copyright 2008 __MyCompanyName__. All rights reserved. * */ #ifndef INCLUDE_RIM_STRING_INPUT_STREAM_H #define INCLUDE_RIM_STRING_INPUT_STREAM_H #include "rimIOConfig.h" //########################################################################################## //****************************** Start Rim IO Namespace ********************************** RIM_IO_NAMESPACE_START //****************************************************************************************** //########################################################################################## class StringInputStream { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructors /// Create a StringInputStream with the native endianness. RIM_INLINE StringInputStream() { } /// Create a StringInputStream with the specified input endianness. RIM_INLINE StringInputStream( data::Endianness newEndianness ) : endianness( newEndianness ) { } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Destructor /// Destroy an input stream and free all of it's resources (close it). virtual ~StringInputStream() { } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Remaining Characters Size Accessor Methods /// Return the number of ASCII characters remaining in the stream. /** * The value returned must only be a lower bound on the number of characters * remaining in the stream. If there are characters remaining, it must return * at least 1. */ virtual LargeSize getCharactersRemaining() const = 0; /// Return whether or not there are bytes remaining in the stream. RIM_INLINE Bool hasCharactersRemaining() const { return this->getCharactersRemaining() > LargeSize(0); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Character/String Read Methods /// Read a single ASCII character and place it in the input parameter. /** * If the read operation was successful, return TRUE, otherwise return * FALSE. */ RIM_INLINE Bool readASCII( Char& value ) { return this->readChars( &value, 1 ) == 1; } /// Read a single UTF32 character and place it in the input parameter. /** * If the read operation was successful, return TRUE, otherwise return * FALSE. */ RIM_INLINE Bool readUTF32( UTF32Char& value ) { return this->readUTF32Chars( &value, 1 ) == 1; } /// Read the specified number of ASCII characters and place them in the output buffer. /** * The number of characters successfully read is returned. */ RIM_INLINE Size readASCII( Char* buffer, Size numBytes ) { if ( buffer == NULL ) return 0; return readChars( buffer, numBytes ); } /// Read the specified number of UTF-8 characters and place them in the output buffer. /** * The number of unicode code points successfully read is returned. The number of * code points read is limited to the specified buffer capacity. The number of * full unicode characters actually read is placed in the input/output paramter * numChars. */ RIM_INLINE Size readUTF8( UTF8Char* buffer, Size numChars, Size capacity ) { if ( buffer == NULL ) return 0; return readUTF8Chars( buffer, numChars, capacity ); } /// Read the specified number of UTF-16 characters and place them in the output buffer. /** * The number of unicode code points successfully read is returned. The number of * code points read is limited to the specified buffer capacity. The number of * full unicode characters actually read is placed in the input/output paramter * numChars. */ RIM_INLINE Size readUTF16( UTF16Char* buffer, Size numChars, Size capacity ) { if ( buffer == NULL ) return 0; return readUTF16Chars( buffer, numChars, capacity ); } /// Read the specified number of UTF-16 characters and place them in the output buffer. /** * The number of characters successfully read is returned. */ RIM_INLINE Size readUTF32( UTF32Char* buffer, Size numChars ) { if ( buffer == NULL ) return 0; return readUTF32Chars( buffer, numChars ); } /// Read the specified number of characters from the stream and place them in the specified string buffer. Size readASCII( data::StringBuffer& buffer, Size numChars ); /// Read the specified number of characters from the stream and place them in the specified UTF-8 string buffer. /** * The number of unicode code points read is returned and the number of characters actually * read is placed in the input/output paramter numChars. */ Size readUTF8( data::UTF8StringBuffer& buffer, Size numChars ); /// Read the specified number of characters from the stream and place them in the specified UTF-16 string buffer. /** * The number of unicode code points read is returned and the number of characters actually * read is placed in the input/output paramter numChars. */ Size readUTF16( data::UTF16StringBuffer& buffer, Size numChars ); /// Read the specified number of characters from the stream and place them in the specified UTF-32 string buffer. /** * The number of characters read is returned. */ Size readUTF32( data::UTF32StringBuffer& buffer, Size numChars ); data::String readAllASCII(); data::UTF8String readAllUTF8(); RIM_INLINE data::UTF16String readAllUTF16(); RIM_INLINE data::UTF32String readAllUTF32(); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Endian-ness Accessor Methods /// Get the endianness to assume when reading from the stream. RIM_INLINE data::Endianness getEndianness() const { return endianness; } /// Set the endianness to assume when reading from the stream. RIM_INLINE void setEndianness( data::Endianness newEndianness ) { endianness = newEndianness; } protected: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Protected String Read Method /// Read the specified number of characters from the stream and place them in the specified output buffer. virtual Size readChars( Char* buffer, Size number ) = 0; /// Read the specified number of UTF-8 characters from the stream and place them in the specified output buffer. /** * If the number of unicode code points exceeds the capacity of the buffer, as many characters * are read as possible. The number of code points read is returned. */ virtual Size readUTF8Chars( UTF8Char* buffer, Size numChars, Size capacity ) = 0; /// Read the specified number of UTF-16 characters from the stream and place them in the specified output buffer. /** * If the number of unicode code points exceeds the capacity of the buffer, as many characters * are read as possible. The number of code points read is returned. */ virtual Size readUTF16Chars( UTF16Char* buffer, Size numChars, Size capacity ) = 0; /// Read the specified number of UTF-32 characters from the stream and place them in the specified output buffer. /** * If the number of unicode code points exceeds the capacity of the buffer, as many characters * are read as possible. The number of code points read is returned. */ virtual Size readUTF32Chars( UTF32Char* buffer, Size numChars ) = 0; private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Helper Methods /// Convert the specified number of characters in a buffer to native endiannness. template < typename CharType > RIM_INLINE void convertEndianness( CharType* buffer, Size number ) { const CharType* const bufferEnd = buffer + number; while ( buffer != bufferEnd ) { *buffer = endianness.convertToNative( *buffer ); buffer++; } } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Members /// The endianness in which the data being read from the stream is assumed to be in. /** * Upon reading primitive types from the stream, they are converted to the platform's * native endianness before being returned to the user. */ data::Endianness endianness; }; //########################################################################################## //****************************** End Rim IO Namespace ************************************ RIM_IO_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_STRING_INPUT_STREAM_H <file_sep>/* * rimSoundUtilities.h * Rim Graphics * * Created by <NAME> on 5/8/08. * Copyright 2008 Rim Software. All rights reserved. * */ #ifndef INCLUDE_RIM_SOUND_UTILITIES_H #define INCLUDE_RIM_SOUND_UTILITIES_H #include "util/rimSoundUtilitiesConfig.h" // Sample Information #include "util/rimSoundInt24.h" #include "util/rimSoundSample.h" #include "util/rimSoundSIMDSample.h" #include "util/rimSoundSampleType.h" #include "util/rimSoundSampleRate.h" // Gain Utilities #include "util/rimSoundGain.h" // Speaker/Channel Configuration Management #include "util/rimSoundChannelType.h" #include "util/rimSoundChannelLayout.h" #include "util/rimSoundChannelLayoutType.h" #include "util/rimSoundPanDirection.h" // Sound Buffer Management Classes #include "util/rimSoundBuffer.h" #include "util/rimSoundBufferQueue.h" #include "util/rimSoundSharedBufferPool.h" #include "util/rimSoundSharedSoundBuffer.h" // Streaming Sound I/O Classes #include "util/rimSoundInputStream.h" #include "util/rimSoundOutputStream.h" // Sound Resource Management #include "util/rimSoundResource.h" // MIDI Classes #include "util/rimSoundMIDIMessage.h" #include "util/rimSoundMIDIEvent.h" #include "util/rimSoundMIDIBuffer.h" #include "util/rimSoundMIDIInputStream.h" #include "util/rimSoundMIDIOutputStream.h" #include "util/rimSoundTimeSignature.h" #include "util/rimSoundMIDITime.h" #endif // INCLUDE_RIM_SOUND_UTILITIES_H <file_sep>/* * rimGraphicsOpenGLShaderPassLibrary.h * Rim Software * * Created by <NAME> on 2/1/14. * Copyright 2014 __MyCompanyName__. All rights reserved. * */ #ifndef INCLUDE_RIM_GRAPHICS_OPENGL_SHADER_PASS_LIBRARY_H #define INCLUDE_RIM_GRAPHICS_OPENGL_SHADER_PASS_LIBRARY_H #include "rimGraphicsOpenGLConfig.h" //########################################################################################## //******************** Start Rim Graphics Devices OpenGL Namespace *********************** RIM_GRAPHICS_DEVICES_OPENGL_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class which contains a set of default shader passes for OpenGL. class OpenGLShaderPassLibrary : public ShaderPassLibrary { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructors /// Create a new OpenGL shader pass library with the default set of shader passes. OpenGLShaderPassLibrary(); private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Helper Methods /// Initialize this shader pass library with the default set of OpenGL shader passes. void initializeLibrary(); /// Create an initialize a new generic shader pass with the ShaderPassUsage::FLAT usage type. static Pointer<GenericShaderPass> newFlatPass(); /// Create an initialize a new generic shader pass with the ShaderPassUsage::FLAT_VERTEX_COLOR usage type. static Pointer<GenericShaderPass> newFlatVertexColorPass(); /// Create an initialize a new generic shader pass with the ShaderPassUsage::LAMBERTIAN usage type. static Pointer<GenericShaderPass> newLambertianPass(); /// Create an initialize a new generic shader pass with the ShaderPassUsage::LAMBERTIAN_VERTEX_COLOR usage type. static Pointer<GenericShaderPass> newLambertianVertexColorPass(); /// Create an initialize a new generic shader pass with the ShaderPassUsage::PHONG usage type. static Pointer<GenericShaderPass> newPhongPass(); /// Create an initialize a new generic shader pass with the ShaderPassUsage::PHONG_VERTEX_COLOR usage type. static Pointer<GenericShaderPass> newPhongVertexColorPass(); /// Create an initialize a new generic shader pass with the ShaderPassUsage::DEPTH usage type. static Pointer<GenericShaderPass> newDepthPass(); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Static Data Members static String phongVertexSource; static String phongFragmentSource; static String depthVertexSource; static String depthFragmentSource; }; //########################################################################################## //******************** End Rim Graphics Devices OpenGL Namespace ************************* RIM_GRAPHICS_DEVICES_OPENGL_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_GRAPHICS_OPENGL_SHADER_PASS_LIBRARY_H <file_sep>/* * rimExceptionsConfig.h * Rim Framework * * Created by <NAME> on 12/28/08. * Copyright 2008 Rim Software. All rights reserved. * */ #ifndef INCLUDE_RIM_EXCEPTIONS_CONFIG_H #define INCLUDE_RIM_EXCEPTIONS_CONFIG_H #include "../rimConfig.h" //########################################################################################## //########################################################################################## //############ //############ Library Namespace Configuration //############ //########################################################################################## //########################################################################################## /// Define the name of the exception library namespace. #ifndef RIM_EXCEPTIONS_NAMESPACE #define RIM_EXCEPTIONS_NAMESPACE exceptions #endif #ifndef RIM_EXCEPTIONS_NAMESPACE_START #define RIM_EXCEPTIONS_NAMESPACE_START RIM_NAMESPACE_START namespace RIM_EXCEPTIONS_NAMESPACE { #endif #ifndef RIM_EXCEPTIONS_NAMESPACE_END #define RIM_EXCEPTIONS_NAMESPACE_END }; RIM_NAMESPACE_END #endif RIM_NAMESPACE_START /// A namespace containing various types of commonly used exception classes. namespace RIM_EXCEPTIONS_NAMESPACE { }; RIM_NAMESPACE_END namespace rim { namespace data { template <typename CharType> class BasicString; typedef BasicString<Char> String; typedef BasicString<UTF8Char> UTF8String; typedef BasicString<UTF16Char> UTF16String; typedef BasicString<UTF32Char> UTF32String; }; }; //########################################################################################## //*************************** Start Rim Exceptions Namespace ***************************** RIM_EXCEPTIONS_NAMESPACE_START //****************************************************************************************** //########################################################################################## using rim::data::String; //########################################################################################## //*************************** End Rim Exceptions Namespace ******************************* RIM_EXCEPTIONS_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_EXCEPTIONS_CONFIG_H <file_sep>/* * rimGraphicsOpenGLConfig.h * Rim Graphics * * Created by <NAME> on 3/1/13. * Copyright 2013 __MyCompanyName__. All rights reserved. * */ #ifndef INCLUDE_RIM_GRAPHICS_OPENGL_CONFIG_H #define INCLUDE_RIM_GRAPHICS_OPENGL_CONFIG_H #include "../rimGraphicsDevicesConfig.h" #include "../rimGraphicsDevice.h" #include "../rimGraphicsContext.h" #include "../rimGraphicsContextFlags.h" #include "../rimGraphicsPixelFormat.h" #ifdef RIM_PLATFORM_APPLE #include <OpenGL/gl.h> #include <OpenGL/glu.h> #include <OpenGL/glext.h> #else #ifdef RIM_PLATFORM_WINDOWS #ifndef UNICODE #define UNICODE #endif #ifndef NOMINMAX #define NOMINMAX #endif #include <Windows.h> #define GLEW_STATIC #include <GL/glew.h> #include <GL/wglew.h> #include <GL/gl.h> #include <GL/glu.h> #define glXGetProcAddress(x) (*glXGetProcAddressARB)((const GLubyte*)x) #endif #endif //########################################################################################## //########################################################################################## //############ //############ Extension Handling //############ //########################################################################################## //########################################################################################## #if GL_VERSION_3_0 | GL_VERSION_2_0 //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Framebuffer Object Preprocessor Redefinitions // Map EXT FBO function names to version 3.0 names if necessary #ifndef glGenFramebuffers #define glGenFramebuffers glGenFramebuffersEXT #endif #ifndef glDeleteFramebuffers #define glDeleteFramebuffers glDeleteFramebuffersEXT #endif #ifndef glBindFramebuffer #define glBindFramebuffer glBindFramebufferEXT #endif #ifndef glFramebufferTexture1D #define glFramebufferTexture1D glFramebufferTexture1DEXT #endif #ifndef glFramebufferTexture2D #define glFramebufferTexture2D glFramebufferTexture2DEXT #endif #ifndef glFramebufferTexture3D #define glFramebufferTexture3D glFramebufferTexture3DEXT #endif #ifndef glCheckFramebufferStatus #define glCheckFramebufferStatus glCheckFramebufferStatusEXT #endif #ifndef glGenerateMipmap #define glGenerateMipmap glGenerateMipmapEXT #endif // Map EXT FBO constants to version 3.0 constants #ifndef GL_FRAMEBUFFER #define GL_FRAMEBUFFER GL_FRAMEBUFFER_EXT #endif #ifndef GL_COLOR_ATTACHMENT0 #define GL_COLOR_ATTACHMENT0 GL_COLOR_ATTACHMENT0_EXT #endif #ifndef GL_COLOR_ATTACHMENT1 #define GL_COLOR_ATTACHMENT1 GL_COLOR_ATTACHMENT1_EXT #endif #ifndef GL_COLOR_ATTACHMENT2 #define GL_COLOR_ATTACHMENT2 GL_COLOR_ATTACHMENT2_EXT #endif #ifndef GL_COLOR_ATTACHMENT3 #define GL_COLOR_ATTACHMENT3 GL_COLOR_ATTACHMENT3_EXT #endif #ifndef GL_COLOR_ATTACHMENT4 #define GL_COLOR_ATTACHMENT4 GL_COLOR_ATTACHMENT4_EXT #endif #ifndef GL_COLOR_ATTACHMENT5 #define GL_COLOR_ATTACHMENT5 GL_COLOR_ATTACHMENT5_EXT #endif #ifndef GL_COLOR_ATTACHMENT6 #define GL_COLOR_ATTACHMENT6 GL_COLOR_ATTACHMENT6_EXT #endif #ifndef GL_COLOR_ATTACHMENT7 #define GL_COLOR_ATTACHMENT7 GL_COLOR_ATTACHMENT7_EXT #endif #ifndef GL_COLOR_ATTACHMENT8 #define GL_COLOR_ATTACHMENT8 GL_COLOR_ATTACHMENT8_EXT #endif #ifndef GL_COLOR_ATTACHMENT9 #define GL_COLOR_ATTACHMENT9 GL_COLOR_ATTACHMENT9_EXT #endif #ifndef GL_MAX_COLOR_ATTACHMENTS #define GL_MAX_COLOR_ATTACHMENTS GL_MAX_COLOR_ATTACHMENTS_EXT #endif #ifndef GL_DEPTH_ATTACHMENT #define GL_DEPTH_ATTACHMENT GL_DEPTH_ATTACHMENT_EXT #endif #ifndef GL_STENCIL_ATTACHMENT #define GL_STENCIL_ATTACHMENT GL_STENCIL_ATTACHMENT_EXT #endif #ifndef GL_FRAMEBUFFER_COMPLETE #define GL_FRAMEBUFFER_COMPLETE GL_FRAMEBUFFER_COMPLETE_EXT #endif #ifndef GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT #define GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT_EXT #endif #ifndef GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT #define GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT_EXT #endif #ifndef GL_FRAMEBUFFER_UNSUPPORTED #define GL_FRAMEBUFFER_UNSUPPORTED GL_FRAMEBUFFER_UNSUPPORTED_EXT #endif #ifndef GL_FRAMEBUFFER_BINDING #define GL_FRAMEBUFFER_BINDING GL_FRAMEBUFFER_BINDING_EXT #endif //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Floating Point Texture Preprocessor Redefinitions #if GL_ARB_texture_float // 16-Bit Half Float Texture Formats #ifndef GL_ALPHA16F #define GL_ALPHA16F GL_ALPHA16F_ARB #endif #ifndef GL_LUMINANCE16F #define GL_LUMINANCE16F GL_LUMINANCE16F_ARB #endif #ifndef GL_LUMINANCE_ALPHA16F #define GL_LUMINANCE_ALPHA16F GL_LUMINANCE_ALPHA16F_ARB #endif #ifndef GL_INTENSITY16F #define GL_INTENSITY16F GL_INTENSITY16F_ARB #endif #ifndef GL_RGB16F #define GL_RGB16F GL_RGB16F_ARB #endif #ifndef GL_RGBA16F #define GL_RGBA16F GL_RGBA16F_ARB #endif // 32-Bit Single Precision Float Texture Formats #ifndef GL_ALPHA32F #define GL_ALPHA32F GL_ALPHA32F_ARB #endif #ifndef GL_LUMINANCE32F #define GL_LUMINANCE32F GL_LUMINANCE32F_ARB #endif #ifndef GL_LUMINANCE_ALPHA32F #define GL_LUMINANCE_ALPHA32F GL_LUMINANCE_ALPHA32F_ARB #endif #ifndef GL_INTENSITY32F #define GL_INTENSITY32F GL_INTENSITY32F_ARB #endif #ifndef GL_RGB32F #define GL_RGB32F GL_RGB32F_ARB #endif #ifndef GL_RGBA32F #define GL_RGBA32F GL_RGBA32F_ARB #endif #endif #if GL_ARB_half_float_pixel #ifndef GL_HALF_FLOAT #define GL_HALF_FLOAT GL_HALF_FLOAT_ARB #endif #endif #if GL_EXT_framebuffer_sRGB #ifndef GL_FRAMEBUFFER_SRGB #define GL_FRAMEBUFFER_SRGB GL_FRAMEBUFFER_SRGB_EXT #endif #endif //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Unsigned Integer Shader Uniform Type Preprocessor Redefinitions #if GL_EXT_gpu_shader4 #ifndef GL_UNSIGNED_INT_VEC2 #define GL_UNSIGNED_INT_VEC2 GL_UNSIGNED_INT_VEC2_EXT #endif #ifndef GL_UNSIGNED_INT_VEC3 #define GL_UNSIGNED_INT_VEC3 GL_UNSIGNED_INT_VEC3_EXT #endif #ifndef GL_UNSIGNED_INT_VEC4 #define GL_UNSIGNED_INT_VEC4 GL_UNSIGNED_INT_VEC4_EXT #endif #ifndef GL_SAMPLER_CUBE_SHADOW #define GL_SAMPLER_CUBE_SHADOW GL_SAMPLER_CUBE_SHADOW_EXT #endif #endif #else //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** OpenGL Version < 2.0 Not Supported! #error "OpenGL Version 2.0 or later is required" #endif //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Anisotropic Filtering Preprocessor Redefinitions #if GL_EXT_texture_filter_anisotropic #ifndef GL_TEXTURE_MAX_ANISOTROPY #define GL_TEXTURE_MAX_ANISOTROPY GL_TEXTURE_MAX_ANISOTROPY_EXT #endif #ifndef GL_MAX_TEXTURE_MAX_ANISOTROPY #define GL_MAX_TEXTURE_MAX_ANISOTROPY GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT #endif #endif //########################################################################################## //########################################################################################## //############ //############ Library Namespace Configuration //############ //########################################################################################## //########################################################################################## #ifndef RIM_GRAPHICS_DEVICES_OPENGL_NAMESPACE_START #define RIM_GRAPHICS_DEVICES_OPENGL_NAMESPACE_START RIM_GRAPHICS_DEVICES_NAMESPACE_START namespace opengl { #endif #ifndef RIM_GRAPHICS_DEVICES_OPENGL_NAMESPACE_END #define RIM_GRAPHICS_DEVICES_OPENGL_NAMESPACE_END }; RIM_GRAPHICS_DEVICES_NAMESPACE_END #endif //########################################################################################## //******************** Start Rim Graphics Devices OpenGL Namespace *********************** RIM_GRAPHICS_DEVICES_OPENGL_NAMESPACE_START //****************************************************************************************** //########################################################################################## /// Define the type which is used to represent an object ID for the OpenGL API. typedef UInt OpenGLID; /// Define the type which is used to represent an enum value in the OpenGL API. typedef UInt OpenGLEnum; //########################################################################################## //******************** End Rim Graphics Devices OpenGL Namespace ************************* RIM_GRAPHICS_DEVICES_OPENGL_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_GRAPHICS_OPENGL_CONFIG_H <file_sep>/* * rimPriorityQueue.h * Rim Framework * * Created by <NAME> on 3/5/09. * Copyright 2009 Rim Software. All rights reserved. * */ #ifndef INCLUDE_RIM_PRIORITY_QUEUE_H #define INCLUDE_RIM_PRIORITY_QUEUE_H #include "rimUtilitiesConfig.h" #include "rimAllocator.h" //########################################################################################## //*************************** Start Rim Framework Namespace ****************************** RIM_UTILITIES_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class which implements a max-heap-based priority queue. /** * The class uses an array-based heap where larger elements are * stored towards the front. When elements are added or removed * from the heap, internal state is kept consistent so that the * first item in the queue is the largest. * Element comparisons are done using the greater-than operator (>). * Therefore, any class which the user wishes to use with this implementation * must provide an overloaded greater-than operator. */ template < typename T > class PriorityQueue { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructors /// Create a new empty priority queue with the default capacity. RIM_INLINE PriorityQueue() : numElements( 0 ), capacity( 0 ), array( NULL ) { } /// Create a new empty priority queue with the specified initial capacity. RIM_INLINE PriorityQueue( Size newCapacity ) : numElements( 0 ), capacity( newCapacity ), array( util::allocate<T>(newCapacity) ) { } /// Create a copy of an existing priority queue, performing a deep copy. RIM_INLINE PriorityQueue( const PriorityQueue<T>& other ) : numElements( other.numElements ), capacity( other.capacity ), array( util::allocate<T>(other.capacity) ) { PriorityQueue<T>::copyObjects( array, other.array, numElements ); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Destructor /// Destroy a priority queue. /** * This destructor reclaims all memory previously used * by this priority queue. */ RIM_INLINE ~PriorityQueue() { if ( array != NULL ) { // Call the destructors of all objects that were constructed and deallocate the internal array. util::destructArray( array, numElements ); } } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Assignment Operator /// Assign this priority queue with the contents of another, performing a deep copy. RIM_INLINE PriorityQueue<T>& operator = ( const PriorityQueue<T>& other ) { if ( this != &other ) { if ( array != NULL ) { // Call the destructors of all objects that were constructed. PriorityQueue<T>::callDestructors( array, numElements ); } numElements = other.numElements; if ( numElements == Size(0) ) return *this; else { if ( numElements > capacity || array == NULL ) { // Deallocate the internal array. if ( array != NULL ) util::deallocate( array ); // Allocate a new array. capacity = other.capacity; array = util::allocate<T>( capacity ); } // copy the elements from the other queue. PriorityQueue<T>::copyObjects( array, other.array, numElements ); } } return *this; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Equality Operators /// Return whether or not whether every entry in this queue is equal to another queue's entries. RIM_INLINE Bool operator == ( const PriorityQueue<T>& other ) const { // If the queues point to the same data, they are equal. if ( array == other.array ) return true; else if ( numElements != other.numElements ) return false; // Do an element-wise comparison otherwise. const T* a = array; const T* b = other.array; const T* const aEnd = a + numElements; while ( a != aEnd ) { if ( !(*a == *b) ) return false; a++; b++; } return true; } RIM_INLINE Bool operator != ( const PriorityQueue<T>& other ) const { return !(*this == other); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Add Methods /// Add a new element to this priority queue. RIM_INLINE void add( const T& newElement ) { if ( numElements == capacity ) doubleCapacity(); Index i = numElements; Index parent = getParentIndex(i); new (array + numElements) T( newElement ); numElements++; // reorder the queue's heap so that the new element is in the correct place. while ( array[parent] < array[i] ) { T temp = array[parent]; array[parent] = array[i]; array[i] = temp; i = parent; parent = getParentIndex(i); } } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Remove Methods /// Remove the largest element from the priority queue. RIM_INLINE void remove() { RIM_DEBUG_ASSERT_MESSAGE( numElements != Size(0), "Cannot remove element from an empty priority queue." ); // Decrement the number of elements in the queue. numElements--; // Copy the last element in the queue's array into the largest element's location. array[0] = array[numElements]; // Call the destructor for the old last element. array[numElements].~T(); // Convert the new array into a heap, starting at the first element. this->heapify( 0 ); } /// Remove the element with the specified value from the priority queue. /** * The method returns whether or not the value was able to be removed. */ RIM_INLINE Bool remove( const T& element ) { Index i; if ( !getIndexRecursive( element, 0, i ) ) return false; // Decrement the number of elements in the queue. numElements--; // Copy the last element in the queue's array into the largest element's location. array[i] = array[numElements]; // Call the destructor for the old last element. array[numElements].~T(); // Convert the new array into a heap, starting at the removed element. this->heapify( i ); return true; } /// Remove the element at the specified index from the priority queue. /** * Indices start at 0 for the largest element in the queue and must be * less than the number of elements in the queue. */ RIM_INLINE void removeAtIndex( Index i ) { RIM_DEBUG_ASSERT_MESSAGE( i < numElements, "Cannot remove element at invalid index in priority queue." ); // Decrement the number of elements in the queue. numElements--; // Copy the last element in the queue's array into the largest element's location. array[i] = array[numElements]; // Call the destructor for the old last element. array[numElements].~T(); // Convert the new array into a heap, starting at the first element. this->heapify( i ); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Update Methods /// Ensure that the heap is propery ordered after the specified element was changed. RIM_INLINE void update( Index i ) { if ( i > 0 ) { Index parent = getParentIndex(i); // Did the entry increase its value? if ( array[parent] < array[i] ) { do { T temp = array[parent]; array[parent] = array[i]; array[i] = temp; i = parent; parent = getParentIndex(i); } while ( i > 0 && array[parent] < array[i] ); return; } } this->heapify( i ); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Index Accessor Methods /// Get the index of the specified value in this priority queue. /** * The method returns whether or not the given value was contained * in the queue. */ RIM_INLINE Bool getIndex( const T& value, Index& index ) const { return getIndexRecursive( value, 0, index ); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Contains Method /// Return whether or not the specified element is in the priority queue. RIM_INLINE Bool contains( const T& element ) const { return containsRecursive( element, 0 ); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Element Accessor Methods /// Return a reference to the largest element in the priority queue. RIM_INLINE T& getFirst() { RIM_DEBUG_ASSERT_MESSAGE( numElements != Size(0), "Cannot get first element from empty priority queue" ); return *array; } /// Return a const reference to the largest element in the priority queue. RIM_INLINE const T& getFirst() const { RIM_DEBUG_ASSERT_MESSAGE( numElements != Size(0), "Cannot get first element from empty priority queue" ); return *array; } /// Return a reference to the element in this priority queue at the specified index. RIM_INLINE T& operator [] ( Index i ) { RIM_DEBUG_ASSERT_MESSAGE( i < numElements, "Cannot get invalid element from priority queue" ); return array[i]; } /// Return a const reference to the element in this priority queue at the specified index. RIM_INLINE const T& operator [] ( Index i ) const { RIM_DEBUG_ASSERT_MESSAGE( i < numElements, "Cannot get invalid element from priority queue" ); return array[i]; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Clear Methods /// Clear the contents of this priority queue. /** * This method calls the destructors of all elements in the priority queue * and sets the number of elements to zero while maintaining the * queue's capacity. */ RIM_INLINE void clear() { if ( array != NULL ) PriorityQueue<T>::callDestructors( array, numElements ); numElements = Size(0); } /// Clear the contents of this priority queue and reclaim the allocated memory. /** * This method performs the same function as the clear() method, but * also deallocates the previously allocated internal array. Calling this * method is equivalent to assigning a new queue instance to this one. */ RIM_INLINE void reset() { if ( array != NULL ) { PriorityQueue<T>::callDestructors( array, numElements ); util::deallocate( array ); } capacity = Size(0); array = NULL; numElements = Size(0); } /// Clear the contents of this priority queue and reclaim the allocated memory. /** * This method performs the same function as the clear() method, but * also deallocates the previously allocated internal array and reallocates * it to a small initial starting size. Calling this method is equivalent * to assigning a new priority queue instance to this one. This version of * the reset() method allows the caller to specify the new starting * capacity of the queue. */ RIM_INLINE void reset( Size newCapacity ) { if ( array != NULL ) { PriorityQueue<T>::callDestructors( array, numElements ); util::deallocate( array ); } capacity = newCapacity; array = util::allocate<T>( capacity ); numElements = Size(0); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Size Accessor Methods /// Return whether or not the priority queue has any elements. /** * This method returns TRUE if the size of the priority queue * is greater than zero, and FALSE otherwise. * * @return whether or not the priority queue has any elements. */ RIM_INLINE Bool isEmpty() const { return numElements == Size(0); } /// Get the number of elements in the priority queue. /** * @return the number of elements in the priority queue. */ RIM_INLINE Size getSize() const { return numElements; } /// Get the current capacity of the priority queue. /** * The capacity is the maximum number of elements that the * priority queue can hold before it will have to resize its * internal array. * * @return the current capacity of the priority queue. */ RIM_INLINE Size getCapacity() const { return capacity; } private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Heap Methods /// Recursively query the priority queue to find the index of a value. /** * This method has O(log n) complexity due to the priority queue's * internal heap data structure. */ RIM_INLINE Bool getIndexRecursive( const T& value, Index i, Index& index ) const { if ( i >= numElements || array[i] < value ) return false; else if ( array[i] == value ) { index = i; return true; } if ( getIndexRecursive( value, getChildIndex1(i), index ) || getIndexRecursive( value, getChildIndex2(i), index ) ) return true; return false; } /// Recursively query the priorit queue to see if a value is contained. /** * This method has O(log n) complexity due to the priority queue's * internal heap data structure. */ RIM_INLINE Bool containsRecursive( const T& value, Index i ) const { if ( i >= numElements || array[i] < value ) return false; else if ( array[i] == value ) return true; if ( containsRecursive( value, getChildIndex1(i) ) || containsRecursive( value, getChildIndex2(i) ) ) return true; return false; } /// Get the index of a child elements's parent element given the child element's index. /** * If the child index is zero, the method returns 0 because this child element is * at the top of the heap and has no parent by definition. */ RIM_INLINE static Index getParentIndex( Index child ) { if ( child == Index(0) ) return Index(0); return (child - Index(1))/Index(2); } /// Get the index of the left child element given the parent element's index. RIM_INLINE static Index getChildIndex1( Index parent ) { return (parent << 1) + Index(1); } /// Get the index of the right child element given the parent element's index. RIM_INLINE static Index getChildIndex2( Index parent ) { return (parent << 1) + Index(2); } /// Convert the specified sub-heap, with root at index i, into a heap. RIM_INLINE void heapify( Index i ) { while ( i < numElements ) { Index childIndex1 = getChildIndex1(i); Index childIndex2 = getChildIndex2(i); Index max; if ( childIndex1 < numElements && array[i] < array[childIndex1] ) max = childIndex1; else max = i; if ( childIndex2 < numElements && array[max] < array[childIndex2] ) max = childIndex2; if ( max == i ) break; T temp = array[max]; array[max] = array[i]; array[i] = temp; i = max; } } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Array-Management Methods RIM_INLINE void doubleCapacity() { // check to see if the array has not yet been allocated. if ( capacity == 0 ) { // allocate the array to hold elements. capacity = DEFAULT_INITIAL_CAPACITY; array = util::allocate<T>( capacity ); } else resize( capacity << 1 ); } /// Double the size of the element array to increase the capacity of the priority queue. /** * This method deallocates the previously used array, and then allocates * a new block of memory with a size equal to double the previous size. * It then copies over all of the previous elements into the new array. */ void resize( Size newCapacity ) { // Update the capacity and allocate a new array. capacity = newCapacity; T* oldArray = array; array = util::allocate<T>( capacity ); // copy the elements from the old array to the new array. PriorityQueue<T>::moveObjects( array, oldArray, numElements ); // deallocate the old array. util::deallocate( oldArray ); } RIM_INLINE static void callDestructors( T* array, Size number ) { const T* const arrayEnd = array + number; while ( array != arrayEnd ) { array->~T(); array++; } } RIM_INLINE static void copyObjects( T* destination, const T* source, Size number ) { const T* const sourceEnd = source + number; while ( source != sourceEnd ) { new (destination) T(*source); destination++; source++; } } RIM_INLINE static void moveObjects( T* destination, const T* source, Size number ) { const T* const sourceEnd = source + number; while ( source != sourceEnd ) { // copy the object from the source to destination new (destination) T(*source); // call the destructors on the source source->~T(); destination++; source++; } } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Members /// A pointer to the array containing all elements in the queue. /** * Data is stored in this array using an array-based max-heap representation. */ T* array; /// The number of elements in the priority queue. Size numElements; /// The number of possible elements that the current queue could hold without resizing. Size capacity; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Static Data Members /// The default initial capacity of a priority queue. /** * This value is used whenever the creator of the queue does * not specify the initial capacity of the priority queue. */ static const Size DEFAULT_INITIAL_CAPACITY; }; template < typename T > const Size PriorityQueue<T>:: DEFAULT_INITIAL_CAPACITY = 8; //########################################################################################## //*************************** End Rim Framework Namespace ******************************** RIM_UTILITIES_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_PRIORITY_QUEUE_H <file_sep>/* * rimGraphicsViewVolume.h * Rim Graphics * * Created by <NAME> on 12/5/10. * Copyright 2010 Rim Software. All rights reserved. * */ #ifndef INCLUDE_RIM_GRAPHICS_VIEW_VOLUME_H #define INCLUDE_RIM_GRAPHICS_VIEW_VOLUME_H #include "rimGraphicsUtilitiesConfig.h" #include "rimGraphicsBoundingCone.h" //########################################################################################## //********************** Start Rim Graphics Utilities Namespace ************************** RIM_GRAPHICS_UTILITIES_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class which represents a visible region of space. /** * A ViewVolume is specified as the intersection of the half-spaces defined by * six viewing planes. Typically, these planes will represent the six sides of a * canonical viewing frustum. * * This class provides methods to determine whether or not a view volume contains * any part of several types of geometric primitives: points, spheres, cones, and * axis-aligned bounding boxes. */ class ViewVolume { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Public Static Data Members /// The return value for an intersection routine when an object is completely inside the view volume. static const UInt INSIDE = 2; /// The return value for an intersection routine when an object intersects the boundary of the view volume. static const UInt INTERSECTS = 1; /// The return value for an intersection routine when an object is outside of the view volume. static const UInt OUTSIDE = 0; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructors /// Create a view volume with the specified bounding planes. /** * By convention, the normals of all planes should point towards the * interior of the view volume. */ ViewVolume( const Plane3& newNear, const Plane3& newFar, const Plane3& newLeft, const Plane3& newRight, const Plane3& newTop, const Plane3& newBottom ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Intersection Query Methods /// Return whether or not the specified point is contained by this view volume. RIM_INLINE Bool intersects( const Vector3& point ) const { if ( left.getSignedDistanceTo( point ) < Real(0) || right.getSignedDistanceTo( point ) < Real(0) || top.getSignedDistanceTo( point ) < Real(0) || bottom.getSignedDistanceTo( point ) < Real(0) || near.getSignedDistanceTo( point ) < Real(0) || far.getSignedDistanceTo( point ) < Real(0) ) { return false; } else return true; } /// Return whether or not the specified bounding sphere intersects this view volume. RIM_INLINE Bool intersects( const BoundingSphere& sphere ) const { if ( left.getSignedDistanceTo( sphere.position ) < -sphere.radius || right.getSignedDistanceTo( sphere.position ) < -sphere.radius || top.getSignedDistanceTo( sphere.position ) < -sphere.radius || bottom.getSignedDistanceTo( sphere.position ) < -sphere.radius || near.getSignedDistanceTo( sphere.position ) < -sphere.radius || far.getSignedDistanceTo( sphere.position ) < -sphere.radius ) { return false; } else return true; } /// Return whether or not the specified bounding cone intersects this view volume. Bool intersects( const BoundingCone& cone ) const; /// Return whether or not the specified point is contained by this view volume. UInt intersects( const AABB3& box ) const; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Near Plane Accessor Methods /// Get the near clipping plane of this view volume. RIM_INLINE const Plane3& getNearPlane() const { return near; } /// Set the near clipping plane of this view volume. RIM_INLINE void setNearPlane( const Plane3& newNear ) { near = newNear; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Far Plane Accessor Methods /// Get the far clipping plane of this view volume. RIM_INLINE const Plane3& getFarPlane() const { return far; } /// Set the far clipping plane of this view volume. RIM_INLINE void setFarPlane( const Plane3& newFar ) { far = newFar; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Left Plane Accessor Methods /// Get the left clipping plane of this view volume. RIM_INLINE const Plane3& getLeftPlane() const { return left; } /// Set the left clipping plane of this view volume. RIM_INLINE void setLeftPlane( const Plane3& newLeft ) { left = newLeft; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Right Plane Accessor Methods /// Get the right clipping plane of this view volume. RIM_INLINE const Plane3& getRightPlane() const { return right; } /// Set the right clipping plane of this view volume. RIM_INLINE void setRightPlane( const Plane3& newRight ) { right = newRight; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Top Plane Accessor Methods /// Get the top clipping plane of this view volume. RIM_INLINE const Plane3& getTopPlane() const { return top; } /// Set the top clipping plane of this view volume. RIM_INLINE void setTopPlane( const Plane3& newTop ) { top = newTop; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Bottom Plane Accessor Methods /// Get the bottom clipping plane of this view volume. RIM_INLINE const Plane3& getBottomPlane() const { return bottom; } /// Set the bottom clipping plane of this view volume. RIM_INLINE void setBottomPlane( const Plane3& newBottom ) { bottom = newBottom; } private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Methodds /// Return whether or not all of the specified vertices are behind a plane. RIM_FORCE_INLINE static Bool verticesAreBehindPlane( const Plane3& plane, const Vector3* vertices ); /// Return whether or not a cone is entirely behind a plane. RIM_FORCE_INLINE static Bool coneIsBehindPlane( const Plane3& plane, const BoundingCone& cone ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Members /// The near clipping plane of the view volume. Plane3 near; /// The far clipping plane of the view volume. Plane3 far; /// The left clipping plane of the view volume. Plane3 left; /// The right clipping plane of the view volume. Plane3 right; /// The top clipping plane of the view volume. Plane3 top; /// The bottom clipping plane of the view volume. Plane3 bottom; }; //########################################################################################## //********************** End Rim Graphics Utilities Namespace **************************** RIM_GRAPHICS_UTILITIES_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_GRAPHICS_VIEW_VOLUME_H <file_sep>/* * rimGraphicsGridShape.h * Rim Software * * Created by <NAME> on 3/26/14. * Copyright 2014 __MyCompanyName__. All rights reserved. * */ #ifndef INCLUDE_RIM_GRAPHICS_GRID_SHAPE_H #define INCLUDE_RIM_GRAPHICS_GRID_SHAPE_H #include "rimGraphicsShapesConfig.h" #include "rimGraphicsShapeBase.h" //########################################################################################## //*********************** Start Rim Graphics Shapes Namespace **************************** RIM_GRAPHICS_SHAPES_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class which provides a simple means to draw an infinite 3D cartesian grid. /** * The grid is by default infinite (to the edge of the view), but can also be * limited to a 3D rectangular region. * * This class handles all vertex and index buffer generation automatically, * simplifying the visualization of grids. The grid is automatically resized * so that it encompasses the entire view volume, but not much further. */ class GridShape : public GraphicsShapeBase<GridShape> { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructors /// Create an infinite grid shape for the given graphics context. GridShape( const Pointer<GraphicsContext>& context ); /// Create a grid shape for the given graphics context which covers the specified 3D region in local space. GridShape( const Pointer<GraphicsContext>& context, const AABB3& newBounds ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Grid Bounding Box Accessor Methods /// Return the 3D region of this grid in its local coordinate frame. RIM_FORCE_INLINE const AABB3& getBounds() const { return bounds; } /// Set the 3D region of this grid in its local coordinate frame. RIM_INLINE void setBounds( const AABB3& newBounds ) { bounds = newBounds; updateMesh(); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Grid Division Size Accessor Methods /// Return the spacing between major grid lines in the shape's local coordinate system. RIM_INLINE Real getMajorSpacing() const { return majorSpacing; } /// Set the spacing between major grid lines in the shape's local coordinate system. /** * The new grid line spacing is clamped to be greater than or equal to 0. */ RIM_INLINE void setMajorSpacing( Real newMajorSpacing ) { majorSpacing = math::max( newMajorSpacing, Real(0) ); meshNeedsUpdate = true; } /// Return the spacing between minor grid lines in the shape's local coordinate system. RIM_INLINE Real getMinorSpacing() const { return minorSpacing; } /// Set the spacing between major grid lines in the shape's local coordinate system. /** * The new grid line spacing is clamped to be greater than or equal to 0. */ RIM_INLINE void setMinorSpacing( Real newMinorSpacing ) { minorSpacing = math::max( newMinorSpacing, Real(0) ); meshNeedsUpdate = true; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Grid Line Color Accessor Methods /// Return the color to use when drawing major grid lines. RIM_INLINE const Color4f& getMajorColor() const { return majorColor; } /// Set the color to use when drawing major grid lines. void setMajorColor( const Color4f& newMajorColor ); /// Return the color to use when drawing minor grid lines. RIM_INLINE const Color4f& getMinorColor() const { return minorColor; } /// Set the color to use when drawing minor grid lines. void setMinorColor( const Color4f& newMinorColor ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Grid Line Width Accessor Methods /// Return the width in pixels to use when drawing major grid lines. RIM_INLINE Real getMajorWidth() const { return majorWidth; } /// Set the width in pixels to use when drawing major grid lines. /** * The new line width is clamped to be at least 1 pixel. */ void setMajorWidth( Real newMajorWidth ); /// Return the width in pixels to use when drawing minor grid lines. RIM_INLINE Real getMinorWidth() const { return minorWidth; } /// Set the width in pixels to use when drawing minor grid lines. /** * The new line width is clamped to be at least 1 pixel. */ void setMinorWidth( Real newMinorWidth ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Context Accessor Methods /// Return a pointer to the graphics contet which is being used to create this box shape. RIM_INLINE const Pointer<GraphicsContext>& getContext() const { return context; } /// Change the graphics context which is used to create this box shape. /** * Calling this method causes the previously generated box geometry to * be discarded and regenerated using the new context. */ void setContext( const Pointer<GraphicsContext>& newContext ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Bounding Volume Accessor Methods /// Update the box's axis-aligned bounding box. virtual void updateBoundingBox(); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Shape Chunk Accessor Method /// Process the shape into a flat list of mesh chunk objects. /** * This method flattens the shape hierarchy and produces mesh chunks * for rendering from the specified camera's perspective. The method * converts its internal representation into one or more MeshChunk * objects which it appends to the specified output list of mesh chunks. * * The method returns whether or not the shape was successfully flattened * into chunks. */ virtual Bool getChunks( const Transform3& worldTransform, const Camera& camera, const ViewVolume* viewVolume, const Vector2D<Size>& viewportSize, ArrayList<MeshChunk>& chunks ) const; private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Helper Methods /// Update the triangle mesh currently used for this box shape from its current state. void updateMesh(); static void generateGrid( const AABB3& gridBounds, Real division, HardwareBufferIterator<Vector3f>& positions ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Members /// The bounding box of the grid in the shape's local coordiante system. AABB3 bounds; /// The current bounding box of the visible grid mesh. mutable AABB3 meshBounds; /// The spacing in shape-local units between major grid lines. Real majorSpacing; /// The spacing in shape-local units between minor grid lines. Real minorSpacing; /// The width of major grid lines in pixels. Real majorWidth; /// The width of minor grid lines in pixels. Real minorWidth; /// The color to use when drawing major grid lines. Color4f majorColor; /// The color to use when drawing minor grid lines. Color4f minorColor; /// The graphics context which is used to create this box shape. Pointer<GraphicsContext> context; /// The grid shape's major grid line material. Pointer<Material> majorMaterial; /// The grid shape's minor grid line material. Pointer<Material> minorMaterial; /// A vertex buffer list containing the current vertices for the grid. Pointer<VertexBufferList> vertexBufferList; /// A vertex buffer containing the positions of the grid vertices for both major and minor grid lines, in that order. Pointer<VertexBuffer> vertexPositions; /// The number of major grid line vertices in the vertex buffer. Size numMajorVertices; /// The number of minor grid line vertices in the vertex buffer. Size numMinorVertices; /// A boolean value indicating whether or not the grid mesh needs to be updated before it is drawn. Bool meshNeedsUpdate; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Static Data Members /// The default major grid line spacing. static const Real DEFAULT_MAJOR_DIVISION; /// The default minor grid line spacing. static const Real DEFAULT_MINOR_DIVISION; /// The default major grid line spacing in pixels. static const Real DEFAULT_MAJOR_WIDTH; /// The default minor grid line spacing in pixels. static const Real DEFAULT_MINOR_WIDTH; /// The default major grid line color. static const Color4f DEFAULT_MAJOR_COLOR; /// The default minor grid line color. static const Color4f DEFAULT_MINOR_COLOR; }; //########################################################################################## //*********************** End Rim Graphics Shapes Namespace ****************************** RIM_GRAPHICS_SHAPES_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_GRAPHICS_GRID_SHAPE_H <file_sep>/* * rimSoundMIDIDevice.h * Rim Sound * * Created by <NAME> on 4/2/13. * Copyright 2013 __MyCompanyName__. All rights reserved. * */ #ifndef INCLUDE_RIM_SOUND_MIDI_DEVICE_H #define INCLUDE_RIM_SOUND_MIDI_DEVICE_H #include "rimSoundDevicesConfig.h" #include "rimSoundMIDIDeviceID.h" #include "rimSoundMIDIDeviceDelegate.h" //########################################################################################## //************************ Start Rim Sound Devices Namespace ***************************** RIM_SOUND_DEVICES_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class which represents a system MIDI device. /** * The class allows the user to send and recieve MIDI events to/from MIDI hardware * ports. */ class MIDIDevice { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructors /// Create a MIDIDevice for the specified MIDIDeviceID. MIDIDevice( const MIDIDeviceID& newDeviceID ); /// Create a copy of the specified MIDIDevice object. MIDIDevice( const MIDIDevice& other ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Destructor /// Destroy a MIDIDevice object, stopping the input/output of any MIDI. ~MIDIDevice(); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Assignment Operator /// Assign the state from one MIDIDevice to this object. MIDIDevice& operator = ( const MIDIDevice& other ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** MIDI Start/Stop Methods /// Start sending/receiving MIDI events to/from the device. /** * If the device is invalid or if an error occurs, FALSE is returned indicating * that the method had no effect. If TRUE is returned, the device was started successfully * * This method should be called before sending any messages to a MIDI output device. */ Bool start(); /// Stop sending/receiving MIDI events to/from the device. /** * If the device is currently receiving MIDI, the input of further MIDI events * is stopped. Otherwise, the method has no effect. If the device is invalid, * this method has no effect. * * This method has the effect of stopping the MIDI thread that was * started in the start() method. */ void stop(); /// Return whether or not the device is currently sending/receiving MIDI. /** * If MIDI is currently being received and sent to the device, TRUE is returned. * Otherwise, FALSE is returned. If the device is invalid, FALSE is always * returned. * * @return whether or not the device IO is currently running. */ Bool isRunning() const; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** MIDI Output Methods /// Send the specified MIDI event to the output of this MIDI device. /** * If the method fails or if the device is not an output, FALSE is returned. * Otherwise, the method succeeds and TRUE is returned. */ Bool write( const MIDIEvent& event ); /// Send the specified MIDI message buffer to the output of this MIDI device. /** * If the method fails or if the device is not an output, FALSE is returned. * Otherwise, the method succeeds and TRUE is returned. */ Bool write( const MIDIBuffer& messageBuffer ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Device Name Accessor Method /// Get a string representing the name of this device. /** * This name is usually specified by the hardware driver as a human-readable * identifier for the device. If the device is not valid, the empty string * is returned. * * @return the name of this device. */ RIM_INLINE const UTF8String& getName() const { return name; } /// Get a string representing the name of this device's manufacturer. /** * This name is usually specified by the hardware driver as a human-readable * identifier for the device's manufacturer. If the device is not valid, the empty string * is returned. * * @return the name of this device's manufacturer. */ RIM_INLINE const UTF8String& getManufacturer() const { return manufacturer; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Delegate Accessor Methods /// Return a reference to the delegate object which is responding to events for this device. RIM_INLINE const MIDIDeviceDelegate& getDelegate() const { return delegate; } /// Replace the delegate object which is responding to events for this device. void setDelegate( const MIDIDeviceDelegate& newDelegate ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Device ID Accessor Method /// Return an object which uniquely identifies this MIDI device. /** * If the device is not valid, MIDIDeviceID::INVALID_DEVICE is returned. */ RIM_INLINE MIDIDeviceID getID() const { return valid ? deviceID : MIDIDeviceID::INVALID_DEVICE; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Device Status Accessor Methods /// Return whether or not this device represents a valid device. /** * If a MIDIDevice is created with a MIDIDeviceID that does not * represent a valid system audio device or if a device is removed after * it is created, the MIDIDevice is marked as invalid and this * method will return FALSE. Otherwise, if the device is valid, the method * returns TRUE. * * If a device is invalid, the output callback method will not be called anymore * and the application should switch to a different device. The application * should periodically check the return value of this function to see if the * device has been removed. */ RIM_INLINE Bool isValid() const { return valid; } /// Return whether or not this MIDI device is a valid input device. /** * If the device is not valid, FALSE is returned. Otherwise, if the * MIDI device is an input device, TRUE is returned. */ RIM_INLINE Bool isInput() const { return valid ? deviceID.isInput() : false; } /// Return whether or not this MIDI device is a valid output device. /** * If the device is not valid, FALSE is returned. Otherwise, if the * MIDI device is an output device, TRUE is returned. */ RIM_INLINE Bool isOutput() const { return valid ? deviceID.isOutput() : false; } private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Wrapper Class Declaration /// A class which encapsulates internal data needed by the MIDIDevice object. class Wrapper; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Helper Methods /// Initialize a newly created device. Bool initializeDeviceData(); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Platform-Specific Methods /// Initialize up any platform-specific data for a newly-created device. Bool createDevice(); /// Clean up any platform-specific data before a device is destroyed. Bool destroyDevice(); /// Register callback functions that tell the device when its attributes change. Bool registerDeviceUpdateCallbacks(); /// Unregister callback functions that tell the device when its attributes change. Bool unregisterDeviceUpdateCallbacks(); /// Determine whether or not this MIDI device is still valid. Bool refreshDeviceStatus(); /// Refresh the name of the MIDI device. Bool refreshName(); /// Refresh the manufacturer name of the MIDI device. Bool refreshManufacturer(); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Members /// An object which represents a unique identifier for this MIDI device. MIDIDeviceID deviceID; /// An object which responds to events for this MIDI device. MIDIDeviceDelegate delegate; /// The device-provided name of this MIDIDevice. UTF8String name; /// The device-provided manufacturer name of this MIDIDevice. UTF8String manufacturer; /// A mutex object which handles output synchronization with device parameter changes. mutable threads::Mutex ioMutex; /// A pointer to a class which wraps internal state of this MIDIDevice. Wrapper* wrapper; /// A boolean value indicating whether or not the device is currently valid for use. Bool valid; /// A boolean value indicating whether or not the device is currently processing MIDI events. Bool running; }; //########################################################################################## //************************ End Rim Sound Devices Namespace ******************************* RIM_SOUND_DEVICES_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_SOUND_MIDI_DEVICE_H <file_sep>/* * rimGraphicsGUIRenderView.h * Rim Graphics GUI * * Created by <NAME> on 2/13/13. * Copyright 2013 Headspace Systems. All rights reserved. * */ #ifndef INCLUDE_RIM_GRAPHICS_GUI_RENDER_VIEW_H #define INCLUDE_RIM_GRAPHICS_GUI_RENDER_VIEW_H #include "rimGraphicsGUIBase.h" #include "rimGraphicsGUIObject.h" #include "rimGraphicsGUIRenderViewDelegate.h" //########################################################################################## //************************ Start Rim Graphics GUI Namespace ****************************** RIM_GRAPHICS_GUI_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class which contains a collection of GUI objects positioned within a 2D rectangle. /** * A render view delegates UI actions to the objects that it contains, as well * as maintains a sorted order for drawing objects based on their depth. */ class RenderView : public GUIObject { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructors /// Create a new render view with no width or height positioned at the origin. RenderView(); /// Create a new empty render view which occupies the specified rectangular region. RenderView( const Rectangle& newRectangle ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Border Accessor Methods /// Return a mutable object which describes this render view's border. RIM_INLINE Border& getBorder() { return border; } /// Return an object which describes this render view's border. RIM_INLINE const Border& getBorder() const { return border; } /// Set an object which describes this render view's border. RIM_INLINE void setBorder( const Border& newBorder ) { border = newBorder; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Content Bounding Box Accessor Methods /// Return the 3D bounding box for the render view's rendered area in its local coordinate frame. RIM_INLINE AABB3f getLocalContentBounds() const { return AABB3f( border.getContentBounds( AABB2f( Vector2f(), this->getSizeXY() ) ), AABB1f( Float(0), this->getSize().z ) ); } /// Return the 2D bounding box for the render view's rendered area in its local coordinate frame. RIM_INLINE AABB2f getLocalContentBoundsXY() const { return border.getContentBounds( AABB2f( Vector2f(), this->getSizeXY() ) ); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Color Accessor Methods /// Return the background color for this render view's main area. RIM_INLINE const Color4f& getBackgroundColor() const { return backgroundColor; } /// Set the background color for this render view's main area. RIM_INLINE void setBackgroundColor( const Color4f& newBackgroundColor ) { backgroundColor = newBackgroundColor; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Border Color Accessor Methods /// Return the border color used when rendering a render view. RIM_INLINE const Color4f& getBorderColor() const { return borderColor; } /// Set the border color used when rendering a render view. RIM_INLINE void setBorderColor( const Color4f& newBorderColor ) { borderColor = newBorderColor; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Update Method /// Update the current internal state of this render view for the specified time interval in seconds. virtual void update( Float dt ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Drawing Method /// Draw this render view using the specified GUI renderer to the given parent coordinate system bounds. /** * The method returns whether or not the render view was successfully drawn. */ virtual Bool drawSelf( GUIRenderer& renderer, const AABB3f& parentBounds ) const; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Input Handling Methods /// Handle the specified keyboard event for the entire render view. virtual void keyEvent( const KeyboardEvent& event ); /// Handle the specified mouse motion event for the entire render view. virtual void mouseMotionEvent( const MouseMotionEvent& event ); /// Handle the specified mouse button event for the entire render view. virtual void mouseButtonEvent( const MouseButtonEvent& event ); /// Handle the specified mouse wheel event for the entire render view. virtual void mouseWheelEvent( const MouseWheelEvent& event ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Delegate Accessor Methods /// Return a reference to the delegate which responds to events for this render view. RIM_INLINE RenderViewDelegate& getDelegate() { return delegate; } /// Return a reference to the delegate which responds to events for this render view. RIM_INLINE const RenderViewDelegate& getDelegate() const { return delegate; } /// Return a reference to the delegate which responds to events for this render view. RIM_INLINE void setDelegate( const RenderViewDelegate& newDelegate ) { delegate = newDelegate; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Static Construction Methods /// Construct a smart-pointer-wrapped instance of this class using the constructor with the given arguments. RIM_INLINE static Pointer<RenderView> construct() { return Pointer<RenderView>::construct(); } /// Construct a smart-pointer-wrapped instance of this class using the constructor with the given arguments. RIM_INLINE static Pointer<RenderView> construct( const Rectangle& newRectangle ) { return Pointer<RenderView>::construct( newRectangle ); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Public Static Data Members /// The default border that is used for a render view. static const Border DEFAULT_BORDER; /// The default background color that is used for a render view's area. static const Color4f DEFAULT_BACKGROUND_COLOR; /// The default border color that is used for a render view. static const Color4f DEFAULT_BORDER_COLOR; private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Members /// An object which describes the border for this render view. Border border; /// An object which contains function pointers that respond to render view events. RenderViewDelegate delegate; /// The background color for the render view's area. Color4f backgroundColor; /// The border color for the render view's background area. Color4f borderColor; }; //########################################################################################## //************************ End Rim Graphics GUI Namespace ******************************** RIM_GRAPHICS_GUI_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_GRAPHICS_GUI_RENDER_VIEW_H <file_sep>/* * rimGraphicsShape.h * Rim Graphics * * Created by <NAME> on 11/28/09. * Copyright 2009 Rim Software. All rights reserved. * */ #ifndef INCLUDE_RIM_GRAPHICS_SHAPE_H #define INCLUDE_RIM_GRAPHICS_SHAPE_H #include "rimGraphicsShapesConfig.h" #include "rimGraphicsShapeType.h" #include "rimGraphicsMeshChunk.h" //########################################################################################## //*********************** Start Rim Graphics Shapes Namespace **************************** RIM_GRAPHICS_SHAPES_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class which represents an abstract renderable object. /** * A shape object contains whatever information is necessary to render * it to the screen. Every shape has a transformation which orients it relative * to its parent coordinate frame. */ class GraphicsShape : public Transformable { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Shape Type Accessor Methods /// Return an integer identifying the sub type of this shape. RIM_FORCE_INLINE ShapeTypeID getTypeID() const { return type->getID(); } /// Return a reference to an object representing the type of this Shape. RIM_FORCE_INLINE const ShapeType& getType() const { return *type; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Name Accessor Methods /// Return the name of the graphics shape. RIM_INLINE const String& getName() const { return name; } /// Set the name of the graphics shape. RIM_INLINE void setName( const String& newName ) { name = newName; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Mesh Chunk Accessor Method /// Process the shape into a flat list of mesh chunk objects. /** * This method flattens the shape hierarchy and produces mesh chunks * for rendering from the specified camera's perspective. The method * should convert its internal representation into one or more MeshChunk * objects which it should append to the specified output list of mesh chunks. * * The caller provides the concatenated local-to-world transformation for the * shape's parent coordinate frame. * * The method should return whether or not the shape was successfully flattened * into chunks. */ virtual Bool getChunks( const Transform3& worldTransform, const Camera& camera, const ViewVolume* viewVolume, const Vector2D<Size>& viewportSize, ArrayList<MeshChunk>& chunks ) const; protected: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructors /// Create a new shape with the specified type and default identity transformation. RIM_INLINE GraphicsShape( const ShapeType* newType ) : Transformable(), type( newType ) { RIM_DEBUG_ASSERT_MESSAGE( type != NULL, "Cannot have NULL type for shape." ); } /// Create a new shape with the specified type and transformation. RIM_INLINE GraphicsShape( const ShapeType* newType, const Transform3& newTransform ) : Transformable( newTransform ), type( newType ) { RIM_DEBUG_ASSERT_MESSAGE( type != NULL, "Cannot have NULL type for shape." ); } private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Members /// A pointer to an object which represents the type of this shape. const ShapeType* type; /// A name for this graphics shape. String name; }; //########################################################################################## //*********************** End Rim Graphics Shapes Namespace ****************************** RIM_GRAPHICS_SHAPES_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_GRAPHICS_SHAPE_H <file_sep>/* * rimGUI.h * Rim GUI * * Created by <NAME> on 10/28/08. * Copyright 2008 __MyCompanyName__. All rights reserved. * */ #ifndef INCLUDE_RIM_GUI_H #define INCLUDE_RIM_GUI_H #include "gui/rimGUIConfig.h" // Input Namespace. #include "gui/rimGUIInput.h" // System Namespace. #include "gui/rimGUISystem.h" // Application #include "gui/rimGUIApplication.h" // Window Elements #include "gui/rimGUIWindow.h" #include "gui/rimGUIWindowDelegate.h" #include "gui/rimGUIWindowElement.h" // View Elements #include "gui/rimGUIView.h" #include "gui/rimGUIRenderView.h" #include "gui/rimGUIRenderViewDelegate.h" // Text Elements #include "gui/rimGUITextField.h" #include "gui/rimGUITextFieldDelegate.h" // Button Elements #include "gui/rimGUIButton.h" #include "gui/rimGUIButtonDelegate.h" // Menu Elements #include "gui/rimGUIMenuItem.h" #include "gui/rimGUIMenuItemDelegate.h" #include "gui/rimGUIMenu.h" #include "gui/rimGUIMenuDelegate.h" // Dialogs #include "gui/rimGUISaveDialog.h" #include "gui/rimGUIOpenDialog.h" //########################################################################################## //*************************** Start Rim GUI Namespace ****************************** RIM_GUI_NAMESPACE_START //****************************************************************************************** //########################################################################################## using namespace rim::gui::input; //########################################################################################## //*************************** End Rim GUI Namespace ******************************** RIM_GUI_NAMESPACE_END //****************************************************************************************** //########################################################################################## #ifdef RIM_GUI_NAMESPACE_START #undef RIM_GUI_NAMESPACE_START #endif #ifdef RIM_GUI_NAMESPACE_END #undef RIM_GUI_NAMESPACE_END #endif #endif // INCLUDE_RIM_GUI_H <file_sep>/* * rimGUIMenuBar.h * Rim GUI * * Created by <NAME> on 9/9/12. * Copyright 2012 __MyCompanyName__. All rights reserved. * */ #ifndef INCLUDE_RIM_GUI_MENU_BAR_H #define INCLUDE_RIM_GUI_MENU_BAR_H #include "rimGUIConfig.h" #include "rimGUIElement.h" #include "rimGUIMenuItem.h" #include "rimGUIMenuDelegate.h" //########################################################################################## //*************************** Start Rim GUI Namespace ****************************** RIM_GUI_NAMESPACE_START //****************************************************************************************** //########################################################################################## class Window; //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class which represents a set of drop-down menus that are displayed in a horizontal row. class MenuBar : public GUIElement { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructors /// Create a new menu bar with no name and no menu items. MenuBar(); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Destructor /// Destroy a menu bar object and all state associated with it. /** * The destructor for a menu bar should not be called until it is not being * used as part of any active GUI. */ ~MenuBar(); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Menu Item Accessor Methods /// Return the number of menus that this menu bar has. Size getMenuCount() const; /// Get the menu at the specified index in this menu bar. /** * If the specified index is invalid, a NULL pointer is returned. * * @param index - the index of the menu to be retrieved. * @return a pointer to the menu at the specified index. */ Pointer<Menu> getMenu( Index index ) const; /// Place the index of the specified menu in the output parameter and return if it was found. /** * If the menu bar contains the specified menu, it places the index of that menu in * the output index parameter and returns TRUE. Otherwise, if the menu is not found, * the method returns FALSE and no index is retrieved. */ Bool getMenuIndex( const Menu* item, Index& index ) const; /// Add the specified menu to the end of the list of menus, placing it at the right side of the menu bar. /** * If the new menu pointer is NULL, the add operation is ignored and FALSE is returned. * Otherwise, the menu is added and TRUE is returned, indicating success. * * @param newMenu - the menu to add to the end of the menu list. */ Bool addMenu( const Pointer<Menu>& newMenu ); /// Insert the specified menu at the specified index in this menu bar. /** * If the new menu pointer is NULL or if the specified insertion index is * greater than the number of menus in the menu bar, FALSE is returned indicating that * the insertion operation failed. Otherwise, TRUE is returned and the menu is inserted * at the specified index. * * @param newMenu - the menu to insert in the menu list. * @param index - the index in the menu list at which to insert the new menu. */ Bool insertMenu( const Pointer<Menu>& newMenu, Index index ); /// Set the specified menu at the specified index in the list of menus. /** * This method replaces the menu at the specified index with a new menu. * If the new menu pointer is NULL, the set operation is ignored. * * @param newMenu - the menu to set in the menu item list. * @param index - the index at which to set the new item. */ Bool setMenu( const Pointer<Menu>& newMenu, Index index ); /// Remove the specified menu from this menu bar. /** * If the menu pointer is NULL or if the specified menu is not contained * in this menu bar, FALSE is returned indicating failure. Otherwise, that * menu is removed and TRUE is returned. * * @param menu - the menu to remove from the menu list. * @return whether or not the remove operation was successful. */ Bool removeMenu( const Menu* menu ); /// Remove the menu at the specified index in the menu list. /** * If the specified index is invalid, FALSE is returned and the menu bar * is unaltered. Otherwise, the menu at that index is removed and * TRUE is returned. * * @param index - the index at which to remove a menu from the menu bar. * @return whether or not the remove operation was successful. */ Bool removeMenuAtIndex( Index index ); /// Remove all menus from this menu bar. void clearMenus(); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Parent Window Accessor Methods /// Return a pointer to the window that this menu bar belongs to. /** * This method returns a NULL pointer if the menu bar doesn't have a parent * window. Use the hasParentWindow() function to detect if the menu bar * has a parent window. */ Window* getParentWindow() const; /// Return whether or not this menu bar has a parent window. Bool hasParentWindow() const; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Platform-Specific Element Pointer Accessor Method /// Get a pointer to this menu bar's platform-specific internal representation. /** * On Mac OS X, this method returns a pointer to a subclass of NSMenu which * represents the menu bar. * * On Windows, this method returns */ virtual void* getInternalPointer() const; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Static Shared Construction Methods /// Create a shared-pointer menu bar object, calling the default constructor. RIM_INLINE static Pointer<MenuBar> construct() { return Pointer<MenuBar>( util::construct<MenuBar>() ); } private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Menu Wrapper Class Declaration. /// A class which hides internal platform-specific state for a menu bar. class Wrapper; /// Declare the Window class as a friend so that it can make itself a parent privately. friend class Window; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Helper Methods /// Set a pointer to this menu bar's parent window. void setParentWindow( Window* window ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Members /// A pointer to an object which wraps internal platform-specific state for this menu bar. Wrapper* wrapper; }; //########################################################################################## //*************************** End Rim GUI Namespace ******************************** RIM_GUI_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_GUI_MENU_BAR_H <file_sep>/* * rimAssetsConfig.h * Rim Assets * * Created by <NAME> on 12/28/08. * Copyright 2008 Rim Software. All rights reserved. * */ #ifndef INCLUDE_RIM_ASSETS_CONFIG_H #define INCLUDE_RIM_ASSETS_CONFIG_H #include "../rimMath.h" #include "../rimData.h" #include "../rimUtilities.h" #include "../rimResources.h" #include "../rimFileSystem.h" #include "../rimIO.h" //########################################################################################## //########################################################################################## //############ //############ Library Namespace Configuration //############ //########################################################################################## //########################################################################################## #ifndef RIM_ASSETS_NAMESPACE_START #define RIM_ASSETS_NAMESPACE_START RIM_NAMESPACE_START namespace assets { #endif #ifndef RIM_ASSETS_NAMESPACE_END #define RIM_ASSETS_NAMESPACE_END }; RIM_NAMESPACE_END #endif //########################################################################################## //**************************** Start Rim Assets Namespace ******************************** RIM_ASSETS_NAMESPACE_START //****************************************************************************************** //########################################################################################## using rim::lang::Pointer; using rim::data::String; using rim::data::UTF8String; using rim::data::UTF8StringBuffer; using rim::util::HashMap; using rim::util::ArrayList; using rim::util::ShortArrayList; using rim::resources::ResourceID; using rim::resources::ResourceLocalID; using rim::resources::Resource; using rim::resources::ResourceManager; //########################################################################################## //**************************** End Rim Assets Namespace ********************************** RIM_ASSETS_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_ASSETS_CONFIG_H <file_sep>/* * rimBVH.h * Rim BVH * * Created by <NAME> on 5/14/2010. * Copyright 2010 Rim Software. All rights reserved. * */ #ifndef INCLUDE_RIM_BVH_H #define INCLUDE_RIM_BVH_H #include "bvh/rimBVHConfig.h" #include "bvh/rimBoundingSphere.h" #include "bvh/rimTraversalStack.h" #include "bvh/rimBVH.h" #include "bvh/rimAABBTree4.h" #include "bvh/rimSceneBVH.h" #ifdef RIM_BVH_NAMESPACE_START #undef RIM_BVH_NAMESPACE_START #endif #ifdef RIM_BVH_NAMESPACE_END #undef RIM_BVH_NAMESPACE_END #endif #endif // INCLUDE_RIM_BVH_H <file_sep>/* * rimGraphicsLightBuffer.h * Rim Graphics * * Created by <NAME> on 5/17/12. * Copyright 2012 __MyCompanyName__. All rights reserved. * */ #ifndef INCLUDE_RIM_GRAPHICS_LIGHT_BUFFER_H #define INCLUDE_RIM_GRAPHICS_LIGHT_BUFFER_H #include "rimGraphicsLightsConfig.h" #include "rimGraphicsLight.h" #include "rimGraphicsDirectionalLight.h" #include "rimGraphicsPointLight.h" #include "rimGraphicsSpotLight.h" //########################################################################################## //************************ Start Rim Graphics Lights Namespace *************************** RIM_GRAPHICS_LIGHTS_NAMESPACE_START //****************************************************************************************** //########################################################################################## class LightBuffer { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructors RIM_INLINE LightBuffer() { } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Directional Light Accessor Methods /// Return a pointer to the directional light contained in this light buffer at the specified index. RIM_INLINE Size getDirectionalLightCount() const { return directionalLights.getSize(); } /// Return a pointer to the directional light contained in this light buffer at the specified index. RIM_INLINE const Pointer<DirectionalLight>& getDirectionalLight( Index index ) const { return directionalLights[index].light; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Point Light Accessor Methods /// Return a pointer to the point light contained in this light buffer at the specified index. RIM_INLINE Size getPointLightCount() const { return pointLights.getSize(); } /// Return a pointer to the directional light contained in this light buffer at the specified index. RIM_INLINE const Pointer<PointLight>& getPointLight( Index index ) const { return pointLights[index].light; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Spot Light Accessor Methods /// Return a pointer to the spot light contained in this light buffer at the specified index. RIM_INLINE Size getSpotLightCount() const { return spotLights.getSize(); } /// Return a pointer to the spot light contained in this light buffer at the specified index. RIM_INLINE const Pointer<SpotLight>& getSpotLight( Index index ) const { return spotLights[index].light; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Light Add Methods /// Add the specified directional light to this light buffer. RIM_INLINE void addLight( const Pointer<DirectionalLight>& newDirectionalLight ) { directionalLights.add( LightIntensity<DirectionalLight>( newDirectionalLight ) ); } /// Add the specified point light to this light buffer. RIM_INLINE void addLight( const Pointer<PointLight>& newPointLight ) { pointLights.add( LightIntensity<PointLight>( newPointLight ) ); } /// Add the specified spot light to this light buffer. RIM_INLINE void addLight( const Pointer<SpotLight>& newSpotLight ) { spotLights.add( LightIntensity<SpotLight>( newSpotLight ) ); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Buffer Clear Methods /// Remove all of the lights from this light buffer. RIM_INLINE void removeAllLights() { directionalLights.clear(); pointLights.clear(); spotLights.clear(); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Light Sorting Method /// Sort each type of light independently in order of decreasing intensity for the specified detector. void sortLightsByDecreasingIntensity( const BoundingSphere& detector ); private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Members template < typename LightType > class LightIntensity { public: RIM_INLINE LightIntensity( const Pointer<LightType>& newLight ) : light( newLight ), intensity( 0 ) { } Real intensity; const Pointer<LightType> light; }; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Helper Methods template < typename LightType > static void sortLightsByDecreasingIntensity( ArrayList<LightIntensity<LightType> >& list ); template < typename LightType > static int compareLightIntensities( const void* a, const void* b ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Members /// A list of all of the directional lights in this light buffer. ArrayList<LightIntensity<DirectionalLight> > directionalLights; /// A list of all of the point lights in this light buffer. ArrayList<LightIntensity<PointLight> > pointLights; /// A list of all of the spot lights in this light buffer. ArrayList<LightIntensity<SpotLight> > spotLights; }; //########################################################################################## //************************ End Rim Graphics Lights Namespace ***************************** RIM_GRAPHICS_LIGHTS_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_GRAPHICS_LIGHT_BUFFER_H <file_sep>/* * rimUtilities.h * Rim Framework * * Created by <NAME> on 12/28/08. * Copyright 2008 Rim Software. All rights reserved. * */ #ifndef INCLUDE_RIM_UTILITIES_H #define INCLUDE_RIM_UTILITIES_H #include "util/rimUtilitiesConfig.h" #include "util/rimAllocator.h" #include "util/rimCopy.h" // Array classes #include "util/rimArray.h" #include "util/rimAlignedArray.h" #include "util/rimShortArray.h" #include "util/rimStaticArray.h" // Array-based list classes #include "util/rimArrayList.h" #include "util/rimStaticArrayList.h" #include "util/rimShortArrayList.h" // Linked list class #include "util/rimLinkedList.h" #include "util/rimHashMap.h" #include "util/rimHashSet.h" #include "util/rimQueue.h" #include "util/rimStack.h" #include "util/rimPriorityQueue.h" #ifdef RIM_UTILITIES_NAMESPACE_START #undef RIM_UTILITIES_NAMESPACE_START #endif #ifdef RIM_UTILITIES_NAMESPACE_END #undef RIM_UTILITIES_NAMESPACE_END #endif #endif // INCLUDE_RIM_UTILITIES_H <file_sep>/* * rimGraphicsGUIFonts.h * Rim Graphics GUI * * Created by <NAME> on 1/15/13. * Copyright 2013 Headspace Systems. All rights reserved. * */ #ifndef INCLUDE_RIM_GRAPHICS_GUI_FONTS_H #define INCLUDE_RIM_GRAPHICS_GUI_FONTS_H #include "fonts/rimGraphicsGUIFontsConfig.h" #include "fonts/rimGraphicsGUIFontInfo.h" #include "fonts/rimGraphicsGUIFontMetrics.h" #include "fonts/rimGraphicsGUIGlyphMetrics.h" #include "fonts/rimGraphicsGUIFont.h" #include "fonts/rimGraphicsGUIFontStyle.h" #include "fonts/rimGraphicsGUIGlyphLayout.h" #include "fonts/rimGraphicsGUIFontManager.h" #include "fonts/rimGraphicsGUIFontDrawer.h" #include "fonts/rimGraphicsGUIGraphicsFontDrawer.h" #endif // INCLUDE_RIM_GRAPHICS_GUI_FONTS_H <file_sep>/* * rimGraphicsGenericConstantBinding.h * Rim Graphics * * Created by <NAME> on 9/26/13. * Copyright 2013 __MyCompanyName__. All rights reserved. * */ #ifndef INCLUDE_RIM_GRAPHICS_GENERIC_CONSTANT_BINDING_H #define INCLUDE_RIM_GRAPHICS_GENERIC_CONSTANT_BINDING_H #include "rimGraphicsShadersConfig.h" #include "rimGraphicsConstantUsage.h" //########################################################################################## //*********************** Start Rim Graphics Shaders Namespace *************************** RIM_GRAPHICS_SHADERS_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// An object that encapsulates information about the binding of a constant to a name and usage. class GenericConstantBinding { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructors /// Create a new generic constant binding object with no name, UNDEFINED usage, and no value. RIM_INLINE GenericConstantBinding() : name(), usage( ConstantUsage::UNDEFINED ), value(), isInput( true ) { } /// Create a new generic constant binding object with the specified name, usage, and value. RIM_INLINE GenericConstantBinding( const String& newName, const ConstantUsage& newUsage ) : name( newName ), usage( newUsage ), value(), isInput( true ) { } /// Create a new generic constant binding object with the specified name, usage, and value. RIM_INLINE GenericConstantBinding( const String& newName, const AttributeValue& newValue, const ConstantUsage& newUsage, Bool newIsInput = true ) : name( newName ), usage( newUsage ), value( newValue ), isInput( newIsInput ) { } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Binding Name Accessor Methods /// Return a string representing the name of the constant binding. RIM_INLINE const String& getName() const { return name; } /// Set a string representing the name of the constant binding. RIM_INLINE void setName( const String& newName ) { name = newName; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Binding Usage Accessor Methods /// Return an enum value indicating the semantic usage of this constant binding. RIM_INLINE const ConstantUsage& getUsage() const { return usage; } /// Set an enum value indicating the semantic usage of this constant binding. RIM_INLINE void setUsage( const ConstantUsage& newUsage ) { usage = newUsage; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constant Binding Value Accessor Methods /// Return an object which contains the constant value for this constant binding. RIM_INLINE AttributeValue& getValue() { return value; } /// Return an object which contains the constant value for this constant binding. RIM_INLINE const AttributeValue& getValue() const { return value; } /// Set an object which contains the constant value for this constant binding. RIM_INLINE void setValue( const AttributeValue& newValue ) { value = newValue; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Input Status Accessor Methods /// Return whether or not this constant binding is a dynamic input to a shader pass. /** * If so, the renderer can provide dynamic scene information for this binding * (such as nearby lights, textures, etc) that aren't explicitly part of this * binding. By default, all bindings are inputs. */ RIM_INLINE Bool getIsInput() const { return isInput; } /// Set whether or not this constant binding is a dynamic input to a shader pass. /** * If so, the renderer can provide dynamic scene information for this binding * (such as nearby lights, textures, etc) that aren't explicitly part of this * binding. */ RIM_INLINE void setIsInput( Bool newInput ) { isInput = newInput; } private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Members /// A string representing the name of the constant binding. String name; /// An enum value indicating the semantic usage of this constant binding. ConstantUsage usage; /// An object which contains the constant value for this constant binding. AttributeValue value; /// A boolean value indicating whether or not this binding represents a dynamic input. Bool isInput; }; //########################################################################################## //*********************** End Rim Graphics Shaders Namespace ***************************** RIM_GRAPHICS_SHADERS_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_GRAPHICS_GENERIC_CONSTANT_BINDING_H <file_sep>/* * rimResourceTranscoder.h * Rim Software * * Created by <NAME> on 2/24/14. * Copyright 2014 __MyCompanyName__. All rights reserved. * */ #ifndef INCLUDE_RIM_RESOURCE_TRANSCODER_H #define INCLUDE_RIM_RESOURCE_TRANSCODER_H #include "rimResourcesConfig.h" #include "rimResource.h" #include "rimResourceID.h" //########################################################################################## //************************** Start Rim Resources Namespace ******************************* RIM_RESOURCES_NAMESPACE_START //****************************************************************************************** //########################################################################################## class ResourceManager; //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class which defines the interface for other classes that load and save resource data. template < typename DataType > class ResourceTranscoder { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Destructor /// Destroy a resource transcoder and release all of its resources. virtual ~ResourceTranscoder() { } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Resource Format Accessor Methods /// Return an object which represents the resource type that this transcoder can read and write. virtual ResourceType getResourceType() const = 0; /// Return an object which represents the resource format that this transcoder can read and write. virtual ResourceFormat getResourceFormat() const = 0; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Encoding Methods /// Return whether or not this transcoder is able to encode the specified resource. virtual Bool canEncode( const DataType& resource ) const = 0; /// Save the specified resource object at the specified ID location. /** * The method returns whether or not the resource was successfully written. */ virtual Bool encode( const ResourceID& identifier, const DataType& resource ) = 0; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Decoding Methods /// Return whether or not the specified identifier refers to a valid resource for this transcoder. /** * If the identifier represents a valid resource, TRUE is returned. Otherwise, * if the resource is not valid, FALSE is returned. */ virtual Bool canDecode( const ResourceID& identifier ) const = 0; /// Load the resource pointed to by the specified identifier. /** * The caller can supply a pointer to a resource manager which can be used * to manage the creation of child resources. * * If the method fails, the return value will be NULL. */ virtual lang::Pointer<DataType> decode( const ResourceID& identifier, ResourceManager* manager = NULL ) = 0; }; //########################################################################################## //************************** End Rim Resources Namespace ********************************* RIM_RESOURCES_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_RESOURCE_TRANSCODER_H <file_sep>/* * rimGraphicsGUIKnobDelegate.h * Rim Graphics GUI * * Created by <NAME> on 2/17/13. * Copyright 2013 Headspace Systems. All rights reserved. * */ #ifndef INCLUDE_RIM_GRAPHICS_GUI_KNOB_DELEGATE_H #define INCLUDE_RIM_GRAPHICS_GUI_KNOB_DELEGATE_H #include "rimGraphicsGUIConfig.h" //########################################################################################## //************************ Start Rim Graphics GUI Namespace ****************************** RIM_GRAPHICS_GUI_NAMESPACE_START //****************************************************************************************** //########################################################################################## class Knob; //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class which contains function objects that recieve Knob events. /** * Any knob-related event that might be processed has an appropriate callback * function object. Each callback function is called by the knob * whenever such an event is received. If a callback function in the delegate * is not initialized, a knob simply ignores it. */ class KnobDelegate { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Knob Delegate Callback Functions /// A function object which is called whenever an attached knob has started to be changed by the user. Function<void ( Knob& knob )> startEdit; /// A function object which is called whenever an attached knob has finished being changed by the user. Function<void ( Knob& knob )> endEdit; /// A function object which is called whenever an attached knob is changed by the user. /** * The delegate function has the option to allow or disallow the change to the * slider's value by returning TRUE to allow or FALSE to not allow the change. */ Function<Bool ( Knob& knob, Float newValue )> edit; }; //########################################################################################## //************************ End Rim Graphics GUI Namespace ******************************** RIM_GRAPHICS_GUI_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_GRAPHICS_GUI_KNOB_DELEGATE_H <file_sep>/* * rimGraphicsGUIObjectFlags.h * Rim Software * * Created by <NAME> on 11/2/14. * Copyright 2014 __MyCompanyName__. All rights reserved. * */ #ifndef INCLUDE_RIM_GRAPHICS_GUI_OBJECT_FLAGS_H #define INCLUDE_RIM_GRAPHICS_GUI_OBJECT_FLAGS_H #include "rimGraphicsGUIConfig.h" //########################################################################################## //************************ Start Rim Graphics GUI Namespace ****************************** RIM_GRAPHICS_GUI_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class which encapsulates the different boolean flags that a GUI object can have. /** * These flags provide boolean information about a certain GUI object. Flags * are indicated by setting a single bit of a 32-bit unsigned integer to 1. * * Enum values for the different flags are defined as members of the class. Typically, * the user would bitwise-OR the flag enum values together to produce a final set * of set flags. */ class GUIObjectFlags { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Graphics Object Flags Enum Declaration /// An enum which specifies the different GUI object flags. typedef enum Flag { /// A flag indicating that an object should be drawn. VISIBLE = (1 << 0), /// A flag indicating whether or not the object should clip child rendering to its bounds. CLIPPING = (1 << 1), /// A flag indicating that an object should be drawn with a shadow. SHADOW = (1 << 2), /// The default flags to use for a GUI object. DEFAULT = VISIBLE | CLIPPING, /// The flag value when all flags are not set. UNDEFINED = 0 }; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructors /// Create a new GUI object flags object with no flags set. RIM_INLINE GUIObjectFlags() : flags( UNDEFINED ) { } /// Create a new GUI object flags object with the specified flag value initially set. RIM_INLINE GUIObjectFlags( Flag flag ) : flags( flag ) { } /// Create a new GUI object flags object with the specified initial combined flags value. RIM_INLINE GUIObjectFlags( UInt32 newFlags ) : flags( newFlags ) { } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Integer Cast Operator /// Convert this GUI object flags object to an integer value. /** * This operator is provided so that the GUIObjectFlags object * can be used as an integer value for bitwise logical operations. */ RIM_INLINE operator UInt32 () const { return flags; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Flag Status Accessor Methods /// Return whether or not the specified flag value is set for this flags object. RIM_INLINE Bool isSet( Flag flag ) const { return (flags & flag) != UNDEFINED; } /// Set whether or not the specified flag value is set for this flags object. RIM_INLINE void set( Flag flag, Bool newIsSet ) { if ( newIsSet ) flags |= flag; else flags &= ~flag; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Flag String Accessor Methods /// Return the flag for the specified literal string representation. static Flag fromEnumString( const String& enumString ); /// Convert the specified flag to its literal string representation. static String toEnumString( Flag flag ); /// Convert the specified flag to human-readable string representation. static String toString( Flag flag ); private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Members /// A value indicating the flags that are set for a GUI object. UInt32 flags; }; //########################################################################################## //************************ End Rim Graphics GUI Namespace ******************************** RIM_GRAPHICS_GUI_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_GRAPHICS_GUI_OBJECT_FLAGS_H <file_sep>/* * rimRandomVariable.h * Rim Math * * Created by <NAME> on 5/8/08. * Copyright 2008 Rim Software. All rights reserved. * */ #ifndef INCLUDE_RIM_RANDOM_VARIABLE_H #define INCLUDE_RIM_RANDOM_VARIABLE_H #include "rimMathConfig.h" #include "../time/rimTime.h" //########################################################################################## //***************************** Start Rim Math Namespace ********************************* RIM_MATH_NAMESPACE_START //****************************************************************************************** //########################################################################################## template < typename T > class RandomVariable; //########################################################################################## //########################################################################################## //############ //############ Random Variable Class for the 'char' type //############ //########################################################################################## //########################################################################################## /// Random variable class for the char data type. template <> class RandomVariable<char> { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Seed Type Declaration /// The underlying type used to represent the random seed. typedef unsigned char SeedType; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructors /// Create a random variable with a default initial seed value. RIM_INLINE RandomVariable() : seed( (SeedType)time::Time::getCurrent().getNanoseconds() ) { } /// Create a random variable with the specified initial seed value. RIM_INLINE RandomVariable( SeedType newSeed ) : seed( newSeed ) { } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Sample Methods /// Generate a sample from the random variable and return the result. /** * The value returned may have any numerical value representable by the * random variable's data type. The pseudorandom values returned over * successive calls to this function will lie in a uniform distribution. */ RIM_INLINE char sample() { advanceSeed(); return seed; } /// Generate a sample from the random variable in the specified range. /** * The value returned can have any numerical value between and including * the minimum and maximum values specified. The pseudorandom values * returned over successive calls to this function will lie in a uniform * distribution. */ RIM_INLINE char sample( char min, char max ) { advanceSeed(); unsigned char uMin = *((unsigned char*)&min) + math::min<char>(); unsigned char uMax = *((unsigned char*)&max) - math::min<char>(); unsigned char a = (seed % (uMax - uMin + 1)) + *((unsigned char*)&min); return *((char*)&a); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Random Seed Accessor Methods /// Set the seed for the random variable. /** * After setting the seed for the random variable, calls to the sample() * methods will produce the same sequence of values for equal initial seed * values. */ RIM_INLINE void setSeed( SeedType newSeed ) { seed = newSeed; } /// Get the current state of the random variable. RIM_INLINE SeedType getSeed() const { return seed; } private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Seed Advance Method /// Advance the random variable's seed to its next value. RIM_INLINE void advanceSeed() { seed = (1664525*seed + 1013904223); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Member /// The current state of the random variable. SeedType seed; }; //########################################################################################## //########################################################################################## //############ //############ Random Variable Class for the 'unsigned char' type //############ //########################################################################################## //########################################################################################## /// Random variable class for the unsigned char data type. template <> class RandomVariable<unsigned char> { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Seed Type Declaration /// The underlying type used to represent the random seed. typedef unsigned char SeedType; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructors /// Create a random variable with a default initial seed value. RIM_INLINE RandomVariable() : seed( (SeedType)time::Time::getCurrent().getNanoseconds() ) { } /// Create a random variable with the specified initial seed value. RIM_INLINE RandomVariable( SeedType newSeed ) : seed( newSeed ) { } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Sample Methods /// Generate a sample from the random variable and return the result. /** * The value returned may have any numerical value representable by the * random variable's data type. The pseudorandom values returned over * successive calls to this function will lie in a uniform distribution. */ RIM_INLINE unsigned char sample() { advanceSeed(); return seed; } /// Generate a sample from the random variable in the specified range. /** * The value returned can have any numerical value between and including * the minimum and maximum values specified. The pseudorandom values * returned over successive calls to this function will lie in a uniform * distribution. */ RIM_INLINE unsigned char sample( unsigned char min, unsigned char max ) { advanceSeed(); return (seed % (max - min + 1)) + min; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Random Seed Accessor Methods /// Set the seed for the random variable. /** * After setting the seed for the random variable, calls to the sample() * methods will produce the same sequence of values for equal initial seed * values. */ RIM_INLINE void setSeed( SeedType newSeed ) { seed = newSeed; } /// Get the current state of the random variable. RIM_INLINE SeedType getSeed() const { return seed; } private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Seed Advance Method /// Advance the random variable's seed to its next value. RIM_INLINE void advanceSeed() { seed = (1664525*seed + 1013904223); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Member /// The current state of the random variable. SeedType seed; }; //########################################################################################## //########################################################################################## //############ //############ Random Variable Class for the 'short' type //############ //########################################################################################## //########################################################################################## /// Random variable class for the short data type. template <> class RandomVariable<short> { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Seed Type Declaration /// The underlying type used to represent the random seed. typedef unsigned short SeedType; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructors /// Create a random variable with a default initial seed value. RIM_INLINE RandomVariable() : seed( (SeedType)time::Time::getCurrent().getNanoseconds() ) { } /// Create a random variable with the specified initial seed value. RIM_INLINE RandomVariable( SeedType newSeed ) : seed( newSeed ) { } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Sample Methods /// Generate a sample from the random variable and return the result. /** * The value returned may have any numerical value representable by the * random variable's data type. The pseudorandom values returned over * successive calls to this function will lie in a uniform distribution. */ RIM_INLINE short sample() { advanceSeed(); return seed; } /// Generate a sample from the random variable in the specified range. /** * The value returned can have any numerical value between and including * the minimum and maximum values specified. The pseudorandom values * returned over successive calls to this function will lie in a uniform * distribution. */ RIM_INLINE short sample( short min, short max ) { advanceSeed(); unsigned short uMin = *((unsigned short*)&min) + math::min<short>(); unsigned short uMax = *((unsigned short*)&max) - math::min<short>(); unsigned short a = (seed % (uMax - uMin + 1)) + *((unsigned short*)&min); return *((short*)&a); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Random Seed Accessor Methods /// Set the seed for the random variable. /** * After setting the seed for the random variable, calls to the sample() * methods will produce the same sequence of values for equal initial seed * values. */ RIM_INLINE void setSeed( SeedType newSeed ) { seed = newSeed; } /// Get the current state of the random variable. RIM_INLINE SeedType getSeed() const { return seed; } private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Seed Advance Method /// Advance the random variable's seed to its next value. RIM_INLINE void advanceSeed() { seed = (1664525*seed + 1013904223); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Member /// The current state of the random variable. SeedType seed; }; //########################################################################################## //########################################################################################## //############ //############ Random Variable Class for the 'unsigned short' type //############ //########################################################################################## //########################################################################################## /// Random variable class for the unsigned short data type. template <> class RandomVariable<unsigned short> { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Seed Type Declaration /// The underlying type used to represent the random seed. typedef unsigned short SeedType; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructors /// Create a random variable with a default initial seed value. RIM_INLINE RandomVariable() : seed( (SeedType)time::Time::getCurrent().getNanoseconds() ) { } /// Create a random variable with the specified initial seed value. RIM_INLINE RandomVariable( SeedType newSeed ) : seed( newSeed ) { } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Sample Methods /// Generate a sample from the random variable and return the result. /** * The value returned may have any numerical value representable by the * random variable's data type. The pseudorandom values returned over * successive calls to this function will lie in a uniform distribution. */ RIM_INLINE unsigned short sample() { advanceSeed(); return seed; } /// Generate a sample from the random variable in the specified range. /** * The value returned can have any numerical value between and including * the minimum and maximum values specified. The pseudorandom values * returned over successive calls to this function will lie in a uniform * distribution. */ RIM_INLINE unsigned short sample( unsigned short min, unsigned short max ) { advanceSeed(); return (seed % (max - min + 1)) + min; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Random Seed Accessor Methods /// Set the seed for the random variable. /** * After setting the seed for the random variable, calls to the sample() * methods will produce the same sequence of values for equal initial seed * values. */ RIM_INLINE void setSeed( SeedType newSeed ) { seed = newSeed; } /// Get the current state of the random variable. RIM_INLINE SeedType getSeed() const { return seed; } private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Seed Advance Method /// Advance the random variable's seed to its next value. RIM_INLINE void advanceSeed() { seed = (1664525*seed + 1013904223); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Member /// The current state of the random variable. SeedType seed; }; //########################################################################################## //########################################################################################## //############ //############ Random Variable Class for the 'int' type //############ //########################################################################################## //########################################################################################## /// Random variable class for the int data type. template <> class RandomVariable<int> { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Seed Type Declaration /// The underlying type used to represent the random seed. typedef unsigned int SeedType; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructors /// Create a random variable with a default initial seed value. RIM_INLINE RandomVariable() : seed( (SeedType)time::Time::getCurrent().getNanoseconds() ) { } /// Create a random variable with the specified initial seed value. RIM_INLINE RandomVariable( SeedType newSeed ) : seed( newSeed ) { } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Sample Methods /// Generate a sample from the random variable and return the result. /** * The value returned may have any numerical value representable by the * random variable's data type. The pseudorandom values returned over * successive calls to this function will lie in a uniform distribution. */ RIM_INLINE int sample() { advanceSeed(); return seed; } /// Generate a sample from the random variable in the specified range. /** * The value returned can have any numerical value between and including * the minimum and maximum values specified. The pseudorandom values * returned over successive calls to this function will lie in a uniform * distribution. */ RIM_INLINE int sample( int min, int max ) { advanceSeed(); unsigned int uMin = *((unsigned int*)&min) + math::min<int>(); unsigned int uMax = *((unsigned int*)&max) - math::min<int>(); unsigned int a = (seed % (uMax - uMin + 1)) + *((unsigned int*)&min); return *((int*)&a); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Random Seed Accessor Methods /// Set the seed for the random variable. /** * After setting the seed for the random variable, calls to the sample() * methods will produce the same sequence of values for equal initial seed * values. */ RIM_INLINE void setSeed( SeedType newSeed ) { seed = newSeed; } /// Get the current state of the random variable. RIM_INLINE SeedType getSeed() const { return seed; } private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Seed Advance Method /// Advance the random variable's seed to its next value. RIM_INLINE void advanceSeed() { seed = (1664525*seed + 1013904223); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Member /// The current state of the random variable. SeedType seed; }; //########################################################################################## //########################################################################################## //############ //############ Random Variable Class for the 'unsigned int' type //############ //########################################################################################## //########################################################################################## /// Random variable class for the unsigned int data type. template <> class RandomVariable<unsigned int> { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Seed Type Declaration /// The underlying type used to represent the random seed. typedef unsigned int SeedType; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructors /// Create a random variable with a default initial seed value. RIM_INLINE RandomVariable() : seed( (SeedType)time::Time::getCurrent().getNanoseconds() ) { } /// Create a random variable with the specified initial seed value. RIM_INLINE RandomVariable( SeedType newSeed ) : seed( newSeed ) { } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Sample Methods /// Generate a sample from the random variable and return the result. /** * The value returned may have any numerical value representable by the * random variable's data type. The pseudorandom values returned over * successive calls to this function will lie in a uniform distribution. */ RIM_INLINE unsigned int sample() { advanceSeed(); return seed; } /// Generate a sample from the random variable in the specified range. /** * The value returned can have any numerical value between and including * the minimum and maximum values specified. The pseudorandom values * returned over successive calls to this function will lie in a uniform * distribution. */ RIM_INLINE unsigned int sample( unsigned int min, unsigned int max ) { advanceSeed(); return (seed % (max - min + 1)) + min; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Random Seed Accessor Methods /// Set the seed for the random variable. /** * After setting the seed for the random variable, calls to the sample() * methods will produce the same sequence of values for equal initial seed * values. */ RIM_INLINE void setSeed( SeedType newSeed ) { seed = newSeed; } /// Get the current state of the random variable. RIM_INLINE SeedType getSeed() const { return seed; } private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Seed Advance Method /// Advance the random variable's seed to its next value. RIM_INLINE void advanceSeed() { seed = (1664525*seed + 1013904223); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Member /// The current state of the random variable. SeedType seed; }; //########################################################################################## //########################################################################################## //############ //############ Random Variable Class for the 'long' type //############ //########################################################################################## //########################################################################################## /// Random variable class for the long data type. template <> class RandomVariable<long> { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Seed Type Declaration /// The underlying type used to represent the random seed. typedef unsigned long SeedType; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructors /// Create a random variable with a default initial seed value. RIM_INLINE RandomVariable() : seed( (SeedType)time::Time::getCurrent().getNanoseconds() ) { } /// Create a random variable with the specified initial seed value. RIM_INLINE RandomVariable( SeedType newSeed ) : seed( newSeed ) { } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Sample Methods /// Generate a sample from the random variable and return the result. /** * The value returned may have any numerical value representable by the * random variable's data type. The pseudorandom values returned over * successive calls to this function will lie in a uniform distribution. */ RIM_INLINE long sample() { advanceSeed(); return seed; } /// Generate a sample from the random variable in the specified range. /** * The value returned can have any numerical value between and including * the minimum and maximum values specified. The pseudorandom values * returned over successive calls to this function will lie in a uniform * distribution. */ RIM_INLINE long sample( long min, long max ) { advanceSeed(); unsigned long uMin = *((unsigned long*)&min) + math::min<long>(); unsigned long uMax = *((unsigned long*)&max) - math::min<long>(); unsigned long a = (seed % (uMax - uMin + 1)) + *((unsigned long*)&min); return *((long*)&a); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Random Seed Accessor Methods /// Set the seed for the random variable. /** * After setting the seed for the random variable, calls to the sample() * methods will produce the same sequence of values for equal initial seed * values. */ RIM_INLINE void setSeed( SeedType newSeed ) { seed = newSeed; } /// Get the current state of the random variable. RIM_INLINE SeedType getSeed() const { return seed; } private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Seed Advance Method /// Advance the random variable's seed to its next value. RIM_INLINE void advanceSeed() { seed = (1664525*seed + 1013904223); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Member /// The current state of the random variable. SeedType seed; }; //########################################################################################## //########################################################################################## //############ //############ Random Variable Class for the 'unsigned long' type //############ //########################################################################################## //########################################################################################## /// Random variable class for the unsigned long data type. template <> class RandomVariable<unsigned long> { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Seed Type Declaration /// The underlying type used to represent the random seed. typedef unsigned long SeedType; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructors /// Create a random variable with a default initial seed value. RIM_INLINE RandomVariable() : seed( (SeedType)time::Time::getCurrent().getNanoseconds() ) { } /// Create a random variable with the specified initial seed value. RIM_INLINE RandomVariable( SeedType newSeed ) : seed( newSeed ) { } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Sample Methods /// Generate a sample from the random variable and return the result. /** * The value returned may have any numerical value representable by the * random variable's data type. The pseudorandom values returned over * successive calls to this function will lie in a uniform distribution. */ RIM_INLINE unsigned long sample() { advanceSeed(); return seed; } /// Generate a sample from the random variable in the specified range. /** * The value returned can have any numerical value between and including * the minimum and maximum values specified. The pseudorandom values * returned over successive calls to this function will lie in a uniform * distribution. */ RIM_INLINE unsigned long sample( unsigned long min, unsigned long max ) { advanceSeed(); return (seed % (max - min + 1)) + min; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Random Seed Accessor Methods /// Set the seed for the random variable. /** * After setting the seed for the random variable, calls to the sample() * methods will produce the same sequence of values for equal initial seed * values. */ RIM_INLINE void setSeed( SeedType newSeed ) { seed = newSeed; } /// Get the current state of the random variable. RIM_INLINE SeedType getSeed() const { return seed; } private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Seed Advance Method /// Advance the random variable's seed to its next value. RIM_INLINE void advanceSeed() { seed = (1664525*seed + 1013904223); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Member /// The current state of the random variable. SeedType seed; }; //########################################################################################## //########################################################################################## //############ //############ Random Variable Class for the 'long long' type //############ //########################################################################################## //########################################################################################## /// Random variable class for the long long data type. template <> class RandomVariable<long long> { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Seed Type Declaration /// The underlying type used to represent the random seed. typedef unsigned long long SeedType; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructors /// Create a random variable with a default initial seed value. RIM_INLINE RandomVariable() : seed( (SeedType)time::Time::getCurrent().getNanoseconds() ) { } /// Create a random variable with the specified initial seed value. RIM_INLINE RandomVariable( SeedType newSeed ) : seed( newSeed ) { } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Sample Methods /// Generate a sample from the random variable and return the result. /** * The value returned may have any numerical value representable by the * random variable's data type. The pseudorandom values returned over * successive calls to this function will lie in a uniform distribution. */ RIM_INLINE long long sample() { advanceSeed(); return seed; } /// Generate a sample from the random variable in the specified range. /** * The value returned can have any numerical value between and including * the minimum and maximum values specified. The pseudorandom values * returned over successive calls to this function will lie in a uniform * distribution. */ RIM_INLINE long long sample( long long min, long long max ) { advanceSeed(); unsigned long long uMin = *((unsigned long long*)&min) + math::min<long long>(); unsigned long long uMax = *((unsigned long long*)&max) - math::min<long long>(); unsigned long long a = (seed % (uMax - uMin + 1)) + *((unsigned long long*)&min); return *((long long*)&a); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Random Seed Accessor Methods /// Set the seed for the random variable. /** * After setting the seed for the random variable, calls to the sample() * methods will produce the same sequence of values for equal initial seed * values. */ RIM_INLINE void setSeed( SeedType newSeed ) { seed = newSeed; } /// Get the current state of the random variable. RIM_INLINE SeedType getSeed() const { return seed; } private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Seed Advance Method /// Advance the random variable's seed to its next value. RIM_INLINE void advanceSeed() { seed = (1664525*seed + 1013904223); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Member /// The current state of the random variable. SeedType seed; }; //########################################################################################## //########################################################################################## //############ //############ Random Variable Class for the 'unsigned long long' type //############ //########################################################################################## //########################################################################################## /// Random variable class for the unsigned long long data type. template <> class RandomVariable<unsigned long long> { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Seed Type Declaration /// The underlying type used to represent the random seed. typedef unsigned long long SeedType; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructors /// Create a random variable with a default initial seed value. RIM_INLINE RandomVariable() : seed( (SeedType)time::Time::getCurrent().getNanoseconds() ) { } /// Create a random variable with the specified initial seed value. RIM_INLINE RandomVariable( SeedType newSeed ) : seed( newSeed ) { } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Sample Methods /// Generate a sample from the random variable and return the result. /** * The value returned may have any numerical value representable by the * random variable's data type. The pseudorandom values returned over * successive calls to this function will lie in a uniform distribution. */ RIM_INLINE unsigned long long sample() { advanceSeed(); return seed; } /// Generate a sample from the random variable in the specified range. /** * The value returned can have any numerical value between and including * the minimum and maximum values specified. The pseudorandom values * returned over successive calls to this function will lie in a uniform * distribution. */ RIM_INLINE unsigned long long sample( unsigned long long min, unsigned long long max ) { advanceSeed(); return (seed % (max - min + 1)) + min; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Random Seed Accessor Methods /// Set the seed for the random variable. /** * After setting the seed for the random variable, calls to the sample() * methods will produce the same sequence of values for equal initial seed * values. */ RIM_INLINE void setSeed( SeedType newSeed ) { seed = newSeed; } /// Get the current state of the random variable. RIM_INLINE SeedType getSeed() const { return seed; } private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Seed Advance Method /// Advance the random variable's seed to its next value. RIM_INLINE void advanceSeed() { seed = (1664525*seed + 1013904223); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Member /// The current state of the random variable. SeedType seed; }; //########################################################################################## //########################################################################################## //############ //############ Random Variable Class for the 'float' type //############ //########################################################################################## //########################################################################################## /// Random variable class for the float data type. template <> class RandomVariable<float> { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Seed Type Declaration /// The underlying type used to represent the random seed. typedef UInt32 SeedType; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructors /// Create a random variable with a default initial seed value. RIM_INLINE RandomVariable() : seed( (SeedType)time::Time::getCurrent().getNanoseconds() ) { } /// Create a random variable with the specified initial seed value. RIM_INLINE RandomVariable( SeedType newSeed ) : seed( newSeed ) { } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Sample Methods /// Generate a sample from the random variable and return the result. /** * The value returned may have any numerical value representable by the * random variable's data type. The pseudorandom values returned over * successive calls to this function will lie in a uniform distribution. */ RIM_INLINE float sample() { advanceSeed(); UInt32 a = (seed & UInt32(0x007FFFFF)) | UInt32(0x3F800000); return (*((float*)&a) - 1.5f)*2.0f*math::max<float>(); } /// Generate a sample from the random variable in the specified range. /** * The value returned can have any numerical value between and including * the minimum and maximum values specified. The pseudorandom values * returned over successive calls to this function will lie in a uniform * distribution. */ RIM_INLINE float sample( float min, float max ) { advanceSeed(); UInt32 a = (seed & UInt32(0x007FFFFF)) | UInt32(0x3F800000); return (*((float*)&a) - 1.0f)*(max - min) + min; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Random Seed Accessor Methods /// Set the seed for the random variable. /** * After setting the seed for the random variable, calls to the sample() * methods will produce the same sequence of values for equal initial seed * values. */ RIM_INLINE void setSeed( SeedType newSeed ) { seed = newSeed; } /// Get the current state of the random variable. RIM_INLINE SeedType getSeed() const { return seed; } private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Seed Advance Method /// Advance the random variable's seed to its next value. RIM_INLINE void advanceSeed() { seed = SeedType(1664525)*seed + SeedType(1013904223); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Member /// The current state of the random variable. SeedType seed; }; //########################################################################################## //########################################################################################## //############ //############ Random Variable Class for the 'double' type //############ //########################################################################################## //########################################################################################## /// Random variable class for the double data type. template <> class RandomVariable<double> { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Seed Type Declaration /// The underlying type used to represent the random seed. typedef UInt64 SeedType; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructors /// Create a random variable with a default initial seed value. RIM_INLINE RandomVariable() : seed( (SeedType)time::Time::getCurrent().getNanoseconds() ) { } /// Create a random variable with the specified initial seed value. RIM_INLINE RandomVariable( SeedType newSeed ) : seed( newSeed ) { } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Sample Methods /// Generate a sample from the random variable and return the result. /** * The value returned may have any numerical value representable by the * random variable's data type. The pseudorandom values returned over * successive calls to this function will lie in a uniform distribution. */ RIM_INLINE double sample() { advanceSeed(); UInt64 a = (seed & UInt64(0x000FFFFFFFFFFFFFull)) | UInt64(0x3FF0000000000000ull); return (*((double*)&a) - 1.5)*2.0*math::max<double>(); } /// Generate a sample from the random variable in the specified range. /** * The value returned can have any numerical value between and including * the minimum and maximum values specified. The pseudorandom values * returned over successive calls to this function will lie in a uniform * distribution. */ RIM_INLINE double sample( double min, double max ) { advanceSeed(); UInt64 a = (seed & UInt64(0x000FFFFFFFFFFFFFull)) | UInt64(0x3FF0000000000000ull); return (*((double*)&a) - 1.0)*(max - min) + min; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Random Seed Accessor Methods /// Set the seed for the random variable. /** * After setting the seed for the random variable, calls to the sample() * methods will produce the same sequence of values for equal initial seed * values. */ RIM_INLINE void setSeed( SeedType newSeed ) { seed = newSeed; } /// Get the current state of the random variable. RIM_INLINE SeedType getSeed() const { return seed; } private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Seed Advance Method /// Advance the random variable's seed to its next value. RIM_INLINE void advanceSeed() { seed = SeedType(1664525)*seed + SeedType(1013904223); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Member /// The current state of the random variable. SeedType seed; }; //########################################################################################## //########################################################################################## //############ //############ Global Random Number Generation Methods //############ //########################################################################################## //########################################################################################## template < typename T > RIM_INLINE static RandomVariable<T>& getGlobalRandomVariable() { static RandomVariable<T> randomVariable; return randomVariable; } template < typename T > RIM_INLINE T random() { return getGlobalRandomVariable<T>().sample(); } template < typename T > RIM_INLINE T random( T min, T max ) { return getGlobalRandomVariable<T>().sample( min, max ); } template < typename T > RIM_INLINE void setRandomSeed( T newSeed ) { getGlobalRandomVariable<T>().setSeed( *(typename RandomVariable<T>::SeedType*)(&newSeed) ); } //########################################################################################## //***************************** End Rim Math Namespace *********************************** RIM_MATH_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_RANDOM_VARIABLE_H <file_sep>/* * rimImage.h * Rim Images * * Created by <NAME> on 11/8/10. * Copyright 2010 Rim Software. All rights reserved. * */ #ifndef INCLUDE_RIM_IMAGE_H #define INCLUDE_RIM_IMAGE_H #include "rimImagesConfig.h" #include "rimPixelFormat.h" //########################################################################################## //**************************** Start Rim Images Namespace ******************************** RIM_IMAGES_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class representing packed image pixel data stored in main memory. /** * This class uses internal reference counting for the image's pixel * memory, allowing an instance of Image to be used as a value type * without significant performance penalties. */ class Image { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructors /// Create an image with no pixel data and an UNDEFINED pixel type. RIM_INLINE Image() : pixelData(), pixelType( PixelFormat::UNDEFINED ), numDimensions( 0 ) { size[0] = size[1] = size[2] = 0; } /// Create a 1D image object with the specified pixel data, pixel type and width. RIM_INLINE Image( const Data& newPixelData, const PixelFormat& newPixelFormat, Size width ) : pixelData( newPixelData ), pixelType( newPixelFormat ), numDimensions( 1 ) { size[0] = width; size[1] = 1; size[2] = 1; } /// Create a 2D image object with the specified pixel data, pixel type, width and height. RIM_INLINE Image( const Data& newPixelData, const PixelFormat& newPixelFormat, Size width, Size height ) : pixelData( newPixelData ), pixelType( newPixelFormat ), numDimensions( 2 ) { size[0] = width; size[1] = height; size[2] = 1; } /// Create a 3D image object with the specified pixel data, pixel type, width, height and depth. RIM_INLINE Image( const Data& newPixelData, const PixelFormat& newPixelFormat, Size width, Size height, Size depth ) : pixelData( newPixelData ), pixelType( newPixelFormat ), numDimensions( 3 ) { size[0] = width; size[1] = height; size[2] = depth; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Size Accessor Methods /// Return the width of this image (size along dimension 0). /** * If an image has no width, 0 is returned. */ RIM_INLINE Size getWidth() const { return size[0]; } /// Return the height of this image (size along dimension 1). /** * If an image has no height, 0 is returned. This can happen if * this image is a 1-dimensional image. */ RIM_INLINE Size getHeight() const { return size[1]; } /// Return the depth of this image (size along dimension 2). /** * If an image has no depth, 0 is returned. This can happen if * this image is a 1D or 2D image. */ RIM_INLINE Size getDepth() const { return size[2]; } /// Get the size of the image along the specified dimension index. /** * Indices start from 0 and count to d-1 for a image with d dimensions. * If the specified dimension index is out of bounds, 1 is returned. */ RIM_INLINE Size getSize( Index dimension ) const { return dimension < numDimensions ? size[dimension] : 1; } /// Get the total number of pixels in the image. RIM_INLINE Size getPixelCount() const { Size numPixels = size[0]; for ( Index i = 1; i < numDimensions; i++ ) numPixels *= size[i]; return numPixels; } /// Get the number of dimensions in this image, usually 1, 2, or 3. /** * This number is defined as the highest dimension where the image's * size is greater than 1 pixel. */ RIM_FORCE_INLINE Size getDimensionCount() const { return numDimensions; } /// Return the maximum number of dimenions that an image can support (usually 3). RIM_INLINE static Size getMaxNumberOfDimensions() { return MAX_DIMENSION_COUNT; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Image Data Accessor Methods /// Return a reference to an object which holds the pixel data for this image. RIM_FORCE_INLINE const Data& getPixelData() const { return pixelData; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Image Pixel Type Accessor Method /// Get the type of the image's pixels. RIM_FORCE_INLINE const PixelFormat& getPixelFormat() const { return pixelType; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Image Validity Accessor Method /// Return whether or not this image has data that matches the image's pixel type. RIM_INLINE Bool isValid() const { // Compute the necessary size in bytes of the image. Size imageSizeInBytes = this->getPixelCount()*pixelType.getSizeInBytes(); return pixelData.getSizeInBytes() == imageSizeInBytes; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Image Resizing Method /// Return a resized version of this image for the specified dimensions. Image resize( Size newWidth, Size newHeight = Size(1), Size newDepth = Size(1) ) const; private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Helper Methods template < Size numChannels > static void resize2DImage( const void* pixels, Size width, Size height, void* output, Size newWidth, Size newHeight, const PixelFormat& pixelType ); template < typename ChannelType, Size numChannels > static void resize2DImage( const ChannelType* pixels, Size width, Size height, ChannelType* output, Size newWidth, Size newHeight ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Static Data Members /// The maximum number of dimensions that an image can have. static const Size MAX_DIMENSION_COUNT = 3; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Members /// The pixel data, stored first by row, column, then pixel plane (depth). Data pixelData; /// The type of the image's pixels. PixelFormat pixelType; /// The dimensions of the image in pixels along each axis. /** * Index 0 corresponds to the image's width, 1 to the height, * 2 to the depth and so on. */ StaticArray<Size,MAX_DIMENSION_COUNT> size; /// The number of dimensions that this image has. Size numDimensions; }; //########################################################################################## //**************************** End Rim Images Namespace ********************************** RIM_IMAGES_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_IMAGE_H <file_sep>/* * rimPhysicsInertiaTensor.h * Rim Physics * * Created by <NAME> on 6/6/12. * Copyright 2012 __MyCompanyName__. All rights reserved. * */ #ifndef INCLUDE_RIM_PHYSICS_INERTIA_TENSOR_H #define INCLUDE_RIM_PHYSICS_INERTIA_TENSOR_H #include "rimPhysicsUtilitiesConfig.h" //########################################################################################## //********************** Start Rim Physics Utilities Namespace *************************** RIM_PHYSICS_UTILITIES_NAMESPACE_START //****************************************************************************************** //########################################################################################## /// Transform an inertia tensor for an object with a given mass by the specified translation. template < typename T > RIM_INLINE Matrix3D<T> transformInertiaTensor( const Matrix3D<T>& I, T mass, const Vector3D<T>& translation ) { // Translate matrix using the 3D parallel axis theorem. return Matrix3D<T>( I.x.x + mass*( translation.y*translation.y + translation.z*translation.z ), I.y.x - mass*translation.x*translation.y, I.z.x - mass*translation.x*translation.z, I.x.y - mass*translation.y*translation.x, I.y.y + mass*( translation.z*translation.z + translation.x*translation.x ), I.z.y - mass*translation.y*translation.z, I.x.z - mass*translation.z*translation.x, I.y.z - mass*translation.z*translation.y, I.z.z + mass*( translation.y*translation.y + translation.z*translation.z ) ); } /// Transform an inertia tensor by the specified rotation matrix. template < typename T > RIM_INLINE Matrix3D<T> transformInertiaTensor( const Matrix3D<T>& I, const Matrix3D<T>& orientation ) { return orientation*I*orientation.transpose(); } /// Transform an inertia tensor for an object with a given mass by the specified orientation and translation. template < typename T > RIM_INLINE Matrix3D<T> transformInertiaTensor( const Matrix3D<T>& I, T mass, const Matrix3D<T>& orientation, const Vector3D<T>& translation ) { // rotate, then translate matrix return transformInertiaTensor( transformInertiaTensor( I, orientation ), mass, translation ); } //########################################################################################## //********************** End Rim Physics Utilities Namespace ***************************** RIM_PHYSICS_UTILITES_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_PHYSICS_INERTIA_TENSOR_H <file_sep>/* * rimGraphicsBuffersConfig.h * Rim Graphics * * Created by <NAME> on 11/28/11. * Copyright 2011 __MyCompanyName__. All rights reserved. * */ #ifndef INCLUDE_RIM_GRAPHICS_BUFFERS_CONFIG_H #define INCLUDE_RIM_GRAPHICS_BUFFERS_CONFIG_H #include "../rimGraphicsConfig.h" #include "../rimGraphicsUtilities.h" #include "../devices/rimGraphicsContextObject.h" //########################################################################################## //########################################################################################## //############ //############ Library Namespace Configuration //############ //########################################################################################## //########################################################################################## #ifndef RIM_GRAPHICS_BUFFERS_NAMESPACE_START #define RIM_GRAPHICS_BUFFERS_NAMESPACE_START RIM_GRAPHICS_NAMESPACE_START namespace buffers { #endif #ifndef RIM_GRAPHICS_BUFFERS_NAMESPACE_END #define RIM_GRAPHICS_BUFFERS_NAMESPACE_END }; RIM_GRAPHICS_NAMESPACE_END #endif //########################################################################################## //*********************** Start Rim Graphics Buffers Namespace *************************** RIM_GRAPHICS_BUFFERS_NAMESPACE_START //****************************************************************************************** //########################################################################################## using rim::graphics::util::AttributeType; using rim::graphics::util::AttributeValue; using rim::graphics::devices::ContextObject; //########################################################################################## //*********************** End Rim Graphics Buffers Namespace ***************************** RIM_GRAPHICS_BUFFERS_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_GRAPHICS_BUFFERS_CONFIG_H <file_sep>/* * rimImageEncodingParameters.h * Rim Images * * Created by <NAME> on 5/14/12. * Copyright 2012 __MyCompanyName__. All rights reserved. * */ #ifndef INCLUDE_RIM_IMAGE_ENCODING_PARAMETERS_H #define INCLUDE_RIM_IMAGE_ENCODING_PARAMETERS_H #include "rimImageIOConfig.h" //########################################################################################## //*************************** Start Rim Image IO Namespace ******************************* RIM_IMAGE_IO_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class which specifies how an image should be encoded. class ImageEncodingParameters { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructor /// Create a set of image encoding parameters with the default values. RIM_INLINE ImageEncodingParameters() : compression( 0 ), isInterlaced( false ) { } /// Create a set of image encoding parameters with the the specified compression value. RIM_INLINE ImageEncodingParameters( Float newCompression ) : compression( newCompression ), isInterlaced( false ) { } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Compression Amount Accessor Methods /// Return a floating point value between 0 and 1 indicating the amount of compression to use. /** * If an image type supports compression, this value will determine the * amount of compression that is used. A value of 0 indicates no compression * or the lowest amount of compression and a value of 1 indicates that maximum * compression is desired. If the image type does not support compression, * this value is ignored. The default value is 0, indicating that no compression * should be used. */ RIM_INLINE Float getCompression() const { return compression; } /// Set a value between 0 and 1 indicating the amount of compression to use. /** * If an image type supports compression, this value will determine the * amount of compression that is used. A value of 0 indicates no compression * or the lowest amount of compression and a value of 1 indicates that maximum * compression is desired. If the image type does not support compression, * this value is ignored. The default value is 0, indicating that no compression * should be used. The input value is clamped to the range of 0 to 1. */ RIM_INLINE void setCompression( Float newCompression ) { compression = math::clamp( newCompression, Float(0), Float(1) ); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Interlace Type Accessor Methods /// Return whether or not the image should be encoded with interlaced scanlines. RIM_INLINE Bool getIsInterlaced() const { return isInterlaced; } /// Return whether or not the image should be encoded with interlaced scanlines. RIM_INLINE void setIsInterlaced( Bool newIsInterlaced ) { isInterlaced = newIsInterlaced; } private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Members /// A value ranging from 0 to 1, indicating the amount of image compression to use. /** * If an image type supports compression, this value will determine the * amount of compression that is used. A value of 0 indicates no compression * or the lowest amount of compression and a value of 1 indicates that maximum * compression is desired. If the image type does not support compression, * this value is ignored. The default value is 0, indicating that no compression * should be used. */ Float compression; /// Whether or not the image should be interlaced. Bool isInterlaced; }; //########################################################################################## //*************************** End Rim Image IO Namespace ********************************* RIM_IMAGE_IO_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_IMAGE_ENCODING_PARAMETERS_H <file_sep>/* * rimSoundSampleType.h * Rim Sound * * Created by <NAME> on 6/7/08. * Copyright 2008 Rim Software. All rights reserved. * */ #ifndef INCLUDE_RIM_SOUND_SAMPLE_TYPE_H #define INCLUDE_RIM_SOUND_SAMPLE_TYPE_H #include "rimSoundUtilitiesConfig.h" //########################################################################################## //*********************** Start Rim Sound Utilities Namespace **************************** RIM_SOUND_UTILITIES_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// An enum wrapper class which specifies the type of a sample of audio data. /** * In addition to providing conversion operator to and from the underlying enum type, * the class also provides a way to query the size in bytes of a given sample type, * avoiding the need for an external switch statement. */ class SampleType { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Sample Type Enum Definition /// The underlying enum type which specifies the type of a sample of audio data. typedef enum Enum { /// An 8-bit signed integer sample, stored in native endian format. SAMPLE_8, /// A 16-bit signed integer sample, stored in native endian format. SAMPLE_16, /// A 24-bit signed integer sample, stored in native endian format. SAMPLE_24, /// A 32-bit signed integer sample, stored in native endian format. SAMPLE_32, /// A 64-bit signed integer sample, stored in native endian format. SAMPLE_64, /// A 32-bit floating point sample, stored in native endian format. SAMPLE_32F, /// A 64-bit floating point sample, stored in native endian format. SAMPLE_64F, /// An undefined/unsupported sample type. UNDEFINED }; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructors /// Create a new sample type with the undefined sample type enum value. RIM_INLINE SampleType() : type( UNDEFINED ) { } /// Create a new sample type with the specified sample type enum value. RIM_INLINE SampleType( Enum newType ) : type( newType ) { } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Enum Cast Operator /// Convert this sample type to an enum value. /** * This operator is provided so that the SampleType object can be used * directly in a switch statement without the need to explicitly access * the underlying enum value. * * @return the enum representation of this sample type. */ RIM_INLINE operator Enum () const { return type; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Sample Size Accessor Methods /// Get the size in bytes that this sample type occupies. RIM_INLINE Size getSizeInBytes() const { switch ( type ) { case SAMPLE_8: return 1; case SAMPLE_16: return 2; case SAMPLE_24: return 3; case SAMPLE_32: case SAMPLE_32F: return 4; case SAMPLE_64: case SAMPLE_64F: return 8; default: return 0; } } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Sample Type Accessor Methods /// Return whether or not this sample type is an integer-based sample type. RIM_INLINE Bool isIntegral() const { switch ( type ) { case SAMPLE_8: case SAMPLE_16: case SAMPLE_24: case SAMPLE_32: case SAMPLE_64: return true; default: return false; } } /// Return whether or not this sample type is a floating-point-based sample type. RIM_INLINE Bool isFloatingPoint() const { switch ( type ) { case SAMPLE_32F: case SAMPLE_64F: return true; default: return false; } } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** String Representation Accessor Methods /// Return a string representation of the sample type. data::String toString() const; /// Convert this sample type into a string representation. RIM_INLINE operator data::String () const { return this->toString(); } private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Members /// The underlying enum representing the type of sample for this SampleType object. Enum type; }; //########################################################################################## //*********************** End Rim Sound Utilities Namespace ****************************** RIM_SOUND_UTILITIES_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_SOUND_SAMPLE_TYPE_H <file_sep>/* * rimSimpleDemo.h * Rim Software * * Created by <NAME> on 12/16/13. * Copyright 2013 __MyCompanyName__. All rights reserved. * */ #ifndef INCLUDE_RIM_ENGINE_SIMPLE_DEMO_H #define INCLUDE_RIM_ENGINE_SIMPLE_DEMO_H #include "rimEngineConfig.h" //########################################################################################## //*************************** Start Rim Engine Namespace ********************************* RIM_ENGINE_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A simple demo application with a single window, basic key/mouse input, and drawing. /** * This class provides basic functionality needed for simple demo applications * where quick prototyping is important. */ class SimpleDemo { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Delegate Class Declaration /// A class which represents a set of delegate methods for demo event handling. class Delegate { public: /// A delegate method that is called when the demo should be initialized. Function<Bool ( const Pointer<GraphicsContext>& )> initialize; /// A delegate method that is called when the demo should be cleaned up. Function<void ()> deinitialize; /// A delegate method that is called when the demo view should be drawn. Function<void ( const Pointer<GraphicsContext>& )> draw; /// A delegate method that is called when the demo view should be resized. Function<void ( const Size2D& )> resize; /// A delegate method that is called when a keyboard event is received. Function<void ( const KeyboardEvent& )> keyEvent; /// A delegate method that is called when a mouse button event is received. Function<void ( const MouseButtonEvent& )> mouseButtonEvent; /// A delegate method that is called when a mouse wheel event is received. Function<void ( const MouseWheelEvent& )> mouseWheelEvent; /// A delegate method that is called when a mouse motion event is received. Function<void ( const MouseMotionEvent& )> mouseMotionEvent; }; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructors /// Create a new simple demo with the name "Simple Demo" and window size 1024x768. SimpleDemo(); /// Create a new simple demo with the specified name and window size. SimpleDemo( const UTF8String& newName, const Size2D& newWindowSize ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Destructor virtual ~SimpleDemo(); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Run Methods /// Run this demo. virtual void run(); /// Stop running this demo. void stop(); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Demo State Accessor Methods /// Return whether or not the demo is currently running. RIM_INLINE Bool getIsRunning() const { return isRunning; } /// Set whether or not the demo should be running. RIM_INLINE void setIsRunning( Bool newIsRunning ) { isRunning = newIsRunning; } /// Return whether or not the demo is currently paused. RIM_INLINE Bool getIsPaused() const { return isPaused; } /// Set whether or not the demo should be paused. RIM_INLINE void setIsPaused( Bool newIsPaused ) { isPaused = newIsPaused; } /// Return whether or not the demo is currently fullscreen. RIM_INLINE Bool getIsFullscreen() const { return isFullscreen; } /// Set whether or not the demo should be fullscreen. RIM_INLINE void setIsFullscreen( Bool newIsFullscreen ) { isFullscreen = newIsFullscreen; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Graphics Context Accessor Methods /// Return a pointer to the graphics context which this simple demo is using. /** * If the demo has not yet been started or the context was not able to be * created, this method returns NULL. */ RIM_INLINE const Pointer<GraphicsContext>& getContext() const { return graphicsContext; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Graphics Converter Accessor Methods /// Return a pointer to the graphics converter which this simple demo is using. /** * If the demo has not yet been started or the context was not able to be * created, this method returns NULL. */ RIM_INLINE const Pointer<GraphicsConverter>& getGraphicsConverter() const { return graphicsConverter; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Resource Manager Accessor Methods /// Return a pointer to the resource manager which this simple demo is using. /** * If the demo has not yet been started this method returns NULL. */ RIM_INLINE const Pointer<ResourceManager>& getResourceManager() const { return resourceManager; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Keyboard Accessor Methods /// Return a pointer to the keyboard state for this demo. RIM_INLINE const Pointer<Keyboard>& getKeyboard() const { return keyboard; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Delegate Accessor Methods /// Return the total number of delegate objects that are responding to events for this demo. RIM_INLINE Size getDelegateCount() const { return delegates.getSize(); } /// Return a pointer to the delegate at the specified index. /** * The method returns NULL if the specified delegate index is invalid. */ RIM_INLINE const Delegate* getDelegate( Index delegateIndex ) const { if ( delegateIndex < delegates.getSize() ) return &delegates[delegateIndex]; else return NULL; } /// Return a pointer to the delegate at the specified index. /** * The method returns NULL if the specified delegate index is invalid. */ RIM_INLINE Delegate* getDelegate( Index delegateIndex ) { if ( delegateIndex < delegates.getSize() ) return &delegates[delegateIndex]; else return NULL; } /// Add a new delegate to this demo. /** * The method returns the index of the new delegate. */ RIM_INLINE Index addDelegate( const Delegate& newDelegate ) { Index delegateIndex = delegates.getSize(); delegates.add( newDelegate ); return delegateIndex; } /// Remove all delegates from this simple demo. RIM_INLINE void clearDelegates() { delegates.clear(); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Engine Accessor Methods /// Return a reference to the entity engine for this demo. RIM_INLINE EntityEngine& getEngine() { return engine; } /// Return a reference to the entity engine for this demo. RIM_INLINE const EntityEngine& getEngine() const { return engine; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Frame Time Accessor Methods /// Return the total time that it took to update the last frame. RIM_INLINE const Time& getLastUpdateTime() const { return lastUpdateTime; } /// Return the total time that it took to draw the last frame. RIM_INLINE const Time& getLastDrawTime() const { return lastDrawTime; } /// Return the total time that it took to complete the last frame. RIM_INLINE const Time& getLastFrameTime() const { return lastFrameTime; } /// Return current average frames per second for the demo. RIM_INLINE Double getCurrentFPS() const { return currentFPS; } protected: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Protected Delegate Methods virtual Bool initialize( const Pointer<GraphicsContext>& context ); virtual void deinitialize(); virtual void update( const Time& dt ); virtual void draw( const Pointer<GraphicsContext>& context ); virtual void resize( const Size2D& newSize ); virtual void keyEvent( const KeyboardEvent& event ); virtual void mouseButtonEvent( const MouseButtonEvent& event ); virtual void mouseWheelEvent( const MouseWheelEvent& event ); virtual void mouseMotionEvent( const MouseMotionEvent& event ); private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Demo Methods Bool initializeGUI(); void deinitializeGUI(); Bool initializeGraphics(); void deinitializeGraphics(); /// Update the render view so that it has the current fullscreen status. void updateFullscreen( Display& display ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Input Handling Methods Bool windowResize( Window& window, const Size2D& newSize ); Bool windowClose( Window& window ); Bool viewResize( RenderView& view, const Size2D& newSize ); void viewKeyEvent( RenderView& view, const KeyboardEvent& event ); void viewMouseButtonEvent( RenderView& view, const MouseButtonEvent& event ); void viewMouseWheelEvent( RenderView& view, const MouseWheelEvent& event ); void viewMouseMotionEvent( RenderView& view, const MouseMotionEvent& event ); void fullscreenItemSelect( MenuItem& item ); void pauseItemSelect( MenuItem& item ); void quitItemSelect( MenuItem& item ); /// Broadcast the input events synchronously to the delegates. void sendInputEvents(); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private GUI Data Members Pointer<Window> window; Pointer<RenderView> renderView; Pointer<MenuBar> menuBar; Pointer<Menu> mainMenu; /// An object which keeps track of the current keyboard state for this demo. Pointer<Keyboard> keyboard; /// A list of keyboard events queued to be synchronously sent to the demo delegates. ArrayList<KeyboardEvent> keyEvents; /// A list of mouse button events queued to be synchronously sent to the demo delegates. ArrayList<MouseButtonEvent> mouseButtonEvents; /// A list of mouse motion events queued to be synchronously sent to the demo delegates. ArrayList<MouseMotionEvent> mouseMotionEvents; /// A list of mouse wheel events queued to be synchronously sent to the demo delegates. ArrayList<MouseWheelEvent> mouseWheelEvents; Mutex inputMutex; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Graphics Data Members Pointer<GraphicsDevice> graphicsDevice; Pointer<GraphicsContext> graphicsContext; /// A pointer to a resource manager for this demo. Pointer<ResourceManager> resourceManager; /// A pointer to a graphics converter for this demo. Pointer<GraphicsConverter> graphicsConverter; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Members /// The entity engine for this demo. EntityEngine engine; /// A string representing the name for this demo. This is used as the window title. UTF8String demoName; /// The size in pixels of the content area of the window for this demo. Size2D windowSize; /// A list of delegates that receive events for this demo. ArrayList<Delegate> delegates; /// A timer which keeps track of the time that it takes to update the demo. Timer updateTimer; /// A timer which keeps track of the time that it takes to draw for the demo. Timer drawTimer; /// A timer which keeps track of the total time that it takes to complete a frame. Timer frameTimer; /// The time that it took to update the demo on the last frame. Time lastUpdateTime; /// The time that it took to draw the demo on the last frame. Time lastDrawTime; /// The total that it took to do the last frame. Time lastFrameTime; /// The current number of frames per second that this demo is running at. Double currentFPS; /// The size of the main display before it was changed. Size2D oldDisplaySize; /// A boolean value indicating whether or not this demo is currently running. Bool isRunning; /// A boolean value indicating whether or not this demo is currently paused. Bool isPaused; /// A boolean value indicating whether or not the demo is in fullscreen mode. Bool isFullscreen; /// A boolean value indicating whether or not the demo should change the display resolution when going fullscreen. Bool changeDisplayResolution; }; //########################################################################################## //*************************** End Rim Engine Namespace *********************************** RIM_ENGINE_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_ENGINE_SIMPLE_DEMO_H <file_sep>#pragma once #include "VehicleState.h" #include "AngularVelocity.h" #include "Orientation.h" #include "VehicleAttitudeHelpers.h" #include <vector> #include <map> #include "rim/rimEngine.h" //using namespace std; using namespace rim; using namespace rim::math; /* Global planner A* path optimization Author: <NAME> */ typedef std::vector<Vector3f> vertices; class Global_planner { public: //path cost to landmark float cost(Vector3f landmark, Vector3f start, std::map<Vector3f,Vector3f> parent ) { if(landmark == start) { return 0; } else { return (landmark.getDistanceTo(parent[landmark]) + cost(parent[landmark],start,parent)); } } //f_score for a landmark float costheur(Vector3f landmark, Vector3f start, Vector3f goal, std::map<Vector3f,Vector3f> parent) { return (cost(landmark, start, parent) + landmark.getDistanceTo(goal)); } //path reconstruction vertices reconstructpath(std::map<Vector3f,Vector3f> came,Vector3f current_node) { vertices pp; std::map<Vector3f,Vector3f>::iterator i1 = came.find(current_node); if (i1==came.end()) { pp.push_back(current_node); return pp; } else { pp = reconstructpath(came,came[current_node]); pp.push_back(current_node); return pp; } } //astar vertices astar(Vector3f start, Vector3f goal, std::map<Vector3f,vertices> rmap, vertices samples) { vertices openlist, closedlist; std::map<Vector3f,Vector3f> parent; std::map<Vector3f,float> tent_cost, tent_f; openlist.push_back(start); tent_cost[start] = 0; tent_f[start] = tent_cost[start] + start.getDistanceTo(goal); for(size_t a = 0; a < samples.size(); a++) { if(samples[a] != start) { tent_cost[samples[a]] = 50000000; tent_f[samples[a]] = tent_cost[samples[a]] + samples[a].getDistanceTo(goal); } } while(!openlist.empty()) { Vector3f current; float mincost = 50000000; size_t minid; for(size_t b = 0; b < openlist.size(); b++) { if(tent_f[openlist[b]] < mincost) { mincost = tent_f[openlist[b]]; current = openlist[b]; minid = b; } } if(current == goal) { float pathcost = cost(current,start,parent); return (reconstructpath(parent,current)); } openlist.erase(openlist.begin() + minid); closedlist.push_back(current); for(size_t c = 0; c < rmap[current].size(); c++) { bool alreadychecked, openchecked; for(size_t d = 0; d < closedlist.size(); d++) { if(rmap[current][c] == closedlist[d]) { alreadychecked = true; break; } } if(alreadychecked) continue; for(size_t e = 0; e < openlist.size(); e++) { if(rmap[current][c] == openlist[e]) { openchecked = true; break; } } float tentativecost = tent_cost[current] + current.getDistanceTo(rmap[current][c]); if((!openchecked) || (tentativecost < tent_cost[rmap[current][c]])) { parent[rmap[current][c]] = current; tent_cost[rmap[current][c]] = tentativecost; tent_f[rmap[current][c]] = tent_cost[rmap[current][c]] + rmap[current][c].getDistanceTo(goal); if(!openchecked) openlist.push_back(rmap[current][c]); } } } perror("path not found!\n "); } Global_planner(void); }; <file_sep>/* * rimGraphicsMenuBarDelegate.h * Rim Graphics GUI * * Created by <NAME> on 2/18/13. * Copyright 2013 Headspace Systems. All rights reserved. * */ #ifndef INCLUDE_RIM_GRAPHICS_GUI_MENU_BAR_DELEGATE_H #define INCLUDE_RIM_GRAPHICS_GUI_MENU_BAR_DELEGATE_H #include "rimGraphicsGUIConfig.h" //########################################################################################## //************************ Start Rim Graphics GUI Namespace ****************************** RIM_GRAPHICS_GUI_NAMESPACE_START //****************************************************************************************** //########################################################################################## class MenuBar; //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class which contains function objects that recieve menu bar events. /** * Any menu-bar-related event that might be processed has an appropriate callback * function object. Each callback function is called by the menu bar * whenever such an event is received. If a callback function in the delegate * is not initialized, a menu bar simply ignores it. */ class MenuBarDelegate { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Menu Delegate Callback Functions /// A function object which is called whenever an attached menu is opened by the user. Function<void ( MenuBar& menuBar, Index menuIndex )> openMenu; /// A function object which is called whenever an attached menu is closed by the user. Function<void ( MenuBar& menuBar, Index menuIndex )> closeMenu; }; //########################################################################################## //************************ End Rim Graphics GUI Namespace ******************************** RIM_GRAPHICS_GUI_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_GRAPHICS_GUI_MENU_BAR_DELEGATE_H <file_sep>/* * rimGUIApplication.h * Rim GUI * * Created by <NAME> on 2/28/08. * Copyright 2008 __MyCompanyName__. All rights reserved. * */ #ifndef INCLUDE_RIM_GUI_APPLICATION_H #define INCLUDE_RIM_GUI_APPLICATION_H #include "rimGUIConfig.h" #include "rimGUIApplicationDelegate.h" //########################################################################################## //*************************** Start Rim GUI Namespace ****************************** RIM_GUI_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class that serves as an interface to the main application launcher. class Application { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Destructor /// Destroy an application, stopping it if it is not already stopped. virtual ~Application(); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Static Factory/Run Methods /// Run an application with the supplied entry point. static void start( const Function<void ( Application& )>& entryPoint ); /// Run an application with the supplied event delegate. static void start( const ApplicationDelegate& delegate ); /// Return a reference to the currently running application. static Application& getCurrent(); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Run Methods /// Run the application and start the main thread on a new thread separate from the GUI thread. void start(); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Stop Method /// Signal to the application that it should terminate its event loop. /** * After terminating the event loop, the application waits for the * main thread (called when starting an application) to complete, * afterwhich the application stops. */ void stop(); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Is Running Accessor /// Return whether or not this application is currently running Bool isRunning() const; /// Get a string representing the name of the currently running application. UTF8String getName() const; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Delegate Accessor Methods /// Return a const reference to the object to which application events are being delegated. const ApplicationDelegate& getDelegate() const; /// Set the object to which application events should be delegated. void setDelegate( const ApplicationDelegate& newDelegate ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Event Thread ID Accessor Method #if defined(RIM_PLATFORM_WINDOWS) /// Get the thread ID for the internal thread that handles GUI events. UInt getEventThreadID() const; #endif private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Application Wrapper Type Declaration #if defined(RIM_PLATFORM_WINDOWS) /// A class which wraps internal platform-specific state. class Wrapper; #endif //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Constructors /// Create an application. Application(); /// Create an application which uses the specified event delegate. Application( const ApplicationDelegate& newDelegate ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Members /// A static pointer to a wrapper for platform specific application state. #if defined(RIM_PLATFORM_WINDOWS) Wrapper* wrapper; #endif /// An object which contain function objects that respond to this application's events. ApplicationDelegate delegate; /// A boolean value indicating whether or not this application is currently running. Bool running; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Static Data Members /// A pointer to the currently running global application. static Application* current; }; //########################################################################################## //*************************** End Rim GUI Namespace ******************************** RIM_GUI_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_GUI_APPLICATION_H <file_sep>/* * rimGraphicsDevice.h * Rim Graphics * * Created by <NAME> on 3/1/13. * Copyright 2013 __MyCompanyName__. All rights reserved. * */ #ifndef INCLUDE_RIM_GRAPHICS_DEVICE_H #define INCLUDE_RIM_GRAPHICS_DEVICE_H #include "rimGraphicsDevicesConfig.h" #include "rimGraphicsContext.h" #include "rimGraphicsContextFlags.h" #include "rimGraphicsPixelFormat.h" #include "rimGraphicsDeviceType.h" //########################################################################################## //*********************** Start Rim Graphics Devices Namespace *************************** RIM_GRAPHICS_DEVICES_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class which represents an interface to a graphics device driver. /** * Specialized implementations inherit from this interface to provide * a way to provide uniform access to their underlying drivers. For instance, * there could be a class OpenGLDevice which inherits from GraphicsDevice * and represents an OpenGL device driver. */ class GraphicsDevice { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Destructor /// Destroy a graphics device, releasing all of its resources and internal state. virtual ~GraphicsDevice() { } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Context Creation Method /// Create a new context for this graphics device with the specified framebuffer pixel format and flags. /** * This method chooses a pixel format for the context which most closely matches * the specified pixel format and flags. A pointer to the created context is * returned. If the returned pointer is NULL, the context creation failed. */ virtual Pointer<GraphicsContext> createContext( const Pointer<RenderView>& targetView, const RenderedPixelFormat& pixelFormat, const GraphicsContextFlags& flags ) = 0; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Device Capabilities Accessor Methods /// Return whether or not the specified pixel format and flags are supported by this device. /** * If they are supported as-is, the method returns TRUE indicating that the format * is supported by this device. * * If the format is not entirely supported but can be approximated * (i.e. different bit depth) and the strict flag is not set, the * supported format which most closely matches the specified format is written to the * output pixel format and flags. TRUE is returned. * * Otherwise, if the format cannot be approximated or if the strict flag is set, * FALSE is returned indicating that the format is not supported. This means that * creating a device context with these settings would fail. */ virtual Bool checkFormat( RenderedPixelFormat& pixelFormat, GraphicsContextFlags& flags, Bool strict = false ) const = 0; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Type Accessor Method /// Return an object which indicates the type of this graphics device. virtual GraphicsDeviceType getType() const = 0; }; //########################################################################################## //*********************** End Rim Graphics Devices Namespace ***************************** RIM_GRAPHICS_DEVICES_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_GRAPHICS_DEVICE_H <file_sep>/* * rimExponentialDistribution.h * Rim Math * * Created by <NAME> on 5/8/08. * Copyright 2008 Rim Software. All rights reserved. * */ #ifndef INCLUDE_RIM_EXPONENTIAL_DISTRIBUTION_H #define INCLUDE_RIM_EXPONENTIAL_DISTRIBUTION_H #include "rimMathConfig.h" #include "rimRandomVariable.h" //########################################################################################## //***************************** Start Rim Math Namespace ********************************* RIM_MATH_NAMESPACE_START //****************************************************************************************** //########################################################################################## template < typename T > class ExponentialDistribution; /// A class which represents an exponential distribution. template <> class ExponentialDistribution<float> { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructors /// Create an exponential distribution with lambda equal to 1. RIM_INLINE ExponentialDistribution() : lambda( 1.0f ), randomVariable() { } /// Create an exponential distribution with lambda equal to 1. /** * The created exponential distribution will produce samples using the * specified random variable. */ RIM_INLINE ExponentialDistribution( const RandomVariable<float>& newRandomVariable ) : lambda( 1.0f ), randomVariable( newRandomVariable ) { } /// Create an exponential distribution with lambda equal to the specified value. RIM_INLINE ExponentialDistribution( float newLambda ) : lambda( math::max( newLambda, 0.0f ) ), randomVariable() { } /// Create an exponential distribution with lambda equal to the specified value. /** * The created exponential distribution will produce samples using the * specified random variable. */ RIM_INLINE ExponentialDistribution( float newLambda, const RandomVariable<float>& newRandomVariable ) : lambda( math::max( newLambda, 0.0f ) ), randomVariable( newRandomVariable ) { } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Distribution Sample Generation Method /// Generate a sample from the exponential distribution. RIM_INLINE float sample() { return -math::ln( randomVariable.sample( 0.0f, 1.0f ) )/lambda; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Lambda Parameter Accessor Methods /// Get the lambda parameter of this exponential distribution. RIM_INLINE float getLambda() const { return lambda; } /// Set the lambda parameter of this exponential distribution. RIM_INLINE void setLambda( float newLambda ) { lambda = newLambda; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Random Variable Accessor Methods /// Get the random variable used to generate samples for this distribution. RIM_INLINE RandomVariable<float>& getRandomVariable() { return randomVariable; } /// Get the random variable used to generate samples for this distribution. RIM_INLINE const RandomVariable<float>& getRandomVariable() const { return randomVariable; } /// Set the random variable used to generate samples for this distribution. RIM_INLINE void getRandomVariable( const RandomVariable<float>& newRandomVariable ) { randomVariable = newRandomVariable; } private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Members /// The lambda parameter of the exponential distribution. float lambda; /// The random variable that the exponential distribution uses to generate samples. RandomVariable<float> randomVariable; }; /// A class which represents an exponential distribution. template <> class ExponentialDistribution<double> { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructors /// Create an exponential distribution with lambda equal to 1. RIM_INLINE ExponentialDistribution() : lambda( 1.0 ), randomVariable() { } /// Create an exponential distribution with lambda equal to the specified value. RIM_INLINE ExponentialDistribution( double newLambda ) : lambda( math::max( newLambda, 0.0 ) ), randomVariable() { } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Distribution Sample Generation Method /// Generate a sample from the exponential distribution. RIM_INLINE double sample() { return -math::ln( randomVariable.sample( 0.0, 1.0 ) )/lambda; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Lambda Parameter Accessor Methods /// Get the lambda parameter of this exponential distribution. RIM_INLINE double getLambda() const { return lambda; } /// Set the lambda parameter of this exponential distribution. RIM_INLINE void setLambda( double newLambda ) { lambda = newLambda; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Random Variable Accessor Methods /// Get the random variable used to generate samples for this distribution. RIM_INLINE RandomVariable<double>& getRandomVariable() { return randomVariable; } /// Get the random variable used to generate samples for this distribution. RIM_INLINE const RandomVariable<double>& getRandomVariable() const { return randomVariable; } /// Set the random variable used to generate samples for this distribution. RIM_INLINE void getRandomVariable( const RandomVariable<double>& newRandomVariable ) { randomVariable = newRandomVariable; } private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Members /// The lambda parameter of the exponential distribution. double lambda; /// The random variable that the exponential distribution uses to generate samples. RandomVariable<double> randomVariable; }; //########################################################################################## //***************************** End Rim Math Namespace *********************************** RIM_MATH_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_EXPONENTIAL_DISTRIBUTION_H <file_sep>/* * rimGraphicsGUIGraphViewDelegate.h * Rim Graphics GUI * * Created by <NAME> on 7/9/13. * Copyright 2013 __MyCompanyName__. All rights reserved. * */ #ifndef INCLUDE_RIM_GRAPHICS_GUI_GRAPH_VIEW_DELEGATE_H #define INCLUDE_RIM_GRAPHICS_GUI_GRAPH_VIEW_DELEGATE_H #include "rimGraphicsGUIConfig.h" //########################################################################################## //************************ Start Rim Graphics GUI Namespace ****************************** RIM_GRAPHICS_GUI_NAMESPACE_START //****************************************************************************************** //########################################################################################## class GraphView; //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class which contains function objects that recieve GraphView events. /** * Any render-view-related event that might be processed has an appropriate callback * function object. Each callback function is called by the button * whenever such an event is received. If a callback function in the delegate * is not initialized, a render view simply ignores it. */ class GraphViewDelegate { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Data Access Functions /// A callback function called when an attached graph view needs to update the visible data points for a series. /** * The implementor should modify the specified list of points so that they reflect the currently * visible set of points for the graph view's current visible range. */ Function<void ( GraphView& graphView, Index seriesIndex, ArrayList<Vector2f>& points )> updateSeries; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** User Input Callback Functions /// A function object called whenever an attached graph view receives a keyboard event. Function<void ( GraphView& graphView, const KeyboardEvent& keyEvent )> keyEvent; /// A function object called whenever an attached graph view receives a mouse-motion event. Function<void ( GraphView& graphView, const MouseMotionEvent& mouseMotionEvent )> mouseMotionEvent; /// A function object called whenever an attached graph view receives a mouse-button event. Function<void ( GraphView& graphView, const MouseButtonEvent& mouseButtonEvent )> mouseButtonEvent; /// A function object called whenever an attached graph view receives a mouse-wheel event. Function<void ( GraphView& graphView, const MouseWheelEvent& mouseWheelEvent )> mouseWheelEvent; }; //########################################################################################## //************************ End Rim Graphics GUI Namespace ******************************** RIM_GRAPHICS_GUI_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_GRAPHICS_GUI_GRAPH_VIEW_DELEGATE_H <file_sep>/* * rimGraphicsGUIFontLayout.h * Rim Graphics GUI * * Created by <NAME> on 2/7/13. * Copyright 2013 Headspace Systems. All rights reserved. * */ #ifndef INCLUDE_RIM_GRAPHICS_GUI_FONT_LAYOUT_H #define INCLUDE_RIM_GRAPHICS_GUI_FONT_LAYOUT_H #include "rimGraphicsGUIFontsConfig.h" //########################################################################################## //********************* Start Rim Graphics GUI Fonts Namespace *************************** RIM_GRAPHICS_GUI_FONTS_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class which describes the orientation of a particular font. /** * A font can be layed out either horizontally, in which case lines are * horizontal and each successive line is vertically offset, or vertically, * where lines are vertical and each successive line is horizontally offset. */ class FontLayout { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Public Enum Declaration /// An enum which specifies the different kinds of font layouts. typedef enum Enum { /// A font layout where lines are horizontal. /** * Each successive line of text is vertically offset from the last. */ HORIZONTAL, /// A font layout where lines are vertical. /** * Each successive line of text is horizontally offset from the last. */ VERTICAL }; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructors /// Create a new font layout using the specified font layout enum value. RIM_INLINE FontLayout( Enum newType ) : type( newType ) { } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Enum Cast Operator /// Convert this font layout to an enum value. RIM_INLINE operator Enum () const { return type; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** String Representation Accessor Methods /// Return a string representation of the font layout. String toString() const; /// Convert this font layout into a string representation. RIM_INLINE operator String () const { return this->toString(); } private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Members /// An enum value indicating the type of font layout this object represents. Enum type; }; //########################################################################################## //********************* End Rim Graphics GUI Fonts Namespace ***************************** RIM_GRAPHICS_GUI_FONTS_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_GRAPHICS_GUI_FONT_LAYOUT_H <file_sep>/* * rimSoundDeviceManager.h * Rim Sound * * Created by <NAME> on 6/7/08. * Copyright 2008 Rim Software. All rights reserved. * */ #ifndef INCLUDE_RIM_SOUND_DEVICE_MANAGER_H #define INCLUDE_RIM_SOUND_DEVICE_MANAGER_H #include "rimSoundDevicesConfig.h" #include "rimSoundDeviceID.h" #include "rimSoundDeviceManagerDelegate.h" //########################################################################################## //************************ Start Rim Sound Devices Namespace ***************************** RIM_SOUND_DEVICES_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class which queries the system for currently connected audio devices. /** * It provides a platform-independent method of determining the number of audio * input and output devices and accessing those devices. It maintains an internal * list of the currently connected audio devices. One can query the class for * input and output device IDs which can be used to construct device objects. */ class SoundDeviceManager { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructors /// Create a sound device manager. SoundDeviceManager(); /// Create a copy of a sound device manager. SoundDeviceManager( const SoundDeviceManager& other ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Destructor /// Destroy this sound device manager. ~SoundDeviceManager(); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Assignment Operator /// Assign the state of one sound device manager to another. SoundDeviceManager& operator = ( const SoundDeviceManager& other ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Output Device Accessor Methods /// Get the number of connected sound devices. Size getDeviceCount() const; /// Get an identifier for the sound device at the specified index. /** * If the specified index is out-of-bounds, SoundDeviceID::INVALID_DEVICE * is returned. */ SoundDeviceID getDeviceID( Index deviceIndex ) const; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Default Device Accessor Methods /// Get an identifier for the default system sound input device. /** * If there is no default input device, SoundDeviceID::INVALID_DEVICE is * returned. */ SoundDeviceID getDefaultInputDeviceID() const; /// Get an identifier for the default system sound output device. /** * If there is no default output device, SoundDeviceID::INVALID_DEVICE is * returned. */ SoundDeviceID getDefaultOutputDeviceID() const; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Delegate Accessor Methods /// Return a reference to the delegate object which is responding to events for this device manager. RIM_INLINE const SoundDeviceManagerDelegate& getDelegate() const { return delegate; } /// Replace the delegate object which is responding to events for this device manager. void setDelegate( const SoundDeviceManagerDelegate& newDelegate ); private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Class Declaration /// A class which wraps OS-specific data needed by the device manager. class Wrapper; /// A class which allows the device manager to be notified when a device is connected or disconnected. class DeviceChangeNotifier; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Helper Methods /// Make sure that the device manager has all currently available devices cached. void cacheDevices(); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Platform-Specific Methods /// Initialize up any platform-specific data for a newly-created device manager. Bool createManager(); /// Clean up any platform-specific data before a device manager is destroyed. Bool destroyManager(); /// Register any OS-specific callbacks which notify the class when devices are disconnected or connected. Bool registerDeviceUpdateCallbacks(); /// Unregister any OS-specific callbacks which notify the class when devices are disconnected or connected. Bool unregisterDeviceUpdateCallbacks(); /// Refresh all of the connected audio devices to make sure that they are still there. Bool refreshDevices(); /// Refresh the current default input device if a notification was received that it changed. Bool refreshDefaultInputDevice(); /// Refresh the current default output device if a notification was received that it changed. Bool refreshDefaultOutputDevice(); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Members /// An array of the IDs for every input and output device currently connected. ArrayList<SoundDeviceID> devices; /// The index of the default input device within the array of input devices. Index defaultInputDeviceIndex; /// The index of the default output device within the array of output devices. Index defaultOutputDeviceIndex; /// A mutex which protects the lists of input and output device IDs from unsafe thread access. /** * Since devices may be asynchronously connected or disconnected from the system, * it is necessary to make sure that the device ID arrays are not modified while * they are being accessed. */ mutable threads::Mutex deviceChangeMutex; /// A mutex which protects the delegate callbacks from being modified when they are being used. mutable threads::Mutex delegateChangeMutex; /// A pointer to a class which holds information related to platform-specific audio APIs. Wrapper* wrapper; /// An object which responds to events for this sound device manager. SoundDeviceManagerDelegate delegate; /// Whether or not this device manager has cached all of the available input/ouptut devices yet. Bool hasCachedDevices; }; //########################################################################################## //************************ End Rim Sound Devices Namespace ******************************* RIM_SOUND_DEVICES_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_SOUND_DEVICE_MANAGER_H <file_sep>/* * rimSoundFilterParameterUnits.h * Rim Sound * * Created by <NAME> on 8/21/12. * Copyright 2012 __MyCompanyName__. All rights reserved. * */ #ifndef INCLUDE_RIM_SOUND_FILTER_PARAMETER_UNITS_H #define INCLUDE_RIM_SOUND_FILTER_PARAMETER_UNITS_H #include "rimSoundFiltersConfig.h" //########################################################################################## //************************ Start Rim Sound Filters Namespace ***************************** RIM_SOUND_FILTERS_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class which represents the units of a certain SoundFilter parameter. /** * This value is used to determine how to display the filter parameter. * Units are available for commonly used DSP parameter types. */ class FilterParameterUnits { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Parameter Type Enum Declaration /// An enum which specifies the allowed SoundFilter parameter types. typedef enum Enum { /// A undefined filter parameter unit type. UNDEFINED = 0, /// A generic parameter. Values are evenly distributed in the parameter's range. GENERIC = 1, /// The parameter is specified in terms of a decibel gain factor, relative to 0dB (full scale). DECIBELS = 2, /// The parameter's value is in terms of a percentage. PERCENT = 3, /// The parameter's value is specified as a ratio of two numbers. /** * This unit type would typically be used for compressor or gate ratios. */ RATIO = 4, /// The parameter's value is specified in terms of seconds. SECONDS = 5, /// The parameter's value is specified in terms of milliseconds. MILLISECONDS = 6, /// The parameter's value is specified in terms of frequency (Hertz). HERTZ = 7, /// The parameter's value is specified in terms of a number of meters. METERS = 8, /// The parameter's value is specified in terms of a number of angular degrees. DEGREES = 9, /// An index parameter, representing a whole-number value. /** * This unit type indicates that only integer values should be allowed for this * filter parameter. */ INDEX = 10, /// The parameter's value is specified in terms of a number of samples. SAMPLES = 11, /// The parameter's value is specified in terms of a number of samples per second. SAMPLE_RATE = 12, /// The parameter's value is specified in terms of the number of beats per minute. BPM = 13, /// The parameter's value is specified in terms of a number of beats. BEATS = 14, /// The parameter's value is specified in terms of a number of cents (1/100th of a semitone). CENTS = 15, /// The parameter's value is specified in terms of a number of semitones. SEMITONES = 16, /// The parameter's value is specified in terms of a number of octaves. OCTAVES = 17, /// The parameter's value is specified in terms of a MIDI note number. /** * Values are evenly distributed in the parameter's range. Values should range * between 0 and 127 to be MIDI-compliant. * * This unit type indicates that only integer values should be allowed for this * filter parameter. */ MIDI_NOTE_NUMBER = 18, /// The parameter's value is specified in terms of a MIDI control channel value. /** * Values are evenly distributed in the parameter's range. Values should range * between 0 and 127 to be MIDI-compliant. */ MIDI_CONTROL = 19 }; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructors /// Create a new filter parameter units object with an UNDEFINED parameter units. RIM_INLINE FilterParameterUnits() : units( (UByte)UNDEFINED ) { } /// Create a new filter parameter units object with the specified units enum value. RIM_INLINE FilterParameterUnits( Enum newUnits ) : units( (UByte)newUnits ) { } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Enum Cast Operator /// Convert this filter parameter units type to an enum value. /** * This operator is provided so that the FilterParameterUnits object can be used * directly in a switch statement without the need to explicitly access * the underlying enum value. * * @return the enum representation of this parameter unit type. */ RIM_INLINE operator Enum () const { return (Enum)units; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** String Representation Accessor Methods /// Return a string representing the abbreviated name of this parameter units. /** * For some parameter types, this method may return an empty string, indicating * there is no valid abbreviation for this unit type (linear gain, for example). */ UTF8String getAbbreviation() const; /// Return a string representation of the parameter unit type. /** * This string is the same as the 'long' representation for this * unit type. This string will not contain any abbreviations and shouldn't * be used for compact display. */ UTF8String toString() const; /// Convert this parameter unit type into a string representation. RIM_INLINE operator UTF8String () const { return this->toString(); } private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Members /// An enum value indicating the unit type of a SoundFilter parameter. UByte units; }; //########################################################################################## //************************ End Rim Sound Filters Namespace ******************************* RIM_SOUND_FILTERS_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_SOUND_FILTER_PARAMETER_UNITS_H <file_sep>/* * rimGraphicsSceneAssetTranscoder.h * Rim Software * * Created by <NAME> on 6/14/14. * Copyright 2014 __MyCompanyName__. All rights reserved. * */ #ifndef INCLUDE_RIM_GRAPHICS_SCENE_ASSET_TRANSCODER_H #define INCLUDE_RIM_GRAPHICS_SCENE_ASSET_TRANSCODER_H #include "rimGraphicsAssetsConfig.h" #include "rimGraphicsObjectAssetTranscoder.h" #include "rimGraphicsCameraAssetTranscoder.h" #include "rimGraphicsLightAssetTranscoder.h" //########################################################################################## //*********************** Start Rim Graphics Assets Namespace **************************** RIM_GRAPHICS_ASSETS_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class which encodes and decodes graphics scenes to the asset format. class GraphicsSceneAssetTranscoder : public AssetTypeTranscoder<GraphicsScene> { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Destructor //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Text Encoding/Decoding Methods /// Decode an object from the specified string stream, returning a pointer to the final object. virtual Pointer<GraphicsScene> decodeText( const AssetType& assetType, const AssetObject& assetObject, ResourceManager* resourceManager = NULL ); /// Encode an object of this asset type into a text-based format. virtual Bool encodeText( UTF8StringBuffer& buffer, ResourceManager* resourceManager, const GraphicsScene& scene ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Public Static Data Members /// An object indicating the asset type for a graphics scene. static const AssetType SCENE_ASSET_TYPE; private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Type Declarations /// An enum describing the fields that a graphics scene can have. typedef enum Field { /// An undefined field. UNDEFINED = 0, /// "name" The name of this graphics scene. NAME, /// "objects" A list of the graphics objects in this scene. OBJECTS, /// "cameras" A list of the graphics cameras in this scene. CAMERAS, /// "lights" A list of the graphics lights in this scene. LIGHTS }; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Helper Methods /// Return an enum value indicating the field indicated by the given field name. static Field getFieldType( const AssetObject::String& name ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Members /// An object that helps transcode graphics objects that are part of a scene. GraphicsObjectAssetTranscoder objectTranscoder; /// An object that helps transcode graphics cameras that are part of a scene. GraphicsCameraAssetTranscoder cameraTranscoder; /// An object that helps transcode graphics lights that are part of a scene. GraphicsLightAssetTranscoder lightTranscoder; /// A temporary asset object used when parsing scene child objects. AssetObject tempObject; }; //########################################################################################## //*********************** End Rim Graphics Assets Namespace ****************************** RIM_GRAPHICS_ASSETS_NAMESPACE_END //****************************************************************************************** //########################################################################################## //########################################################################################## //**************************** Start Rim Assets Namespace ******************************** RIM_ASSETS_NAMESPACE_START //****************************************************************************************** //########################################################################################## template <> RIM_INLINE const AssetType& AssetType::of<rim::graphics::scenes::GraphicsScene>() { return rim::graphics::assets::GraphicsSceneAssetTranscoder::SCENE_ASSET_TYPE; } //########################################################################################## //**************************** End Rim Assets Namespace ********************************** RIM_ASSETS_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_GRAPHICS_SCENE_ASSET_TRANSCODER_H <file_sep>/* * rimSceneBVH.h * Rim Software * * Created by <NAME> on 10/28/14. * Copyright 2014 __MyCompanyName__. All rights reserved. * */ #ifndef INCLUDE_RIM_BVH_SCENE_BVH_H #define INCLUDE_RIM_BVH_SCENE_BVH_H #include "rimBVHConfig.h" #include "./rimBVH.h" #include "rimObjectInterface.h" //########################################################################################## //***************************** Start Rim BVH Namespace ********************************** RIM_BVH_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class that handles hierarchies of transformed BVHs in a scene. class SceneBVH { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructors /// Create a new scene BVH with no objects. SceneBVH(); /// Create a new scene BVH with the specified object set. SceneBVH( const Pointer<const ObjectInterface>& newObjectSet ); /// Create a copy of the specified scene BVH, using the same objects. SceneBVH( const SceneBVH& other ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Destructor /// Destroy this scene BVH. virtual ~SceneBVH(); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Assignment Operator /// Assign a copy of another scene BVH to this one, using the same objects. SceneBVH& operator = ( const SceneBVH& other ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** BVH Object Accessor Methods /// Set the object interface that this scene BVH should use. /** * Calling this method invalidates the current BVH, requiring it * to be rebuilt before it can be used. */ virtual void setObjects( const Pointer<const ObjectInterface>& newObjects ); /// Return a pointer to the object interface used by this BVH. virtual const Pointer<const ObjectInterface>& getObjects() const; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** BVH Attribute Accessor Methods /// Return the maximum depth of this BVH's hierarchy. /** * This value can be used to pre-allocate traversal stacks to prevent overflow. */ virtual Size getMaxDepth() const; /// Return whether or not this BVH is built, valid, and ready for use. virtual Bool isValid() const; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** BVH Building Methods /// Rebuild the BVH using the current set of objects. virtual void rebuild(); /// Do a quick update of the BVH by refitting the bounding volumes without changing the hierarchy. virtual void refit(); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Ray Tracing Methods /// Trace the specified ray through this scene BVH up to a maximum distance. /** * The method returns whether or not an intersection was found. If so, the distance * along the ray and the intersected object and object index are placed in the output parameters. */ virtual Bool traceRay( const Ray3f& ray, Float maxDistance, TraversalStack& stack, Float& closestIntersection, Index& primitiveIndex, Index& objectIndex ) const; /// Trace the specified ray through this scene BVH up to a maximum distance. /** * The method returns whether or not an intersection was found. */ virtual Bool traceRay( const Ray3f& ray, Float maxDistance, TraversalStack& stack ) const; private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Class Declarations /// A class which represents a single node in the scene BVH. class Node; /// A class which stores the AABB of a single object used during tree construction. class ObjectAABB; /// A class used to keep track of surface-area-heuristic paritioning data. class SplitBin; /// A class which stores an object in the scene an its associated object-to-world transformation. class ObjectData; /// A SIMD ray class with extra data used to speed up intersection tests. class FatSIMDRay; /// Define the type to use for offsets in the BVH. typedef Index IndexType; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Tree Bulding Methods /// Build a tree starting at the specified node using the specified objects. /** * This method returns the number of nodes in the tree created. */ static Size buildTreeRecursive( Node* node, ObjectAABB* objectAABBs, Index start, Size numObjects, SplitBin* splitBins, Size numSplitCandidates, Size depth, Size& maxDepth ); /// Partition the specified list of objects into two sets based on the given split plane. /** * The objects are sorted so that the first N objects in the list are deemed "less" than * the split plane along the split axis, and the next M objects are the remainder. * The number of "lesser" objects is placed in the output variable. */ static void partitionObjectsSAH( ObjectAABB* objectAABBs, Size numObjects, SplitBin* splitBins, Size numSplitCandidates, Index& axis, Size& numLesserObjects, AABB3f& lesserVolume, AABB3f& greaterVolume ); /// Partition the specified list of objects into two sets based on their median along the given axis. static void partitionObjectsMedian( ObjectAABB* objectAABBs, Size numObjects, Index splitAxis, Size& numLesserTriangles, AABB3f& lesserVolume, AABB3f& greaterVolume ); /// Compute the axis-aligned bounding box for the specified list of objects. static AABB3f computeAABBForObjects( const ObjectAABB* objectAABBs, Size numObjects ); /// Compute the axis-aligned bounding box for the specified list of objects' centroids. static AABB3f computeAABBForObjectCentroids( const ObjectAABB* objectAABBs, Size numObjects ); /// Get the surface area of a 3D axis-aligned bounding box specified by 2 SIMD min-max vectors. RIM_FORCE_INLINE static float getAABBSurfaceArea( const math::SIMDFloat4& min, const math::SIMDFloat4& max ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Tree Refitting Methods /// Refit the bounding volume for the specified node and return the final bounding box. AABB3f refitTree( Node* node ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Object List Building Methods /// Fill the list of objects data with the final data. void fillObjectData( const ObjectAABB* objectAABBs, Size numObjects ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Static Data Members /// The default intial number of splitting plane candidates that are considered when building the tree. static const Size DEFAULT_NUM_SPLIT_CANDIDATES = 32; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Members /// A pointer to a flat array of nodes that make up this tree. Node* nodes; /// The number of nodes that are in this scene BVH. Size numNodes; /// A list of data objects for each object in the tree. ArrayList<ObjectData> objectData; /// An opaque set of the objects used by this tree. Pointer<const ObjectInterface> objectSet; /// The maximum depth of the hierarchy of this scene BVH. Size maxDepth; /// The number of Surface Area Heuristic split plane candidates to consider when building the tree. Size numSplitCandidates; }; //########################################################################################## //***************************** End Rim BVH Namespace ************************************ RIM_BVH_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_BVH_SCENE_BVH_H <file_sep>/* * rimSampleRate.h * Rim Sound * * Created by <NAME> on 3/3/12. * Copyright 2012 __MyCompanyName__. All rights reserved. * */ #ifndef INCLUDE_RIM_SAMPLE_RATE_H #define INCLUDE_RIM_SAMPLE_RATE_H #include "rimSoundUtilitiesConfig.h" //########################################################################################## //*********************** Start Rim Sound Utilities Namespace **************************** RIM_SOUND_UTILITIES_NAMESPACE_START //****************************************************************************************** //########################################################################################## /// Define the type to represent the sampling rate of a buffer of audio. typedef Double SampleRate; //########################################################################################## //*********************** End Rim Sound Utilities Namespace ****************************** RIM_SOUND_UTILITIES_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_SAMPLE_RATE_H <file_sep>/* * rimGraphicsGUIMenuBar.h * Rim Graphics GUI * * Created by <NAME> on 2/18/13. * Copyright 2013 Headspace Systems. All rights reserved. * */ #ifndef INCLUDE_RIM_GRAPHICS_GUI_MENU_BAR_H #define INCLUDE_RIM_GRAPHICS_GUI_MENU_BAR_H #include "rimGraphicsGUIBase.h" #include "rimGraphicsGUIObject.h" #include "rimGraphicsGUIMenuBarDelegate.h" #include "rimGraphicsGUIMenu.h" //########################################################################################## //************************ Start Rim Graphics GUI Namespace ****************************** RIM_GRAPHICS_GUI_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class which arranges a set of closed Menu objects within a rectangular area. /** * A menu bar uses user input to show or hide menus that it contains, similar to * a standard GUI menu bar. */ class MenuBar : public GUIObject { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructors /// Create a new menu bar with no width or height positioned at the origin. MenuBar(); /// Create a new empty menu bar which occupies the specified rectangular region. MenuBar( const Rectangle& newRectangle ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Menu Accessor Methods /// Return the total number of menus that are part of this menu bar. RIM_INLINE Size getMenuCount() const { return menus.getSize(); } /// Return a pointer to the menu at the specified index in this menu bar. RIM_INLINE const Pointer<Menu>& getMenu( Index menuIndex ) const { return menus[menuIndex].menu; } /// Add the specified menu to this menu bar. /** * If the specified menu pointer is NULL, the method fails and FALSE * is returned. Otherwise, the menu is appended to the end of the menu bar * and TRUE is returned. */ Bool addMenu( const Pointer<Menu>& newMenu ); /// Insert the specified menu at the given index in this menu bar. /** * If the specified menu pointer is NULL, the method fails and FALSE * is returned. Otherwise, the menu is inserted at the given index in the menu bar * and TRUE is returned. */ Bool insertMenu( Index menuIndex, const Pointer<Menu>& newMenu ); /// Replace the specified menu at the given index in this menu bar. /** * If the specified menu pointer is NULL, the method fails and FALSE * is returned. Otherwise, the menu is inserted at the given index in the menu bar * and TRUE is returned. */ Bool setMenu( Index menuIndex, const Pointer<Menu>& newMenu ); /// Remove the specified menu from this menu bar. /** * If the given menu is part of this menu bar, the method removes it * and returns TRUE. Otherwise, if the specified menu is not found, * the method doesn't modify the menu bar and FALSE is returned. */ Bool removeMenu( const Menu* oldMenu ); /// Remove the menu at the specified index from this menu bar. /** * If the specified index is invalid, FALSE is returned and the Menu * is unaltered. Otherwise, the menu at that index is removed and * TRUE is returned. */ Bool removeMenuAtIndex( Index menuIndex ); /// Remove all menus from this menu bar. void clearMenus(); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Selected Menu Index Accesor Methods /// Return the index of the currently highlighted menu in this menu bar. /** * If there is no currently highlighted menu, -1 is returned. */ RIM_INLINE Int getHighlightedMenuIndex() const { return highlightedMenuIndex; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Menu Padding Accessor Methods /// Return the padding amount between each menu in this menu bar. RIM_INLINE Float getMenuPadding() const { return menuPadding; } /// Set the padding amount between each menu in this menu bar. RIM_INLINE void setMenuPadding( Float newPadding ) { menuPadding = newPadding; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Menu Bounding Box Accessor Methods /// Return the bounding box of the menu title with the specified index in this menu bar. RIM_INLINE const AABB2f& getMenuBounds( Index menuIndex ) const { return menus[menuIndex].bounds; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Border Accessor Methods /// Return a mutable object which describes this menu bar's border. RIM_INLINE Border& getBorder() { return border; } /// Return an object which describes this menu bar's border. RIM_INLINE const Border& getBorder() const { return border; } /// Set an object which describes this menu bar's border. RIM_INLINE void setBorder( const Border& newBorder ) { border = newBorder; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Color Accessor Methods /// Return the background color for this menu bar's main area. RIM_INLINE const Color4f& getBackgroundColor() const { return backgroundColor; } /// Set the background color for this menu bar's main area. RIM_INLINE void setBackgroundColor( const Color4f& newBackgroundColor ) { backgroundColor = newBackgroundColor; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Border Color Accessor Methods /// Return the border color used when rendering a menu bar. RIM_INLINE const Color4f& getBorderColor() const { return borderColor; } /// Set the border color used when rendering a menu bar. RIM_INLINE void setBorderColor( const Color4f& newBorderColor ) { borderColor = newBorderColor; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Separator Color Accessor Methods /// Return the color overlayed when a menu bar item is highlighted. RIM_INLINE const Color4f& getHighlightColor() const { return highlightColor; } /// Set the color overlayed when a menu bar item is highlighted. RIM_INLINE void setHighlightColor( const Color4f& newHighlightColor ) { highlightColor = newHighlightColor; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Text Style Accessor Methods /// Return a reference to the font style which is used to render the text for a menu bar. RIM_INLINE const FontStyle& getTextStyle() const { return textStyle; } /// Set the font style which is used to render the text for a menu bar. RIM_INLINE void setTextStyle( const FontStyle& newTextStyle ) { textStyle = newTextStyle; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Drawing Method /// Draw this menu bar using the specified GUI renderer to the given parent coordinate system bounds. /** * The method returns whether or not the menu bar was successfully drawn. */ virtual Bool drawSelf( GUIRenderer& renderer, const AABB3f& parentBounds ) const; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Input Handling Methods /// Handle the specified keyboard event for the entire menu bar. virtual void keyEvent( const KeyboardEvent& event ); /// Handle the specified mouse motion event for the entire menu bar. virtual void mouseMotionEvent( const MouseMotionEvent& event ); /// Handle the specified mouse button event for the entire menu bar. virtual void mouseButtonEvent( const MouseButtonEvent& event ); /// Handle the specified mouse wheel event for the entire menu bar. virtual void mouseWheelEvent( const MouseWheelEvent& event ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Delegate Accessor Methods /// Return a reference to the delegate which responds to events for this menu bar. RIM_INLINE MenuBarDelegate& getDelegate() { return delegate; } /// Return a reference to the delegate which responds to events for this menu bar. RIM_INLINE const MenuBarDelegate& getDelegate() const { return delegate; } /// Return a reference to the delegate which responds to events for this menu bar. RIM_INLINE void setDelegate( const MenuBarDelegate& newDelegate ) { delegate = newDelegate; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Static Construction Methods /// Construct a smart-pointer-wrapped instance of this class using the constructor with the given arguments. RIM_INLINE static Pointer<MenuBar> construct() { return Pointer<MenuBar>::construct(); } /// Construct a smart-pointer-wrapped instance of this class using the constructor with the given arguments. RIM_INLINE static Pointer<MenuBar> construct( const Rectangle& newRectangle ) { return Pointer<MenuBar>::construct( newRectangle ); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Public Static Data Members /// The default padding to use between menus of a menu bar. static const Float DEFAULT_MENU_PADDING; /// The default border that is used for a menu bar. static const Border DEFAULT_BORDER; /// The default background color that is used for a menu bar's area. static const Color4f DEFAULT_BACKGROUND_COLOR; /// The default border color that is used for a menu bar. static const Color4f DEFAULT_BORDER_COLOR; /// The default highlight color that is used for a menu bar. static const Color4f DEFAULT_HIGHLIGHT_COLOR; private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Class Declaration /// A class which contains information about a single menu that is part of a menu bar. class MenuInfo { public: /// Create a new menu information object associated with the specified menu. RIM_INLINE MenuInfo( const Pointer<Menu>& newMenu ) : menu( newMenu ) { } /// A pointer to the menu associated with this menu information object. Pointer<Menu> menu; /// The bounding box of the menu within the menu bar's coordinate system. AABB2f bounds; }; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Helper Methods /// Change which menu is highlighted as part of this menu bar, sending any events to delegates. RIM_INLINE void setHighlightedMenu( Int newHighlightedIndex ) { // Don't send any events if the highlighted menu didn't change. if ( newHighlightedIndex == highlightedMenuIndex ) return; // Notify the previous menu that it was closed. if ( highlightedMenuIndex != -1 ) { const Pointer<Menu>& menu = menus[highlightedMenuIndex].menu; const MenuDelegate& menuDelegate = menu->getDelegate(); if ( menuDelegate.close.isSet() ) menuDelegate.close( *menu ); // Notify the menu bar delegate. if ( delegate.closeMenu.isSet() ) delegate.closeMenu( *this, highlightedMenuIndex ); } highlightedMenuIndex = newHighlightedIndex; // Notify the new menu that it was opened. if ( highlightedMenuIndex != -1 ) { const Pointer<Menu>& menu = menus[highlightedMenuIndex].menu; const MenuDelegate& menuDelegate = menus[highlightedMenuIndex].menu->getDelegate(); if ( menuDelegate.open.isSet() ) menuDelegate.open( *menu ); // Notify the menu bar delegate. if ( delegate.openMenu.isSet() ) delegate.openMenu( *this, highlightedMenuIndex ); } } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Members /// A list of all of the menus that are part of this menu bar. ArrayList<MenuInfo> menus; /// An object which describes the border for this menu bar. Border border; /// The padding space between menus. Float menuPadding; /// The background color for the menu bar's area. Color4f backgroundColor; /// The border color for the menu bar's background area. Color4f borderColor; /// The color which is used to highlight selected menu bar items. Color4f highlightColor; /// An object which determines the style of the text for this menu bar's items. FontStyle textStyle; /// An object which contains function pointers that respond to menu bar events. MenuBarDelegate delegate; /// The index of the currently highlighted menu, or -1 if no menu is highlighted. Int highlightedMenuIndex; /// A boolean value indicating whether or not the user has clicked the menu bar with the mouse. Bool mousePressed; }; //########################################################################################## //************************ End Rim Graphics GUI Namespace ******************************** RIM_GRAPHICS_GUI_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_GRAPHICS_GUI_MENU_BAR_H <file_sep>/* * rimGraphicsGenericShaderProgram.h * Rim Software * * Created by <NAME> on 3/1/14. * Copyright 2014 __MyCompanyName__. All rights reserved. * */ #ifndef INCLUDE_RIM_GRAPHICS_GENERIC_SHADER_PROGRAM_H #define INCLUDE_RIM_GRAPHICS_GENERIC_SHADER_PROGRAM_H #include "rimGraphicsShadersConfig.h" #include "rimGraphicsShader.h" #include "rimGraphicsShaderConfiguration.h" //########################################################################################## //*********************** Start Rim Graphics Shaders Namespace *************************** RIM_GRAPHICS_SHADERS_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class which represents a collection of shader source code objects. class GenericShaderProgram { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructor /// Create a new generic shader program with no shaders and undefined shader language. RIM_INLINE GenericShaderProgram() : language( ShaderLanguage::UNDEFINED ), configuration() { } /// Create a new generic shader program with no shaders for the specified shader language. RIM_INLINE GenericShaderProgram( const ShaderLanguage& newLanguage ) : language( newLanguage ), configuration() { } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Language Accessor Methods /// Return an object describing the language in which this shader program source is written. RIM_INLINE const ShaderLanguage& getLanguage() const { return language; } /// Set an object describing the language in which this shader program source is written. RIM_INLINE void setLanguage( const ShaderLanguage& newLanguage ) { language = newLanguage; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Configuration Accessor Methods /// Return an object describing the configuration of this shader program source. /** * If there are not configuration options for this shader program source, * the method may return a NULL pointer. */ RIM_INLINE const Pointer<ShaderConfiguration>& getConfiguration() const { return configuration; } /// Set an object describing the configuration of this shader program source. RIM_INLINE void setConfiguration( const Pointer<ShaderConfiguration>& newConfiguration ) { configuration = newConfiguration; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Shader Accessor Methods /// Return the number of shaders that this generic shader program has. RIM_INLINE Size getShaderCount() const { return shaders.getSize(); } /// Return a const reference to the shader source at the specified index in this generic shader program. RIM_INLINE const ShaderSource& getShader( Index sourceIndex ) const { return shaders[sourceIndex]; } /// Replace the shader source at the specified index in this generic shader program. RIM_INLINE void setShader( Index sourceIndex, const ShaderSource& newShader ) { shaders[sourceIndex] = newShader; } /// Add a new shader source to the end of this generic shader program's list of shaders. RIM_INLINE void addShader( const ShaderSource& newShader ) { shaders.add( newShader ); } /// Remove the shader source at the specified index in this generic shader program. /** * This method maintains the order of the remaining shaders. */ RIM_INLINE void removeShader( Index sourceIndex ) { shaders.removeAtIndex( sourceIndex ); } /// Clear all shader sources from this generic shader program. RIM_INLINE void clearShaders() { shaders.clear(); } private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Members /// An object describing the language used for this shader program source. ShaderLanguage language; /// A list of source code objects for each shader that makes up this shader program. ArrayList<ShaderSource> shaders; /// An optionally-NULL pointer to the configuration parameters for this shader program source. Pointer<ShaderConfiguration> configuration; }; //########################################################################################## //*********************** End Rim Graphics Shaders Namespace ***************************** RIM_GRAPHICS_SHADERS_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_GRAPHICS_GENERIC_SHADER_PROGRAM_H <file_sep>/* * rimGraphicsPostProcessRenderer.h * Rim Software * * Created by <NAME> on 6/22/14. * Copyright 2014 __MyCompanyName__. All rights reserved. * */ #ifndef INCLUDE_RIM_GRAPHICS_POST_PROCESS_RENDERER_H #define INCLUDE_RIM_GRAPHICS_POST_PROCESS_RENDERER_H #include "rimGraphicsRenderersConfig.h" #include "rimGraphicsRenderer.h" #include "rimGraphicsPostProcessEffect.h" //########################################################################################## //********************** Start Rim Graphics Renderers Namespace ************************** RIM_GRAPHICS_RENDERERS_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class that renders a sequence of post-process effects. class PostProcessRenderer : public Renderer { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructors /// Create a new post process renderer for the given context with no effects to render. PostProcessRenderer( const Pointer<GraphicsContext>& newContext ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Rendering Method /// Render the post-process effects for this renderer. virtual void render(); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Effect Accessor Methods /// Return the number of post-process effects that this post process renderer renders. RIM_INLINE Size getEffectCount() const { return effects.getSize(); } /// Return a pointer to the post-process effect at the specified index in this renderer. RIM_INLINE const Pointer<PostProcessEffect>& getEffect( Index effectIndex ) const { return effects[effectIndex]; } /// Add a new post-process effect to this renderer that is rendered after the previously added effects. /** * The method returns whether or not the effect was successfully added. * The method fails if the effect is NULL or is invalid. */ Bool addEffect( const Pointer<PostProcessEffect>& newEffect ); /// Insert a new post-process effect to this renderer that is rendered at the specified index. /** * The method returns whether or not the effect was successfully added. * The method fails if the effect is NULL or is invalid. */ Bool insertEffect( Index effectIndex, const Pointer<PostProcessEffect>& newEffect ); /// Remove the effect at the specified index in this post process renderer. /** * The method returns whether or not the effect was successfully removed. */ Bool removeEffect( Index effectIndex ); /// Remove the specified effect from this post process renderer. /** * The method returns whether or not the effect was successfully removed. */ Bool removeEffect( const PostProcessEffect* effect ); /// Remove all effects from this post processes renderer. void clearEffects(); public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Members /// A pointer to the graphics context this post process renderer is using. Pointer<GraphicsContext> context; /// A list of the post process effects that should be rendered by this renderer, in order. ArrayList< Pointer<PostProcessEffect> > effects; }; //########################################################################################## //********************** End Rim Graphics Renderers Namespace **************************** RIM_GRAPHICS_RENDERERS_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_GRAPHICS_POST_PROCESS_RENDERER_H <file_sep>/* * rimSoundChannelMixMatrix.h * Rim Sound * * Created by <NAME> on 12/13/12. * Copyright 2012 __MyCompanyName__. All rights reserved. * */ #ifndef INCLUDE_RIM_SOUND_CHANNEL_MIX_MATRIX_H #define INCLUDE_RIM_SOUND_CHANNEL_MIX_MATRIX_H #include "rimSoundUtilitiesConfig.h" #include "rimSoundGain.h" //########################################################################################## //*********************** Start Rim Sound Utilities Namespace **************************** RIM_SOUND_UTILITIES_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class which holds a matrix of gain coefficients mapping from one channel configuration to another. /** * This class is used to represent the mapping from one channel configuration to another, * where the input configuration with N channels is mapped to the output configuration with * M channels using an NxM matrix of linear gain coefficients. */ class ChannelMixMatrix { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructors /// Create a new channel mix matrix with 0 input and output channels. RIM_INLINE ChannelMixMatrix() : gains( NULL ), numInputChannels( 0 ), numOutputChannels( 0 ), gainCapacity( 0 ) { } /// Create a new channel mix matrix with the specified number of input and output channels. RIM_INLINE ChannelMixMatrix( Size newNumInputChannels, Size newNumOutputChannels ) : gains( NULL ), gainCapacity( 0 ) { this->initializeMatrix( newNumInputChannels, newNumOutputChannels ); } /// Create a copy of the specified channel mix matrix object. ChannelMixMatrix( const ChannelMixMatrix& other ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Destructor /// Destroy this channel mix matrix object and release its resources. RIM_INLINE ~ChannelMixMatrix() { if ( gains != NULL ) rim::util::deallocate( gains ); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Assignment Operator /// Assign the state of the specified channel mix matrix to this mix matrix. ChannelMixMatrix& operator = ( const ChannelMixMatrix& other ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Channel Count Accessor Methods /// Return the current number of input channels for this channel mix matrix. RIM_INLINE Size getInputCount() const { return numInputChannels; } /// Set the number of input channels that this channel mix matrix should have. /** * This method reallocates the internal gain matrix if necessary * and causes the values of all previously stored gain values to become * undefined. */ RIM_INLINE void setInputCount( Size newNumInputChannels ) { this->resizeMatrix( newNumInputChannels, numOutputChannels ); } /// Return the current number of output channels for this channel mix matrix. RIM_INLINE Size getOutputCount() const { return numOutputChannels; } /// Set the number of output channels that this channel mix matrix should have. /** * This method reallocates the internal gain matrix if necessary * and causes the values of all previously stored gain values to become * undefined. */ RIM_INLINE void setOutputCount( Size newNumOutputChannels ) { this->resizeMatrix( numInputChannels, newNumOutputChannels ); } /// Set the number of input and output channels that this channel mix matrix should have. /** * This method reallocates the internal gain matrix if necessary * and causes the values of all previously stored gain values to become * undefined. */ RIM_INLINE void setSize( Size newNumInputChannels, Size newNumOutputChannels ) { this->resizeMatrix( newNumInputChannels, newNumOutputChannels ); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Gain Accessor Methods /// Return the linear gain associated with the input and output channels at the specified indices. RIM_INLINE Gain getGain( Index inputChannelIndex, Index outputChannelIndex ) const { return gains[inputChannelIndex*numOutputChannels + outputChannelIndex]; } /// Set the linear gain associated with the input and output channels at the specified indices. RIM_INLINE void setGain( Index inputChannelIndex, Index outputChannelIndex, Gain newGain ) { gains[inputChannelIndex*numOutputChannels + outputChannelIndex] = newGain; } /// Set every input-to-output channel pair to have the specified linear gain value. RIM_INLINE void setAllGains( Gain newGain ) { Gain* currentGain = gains; const Gain* const gainsEnd = gains + numInputChannels*numOutputChannels; while ( currentGain != gainsEnd ) { *currentGain = newGain; currentGain++; } } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Helper Methods /// Set every gain in the channel mix matrix to be 0. RIM_INLINE void zero() { Gain* currentGain = gains; const Gain* const gainsEnd = gains + numInputChannels*numOutputChannels; while ( currentGain != gainsEnd ) { *currentGain = Gain(0); currentGain++; } } private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Helper Methods /// Initialize the channel mix matrix using the specified number of input and output channels. void initializeMatrix( Size newNumInputChannels, Size newNumOutputChannels ); /// Resize the channel mix matrix to the specified number of input and output channels. void resizeMatrix( Size newNumInputChannels, Size newNumOutputChannels ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Members /// A pointer which points to a 2D matrix of gain values stored in a 1D array. Gain* gains; /// The number of input channels that this channel mix matrix has. Size numInputChannels; /// The number of output channels that this channel mix matrix has. Size numOutputChannels; /// The total size of the allocated gain array. Size gainCapacity; }; //########################################################################################## //*********************** End Rim Sound Utilities Namespace ****************************** RIM_SOUND_UTILITIES_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_SOUND_CHANNEL_MIX_MATRIX_H <file_sep>/* * rimGraphicsRasterMode.h * Rim Graphics * * Created by <NAME> on 3/16/13. * Copyright 2013 __MyCompanyName__. All rights reserved. * */ #ifndef INCLUDE_RIM_GRAPHICS_RASTER_MODE_H #define INCLUDE_RIM_GRAPHICS_RASTER_MODE_H #include "rimGraphicsUtilitiesConfig.h" //########################################################################################## //********************** Start Rim Graphics Utilities Namespace ************************** RIM_GRAPHICS_UTILITIES_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class which specifies the way that geometry is rasterized. class RasterMode { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Depth Test Enum Definition /// An enum type which represents the type of rasterization to perform. typedef enum Enum { /// A rasterization mode where only vertices are drawn. POINTS, /// A rasterization mode where lines are used to draw the outlines of rendering primitives. LINES, /// A rasterization mode where all of the area of rendering primitives is filled. TRIANGLES }; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructors /// Create a new raster mode with the specified raster mode enum value. RIM_INLINE RasterMode( Enum newMode ) : mode( newMode ) { } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Enum Cast Operator /// Convert this raster mode type to an enum value. RIM_INLINE operator Enum () const { return (Enum)mode; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** String Representation Accessor Methods /// Return a string representation of the raster mode. String toString() const; /// Convert this raster mode into a string representation. RIM_FORCE_INLINE operator String () const { return this->toString(); } private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Members /// An enum value which indicates the type of raster mode. UByte mode; }; //########################################################################################## //********************** End Rim Graphics Utilities Namespace **************************** RIM_GRAPHICS_UTILITIES_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_GRAPHICS_RASTER_MODE_H <file_sep>/* * rimGUIInputKeyCodeConverter.h * Rim GUI * * Created by <NAME> on 5/28/08. * Copyright 2008 __MyCompanyName__. All rights reserved. * */ #ifndef INCLUDE_RIM_GUI_INPUT_KEY_CODE_CONVERTER_H #define INCLUDE_RIM_GUI_INPUT_KEY_CODE_CONVERTER_H #include "rimGUIInputConfig.h" #include "rimGUIInputKey.h" //########################################################################################## //************************ Start Rim GUI Input Namespace *************************** RIM_GUI_INPUT_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class which is used to convert key codes from platform-specific codes to a generic code set. class KeyCodeConverter { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Static Key Conversion Methods /// Convert the specified Mac OS X key code to a generic code set. static Key::Code convertMacCode( Key::Code macKeyCode ) { if ( !keyCodesAreInitialized ) KeyCodeConverter::initializeKeyCodes(); Index index = macKeyCode & 0x7f; return MAC_KEY_CODE_MAPPING[index]; } /// Convert the specified Windows key code to a generic code set. static Key::Code convertWindowsCode( Key::Code windowsKeyCode ) { if ( !keyCodesAreInitialized ) KeyCodeConverter::initializeKeyCodes(); Index index = windowsKeyCode & 0xff; return WINDOWS_KEY_CODE_MAPPING[index]; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Static Key Accessor Methods /// Return a reference to the Key object for the specified Mac OS X key code. RIM_INLINE static const Key& getKeyForMacCode( Key::Code macKeyCode ) { return Key::getKeyWithCode( KeyCodeConverter::convertMacCode( macKeyCode ) ); } /// Return a reference to the Key object for the specified Windows key code. RIM_INLINE static const Key& getKeyForWindowsCode( Key::Code windowsKeyCode ) { return Key::getKeyWithCode( KeyCodeConverter::convertWindowsCode( windowsKeyCode ) ); } private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Constructor /// Declared private to avoid instantiation. KeyCodeConverter() { } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Methods /// Initialized the key code mappings for all platforms. static void initializeKeyCodes(); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Static Data Members /// An array of key codes that map from Mac OS X key code indices to generic key codes. static Key::Code MAC_KEY_CODE_MAPPING[128]; /// An array of key codes that map from Windows key code indices to generic key codes. static Key::Code WINDOWS_KEY_CODE_MAPPING[256]; /// Whether or not the key code conversion tables are initialized. static Bool keyCodesAreInitialized; }; //########################################################################################## //************************ End Rim GUI Input Namespace ***************************** RIM_GUI_INPUT_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_GUI_INPUT_KEY_CODE_CONVERTER_H <file_sep>/* * rimGraphicsDeviceManager.h * Rim Graphics * * Created by <NAME> on 3/1/13. * Copyright 2013 __MyCompanyName__. All rights reserved. * */ #ifndef INCLUDE_RIM_GRAPHICS_DEVICE_MANAGER_H #define INCLUDE_RIM_GRAPHICS_DEVICE_MANAGER_H #include "rimGraphicsDevicesConfig.h" #include "rimGraphicsDevice.h" #include "rimGraphicsDeviceType.h" //########################################################################################## //*********************** Start Rim Graphics Devices Namespace *************************** RIM_GRAPHICS_DEVICES_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class which enumerates the available kinds of graphics devices for this system. /** * This allows the user to pick an arbitrary GraphicsDevice and use it for rendering. * For instance, the device manager might support 2 devices: one for OpenGL and another * for Direct3D. The user can pick a device at run time and use it. */ class GraphicsDeviceManager { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructors /// Create a new graphics device manager which inspects the available system graphics devices. GraphicsDeviceManager(); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Destructor /// Destroy this graphics device manager and release all associated resources. virtual ~GraphicsDeviceManager(); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Device Accessor Methods /// Return the total number of graphics devices that this manager is aware of. Size getDeviceCount() const; /// Return a pointer to the graphics device at the specified index in the device manager. /** * If an invalid device index is specified, a NULL pointer is returned. */ Pointer<GraphicsDevice> getDevice( Index deviceIndex ) const; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Default Device Accessor Method /// Return a pointer to the default graphics device for this system. /** * If there are no devices present which could be the default, a NULL pointer is returned. */ Pointer<GraphicsDevice> getDefaultDevice() const; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Device Type Methods /// Return a pointer to the graphics device on this system with the specified device type. /** * If there are no devices present with that device type, a NULL pointer is returned. */ Pointer<GraphicsDevice> getDeviceWithType( const GraphicsDeviceType& newType ) const; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Device Registration Methods /// Register the specified graphics device pointer with this device manager. /** * This allows the user to make the manager aware of new types of devices * that it might not be aware of. The method returns whether or not the specified * device was able to be registered. The method can fail if the new device * pointer is NULL. */ virtual Bool registerDevice( const Pointer<GraphicsDevice>& newDevice ); protected: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Protected Helper Method /// Detect the devices that are available on this system and add them to the device list. virtual void detectDevices(); private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Members /// A list of pointers to graphics devices that are available on this system. ArrayList< Pointer<GraphicsDevice> > devices; /// A boolean value indicating whether or not the device manager has already determined the available devices. mutable Bool detectedDevices; }; //########################################################################################## //*********************** End Rim Graphics Devices Namespace ***************************** RIM_GRAPHICS_DEVICES_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_GRAPHICS_DEVICE_MANAGER_H <file_sep>#pragma once /** * Since dealing with angles is difficult and confusing enough with out trying * to remember if x equals Yaw or Y equals pitch, as well as wondering if the * angles are in degrees or radians, this class encapsulates the orientation * data in methods with intelligent names to facilitate ease in programming and * increase readability. * * Author: <NAME> * */ class Orientation { // Yaw about z, pitch, about y, roll about x : alpha, beta, gamma private: double yaw; double pitch; double roll; /** * Constructs a deep copy of the passed in <code>Orientation</code> * * @param orientationToCopy * The <code>Orientation</code> to be copied. */ public: Orientation(const Orientation& orientationToCopy) { yaw = orientationToCopy.yaw; pitch = orientationToCopy.pitch; roll = orientationToCopy.roll; } // default constructor: roll, pitch, yaw set to 0 Orientation(){ yaw = 0; pitch = 0; roll = 0; } /* * Internal use only. This should only be called by the * buildOrientationFromRadians function so users have a more verbosely named * function to describe what to pass and how it should be used. */ private: Orientation(double yawRadians, double pitchRadians, double rollRadians) { yaw = yawRadians; pitch = pitchRadians; roll = rollRadians; } /** * This static build function is to help point out that the orientation * should be in radians instead of just being a constructor named * Orientation that takes some numbers but does effectively the same thing as * if there were a constructor taking the same parameters available.. * * @param yawRadians * The rotation about the Z-axis in radians. * @param pitchRadians * The rotation about the Y-axis in radians. * @param rollRadians * The rotation about the X-axis in radians. * @return A properly constructed <code>Orientation</code> object */ public: static Orientation buildOrientationFromRadians(double yawRadians, double pitchRadians, double rollRadians) { return Orientation(yawRadians, pitchRadians, rollRadians); } /** * Returns the yaw in radians. * * @return The rotation about the Z-axis in radians. */ double getYawRadians() const { return yaw; } /** * Returns the pitch in radians. * * @return The rotation about the Y-axis in radians. */ double getPitchRadians() const { return pitch; } /** * Returns the roll in radians. * * @return The rotation about the X axis-in radians. */ double getRollRadians() const { return roll; } }; <file_sep>/* * rimGraphicsGUIMeterDelegate.h * Rim Graphics GUI * * Created by <NAME> on 2/13/13. * Copyright 2013 Headspace Systems. All rights reserved. * */ #ifndef INCLUDE_RIM_GRAPHICS_GUI_METER_DELEGATE_H #define INCLUDE_RIM_GRAPHICS_GUI_METER_DELEGATE_H #include "rimGraphicsGUIConfig.h" //########################################################################################## //************************ Start Rim Graphics GUI Namespace ****************************** RIM_GRAPHICS_GUI_NAMESPACE_START //****************************************************************************************** //########################################################################################## class Meter; //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class which contains function objects that recieve Meter events. /** * Any meter-related event that might be processed has an appropriate callback * function object. Each callback function is called by the button * whenever such an event is received. If a callback function in the delegate * is not initialized, a meter simply ignores it. */ class MeterDelegate { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Meter Delegate Callback Functions /// A function object which is called whenever a meter's displayed value should update. /** * The delegate function can provide a new value to the meter by writing * the new value to the output parameter and returning TRUE, indicating that * the new value should be used. */ Function<Bool ( Meter& meter, Float& newValue )> update; }; //########################################################################################## //************************ End Rim Graphics GUI Namespace ******************************** RIM_GRAPHICS_GUI_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_GRAPHICS_GUI_METER_DELEGATE_H <file_sep>/* * Roadmap.cpp * Quadcopter * * Created by <NAME> on 12/5/14. * Copyright 2014 __MyCompanyName__. All rights reserved. * */ #include "Roadmap.h" class Foo { public: inline Foo( const Pointer<GenericBufferList>& b, Index i ) : bufferList( b ), indexOffset(i) { } inline Bool operator == ( const Foo& other ) const { return bufferList == other.bufferList; } Pointer<GenericBufferList> bufferList; Index indexOffset; }; ArrayList<Triangle<Vector3f> > convertGenericMeshToMesh( const GenericMeshShape& genericMesh ) { ArrayList<Vector3f> vertices; ArrayList< Triangle<Index> > triangles; Index vertexOffset = 0; ArrayList<Foo> pastBuffers; for ( Index g = 0; g < genericMesh.getGroupCount(); g++ ) { const Pointer<GenericMeshGroup>& group = genericMesh.getGroup(g); const BufferRange& bufferRange = group->getBufferRange(); if ( bufferRange.getPrimitiveType() != IndexedPrimitiveType::TRIANGLES ) continue; //*********************************************************************** const Pointer<GenericBufferList>& vertexBuffers = group->getVertexBuffers(); Index pastBufferIndex; Index currentVertexOffset = 0; if ( !pastBuffers.getIndex( Foo( vertexBuffers, 0 ), pastBufferIndex ) ) { Pointer<GenericBuffer> positionBuffer = vertexBuffers->getBufferWithUsage( VertexUsage::POSITION ); if ( positionBuffer.isNull() ) continue; for ( Index i = 0; i < positionBuffer->getSize(); i++ ) vertices.add( positionBuffer->get<Vector3f>(i) ); currentVertexOffset = vertexOffset; pastBuffers.add( Foo( vertexBuffers, vertexOffset ) ); vertexOffset += positionBuffer->getSize(); } else { currentVertexOffset = pastBuffers[pastBufferIndex].indexOffset; } //*********************************************************************** const Pointer<GenericBuffer>& indexBuffer = group->getIndexBuffer(); if ( indexBuffer.isNull() ) continue; if ( indexBuffer->getAttributeType() == AttributeType::get<UInt32>() ) { for ( Index i = 0; i < indexBuffer->getSize(); i += 3 ) { Index v0 = currentVertexOffset + indexBuffer->get<UInt32>(i); Index v1 = currentVertexOffset + indexBuffer->get<UInt32>(i + 1); Index v2 = currentVertexOffset + indexBuffer->get<UInt32>(i + 2); triangles.add( Triangle<Index>( v0, v1, v2 ) ); } } } //*********************************************************************** ArrayList<Triangle<Vector3f> > outputTriangles; for ( Index t = 0; t < triangles.getSize(); t++ ) { outputTriangles.add( Triangle<Vector3f>( vertices[triangles[t].v1], vertices[triangles[t].v2], vertices[triangles[t].v3] ) ); } return outputTriangles; } class Roadmap:: TriangleSet : public bvh::PrimitiveInterface { public: TriangleSet( const Pointer<GenericMeshShape>& mesh ) : triangles( convertGenericMeshToMesh( *mesh ) ) { } virtual Size getSize() const { return triangles.getSize(); } virtual PrimitiveInterfaceType getType() const { return PrimitiveInterfaceType::TRIANGLES; } virtual AABB3f getAABB( Index primitiveIndex ) const { const Triangle<Vector3f>& t = triangles[primitiveIndex]; AABB3f result( t.v1 ); result.enlargeFor( t.v2 ); result.enlargeFor( t.v3 ); return result; } virtual bvh::BoundingSphere<Float> getBoundingSphere( Index primitiveIndex ) const { const Triangle<Vector3f>& t = triangles[primitiveIndex]; return bvh::BoundingSphere<Float>( t.v1, t.v2, t.v3 ); } virtual Bool intersectRay( Index primitiveIndex, const Ray3f& ray, Float& distance ) const { return true; } virtual Bool intersectRay( const Index* primitiveIndices, Size numPrimitives, const Ray3f& ray, Float& distance, Index& closestPrimitive ) const { return true; } virtual Bool getTriangle( Index primitiveIndex, Vector3f& v0, Vector3f& v1, Vector3f& v2 ) const { if ( primitiveIndex < triangles.getSize() ) { const Triangle<Vector3f>& t = triangles[primitiveIndex]; v0 = t.v1; v1 = t.v2; v2 = t.v3; return true; } return false; } private: ArrayList< Triangle<Vector3f> > triangles; }; Roadmap:: Roadmap( const Pointer<GenericMeshShape>& mesh ) { bvh = Pointer<AABBTree4>::construct( Pointer<TriangleSet>::construct( mesh ) ); bvh->rebuild(); } Bool Roadmap:: link( const Vector3f& start, const Vector3f& end ) const { Float distance; Ray3f ray( start, (end - start).normalize( distance ) ); return !bvh->traceRay( ray, distance, stack.getRoot() ); } static Float getSphereHalfAngleSize( Float observerDistance, Float sphereRadius ) { const Float hypotenuseSquared = math::square(observerDistance) - math::square(sphereRadius); const Float sphereHalfAngle = hypotenuseSquared > 0 ? math::acos( math::sqrt( hypotenuseSquared ) / observerDistance ) : Float(0); return sphereHalfAngle; } static Vector3f getRandomDirectionInZCone( math::RandomVariable<Float>& variable, Real halfAngle ) { Real u1 = variable.sample( math::cos(halfAngle), Real(1) ); Real u2 = variable.sample( Real(0), Real(1) ); Real r = math::sqrt( Real(1) - u1*u1 ); Real theta = Real(2)*math::pi<Real>()*u2; return Vector3f( r*math::cos( theta ), r*math::sin( theta ), u1 ); } static Bool rayIntersectsSphere( const Ray3f& ray, const bvh::BoundingSphere<Float>& sphere, Real& distanceAlongRay ) { Vector3 d = sphere.position - ray.origin; Real dSquared = d.getMagnitudeSquared(); Real rSquared = sphere.radius*sphere.radius; if ( dSquared < rSquared ) { // The ray starts inside the sphere and therefore we have an intersection. distanceAlongRay = Real(0); return true; } else { // Find the closest point on the ray to the sphere's center. Real t1 = math::dot( d, ray.direction ); if ( t1 < math::epsilon<Real>() ) { // The ray points away from the sphere so there is no intersection. return false; } // Find the distance from the closest point to the sphere's surface. Real t2Squared = rSquared - dSquared + t1*t1; if ( t2Squared < math::epsilon<Real>() ) return false; // Compute the distance along the ray of the intersection. distanceAlongRay = t1 - math::sqrt(t2Squared); return true; } } Bool Roadmap:: link( const Vector3f& start, const Vector3f& end, Float radius, Size numSamples ) const { Vector3f detectorDirection = start - end; Float detectorDistance = detectorDirection.getMagnitude(); detectorDirection /= detectorDistance; // Compute the angular size of the detector. const Float detectorHalfAngle = getSphereHalfAngleSize( detectorDistance, radius ); // Compute the rotation matrix for the direction samples. Matrix3f detectorRotation = Matrix3::planeBasis( detectorDirection ); // Take samples to determine the detector's visibility. Size numVisible = 0; for ( Index i = 0; i < numSamples; i++ ) { // Generate a ray that samples the detectors's visibility. Ray3f validationRay( end, detectorRotation*getRandomDirectionInZCone( randomVariable, detectorHalfAngle ) ); // Determine the distance along the ray where the sphere is intersected. Float rayDistance; if ( !rayIntersectsSphere( validationRay, bvh::BoundingSphere<Float>( start, radius ), rayDistance ) ) continue; // Trace a ray to see if that point is visible. if ( !bvh->traceRay( validationRay, rayDistance, stack.getRoot() ) ) numVisible++; } return numVisible == numSamples; } void Roadmap:: rebuild( const AABB3f& bounds, Size numSamples, const Vector3f& start, const Vector3f& goal ) { nodes.clear(); nodes.add( Node( start ) ); nodes.add( Node( goal ) ); for ( Index i = 0; i < numSamples; i++ ) { Vector3f p( math::random( bounds.min.x, bounds.max.x ), math::random( bounds.min.y, bounds.max.y ), math::random( bounds.min.z, bounds.max.z ) ); nodes.add( Node( p ) ); } const Float distanceThreshold = 100.0; const Float distanceThreshold2 = distanceThreshold*distanceThreshold; const Size maxNeighbors = 10; ArrayList< Tuple<Index,Float> > neighbors; for ( Index i = 0; i < nodes.getSize(); i++ ) { const Vector3f& p1 = nodes[i].position; Float maxNeighborDist = 0; for ( Index j = i + 1; j < nodes.getSize(); j++ ) { const Vector3f& p2 = nodes[j].position; Float distSquared = p1.getDistanceToSquared(p2); if ( neighbors.getSize() < maxNeighbors || distSquared < maxNeighborDist ) { if ( link( p1, p2, 2.0f ) && link( p2, p1, 2.0f ) ) //if ( link( p1, p2 ) ) { if ( neighbors.getSize() < maxNeighbors ) { neighbors.add( Tuple<Index,Float>( j, distSquared ) ); maxNeighborDist = math::max( distSquared, maxNeighborDist ); } else { Index maxIndex = 0; Float maxDist = 0; for ( Index k = 0; k < neighbors.getSize(); k++ ) { if ( neighbors[k].value2 > maxDist ) { maxDist = neighbors[k].value2; maxIndex = k; } } neighbors[maxIndex] = Tuple<Index,Float>( j, distSquared ); maxNeighborDist = math::max( distSquared, maxDist ); } } } } for ( Index j = 0; j < neighbors.getSize(); j++ ) { nodes[i].neighbors.add( neighbors[j].value1 ); nodes[neighbors[j].value1].neighbors.add( i ); } neighbors.clear(); } } Bool Roadmap:: traceRay( const Vector3f& start, const Vector3f& direction, Float maxDistance, Float& t ) { Ray3f ray( start, direction.normalize() ); Index primitive; return bvh->traceRay( ray, maxDistance, stack.getRoot(), t, primitive ); } Index Roadmap:: getClosestNode( const Vector3f& position ) const { const Size numNodes = nodes.getSize(); Float minDistance = math::max<Float>(); Index minIndex = 0; for ( Index i = 0; i < numNodes; i++ ) { Float distance = nodes[i].position.getDistanceTo( position ); if ( distance < minDistance ) { minDistance = distance; minIndex = i; } } return minIndex; } <file_sep>/* * rimImagesColor3D.h * Rim Images * * Created by <NAME> on 9/17/09. * Copyright 2009 Rim Software. All rights reserved. * */ #ifndef INCLUDE_RIM_IMAGES_COLOR_3D_H #define INCLUDE_RIM_IMAGES_COLOR_3D_H #include "rimImagesConfig.h" //########################################################################################## //**************************** Start Rim Images Namespace ******************************** RIM_IMAGES_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A template class representing a 3-component color. template < typename T > class Color3D { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructors /// Create a new 3D color with all elements equal to zero. RIM_INLINE Color3D<T>() : r( T(0) ), g( T(0) ), b( T(0) ) { } /// Create a new 3D color with all elements equal to a single value. /** * This constructor creates a uniform 3D color with all elements * equal to each other and equal to the single constructor parameter * value. * * @param value - The value to set all elements of the color to. */ explicit RIM_INLINE Color3D<T>( T value ) : r( value ), g( value ), b( value ) { } /// Create a new 3D color by specifying it's x, y, and z values. /** * This constructor sets each of the color's x, y, and z component * values to be the 1st, 2nd, and 3rd parameters of the constructor, * respectively. * * @param newX - The X component of the new color. * @param newY - The Y component of the new color. * @param newZ - The Z component of the new color. */ RIM_INLINE Color3D<T>( T newR, T newG, T newB ) : r( newR ), g( newG ), b( newB ) { } /// Create a new 3D color from an existing color (copy it). /** * This constructor takes the x, y, and z values of the * color parameter and sets the components of this color * to be the same. * * @param color - The color to be copied. */ RIM_INLINE Color3D<T>( const Color3D<T>& color ) : r( color.r ), g( color.g ), b( color.b ) { } /// Create a new 3D color from an existing 3D vector (copy it). /** * This constructor takes the x, y, and z values of the * vector parameter and sets the components of this color * to be the same. * * @param vector - The vector to be copied. */ RIM_INLINE Color3D<T>( const math::Vector3D<T>& vector ) : r( vector.r ), g( vector.g ), b( vector.b ) { } /// Create a new 3D color from an existing color (copy it), templatized version. /** * This constructor takes the x, y, and z values of the * color parameter and sets the components of this color * to be the same. This is a templatized version of the above copy constructor. * * @param color - The color to be copied. */ template < typename U > RIM_INLINE Color3D<T>( const Color3D<U>& color ) : r( color.r ), g( color.g ), b( color.b ) { } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Element Accessor Methods /// Get a shallow array representation of this color. /** * This method returns a pointer to the address of the red component * of the color and does not do any copying of the elements. * Therefore, this method should only be used where one needs * an array representation of a color without having to * allocate more memory and copy the color. * * @return A pointer to a shallow array copy of this color. */ RIM_INLINE const T* toArray() const { return &r; } /// Get the X component of this color. RIM_INLINE T getRed() const { return r; } /// Get the Y component of this color. RIM_INLINE T getGreen() const { return g; } /// Get the Z component of this color. RIM_INLINE T getBlue() const { return b; } /// Set the red component of the color to the specified value. RIM_INLINE void setRed( T newRed ) { r = newRed; } /// Set the green component of the color to the specified value. RIM_INLINE void setGreen( T newGreen ) { g = newGreen; } /// Set the blue component of the color to the specified value. RIM_INLINE void setBlue( T newBlue ) { b = newBlue; } /// Set the red, green, and blue components of the color to the specified values. /** * This method takes 3 parameter representing the 3 components of this * color and sets this color's components to have those values. * * @param newR - The new red component of the color. * @param newG - The new green component of the color. * @param newB - The new blue component of the color. */ RIM_INLINE void set( T newR, T newG, T newB ) { r = newR; g = newG; b = newB; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Casting Operators /// This operator casts this color to another with different template paramter. /** * This method provides an operator for the casting of this * color to another color with a potentially different template * paramter. * * @return the cast version of this color. */ template < typename U > RIM_INLINE operator Color3D<U>() { return Color3D<U>( (U)r, (U)g, (U)b ); } /// This operator casts this color to another with different template paramter. /** * This method provides an operator for the casting of this * color to another color with a potentially different template * paramter. This is the const version of this operator. * * @return the cast version of this color. */ template < typename U > RIM_INLINE operator Color3D<U>() const { return Color3D<U>( (U)r, (U)g, (U)b ); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Comparison Operators /// Compare two colors component-wise for equality RIM_INLINE bool operator == ( const Color3D<T>& v ) const { return r == v.r && g == v.g && b == v.b; } /// Compare two colors component-wise for inequality RIM_INLINE bool operator != ( const Color3D<T>& v ) const { return r != v.r || g != v.g || b != v.b; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Arithmatic Operators /// Add this color to another and return the result. /** * This method adds another color to this one, component-wise, * and returns this addition. It does not modify either of the original * colors. * * @param color - The color to add to this one. * @return The addition of this color and the parameter. */ RIM_INLINE Color3D<T> operator + ( const Color3D<T>& color ) const { return Color3D<T>( r + color.r, g + color.g, b + color.b ); } /// Add a value to every component of this color. /** * This method adds the value parameter to every component * of the color, and returns a color representing this result. * It does not modifiy the original color. * * @param value - The value to add to all components of this color. * @return The resulting color of this addition. */ RIM_INLINE Color3D<T> operator + ( const T& value ) const { return Color3D<T>( r + value, g + value, b + value ); } /// Subtract a color from this color component-wise and return the result. /** * This method subtracts another color from this one, component-wise, * and returns this subtraction. It does not modify either of the original * colors. * * @param color - The color to subtract from this one. * @return The subtraction of the the parameter from this color. */ RIM_INLINE Color3D<T> operator - ( const Color3D<T>& color ) const { return Color3D<T>( r - color.r, g - color.g, b - color.b ); } /// Subtract a value from every component of this color. /** * This method subtracts the value parameter from every component * of the color, and returns a color representing this result. * It does not modifiy the original color. * * @param value - The value to subtract from all components of this color. * @return The resulting color of this subtraction. */ RIM_INLINE Color3D<T> operator - ( const T& value ) const { return Color3D<T>( r - value, g - value, b - value ); } /// Multiply component-wise this color and another color. /** * This operator multiplies each component of this color * by the corresponding component of the other color and * returns a color representing this result. It does not modify * either original color. * * @param color - The color to multiply this color by. * @return The result of the multiplication. */ RIM_INLINE Color3D<T> operator * ( const Color3D<T>& color ) const { return Color3D<T>( r*color.r, g*color.g, b*color.b ); } /// Multiply every component of this color by a value and return the result. /** * This method multiplies the value parameter with every component * of the color, and returns a color representing this result. * It does not modifiy the original color. * * @param value - The value to multiplly with all components of this color. * @return The resulting color of this multiplication. */ RIM_INLINE Color3D<T> operator * ( const T& value ) const { return Color3D<T>( r*value, g*value, b*value ); } /// Divide every component of this color by a value and return the result. /** * This method Divides every component of the color by the value parameter, * and returns a color representing this result. * It does not modifiy the original color. * * @param value - The value to divide all components of this color by. * @return The resulting color of this division. */ RIM_INLINE Color3D<T> operator / ( const T& value ) const { T inverseValue = T(1) / value; return Color3D<T>( r*inverseValue, g*inverseValue, b*inverseValue ); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Arithmatic Assignment Operators with Colors /// Add a color to this color, modifying this original color. /** * This method adds another color to this color, component-wise, * and sets this color to have the result of this addition. * * @param color - The color to add to this color. * @return A reference to this modified color. */ RIM_INLINE Color3D<T>& operator += ( const Color3D<T>& color ) { r += color.r; g += color.g; b += color.b; return *this; } /// Subtract a color from this color, modifying this original color. /** * This method subtracts another color from this color, component-wise, * and sets this color to have the result of this subtraction. * * @param color - The color to subtract from this color. * @return A reference to this modified color. */ RIM_INLINE Color3D<T>& operator -= ( const Color3D<T>& color ) { r -= color.r; g -= color.g; b -= color.b; return *this; } /// Multiply component-wise this color and another color and modify this color. /** * This operator multiplies each component of this color * by the corresponding component of the other color and * modifies this color to contain the result. * * @param color - The color to multiply this color by. * @return A reference to this modified color. */ RIM_INLINE Color3D<T>& operator *= ( const Color3D<T>& color ) { r *= color.r; g *= color.g; b *= color.b; return *this; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Arithmatic Assignment Operators with Values /// Add a value to each component of this color, modifying it. /** * This operator adds a value to each component of this color * and modifies this color to store the result. * * @param value - The value to add to every component of this color. * @return A reference to this modified color. */ RIM_INLINE Color3D<T>& operator += ( const T& value ) { r += value; g += value; b += value; return *this; } /// Subtract a value from each component of this color, modifying it. /** * This operator subtracts a value from each component of this color * and modifies this color to store the result. * * @param value - The value to subtract from every component of this color. * @return A reference to this modified color. */ RIM_INLINE Color3D<T>& operator -= ( const T& value ) { r -= value; g -= value; b -= value; return *this; } /// Multiply a value with each component of this color, modifying it. /** * This operator multiplies a value with each component of this color * and modifies this color to store the result. * * @param value - The value to multiply with every component of this color. * @return A reference to this modified color. */ RIM_INLINE Color3D<T>& operator *= ( const T& value ) { r *= value; g *= value; b *= value; return *this; } /// Divide each component of this color by a value, modifying it. /** * This operator Divides each component of this color by value * and modifies this color to store the result. * * @param value - The value to multiply with every component of this color. * @return A reference to this modified color. */ RIM_INLINE Color3D<T>& operator /= ( const T& value ) { T inverseValue = T(1) / value; r *= inverseValue; g *= inverseValue; b *= inverseValue; return *this; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** String Conversion Methods /// Convert this color into a human-readable string representation. RIM_NO_INLINE data::String toString() const { data::StringBuffer buffer; buffer << "( " << r << ", " << g << ", " << b << " )"; return buffer.toString(); } /// Convert this color into a human-readable string representation. RIM_FORCE_INLINE operator data::String () const { return this->toString(); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Public Data Members /// The red component of a 3D color. T r; /// The green component of a 3D color. T g; /// The blue component of a 3D color. T b; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Public Static Data Members /// A constant color with all elements equal to zero. static const Color3D<T> ZERO; /// A constant color with all elements equal to zero. static const Color3D<T> BLACK; /// A constant color with all elements equal to one. static const Color3D<T> WHITE; }; template <typename T> const Color3D<T> Color3D<T>:: ZERO( 0, 0, 0 ); template <typename T> const Color3D<T> Color3D<T>:: BLACK( 0, 0, 0 ); template <typename T> const Color3D<T> Color3D<T>:: WHITE( 1, 1, 1 ); //########################################################################################## //########################################################################################## //############ //############ Commutative Arithmatic Operators //############ //########################################################################################## //########################################################################################## /// Add a value to every component of the color. /** * This operator adds the value parameter to every component * of the color, and returns a color representing this result. * It does not modifiy the original color. * * @param value - The value to add to all components of the color. * @param color - The color to be added to. * @return The resulting color of this addition. */ template < typename T > RIM_INLINE Color3D<T> operator + ( const T& value, const Color3D<T>& color ) { return Color3D<T>( color.r + value, color.g + value, color.b + value ); } /// Subtract every component of the color from the value, returning a color result. /** * This operator subtracts every component of the 2nd paramter, a color, * from the 1st paramter, a value, and then returns a color containing the * resulting coloral components. This operator does not modify the orignal color. * * @param value - The value to subtract all components of the color from. * @param color - The color to be subtracted. * @return The resulting color of this subtraction. */ template < typename T > RIM_INLINE Color3D<T> operator - ( const T& value, const Color3D<T>& color ) { return Color3D<T>( value - color.r, value - color.g, value - color.b ); } /// Multiply every component of the color with the value, returning a color result. /** * This operator multiplies every component of the 2nd paramter, a color, * from the 1st paramter, a value, and then returns a color containing the * resulting coloral components. This operator does not modify the orignal color. * * @param value - The value to multiply with all components of the color. * @param color - The color to be multiplied with. * @return The resulting color of this multiplication. */ template < typename T > RIM_INLINE Color3D<T> operator * ( const T& value, const Color3D<T>& color ) { return Color3D<T>( color.r*value, color.g*value, color.b*value ); } /// Divide a value by every component of the color, returning a color result. /** * This operator divides the provided value by every component of * the color, returning a color representing the component-wise division. * The operator does not modify the original color. * * @param value - The value to be divided by all components of the color. * @param color - The color to be divided by. * @return The resulting color of this division. */ template < typename T > RIM_INLINE Color3D<T> operator / ( const T& value, const Color3D<T>& color ) { return Color3D<T>( value/color.r, value/color.g, value/color.b ); } typedef Color3D<Int> Color3i; typedef Color3D<UByte> Color3b; typedef Color3D<Float> Color3f; typedef Color3D<Double> Color3d; //########################################################################################## //**************************** End Rim Images Namespace ********************************** RIM_IMAGES_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_IMAGES_COLOR_3D_H <file_sep>/* * rimGraphicsDevices.h * Rim Graphics * * Created by <NAME> on 3/2/13. * Copyright 2013 __MyCompanyName__. All rights reserved. * */ #ifndef INCLUDE_RIM_GRAPHICS_DEVICES_H #define INCLUDE_RIM_GRAPHICS_DEVICES_H #include "devices/rimGraphicsDevicesConfig.h" // Devices #include "devices/rimGraphicsDevice.h" #include "devices/rimGraphicsDeviceInfo.h" #include "devices/rimGraphicsDeviceManager.h" // Contexts #include "devices/rimGraphicsContext.h" #include "devices/rimGraphicsPixelFormat.h" #include "devices/rimGraphicsContextFlags.h" #endif // INCLUDE_RIM_GRAPHICS_DEVICES_H <file_sep>/* * rimImageIOConfig.h * Rim Images * * Created by <NAME> on 12/29/08. * Copyright 2008 Rim Software. All rights reserved. * */ #ifndef _INCLUDE_RIM_IMAGE_IO_CONFIG_H_ #define _INCLUDE_RIM_IMAGE_IO_CONFIG_H_ #include "../rimImagesConfig.h" #include "../rimImage.h" //########################################################################################## //########################################################################################## //############ //############ Library Namespace Configuration //############ //########################################################################################## //########################################################################################## #ifndef RIM_IMAGE_IO_NAMESPACE_START #define RIM_IMAGE_IO_NAMESPACE_START RIM_IMAGES_NAMESPACE_START namespace io { #endif #ifndef RIM_IMAGE_IO_NAMESPACE_END #define RIM_IMAGE_IO_NAMESPACE_END }; RIM_IMAGES_NAMESPACE_END #endif //########################################################################################## //*************************** Start Rim Image IO Namespace ******************************* RIM_IMAGE_IO_NAMESPACE_START //****************************************************************************************** //########################################################################################## //########################################################################################## //*************************** End Rim Image IO Namespace ********************************* RIM_IMAGE_IO_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // _INCLUDE_RIM_IMAGE_IO_CONFIG_H_ <file_sep>/* * rimGraphicsGenericCapsuleShape.h * Rim Software * * Created by <NAME> on 6/22/14. * Copyright 2014 __MyCompanyName__. All rights reserved. * */ #ifndef INCLUDE_RIM_GRAPHICS_GENERIC_CAPSULE_SHAPE_H #define INCLUDE_RIM_GRAPHICS_GENERIC_CAPSULE_SHAPE_H #include "rimGraphicsShapesConfig.h" #include "rimGraphicsShapeBase.h" //########################################################################################## //*********************** Start Rim Graphics Shapes Namespace **************************** RIM_GRAPHICS_SHAPES_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class which represents a generic capsule shape. /** * A capsule can have different radii that cause it to instead be a * truncated cone. * It has an associated generic material for use in drawing. */ class GenericCapsuleShape : public GraphicsShapeBase<GenericCapsuleShape> { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructors /// Create a capsule shape centered at the origin with a radius and height of 1. GenericCapsuleShape(); /// Create a capsule shape with the specified endpoints and radius. GenericCapsuleShape( const Vector3& newEndpoint1, const Vector3& newEndpoint2, Real newRadius ); /// Create a capsule shape with the specified endpoints and radii. GenericCapsuleShape( const Vector3& newEndpoint1, const Vector3& newEndpoint2, Real newRadius1, Real newRadius2 ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Endpoint Accessor Methods /// Return a const reference to the center of this capsule shape's first endcap in local coordinates. RIM_FORCE_INLINE const Vector3& getEndpoint1() const { return endpoint1; } /// Set the center of this capsule shape's first endcap in local coordinates. void setEndpoint1( const Vector3& newEndpoint1 ); /// Return a const reference to the center of this capsule shape's second endcap in local coordinates. RIM_FORCE_INLINE const Vector3& getEndpoint2() const { return endpoint2; } /// Set the center of this capsule shape's second endcap in local coordinates. void setEndpoint2( const Vector3& newEndpoint2 ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Axis Accessor Methods /// Return a normalized axis vector for this capsule, directed from endpoint 1 to endpoint 2. RIM_FORCE_INLINE const Vector3& getAxis() const { return axis; } /// Set a normalized axis vector for this capsule, directed from endpoint 1 to endpoint 2. /** * Setting this capsule's axis keeps the capsule's first endpoint stationary in shape * space and moves the second endpoint based on the new axis and capsule's height. */ void setAxis( const Vector3& newAxis ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Height Accessor Methods /// Get the distance between the endpoints of this capsule shape in local coordinates. RIM_FORCE_INLINE Real getHeight() const { return height; } /// Set the distance between the endpoints of this capsule shape in local coordinates. /** * The value is clamed to the range of [0,+infinity). Setting this height value * causes the cylilnder's second endpoint to be repositioned, keeping the first * endpoint stationary, based on the capsule's current axis vector. */ void setHeight( Real newHeight ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Radius Accessor Methods /// Get the first endcap radius of this capsule shape in local coordinates. RIM_FORCE_INLINE Real getRadius1() const { return radius1; } /// Set the first endcap radius of this capsule shape in local coordinates. /** * The radius is clamed to the range of [0,+infinity). */ void setRadius1( Real newRadius1 ); /// Get the second endcap radius of this capsule shape in local coordinates. RIM_FORCE_INLINE Real getRadius2() const { return radius2; } /// Set the second endcap radius of this capsule shape in local coordinates. /** * The radius is clamed to the range of [0,+infinity). */ void setRadius2( Real newRadius2 ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Material Accessor Methods /// Get the material of this generic capsule shape. RIM_INLINE Pointer<GenericMaterial>& getMaterial() { return material; } /// Get the material of this generic capsule shape. RIM_INLINE const Pointer<GenericMaterial>& getMaterial() const { return material; } /// Set the material of this generic capsule shape. RIM_INLINE void setMaterial( const Pointer<GenericMaterial>& newMaterial ) { material = newMaterial; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Bounding Capsule Update Method /// Update the shape's bounding capsule based on its current geometric representation. virtual void updateBoundingBox(); private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Members /// The center of the first circular cap of this capsule in shape coordinates. Vector3 endpoint1; /// The center of the second circular cap of this capsule in shape coordiantes. Vector3 endpoint2; /// The normalized axis vector for this capsule in shape coordinates. Vector3 axis; /// The radius of the first endcap of this sphere in shape coordinates. Real radius1; /// The radius of the second endcap of this sphere in shape coordinates. Real radius2; /// The distance from one endpoint to another. Real height; /// A pointer to the material to use when rendering this generic capsule shape. Pointer<GenericMaterial> material; }; //########################################################################################## //*********************** End Rim Graphics Shapes Namespace ****************************** RIM_GRAPHICS_SHAPES_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_GRAPHICS_GENERIC_CAPSULE_SHAPE_H <file_sep>/* * rimGraphicsShader.h * Rim Graphics * * Created by <NAME> on 2/11/10. * Copyright 2010 Rim Software. All rights reserved. * */ #ifndef INCLUDE_RIM_GRAPHICS_SHADER_H #define INCLUDE_RIM_GRAPHICS_SHADER_H #include "rimGraphicsShadersConfig.h" #include "rimGraphicsShaderType.h" #include "rimGraphicsShaderLanguage.h" #include "rimGraphicsShaderSource.h" //########################################################################################## //*********************** Start Rim Graphics Shaders Namespace *************************** RIM_GRAPHICS_SHADERS_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class which represents a hardware-executed programmable rendering stage. /** * A shader is defined by its source code, a string of characters which uses * an implementation-defined language to perform graphics operations such as * lighting and shading. */ class Shader : public ContextObject { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Source Code Accessor Methods /// Return the source code used by this shader. virtual const ShaderSourceString& getSourceCode() const = 0; /// Set the source code used by the shader. /** * This method replaces the current source code for this shader. * The shader must be compiled before the new source code takes effect. * * The method allows the user to specify the language of the shader's source * code. This allows the implementation to choose the correct compiler for * the shader. * * If there is an error or the specified language is not supported, FALSE * is returned and the source code for the shader is unchanged. Otherwise, * the method succeeds and TRUE is returned. */ virtual Bool setSourceCode( const ShaderSourceString& newSource, const ShaderLanguage& language = ShaderLanguage::DEFAULT ) = 0; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Shader Compile Method /// Compile the shader's source code and return whether or not the operation was successful. virtual Bool compile() = 0; /// Compile the shader's source code and return whether or not the operation was successful. /** * If the result of compilation was not successful, the output of the * compiler be stored in the compilation log parameter. */ virtual Bool compile( String& compilationLog ) = 0; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Compilation Status Accessor Method /// Return whether or not this shader has been compiled. /** * The return value indicates whether or not a compilation operation has been * attempted since the last source code change, not whether or not the compilation * was without error. */ virtual Bool isCompiled() const = 0; /// Return whether or not the shader was successfully compiled. /** * If the shader was not successfully compiled or hasn't been compiled yet, * it cannot be used as part of a shader program. */ virtual Bool isValid() const = 0; protected: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Protected Constructors /// Create a new shader with the specified shader type. RIM_INLINE Shader( const devices::GraphicsContext* newContext, ShaderType newShaderType ) : ContextObject( newContext ), shaderType( newShaderType ) { } private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Members /// An enum value which determines what kind of shader this shader is. ShaderType shaderType; }; //########################################################################################## //*********************** End Rim Graphics Shaders Namespace ***************************** RIM_GRAPHICS_SHADERS_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_GRAPHICS_SHADER_H <file_sep>/* * rimGraphicsShadowMapRenderer.h * Rim Software * * Created by <NAME> on 12/4/13. * Copyright 2013 __MyCompanyName__. All rights reserved. * */ #ifndef INCLUDE_RIM_GRAPHICS_SHADOW_MAP_RENDERER_H #define INCLUDE_RIM_GRAPHICS_SHADOW_MAP_RENDERER_H #include "rimGraphicsRenderersConfig.h" #include "rimGraphicsSceneRenderer.h" //########################################################################################## //********************** Start Rim Graphics Renderers Namespace ************************** RIM_GRAPHICS_RENDERERS_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class which manages a set of cached shadow maps that it renders. class ShadowMapRenderer { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructors /// Create a new shadow map renderer which uses the specified context to render shadow maps. ShadowMapRenderer( const Pointer<GraphicsContext>& newContext ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Context Accessor Methods /// Return a pointer to the graphics context which is being used to render shadow maps. /** * This pointer is NULL if the shadow map renderer renderer does not have a valid context. */ RIM_INLINE const Pointer<GraphicsContext>& getContext() const { return context; } /// Change the graphics context that should be used to render shadow maps. /** * This method resets any internal context-specific rendering state, including any * cached shadow maps. * * The method returns whether or not the shadow map renderer was reinitialized * successfully. A NULL or invalid context is allowed but will cause the method to return * FALSE, causing the renderer to be unusable. */ Bool setContext( const Pointer<GraphicsContext>& newContext ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Scene Accessor Methods /// Return a pointer to the scene that is currently being used to render shadow maps. RIM_INLINE const Pointer<GraphicsScene>& getScene() const { return scene; } /// Set a pointer to the scene that should be used to render shadow maps. RIM_INLINE void setScene( const Pointer<GraphicsScene>& newScene ) { scene = newScene; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Shadow Map Accessor Methods /// Render the shadow map for the given light and return the shadow map. /** * If the shadow map for this light was not already stored in the cache * for this shadow map renderer, it is added to the cache. Otherwise, the shadow map * that was stored in the cache is returned. A pointer to this shadow map is returned. * * If there was an error in accessing the cache or creating shadow map, a NULL * pointer is returned. If the light pointer is NULL the method fails, returning NULL. * * Since no camera is specified, the camera's view is not taken into account when * rendering the shadow map for the light. This may result in lower quality shadows. * This method is equivalent to calling the overload cacheShadowMap(light,NULL). */ RIM_INLINE const ShadowMap* cacheShadowMap( const Pointer<Light>& light ) { return this->cacheShadowMap( light, Pointer<Camera>() ); } /// Render the shadow map for the given light and camera combination if necessary and return the shadow map. /** * If the shadow map for this light/camera pair was not already stored in the cache * for this shadow map renderer, it is added to the cache. Otherwise, the shadow map * that was stored in the cache is returned. A pointer to this shadow map is returned. * * If there was an error in accessing the cache or creating shadow map, a NULL * pointer is returned. If the light pointer is NULL the method fails, returning NULL. * * If the camera pointer is NULL, the camera's view is not taken into account when * rendering the shadow map for the light. This may result in lower quality shadows. */ const ShadowMap* cacheShadowMap( const Pointer<Light>& light, const Pointer<Camera>& camera ); /// Return the shadow map for the given light stored in the renderer's cache. /** * If there is no shadow map for this light, a NULL pointer is returned. */ RIM_INLINE const ShadowMap* getShadowMap( const Pointer<Light>& light ) const { return this->getShadowMap( light, Pointer<Camera>() ); } /// Return the shadow map for the given light and camera combination stored in the renderer's cache. /** * If there is no shadow map for this combination, a NULL pointer is returned. */ const ShadowMap* getShadowMap( const Pointer<Light>& light, const Pointer<Camera>& camera ) const; /// Return the total number of cached entries in the shadow map cache. /** * This is the number of shadow maps that currently in use (not counting unused shadow * map textures). */ RIM_INLINE Size getCacheSize() const { return shadowMapCache.getSize(); } /// Return the approximate memory usage in bytes of the entries in the shadow map cache. /** * This is computed from the number of shadow maps that currently in use (not counting unused shadow * map textures). */ RIM_INLINE Size getCacheSizeInBytes() const { return cacheSizeInBytes; } /// Remove all previously cached shadow maps from this shadow map renderer's internal cache, keeping the texture storage. /** * This method should generally be called at the beginning of drawing the shadow maps for * the scene because it removes all cached shadow maps from the previous frame. This * method allows the texture storage from the last frame to be reused, unlike the clearCache() * method. */ void emptyCache(); /// Remove all previously cached shadow maps from this shadow map renderer's internal cache. /** * This method also releases all texture storage that was previously used by the cache. * Calling this method every frame may be expensive, since textures would need to be recreated * after each call. */ void clearCache(); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Shadow Parameter Accessor Methods /// Return a value indicating the approximate pixel-to-unit scale factor for shadow textures. /** * This value is used to determine the resolution of a shadow map in order * to meet a minimum texel density per world unit. * * The default shadow quality is 100, corresponding to 100 texels per world unit. * If the units are meters, this means one texel per centimeter. */ RIM_INLINE Real getShadowQuality() const { return shadowQuality; } /// Set a value indicating the approximate pixel-to-unit scale factor for shadow textures. /** * This value is used to determine the resolution of a shadow map in order * to meet a minimum texel density per world unit. * * The new shadow quality factor is clamped to be greater than 0.001, which would * correspond to a 1-texel-per-kilometer resolution if meters are the units. * * The default shadow quality is 100, corresponding to 100 texels per world unit. * If the units are meters, this means one texel per centimeter. */ RIM_INLINE void setShadowQuality( Real newShadowQuality ) { shadowQuality = math::max( newShadowQuality, MINIMUM_SHADOW_QUALITY ); } /// Return the minimum allowed resolution (width or height) for a shadow map. RIM_INLINE Size getMinimumShadowSize() const { return minimumShadowSize; } /// Set the minimum allowed resolution (width or height) for a shadow map. /** * This value is clamped to be greater than 1. */ RIM_INLINE void setMinimumShadowSize( Size newMinimumShadowSize ) { minimumShadowSize = math::max( newMinimumShadowSize, Size(1) ); } /// Return the maximum allowed resolution (width or height) for a shadow map. RIM_INLINE Size getMaximumShadowSize() const { return maximumShadowSize; } /// Set the maximum allowed resolution (width or height) for a shadow map. /** * This value is clamped to be greater than 1. */ RIM_INLINE void setMaximumShadowSize( Size newMaximumShadowSize ) { maximumShadowSize = math::max( newMaximumShadowSize, Size(1) ); } private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Class Declaration /// A class which represents a light/camera pair. class LightCamera { public: /// Create a new light/camera pair with the specified light and camera pointers. RIM_INLINE LightCamera( const Light* newLight, const Camera* newCamera ) : light( newLight ), camera( newCamera ) { } /// Return whether or not this light-camera pair is equal to another. RIM_INLINE Bool operator == ( const LightCamera& other ) const { return light == other.light && camera == other.camera; } /// Return a hash code for this light-camera pair. RIM_INLINE Hash getHashCode() const { return Hash((PointerInt(light)*PointerInt(2185031351ul)) ^ (PointerInt(camera)*PointerInt(4232417593ul))); } /// A pointer to the light which is part of this light-camera pair. const Light* light; /// A pointer to the camera which is part of this light-camera pair. const Camera* camera; }; /// A class storing a single shadow map texture and information about it. class ShadowMapInfo { public: /// Create a new shadow map information object. RIM_INLINE ShadowMapInfo( const Resource<Texture>& newTexture, const Pointer<Framebuffer>& newFramebuffer, Bool newInUse ) : texture( newTexture ), framebuffer( newFramebuffer ), inUse( newInUse ) { } /// A pointer to the texture which stores this shadow map. Resource<Texture> texture; /// A pointer to a framebuffer object that is used to bind the shadow map for rendering. Pointer<Framebuffer> framebuffer; /// A boolean value indicating whether or not this shadow map is currently in use by a light-camera pair. Bool inUse; }; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Helper Methods /// Render a new shadow map for the given light and camera combination. /** * The method returns whether or not the operation was successful. * The resulting shadow map is returned in the output texture parameter, * as is the shadow texture matrix that transforms from world space to light * texture space. */ RIM_FORCE_INLINE Bool renderShadowMap( const Light* light, const Camera* camera, Resource<Texture>& texture, Matrix4& shadowTextureMatrix ); /// Render a new shadow map for the given directional light and camera combination. Bool renderDirectionalLightShadowMap( const DirectionalLight* light, const Camera* camera, Resource<Texture>& texture, Matrix4& shadowTextureMatrix ); /// Render a new shadow map for the given point light and camera combination. Bool renderPointLightShadowMap( const PointLight* light, const Camera* camera, Resource<Texture>& texture, Matrix4& shadowProjectionMatrix ); /// Render a new shadow map for the given spot light and camera combination. Bool renderSpotLightShadowMap( const SpotLight* light, const Camera* camera, Resource<Texture>& texture, Matrix4& shadowTextureMatrix ); /// Render a light view to the given framebuffer. /** * The method uses the second camera when determining the level-of-detail * for the geometry to be rendered. The method writes the final shadow * texture matrix to the output parameter. */ Bool renderLightView( const Camera& lightView, const Camera& camera, const ArrayList<MeshChunk>& meshChunks, const Pointer<Framebuffer>& framebuffer ); /// Return a pointer to the material technique to use for rendering the given chunk to a shadow map. RIM_FORCE_INLINE const MaterialTechnique* getChunkTechnique( const MeshChunk& chunk ) const; /// Return a pointer to the default material technique to use for rendering to a shadow map. RIM_FORCE_INLINE const MaterialTechnique* getDefaultTechnique() const; /// Return a new empty shadow map which meets the given specifications. /** * This shadow map texture may be either newly created or reused from the * pool of shadow maps. The method returns NULL if no such shadow map was * found or able to be created. */ ShadowMapInfo* findEmptyShadowMap( Size minimumWidth, Size minimumHeight, Bool cubeMap = false ); /// Return a new empty cube shadow map which meets the given specifications. /** * This shadow map texture may be either newly created or reused from the * pool of shadow maps. The method returns NULL if no such shadow map was * found or able to be created. */ RIM_INLINE ShadowMapInfo* findEmptyCubeShadowMap( Size minimumSize ) { return this->findEmptyShadowMap( minimumSize, minimumSize, true ); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Members /// A pointer to the graphics context which is used to render the shadow maps. Pointer<GraphicsContext> context; /// A pointer to the scene for which shadow maps are being rendered. Pointer<GraphicsScene> scene; /// A cache of shadow maps for light-camera pairs. HashMap<LightCamera,ShadowMap> shadowMapCache; /// A list of shadow maps that are part of the cache. /** * Each entry is marked as either in use by some light-camera pair or free for use. * Upon needing storage for a shadow map, the renderer looks through this list * for unused shadow maps and uses the first that satisfies its requirements. */ ArrayList<ShadowMapInfo> shadowMaps; /// The total size of the cache's texture data in bytes. Size cacheSizeInBytes; /// A temporary list of mesh chunks in the scene. ArrayList<MeshChunk> meshChunks; /// The set of current global shader binding data. ShaderBindingData globalBindingData; /// A pointer to the default material technique to use when an object doesn't specify one for depth rendering. mutable Pointer<MaterialTechnique> defaultTechnique; /// The depth value to which the screen should be cleared before rendering a shadow map. Double clearDepth; /// A value indicating the approximate pixel-to-unit scale factor for shadow textures. /** * This value is used to determine the resolution of a shadow map in order * to meet a minimum texel density per world unit. This value is equal * to the number of shadow texels that should cover any surface in the scene. */ Real shadowQuality; /// Return the minimum allowed resolution (width or height) for a shadow map. Size minimumShadowSize; /// Return the maximum allowed resolution (width or height) for a shadow map. Size maximumShadowSize; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Static Data Members /// The default depth value to clear the depth buffer to. static const Double DEFAULT_CLEAR_DEPTH; /// The default shadow quality factor to use when creating a shadow map renderer. static const Real DEFAULT_SHADOW_QUALITY; /// The minimum shadow quality factor to use when creating a shadow map renderer. static const Real MINIMUM_SHADOW_QUALITY; /// The default minimum allowed resolution (width or height) for a shadow map. static const Size DEFAULT_MINIMUM_SHADOW_SIZE = 128; /// The default maximum allowed resolution (width or height) for a shadow map. static const Size DEFAULT_MAXIMUM_SHADOW_SIZE = 4096; /// A matrix which transformed from normalized device coordinates [-1,1] to texture coordinates [0,1]. static const Matrix4 UV_SCALE_MATRIX; /// A set of 6 orientation matrices that correspond to the view transformations for the 6 cube map faces. static const Matrix3 POINT_LIGHT_FACE_VIEWS[6]; }; //########################################################################################## //********************** End Rim Graphics Renderers Namespace **************************** RIM_GRAPHICS_RENDERERS_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_GRAPHICS_SHADOW_MAP_RENDERER_H <file_sep>/* * rimGraphicsGUIUtilities.h * Rim Graphics GUI * * Created by <NAME> on 2/11/13. * Copyright 2013 Headspace Systems. All rights reserved. * */ #ifndef INCLUDE_RIM_GRAPHICS_GUI_UTILITIES_H #define INCLUDE_RIM_GRAPHICS_GUI_UTILITIES_H #include "util/rimGraphicsGUIUtilitiesConfig.h" // Sizing/Alignment Classes #include "util/rimGraphicsGUIOrigin.h" #include "util/rimGraphicsGUIOrientation.h" #include "util/rimGraphicsGUIDirection.h" #include "util/rimGraphicsGUIRectangle.h" // Border Classes #include "util/rimGraphicsGUIMargin.h" #include "util/rimGraphicsGUIBorderType.h" #include "util/rimGraphicsGUIBorder.h" // Image Classes #include "util/rimGraphicsGUIImage.h" #include "util/rimGraphicsGUITextureImage.h" #include "util/rimGraphicsGUIValueCurve.h" #endif // INCLUDE_RIM_GRAPHICS_GUI_UTILITIES_H <file_sep>/* * Mutex.h * GSound * * Created by <NAME> on 3/22/11. * Copyright 2011 Rim Software. All rights reserved. * */ #ifndef INCLUDE_RIM_MUTEX_H #define INCLUDE_RIM_MUTEX_H #include "rimThreadsConfig.h" #include "../rimUtilities.h" //########################################################################################## //*************************** Start Rim Threads Namespace ******************************** RIM_THREADS_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class whose job is to provide a means of thread synchronization by exclusion. /** * The class is essentially a wrapper around the host platform's mutex facilities. * It allows threads to be synchronized so that access to data or other sensitive * items can be restricted to one thread at a time. * * In order to use the class properly, call the lock() method to lock the * mutex and call the unlock() method to unlock it. The lock() method blocks * execution of the calling thread until the mutex has been released by another * thread. One can also query the state of the mutex (locked or unlocked) using * the method isUnlocked(). */ class Mutex { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructors /// Create a new mutex in the default state of not locked. Mutex(); /// Create a copy of a Mutex object. /** * The new mutex is created in the unlocked state and is independent * of the other mutex. The effect is the same as the default constructor. */ Mutex( const Mutex& other ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Destructor /// Destroy a Mutex object, releasing all internal state. ~Mutex(); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Assignment Operator /// Assign one Mutex to another. /** * This operator releases any previous lock on this mutex and effectively results * in a new mutex in the unlocked state. The new mutex is independent * of the other mutex. */ Mutex& operator = ( const Mutex& other ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Mutex Acquisition /// Wait until the Mutex is available for the current thread of execution. /** * This method blocks the current thread until the signal is recieved * that the Mutex has been released, at which time the Mutex is acquired * by the current thread and the method returns. If the Mutex is available, * the method returns immediately and the Mutex is acquired. */ void lock(); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Mutex Release /// Release the mutex so that another thread can acquire it. /** * If the mutex is not already acquired, this method * has no effect. */ void unlock(); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Mutex Status Accessor /// Get whether or not the mutex is available. /** * If the mutex is free for acquisition, TRUE is returned. Otherwise * FALSE is returned. * * @return whether or not the mutex is available for acquisition. */ Bool isUnlocked() const; private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Mutex Wrapper Class Declaration /// A class which encapsulates internal platform-specific Mutex code. class MutexWrapper; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Members /// A pointer to a wrapper object containing the internal state of the Mutex. MutexWrapper* wrapper; }; //########################################################################################## //*************************** End Rim Threads Namespace ********************************** RIM_THREADS_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_MUTEX_H <file_sep>/* * rimGraphicsGenericTexture.h * Rim Software * * Created by <NAME> on 2/26/14. * Copyright 2014 __MyCompanyName__. All rights reserved. * */ #ifndef INCLUDE_RIM_GRAPHICS_GENERIC_TEXTURE_H #define INCLUDE_RIM_GRAPHICS_GENERIC_TEXTURE_H #include "rimGraphicsTexturesConfig.h" #include "rimGraphicsTextureFormat.h" #include "rimGraphicsTextureFilterType.h" #include "rimGraphicsTextureWrapType.h" #include "rimGraphicsTextureFace.h" #include "rimGraphicsTextureType.h" //########################################################################################## //********************** Start Rim Graphics Textures Namespace *************************** RIM_GRAPHICS_TEXTURES_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class which represents an image with associated sampling parameters. /** * A texture can be either 1D, 2D, 3D, or a cube map (six 2D faces), with * any common texture format (Alpha, Gray, RGB, RGBA, etc.). */ class GenericTexture { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructors /// Create a 1D texture object with the specified pixel type and width and no pixel data. GenericTexture(); /// Create a 1D or cube-map texture object with the specified pixel type and width and no pixel data. GenericTexture( Size width, Bool isCubeMap = false ); /// Create a 2D texture object with the specified pixel type, width and height and no pixel data. GenericTexture( Size width, Size height ); /// Create a 3D texture object with the specified pixel type, width, height and depth and no pixel data. GenericTexture( Size width, Size height, Size depth ); /// Create a new texture object with the specified image for its front face. GenericTexture( const Resource<Image>& newImage ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Size Accessor Methods /// Return the number of dimensions in this texture, usually 1, 2, or 3. RIM_INLINE Size getDimensionCount() const { return numDimensions; } /// Return the size of the texture along the X direction (dimension 0). RIM_INLINE Size getWidth() const { return size[0]; } /// Return the size of the texture along the Y direction (dimension 1). RIM_INLINE Size getHeight() const { return size[1]; } /// Return the size of the texture along the Z direction (dimension 2). RIM_INLINE Size getDepth() const { return size[2]; } /// Return the size of the texture along the specified dimension index. /** * Indices start from 0 and count to d-1 for a texture with d dimensions. * The method returns a size of 1 for all out-of-bounds dimensions. */ RIM_INLINE Size getSize( Index dimension ) const { if ( numDimensions == 0 ) return 0; else if ( dimension >= numDimensions ) return 1; else return size[dimension]; } /// Return the total number of texels in the texture. Size getTexelCount() const; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Texture Face Accessor Methods /// Return the number of faces that this texture has. /** * A normal texture will have 1 face, while a cube map texture will have * 6 faces. */ RIM_INLINE Size getFaceCount() const { return faces.getSize(); } /// Return whether or not this texture is a cube map texture. RIM_INLINE Bool isACubeMap() const { return cubeMap; } /// Return whether or not the specified face is valid for this texture. RIM_INLINE Bool isValidFace( TextureFace face ) const { return face == TextureFace::FRONT || cubeMap; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Image Data Accessor Methods /// Get the texture's image data for the specified face index. /** * If the face type is not equal to TextureFace::FRONT and the texture is not a cube map * texture, an empty image with UNDEFINED pixel type is returned. */ Bool getImage( Resource<Image>& image, TextureFace face = TextureFace::FRONT, Index mipmapLevel = 0 ) const; /// Replace the current contents of the texture with the specified image. /** * If the image's pixel type is not compatable with the current type of the * texture, or if the face index is not equal to TextureFace::FRONT and the texture * is not a cube map texture, or if an invalid mipmap level is specified, * FALSE is returned indicating failure and the method has no effect. * Otherwise, the method succeeds and TRUE is returned. */ Bool setImage( const Resource<Image>& newImage, TextureFace face = TextureFace::FRONT, Index mipmapLevel = 0 ); /// Update a region of the texture with the specified image. RIM_INLINE Bool updateImage( const Resource<Image>& newImage, Int position, TextureFace face = TextureFace::FRONT, Index mipmapLevel = 0 ) { return this->updateImage( newImage, Vector3i( position, 0, 0 ), face, mipmapLevel ); } /// Update a region of the texture with the specified image. RIM_INLINE Bool updateImage( const Resource<Image>& newImage, const Vector2i& position, TextureFace face = TextureFace::FRONT, Index mipmapLevel = 0 ) { return this->updateImage( newImage, Vector3i( position, 0 ), face, mipmapLevel ); } /// Update a region of the texture with the specified image. /** * This method replaces some of the pixels that are currently part of the texture * with the pixels stored in the specified image. The texture is replaced with the * image starting at the specified position in pixels from its lower left corner. * * If the updated pixels will lie outside of the texture's area, or if the * image's pixel type is not compatable with the current type of the * texture, or if the face index is not equal to TextureFace::FRONT and the texture * is not a cube map texture, FALSE is returned indicating failure and the method * has no effect. Otherwise, the method succeeds and TRUE is returned. */ Bool updateImage( const Resource<Image>& newImage, const Vector3i& position, TextureFace face = TextureFace::FRONT, Index mipmapLevel = 0 ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Texture Clear Method /// Clear this texture's image using the specified clear color component for the given face and mipmap level. /** * This method initializes every texel of the texture with the specified * color component for every texture component. * * The method returns whether or not the clear operation was successful. */ Bool clear( Float channelColor, TextureFace face = TextureFace::FRONT, Index mipmapLevel = 0 ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Texture Wrap Type Accessor Methods /// Get the type of texture wrapping to do when texture coordinates are outside of the range [0,1]. RIM_INLINE TextureWrapType getWrapType() const { return wrapType; } /// Set the type of texture wrapping to do when texture coordinates are outside of the range [0,1]. RIM_INLINE void setWrapType( const TextureWrapType& newWrapType ) { wrapType = newWrapType; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Texture Minification Filter Type Accessor Methods /// Get the type of texture filtering which is used when the texture is reduced in size. RIM_INLINE TextureFilterType getMinificationFilterType() const { return minificationFilterType; } /// Set the type of texture filtering which is used when the texture is reduced in size. RIM_INLINE void setMinificationFilterType( const TextureFilterType& newMinificationFilterType ) { minificationFilterType = newMinificationFilterType; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Texture Magnification Filter Type Accessor Methods /// Return the type of texture filtering which is used when the texture is increased in size. RIM_INLINE TextureFilterType getMagnificationFilterType() const { return magnificationFilterType; } /// Set the type of texture filtering which is used when the texture is increased in size. RIM_INLINE void setMagnificationFilterType( const TextureFilterType& newMagnificationFilterType ) { magnificationFilterType = newMagnificationFilterType; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Mipmap Accessor Methods /// Return the number of mipmaps that there are for the specified texture face. /** * This number includes the main mipmap level 0. */ RIM_INLINE Size getMipmapCount( const TextureFace& face = TextureFace::FRONT ) const { if ( (Index)face < faces.getSize() ) return faces[(Index)face].mipmaps.getSize(); else return 0; } /// Generate smaller mipmaps of the texture from the largest texture image (level 0). /** * This method automatically scales down the largest mipmap level (level 0) for * each of the smaller mipmap levels (>1), replacing any previous mipmap information. */ Bool generateMipmaps(); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Texture Format Accessor Methods /// Return whether or not this generic texture has any face images that have an alpha channel. Bool hasAlpha() const; private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Members /// A class which stores information for a single face of a texture. class Face { public: /// A list of the mipmaps for this texture face. ShortArrayList< Resource<Image>, 1 > mipmaps; }; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Static Data Members /// The maximum number of dimensions that this texture can have. static const Size MAX_DIMENSION_COUNT = 3; /// The maximum number of faces that this texture can have. static const Size MAX_FACE_COUNT = 6; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Members /// The texture filtering type to use when reducing the size of a texture. TextureFilterType minificationFilterType; /// The texture filtering type to use when increasing the size of a texture. TextureFilterType magnificationFilterType; /// The type of texture wrapping to apply for texture coordinates outside the range [0,1]. TextureWrapType wrapType; /// An integer value indicating the dimension of this texture (usually 1, 2 or 3). Size numDimensions; /// A boolean value indicating whether or not this texture is a cube map. Bool cubeMap; /// A fixed-size array which stores the size of this texture along each axis. StaticArray<Size,MAX_DIMENSION_COUNT> size; /// An array of the faces for this texture. Cube maps use 6 faces while other textures only use the first. Array<Face> faces; }; //########################################################################################## //********************** End Rim Graphics Textures Namespace ***************************** RIM_GRAPHICS_TEXTURES_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_GRAPHICS_GENERIC_TEXTURE_H <file_sep>/* * rimSoundSharedBufferInfo.h * Rim Sound * * Created by <NAME> on 12/1/12. * Copyright 2012 __MyCompanyName__. All rights reserved. * */ #ifndef INCLUDE_RIM_SOUND_SHARED_BUFFER_INFO_H #define INCLUDE_RIM_SOUND_SHARED_BUFFER_INFO_H #include "rimSoundUtilitiesConfig.h" #include "rimSoundBuffer.h" //########################################################################################## //*********************** Start Rim Sound Utilities Namespace **************************** RIM_SOUND_UTILITIES_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class which holds information about a shared sound buffer buffer. /** * This class is an internal class and shouldn't be used directly. */ class SharedBufferInfo { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Constructor /// Create a new shared sound buffer information structure with the specified buffer attributes. RIM_INLINE SharedBufferInfo( Size numChannels, Size numSamples, SampleRate sampleRate ) : buffer( numChannels, numSamples, sampleRate ), referenceCount( 0 ) { } private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Members /// The sound buffer that is being shared. SoundBuffer buffer; /// A integer value indicating whether or not this shared buffer is currently in use. /** * If the value is 0, there are no outstanding references to the shared buffer, * otherwise this value indicates the number of shared references to the buffer. */ Index referenceCount; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Friend Class Declarations /// Declare the SharedBufferPool class as a friend so that it can create instances of this class. friend class SharedBufferPool; /// Declare the SharedSoundBuffer class as a friend so that it can modify private data of this class. friend class SharedSoundBuffer; }; //########################################################################################## //*********************** End Rim Sound Utilities Namespace ****************************** RIM_SOUND_UTILITIES_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_SOUND_SHARED_BUFFER_INFO_H <file_sep>/* * rimSoundSplitter.h * Rim Sound * * Created by <NAME> on 12/11/12. * Copyright 2012 __MyCompanyName__. All rights reserved. * */ #ifndef INCLUDE_RIM_SOUND_SPLITTER_H #define INCLUDE_RIM_SOUND_SPLITTER_H #include "rimSoundFiltersConfig.h" #include "rimSoundFilter.h" //########################################################################################## //************************ Start Rim Sound Filters Namespace ***************************** RIM_SOUND_FILTERS_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class that copies a single input source of sound into multiple outputs. class Splitter : public SoundFilter { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructors /// Create a new splitter with the default number of outputs, 1. RIM_INLINE Splitter() : SoundFilter( 1, 1 ) { } /// Create a new splitter which has the specified number of outputs. RIM_INLINE Splitter( Size numOutputs ) : SoundFilter( 1, numOutputs ) { } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Output Count Accessor Methods /// Set the total number of outputs that this splitter can have. RIM_INLINE void setOutputCount( Size newNumOutputs ) { SoundFilter::setOutputCount( newNumOutputs ); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Filter Attribute Accessor Methods /// Return a human-readable name for this splitter. /** * The method returns the string "Splitter". */ virtual UTF8String getName() const; /// Return the manufacturer name of this splitter. /** * The method returns the string "Headspace Sound". */ virtual UTF8String getManufacturer() const; /// Return an object representing the version of this splitter. virtual SoundFilterVersion getVersion() const; /// Return an object which describes the category of effect that this filter implements. /** * This method returns the value SoundFilterCategory::ROUTING. */ virtual SoundFilterCategory getCategory() const; /// Return whether or not this splitter can process audio data in-place. /** * This method always returns TRUE, splitters can process audio data in-place. */ virtual Bool allowsInPlaceProcessing() const; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Filter Parameter Accessor Methods /// Return the total number of generic accessible parameters this filter has. virtual Size getParameterCount() const; /// Get information about the parameter at the specified index. virtual Bool getParameterInfo( Index parameterIndex, FilterParameterInfo& info ) const; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Public Static Property Objects /// A string indicating the human-readable name of this splitter. static const UTF8String NAME; /// A string indicating the manufacturer name of this splitter. static const UTF8String MANUFACTURER; /// An object indicating the version of this splitter. static const SoundFilterVersion VERSION; private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Filter Parameter Value Accessor Methods /// Place the value of the parameter at the specified index in the output parameter. virtual Bool getParameterValue( Index parameterIndex, FilterParameter& value ) const; /// Attempt to set the parameter value at the specified index. virtual Bool setParameterValue( Index parameterIndex, const FilterParameter& value ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Filter Processing Method /// Split the sound in the first input buffer to as many output buffers as possible. virtual SoundFilterResult processFrame( const SoundFilterFrame& inputFrame, SoundFilterFrame& outputFrame, Size numSamples ); }; //########################################################################################## //************************ End Rim Sound Filters Namespace ******************************* RIM_SOUND_FILTERS_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_SOUND_SPLITTER_H <file_sep>#pragma once /** * Since dealing with angles is difficult and confusing enough with out trying * to remember if x equals Yaw or Y equals pitch, as well as wondering if the * angles are in degrees or radians, this class encapsulates the angular * velocity data in methods with intelligent names to facilitate ease in * programming and increase readability. * * Author: <NAME> * */ class AngularVelocity { // YawRate about z, pitchRate, about y, rollRate about x : alpha, beta, // gamma private: double yawRate; double pitchRate; double rollRate; /** * Constructs a new <code>AngularVelocity</code> object with all rates set to zero. */ public: AngularVelocity() { yawRate = 0; pitchRate = 0; rollRate = 0; } /** * Constructs a copy of the passed <code>AngularVelocity</code>. * * @param angularVelocityToCopy * The <code>AngularVelocity</code> to copy. */ AngularVelocity(const AngularVelocity& angularVelocityToCopy) { yawRate = angularVelocityToCopy.getYawRateRadians(); pitchRate = angularVelocityToCopy.getPitchRateRadians(); rollRate = angularVelocityToCopy.getRollRateRadians(); } /** * Constructs a new <code>AngularVelocity</code> with the values passed. * <p> * <FONT COLOR="117711">Attention!</FONT><br> * All angles are in radians. * </p> * * @param yawRateRadians * The rotation rate about the Z-axis in radians per second. * @param pitchRateRadians * The rotation rate about the Y-axis in radians per second. * @param rollRateRadians * The rotation rate about the X-axis in radians per second. */ AngularVelocity(double yawRateRadians, double pitchRateRadians, double rollRateRadians) { yawRate = yawRateRadians; pitchRate = pitchRateRadians; rollRate = rollRateRadians; } /** * Returns the yaw rate in radians. * * @return The rotation rate about the Z-axis in radians per second. */ double getYawRateRadians() const { return yawRate; } /** * Returns the pitch rate in radians. * * @return The rotation rate about the Y axis in radians per second. */ double getPitchRateRadians() const { return pitchRate; } /** * Returns the roll rate in radians. * * @return The rotation rate about the X axis in radians per second. */ double getRollRateRadians() const { return rollRate; } }; <file_sep>/* * rimGraphicsUtilities.h * Rim Graphics * * Created by <NAME> on 11/28/11. * Copyright 2011 __MyCompanyName__. All rights reserved. * */ #ifndef INCLUDE_RIM_GRAPHICS_UTILITIES_H #define INCLUDE_RIM_GRAPHICS_UTILITIES_H #include "util/rimGraphicsUtilitiesConfig.h" // Bounding Volume Classes #include "util/rimGraphicsBoundingCone.h" // Viewing Classes #include "util/rimGraphicsViewport.h" #include "util/rimGraphicsViewVolume.h" // Object Classes #include "util/rimGraphicsTransformable.h" // Shader Attribute Classes #include "util/rimGraphicsAttributeType.h" #include "util/rimGraphicsAttributeValue.h" // Render State Classes #include "util/rimGraphicsBlendFactor.h" #include "util/rimGraphicsBlendFunction.h" #include "util/rimGraphicsBlendMode.h" #include "util/rimGraphicsDepthTest.h" #include "util/rimGraphicsDepthMode.h" #include "util/rimGraphicsStencilTest.h" #include "util/rimGraphicsStencilAction.h" #include "util/rimGraphicsStencilMode.h" #include "util/rimGraphicsAlphaTest.h" #include "util/rimGraphicsRasterMode.h" #include "util/rimGraphicsRenderFlags.h" #include "util/rimGraphicsRenderMode.h" #include "util/rimGraphicsScissorTest.h" //########################################################################################## //********************** Start Rim Graphics Utilities Namespace ************************** RIM_GRAPHICS_UTILITIES_NAMESPACE_START //****************************************************************************************** //########################################################################################## //########################################################################################## //********************** End Rim Graphics Utilities Namespace **************************** RIM_GRAPHICS_UTILITIES_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_GRAPHICS_UTILITIES_H <file_sep>/* * rimGraphicsAnimationTrackUsage.h * Rim Software * * Created by <NAME> on 6/24/14. * Copyright 2014 __MyCompanyName__. All rights reserved. * */ #ifndef INCLUDE_RIM_GRAPHICS_ANIMATION_TRACK_USAGE_H #define INCLUDE_RIM_GRAPHICS_ANIMATION_TRACK_USAGE_H #include "rimGraphicsAnimationConfig.h" //########################################################################################## //********************** Start Rim Graphics Animation Namespace ************************** RIM_GRAPHICS_ANIMATION_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class that enumerates the different standard usages for an animation track. class AnimationTrackUsage { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Public Enum Declaration /// An enum type which represents the different animation track usages. typedef enum Enum { /// An animation track with undefined usage. UNDEFINED = 0, /// An animation track that is used to determine the position of its target. /** * The position is usually a 3 or 2-component vector. */ POSITION, /// An animation track that is used to determine the scalar X-coordinate position of its target. POSITION_X, /// An animation track that is used to determine the scalar Y-coordinate position of its target. POSITION_Y, /// An animation track that is used to determine the scalar Z-coordinate position of its target. POSITION_Z, /// An animation track that is used to determine the orientation of its target. /** * The orientation can be represented by either a 3x3 matrix or a 4-component quaternion. */ ORIENTATION, /// An animation track that is used to determine the rotation around the X-axis of the target. ROTATION_X, /// An animation track that is used to determine the rotation around the Y-axis of the target. ROTATION_Y, /// An animation track that is used to determine the rotation around the Z-axis of the target. ROTATION_Z, /// An animation track that is used to determine the global scale factor of its target. /** * The scale can be represented by either a vector (indicating the scale along each axis), * or as a scalar, indicating the scaling for all axes. */ SCALE, /// An animation track that is used to determine the X-coordinate scale of its target. SCALE_X, /// An animation track that is used to determine the Y-coordinate scale of its target. SCALE_Y, /// An animation track that is used to determine the Z-coordinate scale of its target. SCALE_Z, /// An animation track that is used to determine the color of its target. COLOR, /// An animation track that is used to determine the diffuse color of its target. DIFFUSE_COLOR, /// An animation track that is used to determine the ambient color of its target. AMBIENT_COLOR, /// An animation track that is used to determine the specular color of its target. SPECULAR_COLOR }; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructors /// Create a new animation usage with the UNDEFINED usage enum value. RIM_INLINE AnimationTrackUsage() : usage( UNDEFINED ) { } /// Create a new animation usage with the specified animation usage enum value. RIM_INLINE AnimationTrackUsage( Enum newUsage ) : usage( newUsage ) { } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Enum Cast Operator /// Convert this animation usage type to an enum value. RIM_INLINE operator Enum () const { return usage; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** String Representation Accessor Methods /// Return a unique string for this track usage that matches its enum value name. String toEnumString() const; /// Return a track usage which corresponds to the given enum string. static AnimationTrackUsage fromEnumString( const String& enumString ); /// Return a string representation of the animation usage. String toString() const; /// Convert this animation usage into a string representation. RIM_INLINE operator String () const { return this->toString(); } private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Members /// An enum representing the animation usage. Enum usage; }; //########################################################################################## //********************** End Rim Graphics Animation Namespace **************************** RIM_GRAPHICS_ANIMATION_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_GRAPHICS_ANIMATION_TRACK_USAGE_H <file_sep>/* * rimGraphicsStencilMode.h * Rim Graphics * * Created by <NAME> on 3/13/13. * Copyright 2013 __MyCompanyName__. All rights reserved. * */ #ifndef INCLUDE_RIM_GRAPHICS_STENCIL_MODE_H #define INCLUDE_RIM_GRAPHICS_STENCIL_MODE_H #include "rimGraphicsUtilitiesConfig.h" #include "rimGraphicsStencilTest.h" #include "rimGraphicsStencilAction.h" //########################################################################################## //********************** Start Rim Graphics Utilities Namespace ************************** RIM_GRAPHICS_UTILITIES_NAMESPACE_START //****************************************************************************************** //########################################################################################## /// A type which represents a value stored in a stencil buffer. typedef UInt StencilValue; //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class which specifies how the stencil buffer should be updated. class StencilMode { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructors /// Create a new stencil mode with the default stencil test parameters. RIM_INLINE StencilMode() : test( StencilTest::ALWAYS ), stencilFailAction( StencilAction::KEEP ), stencilPassDepthFailAction( StencilAction::KEEP ), stencilPassAction( StencilAction::KEEP ), mask( StencilValue(0xFFFFFFFF) ), value( 0 ) { } /// Create a new depth mode with the specified test and action parameters. RIM_INLINE StencilMode( StencilTest newTest, StencilAction stencilFail, StencilAction stencilPassDepthFail, StencilAction stencilPass ) : test( newTest ), stencilFailAction( stencilFail ), stencilPassDepthFailAction( stencilPassDepthFail ), stencilPassAction( stencilPass ), mask( StencilValue(0xFFFFFFFF) ), value( 0 ) { } /// Create a new depth mode with the specified test and action parameters. RIM_INLINE StencilMode( StencilTest newTest, StencilAction stencilFail, StencilAction stencilPassDepthFail, StencilAction stencilPass, StencilValue newMask = StencilValue(0xFFFFFFFF), StencilValue newValue = 0 ) : test( newTest ), stencilFailAction( stencilFail ), stencilPassDepthFailAction( stencilPassDepthFail ), stencilPassAction( stencilPass ), mask( newMask ), value( newValue ) { } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Stencil Test Accessor Methods /// Return an object which describes the stencil test used by this stencil mode. RIM_INLINE const StencilTest& getTest() const { return test; } /// Set the stencil test used by this stencil mode. RIM_INLINE void setTest( const StencilTest& newTest ) { test = newTest; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Stencil Test Pass Action Accessor Methods /// Return an object which describes the stencil action taken when the stencil test passes. RIM_INLINE const StencilAction& getPassAction() const { return stencilPassAction; } /// Set an object which describes the stencil action taken when the stencil test passes. RIM_INLINE void setPassAction( const StencilAction& newPassAction ) { stencilPassAction = newPassAction; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Stencil Test Pass Depth Fail Action Accessor Methods /// Return an object which describes the stencil action taken when the stencil test passes but depth fails. RIM_INLINE const StencilAction& getPassDepthFailAction() const { return stencilPassDepthFailAction; } /// Set an object which describes the stencil action taken when the stencil test passes but depth fails. RIM_INLINE void setPassDepthFailAction( const StencilAction& newPassDepthFailAction ) { stencilPassDepthFailAction = newPassDepthFailAction; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Stencil Test Fail Action Accessor Methods /// Return an object which describes the stencil action taken when the stencil test fails. RIM_INLINE const StencilAction& getFailAction() const { return stencilFailAction; } /// Set an object which describes the stencil action taken when the stencil test fails. RIM_INLINE void setFailAction( const StencilAction& newFailAction ) { stencilFailAction = newFailAction; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Stencil Mask Accessor Methods /// Return a bitwise stencil value mask which is used to determine which bits of the stencil buffer to update. /** * If a bit in the mask is set to 1, that bit of the stencil * buffer will be updated. Otherwise, the buffer is not updated for * that bit. */ RIM_INLINE StencilValue getMask() const { return mask; } /// Set a bitwise stencil value mask which is used to determine which bits of the stencil buffer to update. /** * If a bit in the mask is set to 1, that bit of the stencil * buffer will be updated. Otherwise, the buffer is not updated for * that bit. */ RIM_INLINE void setMask( StencilValue newMask ) { mask = newMask; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Stencil Constant Value Accessor Methods /// Return a constant stencil value which may be used by some stencil actions. RIM_INLINE StencilValue getValue() const { return value; } /// Set a constant stencil value which may be used by some stencil actions. RIM_INLINE void setValue( StencilValue newValue ) { value = newValue; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Comparison Operators /// Return whether or not this stencil mode is equal to another stencil mode. RIM_INLINE Bool operator == ( const StencilMode& other ) const { return test == other.test && stencilFailAction == other.stencilFailAction && stencilPassDepthFailAction == other.stencilPassDepthFailAction && stencilPassAction == other.stencilPassAction && mask == other.mask && value == other.value; } /// Return whether or not this stencil mode is not equal to another stencil mode. RIM_INLINE Bool operator != ( const StencilMode& other ) const { return !(*this == other); } private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Members /// An object which describes the stencil test which should be performed by this mode. StencilTest test; /// An object which describes the stencil action to take when the stencil test fails. StencilAction stencilFailAction; /// An object which describes the stencil action to take when the stencil test pass but depth test fails. StencilAction stencilPassDepthFailAction; /// An object which describes the stencil action to take when the stencil test passes. StencilAction stencilPassAction; /// A bitwise stencil value mask which is used to determine which bits of the stencil buffer to update. /** * If a bit in the mask is set to 1, that bit of the stencil * buffer will be updated. Otherwise, the buffer is not updated for * that bit. */ StencilValue mask; /// A constant stencil value which may be used by some stencil actions. StencilValue value; }; //########################################################################################## //********************** End Rim Graphics Utilities Namespace **************************** RIM_GRAPHICS_UTILITIES_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_GRAPHICS_STENCIL_MODE_H <file_sep>/* * rimMatrix4D.h * Rim Math * * Created by <NAME> on 1/23/08. * Copyright 2008 Rim Software. All rights reserved. * */ #ifndef INCLUDE_RIM_MATRIX_4D_H #define INCLUDE_RIM_MATRIX_4D_H #include "rimMathConfig.h" #include "../data/rimBasicString.h" #include "../data/rimBasicStringBuffer.h" #include "rimVector4D.h" //########################################################################################## //***************************** Start Rim Math Namespace ********************************* RIM_MATH_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class which represents a 4x4 matrix. /** * Elements in the matrix are stored in column-major order. */ template < typename T> class Matrix4D { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructors /// Create a 4x4 matrix with all elements equal to zero. RIM_FORCE_INLINE Matrix4D<T>() : x( 0, 0, 0, 0 ), y( 0, 0, 0, 0 ), z( 0, 0, 0, 0 ), w( 0, 0, 0, 0 ) { } /// Create a 4x4 matrix from four column vectors. RIM_FORCE_INLINE Matrix4D<T>( const Vector4D<T>& col1, const Vector4D<T>& col2, const Vector4D<T>& col3, const Vector4D<T>& col4 ) : x( col1 ), y( col2 ), z( col3 ), w( col4 ) { } /// Create a 4x4 matrix with elements specified in row-major order. RIM_FORCE_INLINE Matrix4D<T>( T a, T b, T c, T d, T e, T f, T g, T h, T i, T j, T k, T l, T m, T n, T o, T p ) : x( a, e, i, m ), y( b, f, j, n ), z( c, g, k, o ), w( d, h, l, p ) { } /// Create a 4x4 matrix from a pointer to an array of elements in column-major order. RIM_FORCE_INLINE explicit Matrix4D<T>( const T* array ) : x( array[0], array[4], array[8], array[12] ), y( array[1], array[5], array[9], array[13] ), z( array[2], array[6], array[10], array[14] ), w( array[3], array[7], array[11], array[15] ) { } /// Create an identity matrx with the specified 2x2 matrix in the upper-left corner. template < typename U > RIM_FORCE_INLINE explicit Matrix4D( const Matrix2D<U>& other ) : x( other.x, T(0), T(0) ), y( other.y, T(0), T(0) ), z( T(0), T(0), T(1), T(0) ), w( T(0), T(0), T(0), T(1) ) { } /// Create an identity matrx with the specified 3x3 matrix in the upper-left corner. template < typename U > RIM_FORCE_INLINE explicit Matrix4D( const Matrix3D<U>& other ) : x( other.x, T(0) ), y( other.y, T(0) ), z( other.z, T(0) ), w( T(0), T(0), T(0), T(1) ) { } /// Create a copy of the specified 4x4 matrix with different template parameter type. template < typename U > RIM_FORCE_INLINE Matrix4D( const Matrix4D<U>& other ) : x( other.x ), y( other.y ), z( other.z ), w( other.w ) { } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Static Matrix Constructors /// Create a 4x4 rotation matrix about the X-axis with the angle in radians. RIM_FORCE_INLINE static Matrix4D<T> rotationX( T xRotation ) { return Matrix4D<T>( 1, 0, 0, 0, 0, math::cos(xRotation), math::sin(xRotation), 0, 0, -math::sin(xRotation), math::cos(xRotation), 0, 0, 0, 0, 1 ); } /// Create a 4x4 rotation matrix about the Y-axis with the angle in radians. RIM_FORCE_INLINE static Matrix4D<T> rotationY( T yRotation ) { return Matrix4D<T>( math::cos(yRotation), 0, -math::sin(yRotation), 0, 0, 1, 0, 0, math::sin(yRotation), 0, math::cos(yRotation), 0, 0, 0, 0, 1 ); } /// Create a 4x4 rotation matrix about the Z-axis with the angle in radians. RIM_FORCE_INLINE static Matrix4D<T> rotationZ( T zRotation ) { return Matrix4D<T>( math::cos(zRotation), math::sin(zRotation), 0, 0, -math::sin(zRotation), math::cos(zRotation), 0, 0, 0, 0, 1, 0, 0, 0, 0, 1 ); } /// Create a 4x4 rotation matrix about the X-axis with the angle in degrees. RIM_FORCE_INLINE static Matrix4D<T> rotationXDegrees( T xRotation ) { return rotationX( math::degreesToRadians(xRotation) ); } /// Create a 4x4 rotation matrix about the Y-axis with the angle in degrees. RIM_FORCE_INLINE static Matrix4D<T> rotationYDegrees( T yRotation ) { return rotationY( math::degreesToRadians(yRotation) ); } /// Create a 4x4 rotation matrix about the Z-axis with the angle in degrees. RIM_FORCE_INLINE static Matrix4D<T> rotationZDegrees( T zRotation ) { return rotationZ( math::degreesToRadians(zRotation) ); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Accessor Methods /// Return a pointer to the matrix's elements in colunn-major order. /** * Since matrix elements are stored in column-major order, * no allocation is performed and the elements are accessed directly. */ RIM_FORCE_INLINE T* toArrayColumnMajor() { return (T*)&x; } /// Return a pointer to the matrix's elements in colunn-major order. /** * Since matrix elements are stored in column-major order, * no allocation is performed and the elements are accessed directly. */ RIM_FORCE_INLINE const T* toArrayColumnMajor() const { return (T*)&x; } /// Place the elements of the matrix at the location specified in row-major order. /** * The output array must be at least 9 elements long. */ RIM_FORCE_INLINE void toArrayRowMajor( T* outputArray ) const { outputArray[0] = x.x; outputArray[1] = y.x; outputArray[2] = z.x; outputArray[3] = w.x; outputArray[4] = x.y; outputArray[5] = y.y; outputArray[6] = z.y; outputArray[7] = w.y; outputArray[8] = x.z; outputArray[9] = y.z; outputArray[10] = z.z; outputArray[11] = w.z; outputArray[12] = x.w; outputArray[13] = y.w; outputArray[14] = z.w; outputArray[15] = w.w; } /// Get the column at the specified index in the matrix. RIM_FORCE_INLINE Vector4D<T>& getColumn( Index columnIndex ) { RIM_DEBUG_ASSERT( columnIndex < 4 ); return (&x)[columnIndex]; } /// Get the column at the specified index in the matrix. RIM_FORCE_INLINE const Vector4D<T>& getColumn( Index columnIndex ) const { RIM_DEBUG_ASSERT( columnIndex < 4 ); return (&x)[columnIndex]; } /// Get the column at the specified index in the matrix. RIM_FORCE_INLINE Vector4D<T>& operator () ( Index columnIndex ) { RIM_DEBUG_ASSERT( columnIndex < 4 ); return (&x)[columnIndex]; } /// Get the column at the specified index in the matrix. RIM_FORCE_INLINE const Vector4D<T>& operator () ( Index columnIndex ) const { RIM_DEBUG_ASSERT( columnIndex < 4 ); return (&x)[columnIndex]; } /// Get the column at the specified index in the matrix. RIM_FORCE_INLINE Vector4D<T>& operator [] ( Index columnIndex ) { RIM_DEBUG_ASSERT( columnIndex < 4 ); return (&x)[columnIndex]; } /// Get the column at the specified index in the matrix. RIM_FORCE_INLINE const Vector4D<T>& operator [] ( Index columnIndex ) const { RIM_DEBUG_ASSERT( columnIndex < 4 ); return (&x)[columnIndex]; } /// Get the row at the specified index in the matrix. RIM_FORCE_INLINE Vector4D<T> getRow( Index rowIndex ) const { RIM_DEBUG_ASSERT( rowIndex < 4 ); switch ( rowIndex ) { case 0: return Vector4D<T>( x.x, y.x, z.x ); case 1: return Vector4D<T>( x.y, y.y, z.y ); case 2: return Vector4D<T>( x.z, y.z, z.z ); case 3: return Vector4D<T>( x.z, y.z, z.z ); default: return Vector4D<T>::ZERO; } } /// Get the element at the specified (column, row) index in the matrix. RIM_FORCE_INLINE T& get( Index columnIndex, Index rowIndex ) { RIM_DEBUG_ASSERT( columnIndex < 4 && rowIndex < 4 ); return (&x)[columnIndex][rowIndex]; } /// Get the element at the specified (column, row) index in the matrix. RIM_FORCE_INLINE const T& get( Index columnIndex, Index rowIndex ) const { RIM_DEBUG_ASSERT( columnIndex < 4 && rowIndex < 4 ); return (&x)[columnIndex][rowIndex]; } /// Get the element at the specified (column, row) index in the matrix. RIM_FORCE_INLINE T& operator () ( Index columnIndex, Index rowIndex ) { RIM_DEBUG_ASSERT( columnIndex < 4 && rowIndex < 4 ); return (&x)[columnIndex][rowIndex]; } /// Get the element at the specified (column, row) index in the matrix. RIM_FORCE_INLINE const T& operator () ( Index columnIndex, Index rowIndex ) const { RIM_DEBUG_ASSERT( columnIndex < 4 && rowIndex < 4 ); return (&x)[columnIndex][rowIndex]; } /// Set the element in the matrix at the specified (column, row) index. RIM_FORCE_INLINE void set( Index columnIndex, Index rowIndex, T value ) { RIM_DEBUG_ASSERT( columnIndex < 4 && rowIndex < 4 ); return (&x)[columnIndex][rowIndex] = value; } /// Set the column in the matrix at the specified index. RIM_FORCE_INLINE void setColumn( Index columnIndex, const Vector4D<T>& newColumn ) { RIM_DEBUG_ASSERT( columnIndex < 4 ); (&x)[columnIndex] = newColumn; } /// Set the row in the matrix at the specified index. RIM_FORCE_INLINE void setRow( Index rowIndex, const Vector4D<T>& newRow ) { RIM_DEBUG_ASSERT( rowIndex < 4 ); switch ( rowIndex ) { case 0: x.x = newRow.x; y.x = newRow.y; z.x = newRow.z; w.x = newRow.w; return; case 1: x.y = newRow.x; y.y = newRow.y; z.y = newRow.z; w.y = newRow.w; return; case 2: x.z = newRow.x; y.z = newRow.y; z.z = newRow.z; w.z = newRow.w; return; case 3: x.w = newRow.x; y.w = newRow.y; z.w = newRow.z; w.w = newRow.w; return; } } /// Return the diagonal vector of this matrix. RIM_FORCE_INLINE Vector4D<T> getDiagonal() const { return Vector4D<T>( x.x, y.y, z.z, w.w ); } /// Return the upper-left 2x2 submatrix of this matrix. RIM_FORCE_INLINE Matrix2D<T> getXY() const { return Matrix2D<T>( x.getXY(), y.getXY() ); } /// Return the upper-left 3x3 submatrix of this matrix. RIM_FORCE_INLINE Matrix3D<T> getXYZ() const { return Matrix3D<T>( x.getXYZ(), y.getXYZ(), z.getXYZ() ); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Matrix Operation Methods /// Return the determinant of this matrix. RIM_FORCE_INLINE T getDeterminant() const { T s0 = (x.x*y.y - y.x*x.y); T s1 = (x.x*z.y - z.x*x.y); T s2 = (x.x*w.y - w.x*x.y); T s3 = (y.x*z.y - z.x*y.y); T s4 = (y.x*w.y - w.x*y.y); T s5 = (z.x*w.y - w.x*z.y); T c0 = (z.z*w.w - w.z*z.w); T c1 = (y.z*w.w - w.z*y.w); T c2 = (y.z*z.w - z.z*y.w); T c3 = (x.z*w.w - w.z*x.w); T c4 = (x.z*z.w - z.z*x.w); T c5 = (x.z*y.w - y.z*x.w); return s0*c0 - s1*c1 + s2*c2 + s3*c3 - s4*c4 + s5*c5; } /// Return the inverse of this matrix, or the zero matrix if the matrix has no inverse. /** * Whether or not the matrix is invertable is determined by comparing the determinant * to a threshold - if the absolute value of the determinant is less than the threshold, * the matrix is not invertable. */ RIM_FORCE_INLINE Matrix4D<T> invert( T threshold = 0 ) const { T det = getDeterminant(); if ( math::abs(det) <= threshold ) return Matrix4D<T>::ZERO; T detInv = T(1)/det; return Matrix4D<T>( ((z.y*w.z - w.y*z.z)*y.w + (w.y*y.z - y.y*w.z)*z.w - (z.y*y.z - y.y*z.z)*w.w) * detInv, ((w.x*z.z - z.x*w.z)*y.w - (w.x*y.z - y.x*w.z)*z.w + (z.x*y.z - y.x*z.z)*w.w) * detInv, ((z.x*w.y - w.x*z.y)*y.w + (w.x*y.y - y.x*w.y)*z.w - (z.x*y.y - y.x*z.y)*w.w) * detInv, ((w.x*z.y - z.x*w.y)*y.z - (w.x*y.y - y.x*w.y)*z.z + (z.x*y.y - y.x*z.y)*w.z) * detInv, ((w.y*z.z - z.y*w.z)*x.w - (w.y*x.z - x.y*w.z)*z.w + (z.y*x.z - x.y*z.z)*w.w) * detInv, ((z.x*w.z - w.x*z.z)*x.w + (w.x*x.z - x.x*w.z)*z.w - (z.x*x.z - x.x*z.z)*w.w) * detInv, ((w.x*z.y - z.x*w.y)*x.w - (w.x*x.y - x.x*w.y)*z.w + (z.x*x.y - x.x*z.y)*w.w) * detInv, ((z.x*w.y - w.x*z.y)*x.z + (w.x*x.y - x.x*w.y)*z.z - (z.x*x.y - x.x*z.y)*w.z) * detInv, ((y.y*w.z - w.y*y.z)*x.w + (w.y*x.z - x.y*w.z)*y.w - (y.y*x.z - x.y*y.z)*w.w) * detInv, ((w.x*y.z - y.x*w.z)*x.w - (w.x*x.z - x.x*w.z)*y.w + (y.x*x.z - x.x*y.z)*w.w) * detInv, ((y.x*w.y - w.x*y.y)*x.w + (w.x*x.y - x.x*w.y)*y.w - (y.x*x.y - x.x*y.y)*w.w) * detInv, ((w.x*y.y - y.x*w.y)*x.z - (w.x*x.y - x.x*w.y)*y.z + (y.x*x.y - x.x*y.y)*w.z) * detInv, ((z.y*y.z - y.y*z.z)*x.w - (z.y*x.z - x.y*z.z)*y.w + (y.y*x.z - x.y*y.z)*z.w) * detInv, ((y.x*z.z - z.x*y.z)*x.w + (z.x*x.z - x.x*z.z)*y.w - (y.x*x.z - x.x*y.z)*z.w) * detInv, ((z.x*y.y - y.x*z.y)*x.w - (z.x*x.y - x.x*z.y)*y.w + (y.x*x.y - x.x*y.y)*z.w) * detInv, ((y.x*z.y - z.x*y.y)*x.z + (z.x*x.y - x.x*z.y)*y.z - (y.x*x.y - x.x*y.y)*z.z) * detInv ); } /// Compute the inverse of this matrix, returning the result in the output parameter. /** * The method returns whether or not the matrix was able to be inverted. This propery * is determined by comparing the determinant to a threshold - if the absolute value of * the determinant is less than the threshold, the matrix is not invertable. */ RIM_FORCE_INLINE Bool invert( Matrix4D<T>& inverse, T threshold = 0 ) const { T det = getDeterminant(); if ( math::abs(det) <= threshold ) return false; T detInv = T(1)/det; inverse = Matrix4D<T>( ((z.y*w.z - w.y*z.z)*y.w + (w.y*y.z - y.y*w.z)*z.w - (z.y*y.z - y.y*z.z)*w.w) * detInv, ((w.x*z.z - z.x*w.z)*y.w - (w.x*y.z - y.x*w.z)*z.w + (z.x*y.z - y.x*z.z)*w.w) * detInv, ((z.x*w.y - w.x*z.y)*y.w + (w.x*y.y - y.x*w.y)*z.w - (z.x*y.y - y.x*z.y)*w.w) * detInv, ((w.x*z.y - z.x*w.y)*y.z - (w.x*y.y - y.x*w.y)*z.z + (z.x*y.y - y.x*z.y)*w.z) * detInv, ((w.y*z.z - z.y*w.z)*x.w - (w.y*x.z - x.y*w.z)*z.w + (z.y*x.z - x.y*z.z)*w.w) * detInv, ((z.x*w.z - w.x*z.z)*x.w + (w.x*x.z - x.x*w.z)*z.w - (z.x*x.z - x.x*z.z)*w.w) * detInv, ((w.x*z.y - z.x*w.y)*x.w - (w.x*x.y - x.x*w.y)*z.w + (z.x*x.y - x.x*z.y)*w.w) * detInv, ((z.x*w.y - w.x*z.y)*x.z + (w.x*x.y - x.x*w.y)*z.z - (z.x*x.y - x.x*z.y)*w.z) * detInv, ((y.y*w.z - w.y*y.z)*x.w + (w.y*x.z - x.y*w.z)*y.w - (y.y*x.z - x.y*y.z)*w.w) * detInv, ((w.x*y.z - y.x*w.z)*x.w - (w.x*x.z - x.x*w.z)*y.w + (y.x*x.z - x.x*y.z)*w.w) * detInv, ((y.x*w.y - w.x*y.y)*x.w + (w.x*x.y - x.x*w.y)*y.w - (y.x*x.y - x.x*y.y)*w.w) * detInv, ((w.x*y.y - y.x*w.y)*x.z - (w.x*x.y - x.x*w.y)*y.z + (y.x*x.y - x.x*y.y)*w.z) * detInv, ((z.y*y.z - y.y*z.z)*x.w - (z.y*x.z - x.y*z.z)*y.w + (y.y*x.z - x.y*y.z)*z.w) * detInv, ((y.x*z.z - z.x*y.z)*x.w + (z.x*x.z - x.x*z.z)*y.w - (y.x*x.z - x.x*y.z)*z.w) * detInv, ((z.x*y.y - y.x*z.y)*x.w - (z.x*x.y - x.x*z.y)*y.w + (y.x*x.y - x.x*y.y)*z.w) * detInv, ((y.x*z.y - z.x*y.y)*x.z + (z.x*x.y - x.x*z.y)*y.z - (y.x*x.y - x.x*y.y)*z.z) * detInv ); return true; } /// Return the orthonormalization of this matrix. /** * This matrix that is returned has all column vectors of unit * length and perpendicular to each other. */ RIM_FORCE_INLINE Matrix4D<T> orthonormalize() const { Vector4D<T> newX = x.normalize(); Vector4D<T> newY = (y - y.projectOnNormalized( newX )).normalize(); Vector4D<T> newZ = (z - z.projectOnNormalized( newX ) - z.projectOnNormalized( newY )).normalize(); Vector4D<T> newW = (w - w.projectOnNormalized( newX ) - w.projectOnNormalized( newY ) - w.projectOnNormalized( newZ )).normalize(); return Matrix4D( newX, newY, newZ, newW ); } /// Return the transposition of this matrix. RIM_FORCE_INLINE Matrix4D<T> transpose() const { return Matrix4D<T>( x.x, x.y, x.z, x.w, y.x, y.y, y.z, y.w, z.x, z.y, z.z, z.w, w.x, w.y, w.z, w.w ); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Comparison Operators /// Compare two matrices component-wise for equality RIM_FORCE_INLINE Bool operator == ( const Matrix4D<T>& m ) const { return x == m.x && y == m.y && z == m.z && w == m.w; } /// Compare two matrices component-wise for inequality RIM_FORCE_INLINE Bool operator != ( const Matrix4D<T>& m ) const { return x != m.x || y != m.y || z != m.z || w != m.w; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Matrix Negation/Positivation Operators /// Negate every element of this matrix and return the resulting matrix. RIM_FORCE_INLINE Matrix4D<T> operator - () const { return Matrix4D<T>( -x, -y, -z, -w ); } /// 'Positivate' every element of this matrix, returning a copy of the original matrix. RIM_FORCE_INLINE Matrix4D<T> operator + () const { return Matrix4D<T>( x, y, z, w ); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Arithmetic Operators /// Add this matrix to another and return the resulting matrix. RIM_FORCE_INLINE Matrix4D<T> operator + ( const Matrix4D<T>& matrix ) const { return Matrix4D<T>( x + matrix.x, y + matrix.y, z + matrix.z, w + matrix.w ); } /// Add a scalar to the elements of this matrix and return the resulting matrix. RIM_FORCE_INLINE Matrix4D<T> operator + ( const T& value ) const { return Matrix4D<T>( x + value, y + value, z + value, 2 + value ); } /// Subtract a matrix from this matrix and return the resulting matrix. RIM_FORCE_INLINE Matrix4D<T> operator - ( const Matrix4D<T>& matrix ) const { return Matrix4D<T>( x - matrix.x, y - matrix.y, z - matrix.z, w - matrix.w ); } /// Subtract a scalar from the elements of this matrix and return the resulting matrix. RIM_FORCE_INLINE Matrix4D<T> operator - ( const T& value ) const { return Matrix4D<T>( x - value, y - value, z - value, w - value ); } /// Multiply a matrix by this matrix and return the result. RIM_FORCE_INLINE Matrix4D<T> operator * ( const Matrix4D<T>& matrix ) const { return Matrix4D<T>( x.x*matrix.x.x + y.x*matrix.x.y + z.x*matrix.x.z + w.x*matrix.x.w, x.x*matrix.y.x + y.x*matrix.y.y + z.x*matrix.y.z + w.x*matrix.y.w, x.x*matrix.z.x + y.x*matrix.z.y + z.x*matrix.z.z + w.x*matrix.z.w, x.x*matrix.w.x + y.x*matrix.w.y + z.x*matrix.w.z + w.x*matrix.w.w, x.y*matrix.x.x + y.y*matrix.x.y + z.y*matrix.x.z + w.y*matrix.x.w, x.y*matrix.y.x + y.y*matrix.y.y + z.y*matrix.y.z + w.y*matrix.y.w, x.y*matrix.z.x + y.y*matrix.z.y + z.y*matrix.z.z + w.y*matrix.z.w, x.y*matrix.w.x + y.y*matrix.w.y + z.y*matrix.w.z + w.y*matrix.w.w, x.z*matrix.x.x + y.z*matrix.x.y + z.z*matrix.x.z + w.z*matrix.x.w, x.z*matrix.y.x + y.z*matrix.y.y + z.z*matrix.y.z + w.z*matrix.y.w, x.z*matrix.z.x + y.z*matrix.z.y + z.z*matrix.z.z + w.z*matrix.z.w, x.z*matrix.w.x + y.z*matrix.w.y + z.z*matrix.w.z + w.z*matrix.w.w, x.w*matrix.x.x + y.w*matrix.x.y + z.w*matrix.x.z + w.w*matrix.x.w, x.w*matrix.y.x + y.w*matrix.y.y + z.w*matrix.y.z + w.w*matrix.y.w, x.w*matrix.z.x + y.w*matrix.z.y + z.w*matrix.z.z + w.w*matrix.z.w, x.w*matrix.w.x + y.w*matrix.w.y + z.w*matrix.w.z + w.w*matrix.w.w ); } RIM_FORCE_INLINE Vector4D<T> operator * ( const Vector4D<T>& vector ) const { return Vector4D<T>( x.x*vector.x + y.x*vector.y + z.x*vector.z + w.x * vector.w, x.y*vector.x + y.y*vector.y + z.y*vector.z + w.y * vector.w, x.z*vector.x + y.z*vector.y + z.z*vector.z + w.z * vector.w, x.w*vector.x + y.w*vector.y + z.w*vector.z + w.w * vector.w ); } /// Multiply the elements of this matrix by a scalar and return the resulting matrix. RIM_FORCE_INLINE Matrix4D<T> operator * ( const T& value ) const { return Matrix4D<T>( x*value, y*value, z*value, w*value ); } /// Multiply the elements of this matrix by a scalar and return the resulting matrix. RIM_FORCE_INLINE Matrix4D<T> operator / ( const T& value ) const { return Matrix4D<T>( x/value, y/value, z/value, w/value ); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Arithmetic Assignment Operators /// Add the elements of another matrix to this matrix. RIM_FORCE_INLINE Matrix4D<T>& operator += ( const Matrix4D<T>& matrix2 ) { x += matrix2.x; y += matrix2.y; z += matrix2.z; w += matrix2.w; return *this; } /// Add a scalar value to the elements of this matrix. RIM_FORCE_INLINE Matrix4D<T>& operator += ( const T& value ) { x += value; y += value; z += value; w += value; return *this; } /// Subtract the elements of another matrix from this matrix. RIM_FORCE_INLINE Matrix4D<T>& operator -= ( const Matrix4D<T>& matrix2 ) { x -= matrix2.x; y -= matrix2.y; z -= matrix2.z; w -= matrix2.w; return *this; } /// Subtract a scalar value from the elements of this matrix. RIM_FORCE_INLINE Matrix4D<T>& operator -= ( const T& value ) { x -= value; y -= value; z -= value; w -= value; return *this; } /// Multiply the elements of this matrix by a scalar value. RIM_FORCE_INLINE Matrix4D<T>& operator *= ( const T& value ) { x *= value; y *= value; z *= value; w *= value; return *this; } /// Divide the elements of this matrix by a scalar value. RIM_FORCE_INLINE Matrix4D<T>& operator /= ( const T& value ) { x /= value; y /= value; z /= value; w /= value; return *this; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** String Conversion Methods /// Convert this 4x4 matrix into a human-readable string representation. RIM_NO_INLINE data::String toString() const { data::StringBuffer buffer; buffer << "[ " << x.x << ", " << y.x << ", " << z.x << ", " << w.x << " ]\n"; buffer << "[ " << x.y << ", " << y.y << ", " << z.y << ", " << w.y << " ]\n"; buffer << "[ " << x.z << ", " << y.z << ", " << z.z << ", " << w.z << " ]\n"; buffer << "[ " << x.w << ", " << y.w << ", " << z.w << ", " << w.w << " ]"; return buffer.toString(); } /// Convert this 4x4 matrix into a human-readable string representation. RIM_FORCE_INLINE operator data::String () const { return this->toString(); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Public Data Members /// The first column vector of the matrix. Vector4D<T> x; /// The second column vector of the matrix. Vector4D<T> y; /// The third column vector of the matrix. Vector4D<T> z; /// The fourth column vector of the matrix. Vector4D<T> w; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Public Static Data Members /// Constant matrix with all elements equal to zero. static const Matrix4D<T> ZERO; /// Constant matrix with diagonal elements equal to one and all others equal to zero. static const Matrix4D<T> IDENTITY; }; template <typename T> const Matrix4D<T> Matrix4D<T>:: ZERO(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0); template <typename T> const Matrix4D<T> Matrix4D<T>:: IDENTITY(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1); //########################################################################################## //########################################################################################## //############ //############ Reverse Matrix Arithmetic Operators //############ //########################################################################################## //########################################################################################## /// Add a sclar value to a matrix's elements and return the resulting matrix template <class T> RIM_FORCE_INLINE Matrix4D<T> operator + ( const T& value, const Matrix4D<T>& matrix ) { return Matrix4D<T>( value + matrix.x.x, value + matrix.y.x, value + matrix.z.x, value + matrix.w.x, value + matrix.x.y, value + matrix.y.y, value + matrix.z.y, value + matrix.w.y, value + matrix.x.z, value + matrix.y.z, value + matrix.z.z, value + matrix.w.z, value + matrix.x.w, value + matrix.y.w, value + matrix.z.w, value + matrix.w.w ); } /// 'Reverse' multiply a vector/point by matrix: multiply it by the matrix's transpose. template < typename T > RIM_FORCE_INLINE Vector4D<T> operator * ( const Vector4D<T>& vector, const Matrix4D<T>& matrix ) { return Vector4D<T>( matrix.x.x * vector.x + matrix.x.y * vector.y + matrix.x.z * vector.z + matrix.x.w * vector.w, matrix.y.x * vector.x + matrix.y.y * vector.y + matrix.y.z * vector.z + matrix.y.w * vector.w, matrix.z.x * vector.x + matrix.z.y * vector.y + matrix.z.z * vector.z + matrix.z.w * vector.w, matrix.w.x * vector.x + matrix.w.y * vector.y + matrix.w.z * vector.z + matrix.w.w * vector.w ); } /// Multiply a matrix's elements by a scalar and return the resulting matrix template <class T> RIM_FORCE_INLINE Matrix4D<T> operator * ( const T& value, const Matrix4D<T>& matrix ) { return Matrix4D<T>( value * matrix.x.x, value * matrix.y.x, value * matrix.z.x, value * matrix.w.x, value * matrix.x.y, value * matrix.y.y, value * matrix.z.y, value * matrix.w.y, value * matrix.x.z, value * matrix.y.z, value * matrix.z.z, value * matrix.w.z, value * matrix.x.w, value * matrix.y.w, value * matrix.z.w, value * matrix.w.w ); } //########################################################################################## //########################################################################################## //############ //############ Other Matrix Functions //############ //########################################################################################## //########################################################################################## /// Return the absolute value of the specified matrix, such that the every component is positive. template < typename T > RIM_FORCE_INLINE Matrix4D<T> abs( const Matrix4D<T>& matrix ) { return Matrix4D<T>( math::abs(matrix.x.x), math::abs(matrix.y.x), math::abs(matrix.z.x), math::abs(matrix.w.x), math::abs(matrix.x.y), math::abs(matrix.y.y), math::abs(matrix.z.y), math::abs(matrix.w.y), math::abs(matrix.x.z), math::abs(matrix.y.z), math::abs(matrix.z.z), math::abs(matrix.w.z), math::abs(matrix.x.w), math::abs(matrix.y.w), math::abs(matrix.z.w), math::abs(matrix.w.w) ); } //########################################################################################## //***************************** End Rim Math Namespace *********************************** RIM_MATH_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_MATRIX_4D_H <file_sep>/* * rimSoundMIDITranscoder.h * Rim Software * * Created by <NAME> on 6/8/14. * Copyright 2014 __MyCompanyName__. All rights reserved. * */ #ifndef INCLUDE_RIM_SOUND_MIDI_TRANSCODER_H #define INCLUDE_RIM_SOUND_MIDI_TRANSCODER_H #include "rimSoundIOConfig.h" #include "rimSoundTranscoder.h" //########################################################################################## //*************************** Start Rim Sound IO Namespace ******************************* RIM_SOUND_IO_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class which provides the interface for objects that encode and decode sound data. class MIDITranscoder : public ResourceTranscoder<MIDIBuffer> { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Format Accessor Methods /// Return an object which represents the resource format that this transcoder can read and write. virtual ResourceFormat getResourceFormat() const; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Encoding Methods /// Return whether or not this transcoder is able to encode the specified resource. virtual Bool canEncode( const MIDIBuffer& midi ) const; /// Save the specified sound resource at the specified ID location. /** * The method returns whether or not the resource was successfully written. */ virtual Bool encode( const ResourceID& identifier, const MIDIBuffer& midi ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Decoding Methods /// Return whether or not the specified identifier refers to a valid resource for this transcoder. /** * If the identifier represents a valid resource, TRUE is returned. Otherwise, * if the resource is not valid, FALSE is returned. */ virtual Bool canDecode( const ResourceID& identifier ) const; /// Load the sound pointed to by the specified identifier. /** * The caller can supply a pointer to a resource manager which can be used * to manage the creation of child resources. * * If the method fails, the return value will be NULL. */ virtual Pointer<MIDIBuffer> decode( const ResourceID& identifier, ResourceManager* manager = NULL ); }; //########################################################################################## //*************************** End Rim Sound IO Namespace ********************************* RIM_SOUND_IO_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_SOUND_MIDI_TRANSCODER_H <file_sep>#pragma once /* Global planner A* path optimization Author: <NAME> */ #include "VehicleState.h" #include "AngularVelocity.h" #include "Orientation.h" #include "VehicleAttitudeHelpers.h" #include <vector> #include <map> #include "rim/rimEngine.h" #include "Roadmap.h" //using namespace std; using namespace rim; using namespace rim::math; /// Define a less-than comparison operator for the Vector3f. namespace rim { namespace math { inline bool operator < ( const Vector3f& a, const Vector3f& b ) { return a.x < b.x;// && a.y < b.y && a.z < b.z; } }; }; typedef std::vector<Vector3f> vertices; class Global_planner { public: //path cost to landmark float cost(Vector3f landmark, Vector3f start, std::map<Vector3f,Vector3f> parent ) { if(landmark == start) { return 0; } else { return (landmark.getDistanceTo(parent[landmark]) + cost(parent[landmark],start,parent)); } } //f_score for a landmark float costheur(Vector3f landmark, Vector3f start, Vector3f goal, std::map<Vector3f,Vector3f> parent) { return (cost(landmark, start, parent) + landmark.getDistanceTo(goal)); } //path reconstruction vertices reconstructpath(std::map<Vector3f,Vector3f> came,Vector3f current_node) { vertices pp; std::map<Vector3f,Vector3f>::iterator i1 = came.find(current_node); if (i1==came.end()) { pp.push_back(current_node); return pp; } else { pp = reconstructpath(came,came[current_node]); pp.push_back(current_node); return pp; } } //astar vertices astar(Vector3f start, Vector3f goal, std::map<Vector3f,vertices> rmap, vertices samples) { vertices openlist, closedlist; std::map<Vector3f,Vector3f> parent; std::map<Vector3f,float> tent_cost, tent_f; openlist.push_back(start); tent_cost[start] = 0; tent_f[start] = tent_cost[start] + start.getDistanceTo(goal); for(size_t a = 0; a < samples.size(); a++) { if(samples[a] != start) { tent_cost[samples[a]] = 50000000; tent_f[samples[a]] = tent_cost[samples[a]] + samples[a].getDistanceTo(goal); } } while(!openlist.empty()) { Vector3f current; float mincost = 50000000; size_t minid = 0; for(size_t b = 0; b < openlist.size(); b++) { if(tent_f[openlist[b]] < mincost) { mincost = tent_f[openlist[b]]; current = openlist[b]; minid = b; } } if(current == goal) { float pathcost = cost(current,start,parent); return (reconstructpath(parent,current)); } openlist.erase(openlist.begin() + minid); closedlist.push_back(current); for(size_t c = 0; c < rmap[current].size(); c++) { bool alreadychecked = false, openchecked = false; for(size_t d = 0; d < closedlist.size(); d++) { if(rmap[current][c] == closedlist[d]) { alreadychecked = true; break; } } if(alreadychecked) continue; for(size_t e = 0; e < openlist.size(); e++) { if(rmap[current][c] == openlist[e]) { openchecked = true; break; } } float tentativecost = tent_cost[current] + current.getDistanceTo(rmap[current][c]); if((!openchecked) || (tentativecost < tent_cost[rmap[current][c]])) { parent[rmap[current][c]] = current; tent_cost[rmap[current][c]] = tentativecost; tent_f[rmap[current][c]] = tent_cost[rmap[current][c]] + rmap[current][c].getDistanceTo(goal); if(!openchecked) openlist.push_back(rmap[current][c]); } } } //perror("path not found!\n "); return vertices(); } vertices prm(const Vector3f start, const Vector3f goal,Pointer<Roadmap> rmap) { std::map<Vector3f,vertices> roadmp; vertices sample; /* sample.push_back(start); vertices nbr1; for ( Index i = 0; i < rmap->getNodeCount(); i++ ) { const Vector3f& p11 = rmap->getNode(i).position; if ( p11.getDistanceToSquared(start) < 10000.0 && rmap->link( p11, start) ) { nbr1.push_back(rmap->getNode(i).position); //rmap->getNode(i).neighbors. add( ); } } roadmp[start] = nbr1; */ for ( Index i = 0; i < rmap->getNodeCount(); i++ ) { sample.push_back(rmap->getNode(i).position); const ArrayList<Index>& neighbors = rmap->getNode(i).neighbors; const Size numNeighbors = neighbors.getSize(); vertices nbr; for ( Index n = 0; n < numNeighbors; n++ ) { nbr.push_back(rmap->getNode(neighbors[n]).position ); } roadmp[rmap->getNode(i).position] = nbr; } /* sample.push_back(goal); vertices nbr2; for ( Index i = 0; i < rmap->getNodeCount(); i++ ) { const Vector3f& p12 = rmap->getNode(i).position; if ( p12.getDistanceToSquared(goal) < 10000.0 && rmap->link( p12, goal) ) { nbr2.push_back(rmap->getNode(i).position); //rmap->getNode(i).neighbors. add( ); } } roadmp[goal] = nbr2; */ return astar(start,goal,roadmp,sample); } Global_planner(){ }; }; <file_sep>/* * rimGraphicsRenderer.h * Rim Graphics * * Created by <NAME> on 11/27/10. * Copyright 2010 Rim Software. All rights reserved. * */ #ifndef INCLUDE_RIM_GRAPHICS_RENDERER_H #define INCLUDE_RIM_GRAPHICS_RENDERER_H #include "rimGraphicsRenderersConfig.h" //########################################################################################## //********************** Start Rim Graphics Renderers Namespace ************************** RIM_GRAPHICS_RENDERERS_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class which serves as a basic interface for a high-level graphcs renderer. class Renderer { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Destructor /// Destroy a renderer object. virtual ~Renderer() { } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Render Method /// Do the main rendering for this renderer. /** * The default implementation has no effect. Subclasses can override * this method to do their main rendering operations. The actual function of this * method is defined by the subclass. */ virtual void render() { } }; //########################################################################################## //********************** End Rim Graphics Renderers Namespace **************************** RIM_GRAPHICS_RENDERERS_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_GRAPHICS_RENDERER_H <file_sep>/* * rimFunctionCall.h * Rim Framework * * Created by <NAME> on 6/7/09. * Copyright 2009 Rim Software. All rights reserved. * */ #ifndef INCLUDE_RIM_FUNCTION_CALL_H #define INCLUDE_RIM_FUNCTION_CALL_H #include "rimLanguageConfig.h" #include "detail/rimFunctionCallBase.h" //########################################################################################## //*************************** Start Rim Language Namespace ******************************* RIM_LANGUAGE_NAMESPACE_START //****************************************************************************************** //########################################################################################## /// Prototype for the function call object template class. template < typename Signature > class FunctionCall; //########################################################################################## //########################################################################################## //############ //############ Function Call Object With 0 Parameters Class Definition //############ //########################################################################################## //########################################################################################## /// Specialization of the function call template class for a method with 0 parameters. template < typename R > class FunctionCall< R () > : public internal::FunctionCallBase< R > { private: typedef internal::FunctionCallBase< R > BaseType; public: typedef typename BaseType::FunctionType FunctionType; typedef R ReturnType; RIM_INLINE FunctionCall( const FunctionType& f ) : BaseType( f ) { } }; template < typename R > RIM_INLINE FunctionCall<R ()> bindCall( R (*functionPointer)() ) { return FunctionCall<R ()>( bind( functionPointer ) ); } template < typename ObjectType, typename ObjectType2, typename R > RIM_INLINE Function<R ()> bindCall( R (ObjectType2::*functionPointer)(), ObjectType* objectPointer ) { return FunctionCall<R ()>( bind( functionPointer, objectPointer ) ); } template < typename ObjectType, typename ObjectType2, typename R > RIM_INLINE FunctionCall<R ()> bindCall( R (ObjectType2::*functionPointer)() const, const ObjectType* objectPointer ) { return FunctionCall<R ()>( bind( functionPointer, objectPointer ) ); } //########################################################################################## //########################################################################################## //############ //############ Function Call Object With 1 Parameters Class Definition //############ //########################################################################################## //########################################################################################## /// Specialization of the function call template class for a method with 1 parameters. template < typename R, typename T1 > class FunctionCall< R ( T1 ) > : public internal::FunctionCallBase< R, T1 > { private: typedef internal::FunctionCallBase< R, T1 > BaseType; public: typedef typename BaseType::FunctionType FunctionType; typedef R ReturnType; typedef T1 ParameterType1; RIM_INLINE FunctionCall( const FunctionType& f, ParameterType1 a1 ) : BaseType( f, a1 ) { } }; template < typename R, typename T1 > RIM_INLINE FunctionCall<R ( T1 )> bindCall( R (*functionPointer)( T1 ), T1 p1 ) { return FunctionCall<R ( T1 )>( bind( functionPointer ), p1 ); } template < typename ObjectType, typename ObjectType2, typename R, typename T1 > RIM_INLINE FunctionCall<R ( T1 )> bindCall( R (ObjectType2::*functionPointer)( T1 ), ObjectType* objectPointer, T1 p1 ) { return FunctionCall<R ( T1 )>( bind( functionPointer, objectPointer ), p1 ); } template < typename ObjectType, typename ObjectType2, typename R, typename T1 > RIM_INLINE FunctionCall<R ( T1 )> bindCall( R (ObjectType2::*functionPointer)( T1 ) const, const ObjectType* objectPointer, T1 p1 ) { return FunctionCall<R ( T1 )>( bind( functionPointer, objectPointer ), p1 ); } //########################################################################################## //########################################################################################## //############ //############ Function Call Object With 2 Parameters Class Definition //############ //########################################################################################## //########################################################################################## /// Specialization of the function call template class for a method with 2 parameters. template < typename R, typename T1, typename T2 > class FunctionCall< R ( T1, T2 ) > : public internal::FunctionCallBase< R, T1, T2 > { private: typedef internal::FunctionCallBase< R, T1, T2 > BaseType; public: typedef typename BaseType::FunctionType FunctionType; typedef R ReturnType; typedef T1 ParameterType1; typedef T2 ParameterType2; RIM_INLINE FunctionCall( const FunctionType& f, ParameterType1 a1, ParameterType2 a2 ) : BaseType( f, a1, a2 ) { } }; template < typename R, typename T1, typename T2 > RIM_INLINE FunctionCall<R ( T1, T2 )> bindCall( R (*functionPointer)( T1, T2 ), T1 p1, T2 p2 ) { return FunctionCall<R ( T1, T2 )>( bind( functionPointer ), p1, p2 ); } template < typename ObjectType, typename ObjectType2, typename R, typename T1, typename T2 > RIM_INLINE FunctionCall<R ( T1, T2 )> bindCall( R (ObjectType2::*functionPointer)( T1, T2 ), ObjectType* objectPointer, T1 p1, T2 p2 ) { return FunctionCall<R ( T1, T2 )>( bind( functionPointer, objectPointer ), p1, p2 ); } template < typename ObjectType, typename ObjectType2, typename R, typename T1, typename T2 > RIM_INLINE FunctionCall<R ( T1, T2 )> bindCall( R (ObjectType2::*functionPointer)( T1, T2 ) const, const ObjectType* objectPointer, T1 p1, T2 p2 ) { return FunctionCall<R ( T1, T2 )>( bind( functionPointer, objectPointer ), p1, p2 ); } //########################################################################################## //########################################################################################## //############ //############ Function Call Object With 3 Parameters Class Definition //############ //########################################################################################## //########################################################################################## /// Specialization of the function call template class for a method with 3 parameters. template < typename R, typename T1, typename T2, typename T3 > class FunctionCall< R ( T1, T2, T3 ) > : public internal::FunctionCallBase< R, T1, T2, T3 > { private: typedef internal::FunctionCallBase< R, T1, T2, T3 > BaseType; public: typedef typename BaseType::FunctionType FunctionType; typedef R ReturnType; typedef T1 ParameterType1; typedef T2 ParameterType2; typedef T3 ParameterType3; RIM_INLINE FunctionCall( const FunctionType& f, ParameterType1 a1, ParameterType2 a2, ParameterType3 a3 ) : BaseType( f, a1, a2, a3 ) { } }; template < typename R, typename T1, typename T2, typename T3 > RIM_INLINE FunctionCall<R ( T1, T2, T3 )> bindCall( R (*functionPointer)( T1, T2, T3 ), T1 p1, T2 p2, T3 p3 ) { return FunctionCall<R ( T1, T2, T3 )>( bind( functionPointer ), p1, p2, p3 ); } template < typename ObjectType, typename ObjectType2, typename R, typename T1, typename T2, typename T3 > RIM_INLINE FunctionCall<R ( T1, T2, T3 )> bindCall( R (ObjectType2::*functionPointer)( T1, T2, T3 ), ObjectType* objectPointer, T1 p1, T2 p2, T3 p3 ) { return FunctionCall<R ( T1, T2, T3 )>( bind( functionPointer, objectPointer ), p1, p2, p3 ); } template < typename ObjectType, typename ObjectType2, typename R, typename T1, typename T2, typename T3 > RIM_INLINE FunctionCall<R ( T1, T2, T3 )> bindCall( R (ObjectType2::*functionPointer)( T1, T2, T3 ) const, const ObjectType* objectPointer, T1 p1, T2 p2, T3 p3 ) { return FunctionCall<R ( T1, T2, T3 )>( bind( functionPointer, objectPointer ), p1, p2, p3 ); } //########################################################################################## //########################################################################################## //############ //############ Function Call Object With 4 Parameters Class Definition //############ //########################################################################################## //########################################################################################## /// Specialization of the function call template class for a method with 4 parameters. template < typename R, typename T1, typename T2, typename T3, typename T4 > class FunctionCall< R ( T1, T2, T3, T4 ) > : public internal::FunctionCallBase< R, T1, T2, T3, T4 > { private: typedef internal::FunctionCallBase< R, T1, T2, T3, T4 > BaseType; public: typedef typename BaseType::FunctionType FunctionType; typedef R ReturnType; typedef T1 ParameterType1; typedef T2 ParameterType2; typedef T3 ParameterType3; typedef T4 ParameterType4; RIM_INLINE FunctionCall( const FunctionType& f, ParameterType1 a1, ParameterType2 a2, ParameterType3 a3, ParameterType4 a4 ) : BaseType( f, a1, a2, a3, a4 ) { } }; template < typename R, typename T1, typename T2, typename T3, typename T4 > RIM_INLINE FunctionCall<R ( T1, T2, T3, T4 )> bindCall( R (*functionPointer)( T1, T2, T3, T4 ), T1 p1, T2 p2, T3 p3, T4 p4 ) { return FunctionCall<R ( T1, T2, T3, T4 )>( bind( functionPointer ), p1, p2, p3, p4 ); } template < typename ObjectType, typename ObjectType2, typename R, typename T1, typename T2, typename T3, typename T4 > RIM_INLINE FunctionCall<R ( T1, T2, T3, T4 )> bindCall( R (ObjectType2::*functionPointer)( T1, T2, T3, T4 ), ObjectType* objectPointer, T1 p1, T2 p2, T3 p3, T4 p4 ) { return FunctionCall<R ( T1, T2, T3, T4 )>( bind( functionPointer, objectPointer ), p1, p2, p3, p4 ); } template < typename ObjectType, typename ObjectType2, typename R, typename T1, typename T2, typename T3, typename T4 > RIM_INLINE FunctionCall<R ( T1, T2, T3, T4 )> bindCall( R (ObjectType2::*functionPointer)( T1, T2, T3, T4 ) const, const ObjectType* objectPointer, T1 p1, T2 p2, T3 p3, T4 p4 ) { return FunctionCall<R ( T1, T2, T3, T4 )>( bind( functionPointer, objectPointer ), p1, p2, p3, p4 ); } //########################################################################################## //########################################################################################## //############ //############ Function Call Object With 5 Parameters Class Definition //############ //########################################################################################## //########################################################################################## /// Specialization of the function call template class for a method with 5 parameters. template < typename R, typename T1, typename T2, typename T3, typename T4, typename T5 > class FunctionCall< R ( T1, T2, T3, T4, T5 ) > : public internal::FunctionCallBase< R, T1, T2, T3, T4, T5 > { private: typedef internal::FunctionCallBase< R, T1, T2, T3, T4, T5 > BaseType; public: typedef typename BaseType::FunctionType FunctionType; typedef R ReturnType; typedef T1 ParameterType1; typedef T2 ParameterType2; typedef T3 ParameterType3; typedef T4 ParameterType4; typedef T5 ParameterType5; RIM_INLINE FunctionCall( const FunctionType& f, ParameterType1 a1, ParameterType2 a2, ParameterType3 a3, ParameterType4 a4, ParameterType5 a5 ) : BaseType( f, a1, a2, a3, a4, a5 ) { } }; template < typename R, typename T1, typename T2, typename T3, typename T4, typename T5 > RIM_INLINE FunctionCall<R ( T1, T2, T3, T4, T5 )> bindCall( R (*functionPointer)( T1, T2, T3, T4, T5 ), T1 p1, T2 p2, T3 p3, T4 p4, T5 p5 ) { return FunctionCall<R ( T1, T2, T3, T4, T5 )>( bind( functionPointer ), p1, p2, p3, p4, p5 ); } template < typename ObjectType, typename ObjectType2, typename R, typename T1, typename T2, typename T3, typename T4, typename T5 > RIM_INLINE FunctionCall<R ( T1, T2, T3, T4, T5 )> bindCall( R (ObjectType2::*functionPointer)( T1, T2, T3, T4, T5 ), ObjectType* objectPointer, T1 p1, T2 p2, T3 p3, T4 p4, T5 p5 ) { return FunctionCall<R ( T1, T2, T3, T4, T5 )>( bind( functionPointer, objectPointer ), p1, p2, p3, p4, p5 ); } template < typename ObjectType, typename ObjectType2, typename R, typename T1, typename T2, typename T3, typename T4, typename T5 > RIM_INLINE FunctionCall<R ( T1, T2, T3, T4, T5 )> bindCall( R (ObjectType2::*functionPointer)( T1, T2, T3, T4, T5 ) const, const ObjectType* objectPointer, T1 p1, T2 p2, T3 p3, T4 p4, T5 p5 ) { return FunctionCall<R ( T1, T2, T3, T4, T5 )>( bind( functionPointer, objectPointer ), p1, p2, p3, p4, p5 ); } //########################################################################################## //########################################################################################## //############ //############ Function Call Object With 6 Parameters Class Definition //############ //########################################################################################## //########################################################################################## /// Specialization of the function call template class for a method with 6 parameters. template < typename R, typename T1, typename T2, typename T3, typename T4, typename T5, typename T6 > class FunctionCall< R ( T1, T2, T3, T4, T5, T6 ) > : public internal::FunctionCallBase< R, T1, T2, T3, T4, T5, T6 > { private: typedef internal::FunctionCallBase< R, T1, T2, T3, T4, T5, T6 > BaseType; public: typedef typename BaseType::FunctionType FunctionType; typedef R ReturnType; typedef T1 ParameterType1; typedef T2 ParameterType2; typedef T3 ParameterType3; typedef T4 ParameterType4; typedef T5 ParameterType5; typedef T6 ParameterType6; RIM_INLINE FunctionCall( const FunctionType& f, ParameterType1 a1, ParameterType2 a2, ParameterType3 a3, ParameterType4 a4, ParameterType5 a5, ParameterType6 a6 ) : BaseType( f, a1, a2, a3, a4, a5, a6 ) { } }; template < typename R, typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8, typename T9, typename T10 > RIM_INLINE FunctionCall<R ( T1, T2, T3, T4, T5, T6 )> bindCall( R (*functionPointer)( T1, T2, T3, T4, T5, T6 ), T1 p1, T2 p2, T3 p3, T4 p4, T5 p5, T6 p6 ) { return FunctionCall<R ( T1, T2, T3, T4, T5, T6 )>( bind( functionPointer ), p1, p2, p3, p4, p5, p6 ); } template < typename ObjectType, typename ObjectType2, typename R, typename T1, typename T2, typename T3, typename T4, typename T5, typename T6 > RIM_INLINE FunctionCall<R ( T1, T2, T3, T4, T5, T6 )> bindCall( R (ObjectType2::*functionPointer)( T1, T2, T3, T4, T5, T6 ), ObjectType* objectPointer, T1 p1, T2 p2, T3 p3, T4 p4, T5 p5, T6 p6 ) { return FunctionCall<R ( T1, T2, T3, T4, T5, T6 )>( bind( functionPointer, objectPointer ), p1, p2, p3, p4, p5, p6 ); } template < typename ObjectType, typename ObjectType2, typename R, typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8, typename T9, typename T10 > RIM_INLINE FunctionCall<R ( T1, T2, T3, T4, T5, T6 )> bindCall( R (ObjectType2::*functionPointer)( T1, T2, T3, T4, T5, T6 ) const, const ObjectType* objectPointer, T1 p1, T2 p2, T3 p3, T4 p4, T5 p5, T6 p6 ) { return FunctionCall<R ( T1, T2, T3, T4, T5, T6 )>( bind( functionPointer, objectPointer ), p1, p2, p3, p4, p5, p6 ); } //########################################################################################## //########################################################################################## //############ //############ Function Call Object With 7 Parameters Class Definition //############ //########################################################################################## //########################################################################################## /// Specialization of the function call template class for a method with 7 parameters. template < typename R, typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7 > class FunctionCall< R ( T1, T2, T3, T4, T5, T6, T7 ) > : public internal::FunctionCallBase< R, T1, T2, T3, T4, T5, T6, T7 > { private: typedef internal::FunctionCallBase< R, T1, T2, T3, T4, T5, T6, T7 > BaseType; public: typedef typename BaseType::FunctionType FunctionType; typedef R ReturnType; typedef T1 ParameterType1; typedef T2 ParameterType2; typedef T3 ParameterType3; typedef T4 ParameterType4; typedef T5 ParameterType5; typedef T6 ParameterType6; typedef T7 ParameterType7; RIM_INLINE FunctionCall( const FunctionType& f, ParameterType1 a1, ParameterType2 a2, ParameterType3 a3, ParameterType4 a4, ParameterType5 a5, ParameterType6 a6, ParameterType7 a7 ) : BaseType( f, a1, a2, a3, a4, a5, a6, a7 ) { } }; template < typename R, typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7 > RIM_INLINE FunctionCall<R ( T1, T2, T3, T4, T5, T6, T7 )> bindCall( R (*functionPointer)( T1, T2, T3, T4, T5, T6, T7 ), T1 p1, T2 p2, T3 p3, T4 p4, T5 p5, T6 p6, T7 p7 ) { return FunctionCall<R ( T1, T2, T3, T4, T5, T6, T7 )>( bind( functionPointer ), p1, p2, p3, p4, p5, p6, p7 ); } template < typename ObjectType, typename ObjectType2, typename R, typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7 > RIM_INLINE FunctionCall<R ( T1, T2, T3, T4, T5, T6, T7 )> bindCall( R (ObjectType2::*functionPointer)( T1, T2, T3, T4, T5, T6, T7 ), ObjectType* objectPointer, T1 p1, T2 p2, T3 p3, T4 p4, T5 p5, T6 p6, T7 p7 ) { return FunctionCall<R ( T1, T2, T3, T4, T5, T6, T7 )>( bind( functionPointer, objectPointer ), p1, p2, p3, p4, p5, p6, p7 ); } template < typename ObjectType, typename ObjectType2, typename R, typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7 > RIM_INLINE FunctionCall<R ( T1, T2, T3, T4, T5, T6, T7 )> bindCall( R (ObjectType2::*functionPointer)( T1, T2, T3, T4, T5, T6, T7 ) const, const ObjectType* objectPointer, T1 p1, T2 p2, T3 p3, T4 p4, T5 p5, T6 p6, T7 p7 ) { return FunctionCall<R ( T1, T2, T3, T4, T5, T6, T7 )>( bind( functionPointer, objectPointer ), p1, p2, p3, p4, p5, p6, p7 ); } //########################################################################################## //########################################################################################## //############ //############ Function Call Object With 8 Parameters Class Definition //############ //########################################################################################## //########################################################################################## /// Specialization of the function call template class for a method with 8 parameters. template < typename R, typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8 > class FunctionCall< R ( T1, T2, T3, T4, T5, T6, T7, T8 ) > : public internal::FunctionCallBase< R, T1, T2, T3, T4, T5, T6, T7, T8 > { private: typedef internal::FunctionCallBase< R, T1, T2, T3, T4, T5, T6, T7, T8 > BaseType; public: typedef typename BaseType::FunctionType FunctionType; typedef R ReturnType; typedef T1 ParameterType1; typedef T2 ParameterType2; typedef T3 ParameterType3; typedef T4 ParameterType4; typedef T5 ParameterType5; typedef T6 ParameterType6; typedef T7 ParameterType7; typedef T8 ParameterType8; RIM_INLINE FunctionCall( const FunctionType& f, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8 ) : BaseType( f, a1, a2, a3, a4, a5, a6, a7, a8 ) { } }; template < typename R, typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8 > RIM_INLINE FunctionCall<R ( T1, T2, T3, T4, T5, T6, T7, T8 )> bindCall( R (*functionPointer)( T1, T2, T3, T4, T5, T6, T7, T8 ), T1 p1, T2 p2, T3 p3, T4 p4, T5 p5, T6 p6, T7 p7, T8 p8 ) { return FunctionCall<R ( T1, T2, T3, T4, T5, T6, T7, T8 )>( bind( functionPointer ), p1, p2, p3, p4, p5, p6, p7, p8 ); } template < typename ObjectType, typename ObjectType2, typename R, typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8 > RIM_INLINE FunctionCall<R ( T1, T2, T3, T4, T5, T6, T7, T8 )> bindCall( R (ObjectType2::*functionPointer)( T1, T2, T3, T4, T5, T6, T7, T8 ), ObjectType* objectPointer, T1 p1, T2 p2, T3 p3, T4 p4, T5 p5, T6 p6, T7 p7, T8 p8 ) { return FunctionCall<R ( T1, T2, T3, T4, T5, T6, T7, T8 )>( bind( functionPointer, objectPointer ), p1, p2, p3, p4, p5, p6, p7, p8 ); } template < typename ObjectType, typename ObjectType2, typename R, typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8 > RIM_INLINE FunctionCall<R ( T1, T2, T3, T4, T5, T6, T7, T8 )> bindCall( R (ObjectType2::*functionPointer)( T1, T2, T3, T4, T5, T6, T7, T8 ) const, const ObjectType* objectPointer, T1 p1, T2 p2, T3 p3, T4 p4, T5 p5, T6 p6, T7 p7, T8 p8 ) { return FunctionCall<R ( T1, T2, T3, T4, T5, T6, T7, T8 )>( bind( functionPointer, objectPointer ), p1, p2, p3, p4, p5, p6, p7, p8 ); } //########################################################################################## //########################################################################################## //############ //############ Function Call Object With 9 Parameters Class Definition //############ //########################################################################################## //########################################################################################## /// Specialization of the function call template class for a method with 9 parameters. template < typename R, typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8, typename T9 > class FunctionCall< R ( T1, T2, T3, T4, T5, T6, T7, T8, T9 ) > : public internal::FunctionCallBase< R, T1, T2, T3, T4, T5, T6, T7, T8, T9 > { private: typedef internal::FunctionCallBase< R, T1, T2, T3, T4, T5, T6, T7, T8, T9 > BaseType; public: typedef typename BaseType::FunctionType FunctionType; typedef R ReturnType; typedef T1 ParameterType1; typedef T2 ParameterType2; typedef T3 ParameterType3; typedef T4 ParameterType4; typedef T5 ParameterType5; typedef T6 ParameterType6; typedef T7 ParameterType7; typedef T8 ParameterType8; typedef T9 ParameterType9; RIM_INLINE FunctionCall( const FunctionType& f, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8, T9 a9 ) : BaseType( f, a1, a2, a3, a4, a5, a6, a7, a8, a9 ) { } }; template < typename R, typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8, typename T9 > RIM_INLINE FunctionCall<R ( T1, T2, T3, T4, T5, T6, T7, T8, T9 )> bindCall( R (*functionPointer)( T1, T2, T3, T4, T5, T6, T7, T8, T9 ), T1 p1, T2 p2, T3 p3, T4 p4, T5 p5, T6 p6, T7 p7, T8 p8, T9 p9 ) { return FunctionCall<R ( T1, T2, T3, T4, T5, T6, T7, T8, T9 )>( bind( functionPointer ), p1, p2, p3, p4, p5, p6, p7, p8, p9 ); } template < typename ObjectType, typename ObjectType2, typename R, typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8, typename T9 > RIM_INLINE FunctionCall<R ( T1, T2, T3, T4, T5, T6, T7, T8, T9 )> bindCall( R (ObjectType2::*functionPointer)( T1, T2, T3, T4, T5, T6, T7, T8, T9 ), ObjectType* objectPointer, T1 p1, T2 p2, T3 p3, T4 p4, T5 p5, T6 p6, T7 p7, T8 p8, T9 p9 ) { return FunctionCall<R ( T1, T2, T3, T4, T5, T6, T7, T8, T9 )>( bind( functionPointer, objectPointer ), p1, p2, p3, p4, p5, p6, p7, p8, p9 ); } template < typename ObjectType, typename ObjectType2, typename R, typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8, typename T9 > RIM_INLINE FunctionCall<R ( T1, T2, T3, T4, T5, T6, T7, T8, T9 )> bindCall( R (ObjectType2::*functionPointer)( T1, T2, T3, T4, T5, T6, T7, T8, T9 ) const, const ObjectType* objectPointer, T1 p1, T2 p2, T3 p3, T4 p4, T5 p5, T6 p6, T7 p7, T8 p8, T9 p9 ) { return FunctionCall<R ( T1, T2, T3, T4, T5, T6, T7, T8, T9 )>( bind( functionPointer, objectPointer ), p1, p2, p3, p4, p5, p6, p7, p8, p9 ); } //########################################################################################## //########################################################################################## //############ //############ Function Call Object With 10 Parameters Class Definition //############ //########################################################################################## //########################################################################################## /// Specialization of the function call template class for a method with 10 parameters. template < typename R, typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8, typename T9, typename T10 > class FunctionCall< R ( T1, T2, T3, T4, T5, T6, T7, T8, T9, T10 ) > : public internal::FunctionCallBase< R, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10 > { private: typedef internal::FunctionCallBase< R, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10 > BaseType; public: typedef typename BaseType::FunctionType FunctionType; typedef R ReturnType; typedef T1 ParameterType1; typedef T2 ParameterType2; typedef T3 ParameterType3; typedef T4 ParameterType4; typedef T5 ParameterType5; typedef T6 ParameterType6; typedef T7 ParameterType7; typedef T8 ParameterType8; typedef T9 ParameterType9; typedef T10 ParameterType10; RIM_INLINE FunctionCall( const FunctionType& f, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8, T9 a9, T10 a10 ) : BaseType( f, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10 ) { } }; template < typename R, typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8, typename T9, typename T10 > RIM_INLINE FunctionCall<R ( T1, T2, T3, T4, T5, T6, T7, T8, T9, T10 )> bindCall( R (*functionPointer)( T1, T2, T3, T4, T5, T6, T7, T8, T9, T10 ), T1 p1, T2 p2, T3 p3, T4 p4, T5 p5, T6 p6, T7 p7, T8 p8, T9 p9, T10 p10 ) { return FunctionCall<R ( T1, T2, T3, T4, T5, T6, T7, T8, T9, T10 )>( bind( functionPointer ), p1, p2, p3, p4, p5, p6, p7, p8, p9, p10 ); } template < typename ObjectType, typename ObjectType2, typename R, typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8, typename T9, typename T10 > RIM_INLINE FunctionCall<R ( T1, T2, T3, T4, T5, T6, T7, T8, T9, T10 )> bindCall( R (ObjectType2::*functionPointer)( T1, T2, T3, T4, T5, T6, T7, T8, T9, T10 ), ObjectType* objectPointer, T1 p1, T2 p2, T3 p3, T4 p4, T5 p5, T6 p6, T7 p7, T8 p8, T9 p9, T10 p10 ) { return FunctionCall<R ( T1, T2, T3, T4, T5, T6, T7, T8, T9, T10 )>( bind( functionPointer, objectPointer ), p1, p2, p3, p4, p5, p6, p7, p8, p9, p10 ); } template < typename ObjectType, typename ObjectType2, typename R, typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8, typename T9, typename T10 > RIM_INLINE FunctionCall<R ( T1, T2, T3, T4, T5, T6, T7, T8, T9, T10 )> bindCall( R (ObjectType2::*functionPointer)( T1, T2, T3, T4, T5, T6, T7, T8, T9, T10 ) const, const ObjectType* objectPointer, T1 p1, T2 p2, T3 p3, T4 p4, T5 p5, T6 p6, T7 p7, T8 p8, T9 p9, T10 p10 ) { return FunctionCall<R ( T1, T2, T3, T4, T5, T6, T7, T8, T9, T10 )>( bind( functionPointer, objectPointer ), p1, p2, p3, p4, p5, p6, p7, p8, p9, p10 ); } //########################################################################################## //*************************** End Rim Language Namespace ********************************* RIM_LANGUAGE_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_FUNCTION_CALL_H <file_sep>/* * rimPhysicsConvexHull.h * Rim Physics * * Created by <NAME> on 9/3/08. * Copyright 2008 Rim Software. All rights reserved. * */ #ifndef INCLUDE_RIM_PHYSICS_CONVEX_HULL_H #define INCLUDE_RIM_PHYSICS_CONVEX_HULL_H #include "rimPhysicsUtilitiesConfig.h" #include "rimPhysicsVertex.h" //########################################################################################## //********************** Start Rim Physics Utilities Namespace *************************** RIM_PHYSICS_UTILITIES_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class which represents a convex polyhedron with triangular faces. class ConvexHull { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Public Class Declarations /// A class which represents a vertex on a convex hull. class Vertex; /// A class which represents a triangle on the surface of a polyhedral convex hull. class Triangle; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructors /// Create an empty convex hull with no triangles or vertices. ConvexHull(); /// Create a convex hull from the specified array of input vertices. ConvexHull( const PhysicsVertex3* inputVertices, Size numVertices ); /// Create a convex hull from the specified list of input vertices. ConvexHull( const ArrayList<PhysicsVertex3>& inputVertices ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Triangle Accessor Methods /// Return the number of triangles that define the surface of this convex hull. RIM_FORCE_INLINE Size getTriangleCount() const { return triangles.getSize(); } /// Return a const reference to the convex hull triangle at the specified index. RIM_FORCE_INLINE const Triangle& getTriangle( Index index ) const { return triangles[index]; } /// Return an array of the three triangle neighbor indices for the triangle at the specified index. StaticArray<Index,3> getTriangleNeighbors( Index index ) const; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Vertex Accessor Methods /// Return the number of vertices that are on the surface of this convex hull. RIM_FORCE_INLINE Size getVertexCount() const { return vertices.getSize(); } /// Return a reference to the vertex on this convex hull at the specified index. RIM_FORCE_INLINE const Vertex& getVertex( Index index ) const { return vertices[index]; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Vertex Triangle Accessor Methods /// Return the number of triangles which share the specified vertex. RIM_FORCE_INLINE Size getVertexTriangleCount( Index vertexIndex ) const; /// Return a const reference to the triange sharing the specified vertex at the given index. RIM_FORCE_INLINE const Triangle& getVertexTriangle( Index vertexIndex, Index triangleIndex ) const; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Supporting Vertex Accessor Method /// Determine which vertex on this convex hull is farthest in the specified direction. /** * This method uses the optional starting vertex as a best-guess for the * supporting vertex. The hull then uses a 'hill-climbing' algorithm to find the * actual supporting vertex in the specified direction. The direction does not * need to be normalized. The index of the support vertex is returned. * * If the convex hull has no vertices, math::max<Index>() is returned. */ Index getSupportVertexIndex( const Vector3& direction, Index startingVertex = 0 ) const; /// Determine which vertex on this convex hull is farthest in the specified direction. /** * This method uses the optional starting vertex as a best-guess for the * supporting vertex. The hull then uses a 'hill-climbing' algorithm to find the * actual supporting vertex in the specified direction. The direction does not * need to be normalized. The position of the support vertex is returned. * * If the convex hull has no vertices, the origin is returned. */ RIM_INLINE const PhysicsVertex3& getSupportVertex( const Vector3& direction, Index startingVertex = 0 ) const; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Bounding Sphere Accessor Methods /// Compute and return a bounding sphere for this convex hull. BoundingSphere computeBoundingSphere() const; private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Class Declaration /// A class which holds extra data about vertices, used during hull construction. class VertexData; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Static Convex Hull Computation Method /// Compute the convex hull of the specified list of input vertices. /** * The method places the resulting convex hull vertices and triangles * into the two output lists. * * This method can fail if less than 4 vertices are used as input, or * if all of the vertices are coplanar. In these cases, FALSE is returned. * Otherwise, TRUE is returned indicating that convex hull computation was * successful. */ static Bool computeConvexHull( const Vector3* vertices, Size numVertices, ArrayList<Vertex>& hullVertices, ArrayList<Triangle>& triangles, ArrayList<Index>& vertexTriangles ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Members /// A list of all of the vertices that are on the boundary of this convex hull. ArrayList<Vertex> vertices; /// A list of all of the triangles that are on the boundary of this convex hull. ArrayList<Triangle> triangles; /// A list of triangle indices that are shared by various vertices in the convex hull. ArrayList<Index> vertexTriangles; }; //########################################################################################## //########################################################################################## //############ //############ Convex Hull Vertex Class Declaration //############ //########################################################################################## //########################################################################################## class ConvexHull:: Vertex { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Members /// Create a new convex hull vertex with the specified position and no connecting triangles. RIM_INLINE Vertex( const PhysicsVertex3& newPosition ) : position( newPosition ), triangleListStartIndex( 0 ), numTriangles( 0 ) { } /// Create a new convex hull vertex with the specified position and index into the triangle neighbor list. RIM_INLINE Vertex( const PhysicsVertex3& newPosition, Index trianglesStart, Size newNumTriangles ) : position( newPosition ), triangleListStartIndex( trianglesStart ), numTriangles( newNumTriangles ) { } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Attribute Accessor Methods /// Return a const reference to the 3D position of this convex hull vertex. RIM_FORCE_INLINE const PhysicsVertex3& getPosition() const { return position; } /// Return the number of triangles that share this convex hull vertex. RIM_FORCE_INLINE Size getTriangleCount() const { return numTriangles; } private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Members /// The position of this convex hull vertex. PhysicsVertex3 position; /// The starting index of this vertex's list of neighboring triangles in the convex hull's neighbor list. Index triangleListStartIndex; /// The number of triangles that share this convex hull vertex. Size numTriangles; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Friend Class Declaration /// Declare the convex hull class as a friend so that it can access necessary data without exposing it in the interface. friend class ConvexHull; }; //########################################################################################## //########################################################################################## //############ //############ Convex Hull Triangle Class Declaration //############ //########################################################################################## //########################################################################################## class ConvexHull:: Triangle { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Members /// Create a new convex hull triangle with the specified vertex indices and plane. RIM_INLINE Triangle( Index newV1, Index newV2, Index newV3, const Plane3& newPlane ) : v1( newV1 ), v2( newV2 ), v3( newV3 ), plane( newPlane ) { } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Attribute Accessor Methods /// Return the index of the vertex at the specified index in this triangle. /** * Valid vertex indices are 0, 1, or 2. */ RIM_FORCE_INLINE Index getVertexIndex( Index index ) const { RIM_DEBUG_ASSERT_MESSAGE( index < 3, "Cannot access invalid vertex index for convex hull triangle." ); return (&v1)[index]; } /// Return a const reference to the 3D plane of this convex hull triangles. RIM_FORCE_INLINE const Plane3& getPlane() const { return plane; } private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Attribute Accessor Methods /// Set the index of the vertex at the specified index in this triangle. /** * Valid vertex indices are 0, 1, or 2. */ RIM_FORCE_INLINE void setVertexIndex( Index v, Index newIndex ) { RIM_DEBUG_ASSERT_MESSAGE( v < 3, "Cannot access invalid vertex index for convex hull triangle." ); (&v1)[v] = newIndex; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Members /// The index of the first vertex that defines a corner of this triangle. Index v1; /// The index of the second vertex that defines a corner of this triangle. Index v2; /// The index of the third vertex that defines a corner of this triangle. Index v3; /// An object representing the 3D plane that this triangle lies in. Plane3 plane; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Friend Class Declaration /// Declare the convex hull class as a friend so that it can access necessary data without exposing it in the interface. friend class ConvexHull; }; //########################################################################################## //########################################################################################## //############ //############ Vertex Triangle Accessor Methods //############ //########################################################################################## //########################################################################################## Size ConvexHull:: getVertexTriangleCount( Index vertexIndex ) const { return vertices[vertexIndex].getTriangleCount(); } const ConvexHull::Triangle& ConvexHull:: getVertexTriangle( Index vertexIndex, Index triangleIndex ) const { return triangles[vertexTriangles[vertices[vertexIndex].triangleListStartIndex + triangleIndex]]; } //########################################################################################## //########################################################################################## //############ //############ Support Vertex Accessor Method //############ //########################################################################################## //########################################################################################## const PhysicsVertex3& ConvexHull:: getSupportVertex( const Vector3& direction, Index startingVertex ) const { Index supportIndex = this->getSupportVertexIndex( direction, startingVertex ); if ( supportIndex < vertices.getSize() ) return vertices[supportIndex].getPosition(); else return PhysicsVertex3::ZERO; } //########################################################################################## //********************** End Rim Physics Utilities Namespace ***************************** RIM_PHYSICS_UTILITES_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_PHYSICS_CONVEX_HULL_H <file_sep>/* * rimPhysicsCollisionAlgorithm.h * Rim Physics * * Created by <NAME> on 11/28/09. * Copyright 2009 Rim Software. All rights reserved. * */ #ifndef INCLUDE_RIM_PHYSICS_COLLISION_ALGORITHM_H #define INCLUDE_RIM_PHYSICS_COLLISION_ALGORITHM_H #include "rimPhysicsCollisionConfig.h" #include "rimPhysicsCollisionResultSet.h" //########################################################################################## //********************** Start Rim Physics Collision Namespace *************************** RIM_PHYSICS_COLLISION_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// The base class for an object which detects collisions between two types of CollisionShape. template < typename ObjectType1, typename ObjectType2 > class CollisionAlgorithm { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Destructor /// Destroy this collision algorithm and all associated resources. virtual ~CollisionAlgorithm() { } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Collision Detection Methods /// Test the specified object pair for collisions and add the results to the result set. /** * If a collision occurred, TRUE is returned and the resulting CollisionPoint(s) * are added to the CollisionManifold for the object pair in the specified * CollisionResultSet. If there was no collision detected, FALSE is returned * and the result set is unmodified. */ virtual Bool testForCollisions( const ObjectCollider<ObjectType1>& collider1, const ObjectCollider<ObjectType2>& collider2, CollisionResultSet<ObjectType1,ObjectType2>& resultSet ) = 0; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Shape Type Accessor Methods /// Get a type ID for the first collision shape type that this algorithm operates on. RIM_FORCE_INLINE CollisionShapeTypeID getShapeTypeID1() const { return shapeType1->getID(); } /// Return an object representing the first shape type that this algorithm operates on. RIM_FORCE_INLINE const CollisionShapeType& getShapeType1() const { return *shapeType1; } /// Get a type ID for the second collision shape type that this algorithm operates on. RIM_FORCE_INLINE CollisionShapeTypeID getShapeTypeID2() const { return shapeType2->getID(); } /// Return an object representing the second shape type that this algorithm operates on. RIM_FORCE_INLINE const CollisionShapeType& getShapeType2() const { return *shapeType2; } protected: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Protected Constructor /// Create a new collision algorithm which operates on the specified collision shape types. RIM_FORCE_INLINE CollisionAlgorithm( const CollisionShapeType* newShapeType1, const CollisionShapeType* newShapeType2 ) : shapeType1( newShapeType1 ), shapeType2( newShapeType2 ) { RIM_DEBUG_ASSERT_MESSAGE( shapeType1 != NULL, "Cannot create collision algorithm with NULL shape type." ); RIM_DEBUG_ASSERT_MESSAGE( shapeType2 != NULL, "Cannot create collision algorithm with NULL shape type." ); } private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Members /// A pointer to an object representing the first shape type that this algorithm operates on. const CollisionShapeType* shapeType1; /// A pointer to an object representing the second shape type that this algorithm operates on. const CollisionShapeType* shapeType2; }; //########################################################################################## //********************** End Rim Physics Collision Namespace ***************************** RIM_PHYSICS_COLLISION_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_PHYSICS_COLLISION_ALGORITHM_H <file_sep>/* * rimPhysicsCollisionShapeCylinder.h * Rim Physics * * Created by <NAME> on 6/6/12. * Copyright 2012 __MyCompanyName__. All rights reserved. * */ #ifndef INCLUDE_RIM_PHYSICS_COLLISION_SHAPE_CYLINDER_H #define INCLUDE_RIM_PHYSICS_COLLISION_SHAPE_CYLINDER_H #include "rimPhysicsShapesConfig.h" #include "rimPhysicsCollisionShape.h" #include "rimPhysicsCollisionShapeBase.h" #include "rimPhysicsCollisionShapeInstance.h" //########################################################################################## //************************ Start Rim Physics Shapes Namespace **************************** RIM_PHYSICS_SHAPES_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class which represents a cylindrical collision shape. class CollisionShapeCylinder : public CollisionShapeBase<CollisionShapeCylinder> { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Public Class Declarations class Instance; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructors /// Create a default cylinder shape with radius 1, height 1, and centered at the origin. CollisionShapeCylinder(); /// Create a cylinder shape with the specified endpoints and radius. /** * This creates a cylinder with both circular end cap radii equal * to the specified radius value. */ CollisionShapeCylinder( const Vector3& newEndpoint1, const Vector3& newEndpoint2, Real newRadius ); /// Create a cylinder shape with the specified endpoints and radii. CollisionShapeCylinder( const Vector3& newEndpoint1, const Vector3& newEndpoint2, Real newRadius1, Real newRadius2 ); /// Create a cylinder shape with the specified endpoints, radii, and material CollisionShapeCylinder( const Vector3& newEndpoint1, const Vector3& newEndpoint2, Real newRadius1, Real newRadius2, const CollisionShapeMaterial& newMaterial ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Point 1 Accessor Methods /// Return a const reference to the center of this cylinder's bottom circular cap. RIM_FORCE_INLINE const Vector3& getEndpoint1() const { return endpoint1; } /// Set the position of the center of the cylinder's bottom circular cap. /** * This keeps the cylinder's 2nd endpoint in the same location and * updates all other cylinder properties to be consistent with the new * first endpoint. */ RIM_INLINE void setEndpoint1( const Vector3& newEndpoint1 ) { endpoint1 = newEndpoint1; axis = endpoint2 - endpoint1; height = axis.getMagnitude(); axis /= height; updateBoundingSphere(); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Point 2 Accessor Methods /// Return a const reference to the center of this cylinder's top circular cap. RIM_FORCE_INLINE const Vector3& getEndpoint2() const { return endpoint2; } /// Set the position of the center of the cylinder's top circular cap. /** * This keeps the cylinder's 1st endpoint in the same location and * updates all other cylinder properties to be consistent with the new * 2nd endpoint. */ RIM_INLINE void setEndpoint2( const Vector3& newEndpoint2 ) { endpoint2 = newEndpoint2; axis = endpoint2 - endpoint1; height = axis.getMagnitude(); axis /= height; updateBoundingSphere(); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Radius 1 Accessor Methods /// Return the radius of this cylinder's bottom circular cap in shape space. RIM_FORCE_INLINE Real getRadius1() const { return radius1; } /// Set the radius of this cylinder's bottom circular cap in shape space. /** * This radius value is clamped to the range of [0,+infinity]. */ RIM_INLINE void setRadius1( Real newRadius1 ) { radius1 = math::max( newRadius1, Real(0) ); updateBoundingSphere(); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Radius 2 Accessor Methods /// Return the radius of this cylinder's top circular cap in shape space. RIM_FORCE_INLINE Real getRadius2() const { return radius2; } /// Set the radius of this cylinder's bottom circular cap in shape space. /** * This radius value is clamped to the range of [0,+infinity]. */ RIM_INLINE void setRadius2( Real newRadius2 ) { radius2 = math::max( newRadius2, Real(0) ); updateBoundingSphere(); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Axis Accessor Methods /// Return a const reference to the normalized axis of this cylinder. RIM_FORCE_INLINE const Vector3& getAxis() const { return axis; } /// Set the axis this cylinder's shaft. /** * This new axis vector is normalized and then the cylinder's * 2nd endpoint is recomputed using the new axis vector and * the cylinder's height and 1st endpoint. */ RIM_INLINE void setAxis( const Vector3& newAxis ) { axis = newAxis.normalize(); endpoint2 = endpoint1 + axis*height; updateBoundingSphere(); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Height Accessor Methods /// Return the distance from this cylinder's top to bottom end caps. RIM_FORCE_INLINE Real getHeight() const { return height; } /// Set the distance from this cylinder's top to bottom end caps. /** * This method keeps the cylinder's first endpoint at the same location * and recomputes the cylinder's 2nd endpoint based on the cylinder's * axis and the new height value. * * This height value is clamped to the range of [0,+infinity]. */ RIM_INLINE void setHeight( Real newHeight ) { height = math::max( newHeight, Real(0) ); endpoint2 = endpoint1 + axis*height; updateBoundingSphere(); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Mass Distribution Accessor Methods /// Return a 3x3 matrix for the inertia tensor of this shape relative to its center of mass. virtual Matrix3 getInertiaTensor() const; /// Return a 3D vector representing the center-of-mass of this shape in its coordinate frame. virtual Vector3 getCenterOfMass() const; /// Return the volume of this shape in length units cubed (m^3). virtual Real getVolume() const; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Instance Creation Methods /// Create and return an instance of this shape. virtual Pointer<CollisionShapeInstance> getInstance() const; private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Helper Methods /// Recalculate this cylinder's bounding sphere from the current cylinder description. RIM_INLINE void updateBoundingSphere() { // Find a point along the cylinder's axis from its 1st endpoint // where the optimal bounding sphere is positioned. Real h = Real(0.5)*(height*height - radius1*radius1 + radius2*radius2) / height; this->setBoundingSphere( BoundingSphere( endpoint1 + axis*h, math::sqrt(h*h + radius1*radius1) ) ); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Members /// The center of the bottom circular cap of this cylinder shape. Vector3 endpoint1; /// The radius of this cylinder's bottom circular face. Real radius1; /// The center of the top circular cap of this cylinder shape. Vector3 endpoint2; /// The radius of this cylinder's top circular face. Real radius2; /// The normalized vector along this cylinder's axis from its bottom face to top face. Vector3 axis; /// The height of this cylinder, the distance between the top and bottom faces. Real height; }; //########################################################################################## //########################################################################################## //############ //############ Sphere Shape Instance Class Definition //############ //########################################################################################## //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class which is used to instance a CollisionShapeCylinder object with an arbitrary rigid transformation. class CollisionShapeCylinder:: Instance : public CollisionShapeInstance { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Transform Update Method /// Update this sphere instance with the specified 3D rigid transformation from shape to world space. /** * This method transforms this instance's position and radius from * shape space to world space. */ virtual void setTransform( const Transform3& newTransform ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Attribute Accessor Methods /// Return a const reference to the center of this cylinder's bottom circular cap. RIM_FORCE_INLINE const Vector3& getEndpoint1() const { return endpoint1; } /// Return a const reference to the center of this cylinder's top circular cap. RIM_FORCE_INLINE const Vector3& getEndpoint2() const { return endpoint2; } /// Return the radius of this cylinder's bottom circular cap in world space. RIM_FORCE_INLINE Real getRadius1() const { return radius1; } /// Return the radius of this cylinder's top circular cap in world space. RIM_FORCE_INLINE Real getRadius2() const { return radius2; } /// Return a const reference to the normalized axis of this cylinder. RIM_FORCE_INLINE const Vector3& getAxis() const { return axis; } /// Return the distance from this cylinder's top to bottom end caps. RIM_FORCE_INLINE Real getHeight() const { return height; } private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Constructors /// Create a new cylinder shape instance which uses the specified base cylinder shape. RIM_INLINE Instance( const CollisionShapeCylinder* newCylinder ) : CollisionShapeInstance( newCylinder ) { } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Members /// The center of the bottom circular cap of this cylinder shape instance. Vector3 endpoint1; /// The radius of this cylinder's bottom circular face. Real radius1; /// The center of the top circular cap of this cylinder shape instance. Vector3 endpoint2; /// The radius of this cylinder's top circular face. Real radius2; /// The normalized vector along this cylinder's axis from its bottom face to top face. Vector3 axis; /// The height of this cylinder, the distance between the top and bottom faces. Real height; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Friend Declarations /// Declare the cylinder collision shape as a friend so that it can construct instances. friend class CollisionShapeCylinder; }; //########################################################################################## //************************ End Rim Physics Shapes Namespace ****************************** RIM_PHYSICS_SHAPES_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_PHYSICS_COLLISION_SHAPE_CYLINDER_H <file_sep>/* * rimPointer.h * Rim Framework * * Created by <NAME> on 3/19/08. * Copyright 2008 Rim Software. All rights reserved. * */ #ifndef INCLUDE_RIM_POINTER_H #define INCLUDE_RIM_POINTER_H #include "rimLanguageConfig.h" #include "../threads/rimAtomics.h" //########################################################################################## //*************************** Start Rim Language Namespace ******************************* RIM_LANGUAGE_NAMESPACE_START //****************************************************************************************** //########################################################################################## template < class T > class Pointer { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructor /// Create a Pointer object which is NULL. RIM_INLINE Pointer() : pointer( NULL ), count( NULL ) { } /// Create a Pointer object which wraps the specified raw pointer. /** * If the specified raw pointer is equal to NULL, the reference count for the * pointer is set to 0. Otherwise, the reference count for the Pointer is 1. * By calling this constructor, the user acknowledges that the Pointer object now * owns the object pointed to by the raw pointer and retains the right to destroy it * when the reference count reaches 0. * * @param newPointer - the raw pointer which this Pointer object should wrap. */ RIM_INLINE explicit Pointer( T* newPointer ) : pointer( newPointer ) { // allocate a new counter if needed if ( pointer != NULL ) count = util::construct< threads::atomic::Atomic<Size> >(1); else count = NULL; } /// Create a Pointer object which wraps the specified raw pointer of a different type. /** * If the specified raw pointer is equal to NULL, the reference count for the * pointer is set to 0. Otherwise, the reference count for the Pointer is 1. * By calling this constructor, the user acknowledges that the Pointer object now * owns the object pointed to by the raw pointer and retains the right to destroy it * when the reference count reaches 0. * * @param newPointer - the raw pointer which this Pointer object should wrap. */ template < typename U > RIM_INLINE explicit Pointer( U* newPointer ) : pointer( newPointer ) { // allocate a new counter if needed if ( pointer != NULL ) count = util::construct< threads::atomic::Atomic<Size> >(1); else count = NULL; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Copy Constructor /// Create a copy of the specified Pointer object, increasing its reference count by 1. RIM_INLINE Pointer( const Pointer& other ) : pointer( other.pointer ), count( other.count ) { if ( count != NULL ) (*count)++; } /// Create a copy of the specified Pointer object, increasing its reference count by 1. template < typename U > RIM_INLINE Pointer( const Pointer<U>& other ) : pointer( other.pointer ), count( other.count ) { if ( count != NULL ) (*count)++; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Assignment Operators /// Assign the pointer stored by another Pointer object to this object. /** * The reference count of the old pointer stored in this object is reduced by 1 * and the pointer is copied from the other Pointer object. The reference count * for the new pointer is increased by 1. * * @param other - the Pointer object whose pointer should be copied. * @return a reference to this Pointer object to allow assignment chaining. */ RIM_INLINE Pointer& operator = ( const Pointer& other ) { if ( this != &other ) { this->decrementCount(); pointer = other.pointer; count = other.count; if ( count != NULL ) (*count)++; } return *this; } /// Assign the pointer stored by another Pointer object of different templated type to this object. /** * The reference count of the old pointer stored in this object is reduced by 1 * and the pointer is copied from the other Pointer object. The reference count * for the new pointer is increased by 1. * * @param other - the Pointer object whose pointer should be copied. * @return a reference to this Pointer object to allow assignment chaining. */ template < typename U > RIM_INLINE Pointer& operator = ( const Pointer<U>& other ) { this->decrementCount(); pointer = other.pointer; count = other.count; if ( count != NULL ) (*count)++; return *this; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Destructor /// Release this Pointer's reference to the object. RIM_INLINE ~Pointer() { this->decrementCount(); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Cast Operators /// Cast this Pointer object to a raw pointer. RIM_INLINE operator T* () const { return pointer; } /// Cast this Pointer object to a raw pointer of a different type to allow polymorphism. template < typename U > RIM_INLINE operator U* () const { return pointer; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Equality Comparison Operators /// Return whether or not this pointer is equal to another pointer. /** * This method compares the pointers themselves, not the objects pointed * to by the pointers. * * @param other - the pointer to compare for equality. * @return whether or not this pointer is equal the other. */ RIM_INLINE Bool operator == ( const Pointer& other ) const { return pointer == other.pointer; } /// Return whether or not this pointer is equal to another pointer. /** * This method compares the pointers themselves, not the objects pointed * to by the pointers. * * @param other - the pointer to compare for equality. * @return whether or not this pointer is equal the other. */ template < typename U > RIM_INLINE Bool operator == ( const Pointer<U>& other ) const { return pointer == other.pointer; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Inequality Comparison Operators /// Return whether or not this pointer is not equal to another pointer. /** * This method compares the pointers themselves, not the objects pointed * to by the pointers. * * @param other - the pointer to compare for inequality. * @return whether or not this pointer is not equal the other. */ RIM_INLINE Bool operator != ( const Pointer& other ) const { return pointer == other.pointer; } /// Return whether or not this pointer is not equal to another pointer. /** * This method compares the pointers themselves, not the objects pointed * to by the pointers. * * @param other - the pointer to compare for inequality. * @return whether or not this pointer is not equal the other. */ template < typename U > RIM_INLINE Bool operator != ( const Pointer<U>& other ) const { return pointer == other.pointer; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Dereference Operators /// Dereference the object referenced by this Pointer. /** * If the pointer is NULL, a debug assertion is raised. * * @return a reference to the object that this Pointer has a reference to. */ RIM_INLINE T& operator * () const { RIM_DEBUG_ASSERT_MESSAGE( pointer != NULL, "Cannot access the contents of a null smart pointer" ); return *pointer; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Pointer Accessor Methods /// Overload the indirection operator so that this Pointer object behaves like a raw pointer. /** * If the pointer is NULL, a debug assertion is raised. * * @return the raw pointer that this Pointer object has a reference to. */ RIM_INLINE T* operator->() const { RIM_DEBUG_ASSERT_MESSAGE( pointer != NULL, "Cannot access the contents of a null smart pointer" ); return pointer; } /// Get a raw pointer to the object which this Pointer references. RIM_INLINE T* getPointer() const { return pointer; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Pointer Trait Accessor Methods /// Return whether or not if the object that this Pointer references is not referenced by another Pointer. /** * The method returns TRUE if the reference count for the Pointer is 1 or if the pointer * is equal to NULL. * * @return whether or not the reference count for the Pointer is equal to 1. */ RIM_INLINE Bool isUnique() const { if ( count == NULL ) return true; else return *count == Size(1); } /// Return whether or not this pointer is equal to NULL. RIM_INLINE Bool isNull() const { return pointer == NULL; } /// Return whether or not this pointer is not equal to NULL. RIM_INLINE Bool isSet() const { return pointer != NULL; } /// Cast this pointer to a boolean value, indicating whether or not the pointer is NULL. RIM_INLINE operator Bool () const { return pointer != NULL; } /// Get the number of references there are to this Pointer's object. RIM_INLINE Size getReferenceCount() const { if ( count == NULL ) return Size(0); else return *count; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Release Method /// Release this pointer's reference to its object, resulting in a NULL pointer with 0 reference count. RIM_INLINE void release() { // Decrement the count, delete if it is 0 if ( count != NULL ) { if ( --(*count) == 0 ) { // Delete the pointers. util::destruct( pointer ); util::deallocate( count ); } // Reset the pointer to NULL. pointer = NULL; count = NULL; } } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Casting Methods /// Cast this pointer to the template type using static_cast. template < typename U > RIM_INLINE Pointer<U> cast() const { return Pointer<U>( static_cast<U*>(pointer), count ); } /// Cast this pointer to the template type using dynamic_cast. /** * If the cast was invalid and not able to performed, a NULL * pointer is returned. */ template < typename U > RIM_INLINE Pointer<U> dynamicCast() const { U* newPointer = dynamic_cast<U*>(pointer); if ( newPointer ) return Pointer<U>( newPointer, count ); else return Pointer<U>(); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Construction Helper Methods /// Construct an object of the templated type with the specified arguments for its constructor. RIM_INLINE static Pointer construct() { return Pointer( util::construct<T>() ); } /// Construct an object of the templated type with the specified arguments for its constructor. template < typename P1 > RIM_INLINE static Pointer construct( P1 p1 ) { return Pointer( util::construct<T>( p1 ) ); } /// Construct an object of the templated type with the specified arguments for its constructor. template < typename P1, typename P2 > RIM_INLINE static Pointer construct( P1 p1, P2 p2 ) { return Pointer( util::construct<T>( p1, p2 ) ); } /// Construct an object of the templated type with the specified arguments for its constructor. template < typename P1, typename P2, typename P3 > RIM_INLINE static Pointer construct( P1 p1, P2 p2, P3 p3 ) { return Pointer( util::construct<T>( p1, p2, p3 ) ); } /// Construct an object of the templated type with the specified arguments for its constructor. template < typename P1, typename P2, typename P3, typename P4 > RIM_INLINE static Pointer construct( P1 p1, P2 p2, P3 p3, P4 p4 ) { return Pointer( util::construct<T>( p1, p2, p3, p4 ) ); } /// Construct an object of the templated type with the specified arguments for its constructor. template < typename P1, typename P2, typename P3, typename P4, typename P5 > RIM_INLINE static Pointer construct( P1 p1, P2 p2, P3 p3, P4 p4, P5 p5 ) { return Pointer( util::construct<T>( p1, p2, p3, p4, p5 ) ); } /// Construct an object of the templated type with the specified arguments for its constructor. template < typename P1, typename P2, typename P3, typename P4, typename P5, typename P6 > RIM_INLINE static Pointer construct( P1 p1, P2 p2, P3 p3, P4 p4, P5 p5, P6 p6 ) { return Pointer( util::construct<T>( p1, p2, p3, p4, p5, p6 ) ); } /// Construct an object of the templated type with the specified arguments for its constructor. template < typename P1, typename P2, typename P3, typename P4, typename P5, typename P6, typename P7 > RIM_INLINE static Pointer construct( P1 p1, P2 p2, P3 p3, P4 p4, P5 p5, P6 p6, P7 p7 ) { return Pointer( util::construct<T>( p1, p2, p3, p4, p5, p6, p7 ) ); } private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Constructor /// Create a new smart pointer which directly uses the specified pointer and reference count. RIM_INLINE Pointer( T* newPointer, threads::atomic::Atomic<Size>* newCount ) : pointer( newPointer ), count( newCount ) { (*count)++; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Methods /// Release this Pointer's reference to the object which it was pointing to. /** * If the reference count reaches zero, the object is destroyed. */ RIM_INLINE void decrementCount() { // Decrement the count, delete if it is 0 if ( count != NULL ) { if ( --(*count) == 0 ) { util::destruct( pointer ); util::deallocate( count ); } } } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Members /// A pointer to the object which this Pointer has a reference to. T* pointer; /// A pointer to the reference count of this Pointer. threads::atomic::Atomic<Size>* count; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Friend Class /// Allow pointer types with a different template parameter to access this class's internals. template < typename U > friend class Pointer; }; //########################################################################################## //*************************** End Rim Language Namespace ********************************* RIM_LANGUAGE_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_POINTER_H <file_sep>/* * rimPhysicsAssets.h * Rim Software * * Created by <NAME> on 6/22/14. * Copyright 2014 __MyCompanyName__. All rights reserved. * */ #ifndef INCLUDE_RIM_PHYSICS_ASSETS_H #define INCLUDE_RIM_PHYSICS_ASSETS_H #include "assets/rimPhysicsAssetsConfig.h" #endif // INCLUDE_RIM_PHYSICS_ASSETS_H <file_sep>/* * rimPhysicsCollisionPair.h * Rim Physics * * Created by <NAME> on 11/28/09. * Copyright 2009 Rim Software. All rights reserved. * */ #ifndef INCLUDE_RIM_PHYSICS_COLLISION_PAIR_H #define INCLUDE_RIM_PHYSICS_COLLISION_PAIR_H #include "rimPhysicsCollisionConfig.h" //########################################################################################## //********************** Start Rim Physics Collision Namespace *************************** RIM_PHYSICS_COLLISION_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class which encapsulates a potentially colliding pair of objects. /** * Each object is specified using an ObjectCollider object which may contain additional * information about the object used during collision detection. */ template < typename ObjectType1, typename ObjectType2 > class CollisionPair { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructors /// Create a collision pair object from the two specified ObjectCollider objects. RIM_INLINE CollisionPair( const ObjectCollider<ObjectType1>& newCollider1, const ObjectCollider<ObjectType2>& newCollider2 ) : collider1( newCollider1 ), collider2( newCollider2 ) { } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Collider Accessor Methods /// Return a const reference to the first collider in this collision pair. RIM_FORCE_INLINE const ObjectCollider<ObjectType1>& getCollider1() const { return collider1; } /// Set the first collider in this collision pair. RIM_INLINE void setCollider1( const ObjectCollider<ObjectType1>& newCollider1 ) { collider1 = newCollider1; } /// Return a const reference to the first collider in this collision pair. RIM_FORCE_INLINE const ObjectCollider<ObjectType2>& getCollider2() const { return collider2; } /// Set the second collider in this collision pair. RIM_INLINE void setCollider2( const ObjectCollider<ObjectType2>& newCollider2 ) { collider2 = newCollider2; } private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Members /// The first collider in this collision pair. ObjectCollider<ObjectType1> collider1; /// The second collider in this collision pair. ObjectCollider<ObjectType2> collider2; }; //########################################################################################## //********************** End Rim Physics Collision Namespace ***************************** RIM_PHYSICS_COLLISION_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_PHYSICS_COLLISION_PAIR_H <file_sep>/* * rimGraphicsLightCuller.h * Rim Graphics * * Created by <NAME> on 12/25/10. * Copyright 2010 Rim Software. All rights reserved. * */ #ifndef INCLUDE_RIM_GRAPHICS_LIGHT_CULLER_H #define INCLUDE_RIM_GRAPHICS_LIGHT_CULLER_H #include "rimGraphicsLightsConfig.h" #include "rimGraphicsLight.h" #include "rimGraphicsLightBuffer.h" //########################################################################################## //************************ Start Rim Graphics Lights Namespace *************************** RIM_GRAPHICS_LIGHTS_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class interface which determines which lights in a scene are visible to cameras and objects. /** * This class keeps an internal set of lights that it queries for visibility. * * Typically, a class implementing this interface will have data structures * that speed up the O(n) problem of determining which lights intersect any given * bounding sphere or view volume. */ class LightCuller { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructor /// Create a new light culler with the default light intensity cutoff value of 0.01. RIM_INLINE LightCuller() : cutoff( 0.01f ) { } /// Create a new light culler with specified light intensity cutoff value. /** * The input cutoff value is clamped to the valid range of [0,+infinity]. */ RIM_INLINE LightCuller( Real newCutoff ) : cutoff( math::max( newCutoff, Real(0) ) ) { } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Destructor /// Destroy this light culler. virtual ~LightCuller() { } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Visible Light Accessor Methods /// Add a pointer to each light that intersects the specified view volume to the output list. virtual void getIntersectingLights( const ViewVolume& viewVolume, LightBuffer& outputBuffer ) const = 0; /// Add a pointer to each light that intersects the specified bounding sphere to the output list. virtual void getIntersectingLights( const BoundingSphere& sphere, LightBuffer& outputBuffer ) const = 0; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Update Method /// Update the bounding volumes of all lights that are part of this light culler and any spatial data structures. virtual void update() = 0; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Light Cutoff Accessor Methods /// Return the light intensity cutoff value at which lights are no longer considered visible. RIM_INLINE Real getCutoff() const { return cutoff; } /// Set the light intensity cutoff value at which lights are no longer considered visible. /** * The input cutoff value is clamped to the valid range of [0,+infinity]. */ RIM_INLINE void setCutoff( Real newCutoff ) { cutoff = math::max( newCutoff, Real(0) ); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Light Accessor Methods /// Return the number of lights that are in this light culler. virtual Size getLightCount() const = 0; /// Return whether or not this light culler contains the specified light. virtual Bool containsLight( const Pointer<Light>& light ) const = 0; /// Add the specified light to this light culler. virtual Bool addLight( const Pointer<Light>& light ) = 0; /// Remove the specified light from this light culler and return whether or not it was removed. virtual Bool removeLight( const Pointer<Light>& light ) = 0; /// Clear all lights from this light culler. virtual void clearLights() = 0; protected: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Protected Data Members /// The light intensity cutoff value at which lights are no longer considered visible. Real cutoff; }; //########################################################################################## //************************ End Rim Graphics Lights Namespace ***************************** RIM_GRAPHICS_LIGHTS_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_GRAPHICS_LIGHT_MANAGER_H <file_sep>/* * rimSoundGainFilter.h * Rim Sound * * Created by <NAME> on 7/30/12. * Copyright 2012 __MyCompanyName__. All rights reserved. * */ #ifndef INCLUDE_RIM_SOUND_GAIN_FILTER_H #define INCLUDE_RIM_SOUND_GAIN_FILTER_H #include "rimSoundFiltersConfig.h" #include "rimSoundFilter.h" //########################################################################################## //************************ Start Rim Sound Filters Namespace ***************************** RIM_SOUND_FILTERS_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class that applies a simple gain factor to input audio. class GainFilter : public SoundFilter { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructors /// Create a new gain filter with unity gain (gain = 1). /** * The new gain filter doesn't do anything to input audio since * it is a unity gain. Set the gain factor to modify the output gain * to something else. */ RIM_INLINE GainFilter() : SoundFilter( 1, 1 ), gain( 1 ), targetGain( 1 ) { } /// Create a new gain filter with the specified linear gain factor. RIM_INLINE GainFilter( Gain newGain ) : SoundFilter( 1, 1 ), gain( newGain ), targetGain( newGain ) { } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Gain Accessor Methods /// Return the current linear gain factor of this gain filter. RIM_INLINE Gain getGain() const { return targetGain; } /// Return the current gain for this gain filter in decibels. RIM_INLINE Gain getGainDB() const { return util::linearToDB( targetGain ); } /// Set the target linear gain for this gain filter. RIM_INLINE void setGain( Gain newGain ) { lockMutex(); targetGain = newGain; unlockMutex(); } /// Set the target gain for this gain filter in decibels. RIM_INLINE void setGainDB( Gain newDBGain ) { lockMutex(); targetGain = util::dbToLinear( newDBGain ); unlockMutex(); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Filter Attribute Accessor Methods /// Return a human-readable name for this gain filter. /** * The method returns the string "Gain Filter". */ virtual UTF8String getName() const; /// Return the manufacturer name of this gain filter. /** * The method returns the string "Headspace Sound". */ virtual UTF8String getManufacturer() const; /// Return an object representing the version of this gain filter. virtual SoundFilterVersion getVersion() const; /// Return an object which describes the category of effect that this filter implements. /** * This method returns the value SoundFilterCategory::DYNAMICS. */ virtual SoundFilterCategory getCategory() const; /// Return whether or not this gain filter can process audio data in-place. /** * This method always returns TRUE, gain filter can process audio data in-place. */ virtual Bool allowsInPlaceProcessing() const; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Filter Parameter Accessor Methods /// Return the total number of generic accessible parameters this filter has. virtual Size getParameterCount() const; /// Get information about the filter parameter at the specified index. virtual Bool getParameterInfo( Index parameterIndex, FilterParameterInfo& info ) const; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Filter Preset Accessor Methods /// Return the number of standard configuration presets that this gain filter has. virtual Size getPresetCount() const; /// Get the standard preset for this gain filter with the specified index. virtual Bool getPreset( Index presetIndex, SoundFilterPreset& preset ) const; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Public Static Property Objects /// A string indicating the human-readable name of this gain filter. static const UTF8String NAME; /// A string indicating the manufacturer name of this gain filter. static const UTF8String MANUFACTURER; /// An object indicating the version of this gain filter. static const SoundFilterVersion VERSION; private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Filter Parameter Value Accessor Methods /// Place the value of the parameter at the specified index in the output parameter. virtual Bool getParameterValue( Index parameterIndex, FilterParameter& value ) const; /// Attempt to set the parameter value at the specified index. virtual Bool setParameterValue( Index parameterIndex, const FilterParameter& value ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Filter Processing Methods /// Multiply the samples in the input frame by this gain filter's gain factor and place them in the output frame. virtual SoundFilterResult processFrame( const SoundFilterFrame& inputFrame, SoundFilterFrame& outputFrame, Size numSamples ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Members /// The current linear gain factor applied to all input audio. Gain gain; /// The target output gain for this gain filter. /** * This value allows smooth changes between different gain values. */ Gain targetGain; }; //########################################################################################## //************************ End Rim Sound Filters Namespace ******************************* RIM_SOUND_FILTERS_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_SOUND_GAIN_FILTER_H <file_sep>/* * rimSoundSIMDSample.h * Rim Sound * * Created by <NAME> on 6/1/13. * Copyright 2013 __MyCompanyName__. All rights reserved. * */ #ifndef INCLUDE_RIM_SOUND_SIMD_SAMPLE_H #define INCLUDE_RIM_SOUND_SIMD_SAMPLE_H #include "rimSoundUtilitiesConfig.h" #include "rimSoundSample.h" //########################################################################################## //*********************** Start Rim Sound Utilities Namespace **************************** RIM_SOUND_UTILITIES_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class which represents a SIMD-vector of template primitive-typed sound samples. template < typename T > class RIM_ALIGN(16) SIMDSample { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Public Type Definitions /// The underlying type used to represent this sample. typedef T BaseType; /// The underlying SIMDScalar type used to represent this SIMD sample. typedef math::SIMDScalar<T,math::SIMDType<T>::MAX_WIDTH> SIMDType; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructors /// Create a new SIMD sample with all component values equal to 0. RIM_FORCE_INLINE SIMDSample() : sample() { } /// Create a new SIMD sample with the specified value for all components. RIM_FORCE_INLINE SIMDSample( const T& newSample ) : sample( newSample ) { } /// Create a new SIMD sample with the SIMD sample values for its components. RIM_FORCE_INLINE SIMDSample( const SIMDType& newSample ) : sample( newSample ) { } /// Create a new SIMD sample with the specified sample value for all components. RIM_FORCE_INLINE SIMDSample( const Sample<T>& newSample ) : sample( newSample ) { } /// Create a new SIMD sample with its components initialized with data from the specified pointer. /** * The pointer must have the correct alignment for the SIMD type. */ RIM_FORCE_INLINE SIMDSample( const T* newSample ) : sample( newSample ) { } /// Create a new SIMD sample with its components initialized with data from the specified pointer. /** * The pointer must have the correct alignment for the SIMD type. */ RIM_FORCE_INLINE SIMDSample( const Sample<T>* newSample ) : sample( (T*)newSample ) { } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Store Methods /// Store the components of this SIMD sample to the specified pointer. /** * The pointer must have the correct alignment for the SIMD type. */ RIM_FORCE_INLINE void store( T* pointer ) { sample.store( pointer ); } /// Store the components of this SIMD sample to the specified pointer. /** * The pointer must have the correct alignment for the SIMD type. */ RIM_FORCE_INLINE void store( Sample<T>* pointer ) { sample.store( (T*)pointer ); } /// Store the components of this SIMD sample to the specified pointer. /** * The pointer must have the correct alignment for the SIMD type. */ RIM_FORCE_INLINE void storeUnaligned( T* pointer ) { sample.storeUnaligned( pointer ); } /// Store the components of this SIMD sample to the specified pointer. /** * The pointer must have the correct alignment for the SIMD type. */ RIM_FORCE_INLINE void storeUnaligned( Sample<T>* pointer ) { sample.storeUnaligned( (T*)pointer ); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Cast Operators /// Return a const reference to this Sample's value. RIM_FORCE_INLINE operator const SIMDType& () const { return sample; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Width and Alignment Accessor Methods /// Return the number of vector components that this SIMD sample type has. RIM_FORCE_INLINE static Size getWidth() { return SIMDType::getWidth(); } /// Return the required byte alignment for SIMD samples with this type. RIM_FORCE_INLINE static Size getRequiredAlignment() { return SIMDType::getRequiredAlignment(); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Horizontal Mixing Method /// Horizontally mix the components of this SIMD sample and return the resulting scalar. RIM_FORCE_INLINE Sample<T> mix() const { return sample.sum(); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Mixing (Addition) Operators /// Mix this sample with another and return the result. RIM_FORCE_INLINE SIMDSample operator + ( const SIMDSample& other ) const { return SIMDSample( sample + other.sample ); } /// Mix another sample with this sample and overwrite this sample. RIM_FORCE_INLINE SIMDSample& operator += ( const SIMDSample& other ) { sample += other.sample; return *this; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Subtraction Operators /// Subtract another sample from this sample and return the result. RIM_FORCE_INLINE SIMDSample operator - ( const SIMDSample& other ) const { return SIMDSample( sample - other.sample ); } /// Subtract another sample from this sample and overwrite this sample. RIM_FORCE_INLINE SIMDSample& operator -= ( const SIMDSample& other ) { sample -= other.sample; return *this; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Gain Scaling Operators /// Scale this sample by a linear gain factor and return the result. RIM_FORCE_INLINE SIMDSample operator * ( T gain ) const { return SIMDSample( sample*gain ); } /// Scale this sample by a linear gain factor and overwite this sample. RIM_FORCE_INLINE SIMDSample& operator *= ( T gain ) { sample *= gain; return *this; } /// Scale this sample by a SIMD linear gain factor and return the result. RIM_FORCE_INLINE SIMDSample operator * ( const SIMDType& gain ) const { return SIMDSample( sample*gain ); } /// Scale this sample by a SIMD linear gain factor and overwite this sample. RIM_FORCE_INLINE SIMDSample& operator *= ( const SIMDType& gain ) { sample *= gain; return *this; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Polarity Inversion /// Return the result when this sample's polarity is inverted. RIM_FORCE_INLINE SIMDSample operator - () const { return SIMDSample(-sample); } private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Members /// The data member which represents this sample's value. SIMDType sample; }; /// Define the type of a floating-point sample which uses a 4x32-bit SIMD representation. typedef SIMDSample<Float32> SIMDSample32f; typedef SIMDSample32f::SIMDType SIMDGain32f; /// Define the type of a floating-point sample which uses a 2x64-bit SIMD representation. typedef SIMDSample<Float64> SIMDSample64f; typedef SIMDSample64f::SIMDType SIMDGain64f; //########################################################################################## //*********************** End Rim Sound Utilities Namespace ****************************** RIM_SOUND_UTILITIES_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_SOUND_SIMD_SAMPLE_H <file_sep>/* * rimGraphicsRenderers.h * Rim Graphics * * Created by <NAME> on 5/16/12. * Copyright 2012 __MyCompanyName__. All rights reserved. * */ #ifndef INCLUDE_RIM_GRAPHICS_RENDERERS_H #define INCLUDE_RIM_GRAPHICS_RENDERERS_H #include "renderers/rimGraphicsRenderersConfig.h" #include "renderers/rimGraphicsRenderer.h" #include "renderers/rimGraphicsShadowMapRenderer.h" #include "renderers/rimGraphicsForwardRenderer.h" #include "renderers/rimGraphicsDeferredRenderer.h" #include "renderers/rimGraphicsImmediateRenderer.h" #include "renderers/rimGraphicsPostProcessEffect.h" #include "renderers/rimGraphicsPostProcessRenderer.h" #include "renderers/rimGraphicsPipeline.h" #endif // INCLUDE_RIM_GRAPHICS_RENDERERS_H <file_sep>/* * rimMatrix.h * Rim Software * * Created by <NAME> on 2/15/14. * Copyright 2014 __MyCompanyName__. All rights reserved. * */ #ifndef INCLUDE_RIM_MATRIX_H #define INCLUDE_RIM_MATRIX_H #include "rimMathConfig.h" #include "rimArrayMath.h" #include "../data/rimBasicString.h" #include "../data/rimBasicStringBuffer.h" #include "../util/rimCopy.h" #include "rimMatrix2D.h" #include "rimMatrix3D.h" #include "rimMatrix4D.h" #include "rimMatrixND.h" #include "rimVector2D.h" #include "rimVector3D.h" #include "rimVector4D.h" #include "rimVectorND.h" //########################################################################################## //***************************** Start Rim Math Namespace ********************************* RIM_MATH_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class which represents a matrix of a dynamic arbitrary number of rows and columns. template < typename T > class Matrix { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructors /// Create an empty matrix with 0 row and 0 columns. RIM_INLINE Matrix() : storage( allocateStorage( 0, 0 ) ) { } /// Create a matrix with the specified number of rows, columns, and default element value. RIM_INLINE explicit Matrix( Size numRows, Size numColumns = Size(1), const T& value = T(0) ) : storage( allocateStorage( numRows, numColumns ) ) { util::set( storage->getElements(), value, numRows*numColumns ); } /// Create a matrix from a pointer to an array with elements specified in column-major order. RIM_INLINE explicit Matrix( const T* array, Size numRows, Size numColumns ) : storage( allocateStorage( numRows, numColumns ) ) { util::copy( storage->getElements(), array, numRows*numColumns ); } /// Create a matrix copy of the specified 2x2 matrix. RIM_INLINE Matrix( const Matrix2D<T>& matrix ) : storage( allocateStorage( 2, 2 ) ) { util::copy( storage->getElements(), matrix.toArrayColumnMajor(), 4 ); } /// Create a matrix copy of the specified 3x3 matrix. RIM_INLINE Matrix( const Matrix3D<T>& matrix ) : storage( allocateStorage( 3, 3 ) ) { util::copy( storage->getElements(), matrix.toArrayColumnMajor(), 9 ); } /// Create a matrix copy of the specified 4x4 matrix. RIM_INLINE Matrix( const Matrix4D<T>& matrix ) : storage( allocateStorage( 4, 4 ) ) { util::copy( storage->getElements(), matrix.toArrayColumnMajor(), 16 ); } /// Create a matrix copy of the specified MxN matrix. template < Size newNumRows, Size newNumColumns > RIM_INLINE Matrix( const MatrixND<T,newNumRows,newNumColumns>& matrix ) : storage( allocateStorage( newNumRows, newNumColumns ) ) { util::copy( storage->getElements(), matrix.toArrayColumnMajor(), newNumRows*newNumColumns ); } /// Create a matrix copy of the specified 2-component column vector. RIM_INLINE Matrix( const Vector2D<T>& vector ) : storage( allocateStorage( 2, 1 ) ) { util::copy( storage->getElements(), vector.toArray(), 2 ); } /// Create a matrix copy of the specified 3-component column vector. RIM_INLINE Matrix( const Vector3D<T>& vector ) : storage( allocateStorage( 3, 1 ) ) { util::copy( storage->getElements(), vector.toArray(), 3 ); } /// Create a matrix copy of the specified 4-component column vector. RIM_INLINE Matrix( const Vector4D<T>& vector ) : storage( allocateStorage( 4, 1 ) ) { util::copy( storage->getElements(), vector.toArray(), 4 ); } /// Create a matrix copy of the specified N-component column vector. template < Size newNumRows > RIM_INLINE Matrix( const VectorND<T,newNumRows>& vector ) : storage( allocateStorage( newNumRows, 1 ) ) { util::copy( storage->getElements(), vector.toArray(), newNumRows ); } /// Create a copy of another matrix, taking a reference to its internal storage. /** * This operation is very fast because it does not require copying the matrix storage. */ RIM_INLINE Matrix( const Matrix& other ) : storage( other.storage ) { storage->referenceCount++; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Destructor /// Destroy this matrix object, release its reference to the internal storage. RIM_INLINE ~Matrix() { deallocateStorage( storage ); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Assignment Operator /// Assign the contents of another matrix to this one. RIM_INLINE Matrix& operator = ( const Matrix& other ) { if ( storage != other.storage ) { // Destroy the current storage. deallocateStorage( storage ); // Copy the other matrix's storage and increment the reference count. storage = other.storage; storage->referenceCount++; } return *this; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Element Accessor Methods /// Return the number of rows that this matrix has. RIM_FORCE_INLINE Size getRowCount() const { return storage->numRows; } /// Return the number of columns that this matrix has. RIM_FORCE_INLINE Size getColumnCount() const { return storage->numColumns; } /// Return a reference to the column at the specified index in the matrix. RIM_NO_INLINE Matrix getColumn( Index columnIndex ) { Size numRows = storage->numRows; RIM_DEBUG_ASSERT_MESSAGE( columnIndex < storage->numColumns, "Invalid matrix column index" ); // Create storage for the result. Storage* result = allocateStorage( numRows, 1 ); T* resultElement = result->getElements(); const T* const resultElementsEnd = resultElement + numRows; const T* matrix1Element = storage->getElements() + columnIndex*numRows; while ( resultElement != resultElementsEnd ) { *resultElement = *matrix1Element; resultElement++; matrix1Element++; } return Matrix( result ); } /// Set the column vector at the specified index in the matrix. RIM_NO_INLINE void setColumn( Index columnIndex, const Matrix& newColumn ) { Size numRows = storage->numRows; RIM_DEBUG_ASSERT_MESSAGE( numRows != numOtherRows, "Incompatible matrix row dimensions" ); RIM_DEBUG_ASSERT_MESSAGE( numOtherColumns != Size(1), "Incompatible matrix column dimension" ); RIM_DEBUG_ASSERT_MESSAGE( columnIndex < numColumns, "Invalid matrix column index" ); T* element = storage->getElements() + columnIndex*numRows; const T* const elementsEnd = element + numRows; const T* columnElement = newColumn.storage->getElements(); while ( element != elementsEnd ) { *element = *columnElement; element++; columnElement++; } } /// Return the row at the specified index in the matrix. RIM_NO_INLINE Matrix getRow( Index rowIndex ) const { Size numColumns = storage->numColumns; RIM_DEBUG_ASSERT_MESSAGE( rowIndex < storage->numRows, "Invalid matrix row index" ); // Create storage for the result. Storage* result = allocateStorage( 1, numColumns ); T* resultElement = result->getElements(); const T* const resultElementsEnd = resultElement + numColumns; const T* matrix1Element = storage->getElements() + rowIndex; while ( resultElement != resultElementsEnd ) { *resultElement = *matrix1Element; resultElement++; matrix1Element += numColumns; } return Matrix( result ); } /// Set the row vector at the specified index in the matrix. RIM_NO_INLINE void setRow( Index rowIndex, const Matrix& newRow ) { Size numRows = storage->numRows; Size numColumns = storage->numColumns; Size numOtherRows = newRow.storage->numRows; RIM_DEBUG_ASSERT_MESSAGE( numColumns != numOtherColumns, "Incompatible matrix column dimensions" ); RIM_DEBUG_ASSERT_MESSAGE( numOtherRows != Size(1), "Incompatible matrix row dimension" ); RIM_DEBUG_ASSERT_MESSAGE( rowIndex < numRows, "Invalid matrix row index" ); T* element = storage->getElements() + rowIndex; const T* const elementsEnd = element + numColumns*numRows; const T* rowElement = newRow.storage->getElements(); while ( element != elementsEnd ) { *element = *rowElement; element += numRows; rowElement += numOtherRows; } } /// Return the element at the specified (row, column) in the matrix. RIM_FORCE_INLINE T& get( Index rowIndex, Index columnIndex ) { RIM_DEBUG_ASSERT_MESSAGE( rowIndex < storage->numRows, "Invalid matrix row index" ); RIM_DEBUG_ASSERT_MESSAGE( columnIndex < storage->numColumns, "Invalid matrix column index" ); return storage->getElements()[rowIndex + columnIndex*storage->numRows]; } /// Return the element at the specified (row, column) in the matrix. RIM_FORCE_INLINE const T& get( Index rowIndex, Index columnIndex ) const { RIM_DEBUG_ASSERT_MESSAGE( rowIndex < storage->numRows, "Invalid matrix row index" ); RIM_DEBUG_ASSERT_MESSAGE( columnIndex < storage->numColumns, "Invalid matrix column index" ); return storage->getElements()[rowIndex + columnIndex*storage->numRows]; } /// Get the element at the specified (row, column) in the matrix. RIM_FORCE_INLINE void set( Index rowIndex, Index columnIndex, const T& value ) { RIM_DEBUG_ASSERT_MESSAGE( rowIndex < storage->numRows, "Invalid matrix row index" ); RIM_DEBUG_ASSERT_MESSAGE( columnIndex < storage->numColumns, "Invalid matrix column index" ); storage->getElements()[rowIndex + columnIndex*storage->numRows] = value; } /// Return the element at the specified (row, column) in the matrix. RIM_FORCE_INLINE T& operator () ( Index rowIndex, Index columnIndex ) { return this->get( rowIndex, columnIndex ); } /// Return the element at the specified (row, column) in the matrix. RIM_FORCE_INLINE const T& operator () ( Index rowIndex, Index columnIndex ) const { return this->get( rowIndex, columnIndex ); } /// Return a pointer to raw elements of the matrix in column-major order. RIM_FORCE_INLINE T* toArrayColumnMajor() { return storage->getElements(); } /// Return a pointer to raw elements of the matrix in column-major order. RIM_FORCE_INLINE const T* toArrayColumnMajor() const { return storage->getElements(); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Matrix Operations /* /// Get the determinant of the matrix. RIM_FORCE_INLINE T getDeterminant() const { return T(1); } */ /// Return the inverse of the matrix if it has one. /** * If there is no inverse, or the matrix is not square, a 0 by 0 matrix * is returned. */ /* RIM_FORCE_INLINE Matrix invert() const { Size numRows = storage->numRows; Size numColumns = storage->numColumns; if ( numRows != numColumns ) return Matrix(); Storage* result = allocateStorage( numRows, numColumns ); return Matrix( result ); } */ /* /// Return the orthonormalization of this matrix. RIM_FORCE_INLINE Matrix orthonormalize() const { Matrix<T,numRows,numColumns> result; for ( Index i = 0; i < numColumns; i++ ) { VectorND<T,numRows> newColumn = getColumn(i); for ( Index j = 0; j < i; j++ ) newColumn -= getColumn(i).projectOn( result.getColumn(j) ); result.setColumn( i, newColumn.normalize() ); } return result; }*/ /// Return the transpose of this matrix. RIM_FORCE_INLINE Matrix transpose() const { Size numRows = storage->numRows; Size numColumns = storage->numColumns; // Create storage for the result. Storage* result = allocateStorage( numColumns, numRows ); T* resultElement = result->getElements(); const T* matrixElements = storage->getElements(); for ( Index i = 0; i < numRows; i++ ) { for ( Index j = 0; j < numColumns; j++ ) { *resultElement = matrixElements[i + j*numRows]; resultElement++; } } return Matrix( result ); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Comparison Operators /// Return whether or not every element in this matrix is equal to that in another matrix. RIM_INLINE Bool operator == ( const Matrix& other ) const { if ( storage->numRows != other.storage->numRows || storage->numColumns != other.storage->numColumns ) return false; const T* element1 = storage->getElements(); const T* element1End = element1 + storage->getSize(); const T* element2 = other.storage->getElements(); while ( element1 != element1End ) { if ( *element1 != *element2 ) return false; element1++; element2++; } return true; } /// Return whether or not some element in this matrix is not equal to that in another matrix. RIM_FORCE_INLINE Bool operator != ( const Matrix<T>& other ) const { return !(operator==( other )); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Matrix Negation/Positivation Operators /// Negate every element of this matrix and return the resulting matrix. RIM_NO_INLINE Matrix operator - () const { Size numRows = storage->numRows; Size numColumns = storage->numColumns; // Create storage for the result. Storage* result = allocateStorage( numRows, numColumns ); T* resultElement = result->getElements(); const T* const resultElementsEnd = resultElement + numRows*numColumns; const T* matrix1Element = storage->getElements(); while ( resultElement != resultElementsEnd ) { *resultElement = -*matrix1Element; resultElement++; matrix1Element++; } return Matrix( result ); } /// 'Positivate' every element of this matrix, returning a copy of the original matrix. RIM_FORCE_INLINE const Matrix& operator + () const { return *this; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Arithmetic Operators /// Add this matrix to another and return the resulting matrix. RIM_NO_INLINE Matrix operator + ( const Matrix& matrix ) const { Size numRows = storage->numRows; Size numColumns = storage->numColumns; RIM_DEBUG_ASSERT_MESSAGE( numRows != matrix.storage->numRows, "Incompatible matrix row dimensions" ); RIM_DEBUG_ASSERT_MESSAGE( numColumns != matrix.storage->numColumns, "Incompatible matrix column dimensions" ); // Create storage for the result. Storage* result = allocateStorage( numRows, numColumns ); // Add the elements and store the result. math::add( result->getElements(), storage->getElements(), matrix.storage->getElements(), numRows*numColumns ); return Matrix( result ); } /// Add a scalar to the elements of this matrix and return the resulting matrix. RIM_NO_INLINE Matrix operator + ( const T& value ) const { Size numRows = storage->numRows; Size numColumns = storage->numColumns; // Create storage for the result. Storage* result = allocateStorage( numRows, numColumns ); // Add the elements and store the result. math::add( result->getElements(), storage->getElements(), value, numRows*numColumns ); return Matrix( result ); } /// Add this matrix to another and return the resulting matrix. RIM_NO_INLINE Matrix operator - ( const Matrix& matrix ) const { Size numRows = storage->numRows; Size numColumns = storage->numColumns; RIM_DEBUG_ASSERT_MESSAGE( numRows != matrix.storage->numRows, "Incompatible matrix row dimensions" ); RIM_DEBUG_ASSERT_MESSAGE( numColumns != matrix.storage->numColumns, "Incompatible matrix column dimensions" ); // Create storage for the result. Storage* result = allocateStorage( numRows, numColumns ); // Subtract the elements and store the result. math::subtract( result->getElements(), storage->getElements(), matrix.storage->getElements(), numRows*numColumns ); return Matrix( result ); } /// Subtract a scalar from the elements of this matrix and return the resulting matrix. RIM_NO_INLINE Matrix operator - ( const T& value ) const { Size numRows = storage->numRows; Size numColumns = storage->numColumns; // Create storage for the result. Storage* result = allocateStorage( numRows, numColumns ); // Subtract the elements and store the result. math::subtract( result->getElements(), storage->getElements(), value, numRows*numColumns ); return Matrix( result ); } /// Multiply a matrix by this matrix and return the result. RIM_NO_INLINE Matrix operator * ( const Matrix& matrix ) { Size numRows = storage->numRows; Size numOtherRows = matrix.storage->numRows; Size numOtherColumns = matrix.storage->numColumns; RIM_DEBUG_ASSERT_MESSAGE( storage->numColumns != numOtherRows, "Incompatible matrix dimensions for multiplication" ); // Create storage for the result. Storage* result = allocateStorage( numRows, numOtherColumns ); T* resultElements = result->getElements(); const T* matrix1Elements = storage->getElements(); const T* matrix2Elements = matrix.storage->getElements(); for ( Index i = 0; i < numRows; i++ ) { const T* const m1RowStart = matrix1Elements + i; for ( Index j = 0; j < numOtherColumns; j++ ) { const T* m2Column = matrix2Elements + j*numOtherRows; const T* const m2ColumnEnd = m2Column + numOtherRows; const T* m1Row = m1RowStart; T dot = T(0); while ( m2Column != m2ColumnEnd ) { dot += (*m1Row)*(*m2Column); m1Row += numRows; m2Column++; } resultElements[i + j*numRows] = dot; } } return Matrix( result ); } /// Multiply the elements of this matrix by a scalar and return the resulting matrix. RIM_NO_INLINE Matrix operator * ( const T& value ) const { Size numRows = storage->numRows; Size numColumns = storage->numColumns; // Create storage for the result. Storage* result = allocateStorage( numRows, numColumns ); // Multiply the elements and store the result. math::multiply( result->getElements(), storage->getElements(), value, numRows*numColumns ); return Matrix( result ); } /// Divide the elements of this matrix by a scalar and return the resulting matrix. RIM_NO_INLINE Matrix operator / ( const T& value ) const { Size numRows = storage->numRows; Size numColumns = storage->numColumns; // Create storage for the result. Storage* result = allocateStorage( numRows, numColumns ); // Multiply the elements and store the result. math::multiply( result->getElements(), storage->getElements(), T(1)/value, numRows*numColumns ); return Matrix( result ); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Matrix Operators /// Add the elements of another matrix to this matrix. RIM_NO_INLINE Matrix& operator += ( const Matrix& matrix ) { Size numRows = storage->numRows; Size numColumns = storage->numColumns; RIM_DEBUG_ASSERT_MESSAGE( numRows != matrix.storage->numRows, "Incompatible matrix row dimensions" ); RIM_DEBUG_ASSERT_MESSAGE( numColumns != matrix.storage->numColumns, "Incompatible matrix column dimensions" ); math::add( storage->getElements(), matrix.storage->getElements(), numRows*numColumns ); return *this; } /// Add a scalar value to the elements of this matrix. RIM_NO_INLINE Matrix& operator += ( const T& value ) { if ( storage->referenceCount > Size(1) ) makeUnique(); Size numRows = storage->numRows; Size numColumns = storage->numColumns; math::add( storage->getElements(), value, numRows*numColumns ); return *this; } /// Subtract the elements of another matrix from this matrix. RIM_NO_INLINE Matrix& operator -= ( const Matrix& matrix ) { Size numRows = storage->numRows; Size numColumns = storage->numColumns; RIM_DEBUG_ASSERT_MESSAGE( numRows != matrix.storage->numRows, "Incompatible matrix row dimensions" ); RIM_DEBUG_ASSERT_MESSAGE( numColumns != matrix.storage->numColumns, "Incompatible matrix column dimensions" ); math::subtract( storage->getElements(), matrix.storage->getElements(), numRows*numColumns ); return *this; } /// Subtract a scalar value from the elements of this matrix. RIM_NO_INLINE Matrix& operator -= ( const T& value ) { if ( storage->referenceCount > Size(1) ) makeUnique(); Size numRows = storage->numRows; Size numColumns = storage->numColumns; math::subtract( storage->getElements(), value, numRows*numColumns ); return *this; } /// Multiply the elements of this matrix by a scalar value. RIM_NO_INLINE Matrix& operator *= ( const T& value ) { if ( storage->referenceCount > Size(1) ) makeUnique(); Size numRows = storage->numRows; Size numColumns = storage->numColumns; math::multiply( storage->getElements(), value, numRows*numColumns ); return *this; } /// Divide the elements of this matrix by a scalar value. RIM_NO_INLINE Matrix& operator /= ( const T& value ) { if ( storage->referenceCount > Size(1) ) makeUnique(); Size numRows = storage->numRows; Size numColumns = storage->numColumns; math::multiply( storage->getElements(), T(1)/value, numRows*numColumns ); return *this; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** String Conversion Methods /// Convert this matrix into a human-readable string representation. RIM_NO_INLINE data::String toString() const { data::StringBuffer buffer; const Size numRows = storage->numRows; const Size numColumns = storage->numColumns; const T* elements = storage->getElements(); for ( Index i = 0; i < numRows; i++ ) { buffer << "[ "; for ( Index j = 0; j < numColumns; j++ ) { if ( j != numColumns - 1 ) buffer << elements[i + j*numRows] << ", "; else buffer << elements[i + j*numRows] << ' '; } if ( i != numRows - 1 ) buffer << "]\n"; else buffer << ']'; } return buffer.toString(); } /// Convert this matrix into a human-readable string representation. RIM_FORCE_INLINE operator data::String () const { return this->toString(); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Static Matrix Creation Methods /// Return the square identity matrix for the specified matrix size. static Matrix getIdentity( Size size ) { Storage* storage = allocateStorage( size, size ); T* element = storage->getElements(); for ( Index i = 0; i < size; i++ ) { for ( Index j = 0; j < size; j++, element++ ) { if ( i == j ) *element = T(1); else *element = T(0); } } return Matrix( storage ); } /// Return an uninitialized matrix of the specified size. /** * The contents of the matrix elements are undefined. */ static Matrix getUninitialized( Size numRows, Size numColumns ) { Storage* storage = allocateStorage( numRows, numColumns ); return Matrix( storage ); } private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Class Declaration /// A class which stores information about this matrix and its element data. class Storage { public: /// Create a new storage object with the specified number of rows and columns and reference count of 1. RIM_INLINE Storage( Size newNumRows, Size newNumColumns ) : numRows( newNumRows ), numColumns( newNumColumns ), referenceCount( 1 ) { } /// Return a pointer to the storage for the elements of this matrix. /** * Elements are stored in column-major order. */ RIM_INLINE T* getElements() { return (T*)((UByte*)this + sizeof(Storage)); } /// Return a const pointer to the storage for the elements of this matrix. /** * Elements are stored in column-major order. */ RIM_INLINE const T* getElements() const { return (const T*)((const UByte*)this + sizeof(Storage)); } /// Return the total number of elements that are part of this storage. RIM_INLINE Size getSize() const { return numRows*numColumns; } /// The number of rows that are part of this matrix storage. Size numRows; /// The number of columns that are part of this matrix storage. Size numColumns; /// The number of matrices that reference this storage object. Size referenceCount; /// An array to pad the storage buffer to a 16-byte boundary. Size padding; }; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Constructor /// Create a new matrix which uses the specified storage object. /** * The new matrix does not increment the storage's reference count. */ RIM_INLINE Matrix( Storage* newStorage ) : storage( newStorage ) { } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Storage Helper Methods /// Allocate a storage object with the specified number of rows and columns. static Storage* allocateStorage( Size numRows, Size numColumns ) { Size storageSize = sizeof(Storage) + sizeof(T)*numRows*numColumns; UByte* storageBytes = util::allocate<UByte>( storageSize ); new ( storageBytes ) Storage( numRows, numColumns ); return (Storage*)storageBytes; } /// Deallocate the specified storage object. static void deallocateStorage( Storage* storage ) { if ( --storage->referenceCount == Size(0) ) util::deallocate( (UByte*)storage ); } /// Set all elements of the specified storage object to the given value. static void setStorage( Storage* storage, const T& value ) { util::set( storage->getElements(), value, storage->getSize() ); } // If this matrix's storage is not unique, copy it so that the matrix has its own storage. RIM_NO_INLINE void makeUnique() { Size numRows = storage->numRows; Size numColumns = storage->numColumns; Storage* oldStorage = storage; // Create new storage and copy the elements. storage = allocateStorage( numRows, numColumns ); util::copy( storage->getElements(), oldStorage->getElements(), numRows*numColumns ); // Clean up the old storage. deallocateStorage( oldStorage ); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Members /// A pointer to the reference-counted storage for this matrix. /** * The matrix employs copy-on-write semantics. */ Storage* storage; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Friend Class template < typename U > friend class Matrix; template < typename U > friend Matrix<U> qr( const Matrix<U>& ); template < typename U > friend Matrix<U> qr( const Matrix<U>&, Matrix<U>& ); }; //########################################################################################## //########################################################################################## //############ //############ Reverse Matrix Arithmetic Operators //############ //########################################################################################## //########################################################################################## /// Add a scalar to a matrix's elements and return the resulting matrix template < typename T > RIM_FORCE_INLINE Matrix<T> operator + ( const T& c, const Matrix<T>& matrix ) { return matrix + c; } /// Subtract a matrix's elements from a scalar and return the resulting matrix template < typename T > RIM_FORCE_INLINE Matrix<T> operator - ( const T& c, const Matrix<T>& matrix ) { return -matrix + c; } /// Multiply a matrix's elements by a scalar and return the resulting matrix template < typename T > RIM_FORCE_INLINE Matrix<T> operator * ( const T& c, const Matrix<T>& matrix ) { return matrix * c; } //########################################################################################## //########################################################################################## //############ //############ QR Factorization Methods //############ //########################################################################################## //########################################################################################## #if 0 /// Do a QR factorization of the specified matrix, returning the R matrix. /** * R is an upper-triangular matrix. The Q matrix is not computed. */ template < typename T > RIM_NO_INLINE Matrix<T> qr( const Matrix<T>& matrix ) { Size numRows = matrix.getRowCount(); Size numColumns = matrix.getColumnCount(); typename Matrix<T>::Storage* rStorage = Matrix<T>::allocateStorage( numRows, numColumns ); for ( Index k = 0; k < numColumns; k++ ) { } return Matrix<T>( rStorage ); } /// Do a QR factorization of the specified matrix, returning the R matrix and the Q matrix in the output parameter. /** * R is an upper-triangular matrix, Q is an orthonormal (unitary) matrix. */ template < typename T > RIM_NO_INLINE Matrix<T> qr( const Matrix<T>& matrix, Matrix<T>& q ) { } #endif //########################################################################################## //***************************** End Rim Math Namespace *********************************** RIM_MATH_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_MATRIX_H <file_sep>/* * rimGraphicsMeshChunk.h * Rim Graphics * * Created by <NAME> on 11/23/11. * Copyright 2011 __MyCompanyName__. All rights reserved. * */ #ifndef INCLUDE_RIM_GRAPHICS_MESH_CHUNK_H #define INCLUDE_RIM_GRAPHICS_MESH_CHUNK_H #include "rimGraphicsShapesConfig.h" #include "rimGraphicsSkeleton.h" //########################################################################################## //*********************** Start Rim Graphics Shapes Namespace **************************** RIM_GRAPHICS_SHAPES_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class which contains all information needed to draw a chunk of geometry. /** * A MeshChunk is used as a intermediate universal data format which should work * for almost any rendering technique. It contains a pointer to a vertex buffer, * an optional index buffer pointer, a range of elements to draw, an object-to-world- * space transformation matrix, and a material for the specified geometry. * * If an index buffer is specified, the range of elements to draw refers to the index * range which should be drawn. If no index buffer is provided, the range refers to the * range of vertices which should be drawn from the vertex buffer. */ class MeshChunk { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructor /// Create a mesh chunk with no data. RIM_FORCE_INLINE MeshChunk() : transformation(), boundingBox(), vertexBuffers( NULL ), indexBuffer( NULL ), material( NULL ), skeleton( NULL ), bufferRange() { } /// Create an indexed mesh chunk which uses the specified range of indices. RIM_FORCE_INLINE MeshChunk( const Matrix4& newTransform, const AABB3& newBoundingBox, const Material* newMaterial, const Skeleton* newSkeleton, const VertexBufferList* newVertexBuffers, const IndexBuffer* newIndices, const BufferRange& newBufferRange ) : transformation( newTransform ), boundingBox( newBoundingBox ), vertexBuffers( newVertexBuffers ), indexBuffer( newIndices ), material( newMaterial ), skeleton( newSkeleton ), bufferRange( newBufferRange ) { } /// Create a non-indexed mesh chunk which uses the specified range of vertices. RIM_FORCE_INLINE MeshChunk( const Matrix4& newTransform, const AABB3& newBoundingBox, const Material* newMaterial, const Skeleton* newSkeleton, const VertexBufferList* newVertexBuffers, const BufferRange& newBufferRange ) : transformation( newTransform ), boundingBox( newBoundingBox ), vertexBuffers( newVertexBuffers ), indexBuffer( NULL ), material( newMaterial ), skeleton( newSkeleton ), bufferRange( newBufferRange ) { } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Vertex Buffer Accessor Methods /// Return whether or not there is a vertex buffer list associated with this mesh chunk. RIM_FORCE_INLINE Bool hasVertexBuffers() const { return vertexBuffers != NULL; } /// Return a pointer to the vertex buffer list for this mesh chunk. RIM_FORCE_INLINE const VertexBufferList* getVertexBuffers() const { return vertexBuffers; } /// Set a pointer to the vertex buffers for this mesh chunk. RIM_FORCE_INLINE void setVertexBuffers( const VertexBufferList* newVertexBuffers ) { vertexBuffers = newVertexBuffers; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Index Buffer Accessor Methods /// Return whether or not there is an index buffer associated with this mesh chunk. /** * If this method returns FALSE, it means that the mesh chunk should * use the in-order vertices in the vertex buffer when it is drawn. * Otherwise, the index buffer is used to index into the vertex buffer * for the chunk's range of elements. */ RIM_FORCE_INLINE Bool hasIndexBuffer() const { return indexBuffer != NULL; } /// Return a pointer to the index buffer for this mesh chunk. /** * If this method returns NULL, it means that the mesh chunk should * use the in-order vertices in the vertex buffer when it is drawn. * Otherwise, the index buffer is used to index into the vertex buffer * for the chunk's range of elements. */ RIM_FORCE_INLINE const IndexBuffer* getIndexBuffer() const { return indexBuffer; } /// Set a pointer to the index buffer for this mesh chunk. RIM_FORCE_INLINE void setIndexBuffer( const IndexBuffer* newIndexBuffer ) { indexBuffer = newIndexBuffer; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Buffer Range Accessor Methods /// Return a reference to the buffer range for this mesh chunk. /** * If the mesh chunk has an index buffer, the valid range refers to the indices * which should be used when drawing the chunk. Otherwise, the range refers * to the valid contiguous range of vertices to use. */ RIM_FORCE_INLINE const BufferRange& getBufferRange() const { return bufferRange; } /// Set the buffer range for this mesh chunk. /** * If the mesh chunk has an index buffer, the valid range refers to the indices * which should be used when drawing the chunk. Otherwise, the range refers * to the valid contiguous range of vertices to use. */ RIM_FORCE_INLINE void setBufferRange( const BufferRange& newBufferRange ) { bufferRange = newBufferRange; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Material Accessor Methods /// Return whether or not this mesh chunk has a material associated with it. RIM_FORCE_INLINE Bool hasMaterial() const { return material != NULL; } /// Return a pointer to the material which should be used to render this mesh chunk. /** * If the method returns NULL, the renderer can either choose to use a default * material when rendering the chunk or can skip the chunk entirely. */ RIM_FORCE_INLINE const Material* getMaterial() const { return material; } /// Set a pointer to the material which should be used to render this mesh chunk. RIM_FORCE_INLINE void setMaterial( const Material* newMaterial ) { material = newMaterial; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Skeleton Accessor Methods /// Return whether or not this mesh chunk has a skeleton associated with it. RIM_FORCE_INLINE Bool hasSkeleton() const { return skeleton != NULL; } /// Return a pointer to the skeleton which should be used to render this mesh chunk, or NULL if there is none. RIM_FORCE_INLINE const Skeleton* getSkeleton() const { return skeleton; } /// Set a pointer to the skeleton which should be used to render this mesh chunk. RIM_FORCE_INLINE void setSkeleton( const Skeleton* newSkeleton ) { skeleton = newSkeleton; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Bounding Sphere Accessor Methods /// Return a 4x4 matrix representing the homogeneous coordinate transform from the mesh's object to world space. RIM_FORCE_INLINE const Matrix4& getTransformMatrix() const { return transformation; } /// Set a 4x4 matrix representing the homogeneous coordinate transform from the mesh's object to world space. RIM_FORCE_INLINE void setTransformMatrix( const Matrix4& newTransform ) { transformation = newTransform; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Bounding Volume Accessor Methods /// Return a reference to a bounding box for this mesh chunk in world space. RIM_FORCE_INLINE const AABB3& getBoundingBox() const { return boundingBox; } /// Return a reference to a bounding box for this mesh chunk in world space. RIM_FORCE_INLINE void setBoundingBox( const AABB3& newBoundingBox ) { boundingBox = newBoundingBox; } private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Members /// A 4x4 transformation matrix which transforms from mesh to world space. Matrix4 transformation; /// The bounding box of this mesh chunk in world space. AABB3 boundingBox; /// A pointer to the vertex buffer list which this mesh chunk uses to describe its vertices. const VertexBufferList* vertexBuffers; /// A pointer to the index buffer which this mesh chunk uses to describe primitives. const IndexBuffer* indexBuffer; /// The material which should be used to render this mesh chunk. const Material* material; /// The skeleton which should be used to render this mesh chunk. const Skeleton* skeleton; /// An object describing the range of indices or vertices to use from the mesh chunk's buffers. BufferRange bufferRange; }; //########################################################################################## //*********************** End Rim Graphics Shapes Namespace ****************************** RIM_GRAPHICS_SHAPES_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_GRAPHICS_MESH_CHUNK_H <file_sep>/* * rimGraphicsHardwareBufferType.h * Rim Graphics * * Created by <NAME> on 1/27/13. * Copyright 2013 __MyCompanyName__. All rights reserved. * */ #ifndef INCLUDE_RIM_GRAPHICS_HARDWARE_BUFFER_TYPE_H #define INCLUDE_RIM_GRAPHICS_HARDWARE_BUFFER_TYPE_H #include "rimGraphicsBuffersConfig.h" //########################################################################################## //*********************** Start Rim Graphics Buffers Namespace *************************** RIM_GRAPHICS_BUFFERS_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class which specifies a kind of HardwareBuffer. /** * The type specified here is used to determine the kinds of elements that a hardware * attribute buffer can hold and how it can be used. */ class HardwareBufferType { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Vertex Attribute Buffer Usage Enum Definition /// An enum type which represents the type for a hardware attribute buffer. typedef enum Enum { /// An attribute buffer that can have any vertex attribute type for its elements. VERTEX_BUFFER = 1, /// An attribute buffer that can only have index types for its elements. INDEX_BUFFER = 2 }; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructors /// Create a new hardware attribute buffer type with the specified usage enum value. RIM_INLINE HardwareBufferType( Enum newType ) : type( newType ) { } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Enum Cast Operator /// Convert this hardware attribute buffer type to an enum value. RIM_INLINE operator Enum () const { return (Enum)type; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Valid Attribute Type Method /// Return whether or not the specified attribute type is a valid type for this buffer type. Bool supportsAttributeType( const AttributeType& attributeType ) const; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** String Representation Accessor Methods /// Return a string representation of the hardware attribute buffer type. String toString() const; /// Convert this hardware attribute buffer type into a string representation. RIM_INLINE operator String () const { return this->toString(); } private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Members /// An enum for the hardware attribute buffer type. UByte type; }; //########################################################################################## //*********************** End Rim Graphics Buffers Namespace ***************************** RIM_GRAPHICS_BUFFERS_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_GRAPHICS_HARDWARE_BUFFER_TYPE_H <file_sep>/* * rimTime.h * Rim Time * * Created by <NAME> on 12/28/08. * Copyright 2008 Rim Software. All rights reserved. * */ #ifndef INCLUDE_RIM_TIME_MODULE_H #define INCLUDE_RIM_TIME_MODULE_H #include "time/rimTimeConfig.h" #include "time/rimTimer.h" #include "time/rimDate.h" #include "time/rimMonth.h" #include "time/rimDay.h" #ifdef RIM_TIME_NAMESPACE_START #undef RIM_TIME_NAMESPACE_START #endif #ifdef RIM_TIME_NAMESPACE_END #undef RIM_TIME_NAMESPACE_END #endif #endif // INCLUDE_RIM_TIME_MODULE_H <file_sep>/* * rimGraphicsShaderParameterInfo.h * Rim Software * * Created by <NAME> on 1/30/14. * Copyright 2014 __MyCompanyName__. All rights reserved. * */ #ifndef INCLUDE_RIM_GRAPHICS_SHADER_PARAMETER_INFO_H #define INCLUDE_RIM_GRAPHICS_SHADER_PARAMETER_INFO_H #include "rimGraphicsShadersConfig.h" #include "rimGraphicsShaderParameterUsage.h" #include "rimGraphicsShaderParameterFlags.h" //########################################################################################## //*********************** Start Rim Graphics Shaders Namespace *************************** RIM_GRAPHICS_SHADERS_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class which specifies information about a shader parameter. /** * This information includes a semantic usage for the parameter, as well * as flags that specify boolean information about the parameter such as * its read/write access status. */ class ShaderParameterInfo { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructors /// Create a new shader parameter info object with ShaderParameterUsage::UNDEFINED usage and default flags. /** * The default shader parameter flags allow no read or write access. */ RIM_INLINE ShaderParameterInfo() : usage( ShaderParameterUsage::UNDEFINED ), flags(), name() { } /// Create a new shader parameter info object with ShaderParameterUsage::UNDEFINED usage and default flags. /** * The default shader parameter flags allow read and write access. */ RIM_INLINE ShaderParameterInfo( const String& newName ) : usage( ShaderParameterUsage::UNDEFINED ), flags( ShaderParameterFlags::READ_ACCESS | ShaderParameterFlags::WRITE_ACCESS ), name( newName ) { } /// Create a new shader parameter info object with the specified usage and default flags. /** * The default shader parameter flags allow read and write access. */ RIM_INLINE ShaderParameterInfo( const String& newName, const ShaderParameterUsage& newUsage ) : usage( newUsage ), flags( ShaderParameterFlags::READ_ACCESS | ShaderParameterFlags::WRITE_ACCESS ), name( newName ) { } /// Create a new shader parameter info object with the specified usage and flags. RIM_INLINE ShaderParameterInfo( const String& newName, const ShaderParameterUsage& newUsage, const ShaderParameterFlags& newFlags ) : usage( newUsage ), flags( newFlags ), name( newName ) { } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Name Accessor Methods /// Return the name of this shader parameter. RIM_INLINE const String& getName() const { return name; } /// Set the name of this shader parameter. RIM_INLINE void setName( const String& newName ) { name = newName; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Usage Accessor Methods /// Return an object describing the semantic usage of this shader parameter. RIM_INLINE const ShaderParameterUsage& getUsage() const { return usage; } /// Set an object describing the semantic usage of this shader parameter. RIM_INLINE void setUsage( const ShaderParameterUsage& newUsage ) { usage = newUsage; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Flags Accessor Methods /// Return an object describing boolean information about this shader parameter. RIM_INLINE const ShaderParameterFlags& getFlags() const { return flags; } /// Set an object describing boolean information about this shader parameter. RIM_INLINE void setFlags( const ShaderParameterFlags& newFlags ) { flags = newFlags; } private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Members /// An object describing the semantic usage of this shader parameter. ShaderParameterUsage usage; /// An object describing boolean information about this shader parameter. ShaderParameterFlags flags; /// A string representing the name of the shader parameter. String name; }; //########################################################################################## //*********************** End Rim Graphics Shaders Namespace ***************************** RIM_GRAPHICS_SHADERS_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_GRAPHICS_SHADER_PARAMETER_INFO_H <file_sep>/* * rimFunctionCallBase.h * Rim Framework * * Created by <NAME> on 6/7/09. * Copyright 2009 Rim Software. All rights reserved. * */ #ifndef INCLUDE_RIM_FUNCTION_CALL_BASE_H #define INCLUDE_RIM_FUNCTION_CALL_BASE_H #include "../rimLanguageConfig.h" #include "../rimFunction.h" //########################################################################################## //*********************** Start Rim Language Internal Namespace ************************** RIM_LANGUAGE_INTERNAL_NAMESPACE_START //****************************************************************************************** //########################################################################################## template < typename R, typename T1 = NullType, typename T2 = NullType, typename T3 = NullType, typename T4 = NullType, typename T5 = NullType, typename T6 = NullType, typename T7 = NullType, typename T8 = NullType, typename T9 = NullType, typename T10 = NullType > class FunctionCallBase { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Public Type Definitions typedef FunctionCallBase<R,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10> ThisType; typedef Function<R ( T1, T2, T3, T4, T5, T6, T7, T8, T9, T10 )> FunctionType; typedef R ReturnType; typedef T1 ParameterType1; typedef T2 ParameterType2; typedef T3 ParameterType3; typedef T4 ParameterType4; typedef T5 ParameterType5; typedef T6 ParameterType6; typedef T7 ParameterType7; typedef T8 ParameterType8; typedef T9 ParameterType9; typedef T10 ParameterType10; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Function Call Execute Method RIM_INLINE R operator () () { return function( arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10 ); } protected: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Protected Constructor RIM_INLINE FunctionCallBase( const FunctionType& f, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8, T9 a9, T10 a10 ) : function( f ), arg1( a1 ), arg2( a2 ), arg3( a3 ), arg4( a4 ), arg5( a5 ), arg6( a6 ), arg7( a7 ), arg8( a8 ), arg9( a9 ), arg10( a10 ) { } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Protected Data Members FunctionType function; T1 arg1; T2 arg2; T3 arg3; T4 arg4; T5 arg5; T6 arg6; T7 arg7; T8 arg8; T9 arg9; T10 arg10; }; template < typename R > struct FunctionCallBase< R, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType > { protected: typedef FunctionCallBase<R> ThisType; typedef Function<R ()> FunctionType; typedef R ReturnType; public: RIM_INLINE R execute() { return function(); } RIM_INLINE R operator () () { return function(); } RIM_INLINE FunctionCallBase( const FunctionType& f ) : function( f ) { } protected: FunctionType function; }; template < typename R, typename T1 > struct FunctionCallBase< R, T1, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType > { protected: typedef FunctionCallBase<R,T1> ThisType; typedef Function<R ( T1 )> FunctionType; typedef R ReturnType; typedef T1 ParameterType1; public: RIM_INLINE R execute() { return function( arg1 ); } RIM_INLINE R operator () () { return function( arg1 ); } RIM_INLINE FunctionCallBase( const FunctionType& f, T1 a1 ) : function( f ), arg1( a1 ) { } protected: FunctionType function; T1 arg1; }; template < typename R, typename T1, typename T2 > struct FunctionCallBase< R, T1, T2, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType > { public: typedef FunctionCallBase<R,T1,T2> ThisType; typedef Function<R ( T1, T2 )> FunctionType; typedef R ReturnType; typedef T1 ParameterType1; typedef T2 ParameterType2; public: RIM_INLINE R execute() { return function( arg1, arg2 ); } RIM_INLINE R operator () () { return function( arg1, arg2 ); } RIM_INLINE FunctionCallBase( const FunctionType& f, T1 a1, T2 a2 ) : function( f ), arg1( a1 ), arg2( a2 ) { } protected: FunctionType function; T1 arg1; T2 arg2; }; template < typename R, typename T1, typename T2, typename T3 > struct FunctionCallBase< R, T1, T2, T3, NullType, NullType, NullType, NullType, NullType, NullType, NullType > { public: typedef FunctionCallBase<R,T1,T2,T3> ThisType; typedef Function<R ( T1, T2, T3 )> FunctionType; typedef R ReturnType; typedef T1 ParameterType1; typedef T2 ParameterType2; typedef T3 ParameterType3; public: RIM_INLINE R execute() { return function( arg1, arg2, arg3 ); } RIM_INLINE R operator () () { return function( arg1, arg2, arg3 ); } RIM_INLINE FunctionCallBase( const FunctionType& f, T1 a1, T2 a2, T3 a3 ) : function( f ), arg1( a1 ), arg2( a2 ), arg3( a3 ) { } protected: FunctionType function; T1 arg1; T2 arg2; T3 arg3; }; template < typename R, typename T1, typename T2, typename T3, typename T4 > struct FunctionCallBase< R, T1, T2, T3, T4, NullType, NullType, NullType, NullType, NullType, NullType > { public: typedef FunctionCallBase<R,T1,T2,T3,T4> ThisType; typedef Function<R ( T1, T2, T3, T4 )> FunctionType; typedef R ReturnType; typedef T1 ParameterType1; typedef T2 ParameterType2; typedef T3 ParameterType3; typedef T4 ParameterType4; public: RIM_INLINE R execute() { return function( arg1, arg2, arg3, arg4 ); } RIM_INLINE R operator () () { return function( arg1, arg2, arg3, arg4 ); } RIM_INLINE FunctionCallBase( const FunctionType& f, T1 a1, T2 a2, T3 a3, T4 a4 ) : function( f ), arg1( a1 ), arg2( a2 ), arg3( a3 ), arg4( a4 ) { } protected: FunctionType function; T1 arg1; T2 arg2; T3 arg3; T4 arg4; }; template < typename R, typename T1, typename T2, typename T3, typename T4, typename T5 > struct FunctionCallBase< R, T1, T2, T3, T4, T5, NullType, NullType, NullType, NullType, NullType > { public: typedef FunctionCallBase<R,T1,T2,T3,T4,T5> ThisType; typedef Function<R ( T1, T2, T3, T4, T5 )> FunctionType; typedef R ReturnType; typedef T1 ParameterType1; typedef T2 ParameterType2; typedef T3 ParameterType3; typedef T4 ParameterType4; typedef T5 ParameterType5; public: RIM_INLINE R execute() { return function( arg1, arg2, arg3, arg4, arg5 ); } RIM_INLINE R operator () () { return function( arg1, arg2, arg3, arg4, arg5 ); } RIM_INLINE FunctionCallBase( const FunctionType& f, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5 ) : function( f ), arg1( a1 ), arg2( a2 ), arg3( a3 ), arg4( a4 ), arg5( a5 ) { } protected: FunctionType function; T1 arg1; T2 arg2; T3 arg3; T4 arg4; T5 arg5; }; template < typename R, typename T1, typename T2, typename T3, typename T4, typename T5, typename T6 > struct FunctionCallBase< R, T1, T2, T3, T4, T5, T6, NullType, NullType, NullType, NullType > { public: typedef FunctionCallBase<R,T1,T2,T3,T4,T5,T6> ThisType; typedef Function<R ( T1, T2, T3, T4, T5, T6 )> FunctionType; typedef R ReturnType; typedef T1 ParameterType1; typedef T2 ParameterType2; typedef T3 ParameterType3; typedef T4 ParameterType4; typedef T5 ParameterType5; typedef T6 ParameterType6; public: RIM_INLINE R execute() { return function( arg1, arg2, arg3, arg4, arg5, arg6 ); } RIM_INLINE R operator () () { return function( arg1, arg2, arg3, arg4, arg5, arg6 ); } RIM_INLINE FunctionCallBase( const FunctionType& f, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6 ) : function( f ), arg1( a1 ), arg2( a2 ), arg3( a3 ), arg4( a4 ), arg5( a5 ), arg6( a6 ) { } protected: FunctionType function; T1 arg1; T2 arg2; T3 arg3; T4 arg4; T5 arg5; T6 arg6; }; template < typename R, typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7 > struct FunctionCallBase< R, T1, T2, T3, T4, T5, T6, T7, NullType, NullType, NullType > { public: typedef FunctionCallBase<R,T1,T2,T3,T4,T5,T6,T7> ThisType; typedef Function<R ( T1, T2, T3, T4, T5, T6, T7 )> FunctionType; typedef R ReturnType; typedef T1 ParameterType1; typedef T2 ParameterType2; typedef T3 ParameterType3; typedef T4 ParameterType4; typedef T5 ParameterType5; typedef T6 ParameterType6; typedef T7 ParameterType7; public: RIM_INLINE R execute() { return function( arg1, arg2, arg3, arg4, arg5, arg6, arg7 ); } RIM_INLINE R operator () () { return function( arg1, arg2, arg3, arg4, arg5, arg6, arg7 ); } RIM_INLINE FunctionCallBase( const FunctionType& f, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7 ) : function( f ), arg1( a1 ), arg2( a2 ), arg3( a3 ), arg4( a4 ), arg5( a5 ), arg6( a6 ), arg7( a7 ) { } protected: FunctionType function; T1 arg1; T2 arg2; T3 arg3; T4 arg4; T5 arg5; T6 arg6; T7 arg7; }; template < typename R, typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8 > struct FunctionCallBase< R, T1, T2, T3, T4, T5, T6, T7, T8, NullType, NullType > { public: typedef FunctionCallBase<R,T1,T2,T3,T4,T5,T6,T7,T8> ThisType; typedef Function<R ( T1, T2, T3, T4, T5, T6, T7, T8 )> FunctionType; typedef R ReturnType; typedef T1 ParameterType1; typedef T2 ParameterType2; typedef T3 ParameterType3; typedef T4 ParameterType4; typedef T5 ParameterType5; typedef T6 ParameterType6; typedef T7 ParameterType7; typedef T8 ParameterType8; public: RIM_INLINE R execute() { return function( arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8 ); } RIM_INLINE R operator () () { return function( arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8 ); } RIM_INLINE FunctionCallBase( const FunctionType& f, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8 ) : function( f ), arg1( a1 ), arg2( a2 ), arg3( a3 ), arg4( a4 ), arg5( a5 ), arg6( a6 ), arg7( a7 ), arg8( a8 ) { } protected: FunctionType function; T1 arg1; T2 arg2; T3 arg3; T4 arg4; T5 arg5; T6 arg6; T7 arg7; T8 arg8; }; template < typename R, typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8, typename T9 > struct FunctionCallBase< R, T1, T2, T3, T4, T5, T6, T7, T8, T9, NullType > { public: typedef FunctionCallBase<R,T1,T2,T3,T4,T5,T6,T7,T8,T9> ThisType; typedef Function<R ( T1, T2, T3, T4, T5, T6, T7, T8, T9 )> FunctionType; typedef R ReturnType; typedef T1 ParameterType1; typedef T2 ParameterType2; typedef T3 ParameterType3; typedef T4 ParameterType4; typedef T5 ParameterType5; typedef T6 ParameterType6; typedef T7 ParameterType7; typedef T8 ParameterType8; public: RIM_INLINE R execute() { return function( arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9 ); } RIM_INLINE R operator () () { return function( arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9 ); } RIM_INLINE FunctionCallBase( const FunctionType& f, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8, T9 a9 ) : function( f ), arg1( a1 ), arg2( a2 ), arg3( a3 ), arg4( a4 ), arg5( a5 ), arg6( a6 ), arg7( a7 ), arg8( a8 ), arg9( a9 ) { } protected: FunctionType function; T1 arg1; T2 arg2; T3 arg3; T4 arg4; T5 arg5; T6 arg6; T7 arg7; T8 arg8; T9 arg9; }; //########################################################################################## //*********************** End Rim Language Internal Namespace **************************** RIM_LANGUAGE_INTERNAL_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_FUNCTION_CALL_BASE_H <file_sep>/* * rimSIMD.h * Rim Framework * * Created by <NAME> on 6/1/13. * Copyright 2013 __MyCompanyName__. All rights reserved. * */ #ifndef INCLUDE_RIM_SIMD_H #define INCLUDE_RIM_SIMD_H #include "rimMathConfig.h" #include "rimSIMDConfig.h" #include "rimSIMDTypes.h" #include "rimSIMDFlags.h" // SIMD Scalar/Vector Classes. #include "rimSIMDScalar.h" #include "rimSIMDScalarInt8_16.h" #include "rimSIMDScalarInt16_8.h" #include "rimSIMDScalarInt32_4.h" #include "rimSIMDScalarInt64_2.h" #include "rimSIMDScalarFloat32_4.h" #include "rimSIMDScalarFloat64_2.h" // SIMD Array Classes. #include "rimSIMDArray.h" #include "rimSIMDArrayInt32.h" #include "rimSIMDArrayFloat32.h" #include "rimSIMDArrayFloat64.h" // SIMD Math Primitive Types #include "rimSIMDVector3D.h" #include "rimSIMDRay3D.h" #include "rimSIMDAABB3D.h" #include "rimSIMDPlane3D.h" #include "rimSIMDTriangle3D.h" //########################################################################################## //***************************** Start Rim Math Namespace ********************************* RIM_MATH_NAMESPACE_START //****************************************************************************************** //########################################################################################## //########################################################################################## //########################################################################################## //############ //############ Typedefs //############ //########################################################################################## //########################################################################################## // SIMD Scalar Type Definitions for the given primitive type. typedef SIMDScalar<Float32,4> SIMDFloat4; typedef SIMDScalar<Float64,2> SIMDDouble2; typedef SIMDScalar<Int32,4> SIMDInt4; // SIMD Scalar Type Definitions for the default-width for the given primitive type. typedef SIMDScalar<Float32,SIMDType<Float32>::MAX_WIDTH> SIMDFloat; typedef SIMDScalar<Float64,SIMDType<Float64>::MAX_WIDTH> SIMDDouble; typedef SIMDScalar<Int32,SIMDType<Int32>::MAX_WIDTH> SIMDInt; //########################################################################################## //***************************** End Rim Math Namespace *********************************** RIM_MATH_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_SIMD_H <file_sep>/* * Roadmap.h * Quadcopter * * Created by <NAME> on 12/5/14. * Copyright 2014 __MyCompanyName__. All rights reserved. * */ #ifndef INCLUDE_ROADMAP_H #define INCLUDE_ROADMAP_H #include "rim/rimEngine.h" using namespace rim; using namespace rim::bvh; using namespace rim::graphics; class Roadmap { public: /// A node in a roadmap. class Node { public: Node( const Vector3f& newPosition ) : position( newPosition ), previous( 0 ) { } /// The 3D position of this node in space. Vector3f position; /// A list of the node indices of the neighbors to this node. ArrayList<Index> neighbors; /// In the A* algorithm, this value stores the index of the previous node in the path so it can be reconstructed. Index previous; }; Roadmap( const Pointer<GenericMeshShape>& mesh ); /// Return whether or not the specified start and end positions are visible to each other. Bool link( const Vector3f& start, const Vector3f& end ) const; /// Return whether or not the specified start and end positions are visible to each other. Bool link( const Vector3f& start, const Vector3f& end, Float radius, Size numSamples = 50 ) const; Bool traceRay( const Vector3f& start, const Vector3f& direction, Float maxDistance, Float& t ); void rebuild( const AABB3f& bounds, Size numSamples, const Vector3f& start, const Vector3f& goal ); /// Return the index of the node in the roadmap that is closest (and visible to) the specified point. Index getClosestNode( const Vector3f& position ) const; /// Return the number of nodes that are in this roadmap. inline Size getNodeCount() const { return nodes.getSize(); } /// Return a reference to the node at the given index in this roadmap. inline const Node& getNode( Index nodeIndex ) const { return nodes[nodeIndex]; } private: /// An object used as the interface to the BVH. class TriangleSet; ArrayList<Node> nodes; /// A pointer to a BVH used for ray tracing in the scene. Pointer<BVH> bvh; TraversalStack stack; mutable RandomVariable<Float> randomVariable; }; #endif // INCLUDE_ROADMAP_H <file_sep>/* * rimPhysicsShapesConfig.h * Rim Physics * * Created by <NAME> on 6/7/08. * Copyright 2008 Rim Software. All rights reserved. * */ #ifndef INCLUDE_RIM_PHYSICS_SHAPES_CONFIG_H #define INCLUDE_RIM_PHYSICS_SHAPES_CONFIG_H #include "../rimPhysicsConfig.h" #include "../rimPhysicsUtilities.h" //########################################################################################## //########################################################################################## //############ //############ Library Namespace Configuration //############ //########################################################################################## //########################################################################################## #ifndef RIM_PHYSICS_SHAPES_NAMESPACE_START #define RIM_PHYSICS_SHAPES_NAMESPACE_START RIM_PHYSICS_NAMESPACE_START namespace shapes { #endif #ifndef RIM_PHYSICS_SHAPES_NAMESPACE_END #define RIM_PHYSICS_SHAPES_NAMESPACE_END }; RIM_PHYSICS_NAMESPACE_END #endif //########################################################################################## //************************ Start Rim Physics Shapes Namespace **************************** RIM_PHYSICS_SHAPES_NAMESPACE_START //****************************************************************************************** //########################################################################################## using rim::physics::util::PhysicsVertex3; using rim::physics::util::PhysicsTriangle; using rim::physics::util::ConvexHull; using rim::bvh::AABBTree4; //########################################################################################## //************************ End Rim Physics Shapes Namespace ****************************** RIM_PHYSICS_SHAPES_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_PHYSICS_SHAPES_CONFIG_H <file_sep>/* * rimGraphicsVertexBufferList.h * Rim Graphics * * Created by <NAME> on 3/12/13. * Copyright 2013 __MyCompanyName__. All rights reserved. * */ #ifndef INCLUDE_RIM_GRAPHICS_VERTEX_BUFFER_LIST_H #define INCLUDE_RIM_GRAPHICS_VERTEX_BUFFER_LIST_H #include "rimGraphicsBuffersConfig.h" #include "rimGraphicsVertexUsage.h" #include "rimGraphicsVertexBuffer.h" //########################################################################################## //*********************** Start Rim Graphics Buffers Namespace *************************** RIM_GRAPHICS_BUFFERS_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class which encapsulates a set of vertex buffers associated with VertexUsage types. /** * This class allows the user to provide external vertex data to a ShaderPass * without having to modify the buffer bindings of the shader pass. This is useful when * a shader pass is shared among many objects that may each have different vertex * buffers. * * At render time, an object's vertex buffer list is used to provide vertex data * to the shader pass with which it is being rendered by connecting the VertexUsage * of each buffer with shader inputs of the same usage types. */ class VertexBufferList { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructors /// Create a new empty vertex buffer list. VertexBufferList(); /// Create an exact copy of the another vertex buffer list. VertexBufferList( const VertexBufferList& other ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Destructor /// Destroy a vertex buffer list and release all internal state. ~VertexBufferList(); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Assignment Operator /// Assign the contents of another vertex buffer list to this one. VertexBufferList& operator = ( const VertexBufferList& other ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Vertex Buffer Accessor Methods /// Return the number of vertex buffers in this vertex buffer list. RIM_INLINE Size getBufferCount() const { return buffers.getSize(); } /// Return a pointer to the buffer with the specified index in this buffer list. /** * If an invalid index is specified, a NULL pointer is returned. */ RIM_INLINE Pointer<VertexBuffer> getBuffer( Index bufferIndex ) const { if ( bufferIndex < buffers.getSize() ) return buffers[bufferIndex].buffer; else return Pointer<VertexBuffer>(); } /// Return an object indicating the usage of the buffer with the specified index in this buffer list. /** * If an invalid index is specified, a VertexUsage::UNDEFINED is returned. */ RIM_INLINE VertexUsage getBufferUsage( Index bufferIndex ) const { if ( bufferIndex < buffers.getSize() ) return buffers[bufferIndex].usage; else return VertexUsage::UNDEFINED; } /// Return a pointer to the vertex buffer with the specified usage in this vertex buffer list. Pointer<VertexBuffer> getBufferWithUsage( const VertexUsage& usage ) const; /// Return whether or not there is a vertex buffer with the specified usage in this vertex buffer list. Bool hasBufferWithUsage( const VertexUsage& usage ) const; /// Add a vertex buffer with the specified usage to this vertex buffer list. Bool addBuffer( const Pointer<VertexBuffer>& newBuffer, const VertexUsage& newUsage = VertexUsage::UNDEFINED ); /// Remove the first buffer with the specified address from this vertex buffer list. /** * The method returns whether or not the buffer was successfully removed. */ Bool removeBuffer( const VertexBuffer* buffer ); /// Remove the first buffer with the specified usage from this vertex buffer list. /** * The method returns whether or not the buffer was successfully removed. */ Bool removeBuffer( const VertexUsage& usage ); /// Clear all vertex buffers from this vertex buffer list. void clearBuffers(); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Size Accessor Methods /// Return the smallest capacity of the buffers within this vertex buffer list. /** * This value is computed by taking the minimum capacity of all buffers * that the buffer list has which have data. If there are no buffers * in the list, the method returns 0. */ Size getMinimumCapacity() const; private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Vertex Buffer Enry Class Definition /// A class which stores information about a single vertex buffer and its usage. class Entry { public: /// Create a new vertex buffer entry with the specified buffer and usage. RIM_INLINE Entry( const Pointer<VertexBuffer>& newBuffer, const VertexUsage& newUsage ) : usage( newUsage ), buffer( newBuffer ) { } /// A pointer to the vertex buffer which this entry represents. Pointer<VertexBuffer> buffer; /// An object representing the usage of this vertex buffer. VertexUsage usage; }; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Members /// A list of the attribute buffers that are part of this vertex buffer. ArrayList<Entry> buffers; }; //########################################################################################## //*********************** End Rim Graphics Buffers Namespace ***************************** RIM_GRAPHICS_BUFFERS_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_GRAPHICS_VERTEX_BUFFER_LIST_H <file_sep>/* * rimPhysicsCollisionShapeMesh.h * Rim Physics * * Created by <NAME> on 7/6/12. * Copyright 2012 __MyCompanyName__. All rights reserved. * */ #ifndef INCLUDE_RIM_PHYSICS_COLLISION_SHAPE_MESH_H #define INCLUDE_RIM_PHYSICS_COLLISION_SHAPE_MESH_H #include "rimPhysicsShapesConfig.h" #include "rimPhysicsCollisionShape.h" #include "rimPhysicsCollisionShapeBase.h" #include "rimPhysicsCollisionShapeInstance.h" //########################################################################################## //************************ Start Rim Physics Shapes Namespace **************************** RIM_PHYSICS_SHAPES_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class which represents an triangle-soup mesh collision shape. class CollisionShapeMesh : public CollisionShapeBase<CollisionShapeMesh> { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Public Type Declarations class Instance; /// Define the type of BVH acceleration structure to use for this mesh collision shape. typedef AABBTree4 BVHType; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructors /// Create a default empty mesh shape with no vertices or triangles. CollisionShapeMesh(); /// Create a mesh shape with the specified vertices, triangles, and materials. CollisionShapeMesh( const PhysicsVertex3* vertices, Size numVertices, const PhysicsTriangle* triangles, Size numTriangles, const CollisionShapeMaterial* materials, Size numMaterials ); /// Create a mesh shape with the specified vertices, triangles, and materials. CollisionShapeMesh( const ArrayList<PhysicsVertex3>& vertices, const ArrayList<PhysicsTriangle>& triangles, const ArrayList<CollisionShapeMaterial>& materials ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Vertex Accessor Methods /// Return the vertex at the specified index in this mesh shape. RIM_INLINE const PhysicsVertex3& getVertex( Index vertexIndex ) const { RIM_DEBUG_ASSERT_MESSAGE( vertexIndex < vertices.getSize(), "Cannot access vertex at invalid index in a mesh collision shape." ); return vertices[vertexIndex]; } /// Return the number of vertices that this mesh shape contains. RIM_INLINE Size getVertexCount() const { return vertices.getSize(); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Triangle Accessor Methods /// Return the triangle at the specified index in this mesh shape. RIM_INLINE const PhysicsTriangle& getTriangle( Index triangleIndex ) const { RIM_DEBUG_ASSERT_MESSAGE( triangleIndex < triangles.getSize(), "Cannot access triangle at invalid index in a mesh collision shape." ); return triangles[triangleIndex]; } /// Return the number of triangles that this mesh shape contains. RIM_INLINE Size getTriangleCount() const { return triangles.getSize(); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Material Accessor Methods /// Return the material at the specified index in this mesh shape. RIM_INLINE const CollisionShapeMaterial& getMaterial( Index materialIndex ) const { RIM_DEBUG_ASSERT_MESSAGE( materialIndex < materials.getSize(), "Cannot access material at invalid index in a mesh collision shape." ); return materials[materialIndex]; } /// Return the number of materials that this mesh shape contains. RIM_INLINE Size getMaterialCount() const { return materials.getSize(); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** BVH Accessor Methods /// Return a pointer to this mesh collision shape's bounding volume hierarchy. /** * If this mesh has no geometry or invalid geometry, NULL is returned indicating * that the mesh has no BVH. */ RIM_FORCE_INLINE const BVHType* getBVH() const { return bvh; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Mass Distribution Accessor Methods /// Return a 3x3 matrix for the inertia tensor of this mesh shape relative to its center of mass. /** * The returned inertia tensor for this mesh shape will always be a matrix * with infinite inertial values because the mesh has no mass. */ virtual Matrix3 getInertiaTensor() const; /// Return a 3D vector representing the center-of-mass of this mesh shape in its coordinate frame. /** * Since a mesh shape has no mass or center, the returned center of mass is the projection of * the origin onto the mesh. */ virtual Vector3 getCenterOfMass() const; /// Return the volume of this mesh shape in length units cubed (m^3). /** * This method always returns 0 because a mesh has no volume. */ virtual Real getVolume() const; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Instance Creation Methods /// Create and return an instance of this shape. virtual Pointer<CollisionShapeInstance> getInstance() const; private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Class Declaration /// A class which creates axis-aligned bounding boxes for PhysicsTriangle objects. class PhysicsTriangleAABBGenerator; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Helper Methods /// Update the bounding sphere and mass quantities of this mesh collision shape. void updateDependentQuantities(); /// Rebuild the BVH for this mesh shape. void rebuildBVH(); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Members /// A list of all of the triangles in this mesh collision shape. ArrayList<PhysicsTriangle> triangles; /// A list of all of the vertices in this mesh collision shape. ArrayList<PhysicsVertex3> vertices; /// A list of all of the collision materials in this mesh collision shape. ArrayList<CollisionShapeMaterial> materials; /// A bounding volume hierarchy for this mesh shape's trianges to accelerate collision detection. BVHType* bvh; }; //########################################################################################## //########################################################################################## //############ //############ Mesh Shape Instance Class Definition //############ //########################################################################################## //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class which is used to instance a CollisionShapeMesh object with an arbitrary rigid transformation. class CollisionShapeMesh:: Instance : public CollisionShapeInstance { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Transform Update Method /// Update this mesh instance with the specified 3D rigid transformation from shape to world space. /** * This method transforms this instance's mesh equation from shape space to world space. */ virtual void setTransform( const Transform3& newTransform ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Attribute Accessor Methods private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Constructors /// Create a new mesh shape instance which uses the specified base mesh shape. RIM_INLINE Instance( const CollisionShapeMesh* newMesh ) : CollisionShapeInstance( newMesh ) { } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Members /// The transformation from shape-space to world space for this mesh shape instance. Transform3 transformation; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Friend Declarations /// Declare the mesh collision shape as a friend so that it can construct instances. friend class CollisionShapeMesh; }; //########################################################################################## //************************ End Rim Physics Shapes Namespace ****************************** RIM_PHYSICS_SHAPES_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_PHYSICS_COLLISION_SHAPE_MESH_H <file_sep>/* * rimGraphicsBoundingCone.h * Rim Graphics * * Created by <NAME> on 12/23/10. * Copyright 2010 Rim Software. All rights reserved. * */ #ifndef INCLUDE_RIM_GRAPHICS_BOUNDING_CONE_H #define INCLUDE_RIM_GRAPHICS_BOUNDING_CONE_H #include "rimGraphicsUtilitiesConfig.h" //########################################################################################## //********************** Start Rim Graphics Utilities Namespace ************************** RIM_GRAPHICS_UTILITIES_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class which represents a bounding cone for a spot light's area of effect. class BoundingCone { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructors /// Create a BoundingCone object with the specified vertex, axis direction, half angle, and height. RIM_INLINE BoundingCone( const Vector3& newVertex, const Vector3& newAxis, Real newTheta, Real newHeight ) : vertex( newVertex ), axis( newAxis ), height( newHeight ), sinTheta( math::sin( newTheta ) ), cosTheta( math::cos( newTheta ) ), theta( newTheta ) { } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Vertex Accessor Methods /// Get the position of the vertex (tip) of the cone. RIM_INLINE const Vector3& getVertex() const { return vertex; } /// Set the position of the vertex (tip) of the cone. RIM_INLINE void setVertex( const Vector3& newVertex ) { vertex = newVertex; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Axis Accessor Methods /// Get the normalized direction of the cone's axis from the vertex to the base's center. RIM_INLINE const Vector3& getAxis() const { return axis; } /// Set the normalized direction of the cone's axis from the vertex to the base's center. RIM_INLINE void setAxis( const Vector3& newAxis ) { axis = newAxis; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Height Accessor Methods /// Get the extent of the cone from the base's center along the cone's axis. RIM_INLINE Real getHeight() const { return height; } /// Set the extent of the cone from the base's center along the cone's axis. RIM_INLINE void setHeight( Real newHeight ) { height = newHeight; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Half Angle Accessor Methods /// Get the angle in radians between the the cone's axis and the side of the cone. RIM_INLINE Real getHalfAngle() const { return theta; } /// Set the angle in radians between the the cone's axis and the side of the cone. RIM_INLINE void setHalfAngle( Real newHalfAngle ) { theta = newHalfAngle; sinTheta = math::sin(theta); cosTheta = math::cos(theta); } /// Get the sine of the angle in radians between the the cone's axis and the side of the cone. RIM_INLINE Real getSineHalfAngle() const { return sinTheta; } /// Get the cosine of the angle in radians between the the cone's axis and the side of the cone. RIM_INLINE Real getCosineHalfAngle() const { return cosTheta; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Intersection Test Methods /// Return whether or not this BoundingCone intersects the specified BoundingSphere. RIM_NO_INLINE Bool intersects( const BoundingSphere& sphere ) const { Real inverseSinTheta = Real(1)/sinTheta; Real cosThetaSquared = cosTheta*cosTheta; Vector3 vertexToSphereCenter = sphere.position - vertex; Vector3 d = vertexToSphereCenter + (sphere.radius*inverseSinTheta)*axis; Real dMagnitudeSquared = d.getMagnitudeSquared(); Real e = math::dot( d, axis ); if ( e > Real(0) && e*e >= dMagnitudeSquared*cosThetaSquared ) { Real sinThetaSquared = sinTheta*sinTheta; Real vertexToSpereCenterDistanceSquared = vertexToSphereCenter.getMagnitudeSquared(); Real f = -math::dot( vertexToSphereCenter, axis ); if ( f < -(height + sphere.radius) ) return false; if ( f > Real(0) && f*f >= vertexToSpereCenterDistanceSquared*sinThetaSquared ) { return vertexToSpereCenterDistanceSquared <= sphere.radius*sphere.radius; } else return true; } else return false; } private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Members /// The extent of the cone from the base's center along the cone's axis. Real height; /// The vertex of the cone Vector3 vertex; /// The normalized direction from the cone's vertex to the center of the cone's base. Vector3 axis; /// The sine of the half angle of the cone. Real sinTheta; /// The cosine of the half angle of the cone. Real cosTheta; /// The half angle of the cone. Real theta; }; //########################################################################################## //********************** End Rim Graphics Utilities Namespace **************************** RIM_GRAPHICS_UTILITIES_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_GRAPHICS_BOUNDING_CONE_H <file_sep>/* * rimGraphicsSphereShape.h * Rim Graphics * * Created by <NAME> on 5/17/12. * Copyright 2012 __MyCompanyName__. All rights reserved. * */ #ifndef INCLUDE_RIM_GRAPHICS_SPHERE_SHAPE_H #define INCLUDE_RIM_GRAPHICS_SPHERE_SHAPE_H #include "rimGraphicsShapesConfig.h" #include "rimGraphicsShapeBase.h" #include "rimGraphicsLODShape.h" //########################################################################################## //*********************** Start Rim Graphics Shapes Namespace **************************** RIM_GRAPHICS_SHAPES_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class which provides a simple means to draw a 3D sphere shape. /** * A sphere is specified by a position and radius. * * This class handles all vertex and index buffer generation automatically, * simplifying the visualization of spheres, such as for collision geometry. * Internally, this class automatically chooses the proper geometric level of * detail for the sphere representation in order to acheive nearly pixel-perfect * accuracy when rendering from any perspective. */ class SphereShape : public GraphicsShapeBase<SphereShape> { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructors /// Create a sphere shape for the given graphics context centered at the origin with a radius of 1. SphereShape( const Pointer<GraphicsContext>& context ); /// Create a sphere shape for the given graphics context centered at the origin with the specified radius. SphereShape( const Pointer<GraphicsContext>& context, Real radius ); /// Create a sphere shape for the given graphics context with the specified position and radius. SphereShape( const Pointer<GraphicsContext>& context, const Vector3& newPosition, Real radius ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Radius Accessor Methods /// Get the radius of this sphere shape in local coordinates. RIM_FORCE_INLINE Real getRadius() const { return radius; } /// Set the radius of this sphere shape in local coordinates. /** * The radius is clamed to the range of [0,+infinity). */ void setRadius( Real newRadius ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Material Accessor Methods /// Get the material of this sphere shape. RIM_INLINE Pointer<Material>& getMaterial() { return material; } /// Get the material of this sphere shape. RIM_INLINE const Pointer<Material>& getMaterial() const { return material; } /// Set the material of this sphere shape. RIM_INLINE void setMaterial( const Pointer<Material>& newMaterial ) { material = newMaterial; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Context Accessor Methods /// Return a pointer to the graphics contet which is being used to create this sphere shape. RIM_INLINE const Pointer<GraphicsContext>& getContext() const { return context; } /// Change the graphics context which is used to create this sphere shape. /** * Calling this method causes the previously generated sphere geometry to * be discarded and regenerated using the new context. */ void setContext( const Pointer<GraphicsContext>& newContext ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Level of Detail Accessor Methods /// Get the level of detail which should be used when the sphere has the specified screen-space radius. Pointer<GraphicsShape> getLevelForPixelRadius( Real pixelRadius ) const; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Level Of Detail Bias Accessor Methods /// Get a value which multiplicatively biases the size of a pixel radius query. RIM_INLINE Real getLODBias() const { return lodShape.getLODBias(); } /// Set a value which multiplicatively biases the size of a pixel radius query. RIM_INLINE void setLODBias( Real newLODBias ) { return lodShape.setLODBias( newLODBias ); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Bounding Volume Accessor Methods /// Update the sphere's axis-aligned bounding box. virtual void updateBoundingBox(); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Shape Chunk Accessor Method /// Process the shape into a flat list of mesh chunk objects. /** * This method flattens the shape hierarchy and produces mesh chunks * for rendering from the specified camera's perspective. The method * converts its internal representation into one or more MeshChunk * objects which it appends to the specified output list of mesh chunks. * * The method returns whether or not the shape was successfully flattened * into chunks. */ virtual Bool getChunks( const Transform3& worldTransform, const Camera& camera, const ViewVolume* viewVolume, const Vector2D<Size>& viewportSize, ArrayList<MeshChunk>& chunks ) const; private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Helper Methods /// Generate a sphere mesh instance with the specified subdivision level. /** * The first subdivision level is an octahedron, and each addition subdivision * level doubles the number of longitude and latitude division on the sphere, * effectivly quadrupling the triangle count for each additional subdivision. */ static Pointer<GraphicsShape> getSubdivision( const Pointer<GraphicsContext>& context, const Pointer<Material>& material, Size subdivisionLevel ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Static Data Members /// The maximum allowed sphere subdivision. static const Size MAXIMUM_SUBDIVISION_LEVEL = 7; /// The predetermined pixel radii for the different subdivision levels. static const Real subdivisionPixelRadii[MAXIMUM_SUBDIVISION_LEVEL + 2]; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Members /// The graphics context which is used to create this sphere shape. Pointer<GraphicsContext> context; /// The sphere shape's material. Pointer<Material> material; /// An LODShape object that holds the levels of detail for this sphere. mutable LODShape lodShape; /// The largest amount that this sphere has been subdivided. mutable Size largestSubdivision; /// The radius of this sphere in shape-coordinates. Real radius; }; //########################################################################################## //*********************** End Rim Graphics Shapes Namespace ****************************** RIM_GRAPHICS_SHAPES_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_GRAPHICS_SPHERE_SHAPE_H <file_sep>/* * Quadcopter.h * Quadcopter * * Created by <NAME> on 10/23/14. * Co-author: <NAME> * Copyright 2014 __MyCompanyName__. All rights reserved. * */ #ifndef INCLUDE_QUADCOPTER_H #define INCLUDE_QUADCOPTER_H #include "rim/rimEngine.h" //#include "rim/rimGraphicsGUI.h" #include "TransformState.h" #include "Global_planner.h" #include "Roadmap.h" using namespace rim; using namespace rim::graphics; //using namespace rim::graphics::gui; //using namespace rim::engine; class Quadcopter { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructor Quadcopter(); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Functions /// Update the graphical representation + camera with the new simulated position. void updateGraphics(); /// Compute the linear and angular accelerations of this quadcopter given the specified state and timestep. /** * The accelerations due to environmental forces (i.e. gravity, drag) are passed in the * acceleration parameters. The function writes the final accelerations of the quadcopter's * center of mass to those parameters. */ void computeAcceleration( const TransformState& state, Float timeStep, Vector3f& linearAcceleration, Vector3f& angularAcceleration ) const; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Motor Class Declaration /// A class that stores information related to a single motor on a quadcopter. class Motor { public: /// Create a new motor with the specified center-of-mass offset vector and unit-length thrust direction. RIM_INLINE Motor( const Vector3f& newCOMOffset, const Vector3f& newThrustDirection ) : comOffset( newCOMOffset ), thrustDirection( newThrustDirection.normalize() ), thrust( 0 ), thrustRange( 0, MAX_MOTOR_THRUST ) { } /// Return the force vector for this motor. RIM_INLINE Vector3f getForce() const { return thrustDirection*thrust; } /// The vector from this quadcopter's center of mass to the motor position in body space. Vector3f comOffset; /// The unit-length direction of this motor's thrust. Vector3f thrustDirection; /// The current thrust of the motor in newtons. Float thrust; /// The range of valid thrust of the motor in newtons. AABB1f thrustRange; }; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Static Data Members static const float MAX_SPEED; static const float MAX_ACCELERATION; static const float MAX_TILT_ANGLE; /// The maximum allowed angular velocity, in radians per second. static const float MAX_ROLL_RATE; /// The maximum allowed tolerance in radians in the rotation from the preferred rotation. static const float MAX_ANGLE_ERROR; /// The maximum thrust that the quadcopter can produce from all motors combined. static const float MAX_THRUST; /// The minimum thrust that the quadcopter can produce from all motors combined. static const float MIN_THRUST; /// The maximum change in thrust per second for a quadcopter motor. static const float MAX_DELTA_THRUST; /// The maximum thrust that the quadcopter can produce from a single motor. static const float MAX_MOTOR_THRUST; /// The maximum torque magnitude that the quadcopter should have, to limit spin. static const float MAX_ANGULAR_ACCELERATION; static const Vector3f VEHICLE_DELTA_THRUST; static const float VEHICLE_CLOSE_RANGE; static const float VEHICLE_CLOSE_RANGE_SCALE_FACTOR; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Data Members /// The current state of the quadcopter. TransformState currentState; /// A list of the motors that are part of the quadcopter. ArrayList<Motor> motors; Pointer<Roadmap> roadmap; vertices path; mutable int nextid; /// The previous thrust vector in the world coordinate frame. Vector3f lastThrust; /// The current target waypoint for the quadcopter in world space. mutable Vector3f nextWaypoint; /// The goal position for the quadcopter in world space. Vector3f goalpoint; mutable Matrix3f prefRot; /// The mass of the quadcopter in kg. Float mass; /// The body-space inertia tensor of the quadcopter. Matrix3f inertia; /// The current inverse world-space interia tensor. Matrix3f inverseWorldInertia; /// The time step used to determine the next acceleration. Float planningTimestep; /// A camera that looks in the forward direction. Pointer<PerspectiveCamera> frontCamera; /// A camera that looks downwards. Pointer<PerspectiveCamera> downCamera; /// The graphical representation of the quadcopter. Pointer<GraphicsObject> graphics; /// A history of the previous points along this quadcopter's path. ArrayList<Vector3f> tracer; private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Functions /// Compute the path based on goal position and transform state vertices getpath(const TransformState& state, const Vector3f& goalPosition, Pointer<Roadmap> rmap) const; /// Compute the ideal thrust vector based on the given goal position, transform stsate, and external acceleration. Vector3f computePreferredThrust( const TransformState& state, const Vector3f& goalPosition, const Vector3f& externalAcceleration ) const; /// Compute and return the ideal net angular acceleration that will acheive the target orientation. Vector3f computePreferredAngularAcceleration( const TransformState& state, const Vector3f& goalPosition, const Vector3f& preferredThrust ) const; /// Compute and return the preferred rotation matrix. Matrix3f computePreferredRotation( const TransformState& state, const Vector3f& look, const Vector3f& preferredThrust ) const; static void solveForMotorThrusts( const TransformState& state, const ArrayList<Motor>& motors, const Vector3f& preferredForce, const Vector3f& preferredTorque, Array<Float>& thrusts ); /// Optimize for the best set of motor thrusts for the specified preferred force and torque. static void optimizeThrusts( const ArrayList<Motor>& motors, Array<Float>& thrusts, const Vector3f& localForce, const Vector3f& localTorque ); /// Use a hill-climbing algorithm to find the best thrusts given starting thrusts. /** * The final best cost is returned. */ static Float hillClimbThrusts( const ArrayList<Motor>& motors, Array<Float>& thrusts, const Vector3f& localForce, const Vector3f& localTorque ); /// Constrain the thrust values for the motors to be within the valid range for the motors. static void constrainThrusts( const ArrayList<Motor>& motors, Array<Float>& thrusts ); /// Compute the cost for a new set of thrust values for the given quadcopter state and preferred accelerations. static Float getCost( const ArrayList<Motor>& motors, const Array<Float>& thrusts, const Vector3f& localForce, const Vector3f& localTorque ); /// Compute and return an orthonormal rotation matrix from the given up and look vectors. static Matrix3f rotationFromUpLook( const Vector3f& up, const Vector3f& look ) { // Generate an orthonormal rotation matrix based on that up vector and the desired look direction. Vector3f right = math::cross( up, -look ).normalize(); Vector3f back = math::cross( right, up ).normalize(); return Matrix3f( right, up, back ).orthonormalize(); } /// Apply a force vector at the given radial arm in world space, adding to the linear and angular acceleration. static void applyForce( const Vector3f& r, const Vector3f& forceVector, Vector3f& force, Vector3f& torque ) { force += forceVector; torque += math::cross( r, forceVector ); } }; #endif // INCLUDE_QUADCOPTER_H <file_sep>/* * Project: Rim Framework * * File: rim/math/SIMDScalarInt32_4.h * * Version: 1.0.0 * * Contents: rim::math::SIMDScalar class specialization for an 4x32-bit integer SIMD data type. * * License: * * Copyright (C) 2010-12 <NAME>. * All rights reserved. * * * Contact Information: * * Please send all bug reports and other contact to: * <NAME> * <EMAIL> * */ #ifndef INCLUDE_RIM_SIMD_SCALAR_INT_32_4_H #define INCLUDE_RIM_SIMD_SCALAR_INT_32_4_H #include "rimMathConfig.h" #include "rimSIMDScalar.h" //########################################################################################## //***************************** Start Rim Math Namespace ********************************* RIM_MATH_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class representing a 4-component 32-bit signed-integer SIMD scalar. /** * This specialization of the SIMDScalar class uses a 128-bit value to encode * 4 32-bit signed-integer values. All basic arithmetic operations are supported, * plus a subset of standard scalar operations: abs(), min(), max(), sqrt(). */ template <> class RIM_ALIGN(16) SIMDScalar<Int32,4> { private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Type Declarations /// Define the type for a 4x float scalar structure. #if RIM_USE_SIMD && defined(RIM_SIMD_ALTIVEC) typedef RIM_ALTIVEC_VECTOR int SIMDInt32; #elif RIM_USE_SIMD && defined(RIM_SIMD_SSE) #if RIM_SSE_VERSION_IS_SUPPORTED(1,0) typedef __m128 SIMDInt32Float; #endif #if RIM_SSE_VERSION_IS_SUPPORTED(2,0) typedef __m128i SIMDInt32; #endif #endif //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Constructor #if RIM_USE_SIMD && (defined(RIM_SIMD_ALTIVEC) || defined(RIM_SIMD_SSE) && RIM_SSE_VERSION_IS_SUPPORTED(2,0)) /// Create a new 4D vector with the specified 4D SIMD vector value. RIM_FORCE_INLINE SIMDScalar( SIMDInt32 simdScalar ) : v( simdScalar ) { } #endif #if RIM_USE_SIMD && defined(RIM_SIMD_SSE) && RIM_SSE_VERSION_IS_SUPPORTED(1,0) /// Create a new 4D vector with the specified 4D SIMD vector value. RIM_FORCE_INLINE SIMDScalar( SIMDInt32Float simdScalar ) : vFloat( simdScalar ) { } #endif public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructors /// Create a new 4D SIMD scalar with all elements left uninitialized. RIM_FORCE_INLINE SIMDScalar() { } /// Create a new 4D SIMD scalar with all elements equal to the specified value. RIM_FORCE_INLINE SIMDScalar( Int32 value ) { #if RIM_USE_SIMD && defined(RIM_SIMD_ALTIVEC) v = (SIMDInt32)(value); #elif RIM_USE_SIMD && defined(RIM_SIMD_SSE) && RIM_SSE_VERSION_IS_SUPPORTED(2,0) v = _mm_set1_epi32( value ); #else a = b = c = d = value; #endif } /// Create a new 4D SIMD scalar with the elements equal to the specified 4 values. RIM_FORCE_INLINE SIMDScalar( Int32 newA, Int32 newB, Int32 newC, Int32 newD ) { #if RIM_USE_SIMD && defined(RIM_SIMD_ALTIVEC) v = (SIMDInt32)( newA, newB, newC, newD ); #elif RIM_USE_SIMD && defined(RIM_SIMD_SSE) && RIM_SSE_VERSION_IS_SUPPORTED(2,0) // The parameters are reversed to keep things consistent with loading from an address. v = _mm_set_epi32( newD, newC, newB, newA ); #else a = newA; b = newB; c = newC; d = newD; #endif } /// Create a new 4D SIMD scalar from the first 4 values stored at specified pointer's location. RIM_FORCE_INLINE SIMDScalar( const Int32* array ) { #if RIM_USE_SIMD && defined(RIM_SIMD_ALTIVEC) a = array[0]; b = array[1]; c = array[2]; d = array[3]; #elif RIM_USE_SIMD && defined(RIM_SIMD_SSE) && RIM_SSE_VERSION_IS_SUPPORTED(2,0) v = _mm_load_si128( (const SIMDInt32*)array ); #else a = array[0]; b = array[1]; c = array[2]; d = array[3]; #endif } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Copy Constructor /// Create a new SIMD scalar with the same contents as another. /** * This shouldn't have to be overloaded, but for some reason the compiler (GCC) * optimizes SIMD code better with it overloaded. Before, the compiler would * store the result of a SIMD operation on the stack before transfering it to * the destination, resulting in an extra 8+ load/stores per computation. */ RIM_FORCE_INLINE SIMDScalar( const SIMDScalar& other ) { #if RIM_USE_SIMD && defined(RIM_SIMD_ALTIVEC) v = other.v; #elif RIM_USE_SIMD && defined(RIM_SIMD_SSE) && RIM_SSE_VERSION_IS_SUPPORTED(2,0) v = other.v; #elif RIM_USE_SIMD && defined(RIM_SIMD_SSE) && RIM_SSE_VERSION_IS_SUPPORTED(1,0) vFloat = other.vFloat; #else a = other.a; b = other.b; c = other.c; d = other.d; #endif } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Assignment Operator /// Assign the contents of one SIMDScalar object to another. /** * This shouldn't have to be overloaded, but for some reason the compiler (GCC) * optimizes SIMD code better with it overloaded. Before, the compiler would * store the result of a SIMD operation on the stack before transfering it to * the destination, resulting in an extra 8+ load/stores per computation. */ RIM_FORCE_INLINE SIMDScalar& operator = ( const SIMDScalar& other ) { #if RIM_USE_SIMD && defined(RIM_SIMD_ALTIVEC) v = other.v; #elif RIM_USE_SIMD && defined(RIM_SIMD_SSE) && RIM_SSE_VERSION_IS_SUPPORTED(2,0) v = other.v; #elif RIM_USE_SIMD && defined(RIM_SIMD_SSE) && RIM_SSE_VERSION_IS_SUPPORTED(1,0) vFloat = other.vFloat; #else a = other.a; b = other.b; c = other.c; d = other.d; #endif return *this; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Load Methods RIM_FORCE_INLINE static SIMDScalar load( const Int32* array ) { #if RIM_USE_SIMD && defined(RIM_SIMD_ALTIVEC) return SIMDScalar( array[0], array[1], array[2], array[3] ); #elif RIM_USE_SIMD && defined(RIM_SIMD_SSE) && RIM_SSE_VERSION_IS_SUPPORTED(1,0) return SIMDScalar( _mm_load_si128( (const SIMDInt32*)array ) ); #else return SIMDScalar( array[0], array[1], array[2], array[3] ); #endif } RIM_FORCE_INLINE static SIMDScalar loadUnaligned( const Int32* array ) { #if RIM_USE_SIMD && defined(RIM_SIMD_ALTIVEC) return SIMDScalar( array[0], array[1], array[2], array[3] ); #elif RIM_USE_SIMD && defined(RIM_SIMD_SSE) && RIM_SSE_VERSION_IS_SUPPORTED(1,0) return SIMDScalar( _mm_loadu_si128( (const SIMDInt32*)array ) ); #else return SIMDScalar( array[0], array[1], array[2], array[3] ); #endif } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Store Method RIM_FORCE_INLINE void store( Int32* destination ) const { #if RIM_USE_SIMD && defined(RIM_SIMD_ALTIVEC) destination[0] = a; destination[1] = b; destination[2] = c; destination[3] = d; #elif RIM_USE_SIMD && defined(RIM_SIMD_SSE) && RIM_SSE_VERSION_IS_SUPPORTED(2,0) _mm_store_si128( (SIMDInt32*)destination, v ); #else destination[0] = a; destination[1] = b; destination[2] = c; destination[3] = d; #endif } RIM_FORCE_INLINE void storeUnaligned( Int32* destination ) const { #if RIM_USE_SIMD && defined(RIM_SIMD_ALTIVEC) destination[0] = a; destination[1] = b; destination[2] = c; destination[3] = d; #elif RIM_USE_SIMD && defined(RIM_SIMD_SSE) && RIM_SSE_VERSION_IS_SUPPORTED(1,0) _mm_storeu_si128( (SIMDInt32*)destination, v ); #else destination[0] = a; destination[1] = b; destination[2] = c; destination[3] = d; #endif } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Accessor Methods /// Get a reference to the value stored at the specified component index in this scalar. RIM_FORCE_INLINE Int32& operator [] ( Index i ) { return x[i]; } /// Get the value stored at the specified component index in this scalar. RIM_FORCE_INLINE Int32 operator [] ( Index i ) const { return x[i]; } /// Get a pointer to the first element in this scalar. /** * The remaining values are in the next 3 locations after the * first element. */ RIM_FORCE_INLINE const Int32* toArray() const { return x; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Mask Operator /// Return a mask which indicates if each of the components are true. RIM_FORCE_INLINE Int getMask() const { #if RIM_USE_SIMD && defined(RIM_SIMD_ALTIVEC) return ((a & 0x80000000) << 3) | ((b & 0x80000000) << 2) | ((c & 0x80000000) << 1) | ((d & 0x80000000)); #elif RIM_USE_SIMD && defined(RIM_SIMD_SSE) && RIM_SSE_VERSION_IS_SUPPORTED(1,0) return _mm_movemask_ps( vFloat ); #else return ((a & 0x80000000) << 3) | ((b & 0x80000000) << 2) | ((c & 0x80000000) << 1) | ((d & 0x80000000)); #endif } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Logical Operators /// Return the bitwise NOT of this 4D SIMD vector. RIM_FORCE_INLINE SIMDScalar operator ~ () const { #if RIM_USE_SIMD && defined(RIM_SIMD_ALTIVEC) return SIMDScalar( vec_nor( v, v ) ); #elif RIM_USE_SIMD && defined(RIM_SIMD_SSE) && RIM_SSE_VERSION_IS_SUPPORTED(2,0) return SIMDScalar( _mm_xor_si128( v, _mm_set1_epi32( 0xFFFFFFFF ) ) ); #else return SIMDScalar( ~a, ~b, ~c, ~d ); #endif } /// Compute the bitwise AND of this 4D SIMD vector with another and return the result. RIM_FORCE_INLINE SIMDScalar operator & ( const SIMDScalar& vector ) const { #if RIM_USE_SIMD && defined(RIM_SIMD_ALTIVEC) return SIMDScalar( vec_and( v, vector.v ) ); #elif RIM_USE_SIMD && defined(RIM_SIMD_SSE) && RIM_SSE_VERSION_IS_SUPPORTED(2,0) return SIMDScalar( _mm_and_si128( v, vector.v ) ); #else return SIMDScalar( a & vector.a, b & vector.b, c & vector.c, d & vector.d ); #endif } /// Compute the bitwise OR of this 4D SIMD vector with another and return the result. RIM_FORCE_INLINE SIMDScalar operator | ( const SIMDScalar& vector ) const { #if RIM_USE_SIMD && defined(RIM_SIMD_ALTIVEC) return SIMDScalar( vec_or( v, vector.v ) ); #elif RIM_USE_SIMD && defined(RIM_SIMD_SSE) && RIM_SSE_VERSION_IS_SUPPORTED(2,0) return SIMDScalar( _mm_or_si128( v, vector.v ) ); #else return SIMDScalar( a | vector.a, b | vector.b, c | vector.c, d | vector.d ); #endif } /// Compute the bitwise XOR of this 4D SIMD vector with another and return the result. RIM_FORCE_INLINE SIMDScalar operator ^ ( const SIMDScalar& vector ) const { #if RIM_USE_SIMD && defined(RIM_SIMD_ALTIVEC) return SIMDScalar( vec_xor( v, vector.v ) ); #elif RIM_USE_SIMD && defined(RIM_SIMD_SSE) && RIM_SSE_VERSION_IS_SUPPORTED(2,0) return SIMDScalar( _mm_xor_si128( v, vector.v ) ); #else return SIMDScalar( a ^ vector.a, b ^ vector.b, c ^ vector.c, d ^ vector.d ); #endif } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Logical Assignment Operators /// Compute the logical AND of this 4D SIMD vector with another and assign it to this vector. RIM_FORCE_INLINE SIMDScalar& operator &= ( const SIMDScalar& vector ) { #if RIM_USE_SIMD && defined(RIM_SIMD_ALTIVEC) v = vec_and( v, vector.v ); #elif RIM_USE_SIMD && defined(RIM_SIMD_SSE) && RIM_SSE_VERSION_IS_SUPPORTED(2,0) v = _mm_and_si128( v, vector.v ); #else a &= vector.a; b &= vector.b; c &= vector.c; d &= vector.d; #endif return *this; } /// Compute the logical OR of this 4D SIMD vector with another and assign it to this vector. RIM_FORCE_INLINE SIMDScalar& operator |= ( const SIMDScalar& vector ) { #if RIM_USE_SIMD && defined(RIM_SIMD_ALTIVEC) v = vec_or( v, vector.v ); #elif RIM_USE_SIMD && defined(RIM_SIMD_SSE) && RIM_SSE_VERSION_IS_SUPPORTED(2,0) v = _mm_or_si128( v, vector.v ); #else a |= vector.a; b |= vector.b; c |= vector.c; d |= vector.d; #endif return *this; } /// Compute the bitwise XOR of this 4D SIMD vector with another and assign it to this vector. RIM_FORCE_INLINE SIMDScalar& operator ^= ( const SIMDScalar& vector ) { #if RIM_USE_SIMD && defined(RIM_SIMD_ALTIVEC) v = vec_xor( v, vector.v ); #elif RIM_USE_SIMD && defined(RIM_SIMD_SSE) && RIM_SSE_VERSION_IS_SUPPORTED(2,0) v = _mm_xor_si128( v, vector.v ); #else a ^= vector.a; b ^= vector.b; c ^= vector.c; d ^= vector.d; #endif return *this; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Comparison Operators /// Compare two 4D SIMD scalars component-wise for equality. /** * Return a 4D scalar of booleans indicating the result of the comparison. * If each corresponding pair of components is equal, the corresponding result * component is non-zero. Otherwise, that result component is equal to zero. */ RIM_FORCE_INLINE SIMDScalar operator == ( const SIMDScalar& scalar ) const { #if RIM_USE_SIMD && defined(RIM_SIMD_ALTIVEC) return SIMDScalar( vec_cmpeq( v, scalar.v ) ); #elif RIM_USE_SIMD && defined(RIM_SIMD_SSE) && RIM_SSE_VERSION_IS_SUPPORTED(2,0) return SIMDScalar( _mm_cmpeq_epi32( v, scalar.v ) ); #else return SIMDScalar( a == scalar.a, b == scalar.b, c == scalar.c, d == scalar.d ); #endif } /// Compare this scalar to a single floating point value for equality. /** * Return a 4D scalar of booleans indicating the result of the comparison. * The float value is expanded to a 4-wide SIMD scalar and compared with this scalar. * If each corresponding pair of components is equal, the corresponding result * component is non-zero. Otherwise, that result component is equal to zero. */ RIM_FORCE_INLINE SIMDScalar operator == ( const Int32 value ) const { #if RIM_USE_SIMD && defined(RIM_SIMD_ALTIVEC) return SIMDScalar( vec_cmpeq( v, (SIMDInt32)(value) ) ); #elif RIM_USE_SIMD && defined(RIM_SIMD_SSE) && RIM_SSE_VERSION_IS_SUPPORTED(2,0) return SIMDScalar( _mm_cmpeq_epi32( v, _mm_set1_epi32(value) ) ); #else return SIMDScalar( a == value, b == value, c == value, d == value ); #endif } /// Compare two 4D SIMD scalars component-wise for inequality /** * Return a 4D scalar of booleans indicating the result of the comparison. * If each corresponding pair of components is not equal, the corresponding result * component is non-zero. Otherwise, that result component is equal to zero. */ RIM_FORCE_INLINE SIMDScalar operator != ( const SIMDScalar& scalar ) const { #if RIM_USE_SIMD && defined(RIM_SIMD_ALTIVEC) const SIMDInt32 temp = vec_cmpeq( v, scalar.v ); return SIMDScalar( vec_nor( temp, temp ) ); #elif RIM_USE_SIMD && defined(RIM_SIMD_SSE) && RIM_SSE_VERSION_IS_SUPPORTED(2,0) return SIMDScalar( _mm_xor_si128( _mm_cmpeq_epi32( v, scalar.v ), _mm_set1_epi32(0xFFFFFFFF) ) ); #else return SIMDScalar( a != scalar.a, b != scalar.b, c != scalar.c, d != scalar.d ); #endif } /// Compare this scalar to a single floating point value for inequality. /** * Return a 4D scalar of booleans indicating the result of the comparison. * The float value is expanded to a 4-wide SIMD scalar and compared with this scalar. * If each corresponding pair of components is not equal, the corresponding result * component is non-zero. Otherwise, that result component is equal to zero. */ RIM_FORCE_INLINE SIMDScalar operator != ( const Int32 value ) const { #if RIM_USE_SIMD && defined(RIM_SIMD_ALTIVEC) const SIMDInt32 temp = vec_cmpeq( v, (SIMDInt32)(value) ); return SIMDScalar( vec_nor( temp, temp ) ); #elif RIM_USE_SIMD && defined(RIM_SIMD_SSE) && RIM_SSE_VERSION_IS_SUPPORTED(2,0) return SIMDScalar( _mm_xor_si128( _mm_cmpeq_epi32( v, _mm_set1_epi32(value) ), _mm_set1_epi32(0xFFFFFFFF) ) ); #else return SIMDScalar( a != value, b != value, c != value, d != value ); #endif } /// Perform a component-wise less-than comparison between this an another 4D SIMD scalar. /** * Return a 4D scalar of booleans indicating the result of the comparison. * If each corresponding pair of components has this scalar's component less than * the other scalar's component, the corresponding result component is non-zero. * Otherwise, that result component is equal to zero. */ RIM_FORCE_INLINE SIMDScalar operator < ( const SIMDScalar& scalar ) const { #if RIM_USE_SIMD && defined(RIM_SIMD_ALTIVEC) return SIMDScalar( vec_cmplt( v, scalar.v ) ); #elif RIM_USE_SIMD && defined(RIM_SIMD_SSE) && RIM_SSE_VERSION_IS_SUPPORTED(2,0) return SIMDScalar( _mm_cmplt_epi32( v, scalar.v ) ); #else return SIMDScalar( a < scalar.a, b < scalar.b, c < scalar.c, d < scalar.d ); #endif } /// Perform a component-wise less-than comparison between this 4D SIMD scalar and an expanded scalar. /** * Return a 4D scalar of booleans indicating the result of the comparison. * The float value is expanded to a 4-wide SIMD scalar and compared with this scalar. * If each corresponding pair of components has this scalar's component less than * the other scalar's component, the corresponding result component is non-zero. * Otherwise, that result component is equal to zero. */ RIM_FORCE_INLINE SIMDScalar operator < ( const Int32 value ) const { #if RIM_USE_SIMD && defined(RIM_SIMD_ALTIVEC) return SIMDScalar( vec_cmplt( v, (SIMDInt32)(value) ) ); #elif RIM_USE_SIMD && defined(RIM_SIMD_SSE) && RIM_SSE_VERSION_IS_SUPPORTED(2,0) return SIMDScalar( _mm_cmplt_epi32( v, _mm_set1_epi32(value) ) ); #else return SIMDScalar( a < value, b < value, c < value, d < value ); #endif } /// Perform a component-wise greater-than comparison between this an another 4D SIMD scalar. /** * Return a 4D scalar of booleans indicating the result of the comparison. * If each corresponding pair of components has this scalar's component greater than * the other scalar's component, the corresponding result component is non-zero. * Otherwise, that result component is equal to zero. */ RIM_FORCE_INLINE SIMDScalar operator > ( const SIMDScalar& scalar ) const { #if RIM_USE_SIMD && defined(RIM_SIMD_ALTIVEC) return SIMDScalar( vec_cmpgt( v, scalar.v ) ); #elif RIM_USE_SIMD && defined(RIM_SIMD_SSE) && RIM_SSE_VERSION_IS_SUPPORTED(2,0) return SIMDScalar( _mm_cmpgt_epi32( v, scalar.v ) ); #else return SIMDScalar( a > scalar.a, b > scalar.b, c > scalar.c, d > scalar.d ); #endif } /// Perform a component-wise greater-than comparison between this 4D SIMD scalar and an expanded scalar. /** * Return a 4D scalar of booleans indicating the result of the comparison. * The float value is expanded to a 4-wide SIMD scalar and compared with this scalar. * If each corresponding pair of components has this scalar's component greater than * the other scalar's component, the corresponding result component is non-zero. * Otherwise, that result component is equal to zero. */ RIM_FORCE_INLINE SIMDScalar operator > ( const Int32 value ) const { #if RIM_USE_SIMD && defined(RIM_SIMD_ALTIVEC) return SIMDScalar( vec_cmpgt( v, (SIMDInt32)(value) ) ); #elif RIM_USE_SIMD && defined(RIM_SIMD_SSE) && RIM_SSE_VERSION_IS_SUPPORTED(2,0) return SIMDScalar( _mm_cmpgt_epi32( v, _mm_set1_epi32(value) ) ); #else return SIMDScalar( a > value, b > value, c > value, d > value ); #endif } /// Perform a component-wise less-than-or-equal-to comparison between this an another 4D SIMD scalar. /** * Return a 4D scalar of booleans indicating the result of the comparison. * If each corresponding pair of components has this scalar's component less than * or equal to the other scalar's component, the corresponding result component is non-zero. * Otherwise, that result component is equal to zero. */ RIM_FORCE_INLINE SIMDScalar operator <= ( const SIMDScalar& scalar ) const { #if RIM_USE_SIMD && defined(RIM_SIMD_ALTIVEC) return SIMDScalar( vec_cmple( v, scalar.v ) ); #elif RIM_USE_SIMD && defined(RIM_SIMD_SSE) && RIM_SSE_VERSION_IS_SUPPORTED(2,0) return SIMDScalar( _mm_or_si128( _mm_cmplt_epi32( v, scalar.v ), _mm_cmpeq_epi32( v, scalar.v ) ) ); #else return SIMDScalar( a <= scalar.a, b <= scalar.b, c <= scalar.c, d <= scalar.d ); #endif } /// Perform a component-wise less-than-or-equal-to comparison between this 4D SIMD scalar and an expanded scalar. /** * Return a 4D scalar of booleans indicating the result of the comparison. * The float value is expanded to a 4-wide SIMD scalar and compared with this scalar. * If each corresponding pair of components has this scalar's component less than * or equal to the other scalar's component, the corresponding result component is non-zero. * Otherwise, that result component is equal to zero. */ RIM_FORCE_INLINE SIMDScalar operator <= ( const Int32 value ) const { #if RIM_USE_SIMD && defined(RIM_SIMD_ALTIVEC) return SIMDScalar( vec_cmple( v, (SIMDInt32)(value) ) ); #elif RIM_USE_SIMD && defined(RIM_SIMD_SSE) && RIM_SSE_VERSION_IS_SUPPORTED(2,0) SIMDInt32 scalar = _mm_set1_epi32(value); return SIMDScalar( _mm_or_si128( _mm_cmplt_epi32( v, scalar ), _mm_cmpeq_epi32( v, scalar ) ) ); #else return SIMDScalar( a <= value, b <= value, c <= value, d <= value ); #endif } /// Perform a component-wise greater-than-or-equal-to comparison between this an another 4D SIMD scalar. /** * Return a 4D scalar of booleans indicating the result of the comparison. * If each corresponding pair of components has this scalar's component greater than * or equal to the other scalar's component, the corresponding result component is non-zero. * Otherwise, that result component is equal to zero. */ RIM_FORCE_INLINE SIMDScalar operator >= ( const SIMDScalar& scalar ) const { #if RIM_USE_SIMD && defined(RIM_SIMD_ALTIVEC) return SIMDScalar( vec_cmpge( v, scalar.v ) ); #elif RIM_USE_SIMD && defined(RIM_SIMD_SSE) && RIM_SSE_VERSION_IS_SUPPORTED(2,0) return SIMDScalar( _mm_or_si128( _mm_cmpgt_epi32( v, scalar.v ), _mm_cmpeq_epi32( v, scalar.v ) ) ); #else return SIMDScalar( a >= scalar.a, b >= scalar.b, c >= scalar.c, d >= scalar.d ); #endif } /// Perform a component-wise greater-than-or-equal-to comparison between this 4D SIMD scalar and an expanded scalar. /** * Return a 4D scalar of booleans indicating the result of the comparison. * The float value is expanded to a 4-wide SIMD scalar and compared with this scalar. * If each corresponding pair of components has this scalar's component greater than * or equal to the other scalar's component, the corresponding result component is non-zero. * Otherwise, that result component is equal to zero. */ RIM_FORCE_INLINE SIMDScalar operator >= ( const Int32 value ) const { #if RIM_USE_SIMD && defined(RIM_SIMD_ALTIVEC) return SIMDScalar( vec_cmpge( v, (SIMDInt32)(value) ) ); #elif RIM_USE_SIMD && defined(RIM_SIMD_SSE) && RIM_SSE_VERSION_IS_SUPPORTED(2,0) SIMDInt32 scalar = _mm_set1_epi32(value); return SIMDScalar( _mm_or_si128( _mm_cmpgt_epi32( v, scalar ), _mm_cmpeq_epi32( v, scalar ) ) ); #else return SIMDScalar( a >= value, b >= value, c >= value, d >= value ); #endif } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Shifting Operators /// Shift each component of the SIMD scalar to the left by the specified amount of bits. /** * This method shifts the contents of each component to the left by the specified * amount of bits and inserts zeros. * * @param bitShift - the number of bits to shift this SIMD scalar by. * @return the shifted SIMD scalar. */ RIM_FORCE_INLINE SIMDScalar operator << ( Int32 bitShift ) const { #if RIM_USE_SIMD && defined(RIM_SIMD_ALTIVEC) return SIMDScalar( vec_sl( v, (SIMDInt32)(bitShift) ) ); #elif RIM_USE_SIMD && defined(RIM_SIMD_SSE) && RIM_SSE_VERSION_IS_SUPPORTED(2,0) return SIMDScalar( _mm_slli_epi32( v, bitShift ) ); #else return SIMDScalar( a << bitShift, b << bitShift, c << bitShift, d << bitShift ); #endif } /// Shift each component of the SIMD scalar to the right by the specified amount of bits. /** * This method shifts the contents of each component to the right by the specified * amount of bits and sign extends the original values.. * * @param bitShift - the number of bits to shift this SIMD scalar by. * @return the shifted SIMD scalar. */ RIM_FORCE_INLINE SIMDScalar operator >> ( Int32 bitShift ) const { #if RIM_USE_SIMD && defined(RIM_SIMD_ALTIVEC) return SIMDScalar( vec_sra( v, (SIMDInt32)(bitShift) ) ); #elif RIM_USE_SIMD && defined(RIM_SIMD_SSE) && RIM_SSE_VERSION_IS_SUPPORTED(2,0) return SIMDScalar( _mm_srai_epi32( v, bitShift ) ); #else return SIMDScalar( a >> bitShift, b >> bitShift, c >> bitShift, d >> bitShift ); #endif } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Negation/Positivation Operators /// Negate a scalar. /** * This method negates every component of this 4D SIMD scalar * and returns the result, leaving this scalar unmodified. * * @return the negation of the original scalar. */ RIM_FORCE_INLINE SIMDScalar operator - () const { #if RIM_USE_SIMD && defined(RIM_SIMD_ALTIVEC) return SIMDScalar( vec_sub( (SIMDInt32)(0), v ) ); #elif RIM_USE_SIMD && defined(RIM_SIMD_SSE) && RIM_SSE_VERSION_IS_SUPPORTED(2,0) return SIMDScalar( _mm_sub_epi32( _mm_set1_epi32(0), v ) ); #else return SIMDScalar( -a, -b, -c, -d ); #endif } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Arithmetic Operators /// Add this scalar to another and return the result. /** * This method adds another scalar to this one, component-wise, * and returns this addition. It does not modify either of the original * scalars. * * @param scalar - The scalar to add to this one. * @return The addition of this scalar and the parameter. */ RIM_FORCE_INLINE SIMDScalar operator + ( const SIMDScalar& scalar ) const { #if RIM_USE_SIMD && defined(RIM_SIMD_ALTIVEC) return SIMDScalar( vec_add( v, scalar.v ) ); #elif RIM_USE_SIMD && defined(RIM_SIMD_SSE) && RIM_SSE_VERSION_IS_SUPPORTED(2,0) return SIMDScalar( _mm_add_epi32( v, scalar.v ) ); #else return SIMDScalar( a + scalar.a, b + scalar.b, c + scalar.c, d + scalar.d ); #endif } /// Add a value to every component of this scalar. /** * This method adds the value parameter to every component * of the scalar, and returns a scalar representing this result. * It does not modifiy the original scalar. * * @param value - The value to add to all components of this scalar. * @return The resulting scalar of this addition. */ RIM_FORCE_INLINE SIMDScalar operator + ( const Int32 value ) const { #if RIM_USE_SIMD && defined(RIM_SIMD_ALTIVEC) return SIMDScalar( vec_add( v, (SIMDInt32)(value) ) ); #elif RIM_USE_SIMD && defined(RIM_SIMD_SSE) && RIM_SSE_VERSION_IS_SUPPORTED(2,0) return SIMDScalar( _mm_add_epi32( v, _mm_set1_epi32(value) ) ); #else return SIMDScalar( a + value, b + value, c + value, d + value ); #endif } /// Subtract a scalar from this scalar component-wise and return the result. /** * This method subtracts another scalar from this one, component-wise, * and returns this subtraction. It does not modify either of the original * scalars. * * @param scalar - The scalar to subtract from this one. * @return The subtraction of the the parameter from this scalar. */ RIM_FORCE_INLINE SIMDScalar operator - ( const SIMDScalar& scalar ) const { #if RIM_USE_SIMD && defined(RIM_SIMD_ALTIVEC) return SIMDScalar( vec_sub( v, scalar.v ) ); #elif RIM_USE_SIMD && defined(RIM_SIMD_SSE) && RIM_SSE_VERSION_IS_SUPPORTED(2,0) return SIMDScalar( _mm_sub_epi32( v, scalar.v ) ); #else return SIMDScalar( a - scalar.a, b - scalar.b, c - scalar.c, d - scalar.d ); #endif } /// Subtract a value from every component of this scalar. /** * This method subtracts the value parameter from every component * of the scalar, and returns a scalar representing this result. * It does not modifiy the original scalar. * * @param value - The value to subtract from all components of this scalar. * @return The resulting scalar of this subtraction. */ RIM_FORCE_INLINE SIMDScalar operator - ( const Int32 value ) const { #if RIM_USE_SIMD && defined(RIM_SIMD_ALTIVEC) return SIMDScalar( vec_sub( v, (SIMDInt32)(value) ) ); #elif RIM_USE_SIMD && defined(RIM_SIMD_SSE) && RIM_SSE_VERSION_IS_SUPPORTED(2,0) return SIMDScalar( _mm_sub_epi32( v, _mm_set1_epi32(value) ) ); #else return SIMDScalar( a - value, b - value, c - value, d - value ); #endif } /// Multiply component-wise this scalar and another scalar. /** * This operator multiplies each component of this scalar * by the corresponding component of the other scalar and * returns a scalar representing this result. It does not modify * either original scalar. * * @param scalar - The scalar to multiply this scalar by. * @return The result of the multiplication. */ RIM_FORCE_INLINE SIMDScalar operator * ( const SIMDScalar& scalar ) const { return SIMDScalar( a*scalar.a, b*scalar.b, c*scalar.c, d*scalar.d ); } /// Multiply every component of this scalar by a value and return the result. /** * This method multiplies the value parameter with every component * of the scalar, and returns a scalar representing this result. * It does not modifiy the original scalar. * * @param value - The value to multiplly with all components of this scalar. * @return The resulting scalar of this multiplication. */ RIM_FORCE_INLINE SIMDScalar operator * ( const Int32 value ) const { return SIMDScalar( a*value, b*value, c*value, d*value ); } /// Divide this scalar by another scalar component-wise. /** * This operator divides each component of this scalar * by the corresponding component of the other scalar and * returns a scalar representing this result. It does not modify * either original scalar. * * @param scalar - The scalar to multiply this scalar by. * @return The result of the division. */ RIM_FORCE_INLINE SIMDScalar operator / ( const SIMDScalar& scalar ) const { return SIMDScalar( a/scalar.a, b/scalar.b, c/scalar.c, d/scalar.d ); } /// Divide every component of this scalar by a value and return the result. /** * This method Divides every component of the scalar by the value parameter, * and returns a scalar representing this result. * It does not modifiy the original scalar. * * @param value - The value to divide all components of this scalar by. * @return The resulting scalar of this division. */ RIM_FORCE_INLINE SIMDScalar operator / ( const Int32 value ) const { return SIMDScalar( a/value, b/value, c/value, d/value ); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Arithmetic Assignment Operators /// Add a scalar to this scalar, modifying this original scalar. /** * This method adds another scalar to this scalar, component-wise, * and sets this scalar to have the result of this addition. * * @param scalar - The scalar to add to this scalar. * @return A reference to this modified scalar. */ RIM_FORCE_INLINE SIMDScalar& operator += ( const SIMDScalar& scalar ) { #if RIM_USE_SIMD && defined(RIM_SIMD_ALTIVEC) v = vec_add( v, scalar.v ); #elif RIM_USE_SIMD && defined(RIM_SIMD_SSE) && RIM_SSE_VERSION_IS_SUPPORTED(2,0) v = _mm_add_epi32( v, scalar.v ); #else a += scalar.a; b += scalar.b; c += scalar.c; d += scalar.d; #endif return *this; } /// Subtract a scalar from this scalar, modifying this original scalar. /** * This method subtracts another scalar from this scalar, component-wise, * and sets this scalar to have the result of this subtraction. * * @param scalar - The scalar to subtract from this scalar. * @return A reference to this modified scalar. */ RIM_FORCE_INLINE SIMDScalar& operator -= ( const SIMDScalar& scalar ) { #if RIM_USE_SIMD && defined(RIM_SIMD_ALTIVEC) v = vec_sub( v, scalar.v ); #elif RIM_USE_SIMD && defined(RIM_SIMD_SSE) && RIM_SSE_VERSION_IS_SUPPORTED(2,0) v = _mm_sub_epi32( v, scalar.v ); #else a -= scalar.a; b -= scalar.b; c -= scalar.c; d -= scalar.d; #endif return *this; } /// Multiply component-wise this scalar and another scalar and modify this scalar. /** * This operator multiplies each component of this scalar * by the corresponding component of the other scalar and * modifies this scalar to contain the result. * * @param scalar - The scalar to multiply this scalar by. * @return A reference to this modified scalar. */ RIM_FORCE_INLINE SIMDScalar& operator *= ( const SIMDScalar& scalar ) { #if RIM_USE_SIMD && defined(RIM_SIMD_ALTIVEC) a *= scalar.a; b *= scalar.b; c *= scalar.c; d *= scalar.d; #elif RIM_USE_SIMD && defined(RIM_SIMD_SSE) a *= scalar.a; b *= scalar.b; c *= scalar.c; d *= scalar.d; #else a *= scalar.a; b *= scalar.b; c *= scalar.c; d *= scalar.d; #endif return *this; } /// Divide this scalar by another scalar component-wise and modify this scalar. /** * This operator divides each component of this scalar * by the corresponding component of the other scalar and * modifies this scalar to contain the result. * * @param scalar - The scalar to divide this scalar by. * @return A reference to this modified scalar. */ RIM_FORCE_INLINE SIMDScalar& operator /= ( const SIMDScalar& scalar ) { #if RIM_USE_SIMD && defined(RIM_SIMD_ALTIVEC) a /= scalar.a; b /= scalar.b; c /= scalar.c; d /= scalar.d; #elif RIM_USE_SIMD && defined(RIM_SIMD_SSE) a /= scalar.a; b /= scalar.b; c /= scalar.c; d /= scalar.d; #else a /= scalar.a; b /= scalar.b; c /= scalar.c; d /= scalar.d; #endif return *this; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Required Alignment Accessor Methods /// Return the alignment required for objects of this type. /** * For most SIMD types this value will be 16 bytes. If there is * no alignment required, 0 is returned. */ RIM_FORCE_INLINE static Size getRequiredAlignment() { #if RIM_USE_SIMD && (defined(RIM_SIMD_ALTIVEC) || defined(RIM_SIMD_SSE) && RIM_SSE_VERSION_IS_SUPPORTED(1,0)) return 16; #else return 0; #endif } /// Get the width of this scalar (number of components it has). RIM_FORCE_INLINE static Size getWidth() { return 4; } /// Return whether or not this SIMD type is supported by the current CPU. RIM_FORCE_INLINE static Bool isSupported() { SIMDFlags flags = SIMDFlags::get(); return (flags & SIMDFlags::SSE_2) != 0 || (flags & SIMDFlags::ALTIVEC) != 0; } private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Members RIM_ALIGN(16) union { #if RIM_USE_SIMD && (defined(RIM_SIMD_ALTIVEC) || defined(RIM_SIMD_SSE) && RIM_SSE_VERSION_IS_SUPPORTED(2,0)) /// The 4D SIMD vector used internally. SIMDInt32 v; #endif #if RIM_USE_SIMD && defined(RIM_SIMD_SSE) && RIM_SSE_VERSION_IS_SUPPORTED(1,0) /// A floating-point alias of the integer SIMD scalar. SIMDInt32Float vFloat; #endif struct { /// The A component of a 4D SIMD scalar. Int32 a; /// The B component of a 4D SIMD scalar. Int32 b; /// The C component of a 4D SIMD scalar. Int32 c; /// The D component of a 4D SIMD scalar. Int32 d; }; /// The components of a 4D SIMD scalar in array format. Int32 x[4]; }; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Friend Declarations template < typename T, Size width > friend class SIMDVector3D; /// Declare the floating point version of this class as a friend. friend class SIMDScalar<Float32,4>; friend RIM_FORCE_INLINE SIMDScalar abs( const SIMDScalar& scalar ); friend RIM_FORCE_INLINE SIMDScalar sqrt( const SIMDScalar& scalar ); friend RIM_FORCE_INLINE SIMDScalar min( const SIMDScalar& scalar1, const SIMDScalar& scalar2 ); friend RIM_FORCE_INLINE SIMDScalar max( const SIMDScalar& scalar1, const SIMDScalar& scalar2 ); template < UInt i1, UInt i2, UInt i3, UInt i4 > friend RIM_FORCE_INLINE SIMDScalar shuffle( const SIMDScalar& scalar1 ); template < UInt i1, UInt i2, UInt i3, UInt i4 > friend RIM_FORCE_INLINE SIMDScalar shuffle( const SIMDScalar& scalar1, const SIMDScalar& scalar2 ); friend RIM_FORCE_INLINE SIMDScalar select( const SIMDScalar& selector, const SIMDScalar& scalar1, const SIMDScalar& scalar2 ); friend RIM_FORCE_INLINE SIMDScalar<Float32,4> select( const SIMDScalar& selector, const SIMDScalar<Float32,4>& scalar1, const SIMDScalar<Float32,4>& scalar2 ); friend RIM_FORCE_INLINE SIMDScalar lows( const SIMDScalar& scalar ); friend RIM_FORCE_INLINE SIMDScalar highs( const SIMDScalar& scalar ); }; //########################################################################################## //########################################################################################## //############ //############ Associative SIMD Scalar Operators //############ //########################################################################################## //########################################################################################## /// Add a scalar value to each component of this scalar and return the resulting scalar. RIM_FORCE_INLINE SIMDScalar<Int32,4> operator + ( const Int32 value, const SIMDScalar<Int32,4>& scalar ) { return SIMDScalar<Int32,4>(value) + scalar; } /// Subtract a scalar value from each component of this scalar and return the resulting scalar. RIM_FORCE_INLINE SIMDScalar<Int32,4> operator - ( const Int32 value, const SIMDScalar<Int32,4>& scalar ) { return SIMDScalar<Int32,4>(value) - scalar; } /// Multiply a scalar value by each component of this scalar and return the resulting scalar. RIM_FORCE_INLINE SIMDScalar<Int32,4> operator * ( const Int32 value, const SIMDScalar<Int32,4>& scalar ) { return SIMDScalar<Int32,4>(value) * scalar; } /// Divide each component of this scalar by a scalar value and return the resulting scalar. RIM_FORCE_INLINE SIMDScalar<Int32,4> operator / ( const Int32 value, const SIMDScalar<Int32,4>& scalar ) { return SIMDScalar<Int32,4>(value) / scalar; } //########################################################################################## //########################################################################################## //############ //############ Free Vector Functions //############ //########################################################################################## //########################################################################################## /// Compute the absolute value of each component of the specified SIMD scalar and return the result. RIM_FORCE_INLINE SIMDScalar<Int32,4> abs( const SIMDScalar<Int32,4>& scalar ) { #if RIM_USE_SIMD && defined(RIM_SIMD_ALTIVEC) return SIMDScalar<Int32,4>( vec_abs( scalar.v ) ); #elif RIM_USE_SIMD && defined(RIM_SIMD_SSE) return SIMDScalar<Int32,4>( math::abs(scalar.a), math::abs(scalar.b), math::abs(scalar.c), math::abs(scalar.d) ); #else return SIMDScalar<Int32,4>( math::abs(scalar.a), math::abs(scalar.b), math::abs(scalar.c), math::abs(scalar.d) ); #endif } /// Compute the minimum of each component of the specified SIMD scalars and return the result. RIM_FORCE_INLINE SIMDScalar<Int32,4> min( const SIMDScalar<Int32,4>& scalar1, const SIMDScalar<Int32,4>& scalar2 ) { #if RIM_USE_SIMD && defined(RIM_SIMD_ALTIVEC) return SIMDScalar<Int32,4>( vec_min( scalar1.v, scalar2.v ) ); #elif RIM_USE_SIMD && defined(RIM_SIMD_SSE) return SIMDScalar<Int32,4>( math::min(scalar1.a, scalar2.a), math::min(scalar1.b, scalar2.b), math::min(scalar1.c, scalar2.c), math::min(scalar1.d, scalar2.d) ); #else return SIMDScalar<Int32,4>( math::min(scalar1.a, scalar2.a), math::min(scalar1.b, scalar2.b), math::min(scalar1.c, scalar2.c), math::min(scalar1.d, scalar2.d) ); #endif } /// Compute the maximum of each component of the specified SIMD scalars and return the result. RIM_FORCE_INLINE SIMDScalar<Int32,4> max( const SIMDScalar<Int32,4>& scalar1, const SIMDScalar<Int32,4>& scalar2 ) { #if RIM_USE_SIMD && defined(RIM_SIMD_ALTIVEC) return SIMDScalar<Int32,4>( vec_max( scalar1.v, scalar2.v ) ); #elif RIM_USE_SIMD && defined(RIM_SIMD_SSE) return SIMDScalar<Int32,4>( math::max(scalar1.a, scalar2.a), math::max(scalar1.b, scalar2.b), math::max(scalar1.c, scalar2.c), math::max(scalar1.d, scalar2.d) ); #else return SIMDScalar<Int32,4>( math::max(scalar1.a, scalar2.a), math::max(scalar1.b, scalar2.b), math::max(scalar1.c, scalar2.c), math::max(scalar1.d, scalar2.d) ); #endif } /// Pick 4 elements from the specified SIMD scalar and return the result. template < UInt i1, UInt i2, UInt i3, UInt i4 > RIM_FORCE_INLINE SIMDScalar<Int32,4> shuffle( const SIMDScalar<Int32,4>& scalar ) { #if RIM_USE_SIMD && defined(RIM_SIMD_ALTIVEC) return SIMDScalar<Int32,4>( scalar[i1], scalar[i2], scalar[i3], scalar[i4] ); #elif RIM_USE_SIMD && defined(RIM_SIMD_SSE) && RIM_SSE_VERSION_IS_SUPPORTED(1,0) return SIMDScalar<Int32,4>( _mm_shuffle_ps( scalar.vFloat, scalar.vFloat, _MM_SHUFFLE(i4, i3, i2, i1) ) ); #else return SIMDScalar<Int32,4>( scalar[i1], scalar[i2], scalar[i3], scalar[i4] ); #endif } /// Pick two elements from each SIMD scalar and return the result. template < UInt i1, UInt i2, UInt i3, UInt i4 > RIM_FORCE_INLINE SIMDScalar<Int32,4> shuffle( const SIMDScalar<Int32,4>& scalar1, const SIMDScalar<Int32,4>& scalar2 ) { #if RIM_USE_SIMD && defined(RIM_SIMD_ALTIVEC) return SIMDScalar<Int32,4>( scalar1[i1], scalar1[i2], scalar2[i3], scalar2[i4] ); #elif RIM_USE_SIMD && defined(RIM_SIMD_SSE) && RIM_SSE_VERSION_IS_SUPPORTED(1,0) return SIMDScalar<Int32,4>( _mm_shuffle_ps( scalar1.vFloat, scalar2.vFloat, _MM_SHUFFLE(i4, i3, i2, i1) ) ); #else return SIMDScalar<Int32,4>( scalar1[i1], scalar1[i2], scalar2[i3], scalar2[i4] ); #endif } /// Select elements from the first SIMD scalar if the selector is TRUE, otherwise from the second. RIM_FORCE_INLINE SIMDScalar<Int32,4> select( const SIMDScalar<Int32,4>& selector, const SIMDScalar<Int32,4>& scalar1, const SIMDScalar<Int32,4>& scalar2 ) { #if RIM_USE_SIMD && defined(RIM_SIMD_ALTIVEC) return SIMDScalar<Int32,4>( vec_sel( scalar2.v, scalar1.v, selector.v ) ); #elif RIM_USE_SIMD && defined(RIM_SIMD_SSE) && RIM_SSE_VERSION_IS_SUPPORTED(1,0) // (((b^a) & selector) ^ a) return SIMDScalar<Int32,4>( _mm_xor_ps( scalar2.vFloat, _mm_and_ps( selector.vFloat, _mm_xor_ps( scalar1.vFloat, scalar2.vFloat ) ) ) ); #else return SIMDScalar<Int32,4>( selector.a ? scalar1.a : scalar2.a, selector.b ? scalar1.b : scalar2.b, selector.c ? scalar1.c : scalar2.c, selector.d ? scalar1.d : scalar2.d ); #endif } /// Copy the first and third element of the specified SIMD scalar into the second and fourth places. RIM_FORCE_INLINE SIMDScalar<Int32,4> lows( const SIMDScalar<Int32,4>& scalar ) { #if RIM_USE_SIMD && defined(RIM_SIMD_ALTIVEC) return SIMDScalar<Int32,4>( scalar.a, scalar.a, scalar.c, scalar.c ); #elif RIM_USE_SIMD && defined(RIM_SIMD_SSE) && RIM_SSE_VERSION_IS_SUPPORTED(3,0) return SIMDScalar<Int32,4>( _mm_moveldup_ps( scalar.vFloat ) ); #else return SIMDScalar<Int32,4>( scalar.a, scalar.a, scalar.c, scalar.c ); #endif } /// Copy the second and fourth element of the specified SIMD scalar into the first and third places. RIM_FORCE_INLINE SIMDScalar<Int32,4> highs( const SIMDScalar<Int32,4>& scalar ) { #if RIM_USE_SIMD && defined(RIM_SIMD_ALTIVEC) return SIMDScalar<Int32,4>( scalar.b, scalar.b, scalar.d, scalar.d ); #elif RIM_USE_SIMD && defined(RIM_SIMD_SSE) && RIM_SSE_VERSION_IS_SUPPORTED(3,0) return SIMDScalar<Int32,4>( _mm_movehdup_ps( scalar.vFloat ) ); #else return SIMDScalar<Int32,4>( scalar.b, scalar.b, scalar.d, scalar.d ); #endif } //########################################################################################## //***************************** End Rim Math Namespace *********************************** RIM_MATH_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_SIMD_SCALAR_INT_32_4_H <file_sep>/* * rimGraphicsForwardRenderer.h * Rim Graphics * * Created by <NAME> on 5/16/12. * Copyright 2012 __MyCompanyName__. All rights reserved. * */ #ifndef INCLUDE_RIM_GRAPHICS_FORWARD_RENDERER_H #define INCLUDE_RIM_GRAPHICS_FORWARD_RENDERER_H #include "rimGraphicsRenderersConfig.h" #include "rimGraphicsSceneRenderer.h" #include "rimGraphicsShadowMapRenderer.h" #include "rimGraphicsImmediateRenderer.h" //########################################################################################## //********************** Start Rim Graphics Renderers Namespace ************************** RIM_GRAPHICS_RENDERERS_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class that uses forward rendering techniques to draw a graphics scene. class ForwardRenderer : public SceneRenderer { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructors /// Create a forward renderer for the specified context with no viewport layout to render. ForwardRenderer( const Pointer<GraphicsContext>& newContext ); /// Create a forward renderer which renderers the specified viewport layout. ForwardRenderer( const Pointer<GraphicsContext>& newContext, const Pointer<ViewportLayout>& newViewportLayout ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Render Method /// Render all of the cameras in this renderer's scene to the current framebuffer. virtual void render(); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Graphics Context Accessor Methods /// Return a pointer to the graphics context that is currently being used to render with. RIM_INLINE const Pointer<GraphicsContext>& getContext() const { return context; } /// Set a pointer to the graphics context that should be used to render with. RIM_INLINE void setContext( const Pointer<GraphicsContext>& newContext ) { context = newContext; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Viewport Layout Accessor Methods /// Return a pointer to the viewport layout that is currently being rendered. virtual Pointer<ViewportLayout> getViewportLayout() const; /// Set a pointer to the viewport layout that should be rendered. virtual void setViewportLayout( const Pointer<ViewportLayout>& newViewportLayout ); private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Class Declaration class MeshChunkDepth { public: RIM_INLINE MeshChunkDepth( const MeshChunk* newChunk, const MaterialTechnique* newTechnique, Real newDepth ) : chunk( newChunk ), technique( newTechnique ), depth( newDepth ) { } RIM_INLINE Bool operator < ( const MeshChunkDepth& other ) const { return depth > other.depth; } /// A pointer to the chunk that has this depth. const MeshChunk* chunk; /// A pointer to the material technique used to render this chunk. const MaterialTechnique* technique; /// The distance away from the camera along the view direction of this chunk. Real depth; }; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Helper Methods RIM_FORCE_INLINE void drawMeshChunk( const MeshChunk& chunk, const MaterialTechnique& technique, const Pointer<LightCuller>& lightCuller, const Pointer<Camera>& camera ); /// Fill this object's global attribute set with data needed for the specified shader pass. void fillGlobalAttributeSet( const ShaderPass& shaderPass, const MeshChunk& chunk, const VertexBufferList* vertexBuffers, const Pointer<Camera>& camera ); void drawDebug( const ViewportLayout::CameraView& cameraView ); static void drawDebugObjects( ImmediateRenderer& immediate, const GraphicsObject& object ); static void drawDebugShapes( ImmediateRenderer& immediate, const GraphicsObject& object ); static void drawDebugBoundingBoxes( ImmediateRenderer& immediate, const GraphicsObject& object ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Members /// A pointer to the graphics context which this renderer is rendering to. Pointer<GraphicsContext> context; /// The set of current global shader binding data. ShaderBindingData globalBindingData; /// A temporary buffer of visible lights in the scene. LightBuffer visibleLights; /// A temporary list of mesh chunks in the scene. ArrayList<MeshChunk> meshChunks; /// A temporary list of transparent mesh chunks indices in the scene. ArrayList<MeshChunkDepth> transparentChunks; /// An object which handles rendering shadow maps for this renderer. ShadowMapRenderer shadowMapRenderer; /// An object that handles rendering debug info. ImmediateRenderer immediateRenderer; /// A pointer to the viewport layout that is currently being rendered. Pointer<ViewportLayout> viewportLayout; /// A matrix used as temporary rendering state representing the current projection matrix. Matrix4 projectionMatrix; /// A matrix used as temporary rendering state representing the current camera transformation matrix. Matrix4 cameraTransformMatrix; /// A matrix used as temporary rendering state representing the current inverse camera transformation matrix. Matrix4 inverseCameraTransformMatrix; }; //########################################################################################## //********************** End Rim Graphics Renderers Namespace **************************** RIM_GRAPHICS_RENDERERS_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_GRAPHICS_FORWARD_RENDERER_H <file_sep>/* * rimXML.h * Rim XML * * Created by <NAME> on 12/27/07. * Copyright 2007 Rim Software. All rights reserved. * */ #ifndef INCLUDE_RIM_XML_H #define INCLUDE_RIM_XML_H #include "xml/rimXMLConfig.h" #include "xml/rimXMLNode.h" #include "xml/rimXMLDocument.h" #include "xml/rimXMLDOMParser.h" #include "xml/rimXMLSAXParser.h" #endif // INCLUDE_RIM_XML_H <file_sep>/* * rimSoundBandFilter.h * Rim Sound * * Created by <NAME> on 11/29/12. * Copyright 2012 __MyCompanyName__. All rights reserved. * */ #ifndef INCLUDE_RIM_SOUND_BAND_FILTER_H #define INCLUDE_RIM_SOUND_BAND_FILTER_H #include "rimSoundFiltersConfig.h" #include "rimSoundFilter.h" #include "rimSoundCutoffFilter.h" //########################################################################################## //************************ Start Rim Sound Filters Namespace ***************************** RIM_SOUND_FILTERS_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class that implements a band-pass or band-reject filter of various types. class BandFilter : public SoundFilter { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Band Filter Type Enum Declaration /// An enum type that denotes a certain class of band filter. typedef enum Type { /// A type of band filter that uses a Bufferworth design. /** * A Butterworth filter is a type of filter that is designed to be as flat as * possible in the passband with no ripple in the stopband. The filter is -3dB at the corner * frequency. */ BUTTERWORTH = 0, /// A type of band filter that uses a Linkwitz-Riley design. /** * A Linkwitz-Riley filter is a type of filter that is designed to be allpass when * summed with a corresponding opposite filter at the crossover frequency. * The filter is -6dB at the corner frequency. * * Linkwitz-Riley filters only support orders 2, 4, 6, and 8 because of their special properties. * Attempting to use an invalid order will result in the next highest valid order being * used. */ LINKWITZ_RILEY = 1, /// A type of band filter that uses a Chebyshev type I design. /** * A Chebyshev type I filter is a filter that has a steeper rolloff but at the expense * of ripple in the passband. */ CHEBYSHEV_I = 2, }; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Filter Direction Enum Declaration /// An enum type that specifies if a filter is high-pass or low-pass. typedef enum Direction { /// A type of filter that filters out all frequencies outside the cutoff frequencies. BAND_PASS = 0, /// A type of filter that filters out all frequencies between the cutoff frequencies. BAND_REJECT = 1 }; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructors /// Create a default 1st order butterworth band pass filter with band frequencies at 0 Hz and 20000 Hz. BandFilter(); /// Create a band filter with the specified type, direction, order, and corner frequencies. /** * The filter order is clamped between 1 and the maximum allowed filter order, * and the corner frequencies are clamped to the range of [0,+infinity]. */ BandFilter( Type newFilterType, Direction newFilterDirection, Size newFilterOrder, Float newFrequency1, Float newFrequency2 ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Filter Type Accessor Methods /// Return the type of filter that is being used. /** * Since different types of filters have different characteristics in frequency * and phase response, this value allows the user to pick the filter type best * suited for their needs. */ RIM_INLINE Type getType() const { return convertFilterType( highPass.getType() ); } /// Set the type of filter that is being used. /** * Since different types of filters have different characteristics in frequency * and phase response, this value allows the user to pick the filter type best * suited for their needs. */ RIM_INLINE void setType( Type newFilterType ) { lockMutex(); CutoffFilter::Type cutoffType = convertFilterType( newFilterType ); highPass.setType( cutoffType ); lowPass.setType( cutoffType ); unlockMutex(); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Filter Direction Accessor Methods /// Return the direction of the filter that is being used. /** * This value determines whether the filter behaves as a high-pass * or low-pass filter. */ RIM_INLINE Direction getDirection() const { return filterDirection; } /// Set the type of filter that is being used. /** * This value determines whether the filter behaves as a high-pass * or low-pass filter. */ RIM_INLINE void setDirection( Direction newFilterDirection ) { lockMutex(); filterDirection = newFilterDirection; unlockMutex(); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Filter Order Accessor Methods /// Return the order of this band filter. RIM_INLINE Size getOrder() const { return highPass.getOrder(); } /// Set the order of this band filter. /** * If the specified order is not supported by this filter, the closest * order to the desired order is used. * * The new filter order is clamped betwee 1 and the maximum allowed filter order. */ RIM_INLINE void setOrder( Size newFilterOrder ) { lockMutex(); highPass.setOrder( newFilterOrder ); lowPass.setOrder( newFilterOrder ); unlockMutex(); } /// Return the maximum filter order allowed. /** * All created filters will have an order less than or equal to this value * and it is impossible to set the order of a filter to be greater than this * value. */ RIM_INLINE Size getMaximumOrder() const { return highPass.getMaximumOrder(); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Corner Frequency Accessor Methods /// Return the first corner frequency of this band filter. /** * This is the frequency at which the frequency begins to be cut off by the * filter. This is usually the point at which the filter is -3dB down, but * can be -6dB or other for some filter types. */ RIM_INLINE Float getFrequency1() const { return frequency1; } /// Set the first corner frequency of this band filter. /** * This is the frequency at which the frequency begins to be cut off by the * filter. This is usually the point at which the filter is -3dB down, but * can be -6dB or other for some filter types. * * The new corner frequency is clamped to be in the range [0,+infinity]. */ RIM_INLINE void setFrequency1( Float newCornerFrequency ) { lockMutex(); frequency1 = math::max( newCornerFrequency, Float(0) ); unlockMutex(); } /// Return the first corner frequency of this band filter. /** * This is the frequency at which the frequency begins to be cut off by the * filter. This is usually the point at which the filter is -3dB down, but * can be -6dB or other for some filter types. */ RIM_INLINE Float getFrequency2() const { return frequency2; } /// Set the first corner frequency of this band filter. /** * This is the frequency at which the frequency begins to be cut off by the * filter. This is usually the point at which the filter is -3dB down, but * can be -6dB or other for some filter types. * * The new corner frequency is clamped to be in the range [0,+infinity]. */ RIM_INLINE void setFrequency2( Float newCornerFrequency ) { lockMutex(); frequency2 = math::max( newCornerFrequency, Float(0) ); unlockMutex(); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Filter Ripple Accessor Methods /// Return the ripple of this band filter in dB. /** * This parameter is only used by the Chebyshev type I and type II filters. * It determines the amount of ripple in the passband (for type I) or in * the stopband (for type II). A smaller ripple results in a slower * rolloff in the frequency response for any given filter order. * * The ripple amount is initially equal to 1 dB and must be greater than 0. */ RIM_INLINE Float getRipple() const { return highPass.getRipple(); } /// Set the ripple of this band filter in dB. /** * This parameter is only used by the Chebyshev type I and type II filters. * It determines the amount of ripple in the passband (for type I) or in * the stopband (for type II). A smaller ripple results in a slower * rolloff in the frequency response for any given filter order. * * The ripple amount is initially equal to 1 dB and is clamped to be greater than 0. */ RIM_INLINE void setRipple( Float newRipple ) { lockMutex(); highPass.setRipple( newRipple ); lowPass.setRipple( newRipple ); unlockMutex(); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Filter Attribute Accessor Methods /// Return a human-readable name for this band filter. /** * The method returns the string "Band Filter". */ virtual UTF8String getName() const; /// Return the manufacturer name of this band filter. /** * The method returns the string "Headspace Sound". */ virtual UTF8String getManufacturer() const; /// Return an object representing the version of this band filter. virtual SoundFilterVersion getVersion() const; /// Return an object which describes the category of effect that this filter implements. /** * This method returns the value SoundFilterCategory::EQUALIZER. */ virtual SoundFilterCategory getCategory() const; /// Return whether or not this band filter can process audio data in-place. /** * This method always returns TRUE, band filters can process audio data in-place. */ virtual Bool allowsInPlaceProcessing() const; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Filter Parameter Accessor Methods /// Return the total number of generic accessible parameters this filter has. virtual Size getParameterCount() const; /// Get information about the parameter at the specified index. virtual Bool getParameterInfo( Index parameterIndex, FilterParameterInfo& info ) const; /// Get any special name associated with the specified value of an indexed parameter. virtual Bool getParameterValueName( Index parameterIndex, const FilterParameter& value, UTF8String& name ) const; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Public Static Property Objects /// A string indicating the human-readable name of this band filter. static const UTF8String NAME; /// A string indicating the manufacturer name of this band filter. static const UTF8String MANUFACTURER; /// An object indicating the version of this band filter. static const SoundFilterVersion VERSION; private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Filter Parameter Value Accessor Methods /// Place the value of the parameter at the specified index in the output parameter. virtual Bool getParameterValue( Index parameterIndex, FilterParameter& value ) const; /// Attempt to set the parameter value at the specified index. virtual Bool setParameterValue( Index parameterIndex, const FilterParameter& value ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Stream Reset Method /// A method which is called whenever the filter's stream of audio is being reset. /** * This method allows the filter to reset all parameter interpolation * and processing to its initial state to avoid coloration from previous * audio or parameter values. */ virtual void resetStream(); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Filter Processing Methods /// Apply this band filter to the samples in the input frame and place them in the output frame. virtual SoundFilterResult processFrame( const SoundFilterFrame& inputFrame, SoundFilterFrame& outputFrame, Size numSamples ); /// Convert the specified band filter type enum to a cutoff filter type enum. RIM_INLINE static CutoffFilter::Type convertFilterType( Type newType ) { switch ( newType ) { case BUTTERWORTH: return CutoffFilter::BUTTERWORTH; case LINKWITZ_RILEY: return CutoffFilter::LINKWITZ_RILEY; case CHEBYSHEV_I: return CutoffFilter::CHEBYSHEV_I; } return CutoffFilter::BUTTERWORTH; } /// Convert the specified cutoff filter type enum to a band filter type enum. RIM_INLINE static Type convertFilterType( CutoffFilter::Type newType ) { switch ( newType ) { case CutoffFilter::BUTTERWORTH: return BUTTERWORTH; case CutoffFilter::LINKWITZ_RILEY: return LINKWITZ_RILEY; case CutoffFilter::CHEBYSHEV_I: return CHEBYSHEV_I; } return BUTTERWORTH; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Members /// An enum representing the direction of this band filter. /** * This value specifies whether the filter is a band-pass or band-reject filter. */ Direction filterDirection; /// A cutoff filter that filters out low frequencies for this band filter. CutoffFilter highPass; /// A cutoff filter that filters out high frequencies for this band filter. CutoffFilter lowPass; /// The first frequency which defines this band filter's pass-band or stop-band. Float frequency1; /// The second frequency which defines this band filter's pass-band or stop-band. Float frequency2; }; //########################################################################################## //************************ End Rim Sound Filters Namespace ******************************* RIM_SOUND_FILTERS_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_SOUND_BAND_FILTER_H <file_sep>/* * rimHashMap.h * Rim Framework * * Created by <NAME> on 3/6/11. * Copyright 2011 Rim Software. All rights reserved. * */ #ifndef INCLUDE_RIM_HASH_MAP_H #define INCLUDE_RIM_HASH_MAP_H #include "rimUtilitiesConfig.h" #include "../math/rimPrimes.h" #include "rimAllocator.h" //########################################################################################## //*************************** Start Rim Utilities Namespace ****************************** RIM_UTILITIES_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A container class which uses a hash table to map key objects to value objects. template < typename K, typename V, typename HashType = Hash > class HashMap { private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Bucket Class class Entry { public: RIM_INLINE Entry( HashType newKeyHash, const K& newKey, const V& newValue ) : next( NULL ), keyHash( newKeyHash ), key( newKey ), value( newValue ) { } Entry( const Entry& other ) : keyHash( other.keyHash ), key( other.key ), value( other.value ) { if ( other.next ) next = util::construct<Entry>(*other.next); else next = NULL; } ~Entry() { if ( next ) util::destruct(next); } Entry* next; HashType keyHash; K key; V value; }; public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructors /// Create a hash map with the default load factor and number of buckets. RIM_INLINE HashMap() : buckets( util::allocate<Entry*>(DEFAULT_NUMBER_OF_BUCKETS) ), numBuckets( DEFAULT_NUMBER_OF_BUCKETS ), numElements( 0 ), loadFactor( DEFAULT_LOAD_FACTOR ), loadThreshold( Size(DEFAULT_LOAD_FACTOR*DEFAULT_NUMBER_OF_BUCKETS) ) { nullBuckets(); } /// Create a hash map with the specified load factor and default number of buckets. RIM_INLINE HashMap( Float newLoadFactor ) : buckets( util::allocate<Entry*>(DEFAULT_NUMBER_OF_BUCKETS) ), numBuckets( DEFAULT_NUMBER_OF_BUCKETS ), numElements( 0 ), loadFactor( math::clamp( newLoadFactor, 0.1f, 2.0f ) ) { loadThreshold = Size(loadFactor*DEFAULT_NUMBER_OF_BUCKETS); nullBuckets(); } /// Create a hash map with the default load factor and specified number of buckets. RIM_INLINE HashMap( HashType newNumBuckets ) : numBuckets( math::nextPowerOf2Prime(newNumBuckets) ), numElements( 0 ), loadFactor( DEFAULT_LOAD_FACTOR ) { buckets = util::allocate<Entry*>(numBuckets); loadThreshold = Size(DEFAULT_LOAD_FACTOR*numBuckets); nullBuckets(); } /// Create a hash map with the specified load factor and number of buckets. RIM_INLINE HashMap( HashType newNumBuckets, Float newLoadFactor ) : numBuckets( math::nextPowerOf2Prime(newNumBuckets) ), numElements( 0 ), loadFactor( math::clamp( newLoadFactor, 0.1f, 2.0f ) ) { buckets = util::allocate<Entry*>(numBuckets); loadThreshold = Size(loadFactor*numBuckets); nullBuckets(); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Copy Constructor /// Create a hash map with the specified load factor and number of buckets. RIM_INLINE HashMap( const HashMap& other ) : buckets( util::allocate<Entry*>(other.numBuckets) ), numBuckets( other.numBuckets ), numElements( other.numElements ), loadFactor( other.loadFactor ), loadThreshold( other.loadThreshold ) { // Copy the hash table buckets const Entry* const * otherBucket = other.buckets; const Entry* const * const otherBucketsEnd = otherBucket + numBuckets; Entry** bucket = buckets; while ( otherBucket != otherBucketsEnd ) { if ( *otherBucket ) *bucket = util::construct<Entry>(**otherBucket); else *bucket = NULL; otherBucket++; bucket++; } } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Assignment Operator /// Copy the contents of one hash map into another. RIM_INLINE HashMap& operator = ( const HashMap& other ) { if ( this != &other ) { deleteBuckets( buckets, numBuckets ); // Copy the parameters from the other hash map. numBuckets = other.numBuckets; numElements = other.numElements; buckets = util::allocate<Entry*>( numBuckets ); loadFactor = other.loadFactor; loadThreshold = other.loadThreshold; { // Copy the hash table buckets const Entry* const * otherBucket = other.buckets; const Entry* const * const otherBucketsEnd = otherBucket + numBuckets; Entry** bucket = buckets; while ( otherBucket != otherBucketsEnd ) { if ( *otherBucket ) *bucket = util::construct<Entry>(**otherBucket); else *bucket = NULL; otherBucket++; bucket++; } } } return *this; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Destructor /// Destroy a hash map and it's contents, deallocating all memory used. RIM_INLINE ~HashMap() { deleteBuckets( buckets, numBuckets ); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Add Method /// Add a new mapping to the hash map, associating the given key with the given value. /** * If the add operation was successful, it returns a pointer to the location * where the mapping's value is stored. Otherwise, a NULL pointer is returned. */ RIM_INLINE V* add( HashType keyHash, const K& key, const V& value ) { // Check the load constraint, if necessary, increase the size of the table. if ( numElements > loadThreshold ) resize( math::nextPowerOf2Prime( numBuckets + 1 ) ); // Compute the bucket for the new element. Entry** bucket = buckets + keyHash % numBuckets; numElements++; // Add the new element. if ( *bucket == NULL ) { *bucket = util::construct<Entry>( keyHash, key, value ); return &(*bucket)->value; } else { Entry* entry = *bucket; while ( entry->next ) entry = entry->next; entry->next = util::construct<Entry>( keyHash, key, value ); return &entry->next->value; } } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Set Method /// Set the mapping of a key to be the given value, regardless of it's previous state. /** * The method returns TRUE if the key did not previously exist in the HashMap. * Otherwise the method returns FALSE. */ RIM_INLINE Bool set( HashType keyHash, const K& key, const V& value ) { // Compute the bucket for the new element. Entry** bucket = buckets + keyHash % numBuckets; if ( *bucket == NULL ) *bucket = util::construct<Entry>( keyHash, key, value ); else { Entry* entry = *bucket; if ( entry->key == key ) { entry->value = value; return false; } while ( entry->next ) { entry = entry->next; if ( entry->key == key ) { entry->value = value; return false; } } entry->next = util::construct<Entry>( keyHash, key, value ); } numElements++; return true; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Remove Methods /// Remove the first mapping of the given key and return the mapped value. /** * If the key does not exist in the hash map, then FALSE is returned, * otherwise TRUE is returned. */ RIM_INLINE Bool remove( HashType keyHash, const K& key ) { // Compute the bucket for the new element. Entry** bucket = buckets + keyHash % numBuckets; Entry** previousNext = bucket; Entry* entry = *bucket; while ( entry ) { if ( entry->key == key ) { *previousNext = entry->next; entry->next = NULL; util::destruct(entry); numElements--; return true; } previousNext = &(*previousNext)->next; entry = entry->next; } return false; } /// Remove a mapping from the hash map if it was found, returning the success. RIM_INLINE Bool remove( HashType keyHash, const K& key, const V& value ) { // Compute the bucket for the new element. Entry** bucket = buckets + keyHash % numBuckets; Entry** previousNext = bucket; Entry* entry = *bucket; while ( entry ) { if ( entry->key == key && entry->value == value ) { *previousNext = entry->next; entry->next = NULL; util::destruct(entry); numElements--; return true; } previousNext = &(*previousNext)->next; entry = entry->next; } return false; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Clear Method /// Clear all mappings from the hash map. RIM_INLINE void clear() { // Delete all entries Entry** entry = buckets; const Entry* const * const entryEnd = entry + numBuckets; while ( entry != entryEnd ) { if ( *entry ) { util::destruct(*entry); *entry = NULL; } entry++; } numElements = 0; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Contains Methods /// Query whether or not the specified key is contained in a hash map. RIM_INLINE Bool find( HashType keyHash, const K& key, V*& value ) { // Compute the bucket for the query. Entry* entry = *(buckets + keyHash % numBuckets); // Look for the key in the bucket. while ( entry ) { if ( entry->key == key ) { value = &entry->value; return true; } entry = entry->next; } return false; } /// Query whether or not the specified key is contained in a hash map. RIM_INLINE Bool find( HashType keyHash, const K& key, const V*& value ) const { // Compute the bucket for the query. Entry* entry = *(buckets + keyHash % numBuckets); // Look for the key in the bucket. while ( entry ) { if ( entry->key == key ) { value = &entry->value; return true; } entry = entry->next; } return false; } /// Query whether or not the specified key is contained in a hash map. RIM_INLINE Bool contains( HashType keyHash, const K& key ) const { // Compute the bucket for the query. Entry* entry = *(buckets + keyHash % numBuckets); // Look for the key in the bucket. while ( entry ) { if ( entry->key == key ) return true; entry = entry->next; } return false; } /// Query whether or not a particular mapping exists in the hash map. RIM_INLINE Bool contains( HashType keyHash, const K& key, const V& value ) const { // Compute the bucket for the query. Entry* entry = *(buckets + keyHash % numBuckets); // Look for the key in the bucket. while ( entry ) { if ( entry->key == key && entry->value == value ) return true; entry = entry->next; } return false; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Size Accessor Methods /// Return the number of mappings in a hash map. RIM_INLINE Size getSize() const { return numElements; } /// Return whether or not a hash map is empty. RIM_INLINE Bool isEmpty() const { return numElements == Size(0); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Get Methods /// Return a pointer to the value associated with the given key. /** * If the key does not exist in the hash map, a NULL pointer is * returned. */ RIM_INLINE V* get( HashType keyHash, const K& key ) { // Compute the bucket for the query. Entry* entry = *(buckets + keyHash % numBuckets); // Look for the key in the bucket. while ( entry ) { if ( entry->key == key ) return &entry->value; entry = entry->next; } return NULL; } /// Return a const pointer to the value associated with the given key. /** * If the key does not exist in the hash map, a NULL pointer is * returned. */ RIM_INLINE const V* get( HashType keyHash, const K& key ) const { // Compute the bucket for the query. Entry* entry = *(buckets + keyHash % numBuckets); // Look for the key in the bucket. while ( entry ) { if ( entry->key == key ) return &entry->value; entry = entry->next; } return NULL; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Iterator Class /// A class which iterates over hash map elements. class Iterator { public: //******************************************** // Constructor /// Create a new hash map iterator for the specified hash map. RIM_INLINE Iterator( HashMap& newHashMap ) : hashMap( newHashMap ), currentBucket( newHashMap.buckets ), bucketsEnd( newHashMap.buckets + newHashMap.numBuckets ) { // advance until the first element advanceToNextFullBucket(); } //******************************************** // Public Methods /// Increment the location of a hash map iterator by one element. RIM_INLINE void operator ++ () { currentEntry = currentEntry->next; if ( currentEntry == NULL ) { currentBucket++; advanceToNextFullBucket(); } } /// Increment the location of a hash map iterator by one element. RIM_INLINE void operator ++ ( int ) { this->operator++(); } /// Test whether or not the current element is valid. /** * This will return FALSE when the last element of the hash map * has been iterated over. */ RIM_INLINE operator Bool () const { return currentEntry != NULL; } /// Return the value of the key-value pair pointed to by the iterator. RIM_INLINE V& operator * () const { return currentEntry->value; } /// Access the current iterator element value RIM_INLINE V* operator -> () const { return &currentEntry->value; } /// Get the value of the key-value pair pointed to by the iterator. RIM_INLINE V& getValue() const { return currentEntry->value; } /// Get the key of the key-value pair pointed to by the iterator. RIM_INLINE K& getKey() const { return currentEntry->key; } /// Get the key hash of the key-value pair pointed to by the iterator. RIM_INLINE HashType getKeyHash() const { return currentEntry->keyHash; } /// Remove the current element from the hash table. RIM_INLINE void remove() { // Backup in the bucket so that we can remove the current element. // This is potentially inefficient, it would be best if the buckets // would use a doublely linked list, but this might add extra overhead // elsewhere. // Handle removing from the start of a bucket separately. if ( currentEntry == *currentBucket ) { *currentBucket = currentEntry->next; if ( *currentBucket != NULL ) { currentEntry->next = NULL; util::destruct( currentEntry ); currentEntry = *currentBucket; } else { util::destruct( currentEntry ); currentBucket++; advanceToNextFullBucket(); } } else { // Otherwise, iterate through the bucket until we find the element // before this one. Entry* previousEntry = *currentBucket; while ( previousEntry && previousEntry->next != currentEntry ) previousEntry = previousEntry->next; previousEntry->next = currentEntry->next; Entry* temp = currentEntry; operator++(); temp->next = NULL; util::destruct( temp ); } hashMap.numElements--; } /// Reset the iterator to the beginning of the hash map. RIM_INLINE void reset() { currentBucket = hashMap.buckets; // advance until the first element advanceToNextFullBucket(); } private: //******************************************** // Private Methods /// Advance the iterator to the next non-empty bucket. RIM_INLINE void advanceToNextFullBucket() { while ( *currentBucket == NULL && currentBucket != bucketsEnd ) currentBucket++; if ( currentBucket == bucketsEnd ) currentEntry = NULL; else currentEntry = *currentBucket; } //******************************************** // Private Data Members /// The HashMap that is being iterated over. HashMap& hashMap; /// The current bucket in the HashMap. Entry** currentBucket; /// The last bucket in the HashMap. const Entry* const * const bucketsEnd; /// The current entry in the hash map that the iterator is pointing to. Entry* currentEntry; }; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** ConstIterator Class /// A class which iterates over hash map elements without the ability to modify them. class ConstIterator { public: //******************************************** // Constructor /// Create a new hash map iterator for the specified hash map. RIM_INLINE ConstIterator( const HashMap& newHashMap ) : hashMap( newHashMap ), currentBucket( newHashMap.buckets ), bucketsEnd( newHashMap.buckets + newHashMap.numBuckets ) { // advance until the first element advanceToNextFullBucket(); } //******************************************** // Public Methods /// Increment the location of a hash map iterator by one element. RIM_INLINE void operator ++ () { currentEntry = currentEntry->next; if ( currentEntry == NULL ) { currentBucket++; advanceToNextFullBucket(); } } /// Increment the location of a hash map iterator by one element. RIM_INLINE void operator ++ ( int ) { this->operator++(); } /// Test whether or not the current element is valid. /** * This will return FALSE when the last element of the hash map * has been iterated over. */ RIM_INLINE operator Bool () const { return currentEntry != NULL; } /// Return the value of the key-value pair pointed to by the iterator. RIM_INLINE const V& operator * () const { return currentEntry->value; } /// Access the current iterator element value RIM_INLINE const V* operator -> () const { return &currentEntry->value; } /// Get the value of the key-value pair pointed to by the iterator. RIM_INLINE const V& getValue() const { return currentEntry->value; } /// Get the key of the key-value pair pointed to by the iterator. RIM_INLINE const K& getKey() const { return currentEntry->key; } /// Get the key hash of the key-value pair pointed to by the iterator. RIM_INLINE HashType getKeyHash() const { return currentEntry->keyHash; } /// Reset the iterator to the beginning of the hash map. RIM_INLINE void reset() { currentBucket = hashMap.buckets; // advance until the first element advanceToNextFullBucket(); } private: //******************************************** // Private Methods /// Advance the iterator to the next non-empty bucket. RIM_INLINE void advanceToNextFullBucket() { while ( *currentBucket == NULL && currentBucket != bucketsEnd ) currentBucket++; if ( currentBucket == bucketsEnd ) currentEntry = NULL; else currentEntry = *currentBucket; } //******************************************** // Private Data Members /// The HashMap that is being iterated over. const HashMap& hashMap; /// The current bucket in the HashMap. const Entry* const * currentBucket; /// The last bucket in the HashMap. const Entry* const * bucketsEnd; /// The current entry in the hash map that the iterator is pointing to. const Entry* currentEntry; }; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Iterator Method /// Get a const-iterator for the hash map. RIM_INLINE ConstIterator getIterator() const { return ConstIterator(*this); } /// Get an iterator for the hash map that can modify the hash map. RIM_INLINE Iterator getIterator() { return Iterator(*this); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Load Factor Accessor Methods RIM_INLINE void setLoadFactor( Float newLoadFactor ) { loadFactor = math::clamp( newLoadFactor, 0.1f, 5.0f ); loadThreshold = Size(loadFactor*numBuckets); // Check the load constraint, if necessary, increase the size of the table. if ( numElements > loadThreshold ) resize( math::nextPowerOf2Prime( numBuckets + 1 ) ); } RIM_INLINE Float getLoadFactor() const { return loadFactor; } private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Methods void resize( HashType newNumBuckets ) { Entry** oldBuckets = buckets; HashType oldNumBuckets = numBuckets; // initialize all buckets and resize the array numBuckets = newNumBuckets; loadThreshold = Size(loadFactor*numBuckets); buckets = util::allocate<Entry*>(numBuckets); nullBuckets(); // add old elements to the hash map. Entry** oldBucket = oldBuckets; const Entry* const * const oldBucketsEnd = oldBucket + oldNumBuckets; while ( oldBucket != oldBucketsEnd ) { Entry* oldEntry = *oldBucket; while ( oldEntry ) { Entry** bucket = buckets + oldEntry->keyHash % numBuckets; // Add the old element to the end of the bucket. if ( *bucket == NULL ) { *bucket = oldEntry; oldEntry = oldEntry->next; (*bucket)->next = NULL; } else { Entry* entry = *bucket; while ( entry->next ) entry = entry->next; entry->next = oldEntry; oldEntry = oldEntry->next; entry->next->next = NULL; } } oldBucket++; } // deallocate all memory currently used by the old buckets util::deallocate(oldBuckets); } RIM_INLINE void nullBuckets() { Entry** bucket = buckets; const Entry* const * const bucketsEnd = bucket + numBuckets; while ( bucket != bucketsEnd ) { *bucket = NULL; bucket++; } } RIM_INLINE static void deleteBuckets( Entry** buckets, HashType numBuckets ) { // Delete all entries Entry** entry = buckets; const Entry* const * const entryEnd = entry + numBuckets; while ( entry != entryEnd ) { if ( *entry ) util::destruct(*entry); entry++; } // Delete the bucket array. util::deallocate(buckets); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Members /// A pointer to an array of pointers to the buckets for this hash map. Entry** buckets; /// The total number of buckets that are part of this hash map. Size numBuckets; /// The total number of entries that are stored in this hash map. Size numElements; /// The fraction of the number of buckets that the hash map can have filled before it resizes. Float loadFactor; /// The maximum number of elements this hash map can have before it is resized. /** * This value is computed as the load factor multiplied with the number of buckets. */ Size loadThreshold; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Static Data Members static const Size DEFAULT_NUMBER_OF_BUCKETS = 19; static const Float DEFAULT_LOAD_FACTOR; }; template < typename K, typename V, typename HashType > const Float HashMap<K,V,HashType>:: DEFAULT_LOAD_FACTOR = 0.5f; //########################################################################################## //*************************** End Rim Utilities Namespace ******************************** RIM_UTILITIES_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_HASH_MAP_H <file_sep>/* * rimPhysicsConfig.h * Rim Physics * * Created by <NAME> on 6/7/08. * Copyright 2008 Rim Software. All rights reserved. * */ #ifndef INCLUDE_RIM_PHYSICS_CONFIG_H #define INCLUDE_RIM_PHYSICS_CONFIG_H #include "rim/rimFramework.h" #include "rim/rimBVH.h" //########################################################################################## //########################################################################################## //############ //############ Library Configuration //############ //########################################################################################## //########################################################################################## #ifndef RIM_PHYSICS_USE_SIMD /// Define whether or not SIMD code is allowed in this physics library. /** * A value of 0 indicates that SIMD code is disabled, while non-zero * values indicate that SIMD code is enabled. */ #define RIM_PHYSICS_USE_SIMD 0 #endif #ifndef RIM_PHYSICS_FIXED_MAX_NUM_COLLISION_POINTS /// Define whether or not to have a fixed maximum CollisionManifold size. /** * Setting this to a non-zero value will cause collision manifolds to contain * up to a maximum number of points. This can improve performance by avoiding * dynamic allocations for each collision manifold. A zero value will allow * any number of collision points per manifold. */ #define RIM_PHYSICS_FIXED_MAX_NUM_COLLISION_POINTS 1 #endif //########################################################################################## //########################################################################################## //############ //############ Library Namespace Configuration //############ //########################################################################################## //########################################################################################## #ifndef RIM_PHYSICS_NAMESPACE_START #define RIM_PHYSICS_NAMESPACE_START RIM_NAMESPACE_START namespace physics { #endif #ifndef RIM_PHYSICS_NAMESPACE_END #define RIM_PHYSICS_NAMESPACE_END }; RIM_NAMESPACE_END #endif //########################################################################################## //*************************** Start Rim Physics Namespace ******************************** RIM_PHYSICS_NAMESPACE_START //****************************************************************************************** //########################################################################################## typedef float Real; using namespace rim::math; typedef rim::math::Vector2D<Real> Vector2; typedef rim::math::Matrix2D<Real> Matrix2; typedef rim::math::AABB2D<Real> AABB2; typedef rim::math::Transform2D<Real> Transform2; typedef rim::math::Vector3D<Real> Vector3; typedef rim::math::Matrix3D<Real> Matrix3; typedef rim::math::AABB3D<Real> AABB3; typedef rim::math::Transform3D<Real> Transform3; typedef rim::math::Vector4D<Real> Vector4; typedef rim::math::Matrix4D<Real> Matrix4; typedef rim::math::Plane3D<Real> Plane3; typedef rim::bvh::BoundingSphere<Real> BoundingSphere; //########################################################################################## //*************************** End Rim Physics Namespace ********************************** RIM_PHYSICS_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_PHYSICS_CONFIG_H <file_sep>/* * rimPhysicsRigidObject.h * Rim Physics * * Created by <NAME> on 11/28/09. * Copyright 2009 Rim Software. All rights reserved. * */ #ifndef INCLUDE_RIM_PHYSICS_COLLISION_SHAPE_TYPE_H #define INCLUDE_RIM_PHYSICS_COLLISION_SHAPE_TYPE_H #include "rimPhysicsShapesConfig.h" //########################################################################################## //************************ Start Rim Physics Shapes Namespace **************************** RIM_PHYSICS_SHAPES_NAMESPACE_START //****************************************************************************************** //########################################################################################## /// Define the integer type to use for a collision shape type hashed identifier. typedef Hash CollisionShapeTypeID; //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class which encapsulates a RTTI-determined type for a CollisionShape. class CollisionShapeType { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructors /// Create a CollisionShapeType object with the specified internal type. RIM_FORCE_INLINE CollisionShapeType( const Type& newType ) : type( newType ) { } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Static Type Creation Methods /// Return a CollisionShapeType object for the specified ShapeType template parameter. template < typename ShapeType > RIM_FORCE_INLINE static CollisionShapeType of() { return CollisionShapeType( Type::of<ShapeType>() ); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Equality Comparison Operators /// Return whether or not this collision shape type is equal to another. RIM_FORCE_INLINE Bool operator == ( const CollisionShapeType& other ) const { return type == other.type; } /// Return whether or not this collision shape type is not equal to another. RIM_FORCE_INLINE Bool operator != ( const CollisionShapeType& other ) const { return type != other.type; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Type ID Accessor Methods /// Return an integer identifying this collision shape type. /** * This ID is a 32-bit integer that is generated by hashing the string * generated for a type template parameter. While the posibility of * ID collisions is very low, duplicates are nonetheless a possibility. */ RIM_FORCE_INLINE CollisionShapeTypeID getID() const { return type.getHashCode(); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Type String Accessor Methods /// Get a string representing the implementation-defined name of this type. RIM_FORCE_INLINE operator const String& () const { return type.toString(); } /// Get a string representing the implementation-defined name of this type. RIM_FORCE_INLINE const String& toString() const { return type.toString(); } /// Get a string representing the implementation-defined name of this type. RIM_FORCE_INLINE const String& getName() const { return type.getName(); } public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Members /// A Type object representing the internal type for this CollisionShapeType. Type type; }; //########################################################################################## //************************ End Rim Physics Shapes Namespace ****************************** RIM_PHYSICS_SHAPES_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_PHYSICS_COLLISION_SHAPE_TYPE_H <file_sep>/* * rimStaticArrayList.h * Rim Framework * * Created by <NAME> on 2/18/11. * Copyright 2011 Rim Software. All rights reserved. * */ #ifndef INCLUDE_RIM_STATIC_ARRAY_LIST_H #define INCLUDE_RIM_STATIC_ARRAY_LIST_H #include "rimUtilitiesConfig.h" //########################################################################################## //*************************** Start Rim Utilities Namespace ****************************** RIM_UTILITIES_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// An array-based list class with a static element capacity. /** * The StaticArrayList class allows basic list operations: add(), remove(), * insert(), clear() and getSize(). Once the static capacity of the list is * reached, no more elements can be added to the list. */ template < typename T, Size capacity > class StaticArrayList { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructors /// Create a new empty static array list. RIM_INLINE StaticArrayList() : numElements( 0 ), array( (T*)data ) { } /// Create a new static array list with its internal array initialized with element from an external array. /** * The initial size of the static array list is set to the number of * elements that are to be copied from the given array. If the number of * elements to be copied is larger than the static capacity of the list, * the maximum possible number of elements are copied. * * @param elements - an array of contiguous element objects from which to initialize this static array list. * @param newNumElements - the number of elements to copy from the element array. */ RIM_INLINE StaticArrayList( const T* elements, Size newNumElements ) : numElements( newNumElements < capacity ? newNumElements : capacity ), array( (T*)data ) { copyObjects( array, elements, numElements ); } /// Create a copy of another static array list, performing a deep copy. RIM_INLINE StaticArrayList( const StaticArrayList& other ) : numElements( other.numElements ), array( (T*)data ) { copyObjects( array, other.array, other.numElements ); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Destructor /// Destroy this static array list, releasing all internal state. RIM_INLINE ~StaticArrayList() { // Call the destructors of all objects that were constructed. callDestructors( array, numElements ); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Assignment Operator /// Assign the contents from another static array list to this one. RIM_INLINE StaticArrayList& operator = ( const StaticArrayList& other ) { if ( this != &other ) { // Call the destructors of all objects that were constructed. callDestructors( array, numElements ); // Copy the objects from the other array. numElements = other.numElements; copyObjects( array, other.array, other.numElements ); } return *this; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Equality Operators /// Return whether or not whether every entry in this list is equal to another list's entries. RIM_INLINE Bool operator == ( const StaticArrayList<T,capacity>& other ) const { // If the arraylists point to the same data, they are equal. if ( array == other.array ) return true; else if ( numElements != other.numElements ) return false; // Do an element-wise comparison otherwise. const T* a = array; const T* b = other.array; const T* const aEnd = a + numElements; while ( a != aEnd ) { if ( !(*a == *b) ) return false; a++; b++; } return true; } /// Return whether or not whether any entry in this list is not equal to another list's entries. RIM_INLINE Bool operator != ( const StaticArrayList<T,capacity>& other ) const { return !(*this == other); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Add Methods /// Add an element to the end of the static list. /** * If the capacity of the static array list is not great enough to hold * the new element, then FALSE is returned and the static array list is * unaffected. Otherwise, the element is successfully added and TRUE * is returned. * * @param newElement - the new element to add to the end of the static array list. * @return whether or not the element was successfully added. */ RIM_INLINE Bool add( const T& newElement ) { if ( numElements != capacity ) { new (array + numElements) T( newElement ); numElements++; return true; } else return false; } /// Add the contents of one static array list to another. /** * This method has the effect of adding each element of * the given list to the end of this array list in order. * * @param list - the list to be added to the end of this list */ template < Size otherCapacity > void addAll( const StaticArrayList<T,otherCapacity>& list ) { if ( numElements + list.numElements <= capacity ) { StaticArrayList::copyObjects( array + numElements, list.array, list.numElements ); numElements += list.numElements; return true; } else return false; } /// Insert an element at the specified index of the static array list. /** * The method returns TRUE if the element was successfully inserted * into the static array list. If the index is outside of the bounds of the * static array list, then FALSE is returned, indicating that the element * was not inserted. FALSE will also be returned if there is no * more room in the static array list. This method has an average case * time complexity of O(n/2) because all subsequent elements in * the static array list have to be moved towards the end of the array by one * index. * * @param newElement - the new element to insert into the static array list. * @param index - the index at which to insert the new element. * @return whether or not the element was successfully inserted into the static array list. */ RIM_INLINE Bool insert( Index index, const T& newElement ) { if ( index >= 0 && index <= numElements && numElements != capacity ) { T* destination = array + numElements; const T* source = array + numElements - 1; const T* const sourceEnd = array + index - 1; while ( source != sourceEnd ) { new (destination) T(*source); source->~T(); source--; destination--; } new (array + index) T( newElement ); numElements++; return true; } else return false; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Set Method /// Set an element at the specified index of the static array list to a new value. /** * This method returns TRUE if the specified index is within the bounds * of the static array list, indicating that the element was successfully set * at that position in the static array list. Otherwise, FALSE is returned, * indicating that the index was out of bounds of the static array list. This * method has worst-case time complexity of O(1). * * @param newElement - the new element to set in the static array list. * @param index - the index at which to set the new element. * @return whether or not the element was successfully set to the new value. */ RIM_INLINE Bool set( Index index, const T& newElement ) { if ( index < numElements ) { // destroy the old element. array[index].~T(); // replace it with the new element. new (array + index) T(newElement); return true; } else return false; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Remove Methods /// Remove the element at the specified index, ordered version. /** * If the index is within the bounds of the static array list ( >= 0 && < getSize() ), * then the static array list element at that index is removed and TRUE is returned, * indicating that the remove operation was successful. * Otherwise, FALSE is returned and the static array list * is unaffected. The order of the static array list is unaffected, meaning that * all of the elements after the removed element must be copied one * index towards the beginning of the static array list. This gives the method * an average case performance of O(n/2) where n is the number of * elements in the static array list. * * @param index - the index of the static array list element to remove. * @return whether or not the element was successfully removed. */ RIM_INLINE Bool removeAtIndex( Index index ) { if ( index < numElements ) { // shift all elements forward in the array one index. numElements--; // Destroy the element to be removed. array[index].~T(); // Move the objects to fill the hole in the array. StaticArrayList::moveObjects( array + index, array + index + 1, numElements - index ); return true; } else return false; } /// Remove the element at the specified index, unordered version. /** * If the index is within the bounds of the static array list ( >= 0 && < getSize() ), * then the static array list element at that index is removed and TRUE is returned, * indicating that the remove operation was successful. * Otherwise, FALSE is returned and the static array list is unaffected. * The order of the static array list is affected when this method * successfully removes the element. It works by replacing the element * at the index to be removed with the last element in the static array list. This * gives the method a worst case time complexity of O(1), which is * much faster than the ordered remove methods. * * @param index - the index of the static array list element to remove. * @return whether or not the element was successfully removed. */ RIM_INLINE Bool removeAtIndexUnordered( Index index ) { if ( index < numElements ) { numElements--; // Destroy the element to be removed. T* destination = array + index; destination->~T(); // Replace it with the last element if necessary. if ( index != numElements ) { T* source = array + numElements; new (destination) T(*source); source->~T(); } return true; } else return false; } /// Remove the first element equal to the parameter object, ordered version. /** * If this element is found, then it is removed and TRUE is returned. * Otherwise, FALSE is returned and the static array list is unaffected. * The order of the static array list is unaffected, meaning that all of the elements after * the removed element must be copied one index towards the beginning * of the static array list. This gives the method an average case performance * of O(n) where n is the number of elements in the static array list. This * method's complexity is worse than the ordered index remove method * because it must search through the static array list for the element and then * copy all subsequent elements one position nearer to the start of the * list. * * @param element - the element to remove the first instance of. * @return whether or not the element was successfully removed. */ RIM_INLINE Bool remove( const T& object ) { const T* const end = array + numElements; for ( T* element = array; element != end; element++ ) { if ( *element == object ) { numElements--; // Destroy the element to be removed. element->~T(); // Move the objects to fill the hole in the array. StaticArrayList::moveObjects( element, element + 1, end - element - 1 ); return true; } } return false; } /// Remove the first element equal to the parameter object, unordered version. /** * If this element is found, then it is removed and TRUE is returned. * Otherwise, FALSE is returned and the static array list is unaffected. * The order of the static array list is affected when this method * successfully removes the element. It works by replacing the element * at the index to be removed with the last element in the static array list. This * gives the method a worst case time complexity of O(1), which is * much faster than the ordered remove methods. * * @param object - the static array list element to remove the first instance of. * @return whether or not the element was successfully removed. */ RIM_INLINE Bool removeUnordered( const T& object ) { const T* const end = array + numElements; for ( T* element = array; element != end; element++ ) { if ( *element == object ) { numElements--; // Destroy the element to be removed. element->~T(); const T* last = array + numElements; // Replace it with the last element if possible. if ( element != last ) { new (element) T(*last); last->~T(); } return true; } } return false; } /// Remove the last element in the static array list. /** * If the static array list has elements remaining in it, then * the last element in the array list is removed and TRUE is returned. * If the static array list has no remaining elements, then FALSE is returned, * indicating that the static array list was unaffected. This method has worst * case O(1) time complexity. * * @return whether or not the last element was successfully removed. */ RIM_INLINE Bool removeLast() { if ( numElements != Size(0) ) { numElements--; // destroy the last element. array[numElements].~T(); return true; } else return false; } /// Remove the last N elements from the static array list. /** * If the static array list has at least N elements remaining in it, then * the last N elements in the array list are removed and N is returned. * If the array list has less than N elements, then the list will be * completely cleared, resulting in an empty list. The method returns the * number of elements successfully removed. * * @return the number of elements removed from the end of the list. */ RIM_INLINE Size removeLast( Size number ) { number = numElements > number ? number : numElements; numElements -= number; // destroy the elements that were removed. ArrayList<T>::callDestructors( array + numElements, number ); return number; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Clear Method /// Clear the contents of this static array list. /** * This method calls the destructors of all elements in the static * array and sets the number of elements to zero while maintaining the * array's capacity. */ RIM_INLINE void clear() { StaticArrayList::callDestructors( array, numElements ); numElements = Size(0); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Contains Method /// Return whether or not the specified element is in this static array list. /** * The method has average case O(n/2) time complexity, where * n is the number of elements in the static array list. This method * is here for convenience. It just calls the static array list's * getIndex() method, and tests to see if the return value is * not equal to -1. It is recommended that if one wants the * index of the element as well as whether or not it is contained * in the static array list, they should use the getIndex() method exclusively, * and check the return value to make sure that the element is in the * static array list. This avoids the double O(n/2) lookup that would be performed * one naively called this method and then that method. * * @param element - the element to check to see if it is contained in the static array list. * @return whether or not the specified element is in the static array list. */ RIM_INLINE Bool contains( const T& anElement ) const { T* element = array; const T* const end = array + numElements; while ( element != end ) { if ( *element == anElement ) return true; } return false; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Element Find Method /// Return the index of the element equal to the parameter element. /** * If the specified element is not found within the static array list, * then -1 is returned. Otherwise, the index of the element * equal to the parameter is returned. * * @param element - the element to find in the static array list. * @return the index of the element which was found, or -1 if it was not found. */ RIM_INLINE Bool getIndex( const T& object, Index& index ) const { T* element = array; const T* const end = array + numElements; while ( element != end ) { if ( *element == object ) { index = element - array; return true; } } return false; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Element Accessor Methods /// Return the element at the specified index. /** * If the specified index is not within the valid bounds * of the static array list, then an exception is thrown indicating * an index out of bounds error occurred. This is the const version * of the get() method, disallowing modification of the element. * * @param index - the index of the desired element. * @return a const reference to the element at the index specified by the parameter. */ RIM_INLINE const T& get( Index index ) const { RIM_DEBUG_ASSERT( index < numElements ); return array[index]; } /// Return the element at the specified index. /** * If the specified index is not within the valid bounds * of the static array list, then an exception is thrown indicating * an index out of bounds error occurred. This is the non-const version * of the get() method, allowing modification of the element via the * returned non-const reference. * * @param index - the index of the desired element. * @return a reference to the element at the index specified by the parameter. */ RIM_INLINE T& get( Index index ) { RIM_DEBUG_ASSERT( index < numElements ); return array[index]; } /// Return a reference to the first element in the static array list. RIM_INLINE T& getFirst() { RIM_DEBUG_ASSERT( numElements != Size(0) ); return *array; } /// Return a const reference to the first element in the static array list. RIM_INLINE const T& getFirst() const { RIM_DEBUG_ASSERT( numElements != Size(0) ); return *array; } /// Return a reference to the last element in the static array list. RIM_INLINE T& getLast() { RIM_DEBUG_ASSERT( numElements != Size(0) ); return *(array + numElements - 1); } /// Return a const reference to the last element in the static array list. RIM_INLINE const T& getLast() const { RIM_DEBUG_ASSERT( numElements != Size(0) ); return *(array + numElements - 1); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Element Accessor Operators /// Return the element at the specified index. /** * If the specified index is not within the valid bounds * of the static array list, then an exception is thrown indicating * an index out of bounds error occurred. This is the const version * of the operator (), disallowing modification of the element. * * @param index - the index of the desired element. * @return a const reference to the element at the index specified by the parameter. */ RIM_INLINE const T& operator () ( Index index ) const { RIM_DEBUG_ASSERT( index < numElements ); return array[index]; } /// Return the element at the specified index. /** * If the specified index is not within the valid bounds * of the static array list, then an exception is thrown indicating * an index out of bounds error occurred. This is the non-const version * of the operator (), allowing modification of the element via the * returned non-const reference. * * @param index - the index of the desired element. * @return a reference to the element at the index specified by the parameter. */ RIM_INLINE T& operator () ( Index index ) { RIM_DEBUG_ASSERT( index < numElements ); return array[index]; } /// Get a const pointer to the first element in the static array list. RIM_INLINE operator const T* () const { return array; } /// Get a pointer to the first element in the static array list. RIM_INLINE operator T* () { return array; } /// Return a const pointer to the beginning of the internal array. RIM_INLINE const T* getPointer() const { return array; } /// Return a pointer to the beginning of the internal array. RIM_INLINE T* getPointer() { return array; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Size Accessor Methods /// Return whether or not the static array list has any elements. /** * This method returns TRUE if the size of the static array list * is greater than zero, and FALSE otherwise. * This method is here for convenience. * * @return whether or not the static array list has any elements. */ RIM_INLINE Bool isEmpty() const { return numElements == 0; } /// Get the number of elements in the static array list. /** * @return the number of elements in the static array list. */ RIM_INLINE Size getSize() const { return numElements; } /// Get the capacity of the static array list. /** * The capacity is the maximum number of elements that the * static array list can hold. This value does not change during * the lifetime of the static array list, hence the name. * * @return the current capacity of the static array list. */ RIM_INLINE Size getCapacity() const { return capacity; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Iterator Class /// Iterator class for an static array list. /** * The purpose of this class is to iterate through all * or some of the elements in the static array list, making changes as * necessary to the elements. */ class Iterator { public: //******************************************** // Constructor /// Create a new static array list iterator from a reference to a list. RIM_INLINE Iterator( StaticArrayList<T,capacity>& newList ) : list( newList ), current( newList.array ), end( newList.array + newList.numElements ) { } //******************************************** // Public Methods /// Prefix increment operator. RIM_INLINE void operator ++ () { current++; } /// Postfix increment operator. RIM_INLINE void operator ++ ( int ) { current++; } /// Return whether or not the iterator is at the end of the list. /** * If the iterator is at the end of the list, return FALSE. * Otherwise, return TRUE, indicating that there are more * elements to iterate over. * * @return FALSE if at the end of list, otherwise TRUE. */ RIM_INLINE operator Bool () const { return current < end; } /// Return a reference to the current iterator element. RIM_INLINE T& operator * () { return *current; } /// Access the current iterator element. RIM_INLINE T* operator -> () { return current; } /// Remove the current element from the list. /** * This method calls the removeAtIndex() method of the * iterated static array list, and therefore has an average * time complexity of O(n/2) where n is the size of the * array list. */ RIM_INLINE void remove() { list.removeAtIndex( getIndex() ); current = current == list.array ? current : current - 1; end--; } /// Remove the current element from the list. /** * This method calls the removeAtIndexUnordered() method of the * iterated static array list, and therefore has an average * time complexity of O(1). */ RIM_INLINE void removeUnordered() { list.removeAtIndexUnordered( getIndex() ); current = current == list.array ? current : current - 1; end--; } /// Reset the iterator to the beginning of the list. RIM_INLINE void reset() { current = list.array; end = current + list.numElements; } /// Get the index of the next element to be iterated over. RIM_INLINE Index getIndex() { return current - list.array; } private: //******************************************** // Private Data Members /// The current position of the iterator T* current; /// A pointer to one element past the end of the list. const T* end; /// The list that is being iterated over. StaticArrayList<T,capacity>& list; /// Make the const iterator class a friend. friend class StaticArrayList<T,capacity>::ConstIterator; }; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** ConstIterator Class /// An iterator class for a static array list which can't modify it. /** * The purpose of this class is to iterate through all * or some of the elements in the static array list. */ class ConstIterator { public: //******************************************** // Constructor /// Create a new static array list iterator from a reference to a list. RIM_INLINE ConstIterator( const StaticArrayList<T,capacity>& newList ) : list( newList ), current( newList.array ), end( newList.array + newList.numElements ) { } /// Create a new const static array list iterator from a non-const iterator. RIM_INLINE ConstIterator( const Iterator& iterator ) : list( iterator.list ), current( iterator.current ), end( iterator.end ) { } //******************************************** // Public Methods /// Prefix increment operator. RIM_INLINE void operator ++ () { current++; } /// Postfix increment operator. RIM_INLINE void operator ++ ( int ) { current++; } /// Return whether or not the iterator is at the end of the list. /** * If the iterator is at the end of the list, return FALSE. * Otherwise, return TRUE, indicating that there are more * elements to iterate over. * * @return FALSE if at the end of list, otherwise TRUE. */ RIM_INLINE operator Bool () const { return current < end; } /// Return a const-reference to the current iterator element. RIM_INLINE const T& operator * () const { return *current; } /// Access the current iterator element. RIM_INLINE const T* operator -> () const { return current; } /// Reset the iterator to the beginning of the list. RIM_INLINE void reset() { current = list.array; end = current + list.numElements; } /// Get the index of the next element to be iterated over. RIM_INLINE Index getIndex() const { return current - list.array; } private: //******************************************** // Private Data Members /// The current position of the iterator const T* current; /// A pointer to one element past the end of the list. const T* end; /// The list that is being iterated over. const StaticArrayList<T,capacity>& list; }; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Iterator Creation Methods /// Return an iterator for the static array list. /** * The iterator serves to provide a way to efficiently iterate * over the elements of the static array list. It is more useful for * a linked list type of data structure, but it is provided for * uniformity among data structures. * * @return an iterator for the static array list. */ RIM_INLINE Iterator getIterator() { return Iterator(*this); } /// Return a const iterator for the static array list. /** * The iterator serves to provide a way to efficiently iterate * over the elements of the static array list. It is more useful for * a linked list type of data structure, but it is provided for * uniformity among data structures. * * @return an iterator for the static array list. */ RIM_INLINE ConstIterator getIterator() const { return ConstIterator(*this); } private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Methods RIM_INLINE static void callDestructors( T* array, Size number ) { const T* const arrayEnd = array + number; while ( array != arrayEnd ) { array->~T(); array++; } } RIM_INLINE static void copyObjects( T* destination, const T* source, Size number ) { const T* const sourceEnd = source + number; while ( source != sourceEnd ) { new (destination) T(*source); destination++; source++; } } RIM_INLINE static void moveObjects( T* destination, const T* source, Size number ) { const T* const sourceEnd = source + number; while ( source != sourceEnd ) { // copy the object from the source to destination new (destination) T(*source); // call the destructors on the source source->~T(); destination++; source++; } } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Members /// The array holding all elements in this static array list. T* array; /// The number of elements in the static array list. Size numElements; /// The array of bytes used to allocate memory for the array. UByte data[capacity*sizeof(T)]; }; //########################################################################################## //*************************** End Rim Utilities Namespace ******************************** RIM_UTILITIES_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_STATIC_ARRAY_LIST_H <file_sep>/* * rimGraphicsGUIOrigin.h * Rim Graphics GUI * * Created by <NAME> on 1/22/13. * Copyright 2013 Headspace Systems. All rights reserved. * */ #ifndef INCLUDE_RIM_GRAPHICS_GUI_ORIGIN_H #define INCLUDE_RIM_GRAPHICS_GUI_ORIGIN_H #include "rimGraphicsGUIUtilitiesConfig.h" //########################################################################################## //******************* Start Rim Graphics GUI Utilities Namespace ************************* RIM_GRAPHICS_GUI_UTILITIES_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class which represents the location of the origin of a GUI rectangle coordinate system. class Origin { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Public Enum Declaration /// An enum which specifies the different types of horizontal coordinate origins. typedef enum XOrigin { /// An origin that is at the minimum X coordinate of a rectangular region. X_MIN = 1, /// An origin that is at the center X coordinate of a rectangular region. X_CENTER = 2, /// An origin that is at the maximum X coordinate of a rectangular region. X_MAX = 4, /// A coordinate origin that lies to the left of a rectangular region. LEFT = X_MIN, /// A coordinate origin that is horizontally centered within a rectangular region. HORIZONTAL_CENTER = X_CENTER, /// A coordinate origin that lies to the right of a rectangular region. RIGHT = X_MAX }; /// An enum which specifies the different types of vertical coordinate origins. typedef enum YOrigin { /// An origin that is at the minimum Y coordinate of a rectangular region. Y_MIN = 1, /// An origin that is at the center Y coordinate of a rectangular region. Y_CENTER = 2, /// An origin that is at the maximum Y coordinate of a rectangular region. Y_MAX = 4, /// A coordinate origin that lies to the bottom of a rectangular region. BOTTOM = Y_MIN, /// A coordinate origin that is vertically centered within a rectangular region. VERTICAL_CENTER = Y_CENTER, /// A coordinate origin that lies to the top of a rectangular region. TOP = Y_MAX }; /// An enum which specifies the different types of depth coordinate origins. typedef enum ZOrigin { /// An origin that is at the minimum Z coordinate of a rectangular region. Z_MIN = 1, /// An origin that is at the center Z coordinate of a rectangular region. Z_CENTER = 2, /// An origin that is at the maximum Z coordinate of a rectangular region. Z_MAX = 4, /// A coordinate origin that lies to the back of a 3D rectangular region. BACK = Z_MIN, /// A coordinate origin that is depth centered within a rectangular region. DEPTH_CENTER = Z_CENTER, /// A coordinate origin that lies to the front of a 3D rectangular region. FRONT = Z_MAX }; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructors /// Create a new default coordinate origin, the bottom-left corner. RIM_INLINE Origin() : xOrigin( X_MIN ), yOrigin( Y_MIN ), zOrigin( Z_CENTER ) { } /// Create a new coordinate origin using the specified horizontal and vertical origin alignments. RIM_INLINE Origin( XOrigin newXOrigin, YOrigin newYOrigin ) : xOrigin( newXOrigin ), yOrigin( newYOrigin ), zOrigin( Z_CENTER ) { } /// Create a new coordinate origin using the specified horizontal and vertical origin alignments. RIM_INLINE Origin( XOrigin newXOrigin, YOrigin newYOrigin, ZOrigin newZOrigin ) : xOrigin( newXOrigin ), yOrigin( newYOrigin ), zOrigin( newZOrigin ) { } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Horizontal Origin Accessor Methods /// Return an enum value indicating the alignment of the horizontal axis of the coordinate system. RIM_INLINE XOrigin getX() const { return static_cast<XOrigin>( xOrigin ); } /// Set an enum value indicating the alignment of the horizontal axis of the coordinate system. RIM_INLINE void setX( XOrigin newXOrigin ) { xOrigin = static_cast<UByte>( newXOrigin ); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Vertical Origin Accessor Methods /// Return an enum value indicating the alignment of the vertical axis of the coordinate system. RIM_INLINE YOrigin getY() const { return static_cast<YOrigin>( yOrigin ); } /// Set an enum value indicating the alignment of the vertical axis of the coordinate system. RIM_INLINE void setY( YOrigin newYOrigin ) { yOrigin = static_cast<UByte>( newYOrigin ); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Depth Origin Accessor Methods /// Return an enum value indicating the alignment of the depth axis of the coordinate system. RIM_INLINE ZOrigin getZ() const { return static_cast<ZOrigin>( zOrigin ); } /// Set an enum value indicating the alignment of the depth axis of the coordinate system. RIM_INLINE void setZ( ZOrigin newZOrigin ) { zOrigin = static_cast<UByte>( newZOrigin ); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Equality Comparison Operators /// Return whether or not this coordinate origin object is the same as another. RIM_INLINE Bool operator == ( const Origin& other ) const { return xOrigin == other.xOrigin && yOrigin == other.yOrigin && zOrigin == other.zOrigin; } /// Return whether or not this coordinate origin object is different than another. RIM_INLINE Bool operator != ( const Origin& other ) const { return xOrigin != other.xOrigin || yOrigin != other.yOrigin || zOrigin != other.zOrigin; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Origin Offset Accessor Method /// Return a vector indicating the origin offset from the bottom left (minimum) coordinate of a parent bounding box. /** * The 2D vector indicates, relative to the minimum corner of the parent bounding box * with the specified 2D size, the direction and distance to this origin's position. */ Vector2f getOffset( const Vector2f& parentSize, const Vector2f& childSize ) const; /// Return a vector indicating the origin offset from the bottom left (minimum) coordinate of a parent bounding box. /** * The 3D vector indicates, relative to the minimum corner of the parent bounding box * with the specified 3D size, the direction and distance to this origin's position. */ Vector3f getOffset( const Vector3f& parentSize, const Vector3f& childSize ) const; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** String Representation Accessor Methods /// Return a string representation of the origin type. String toString() const; /// Convert this origin type into a string representation. RIM_INLINE operator String () const { return this->toString(); } private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Members /// An enum value indicating the alignment of the horizontal axis of the coordinate system. UByte xOrigin; /// An enum value indicating the alignment of the vertical axis of the coordinate system. UByte yOrigin; /// An enum value indicating the alignment of the depth axis of the coordinate system. UByte zOrigin; }; //########################################################################################## //******************* End Rim Graphics GUI Utilities Namespace *************************** RIM_GRAPHICS_GUI_UTILITIES_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_GRAPHICS_GUI_ORIGIN_H <file_sep>/* * Fixed.h * Rim Math * * Created by <NAME> on 11/6/07. * Copyrivalueht 2007 Rim Software. All rivaluehts reserved. * */ #ifndef INCLUDE_RIM_FIXED_H #define INCLUDE_RIM_FIXED_H #include "rimMathConfig.h" //########################################################################################## //***************************** Start Rim Math Namespace ********************************* RIM_MATH_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class which represents a fixed-point number. template < typename BaseType, Size fractionalBits > class Fixed { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructors RIM_FORCE_INLINE Fixed() : value( BaseType(0) ) { } RIM_FORCE_INLINE Fixed( float a ) : value( BaseType(a*FLOAT_SHIFT) ) { } RIM_FORCE_INLINE Fixed( double a ) : value( BaseType(a*DOUBLE_SHIFT) ) { } RIM_FORCE_INLINE Fixed( int a ) : value( BaseType(a) << fractionalBits ) { } RIM_FORCE_INLINE Fixed( unsigned int a ) : value( BaseType(a) << fractionalBits ) { } RIM_FORCE_INLINE Fixed( long a ) : value( BaseType(a) << fractionalBits ) { } RIM_FORCE_INLINE Fixed( unsigned long a ) : value( BaseType(a) << fractionalBits ) { } RIM_FORCE_INLINE Fixed( long long a ) : value( BaseType(a) << fractionalBits ) { } RIM_FORCE_INLINE Fixed( unsigned long long a ) : value( BaseType(a) << fractionalBits ) { } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Assignment Operator template < typename PrimitiveType > RIM_FORCE_INLINE Fixed& operator = ( PrimitiveType a ) { value = Fixed(a).value; return *this; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Type Conversion Operators RIM_FORCE_INLINE operator float () const { return float(value) * INVERSE_FLOAT_SHIFT; } RIM_FORCE_INLINE operator double () const { return double(value) * INVERSE_DOUBLE_SHIFT; } RIM_FORCE_INLINE operator int () const { return value >> fractionalBits; } RIM_FORCE_INLINE operator unsigned int () const { return value >> fractionalBits; } RIM_FORCE_INLINE operator long () const { return value >> fractionalBits; } RIM_FORCE_INLINE operator unsigned long () const { return value >> fractionalBits; } RIM_FORCE_INLINE operator long long () const { return value >> fractionalBits; } RIM_FORCE_INLINE operator unsigned long long () const { return value >> fractionalBits; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Comparison Operators RIM_FORCE_INLINE Bool operator == ( const Fixed& other ) const { return value == other.value; } RIM_FORCE_INLINE Bool operator != ( const Fixed& other ) const { return value != other.value; } RIM_FORCE_INLINE Bool operator <= ( const Fixed& other ) const { return value <= other.value; } RIM_FORCE_INLINE Bool operator >= ( const Fixed& other ) const { return value >= other.value; } RIM_FORCE_INLINE Bool operator < ( const Fixed& other ) const { return value < other.value; } RIM_FORCE_INLINE Bool operator > ( const Fixed& other ) const { return value > other.value; } template < typename PrimitiveType > RIM_FORCE_INLINE Bool operator == ( PrimitiveType other ) const { return value == Fixed(other).value; } template < typename PrimitiveType > RIM_FORCE_INLINE Bool operator != ( PrimitiveType other ) const { return value != Fixed(other).value; } template < typename PrimitiveType > RIM_FORCE_INLINE Bool operator <= ( PrimitiveType other ) const { return value <= Fixed(other).value; } template < typename PrimitiveType > RIM_FORCE_INLINE Bool operator >= ( PrimitiveType other ) const { return value >= Fixed(other).value; } template < typename PrimitiveType > RIM_FORCE_INLINE Bool operator < ( PrimitiveType other ) const { return value < Fixed(other).value; } template < typename PrimitiveType > RIM_FORCE_INLINE Bool operator > ( PrimitiveType other ) const { return value > Fixed(other).value; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Sign Change Operators RIM_FORCE_INLINE Fixed operator + () const { return Fixed( value, 0 ); } RIM_FORCE_INLINE Fixed operator - () const { return Fixed( -value, 0 ); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Arithmetic Operators RIM_FORCE_INLINE Fixed operator + ( const Fixed& other ) const { return Fixed( value + other.value, 0 ); } RIM_FORCE_INLINE Fixed operator - ( const Fixed& other ) const { return Fixed( value - other.value, 0 ); } RIM_FORCE_INLINE Fixed operator * ( const Fixed& other ) const { return Fixed( (value * other.value) >> fractionalBits, 0 ); } RIM_FORCE_INLINE Fixed operator / ( const Fixed& other ) const { return Fixed( BaseType((double(value) / double(other.value))*DOUBLE_SHIFT), 0 ); } template < typename PrimitiveType > RIM_FORCE_INLINE Fixed operator + ( PrimitiveType value ) const { return (*this) + Fixed(value); } template < typename PrimitiveType > RIM_FORCE_INLINE Fixed operator - ( PrimitiveType value ) const { return (*this) - Fixed(value); } template < typename PrimitiveType > RIM_FORCE_INLINE Fixed operator * ( PrimitiveType value ) const { return (*this) * Fixed(value); } template < typename PrimitiveType > RIM_FORCE_INLINE Fixed operator / ( PrimitiveType value ) const { return (*this) / Fixed(value); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Arithmetic Assignment Operators RIM_FORCE_INLINE Fixed& operator += ( const Fixed& other ) const { value += other.value; return *this; } RIM_FORCE_INLINE Fixed& operator -= ( const Fixed& other ) const { value -= other.value; return *this; } RIM_FORCE_INLINE Fixed& operator *= ( const Fixed& other ) const { value = (value * other.value) >> fractionalBits; return *this; } RIM_FORCE_INLINE Fixed& operator /= ( const Fixed& other ) const { value = BaseType((double(value) / double(other.value))*DOUBLE_SHIFT); return *this; } template < typename PrimitiveType > RIM_FORCE_INLINE Fixed& operator += ( PrimitiveType value ) const { value = ((*this) + Fixed(value)).value; return *this; } template < typename PrimitiveType > RIM_FORCE_INLINE Fixed& operator -= ( PrimitiveType value ) const { value = ((*this) - Fixed(value)).value; return *this; } template < typename PrimitiveType > RIM_FORCE_INLINE Fixed& operator *= ( PrimitiveType value ) const { value = ((*this) * Fixed(value)).value; return *this; } template < typename PrimitiveType > RIM_FORCE_INLINE Fixed& operator /= ( PrimitiveType value ) const { value = ((*this) / Fixed(value)).value; return *this; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** String Conversion Methods /// Convert this vector into a human-readable string representation. RIM_NO_INLINE data::String toString() const { return data::String( (Double)(*this) ); } /// Convert this vector into a human-readable string representation. RIM_FORCE_INLINE operator data::String () const { return this->toString(); } private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Constructor RIM_FORCE_INLINE Fixed( BaseType newValue, int ) : value( newValue ) { } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Static Constants static const Size fractionalBits2 = fractionalBits*2; static const BaseType SHIFT = BaseType(1) << fractionalBits; static const float FLOAT_SHIFT; static const double DOUBLE_SHIFT; static const float INVERSE_FLOAT_SHIFT; static const double INVERSE_DOUBLE_SHIFT; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Member /// The underlying value which stores the fixed point number. BaseType value; }; template < typename BaseType, Size fractionalBits > const float Fixed<BaseType,fractionalBits>:: FLOAT_SHIFT = float(SHIFT); template < typename BaseType, Size fractionalBits > const double Fixed<BaseType,fractionalBits>:: DOUBLE_SHIFT = double(SHIFT); template < typename BaseType, Size fractionalBits > const float Fixed<BaseType,fractionalBits>:: INVERSE_FLOAT_SHIFT = 1.0f/FLOAT_SHIFT; template < typename BaseType, Size fractionalBits > const double Fixed<BaseType,fractionalBits>:: INVERSE_DOUBLE_SHIFT = 1.0/DOUBLE_SHIFT; //########################################################################################## //########################################################################################## //############ //############ Commutative Comparison Operators //############ //########################################################################################## //########################################################################################## template < typename PrimitiveType, typename BaseType, Size fractionalBits > RIM_FORCE_INLINE Bool operator == ( PrimitiveType a, const Fixed<BaseType,fractionalBits>& b ) { return Fixed<BaseType,fractionalBits>(a) == b; } template < typename PrimitiveType, typename BaseType, Size fractionalBits > RIM_FORCE_INLINE Bool operator != ( PrimitiveType a, const Fixed<BaseType,fractionalBits>& b ) { return Fixed<BaseType,fractionalBits>(a) != b; } template < typename PrimitiveType, typename BaseType, Size fractionalBits > RIM_FORCE_INLINE Bool operator <= ( PrimitiveType a, const Fixed<BaseType,fractionalBits>& b ) { return Fixed<BaseType,fractionalBits>(a) <= b; } template < typename PrimitiveType, typename BaseType, Size fractionalBits > RIM_FORCE_INLINE Bool operator >= ( PrimitiveType a, const Fixed<BaseType,fractionalBits>& b ) { return Fixed<BaseType,fractionalBits>(a) >= b; } template < typename PrimitiveType, typename BaseType, Size fractionalBits > RIM_FORCE_INLINE Bool operator < ( PrimitiveType a, const Fixed<BaseType,fractionalBits>& b ) { return Fixed<BaseType,fractionalBits>(a) < b; } template < typename PrimitiveType, typename BaseType, Size fractionalBits > RIM_FORCE_INLINE Bool operator > ( PrimitiveType a, const Fixed<BaseType,fractionalBits>& b ) { return Fixed<BaseType,fractionalBits>(a) > b; } //########################################################################################## //########################################################################################## //############ //############ Commutative Arithmetic Operators //############ //########################################################################################## //########################################################################################## template < typename PrimitiveType, typename BaseType, Size fractionalBits > RIM_FORCE_INLINE Fixed<BaseType,fractionalBits> operator + ( PrimitiveType a, const Fixed<BaseType,fractionalBits>& b ) { return Fixed<BaseType,fractionalBits>(a) + b; } template < typename PrimitiveType, typename BaseType, Size fractionalBits > RIM_FORCE_INLINE Fixed<BaseType,fractionalBits> operator - ( PrimitiveType a, const Fixed<BaseType,fractionalBits>& b ) { return Fixed<BaseType,fractionalBits>(a) - b; } template < typename PrimitiveType, typename BaseType, Size fractionalBits > RIM_FORCE_INLINE Fixed<BaseType,fractionalBits> operator * ( PrimitiveType a, const Fixed<BaseType,fractionalBits>& b ) { return Fixed<BaseType,fractionalBits>(a) * b; } template < typename PrimitiveType, typename BaseType, Size fractionalBits > RIM_FORCE_INLINE Fixed<BaseType,fractionalBits> operator / ( PrimitiveType a, const Fixed<BaseType,fractionalBits>& b ) { return Fixed<BaseType,fractionalBits>(a) / b; } //########################################################################################## //########################################################################################## //############ //############ Commutative Arithmetic Assignment Operators //############ //########################################################################################## //########################################################################################## template < typename PrimitiveType, typename BaseType, Size fractionalBits > RIM_FORCE_INLINE PrimitiveType& operator += ( PrimitiveType& a, const Fixed<BaseType,fractionalBits>& b ) { return a = (PrimitiveType)(Fixed<BaseType,fractionalBits>(a) + b); } template < typename PrimitiveType, typename BaseType, Size fractionalBits > RIM_FORCE_INLINE PrimitiveType& operator -= ( PrimitiveType& a, const Fixed<BaseType,fractionalBits>& b ) { return a = (PrimitiveType)(Fixed<BaseType,fractionalBits>(a) - b); } template < typename PrimitiveType, typename BaseType, Size fractionalBits > RIM_FORCE_INLINE PrimitiveType& operator *= ( PrimitiveType& a, const Fixed<BaseType,fractionalBits>& b ) { return a = (PrimitiveType)(Fixed<BaseType,fractionalBits>(a) * b); } template < typename PrimitiveType, typename BaseType, Size fractionalBits > RIM_FORCE_INLINE PrimitiveType& operator /= ( PrimitiveType& a, const Fixed<BaseType,fractionalBits>& b ) { return a = (PrimitiveType)(Fixed<BaseType,fractionalBits>(a) / b); } //########################################################################################## //***************************** End Rim Math Namespace *********************************** RIM_MATH_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_FIXED_H <file_sep>/* * rimDate.h * Rim Time * * Created by <NAME> on 5/30/08. * Copyright 2008 __MyCompanyName__. All rights reserved. * */ #ifndef INCLUDE_RIM_DATE_H #define INCLUDE_RIM_DATE_H #include "rimTimeConfig.h" #include "rimMonth.h" #include "rimDay.h" #include "rimTimeOfDay.h" //########################################################################################## //******************************* Start Time Namespace ********************************* RIM_TIME_NAMESPACE_START //****************************************************************************************** //########################################################################################## class Time; //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class which represents an instant in time within the modern calendar. class Date { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructors /// Create a date object which represents the current date. Date(); /// Create a date corresponding to the specified Time offset since the Epoch, 1970-01-01 00:00:00 +0000 (UTC). Date( const Time& time ); /// Create a date corresponding to the specified year, month, and day, at the first instant of the day. RIM_INLINE Date( Int64 newYear, const Month& newMonth, const Day& newDay ) : year( newYear ), month( newMonth ), day( newDay ) { } /// Create a date corresponding to the specified year, month, day, and time of day. RIM_INLINE Date( Int64 newYear, const Month& newMonth, const Day& newDay, const TimeOfDay& newTimeOfDay ) : year( newYear ), month( newMonth ), day( newDay ), timeOfDay( newTimeOfDay ) { } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Month Accessor Methods /// Return the year of this date. Values are interpreted as relative to the year 0 AD. RIM_INLINE Int64 getYear() const { return year; } /// Set the year of this date. Values are interpreted as relative to the year 0 AD. RIM_INLINE void setYear( Int64 newYear ) { year = newYear; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Month Accessor Methods /// Return a reference to an object which represents the month of this date. RIM_INLINE const Month& getMonth() const { return month; } /// Set the month of this date. RIM_INLINE void setMonth( const Month& newMonth ) { month = newMonth; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Day Accessor Methods /// Return a reference to an object which represents the day of this date. RIM_INLINE const Day& getDay() const { return day; } /// Set the day of this date. RIM_INLINE void setDay( const Day& newDay ) { day = newDay; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Time Of Day Accessor Methods /// Return a reference to an object which represents the time of day of this date. RIM_INLINE const TimeOfDay& getTimeOfDay() const { return timeOfDay; } /// Set the time of day of this date. RIM_INLINE void setTimeOfDay( const TimeOfDay& newTimeOfDay ) { timeOfDay = newTimeOfDay; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** String Conversion Methods /// Convert the Date object to a String representation. data::String toString() const; /// Convert the Date object to a String representation. RIM_FORCE_INLINE operator data::String() const { return this->toString(); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Static Time Zone Accessor Methods /// Get the current time zone that dates are being processed as being in. /** * The time zone is specified as the signed offset in hours from GMT. * * The default initial value for the time zone is the local time zone. */ static Int getTimeZone(); /// Get the local time zone. /** * The time zone is specified as the signed offset in hours from GMT. */ static Int getLocalTimeZone(); /// Set the time zone to use when computing the hour of the day. /** * The time zone is specified as the signed offset in hours from GMT. * * The default initial value for the time zone is the local time zone. */ RIM_INLINE static void setTimeZone( Int newTimeZone ) { timeZone = newTimeZone; timeZoneIsInitialized = true; } private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Static Helper Methods /// Get the date for the time specified by the Time object. static void getDateForTimeSinceEpoch( const Time& time, Int64& year, Month& month, Day& day, TimeOfDay& timeOfDay ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Members /// An integer representing the year of this Date. Int64 year; /// The month of this Date object. Month month; /// The day of this Date object. Day day; /// The time of day of this date. TimeOfDay timeOfDay; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Static Data Members static Int timeZone; static Bool timeZoneIsInitialized; }; //########################################################################################## //******************************* End Time Namespace *********************************** RIM_TIME_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_DATE_H <file_sep>/* * rimPhysicsRigidObjectCollider.h * Rim Physics * * Created by <NAME> on 11/28/09. * Copyright 2009 Rim Software. All rights reserved. * */ #ifndef INCLUDE_RIM_PHYSICS_RIGID_OBJECT_COLLIDER_H #define INCLUDE_RIM_PHYSICS_RIGID_OBJECT_COLLIDER_H #include "rimPhysicsObjectsConfig.h" #include "rimPhysicsObjectCollider.h" #include "rimPhysicsRigidObject.h" //########################################################################################## //*********************** Start Rim Physics Objects Namespace **************************** RIM_PHYSICS_OBJECTS_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class which contains collision data for a RigidObject. /** * This class contains a pointer to a RigidObject and a pointer to a * CollisionShapeInstance which is being tested for collision. This is * necessary because an object could potentailly have more than one shape * (such as via shape hierarchies). */ template <> class ObjectCollider<RigidObject> { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructors /// Create a ObjectCollider object which encapsulates the specified object and shape instance. RIM_FORCE_INLINE ObjectCollider( const RigidObject* newObject, const CollisionShapeInstance* newShape ) : object( newObject ), shape( newShape ) { RIM_DEBUG_ASSERT_MESSAGE( newObject != NULL, "Cannot use NULL RigidObject in ObjectCollider" ); RIM_DEBUG_ASSERT_MESSAGE( newShape != NULL, "Cannot use NULL shape instance in ObjectCollider" ); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Object Accessor Methods /// Return a pointer to the object that constitutes this ObjectCollider. RIM_FORCE_INLINE const RigidObject* getObject() const { return object; } /// Set a pointer to the object that constitutes this ObjectCollider. RIM_FORCE_INLINE void setObject( const RigidObject* newObject ) { object = newObject; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Shape Accessor Methods /// Return a pointer to the collision shape instance that constitutes this ObjectCollider. RIM_FORCE_INLINE const CollisionShapeInstance* getShape() const { return shape; } /// Set a pointer to the collision shape instance that constitutes this ObjectCollider. RIM_FORCE_INLINE void setShape( const CollisionShapeInstance* newShape ) { shape = newShape; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Collider Type Accessor Methods /// Return a const reference the collision shape type for this ObjectCollider. RIM_FORCE_INLINE const CollisionShapeType& getType() const { return shape->getType(); } /// Return an integral identifier for this collider's collision shape type. RIM_FORCE_INLINE CollisionShapeTypeID getTypeID() const { return shape->getTypeID(); } private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Members /// A pointer to the object that constitutes this ObjectCollider. const RigidObject* object; /// The specific shape instance of this collider's object that is being tested for collisions. const CollisionShapeInstance* shape; }; //########################################################################################## //*********************** End Rim Physics Objects Namespace ****************************** RIM_PHYSICS_OBJECTS_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_PHYSICS_RIGID_OBJECT_COLLIDER_H <file_sep>/* * rimPhysicsEPASolver.h * Rim Physics * * Created by <NAME> on 9/3/08. * Copyright 2008 Rim Software. All rights reserved. * */ #ifndef INCLUDE_RIM_PHYSICS_EPA_SOLVER_H #define INCLUDE_RIM_PHYSICS_EPA_SOLVER_H #include "rimPhysicsUtilitiesConfig.h" #include "rimPhysicsMinkowskiVertex.h" #include "rimPhysicsEPAResult.h" //########################################################################################## //********************** Start Rim Physics Utilities Namespace *************************** RIM_PHYSICS_UTILITIES_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class which iteratively refines a GJK simplex to approximate the shape surface at the collision point. /** * Since the output of the GJKSolver is just a simplex containing the origin, * without any contact information, the EPASolver class refines that simplex so that * one face of it lies near the surface of the convex shapes that are intersecting. * This class can be used to generate better contact information than would be possible * with just GJK. */ class EPASolver { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructors /// Create a default EPASolver object with the default max number of iterations. RIM_INLINE EPASolver() : maximumNumberOfIterations( DEFAULT_MAXIMUM_NUMBER_OF_ITERATIONS ) { } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Solve Method /// Iteratively refine the specified GJK simplex. /** * This method iteratively adds triangles to the given simplex * that better approximate the minkowski difference between two convex * shapes. The method returns the triangle that is closest to the surface * of the shapes' minkowski difference. This triangle can then be used to * generate a point of contact on each shape. */ template < typename UserDataType1, typename UserDataType2, MinkowskiVertex3 (*getSupportPoint)( const Vector3&, const UserDataType1*, const UserDataType2* ) > EPAResult solve( const StaticArray<MinkowskiVertex3,4>& simplex, Real terminationThreshold, const UserDataType1* userData1 = NULL, const UserDataType2* userDat2 = NULL ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Maximum Number of Iterations Accessor Methods /// Return the maximum number of iterations that this GJK solver can perform. /** * An upper bound to the number of iterations is necessary so that degenerate * cases don't produce an infinite solver loop. Values in the range of 10 to 30 * are typical good iteration count limits. Your mileage may vary. */ RIM_FORCE_INLINE Size getMaximumNumberOfIterations() const { return maximumNumberOfIterations; } /// Set the maximum number of iterations that this GJK solver can perform. /** * An upper bound to the number of iterations is necessary so that degenerate * cases don't produce an infinite solver loop. Values in the range of 10 to 30 * are typical good iteration count limits. Your mileage may vary. */ RIM_FORCE_INLINE void setMaximumNumberOfIterations( Size newMaximumNumberOfIterations ) { maximumNumberOfIterations = newMaximumNumberOfIterations; } private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** EPA Triangle Class /// A class which holds data about a triangle in the EPA algorithm. class EPATriangle; /// A class which holds the vertex indices of an edge's endpoints. class EPAEdge; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Helper Methods /// Add a vertex to the expanding polytope, removing and adding triangles necessary to maintain convexity. void addNewVertex( const MinkowskiVertex3& newVertex ); /// Create a new triangle with the specified vertex indices and add it to this EPA solver's triangle queue. /** * The back vertex index parameter indicates the index of a vertex which should be * behind the created triangle (the normal should point away from this vertex). */ RIM_FORCE_INLINE void addNewTriangle( Index v1, Index v2, Index v3, Index backVertex ); /// Non-inline version of addNewTriangle() for non performance-critical applications. void addNewTriangleNoInline( Index v1, Index v2, Index v3, Index backVertex ); /// Initialize the EPA data structures for the specified GJK termination simplex. void initializeDataStructures( const StaticArray<MinkowskiVertex3,4>& simplex ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Members /// A queue of EPA triangles, sorted by increasing distance from the origin. PriorityQueue<EPATriangle> triangleQueue; /// A list of all of the current minkowski vertices in this EPA solver. ArrayList<MinkowskiVertex3> vertices; /// A list of edges that need to be connected to a new EPA vertex by triangles. ArrayList<EPAEdge> edgesToFill; /// The maximum allowed number of iterations for this EPA solver. Size maximumNumberOfIterations; /// The default starting maximum number of iterations that this EPA solver performs. static const Size DEFAULT_MAXIMUM_NUMBER_OF_ITERATIONS = 64; }; //########################################################################################## //########################################################################################## //############ //############ EPA Triangle Class Definition //############ //########################################################################################## //########################################################################################## class EPASolver:: EPATriangle { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructor /// Create a new EPA triangle from the specified vertex indices and plane. RIM_INLINE EPATriangle( Index newV1, Index newV2, Index newV3, const Plane3& newPlane ) : v1( newV1 ), v2( newV2 ), v3( newV3 ), plane( newPlane ), distance( math::abs( newPlane.offset ) ) { } /// Create a new EPA triangle from the specified vertex indices and vertices RIM_INLINE EPATriangle( Index newV1, Index newV2, Index newV3, const ArrayList<MinkowskiVertex3>& vertices ) : v1( newV1 ), v2( newV2 ), v3( newV3 ), plane( vertices[newV1], vertices[newV2], vertices[newV3] ) { if ( plane.offset <= Real(0) ) distance = -plane.offset; else { distance = plane.offset; plane = -plane; } } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Triangle Comparison Operators RIM_FORCE_INLINE Bool operator > ( const EPATriangle& triangle ) const { return distance < triangle.distance; } RIM_FORCE_INLINE Bool operator < ( const EPATriangle& triangle ) const { return distance > triangle.distance; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Public Data Members /// The index of the first vertex of this EPA triangle. Index v1; /// The index of the second vertex of this EPA triangle. Index v2; /// The index of the third vertex of this EPA triangle. Index v3; /// The plane of this EPA triangle in minkowski space. Plane3 plane; /// The offset of this triangle from the origin. Real distance; }; //########################################################################################## //########################################################################################## //############ //############ EPA Triangle Class Definition //############ //########################################################################################## //########################################################################################## class EPASolver:: EPAEdge { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructor /// Create a new EPA edge from the specified vertex indices. RIM_INLINE EPAEdge( Index newV1, Index newV2 ) : v1( newV1 ), v2( newV2 ) { } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Equality Comparison Operators /// Return whether or not this EPA edge is equal to another. RIM_FORCE_INLINE Bool operator == ( const EPAEdge& other ) const { if ( v1 == other.v1 ) return v2 == other.v2; else if ( v1 == other.v2 ) return v2 == other.v1; else return false; } /// Return whether or not this EPA edge is not equal to another. RIM_FORCE_INLINE Bool operator != ( const EPAEdge& other ) const { return !((*this) == other); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Public Data Members /// The index of the first vertex of this EPA edge. Index v1; /// The index of the second vertex of this EPA edge. Index v2; }; //########################################################################################## //########################################################################################## //############ //############ EPA Solve Method //############ //########################################################################################## //########################################################################################## template < typename UserDataType1, typename UserDataType2, MinkowskiVertex3 (*getSupportPoint)( const Vector3&, const UserDataType1*, const UserDataType2* ) > EPAResult EPASolver:: solve( const StaticArray<MinkowskiVertex3,4>& simplex, Real terminationThreshold, const UserDataType1* userData1, const UserDataType2* userData2 ) { // Add the four initial simplex triangles and vertices to start the algorithm. initializeDataStructures( simplex ); const EPATriangle* triangle = &triangleQueue[0]; for ( Index i = 0; i < maximumNumberOfIterations; i++ ) { // Get the triangle that is closest to the origin in minkowski space. triangle = &triangleQueue[0]; // Detect degenerate triangles before a support vertex is generated. // Stop the expansion due to the error and use the closest non-degenerate triangle. if ( math::isNAN( triangle->distance ) ) break; //************************************************************ // Find the support point farthest from the triangle and // from the origin. MinkowskiVertex3 supportPoint = getSupportPoint( triangle->plane.normal, userData1, userData2 ); // Terminate the algorithm if the algorithm is within the termination threshold // of the surface of the minkowski difference of the two shapes. if ( triangle->plane.getSignedDistanceTo( supportPoint ) < terminationThreshold ) break; // Add the support point to the expanding polytope, adding and removing any triangles // necessary to maintain the convex hull of the polytope's vertices. addNewVertex( supportPoint ); } // A final degeneracy check, sometimes (very rarely) this will happen // if a support vertex is generated that already exists numerically in the // set of polytope vertices, just use the closest valid triangle. while ( math::isNAN( triangle->distance ) ) { triangleQueue.remove(); triangle = &triangleQueue[0]; } return EPAResult( vertices[triangle->v1], vertices[triangle->v2], vertices[triangle->v3], triangle->distance ); } //########################################################################################## //********************** End Rim Physics Utilities Namespace ***************************** RIM_PHYSICS_UTILITES_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_PHYSICS_EPA_SOLVER_H <file_sep>/* * rimSoundGraphicEqualizer.h * Rim Sound * * Created by <NAME> on 11/30/12. * Copyright 2012 __MyCompanyName__. All rights reserved. * */ #ifndef INCLUDE_RIM_SOUND_GRAPHIC_EQUALIZER_H #define INCLUDE_RIM_SOUND_GRAPHIC_EQUALIZER_H #include "rimSoundFiltersConfig.h" #include "rimSoundFilter.h" #include "rimSoundParametricFilter.h" #include "rimSoundGainFilter.h" //########################################################################################## //************************ Start Rim Sound Filters Namespace ***************************** RIM_SOUND_FILTERS_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class that implements a 31-band graphic equalizer with variable-width filters. /** * This class provides a set of 31 variable-width parametric filters at fixed frequencies * spaced at 1/3 octave intervals. Each filter has its own gain control and the width * of all filters can be adjusted together. */ class GraphicEqualizer : public SoundFilter { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructors /// Create a default 31-band graphic equalizer with all bands with a gain of 0dB. GraphicEqualizer(); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Output Gain Accessor Methods /// Return the linear output gain for this graphic equalizer. RIM_INLINE Gain getOutputGain() const { return gainFilter.getGain(); } /// Return the output gain in decibels for this graphic equalizer. RIM_INLINE Gain getOutputGainDB() const { return gainFilter.getGainDB(); } /// Set the linear output gain for this graphic equalizer. RIM_INLINE void setOutputGain( Gain newGain ) { lockMutex(); gainFilter.setGain( newGain ); unlockMutex(); } /// Set the output gain in decibels for this graphic equalizer. RIM_INLINE void setOutputGainDB( Gain newGain ) { lockMutex(); gainFilter.setGainDB( newGain ); unlockMutex(); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Filter Frequency Accessor Methods /// Return the number of filters (frequency bands) that this graphic equalizer has. RIM_INLINE Size getFilterCount() const { return filters.getSize(); } /// Return the frequency of the filter at the specified index. /** * If the specified filter index is invalid, a frequency of 0 Hz is returned. */ RIM_INLINE Float getFilterFrequency( Index filterIndex ) const { return filters[filterIndex].getFrequency(); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Filter Gain Accessor Methods /// Return the linear gain of the graphic EQ filter at the specified index. /** * If the specified filter index is invalid, a gain of 0 is returned. */ RIM_INLINE Gain getFilterGain( Index filterIndex ) const { if ( filterIndex >= filters.getSize() ) return Gain(0); else return filters[filterIndex].getGain(); } /// Return the gain in decibels of the graphic EQ filter at the specified index. /** * If the specified filter index is invalid, a gain of -infinity is returned. */ RIM_INLINE Gain getFilterGainDB( Index filterIndex ) const { if ( filterIndex >= filters.getSize() ) return math::negativeInfinity<Float>(); else return filters[filterIndex].getGainDB(); } /// Set the linear gain of the graphic EQ filter at the specified index. /** * If the specified filter index is invalid, the method has no effect. */ RIM_INLINE void setFilterGain( Index filterIndex, Gain newGain ) { lockMutex(); if ( filterIndex < filters.getSize() ) filters[filterIndex].setGain( newGain ); unlockMutex(); } /// Set the gain in decibels of the graphic EQ filter at the specified index. /** * If the specified filter index is invalid, the method has no effect. */ RIM_INLINE void setFilterGainDB( Index filterIndex, Gain newGain ) { lockMutex(); if ( filterIndex < filters.getSize() ) filters[filterIndex].setGainDB( newGain ); unlockMutex(); } /// Reset all frequency bands to have a gain of 0dB, making the graphic equalizer have a flat response. void setFlat(); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Filter Bandwith Accessor Methods /// Return the Q factor used for all filters that make up this graphic equalizer. /** * This value controls the width of the boost or cut that a filter produces. * A smaller Q indicates a wider filter, while a larger Q indicates a narrower filter. */ RIM_INLINE Float getFilterQ() const { // Return the Q of the first filter since they should all be the same return filters[0].getQ(); } /// Set the Q factor used for all filters that make up this graphic equalizer. /** * This value controls the width of the boost or cut that a filter produces. * A smaller Q indicates a wider filter, while a larger Q indicates a narrower filter. * * The new Q value is clamped to the range [0, +infinity]. */ void setFilterQ( Float newQ ); /// Return the octave bandwidth used for all filters that make up this graphic equalizer. /** * This value controls the width of the boost or cut that a filter produces. * A larger bandwidth indicates a wider filter, while a smaller bandwidth * indicates a narrower filter. * * The default bandwidth is 1/3 of an octave. */ RIM_INLINE Float getFilterBandwidth() const { // Return the bandwidth of the first filter since they should all be the same return filters[0].getBandwidth(); } /// Set the octave bandwidth used for all filters that make up this graphic equalizer. /** * This value controls the width of the boost or cut that a filter produces. * A larger bandwidth indicates a wider filter, while a smaller bandwidth * indicates a narrower filter. * * The default bandwidth is 1/3 of an octave. */ void setFilterBandwidth( Float newBandwidth ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Filter Attribute Accessor Methods /// Return a human-readable name for this parametric filter. /** * The method returns the string "Parametric Filter". */ virtual UTF8String getName() const; /// Return the manufacturer name of this parametric filter. /** * The method returns the string "Headspace Sound". */ virtual UTF8String getManufacturer() const; /// Return an object representing the version of this parametric filter. virtual SoundFilterVersion getVersion() const; /// Return an object which describes the category of effect that this filter implements. /** * This method returns the value SoundFilterCategory::EQUALIZER. */ virtual SoundFilterCategory getCategory() const; /// Return whether or not this graphic equalizer can process audio data in-place. /** * This method always returns TRUE, graphic equalizers can process audio data in-place. */ virtual Bool allowsInPlaceProcessing() const; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Filter Parameter Accessor Methods /// Return the total number of generic accessible parameters this filter has. virtual Size getParameterCount() const; /// Get information about the parameter at the specified index. virtual Bool getParameterInfo( Index parameterIndex, FilterParameterInfo& info ) const; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Public Static Property Objects /// A string indicating the human-readable name of this graphic equalizer. static const UTF8String NAME; /// A string indicating the manufacturer name of this graphic equalizer. static const UTF8String MANUFACTURER; /// An object indicating the version of this graphic equalizer. static const SoundFilterVersion VERSION; private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Filter Parameter Value Accessor Methods /// Place the value of the parameter at the specified index in the output parameter. virtual Bool getParameterValue( Index parameterIndex, FilterParameter& value ) const; /// Attempt to set the parameter value at the specified index. virtual Bool setParameterValue( Index parameterIndex, const FilterParameter& value ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Stream Reset Method /// A method which is called whenever the filter's stream of audio is being reset. /** * This method allows the filter to reset all parameter interpolation * and processing to its initial state to avoid coloration from previous * audio or parameter values. */ virtual void resetStream(); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Filter Processing Methods /// Apply this parametric filter to the samples in the input frame and place them in the output frame. virtual SoundFilterResult processFrame( const SoundFilterFrame& inputFrame, SoundFilterFrame& outputFrame, Size numSamples ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Static Data Members /// Define the number of parametric filters to use for a graphic equalizer. static const Size NUMBER_OF_FILTERS = 31; /// An array of the standard filter frequencies used for a 31-band graphic equalizer. static const Float FILTER_FREQUENCIES[NUMBER_OF_FILTERS]; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Members /// An array of the filters that make up this graphic equalizer. StaticArray<ParametricFilter,NUMBER_OF_FILTERS> filters; /// A simple filter that applies a gain factor to the output of the graphic equalizer. GainFilter gainFilter; }; //########################################################################################## //************************ End Rim Sound Filters Namespace ******************************* RIM_SOUND_FILTERS_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_SOUND_GRAPHIC_EQUALIZER_H <file_sep>/* * rimPhysicsConstraint.h * Rim Physics * * Created by <NAME> on 11/28/09. * Copyright 2009 Rim Software. All rights reserved. * */ #ifndef INCLUDE_RIM_PHYSICS_CONSTRAINT_H #define INCLUDE_RIM_PHYSICS_CONSTRAINT_H #include "rimPhysicsConstraintsConfig.h" //########################################################################################## //********************* Start Rim Physics Constraints Namespace ************************** RIM_PHYSICS_CONSTRAINTS_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// An interface for classes that solve constraints for physical objects. class Constraint { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Destructor /// Destroy this constraint. virtual ~Constraint() { } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constraint Solving Methods /// Solve all instances of this constraint for the specified time step and number of solver iterations. virtual void solve( Real dt, Size numIterations ) = 0; }; //########################################################################################## //********************* End Rim Physics Constraints Namespace **************************** RIM_PHYSICS_CONSTRAINTS_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_PHYSICS_CONSTRAINT_H <file_sep>/* * rimGraphicsImmediateRenderer.h * Rim Software * * Created by <NAME> on 12/4/13. * Copyright 2013 __MyCompanyName__. All rights reserved. * */ #ifndef INCLUDE_RIM_GRAPHICS_IMMEDIATE_RENDERER_H #define INCLUDE_RIM_GRAPHICS_IMMEDIATE_RENDERER_H #include "rimGraphicsRenderersConfig.h" #include "rimGraphicsRenderer.h" #include "../rimGraphicsShapes.h" //########################################################################################## //********************** Start Rim Graphics Renderers Namespace ************************** RIM_GRAPHICS_RENDERERS_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class that emulates immediate-mode graphics rendering like older graphics APIs. /** * An immediate renderer uses an internal OpenGL-like state machine build on top * of modern graphics rendering techniques. This style of rendering can be useful * for easily drawing debug information or quick prototyping. This renderer should * not be used for performance-sensitive rendering. */ class ImmediateRenderer : public Renderer { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructors /// Create a new immediate-mode renderer with no valid context to render to. ImmediateRenderer(); /// Create a new immediate-mode renderer which uses the specified graphics context. ImmediateRenderer( const Pointer<GraphicsContext>& newContext ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Destructor /// Destroy this immediate renderer and release all associated resources. virtual ~ImmediateRenderer(); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Context Accessor Methods /// Return a pointer to the graphics context which is being used to draw geometry. /** * This pointer is NULL if the immediate renderer does not have a valid context. */ RIM_INLINE const Pointer<GraphicsContext>& getContext() const { return context; } /// Change the graphics context that should be used to draw geometry. /** * This method resets any internal context-specific rendering state but keeps * the previous drawing state (viewports, transformations, colors, normals, etc). * * The method returns whether or not the immediate-mode renderer was reinitialized * successfully. A NULL or invalid context is allowed but will cause the method to return * FALSE, causing the renderer to be unusable. */ Bool setContext( const Pointer<GraphicsContext>& newContext ); /// Ensure that the context has the current rendering state for this immediate renderer. /** * This method should be called before doing any immediate-mode rendering so that * the context is ensured to have the same state as what is stored locally * as part of the immediate-mode renderer. This information consists of the * viewport, scissor viewport, and render mode attributes. */ void synchronizeContext(); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Shader Pass Accessor Methods /// Return the current shader pass for the renderer. RIM_INLINE const Pointer<ShaderPass>& getShaderPass() const { return shaderPass; } /// Replace the current shader pass for the renderer. /** * This method may cause previously buffered drawing commands to be flushed to the screen. */ void setShaderPass( const Pointer<ShaderPass>& newShaderPass ); /// Push the current shader pass onto the shader pass stack. The current shader pass is unchanged. /** * Each call to pushShaderPass() should be paired with a call to popShaderPass(), * otherwise the stack will continue to grow and produce undesired behavior. */ void pushShaderPass(); /// Remove the last shader pass from the shader pass stack and make it the current shader pass. /** * If there are no shader passes on the stack, the method sets the current shader pass * to be the default shader pass. */ void popShaderPass(); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Render Mode Accessor Methods /// Return the render mode object for the current shader pass. RIM_INLINE RenderMode& getRenderMode() { return shaderPass->getRenderMode(); } /// Return the render mode object for the current shader pass. RIM_INLINE const RenderMode& getRenderMode() const { return shaderPass->getRenderMode(); } /// Set the render mode object for the current shader pass. RIM_INLINE void setRenderMode( const RenderMode& newRenderMode ) const { shaderPass->setRenderMode( newRenderMode ); } /// Push the current shader pass onto the shader pass stack. The current shader pass is unchanged. /** * Each call to pushShaderPass() should be paired with a call to popShaderPass(), * otherwise the stack will continue to grow and produce undesired behavior. */ void pushRenderMode(); /// Remove the last render mode from the render mode stack and make the current shader pass use it. /** * If there are no render modes on the stack, the method sets the current shader pass's mode * to be the default render mode. */ void popRenderMode(); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Viewport Accessor Methods /// Return the current viewport for the renderer. RIM_INLINE const Viewport& getViewport() const { return viewport; } /// Replace the current viewport for the renderer. /** * This method changes the context's viewport if the context is valid * and replaces the locally-stored current viewport regardless of whether * or not the context is valid. * * This method may cause previously buffered drawing commands to be flushed to the screen. */ void setViewport( const Viewport& newViewport ); /// Replace the current viewport for the renderer. /** * This method changes the context's viewport if the context is valid * and replaces the locally-stored current viewport regardless of whether * or not the context is valid. * * This method may cause previously buffered drawing commands to be flushed to the screen. */ void setViewport( const AABB2f& newViewport ) { this->setViewport( Viewport( newViewport ) ); } /// Push the current viewport onto the viewport stack. The current viewport is unchanged. /** * Each call to pushViewport() should be paired with a call to popViewport(), * otherwise the stack will continue to grow and produce undesired behavior. */ void pushViewport(); /// Remove the last viewport from the viewport stack and make it the current viewport. /** * If there are no viewports on the stack, the method has no effect. */ void popViewport(); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Scissor Viewport Accessor Methods /// Return the current scissor test for the renderer. RIM_INLINE const ScissorTest& getScissorTest() const { return scissorTest; } /// Replace the current scissor test for the renderer. /** * This method changes the context's scissor test if the context is valid * and replaces the locally-stored current scissor test regardless of whether * or not the context is valid. * * This method may cause previously buffered drawing commands to be flushed to the screen. */ void setScissorTest( const ScissorTest& newScissorTest ); /// Replace the current scissor test for the renderer. /** * This method changes the context's scissor test if the context is valid * and replaces the locally-stored current scissor test regardless of whether * or not the context is valid. * * This method may cause previously buffered drawing commands to be flushed to the screen. */ void setScissorTest( const AABB2f& newScissorBounds, Bool enabled = true ) { this->setScissorTest( ScissorTest( Viewport( newScissorBounds ), enabled ) ); } /// Push the current scissor test onto the scissor test stack. The current scissor test is unchanged. /** * Each call to pushScissorTest() should be paired with a call to popScissorTest(), * otherwise the stack will continue to grow and produce undesired behavior. */ void pushScissorTest(); /// Remove the last scissor test from the scissor test stack and make it the current one. /** * If there are no scissor tests on the stack, the method has no effect. */ void popScissorTest(); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Projection Matrix Accessor Methods /// Return the current projection matrix for the renderer. RIM_INLINE const Matrix4& getProjection() const { return projection; } /// Replace the current projection matrix for the renderer. /** * This method may cause previously buffered drawing commands to be flushed to the screen. */ void setProjection( const Matrix4& newProjection ); /// Replace the current projection matrix for the renderer with a 2D orthographic projection matrix. /** * The resulting projection views the specified volume with its view direction * down the negative Z axis. The z near and far planes are set to be 1 and -1, * respectively. */ void setProjection( const AABB2& viewVolume ); /// Replace the current projection matrix for the renderer with a 3D orthographic projection matrix. /** * The resulting projection views the specified volume with its view direction * down the negative Z axis. */ void setProjection( const AABB3& viewVolume ); /// Push the current projection matrix onto the projection matrix stack. The current projection matrix is unchanged. /** * Each call to pushProjection() should be paired with a call to popProjection(), * otherwise the stack will continue to grow and produce undesired behavior. */ void pushProjection(); /// Remove the last projection matrix from the projection matrix stack and make it the current projection matrix. /** * If there are no projection matrixs on the stack, the method has no effect. */ void popProjection(); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Transform Matrix Accessor Methods /// Return the current transformation matrix for the renderer. RIM_INLINE const Matrix4& getTransform() const { return transformation; } /// Replace the current transformation matrix for the renderer. /** * This method may cause previously buffered drawing commands to be flushed to the screen. */ void setTransform( const Matrix4& newTransform ); /// Replace the current transformation for the renderer. /** * This method may cause previously buffered drawing commands to be flushed to the screen. */ void setTransform( const Transform3& newTransform ); /// Multiply the current transformation matrix for the renderer by another matrix. /** * This method may cause previously buffered drawing commands to be flushed to the screen. */ void applyTransform( const Matrix4& newTransform ); /// Multiply the current transformation matrix for the renderer by another transformation. /** * This method may cause previously buffered drawing commands to be flushed to the screen. */ void applyTransform( const Transform3& newTransform ); /// Push the current transformation matrix onto the transformation matrix stack. The current transformation matrix is unchanged. /** * Each call to pushTransform() should be paired with a call to popTransform(), * otherwise the stack will continue to grow and produce undesired behavior. */ void pushTransform(); /// Remove the last transformation matrix from the transformation matrix stack and make it the current transformation matrix. /** * If there are no transformation matrixs on the stack, the method has no effect. */ void popTransform(); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Line Width Accessor Methods /// Return the width in pixels to use when rendering lines. Float getLineWidth() const; /// Set the width in pixels to use when rendering lines. void setLineWidth( Float newLineWidth ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Point Size Accessor Methods /// Return the size in pixels to use when rendering points. Float getPointSize() const; /// Set the size in pixels to use when rendering points. void setPointSize( Float newPointSize ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constant Accessor Methods /// Get the constant value with the specified usage in the output parameter. /** * The method returns whether or not the constant value was able to be retrieved. */ RIM_INLINE Bool getConstant( const ConstantUsage& usage, AttributeValue& value ) const { return constants.getConstant( usage, value ); } /// Get the constant value with the specified usage in the template output parameter. /** * The method returns whether or not the constant value was able to be retrieved. */ template < typename T > RIM_INLINE Bool getConstant( const ConstantUsage& usage, T& value ) const { return constants.getConstant( usage, &value ); } /// Set the value of the specified constant usage for this renderer. /** * The method returns whether or not the constant value was able to be set. */ RIM_INLINE Bool setConstant( const ConstantUsage& usage, const AttributeValue& value ) { return constants.setConstant( usage, value ); } /// Set the value of the specified constant usage for this renderer. /** * The method returns whether or not the constant value was able to be set. */ template < typename T > RIM_INLINE Bool setConstant( const ConstantUsage& usage, const T& value ) { return constants.setConstant( usage, &value ); } /// Clear all constants that are currently set in this immediate renderer. /** * This method should be called whenever the renderer does not need the * previously stored constants anymore in order to reduce the memory used. */ RIM_INLINE void clearConstants() { constants.clearConstants(); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Render Method /// Draw all previously buffered geometry to the screen. /** * As drawing commands are submitted, the renderer buffers them internally * until the rendering state is changed, necessitating flushing the commands. * This method should be called after all commands are submitted, in order to * ensure that any previously buffered commands are completely drawn. */ virtual void render(); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Drawing Control Methods /// Start drawing the specified kind of primitive type. /** * All subsequent vertex submissions will be interpreted as a sequence of * primitives of this type. For example, if IndexedPrimitiveType::TRIANGLES * is used, every 3 vertices correspond to a single triangle that is to be drawn. * * This method causes previously buffered drawing commands to be flushed to the screen * as the rendering state is prepared for the new primitive type. */ void begin( const IndexedPrimitiveType& primitiveType ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Vertex Submission Methods /// Submit a 2D vertex with the given position to the immediate renderer. /** * This vertex uses the last values for vertex color, normal texture coordinate, etc. * * 2D vertex positions are padded out to 4 components with the Z and W components 0 and 1 * when they are submitted. */ RIM_INLINE void vertex( const Vector2f& position ) { this->vertex( Vector4f( position, 0, 1 ) ); } /// Submit a 3D vertex with the given position to the immediate renderer. /** * This vertex uses the last values for vertex color, normal texture coordinate, etc. * * 3D vertex positions are padded out to 4 components with the W component 1 * when they are submitted. */ RIM_INLINE void vertex( const Vector3f& position ) { this->vertex( Vector4f( position, 1 ) ); } /// Submit a 4D vertex with the given position to the immediate renderer. /** * This vertex uses the last values for vertex color, normal texture coordinate, etc. */ void vertex( const Vector4f& position ); /// Submit a 2D vertex with the given position to the immediate renderer. /** * This vertex uses the last values for vertex color, normal texture coordinate, etc. * * 2D vertex positions are padded out to 4 components with the Z and W components 0 and 1 * when they are submitted. */ RIM_INLINE void vertex( Float x, Float y ) { this->vertex( Vector2f( x, y ) ); } /// Submit a 3D vertex with the given position to the immediate renderer. /** * This vertex uses the last values for vertex color, normal texture coordinate, etc. * * 3D vertex positions are padded out to 4 components with the W component 1 * when they are submitted. */ RIM_INLINE void vertex( Float x, Float y, Float z ) { this->vertex( Vector3f( x, y, z ) ); } /// Submit a 4D vertex with the given position to the immediate renderer. /** * This vertex uses the last values for vertex color, normal texture coordinate, etc. */ RIM_INLINE void vertex( Float x, Float y, Float z, Float w ) { this->vertex( Vector4f( x, y, z, w ) ); } /// Submit the specified number of 2D vertices from an array of vertices. /** * All vertices uses the last values for vertex color, normal texture coordinate, etc. */ void vertices( const Vector2f* v, Size numVertices ); /// Submit the specified number of 3D vertices from an array of vertices. /** * All vertices uses the last values for vertex color, normal texture coordinate, etc. */ void vertices( const Vector3f* v, Size numVertices ); /// Submit the specified number of 4D vertices from an array of vertices. /** * All vertices uses the last values for vertex color, normal texture coordinate, etc. */ void vertices( const Vector4f* v, Size numVertices ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Vertex Normal Submission Methods /// Set the current normal of the immediate renderer as a 3-component vector. /** * This value affects all subsequent draw calls until the method is called again. */ void normal( const Vector3f& normal ); /// Set the current normal of the immediate renderer as a 3-component vector. /** * This value affects all subsequent draw calls until the method is called again. */ RIM_INLINE void normal( Float nx, Float ny, Float nz ) { this->normal( Vector3f( nx, ny, nz ) ); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Vertex Texture Coordinate Submission Methods /// Set the current texture coordinate of the immediate renderer as a 2-component UV coordinate. /** * This value affects all subsequent draw calls until the method is called again. */ void uv( const Vector2f& uv ); /// Set the current texture coordinate of the immediate renderer as a 2-component UV coordinate. /** * This value affects all subsequent draw calls until the method is called again. */ RIM_INLINE void uv( Float u, Float v ) { this->uv( Vector2f( u, v ) ); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Vertex Color Accessor Methods /// Set the current color of the immediate renderer as a 3-component RGB color. /** * The color value is padded to 4 components with an alpha component of 1. * * This color affects all subsequent draw calls until the method is called again. */ void color( const Color3f& newColor ); /// Set the current color of the immediate renderer as a 4-component RGBA color. /** * This color affects all subsequent draw calls until the method is called again. */ void color( const Color4f& newColor ); /// Set the current color of the immediate renderer as a 3-component RGB color. /** * The color value is padded to 4 components with an alpha component of 1. * * This color affects all subsequent draw calls until the method is called again. */ RIM_INLINE void color( Float r, Float g, Float b ) { this->color( Color3f( r, g, b ) ); } /// Set the current color of the immediate renderer as a 3-component RGB color. /** * The color value is padded to 4 components with an alpha component of 1. * * This color affects all subsequent draw calls until the method is called again. */ RIM_INLINE void color( Float r, Float g, Float b, Float a ) { this->color( Color4f( r, g, b, a ) ); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Shape Drawing Methods /// Synchronously draw a sphere in the current coordinate frame with the given radius and current color. Bool sphere( const Vector3f& position, Float radius ); /// Synchronously draw an axis-aligned box in the current coordinate frame with the current color. /** * The box is drawn with filled sides. */ void box( const AABB3f& bounds ); /// Synchronously draw an axis-aligned bounding box in the current coordinate frame with the current color. /** * The box is drawn with edges only. */ void boundingBox( const AABB3f& bounds ); private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Members /// A pointer to the graphics context which is being used to draw geometry. Pointer<GraphicsContext> context; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Buffering Data Members /// The current indexed primitive type that is being drawn. IndexedPrimitiveType primitiveType; /// The minimum number of vertices that can be fit into the buffers for the current primitive type. Size bufferLimit; /// The total number of vertices that have been buffered. Size numVertices; /// The size of the internal vertex buffers. Size bufferCapacity; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Position Data Members /// A pointer to the hardware buffer of vertex positions. Pointer<VertexBuffer> positionBuffer; /// A pointer to the current write position in the memory-mapped position buffer, or NULL if unmapped. Vector4f* positionPointer; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Normal Data Members /// A pointer to the hardware buffer of vertex normals. Pointer<VertexBuffer> normalBuffer; /// A pointer to the current write position in the memory-mapped normal buffer, or NULL if unmapped. Vector3f* normalPointer; /// The current normal vector that is being assigned to new vertices. Vector3f currentNormal; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** UV Data Members /// A pointer to the hardware buffer of vertex texture coordinates. Pointer<VertexBuffer> uvBuffer; /// A pointer to the current write position in the memory-mapped uv buffer, or NULL if unmapped. Vector2f* uvPointer; /// The current texture coordinate that is being assigned to new vertices. Vector2f currentUV; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Color Data Members /// A pointer to the hardware buffer of vertex colors. Pointer<VertexBuffer> colorBuffer; /// A pointer to the current write position in the memory-mapped color buffer, or NULL if unmapped. Color4f* colorPointer; /// The current color that is being assigned to new vertices. Color4f currentColor; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Viewport Data Members /// The current viewport. Viewport viewport; /// A stack of viewports that have been saved for later. ShortArrayList<Viewport,2> viewports; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Scissor Test Data Members /// The current scissor test. ScissorTest scissorTest; /// A stack of scissor tets that have been saved for later. ShortArrayList<ScissorTest,2> scissorTests; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Matrix Data Members /// The current projection matrix. Matrix4 projection; /// A stack of 4x4 projection matrices that have been saved for later. ShortArrayList<Matrix4,2> projections; /// The current transformation matrix. Matrix4 transformation; /// A stack of 4x4 transformation matrices that have been saved for later. ShortArrayList<Matrix4,4> transformations; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constant Data Members /// A buffer containing the currently set constants for this renderer. ConstantBuffer constants; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Shader Pass Data Members /// The current shader pass. Pointer<ShaderPass> shaderPass; /// The default shader pass, for when the user has not specified one. Pointer<ShaderPass> defaultShaderPass; /// A stack of shader passes that have been saved for later. ShortArrayList<Pointer<ShaderPass>,4> shaderPasses; /// A stack of render modes that have been saved for later. ShortArrayList<RenderMode,4> renderModes; /// The default render mode. RenderMode defaultRenderMode; /// A set of global shader binding data. ShaderBindingData globalBindingData; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Sphere Data Members /// A pointer to a sphere shape for drawing spheres. Pointer<shapes::SphereShape> sphereShape; /// The sphere shader pass. Pointer<ShaderPass> sphereShaderPass; }; //########################################################################################## //********************** End Rim Graphics Renderers Namespace **************************** RIM_GRAPHICS_RENDERERS_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_GRAPHICS_IMMEDIATE_RENDERER_H <file_sep>/* * rimGraphicsScenes.h * Rim Software * * Created by <NAME> on 2/17/14. * Copyright 2014 __MyCompanyName__. All rights reserved. * */ #ifndef INCLUDE_RIM_GRAPHICS_SCENES_H #define INCLUDE_RIM_GRAPHICS_SCENES_H #include "scenes/rimGraphicsScenesConfig.h" #include "scenes/rimGraphicsScene.h" #endif // INCLUDE_RIM_GRAPHICS_SCENES_H <file_sep>/* * rimResourcePool.h * Rim Software * * Created by <NAME> on 11/27/09. * Copyright 2009 Rim Software. All rights reserved. * */ #ifndef INCLUDE_RIM_RESOURCE_POOL_H #define INCLUDE_RIM_RESOURCE_POOL_H #include "rimResourcesConfig.h" #include "rimResource.h" #include "rimResourceID.h" //########################################################################################## //************************** Start Rim Resources Namespace ******************************* RIM_RESOURCES_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class which stores a persistent pool of resources to avoid resource duplication. template < typename DataType > class ResourcePool { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructors /// Create a new empty resource pool. RIM_INLINE ResourcePool() { } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Resource Accessor Methods /// Return the total number of resources that are part of this resource pool. RIM_INLINE Size getResourceCount() const { return pool.getSize(); } /// Return a pointer to the resource with the specified ID. /** * If there is no resource corresponding to that ID, the method returns NULL. */ RIM_NO_INLINE Resource<DataType>* getResource( const ResourceID& identifier ) { Resource<DataType>* resource; if ( pool.find( identifier.getHashCode(), identifier, resource ) ) return resource; else return NULL; } /// Add a new resource with the specified ID to this pool. /** * If the resource is not NULL, it is added to the pool and TRUE is * returned. Otherwise, the pool is unmodified and FALSE is returned. */ RIM_NO_INLINE Bool addResource( const ResourceID& identifier, const Resource<DataType>& resource ) { if ( resource.isNull() ) return false; pool.add( identifier.getHashCode(), identifier, resource ); return true; } /// Remove all resources from the pool that aren't referenced anywhere else. /** * This has the effect of deallocating any data stored by any of the unreferenced * resources. */ RIM_NO_INLINE void removeUnusedResources() { typename util::HashMap<ResourceID,Resource<DataType> >::Iterator iterator = pool.getIterator(); while ( iterator ) { if ( iterator->getReferenceCount() <= 1 ) { iterator->release(); iterator.remove(); continue; } iterator++; } } /// Remove all references of the resources contained in this pool. /** * This won't cause the resources to be deallocated from memory * unless the aren't being used elsewhere. The resources will stay * resident in memory until they are not used, at which point they will * be deallocated automatically. */ void clearResources() { pool.clear(); } private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Members /// A map from resource ID to resource util::HashMap< ResourceID, Resource<DataType> > pool; }; //########################################################################################## //************************** End Rim Resources Namespace ********************************* RIM_RESOURCES_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_RESOURCE_POOL_H <file_sep>/* * rimSoundMultichannelDelay.h * Rim Sound * * Created by <NAME> on 8/22/12. * Copyright 2012 __MyCompanyName__. All rights reserved. * */ #ifndef INCLUDE_RIM_SOUND_MULTICHANNEL_DELAY_H #define INCLUDE_RIM_SOUND_MULTICHANNEL_DELAY_H #include "rimSoundFiltersConfig.h" #include "rimSoundFilter.h" //########################################################################################## //************************ Start Rim Sound Filters Namespace ***************************** RIM_SOUND_FILTERS_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class that produces delay effects which can be independently changed per channel. /** * This class represents a generic delay-style effect. It can be switched between * comb filtering and all-pass delay. This class can also be used to implement a * simple delay filter with basic delay time, feedback, and mix controls. It may * also be used as a building block for more complex effects like a Schroeder reverberator. * * Having explicit control of the delay times and feedback gains for the different * channels allows different echo patterns for each channel, increasing stereo imaging. * It is often useful to use a set of delay filters with different delay times for each channel * to approximate a reverb tail. */ class MultichannelDelay : public SoundFilter { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Delay Type Enum Declaration /// An enum type which describes the various types of delay effects that a Delay can produce. typedef enum DelayType { /// The delay filter behaves as a delay filter (the same as a standard delay effect). COMB = 0, /// The delay filter behaves as an all-pass filter. ALL_PASS = 1 }; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructors /// Create a multichannel comb delay filter with 500ms delay time, 0 delay feedback, 0dB delay gain, and 0dB dry gain. MultichannelDelay(); /// Create a multichannel comb delay filter with the specified delay parameters. /** * This constructor creates a filter with the specified delay time, delay * feedback gain, delay output gain, and input-to-output gain. */ MultichannelDelay( Float newDelayTime, Gain newFeedbackGain, Gain newDelayGain, Gain newDryGain ); /// Create a multichannel delay filter with the specified type and delay parameters. /** * This constructor creates a filter with the specified delay time, delay * feedback gain, delay output gain, and input-to-output gain. */ MultichannelDelay( DelayType newType, Float newDelayTime, Gain newFeedbackGain, Gain newDelayGain, Gain newDryGain ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Delay Effect Type Accessor Methods /// Return the kind of delay effect that this delay filter is producing. RIM_INLINE DelayType getType() const { return type; } /// Set the kind of delay effect that this delay filter is producing. RIM_INLINE void setType( DelayType newType ) { lockMutex(); type = newType; unlockMutex(); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Delay Time Accessor Methods /// Return the delay time for the specified delay filter channel in seconds. RIM_INLINE Float getDelayTime( Index channelIndex ) const { if ( channelIndex < channels.getSize() ) return channels[channelIndex].delayTime; else return globalChannel.delayTime; } /// Set the delay time for the specified delay filter channel in seconds. void setDelayTime( Index channelIndex, Float newDelayTime ); /// Set the delay time for all of this delay filter's channels in seconds. void setDelayTime( Float newDelayTime ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Decay Time Accessor Methods /// Return the time it takes for the output of the specified delay filter channel to decay to -60dB. /** * This method computes the decay time of the multichannel delay filter using the current values * for the feedback gain and delay time of the multichannel delay filter. */ RIM_INLINE Float getDecayTime( Index channelIndex ) const { if ( channelIndex < channels.getSize() ) return channels[channelIndex].delayTime*math::log( Float(0.001), channels[channelIndex].feedbackGain ); else return globalChannel.delayTime*math::log( Float(0.001), globalChannel.feedbackGain ); } /// Set the time it takes for the output of the specified delay filter channel to decay to -60dB. /** * This method uses the current multichannel delay filter delay time to compute the feedback * gain necessary to produce the desired decay time. */ void setDecayTime( Index channelIndex, Float newDecayTime ); /// Set the time it takes for the output of the all delay filter channels to decay to -60dB. /** * This method uses the current multichannel delay filter delay time to compute the feedback * gain necessary to produce the desired decay time. */ void setDecayTime( Float newDecayTime ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Feedback Gain Accessor Methods /// Return the feedback gain for the specified channel of this delay filter. /** * This value represents how much of each output delay sample is sent * back to the delay buffer during each pass over the delay buffer. * This value should be between -0.99999 and 0.99999 in order to ensure * filter stability. */ RIM_INLINE Gain getFeedbackGain( Index channelIndex ) const { if ( channelIndex < channels.getSize() ) return channels[channelIndex].feedbackGain; else return globalChannel.feedbackGain; } /// Return the feedback gain for the specified channel of this delay filter in decibels. /** * This value represents the gain applied to the output delay sample which is sent * back to the delay buffer during each pass over the delay buffer. * This value should be between -infinity and -0.00001 in order to ensure * filter stability. */ RIM_INLINE Gain getFeedbackGainDB( Index channelIndex ) const { return util::linearToDB( this->getFeedbackGain( channelIndex ) ); } /// Set the feedback gain for the specified channel of this delay filter. /** * This value represents how much of each output delay sample is sent * back to the delay buffer during each pass over the delay buffer. * This value is clamped to be between -0.99999 and 0.99999 in order to ensure * filter stability. */ void setFeedbackGain( Index channelIndex, Gain newFeedbackGain ); /// Set the feedback gain for the specified channel of this delay filter in decibels. /** * This value represents the gain applied to the output delay sample which is sent * back to the delay buffer during each pass over the delay buffer. * This value should be between -infinity and -0.00001 in order to ensure * filter stability. */ RIM_INLINE void setFeedbackGainDB( Index channelIndex, Gain newFeedbackGain ) { this->setFeedbackGain( channelIndex, util::dbToLinear( newFeedbackGain ) ); } /// Set the feedback gain for all channels of this delay filter. /** * This value represents how much of each output delay sample is sent * back to the delay buffer during each pass over the delay buffer. * This value is clamped to be between -0.99999 and 0.99999 in order to ensure * filter stability. */ void setFeedbackGain( Gain newFeedbackGain ); /// Set the feedback gain for all channels of this delay filter. /** * This value represents the gain applied to the output delay sample which is sent * back to the delay buffer during each pass over the delay buffer. * This value should be between -infinity and -0.00001 in order to ensure * filter stability. */ RIM_INLINE void setFeedbackGainDB( Gain newFeedbackGain ) { this->setFeedbackGain( util::dbToLinear( newFeedbackGain ) ); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Channel Phase Accessor Methods /// Return the delay phase offset of the channel with the specified index. /** * This value, specified in degrees, indicates how much the phase of the channel * should be shifted by. This parameter allows the creation of ping-pong * delay effects. For example, if the phase of the left channel is 0 and the phase * of the right channel is 180, the channels' delay will be 50% out-of-phase, creating * the classic ping-pong style delay. */ inline Float getChannelPhase( Index channelIndex ) const { if ( channelIndex < channels.getSize() ) return Float(180)*channels[channelIndex].phase; else return Float(180)*globalChannel.phase; } /// Set the delay phase offset of the channel with the specified index. /** * This value, specified in degrees, indicates how much the phase of the channel * should be shifted by. This parameter allows the creation of ping-pong * delay effects. For example, if the phase of the left channel is 0 and the phase * of the right channel is 180, the channels' delay will be 50% out-of-phase, creating * the classic ping-pong style delay. * * The input phase value is clamped so that the new phase value lies between -180 and 180 degrees. */ void setChannelPhase( Index channelIndex, Float newPhase ); /// Set the delay phase offset for all channels. /** * Doing this brings all channels into phase with each other (regardless of what phase that is). * * The input phase value is clamped so that the new phase value lies between -180 and 180 degrees. */ void setChannelPhase( Float newPhase ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Delay Gain Accessor Methods /// Return the linear delay gain of this multichannel delay filter. /** * This value represents the gain applied to the delayed * signal before it is mixed with input signal. */ RIM_INLINE Gain getDelayGain() const { return delayGain; } /// Return the delay gain of this multichannel delay filter in decibels. /** * This value represents the gain applied to the delayed * signal before it is mixed with input signal. */ RIM_INLINE Gain getDelayGainDB() const { return util::linearToDB( delayGain ); } /// Set the linear delay gain of this multichannel delay filter. /** * This value represents the gain applied to the delayed * signal before it is mixed with input signal. */ RIM_INLINE void setDelayGain( Gain newDelayGain ) { lockMutex(); targetDelayGain = newDelayGain; unlockMutex(); } /// Set the delay gain of this multichannel delay filter in decibels. /** * This value represents the gain applied to the delayed * signal before it is mixed with input signal. */ RIM_INLINE void setDelayGainDB( Gain newDelayGain ) { lockMutex(); targetDelayGain = util::dbToLinear( newDelayGain ); unlockMutex(); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Input Gain Accessor Methods /// Return the linear dry gain of this multichannel delay filter. /** * This value represents the gain applied to the input * signal before it is mixed with delayed signal. */ RIM_INLINE Gain getDryGain() const { return dryGain; } /// Return the dry gain of this multichannel delay filter in decibels. /** * This value represents the gain applied to the input * signal before it is mixed with delayed signal. */ RIM_INLINE Gain getDryGainDB() const { return util::linearToDB( dryGain ); } /// Set the linear dry gain of this multichannel delay filter. /** * This value represents the gain applied to the input * signal before it is mixed with delayed signal. */ RIM_INLINE void setDryGain( Gain newDryGain ) { lockMutex(); targetDryGain = newDryGain; unlockMutex(); } /// Set the dry gain of this multichannel delay filter in decibels. /** * This value represents the gain applied to the input * signal before it is mixed with delayed signal. */ RIM_INLINE void setDryGainDB( Gain newDryGain ) { lockMutex(); targetDryGain = util::dbToLinear( newDryGain ); unlockMutex(); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Filter Attribute Accessor Methods /// Return a human-readable name for this multichannel delay filter. /** * The method returns the string "Mutichannel Comb Filter". */ virtual UTF8String getName() const; /// Return the manufacturer name of this multichannel delay filter. /** * The method returns the string "Headspace Sound". */ virtual UTF8String getManufacturer() const; /// Return an object representing the version of this multichannel delay filter. virtual SoundFilterVersion getVersion() const; /// Return an object which describes the category of effect that this filter implements. /** * This method returns the value SoundFilterCategory::DELAY. */ virtual SoundFilterCategory getCategory() const; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Filter Parameter Accessor Methods /// Return the total number of generic accessible parameters this multichannel delay filter has. virtual Size getParameterCount() const; /// Get information about the multichannel delay filter parameter at the specified index. virtual Bool getParameterInfo( Index parameterIndex, FilterParameterInfo& info ) const; /// Get any special name associated with the specified value of an indexed parameter. virtual Bool getParameterValueName( Index parameterIndex, const FilterParameter& value, UTF8String& name ) const; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Public Static Property Objects /// A string indicating the human-readable name of this multichannel delay filter. static const UTF8String NAME; /// A string indicating the manufacturer name of this multichanel delay filter. static const UTF8String MANUFACTURER; /// An object indicating the version of this multichannel delay filter. static const SoundFilterVersion VERSION; private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Comb Filter Channel Data Class Declaration /// A class which holds channel-dependent delay filter data for a single channel. class Channel { public: /// Create a default channel with the default delay filter parameters. inline Channel() : delayBufferSize( 0 ), currentDelayWriteIndex( 0 ), delayTime( 0 ), targetDelayTime( 0.5f ), feedbackGain( 0 ), targetFeedbackGain( 0 ), phase( 0 ) { } /// Create a new channel with the specified delay time and feedback gain. inline Channel( Float newDelayTime, Gain newFeedbackGain ) : delayBufferSize( 0 ), currentDelayWriteIndex( 0 ), delayTime( 0 ), targetDelayTime( math::max( newDelayTime, Float(0) ) ), feedbackGain( math::clamp( newFeedbackGain, Gain(-0.999), Gain(0.999) ) ), phase( 0 ) { targetFeedbackGain = newFeedbackGain; } /// An array of delay samples for this delay filter channel. Array<Sample32f> delayBuffer; /// The total number of samples in the delay buffer that are valid delay samples. /** * This value is stored separately from the delay buffer so that the buffer can * have a size that is greater than or equal to the actual number of delay samples. */ Size delayBufferSize; /// The current write position within the delay buffer in samples. Index currentDelayWriteIndex; /// The time in seconds of the delay of this channel of the delay filter. Float delayTime; /// The target delay time for this channel of the delay filter. /** * This is the desired delay time which was set by the user. * Since instant parameter changes can be audible, this value allows the filter * to slowly approach the target delay time if it changes. */ Float targetDelayTime; /// The feedback gain of the delay filter channel. /** * This indicates How much of each output delay sample is sent back to the delay buffer. */ Gain feedbackGain; /// The target feedback gain for this channel of the delay filter. /** * This is the desired value for the feedback gain which was set by the user. * Since instant parameter changes can be audible, this value allows the filter * to slowly approach the target feedback gain if it changes. */ Gain targetFeedbackGain; /// The phase offset of this channel's delay, in the range [-1,1], where 0 is in phase and 1 is 180 degrees out of phase. Float phase; }; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Filter Parameter Value Accessor Methods /// Place the value of the parameter at the specified index in the output parameter. virtual Bool getParameterValue( Index parameterIndex, FilterParameter& value ) const; /// Attempt to set the parameter value at the specified index. virtual Bool setParameterValue( Index parameterIndex, const FilterParameter& value ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Stream Reset Method /// A method which is called whenever the filter's stream of audio is being reset. /** * This method allows the filter to reset all parameter interpolation * and processing to its initial state to avoid coloration from previous * audio or parameter values. */ virtual void resetStream(); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Filter Processing Methods /// Apply this multichannel delay filter to the specified input frame samples and place them in the output frame. virtual SoundFilterResult processFrame( const SoundFilterFrame& inputFrame, SoundFilterFrame& outputFrame, Size numSamples ); /// Apply a comb filter to the given buffers when no parameters have changed. RIM_FORCE_INLINE static void processCombFilterNoChanges( const Sample32f* input, Sample32f* output, Size numSamples, Sample32f* const delayBufferStart, Sample32f* const delayBufferEnd, const Sample32f* delayRead, Sample32f* delayWrite, Gain feedbackGain, Gain delayGain, Gain dryGain ); /// Apply a comb filter to the given buffers when some parameter has changed. RIM_FORCE_INLINE static void processCombFilterChanges( const Sample32f* input, Sample32f* output, Size numSamples, Sample32f* const delayBufferStart, Sample32f* const delayBufferEnd, const Sample32f* delayRead, Sample32f* delayWrite, Gain feedbackGain, Gain feedbackGainChangePerSample, Gain delayGain, Gain delayGainChangePerSample, Gain dryGain, Gain dryGainChangePerSample ); /// Apply an all-pass filter to the given buffers when no parameters have changed. RIM_FORCE_INLINE static void processAllPassFilterNoChanges( const Sample32f* input, Sample32f* output, Size numSamples, Sample32f* const delayBufferStart, Sample32f* const delayBufferEnd, const Sample32f* delayRead, Sample32f* delayWrite, Gain feedbackGain, Gain delayGain, Gain dryGain ); /// Apply an all-pass delay filter to the given buffers when some parameter has changed. RIM_FORCE_INLINE static void processAllPassFilterChanges( const Sample32f* input, Sample32f* output, Size numSamples, Sample32f* const delayBufferStart, Sample32f* const delayBufferEnd, const Sample32f* delayRead, Sample32f* delayWrite, Gain feedbackGain, Gain feedbackGainChangePerSample, Gain delayGain, Gain delayGainChangePerSample, Gain dryGain, Gain dryGainChangePerSample ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Members /// An array of data for each channel of this delay filter. Array<Channel> channels; /// An enum representing the type of delay effect that this delay filter produces. DelayType type; /// A structure to use for all channels that haven't yet had their attributes set. /** * Since the filter needs to be able to handle any number of filters, it must * provide default parameters to use for channels that haven't been initialized. * When an uninitialized channel is needed, its attributes are initialzed using the * values in the global channel. */ Channel globalChannel; /// The gain applied to the delayed signal before it is mixed with input signal. Gain delayGain; /// The target delay gain for this multichannel delay filter. /** * This is the desired value for the delay gain which was set by the user. * Since instant parameter changes can be audible, this value allows the filter * to slowly approach the target delay gain if it changes. */ Gain targetDelayGain; /// The gain applied to the input signal before it is mixed with the delayed signal. Gain dryGain; /// The target dry gain for this multichannel delay filter. /** * This is the desired value for the dry gain which was set by the user. * Since instant parameter changes can be audible, this value allows the filter * to slowly approach the target dry gain if it changes. */ Gain targetDryGain; }; //########################################################################################## //************************ End Rim Sound Filters Namespace ******************************* RIM_SOUND_FILTERS_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_SOUND_MULTICHANNEL_DELAY_H <file_sep>/* * rimBVH.h * Rim BVH * * Created by <NAME> on 12/28/08. * Copyright 2008 Rim Software. All rights reserved. * */ #ifndef INCLUDE_RIM_BVH_BVH_H #define INCLUDE_RIM_BVH_BVH_H #include "rimBVHConfig.h" #include "rimPrimitiveInterface.h" #include "rimTraversalStack.h" //########################################################################################## //***************************** Start Rim BVH Namespace ********************************** RIM_BVH_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A generic interface for a Bounding Volume Hierarchy. class BVH { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Destructor /// Destroy this BVH. virtual ~BVH() { } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** BVH Primitive Accessor Methods /// Set the primitive set that this BVH should use. /** * Calling this method invalidates the current BVH, requiring it * to be rebuilt before it can be used. */ virtual void setPrimitives( const Pointer<const PrimitiveInterface>& newPrimitives ) = 0; /// Return a pointer to the primitive set used by this BVH. virtual const Pointer<const PrimitiveInterface>& getPrimitives() const = 0; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** BVH Building Methods /// Rebuild the BVH using the current set of primitives. virtual void rebuild() = 0; /// Do a quick update of the BVH by refitting the bounding volumes without changing the hierarchy. virtual void refit() = 0; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** BVH Attribute Accessor Methods /// Return the maximum depth of this BVH's hierarchy. /** * This value can be used to pre-allocate traversal stacks to prevent overflow. */ virtual Size getMaxDepth() const = 0; /// Return whether or not this BVH is built, valid, and ready for use. virtual Bool isValid() const = 0; /// Return the approximate total amount of memory in bytes allocated for this BVH. virtual Size getSizeInBytes() const = 0; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Ray Tracing Methods /// Trace the specified ray through this BVH up to a maximum distance. /** * The method returns whether or not an intersection was found. If so, the distance * along the ray and the intersected primitive index are placed in the output parameters. */ RIM_FORCE_INLINE Bool traceRay( const Ray3f& ray, Float maxDistance, TraversalStack& stack, Float& closestIntersection, Index& closestPrimitiveIndex ) const { return this->traceRay( ray, maxDistance, stack.getRoot(), closestIntersection, closestPrimitiveIndex ); } /// Trace the specified ray through this BVH up to a maximum distance. /** * The method returns whether or not an intersection was found. If so, the distance * along the ray and the intersected primitive index are placed in the output parameters. */ virtual Bool traceRay( const Ray3f& ray, Float maxDistance, const void** stack, Float& closestIntersection, Index& closestPrimitiveIndex ) const = 0; /// Trace the specified ray through this BVH up to a maximum distance. /** * The method returns whether or not an intersection was found. */ RIM_FORCE_INLINE Bool traceRay( const Ray3f& ray, Float maxDistance, TraversalStack& stack ) const { return this->traceRay( ray, maxDistance, stack.getRoot() ); } /// Trace the specified ray through this BVH up to a maximum distance. /** * The method returns whether or not an intersection was found. */ virtual Bool traceRay( const Ray3f& ray, Float maxDistance, const void** stack ) const = 0; }; //########################################################################################## //***************************** End Rim BVH Namespace ************************************ RIM_BVH_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_BVH_BVH_H <file_sep>/* * rimMatrixND.h * Rim Math * * Created by <NAME> on 10/22/07. * Copyright 2007 Rim Software. All rights reserved. * */ #ifndef INCLUDE_RIM_MATRIX_ND_H #define INCLUDE_RIM_MATRIX_ND_H #include "rimMathConfig.h" #include "../data/rimBasicString.h" #include "../data/rimBasicStringBuffer.h" #include "rimVectorND.h" //########################################################################################## //***************************** Start Rim Math Namespace ********************************* RIM_MATH_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class which represents a matrix of a fixed arbitrary number of rows and columns. template < typename T, Size numRows, Size numColumns > class MatrixND { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructors /// Create a matrix with its elements all equal to zero. RIM_FORCE_INLINE MatrixND() : column() { } /// Create a matrix from a pointer to an array with elements specified in column-major order. RIM_FORCE_INLINE MatrixND( const T* array ) { for ( Index i = 0; i < numColumns; i++ ) for ( Index j = 0; j < numRows; j++ ) column[i][j] = array[i*numRows + j]; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Accessor Methods /// Return a pointer to the matrix's elements in colunn-major order. /** * Since matrix elements are stored in column-major order, * no allocation is performed and the elements are accessed directly. */ RIM_FORCE_INLINE T* toArrayColumnMajor() { return (T*)&column[0]; } /// Return a pointer to the matrix's elements in colunn-major order. /** * Since matrix elements are stored in column-major order, * no allocation is performed and the elements are accessed directly. */ RIM_FORCE_INLINE const T* toArrayColumnMajor() const { return (T*)&column[0]; } /// Return a reference to the column at the specified index in the matrix. RIM_FORCE_INLINE VectorND<T,numRows>& getColumn( Index columnIndex ) { RIM_DEBUG_ASSERT( columnIndex < numColumns ); return column[columnIndex]; } /// Return a const reference to the column at the specified index in the matrix. RIM_FORCE_INLINE const VectorND<T,numRows>& getColumn( Index columnIndex ) const { RIM_DEBUG_ASSERT( columnIndex < numColumns ); return column[columnIndex]; } /// Return a reference to the column at the specified index in the matrix. RIM_FORCE_INLINE VectorND<T,numRows>& operator () ( Index columnIndex ) { RIM_DEBUG_ASSERT( columnIndex < numColumns ); return column[columnIndex]; } /// Return a const reference to the column at the specified index in the matrix. RIM_FORCE_INLINE const VectorND<T,numRows>& operator () ( Index columnIndex ) const { RIM_DEBUG_ASSERT( columnIndex < numColumns ); return column[columnIndex]; } /// Return a reference the column at the specified index in the matrix. RIM_FORCE_INLINE VectorND<T,numRows>& operator [] ( Index columnIndex ) { RIM_DEBUG_ASSERT( columnIndex < numColumns ); return column[columnIndex]; } /// Return a const reference to the column at the specified index in the matrix. RIM_FORCE_INLINE const VectorND<T,numRows>& operator [] ( Index columnIndex ) const { RIM_DEBUG_ASSERT( columnIndex < numColumns ); return column[columnIndex]; } /// Return the row at the specified index in the matrix. RIM_FORCE_INLINE VectorND<T,numColumns> getRow( Index rowIndex ) const { RIM_DEBUG_ASSERT( rowIndex < numRows ); VectorND<T,numColumns> result; for ( Index i = 0; i < numColumns; i++ ) result.set( i, column[i][rowIndex] ); return result; } /// Return the element at the specified (row, column) in the matrix. RIM_FORCE_INLINE T& get( Index rowIndex, Index columnIndex ) { RIM_DEBUG_ASSERT( rowIndex < numRows ); RIM_DEBUG_ASSERT( columnIndex < numColumns ); return column[columnIndex][rowIndex]; } /// Return the element at the specified (row, column) in the matrix. RIM_FORCE_INLINE const T& get( Index rowIndex, Index columnIndex ) const { RIM_DEBUG_ASSERT( rowIndex < numRows ); RIM_DEBUG_ASSERT( columnIndex < numColumns ); return column[columnIndex][rowIndex]; } /// Return the element at the specified (row, column) in the matrix. RIM_FORCE_INLINE T& operator () ( Index rowIndex, Index columnIndex ) { RIM_DEBUG_ASSERT( rowIndex < numRows ); RIM_DEBUG_ASSERT( columnIndex < numColumns ); return column[columnIndex][rowIndex]; } /// Return the element at the specified (row, column) in the matrix. RIM_FORCE_INLINE const T& operator () ( Index rowIndex, Index columnIndex ) const { RIM_DEBUG_ASSERT( rowIndex < numRows ); RIM_DEBUG_ASSERT( columnIndex < numColumns ); return column[columnIndex][rowIndex]; } /// Set the column vector at the specified index in the matrix. RIM_FORCE_INLINE void setColumn( Index columnIndex, const VectorND<T,numRows>& newColumn ) { RIM_DEBUG_ASSERT( columnIndex < numColumns ); column[columnIndex] = newColumn; } /// Set the row vector at the specified index in the matrix. RIM_FORCE_INLINE void setRow( Index rowIndex, const VectorND<T,numColumns>& newRow ) { RIM_DEBUG_ASSERT( rowIndex < numRows ); for ( Index i = 0; i < numColumns; i++ ) column[i].set( rowIndex, newRow[i] ); } /// Get the element at the specified (row, column) in the matrix. RIM_FORCE_INLINE void set( Index rowIndex, Index columnIndex, T value ) { RIM_DEBUG_ASSERT( rowIndex < numRows ); RIM_DEBUG_ASSERT( columnIndex < numColumns ); column[columnIndex].set( rowIndex, value ); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** MatrixND Operations /// Get the determinant of the matrix. RIM_FORCE_INLINE T getDeterminant() const { } /// Get the inverse of the matrix if it has one. RIM_FORCE_INLINE MatrixND invert() const { } /// Return the orthonormalization of this matrix. RIM_FORCE_INLINE MatrixND orthonormalize() const { MatrixND<T,numRows,numColumns> result; for ( Index i = 0; i < numColumns; i++ ) { VectorND<T,numRows> newColumn = getColumn(i); for ( Index j = 0; j < i; j++ ) newColumn -= getColumn(i).projectOn( result.getColumn(j) ); result.setColumn( i, newColumn.normalize() ); } return result; } /// Return the transpose of this matrix. RIM_FORCE_INLINE MatrixND<T,numColumns,numRows> transpose() const { MatrixND<T,numColumns,numRows> result; for ( Index i = 0; i < numRows; i++ ) result.setColumn( i, getRow(i) ); return result; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Comparison Operators /// Return whether or not every component in this matrix is equal to that in another matrix. RIM_FORCE_INLINE Bool operator == ( const MatrixND<T,numRows,numColumns> &matrix ) const { Bool result = true; for ( Index i = 0; i < numColumns; i++ ) result &= (column[i] == matrix.getColumn(i)); return result; } /// Return whether or not some component in this matrix is not equal to that in another matrix. RIM_FORCE_INLINE Bool operator != ( const MatrixND<T,numRows,numColumns>& matrix ) const { return !(operator==( matrix )); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** MatrixND Negation/Positivation Operators /// Negate every element of this matrix and return the resulting matrix. RIM_FORCE_INLINE MatrixND operator - () const { MatrixND result; for ( Index i = 0; i < numColumns; i++ ) result.column[i] = -column[i]; return result; } /// 'Positivate' every element of this matrix, returning a copy of the original matrix. RIM_FORCE_INLINE MatrixND operator + () const { return *this; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Arithmetic Operators /// Add this matrix to another and return the resulting matrix. RIM_FORCE_INLINE MatrixND operator + ( const MatrixND<T,numRows,numColumns>& matrix ) const { MatrixND result; for ( Index i = 0; i < numColumns; i++ ) result.column[i] = column[i] + matrix.column[i]; return result; } /// Add a scalar to the elements of this matrix and return the resulting matrix. RIM_FORCE_INLINE MatrixND operator + ( const T& value ) const { MatrixND result; for ( Index i = 0; i < numColumns; i++ ) result.column[i] = column[i] + value; return result; } /// Add this matrix to another and return the resulting matrix. RIM_FORCE_INLINE MatrixND operator - ( const MatrixND<T,numRows,numColumns>& matrix ) const { MatrixND result; for ( Index i = 0; i < numColumns; i++ ) result.column[i] = column[i] - matrix.column[i]; return result; } /// Subtract a scalar from the elements of this matrix and return the resulting matrix. RIM_FORCE_INLINE MatrixND operator - ( const T& value ) const { MatrixND result; for ( Index i = 0; i < numColumns; i++ ) result.column[i] = column[i] - value; return result; } /// Multiply a matrix by this matrix and return the result. template < Size otherColumnDimension > RIM_FORCE_INLINE MatrixND<T,numRows,otherColumnDimension> operator * ( const MatrixND<T,numColumns,otherColumnDimension>& matrix ) { MatrixND<T,numRows,otherColumnDimension> result; for ( Index i = 0; i < numRows; i++ ) { for ( Index j = 0; j < otherColumnDimension; j++ ) { T dot = T(0); for ( Index k = 0; k < numColumns; k++ ) dot += column[k][i] * matrix.column[j][k]; result.column[j][i] = dot; } } return result; } /// Multiply a vector/point by this matrix and return the result. RIM_FORCE_INLINE VectorND<T,numRows> operator * ( const VectorND<T,numColumns>& vector ) { VectorND<T,numRows> result; for ( Index i = 0; i < numRows; i++ ) { T dot = T(0); for ( Index j = 0; j < numColumns; j++ ) dot += column[j][i] * vector[j]; result[i] = dot; } return result; } /// Multiply the elements of this matrix by a scalar and return the resulting matrix. RIM_FORCE_INLINE MatrixND operator * ( const T& value ) const { MatrixND result; for ( Index i = 0; i < numColumns; i++ ) result.column[i] = column[i] * value; return result; } /// Divide the elements of this matrix by a scalar and return the resulting matrix. RIM_FORCE_INLINE MatrixND operator / ( const T& value ) const { MatrixND result; T inverseValue = T(1)/value; for ( Index i = 0; i < numColumns; i++ ) result.column[i] = column[i] * inverseValue; return result; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** MatrixND Operators /// Add the elements of another matrix to this matrix. RIM_FORCE_INLINE MatrixND& operator += ( const MatrixND<T,numRows,numColumns>& matrix ) { for ( Index i = 0; i < numColumns; i++ ) column[i] += matrix.column[i]; return *this; } /// Add a scalar value to the elements of this matrix. RIM_FORCE_INLINE MatrixND& operator += ( const T& value ) { for ( Index i = 0; i < numColumns; i++ ) column[i] += value; return *this; } /// Subtract the elements of another matrix from this matrix. RIM_FORCE_INLINE MatrixND& operator -= ( const MatrixND<T,numRows,numColumns>& matrix ) { for ( Index i = 0; i < numColumns; i++ ) column[i] -= matrix.column[i]; return *this; } /// Subtract a scalar value from the elements of this matrix. RIM_FORCE_INLINE MatrixND& operator -= ( const T& value ) { for ( Index i = 0; i < numColumns; i++ ) column[i] -= value; return *this; } /// Multiply the elements of this matrix by a scalar value. RIM_FORCE_INLINE MatrixND& operator *= ( const T& value ) { for ( Index i = 0; i < numColumns; i++ ) column[i] *= value; return *this; } /// Divide the elements of this matrix by a scalar value. RIM_FORCE_INLINE MatrixND& operator /= ( const T& value ) { T inverseValue = T(1)/value; for ( Index i = 0; i < numColumns; i++ ) column[i] *= inverseValue; return *this; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** String Conversion Methods /// Convert this matrix into a human-readable string representation. RIM_NO_INLINE data::String toString() const { data::StringBuffer buffer; for ( Index i = 0; i < numRows; i++ ) { buffer << "[ "; for ( Index j = 0; j < numColumns; j++ ) { if ( j != numColumns - 1 ) buffer << column[i][j] << ", "; else buffer << column[i][j] << ' '; } if ( i != numRows - 1 ) buffer << "]\n"; else buffer << ']'; } return buffer.toString(); } /// Convert this matrix into a human-readable string representation. RIM_FORCE_INLINE operator data::String () const { return this->toString(); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Public Static Data Members /// Constant matrix with all elements equal to zero. static const MatrixND ZERO; /// Constant matrix which is the identity matrix. static const MatrixND IDENTITY; private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Helper Methods /// Return the identity matrix for this matrix size. static MatrixND getIdentity() { MatrixND result; Size minDimension = math::min( numRows, numColumns ); for ( Index i = 0; i < minDimension; i++ ) result[i][i] = T(1); return result; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Members /// An array of column vectors for this matrix. VectorND<T,numRows> column[numColumns]; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Friend Class template < typename U, Size r, Size c > friend class MatrixND; }; template < typename T, Size numRows, Size numColumns > const MatrixND<T,numRows,numColumns> MatrixND<T,numRows,numColumns>:: ZERO; template < typename T, Size numRows, Size numColumns > const MatrixND<T,numRows,numColumns> MatrixND<T,numRows,numColumns>:: IDENTITY = MatrixND<T,numRows,numColumns>::getIdentity(); //########################################################################################## //########################################################################################## //############ //############ Reverse Matrix Arithmetic Operators //############ //########################################################################################## //########################################################################################## /// Multiply a matrix's elements by a scalar and return the resulting matrix template <typename T, Size numRows, Size numColumns> RIM_FORCE_INLINE MatrixND<T,numRows,numColumns> operator + ( const T& c, const MatrixND<T,numRows,numColumns>& matrix ) { MatrixND<T,numRows,numColumns> result; for ( Index i = 0; i < numColumns; i++ ) result.setColumn( i, matrix.getColumn(i) * c ); return result; } /// 'Reverse' multiply a vector/point by matrix: multiply it by the matrix's transpose. template <typename T, Size numRows, Size numColumns> RIM_FORCE_INLINE VectorND<T,numColumns> operator * ( const VectorND<T,numRows>& vector, const MatrixND<T,numRows,numColumns>& matrix ) { VectorND<T,numColumns> result; for ( Index i = 0; i < numColumns; i++ ) { T dot = T(0); for ( Index j = 0; j < numRows; j++ ) dot += matrix[i][j] * vector[j]; result[i] = dot; } return result; } /// Multiply a matrix's elements by a scalar and return the resulting matrix template <typename T, Size numRows, Size numColumns> RIM_FORCE_INLINE MatrixND<T,numRows,numColumns> operator * ( const T& c, const MatrixND<T,numRows,numColumns>& matrix ) { MatrixND<T,numRows,numColumns> result; for ( int i = 0; i < numColumns; i++ ) result.setColumn( i, matrix.getColumn(i) * c ); return result; } //########################################################################################## //***************************** End Rim Math Namespace *********************************** RIM_MATH_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_MATRIX_ND_H <file_sep>/* * rimGraphicsGUIFontDrawer.h * Rim Graphics GUI * * Created by <NAME> on 1/16/13. * Copyright 2013 Headspace Systems. All rights reserved. * */ #ifndef INCLUDE_RIM_GRAPHICS_GUI_FONT_DRAWER_H #define INCLUDE_RIM_GRAPHICS_GUI_FONT_DRAWER_H #include "rimGraphicsGUIFontsConfig.h" #include "rimGraphicsGUIFont.h" #include "rimGraphicsGUIFontStyle.h" //########################################################################################## //********************* Start Rim Graphics GUI Fonts Namespace *************************** RIM_GRAPHICS_GUI_FONTS_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class which represents the interface for classes that draw strings for Font objects. class FontDrawer { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Destructor /// Destroy this font drawer and release any resources. virtual ~FontDrawer() { } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** String Drawing Methods /// Draw the specified unicode string using the provided font style. /** * The position and font size are assumed to be in viewport pixel coordinates. * For instance, the lower left corner of the current viewport has position (0,0) * and for a viewport with width 1024 and height 768, the upper right corner * has position (1023,767). * * The position is an in/out parameter which indicates the final pen position * of the font renderer after rendering the string. The method returns whether * or not the string was able to be drawn successfully. */ virtual Bool drawString( const UTF8String& string, const FontStyle& style, Vector2f& position ) = 0; /// Draw the specified number of characters from a string iterator using the provided font style. /** * The position and font size are assumed to be in viewport pixel coordinates. * For instance, the lower left corner of the current viewport has position (0,0) * and for a viewport with width 1024 and height 768, the upper right corner * has position (1023,767). * * The position is an in/out parameter which indicates the final pen position * of the font renderer after rendering the string. The method returns whether * or not the characters were able to be drawn successfully. */ virtual Bool drawCharacters( UTF8StringIterator& string, Size numCharacters, const FontStyle& style, Vector2f& position ) = 0; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** String Size Accessor Method /// Retrieve a bounding box for the specified string using the given font style. /** * This method computes a bounding box for the string where the starting * pen position is the origin (0,0). If the method succeeds, the string's * bounding box is placed in the output reference parameter and TRUE is returned. * If the method fails, FALSE is returned and no bounding box is computed. */ virtual Bool getStringBounds( const UTF8String& string, const FontStyle& style, AABB2f& bounds ) = 0; /// Retrieve a bounding box for the specified string iterator's next line using the given font style. /** * This method computes the bounding box of every character from the specified * string iterator until either a new line character is encountered or the * size of the string's bounding box exceeds the specified maximum size. * * Thie method can be used to perform text wrapping. Use the final position * of the iterator to know how many characters to draw. */ virtual Bool getLineBounds( UTF8StringIterator& string, const FontStyle& style, const Vector2f& maxSize, AABB2f& bounds ) = 0; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** String Caching Method /// Cache all of the glyphs in the specified string with the given font style. /** * This method allows the user to cache whatever rendering state is necessary * to draw the glyphs contained in the given string with the specified font * style. Since loading glyphs from a font file can be slow, this allows an * application to pre-cache commonly needed glyphs to avoid rendering stalls * when the drawer loads new glyphs at runtime. * * The method returns whether or not the string's characters were successfully * cached. The default implementation does nothing and returns FALSE. */ virtual Bool cacheString( const UTF8String& string, const FontStyle& style ) { return false; } private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Members }; //########################################################################################## //********************* End Rim Graphics GUI Fonts Namespace ***************************** RIM_GRAPHICS_GUI_FONTS_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_GRAPHICS_GUI_FONT_DRAWER_H <file_sep>/* * rimFileSystemNode.h * Rim IO * * Created by <NAME> on 5/22/08. * Copyright 2008 __MyCompanyName__. All rights reserved. * */ #ifndef INCLUDE_RIM_FILE_SYSTEM_NODE_H #define INCLUDE_RIM_FILE_SYSTEM_NODE_H #include "rimFileSystemConfig.h" #include "rimPath.h" //########################################################################################## //************************* Start Rim File System Namespace ****************************** RIM_FILE_SYSTEM_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class which represents the interface for a node within the global file system. /** * A file system node can be either a file or a directory. The file system node allows * the user to query basic properties of the node (size, path, name, type) and to * create and remove the referenced file system node. */ class FileSystemNode { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Destructor /// Destroy a file system node object. virtual ~FileSystemNode() { } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Path Accessor Methods /// Return the name of the file system node, the last component of its path. RIM_INLINE UTF8String getName() const { return path.getName(); } /// Set the name of the file system node, the last component of its path. virtual Bool setName( const UTF8String& newName ) = 0; /// Return a string representing the extension of this node's file name. /** * The extension is defined as the characters after the last period '.' * in the node's file name. */ RIM_INLINE UTF8String getExtension() const { return path.getExtension(); } /// Return a path object representing the path to this file system node. RIM_INLINE const Path& getPath() const { return path; } /// Return a string representing the path to the file system node. RIM_INLINE const UTF8String& getPathString() const { return path.toString(); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Node Attribute Accessor Methods /// Return whether or not the file system node is a file. virtual Bool isAFile() const = 0; /// Return whether or not the file system node is a directory. virtual Bool isADirectory() const = 0; /// Return whether or not the file system node is at the root level of the file system. RIM_INLINE Bool isAtRootLevel() const { return path.isAtRootLevel(); } /// Return whether or not this file system node exists. virtual Bool exists() const = 0; /// Get the total size of the file system node. /** * For files, this is the total size of the file. For directories, * this is the total size of all child file system nodes. */ virtual LargeSize getSize() const = 0; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Node Modification Methods /// Create this file system node if it doesn't exist. /** * If the file system node already exists, no operation is performed * and FALSE is returned. If the creation operation was not successful, * FALSE is returned. Otherwise, TRUE is returned and the node is created. */ virtual Bool create() = 0; /// Remove this file system node and all children (if it is a directory). virtual Bool remove() = 0; protected: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Protected Constructor /// Create a file system node which is represented by the specified path string. RIM_INLINE FileSystemNode( const UTF8String& newPathString ) : path( newPathString ) { } /// Create a file system node which is represented by the specified path. RIM_INLINE FileSystemNode( const Path& newPath ) : path( newPath ) { } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Members /// The path to this file system node. Path path; }; //########################################################################################## //************************* End Rim File System Namespace ******************************** RIM_FILE_SYSTEM_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_FILE_SYSTEM_NODE_H <file_sep>/* * rimGraphicsCamerasConfig.h * Rim Graphics * * Created by <NAME> on 11/28/11. * Copyright 2011 __MyCompanyName__. All rights reserved. * */ #ifndef INCLUDE_RIM_GRAPHICS_CAMERAS_CONFIG_H #define INCLUDE_RIM_GRAPHICS_CAMERAS_CONFIG_H #include "../rimGraphicsConfig.h" #include "../rimGraphicsUtilities.h" //########################################################################################## //########################################################################################## //############ //############ Library Namespace Configuration //############ //########################################################################################## //########################################################################################## #ifndef RIM_GRAPHICS_CAMERAS_NAMESPACE_START #define RIM_GRAPHICS_CAMERAS_NAMESPACE_START RIM_GRAPHICS_NAMESPACE_START namespace cameras { #endif #ifndef RIM_GRAPHICS_CAMERAS_NAMESPACE_END #define RIM_GRAPHICS_CAMERAS_NAMESPACE_END }; RIM_GRAPHICS_NAMESPACE_END #endif //########################################################################################## //*********************** Start Rim Graphics Cameras Namespace *************************** RIM_GRAPHICS_CAMERAS_NAMESPACE_START //****************************************************************************************** //########################################################################################## using rim::graphics::util::BoundingCone; using rim::graphics::util::Transformable; using rim::graphics::util::Viewport; using rim::graphics::util::ViewVolume; //########################################################################################## //*********************** End Rim Graphics Cameras Namespace ***************************** RIM_GRAPHICS_CAMERAS_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_GRAPHICS_CAMERAS_CONFIG_H <file_sep>/* * rimGraphicsObject.h * Rim Graphics * * Created by <NAME> on 11/28/09. * Copyright 2009 Rim Software. All rights reserved. * */ #ifndef INCLUDE_RIM_GRAPHICS_OBJECT_H #define INCLUDE_RIM_GRAPHICS_OBJECT_H #include "rimGraphicsObjectsConfig.h" #include "rimGraphicsObjectFlags.h" //########################################################################################## //************************ Start Rim Graphics Objects Namespace ************************** RIM_GRAPHICS_OBJECTS_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class that describes a hierarchy of shapes and their transformations. class GraphicsObject : public Transformable { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructors /// Create a default object with no shape centered at the origin. GraphicsObject(); /// Create an object with no shape and the specified transformation. GraphicsObject( const Transform3& newTransform ); /// Create an object centered at the origin with the specified shape. GraphicsObject( const Pointer<GraphicsShape>& newShape ); /// Create an object with the specified shape and transformation. GraphicsObject( const Pointer<GraphicsShape>& newShape, const Transform3& newTransform ); /// Create an object with the specified shape, transformation, and child objects. GraphicsObject( const Pointer<GraphicsShape>& newShape, const Transform3& newTransform, const ArrayList< Pointer<GraphicsObject> >& newChildren ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Destructor /// Destroy a graphics object. virtual ~GraphicsObject(); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Shape Accessor Methods /// Return the number of shapes that this object has. RIM_FORCE_INLINE Size getShapeCount() const { return shapes.getSize(); } /// Return a pointer to the shape for this object at the specified index. RIM_FORCE_INLINE const Pointer<GraphicsShape>& getShape( Index shapeIndex ) const { return shapes[shapeIndex]; } /// Set the shape for this object at the specified index. /** * The method returns whether or not the operation was successful. * The method fails if the new shape pointer is NULL. */ Bool addShape( const Pointer<GraphicsShape>& newShape ); /// Set the shape for this object at the specified index. /** * The method returns whether or not the operation was successful. * The method fails if the new shape pointer is NULL. */ RIM_INLINE Bool setShape( Index shapeIndex, const Pointer<GraphicsShape>& newShape ) { if ( shapeIndex >= shapes.getSize() || newShape.isNull() ) return false; shapes[shapeIndex] = newShape; return true; } /// Remove the shape from this object at the specified index. /** * The method returns whether or not the operation was successful. * The method fails if the specified index is out of bounds. */ Bool removeShape( Index shapeIndex ); /// Remove the specified shape from this object. /** * @return whether or not the shape was successfully found and removed. */ Bool removeShape( const Pointer<GraphicsShape>& shape ); /// Remove all shapes from this object. void clearShapes(); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Child Object Accessor Methods /// Return the number of child objects that this object has. RIM_FORCE_INLINE Size getChildCount() const { return children.getSize(); } /// Return a pointer to the child object at the specified index. RIM_FORCE_INLINE const Pointer<GraphicsObject>& getChild( Index childIndex ) const { return children[childIndex]; } /// Add a child object to this graphics object. /** * The method returns whether or not the add operation was successful. * The method fails if the specified new child pointer is NULL. */ Bool addChild( const Pointer<GraphicsObject>& child ); /// Remove the child object from this object at the specified index. /** * The method returns whether or not the operation was successful. * The method fails if the specified index is out of bounds. */ Bool removeChild( Index childIndex ); /// Remove the specified child object from this object. /** * @return whether or not the child object was successfully found and removed. */ Bool removeChild( const Pointer<GraphicsObject>& child ); /// Remove all children from this graphics object. void clearChildren(); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Flags Accessor Methods /// Return a reference to an object which contains boolean parameters of the graphics object. RIM_INLINE GraphicsObjectFlags& getFlags() { return flags; } /// Return an object which contains boolean parameters of the graphics object. RIM_INLINE const GraphicsObjectFlags& getFlags() const { return flags; } /// Set an object which contains boolean parameters of the graphics object. RIM_INLINE void setFlags( const GraphicsObjectFlags& newFlags ) { flags = newFlags; } /// Return whether or not the specified boolan flag is set for this graphics object. RIM_INLINE Bool flagIsSet( GraphicsObjectFlags::Flag flag ) const { return flags.isSet( flag ); } /// Set whether or not the specified boolan flag is set for this graphics object. RIM_INLINE void setFlag( GraphicsObjectFlags::Flag flag, Bool newIsSet = true ) { flags.set( flag, newIsSet ); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Visibility Accessor Methods /// Get whether or not the object and its children are visible in the scene. RIM_INLINE Bool getIsVisible() const { return flags.isSet( GraphicsObjectFlags::VISIBLE ); } /// Set whether or not the object and its children are visible in the scene. RIM_INLINE void setIsVisible( Bool newIsVisible ) { flags.set( GraphicsObjectFlags::VISIBLE, newIsVisible ); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Visibility Accessor Methods /// Get whether or not this object can cast shadows. RIM_INLINE Bool getShadowsEnabled() const { return flags.isSet( GraphicsObjectFlags::SHADOWS_ENABLED ); } /// Set whether or not this object can cast shadows. RIM_INLINE void setShadowsEnabled( Bool newCanCastShadows ) { flags.set( GraphicsObjectFlags::SHADOWS_ENABLED, newCanCastShadows ); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Bounding Volume Accessor Methods /// Update this object's bounding box. /** * This method uses the current bounding boxes for all child objects and shapes * to compute a new bounding box for this object in its parent coordinate frame. * This method does not update the bounding boxes for each shape that is part of * this object, but it does recursively call updateBoundingBox() on all child * objects so that the entire object hierarchy is updated with one method call. */ virtual void updateBoundingBox(); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Name Accessor Methods /// Return the name of the graphics object. RIM_INLINE const String& getName() const { return name; } /// Set the name of the graphics object. RIM_INLINE void setName( const String& newName ) { name = newName; } private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Static Data Members /// An integer which contains the default boolean flags for a graphics object. static const UInt32 DEFAULT_FLAGS = GraphicsObjectFlags::VISIBLE | GraphicsObjectFlags::SHADOWS_ENABLED; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Members /// A list of pointers to the shapes of this object. ShortArrayList< Pointer<GraphicsShape>, 2 > shapes; /// A list of child objects which form a hierarchy of transformations. ShortArrayList< Pointer<GraphicsObject>, 2 > children; /// An object which contains boolean flags for this graphics object. GraphicsObjectFlags flags; /// A name for this graphics object. String name; }; //########################################################################################## //************************ End Rim Graphics Objects Namespace **************************** RIM_GRAPHICS_OBJECTS_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_GRAPHICS_OBJECT_H <file_sep>/* * rimQueue.h * Rim Framework * * Created by <NAME> on 2/27/08. * Copyright 2008 Rim Software. All rights reserved. * */ #ifndef INCLUDE_RIM_QUEUE_H #define INCLUDE_RIM_QUEUE_H #include "rimUtilitiesConfig.h" #include "rimAllocator.h" //########################################################################################## //*************************** Start Rim Framework Namespace ****************************** RIM_UTILITIES_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A linked queue data structure, with first-in-first-out semantics. template < typename T > class Queue { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructor /// Create a new empty queue with no elements. RIM_INLINE Queue() : head( NULL ), tail( NULL ), numElements( 0 ) { } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Copy Constructor /// Perform a deep copy of a queue, copying all of its elements. RIM_INLINE Queue( const Queue<T>& other ) : head( NULL ), tail( NULL ), numElements( 0 ) { if ( other.head ) { numElements = other.numElements; Node* current = other.head; tail = head = util::construct<Node>( current->data, (Node*)NULL, (Node*)NULL ); current = current->next; while ( current ) { // copy and add each node to this queue tail = tail->next = util::construct<Node>( current->data, tail, (Node*)NULL ); current = current->next; } } } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Assignment Operator /// Assign the contents of one queue to another, performing a deep copy. RIM_INLINE Queue& operator = ( const Queue<T>& other ) { if ( this != &other ) { // deallocate the previous contents clear(); // Copy the queue only if it has elements. if ( other.head ) { numElements = other.numElements; Node* current = other.head; tail = head = util::construct<Node>( current->data, (Node*)NULL, (Node*)NULL ); current = current->next; while ( current ) { // copy and add each node to this queue tail = tail->next = util::construct<Node>( current->data, tail, (Node*)NULL ); current = current->next; } } } return *this; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Destructor /// Destroy a queue, deallocating all memory used by internal structures. RIM_INLINE ~Queue() { this->clear(); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Queue Methods /// Add an element to the end of the queue. /** * This increases the size of the queue by one and * allocates another node in the queue's internal linked * data structure. * * @param newElement - the new element to add to the end of the queue */ RIM_INLINE void add( const T& newElement ) { if ( head == NULL ) tail = head = util::construct<Node>( newElement, (Node*)NULL, (Node*)NULL ); else tail = tail->next = util::construct<Node>( newElement, tail, (Node*)NULL ); numElements++; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Remove Methods /// Remove the first element in the queue if one exists. /** * If the queue is not empty, then the first element in the * queue is remove (the first element put in that has not yet * been dequeued). Otherwise, if the queue is empty, an assertion is raised. */ RIM_INLINE void remove() { RIM_DEBUG_ASSERT_MESSAGE( head != NULL, "Cannot remove an element from an empty queue." ); // If the queue is one element, set the tail to NULL. (no elements after dequeue). if ( head == tail ) tail = NULL; Node* oldHead = head; // remove the first element in the queue head = oldHead->next; if ( head != NULL ) head->previous = NULL; util::destruct( oldHead ); numElements--; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Contains Method /// Return whether or not the specified element is in the queue. RIM_INLINE Bool contains( const T& element ) const { Node* current = head; while ( current ) { if ( current->data == element ) return true; current = current->next; } return false; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Element Accessor Methods /// Return a reference to the first element in the queue. /** * If there are no elements in the queue, then an assertion is raised. * The first element in the queue is the first element that was enqueued * which has not yet been dequeued. * * @return the first element in the queue. */ RIM_INLINE T& getFirst() { RIM_DEBUG_ASSERT_MESSAGE( head != NULL, "Cannot peek at an empty queue." ); return head->data; } /// Return a const reference to the first element in the queue. /** * If there are no elements in the queue, then an assertion is raised. * The first element in the queue is the first element that was enqueued * which has not yet been dequeued. * * @return the first element in the queue. */ RIM_INLINE const T& getFirst() const { RIM_DEBUG_ASSERT_MESSAGE( head != NULL, "Cannot peek at an empty queue." ); return head->data; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Clear Method /// Remove all elements from the queue. /** * This method deallocates all memory used by the queue, * reseting it to the state of when it was first constructed. */ RIM_INLINE void clear() { Node* current = head; while ( current ) { Node* previous = current; current = previous->next; util::destruct( previous ); } head = tail = NULL; numElements = Size(0); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Size Accessor Methods /// Return whether or not the queue has any elements. /** * This method returns TRUE if the size of the queue * is greater than zero, and FALSE otherwise. * * @return whether or not the priority queue has any elements. */ RIM_INLINE Bool isEmpty() const { return numElements == Size(0); } /// Return the number of elements in the queue. /** * @return the number of elements in the queue */ RIM_INLINE Size getSize() const { return numElements; } private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Queue Node Class /// A class which defines the type of a doubly-linked node in a queue. class Node { public: //**************************************************** // Constructors /// Create a new node with the specified data element and previous and next node pointers. RIM_INLINE Node( const T& newData, Node* newPrevious, Node* newNext ) : data( newData ), previous( newPrevious ), next( newNext ) { } //**************************************************** // Data Members /// The data contained by the queue node. T data; /// A pointer to the previous node in the queue. Node* previous; /// A pointer to the next node in the queue. Node* next; }; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Members /// The head of the queue (pointing to the first element). Node* head; /// The tail of the queue (pointing to the last element). Node* tail; /// The number of elements in the queue. Size numElements; }; //########################################################################################## //*************************** End Rim Framework Namespace ******************************** RIM_UTILITIES_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_QUEUE_H <file_sep>/* * rimDataOutputStream.h * Rim IO * * Created by <NAME> on 10/29/08. * Copyright 2008 __MyCompanyName__. All rights reserved. * */ #ifndef INCLUDE_RIM_DATA_OUTPUT_STREAM_H #define INCLUDE_RIM_DATA_OUTPUT_STREAM_H #include "rimIOConfig.h" //########################################################################################## //****************************** Start Rim IO Namespace ********************************** RIM_IO_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class/interface which represents an abstract write-only stream of data. class DataOutputStream { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructors /// Create a DataOutputStream with the native output endianness. RIM_INLINE DataOutputStream() { } /// Create a DataOutputStream with the specified output endianness. RIM_INLINE DataOutputStream( data::Endianness newEndianness ) : endianness( newEndianness ) { } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Destructor /// Destroy an output stream and free all of its resources (close it). virtual ~DataOutputStream() { } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Primitive Type Write Methods /// Write the specified signed 8-bit integer value to the data output stream. /** * The method returns TRUE if the value was successfully written. Otherwise, * the method returns FALSE and nothing is written to the stream. */ RIM_INLINE Bool write( Int8 value ) { return writeData( (const UByte*)&value, sizeof(Int8) ) == sizeof(Int8); } /// Write the specified unsigned 8-bit integer value to the data output stream. /** * The method returns TRUE if the value was successfully written. Otherwise, * the method returns FALSE and nothing is written to the stream. */ RIM_INLINE Bool write( UInt8 value ) { return writeData( (const UByte*)&value, sizeof(UInt8) ) == sizeof(UInt8); } /// Write the specified signed 16-bit integer value to the data output stream. /** * The method returns TRUE if the value was successfully written. Otherwise, * the method returns FALSE and nothing is written to the stream. */ RIM_INLINE Bool write( Int16 value ) { Int16 temp = endianness.convertFromNative( value ); return writeData( (const UByte*)&temp, sizeof(Int16) ) == sizeof(Int16); } /// Write the specified unsigned 16-bit integer value to the data output stream. /** * The method returns TRUE if the value was successfully written. Otherwise, * the method returns FALSE and nothing is written to the stream. */ RIM_INLINE Bool write( UInt16 value ) { UInt16 temp = endianness.convertFromNative( value ); return writeData( (const UByte*)&temp, sizeof(UInt16) ) == sizeof(UInt16); } /// Write the specified signed 32-bit integer value to the data output stream. /** * The method returns TRUE if the value was successfully written. Otherwise, * the method returns FALSE and nothing is written to the stream. */ RIM_INLINE Bool write( Int32 value ) { Int32 temp = endianness.convertFromNative( value ); return writeData( (const UByte*)&temp, sizeof(Int32) ) == sizeof(Int32); } /// Write the specified unsigned 32-bit integer value to the data output stream. /** * The method returns TRUE if the value was successfully written. Otherwise, * the method returns FALSE and nothing is written to the stream. */ RIM_INLINE Bool write( UInt32 value ) { UInt32 temp = endianness.convertFromNative( value ); return writeData( (const UByte*)&temp, sizeof(UInt32) ) == sizeof(UInt32); } /// Write the specified signed 64-bit integer value to the data output stream. /** * The method returns TRUE if the value was successfully written. Otherwise, * the method returns FALSE and nothing is written to the stream. */ RIM_INLINE Bool write( Int64 value ) { Int64 temp = endianness.convertFromNative( value ); return writeData( (const UByte*)&temp, sizeof(Int64) ) == sizeof(Int64); } /// Write the specified unsigned 64-bit integer value to the data output stream. /** * The method returns TRUE if the value was successfully written. Otherwise, * the method returns FALSE and nothing is written to the stream. */ RIM_INLINE Bool write( UInt64 value ) { UInt64 temp = endianness.convertFromNative( value ); return writeData( (const UByte*)&temp, sizeof(UInt64) ) == sizeof(UInt64); } /// Write the specified 32-bit floating-point value to the data output stream. /** * The method returns TRUE if the value was successfully written. Otherwise, * the method returns FALSE and nothing is written to the stream. */ RIM_INLINE Bool write( Float32 value ) { Float32 temp = endianness.convertFromNative( value ); return writeData( (const UByte*)&temp, sizeof(Float32) ) == sizeof(Float32); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Data Write Methods /// Write as much of the specified data array to the stream and return the number of bytes written. RIM_INLINE Size write( const data::Data& data ) { return writeData( data.getPointer(), data.getSize() ); } /// Write as much of the specified data array to the stream and return the number of bytes written. RIM_INLINE Size write( const data::DataBuffer& dataBuffer ) { return writeData( dataBuffer.getPointer(), dataBuffer.getSize() ); } /// Write as many bytes as possible from the specified data pointer and return the number written. RIM_INLINE Size write( const UByte* data, Size number ) { if ( data == NULL ) return 0; return writeData( data, number ); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Flush Method /// Flush the output stream, sending all internally buffered output to it's destination. /** * This method causes all currently pending output data to be sent to it's * final destination. This method ensures that this is done and that all internal * data buffers are emptied if they have any contents. */ virtual void flush() = 0; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Seeking Methods /// Return whether or not this type of stream allows seeking. /** * Some types of IO (like files) allow seeking, but others, especially those * over networks don't allow streaming. This method allows the user to detect * that situation. */ virtual Bool canSeek() const = 0; /// Return whether or not this stream can seek by the specified amount in bytes. /** * Since some streams may not support rewinding, this method can be used * to determine if a given seek operation can succeed. The method can also * be used to determine if the end of a stream has been reached, a seek past * the end of a file will fail. */ virtual Bool canSeek( Int64 relativeOffset ) const = 0; /// Move the current position in the stream by the specified relative signed offset in bytes. /** * The method attempts to seek in the stream by the specified amount and * returns the signed amount that the position in the stream was changed by * in bytes. A negative offset indicates that the position should be moved in * reverse and a positive offset indicates that the position should be moved * forwards. */ virtual Int64 seek( Int64 relativeOffset ) = 0; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Endian-ness Accessor Methods /// Get the current endianness of the data being written to the stream. RIM_INLINE data::Endianness getEndianness() const { return endianness; } /// Set the stream to write data in the specified endian format. RIM_INLINE void setEndianness( data::Endianness newEndianness ) { endianness = newEndianness; } protected: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Protected Data Write Methods /// Write the specified number of bytes of data from the buffer to the stream. virtual Size writeData( const UByte* data, Size number ) = 0; private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Members /// The endianness with which the data output to the stream is being written in. data::Endianness endianness; }; //########################################################################################## //****************************** End Rim IO Namespace ************************************ RIM_IO_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_DATA_OUTPUT_STREAM_H <file_sep>/* * rimStringOutputStream.h * Rim IO * * Created by <NAME> on 10/29/08. * Copyright 2008 __MyCompanyName__. All rights reserved. * */ #ifndef INCLUDE_RIM_STRING_OUTPUT_STREAM_H #define INCLUDE_RIM_STRING_OUTPUT_STREAM_H #include "rimIOConfig.h" //########################################################################################## //****************************** Start Rim IO Namespace ********************************** RIM_IO_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class which abstracts a destination for stream of character information. class StringOutputStream { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructors /// Create a StringOutputStream with the native output endianness. RIM_INLINE StringOutputStream() { } /// Create a StringOutputStream with the specified output endianness. RIM_INLINE StringOutputStream( data::Endianness newEndianness ) : endianness( newEndianness ) { } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Destructor /// Destroy an output stream and free all of it's resources (close it). virtual ~StringOutputStream() { } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** ASCII String Write Methods /// Write one ASCII character to the output stream. RIM_INLINE Bool writeASCII( Char character ) { return this->writeChars( &character, Size(1) ) == Size(1); } /// Write characters from the buffer until a NULl terminator is reached and return the number written. RIM_INLINE Size writeASCII( const Char* characters ) { return this->writeChars( characters, data::String::getLength( characters ) ); } /// Write the specified number of characters from the buffer and return the number written. RIM_INLINE Size writeASCII( const Char* characters, Size numCharacters ) { return this->writeChars( characters, numCharacters ); } /// Write the specified string to the output string and return the number of characters written. RIM_INLINE Size writeASCII( const data::String& string ) { return this->writeChars( string.getCString(), string.getLength() ); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** UTF-8 String Write Methods /// Write one UTF-8 character to the output stream. RIM_INLINE Bool writeUTF8( UTF8Char character ) { return this->writeUTF8Chars( &character, Size(1) ) == Size(1); } /// Write characters from the buffer until a NULl terminator is reached and return the number written. RIM_INLINE Size writeUTF8( const UTF8Char* characters ) { return this->writeUTF8Chars( characters, data::UTF8String::getLength( characters ) ); } /// Write the specified number of characters from the buffer and return the number written. RIM_INLINE Size writeUTF8( const UTF8Char* characters, Size numCharacters ) { return this->writeUTF8Chars( characters, numCharacters ); } /// Write the specified string to the output string and return the number of characters written. RIM_INLINE Size writeUTF8( const data::UTF8String& string ) { return this->writeUTF8Chars( string.getCString(), string.getLength() ); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** UTF-16 String Write Methods /// Write one UTF-16 character to the output stream. RIM_INLINE Bool writeUTF16( UTF16Char character ) { character = endianness.convertToNative( character ); return this->writeUTF16Chars( &character, Size(1) ) == Size(1); } /// Write characters from the buffer until a NULl terminator is reached and return the number written. RIM_INLINE Size writeUTF16( const UTF16Char* characters ) { const UTF16Char* character = characters; Size numWritten = 0; while ( *character ) { numWritten += this->writeUTF16( *character ) ? 1 : 0; character++; } return numWritten; } /// Write the specified number of characters from the buffer and return the number written. RIM_INLINE Size writeUTF16( const UTF16Char* characters, Size numCharacters ) { const UTF16Char* character = characters; const UTF16Char* const charactersEnd = characters + numCharacters; Size numWritten = 0; while ( character != charactersEnd ) { numWritten += this->writeUTF16( *character ) ? 1 : 0; character++; } return numWritten; } /// Write the specified string to the output string and return the number of characters written. RIM_INLINE Size writeUTF16( const data::UTF16String& string ) { return this->writeUTF16( string.getCString(), string.getLength() ); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** UTF-32 String Write Methods /// Write one UTF-32 character to the output stream. RIM_INLINE Bool writeUTF32( UTF32Char character ) { character = endianness.convertToNative( character ); return this->writeUTF32Chars( &character, Size(1) ) == Size(1); } /// Write characters from the buffer until a NULl terminator is reached and return the number written. RIM_INLINE Size writeUTF32( const UTF32Char* characters ) { const UTF32Char* character = characters; Size numWritten = 0; while ( *character ) { numWritten += this->writeUTF32( *character ) ? 1 : 0; character++; } return numWritten; } /// Write the specified number of characters from the buffer and return the number written. RIM_INLINE Size writeUTF32( const UTF32Char* characters, Size numCharacters ) { const UTF32Char* character = characters; const UTF32Char* const charactersEnd = characters + numCharacters; Size numWritten = 0; while ( character != charactersEnd ) { numWritten += this->writeUTF32( *character ) ? 1 : 0; character++; } return numWritten; } /// Write the specified string to the output string and return the number of characters written. RIM_INLINE Size writeUTF32( const data::UTF32String& string ) { return this->writeUTF32( string.getCString(), string.getLength() ); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Flush Method /// Flush the output stream, sending all internally buffered output to it's destination. /** * This method causes all currently pending output data to be sent to it's * final destination. This method ensures that this is done and that all internal * data buffers are emptied if they have any contents. */ virtual void flush() = 0; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Endian-ness Accessor Methods /// Get the current endianness of the wide characters being written to the stream. RIM_INLINE data::Endianness getEndianness() const { return endianness; } /// Set the stream to write wide characters in the specified endian format. RIM_INLINE void setEndianness( data::Endianness newEndianness ) { endianness = newEndianness; } protected: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Protected String Write Methods /// Write the specified number of characters from the character buffer and return the number written. virtual Size writeChars( const Char* characters, Size number ) = 0; /// Write the specified number of UTF-8 characters from the character buffer and return the number written. virtual Size writeUTF8Chars( const UTF8Char* characters, Size number ) = 0; /// Write the specified number of UTF-16 characters from the character buffer and return the number written. virtual Size writeUTF16Chars( const UTF16Char* characters, Size number ) = 0; /// Write the specified number of UTF-32 characters from the character buffer and return the number written. virtual Size writeUTF32Chars( const UTF32Char* characters, Size number ) = 0; private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Members /// The endianness in which the data being written to the stream is converted to. /** * Wide characters are converted from the native platform endianness to this * endianness before they are written to a string output stream. */ data::Endianness endianness; }; //########################################################################################## //****************************** End Rim IO Namespace ************************************ RIM_IO_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_STRING_OUTPUT_STREAM_H <file_sep>/* * rimSignal.h * Rim Threads * * Created by <NAME> on 8/27/09. * Copyright 2009 Rim Software. All rights reserved. * */ #ifndef INCLUDE_RIM_SIGNAL_H #define INCLUDE_RIM_SIGNAL_H #include "rimThreadsConfig.h" #include "../rimUtilities.h" //########################################################################################## //*************************** Start Rim Threads Namespace ******************************** RIM_THREADS_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class which represents a thread-to-thread signal event. /** * This class allows a thread to wait for a given signal object. This will * halt the execution of that thread until another thread signals that the signal * has been raised. At that point the waiting thread wakes up and begins execution * again. A typical application of this class would be in produce-consumer systems * where one thread is waiting for data from another thread. */ class Signal { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructors /// Create a new signal object. Signal(); /// Create a copy of a signal object. /** * This has the effect of linking the two signal objects - * whenever one is signaled, all listeners for the other * receive the signal. */ Signal( const Signal& signal ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Destructor /// Destroy a signal object. /** * This has the effect of signaling all listening * threads that the signal has been sent. This is * done in order to prevent deadlocks. */ ~Signal(); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Assignment Operator /// Assign one signal to another. /** * This has the effect of linking the two signal objects - * whenever one is signaled, all listeners for the other * receive the signal. */ Signal& operator = ( const Signal& signal ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Signal/Listen Methods /// Send a signal to all listening threads. void signal(); /// Wait until the signal is given by another thread. /** * This method blocks the calling thread until another * thread calls the signal() method on this object. */ void wait() const; /// Lock the mutex associated with this signal. void lock(); /// Unlock this mutex associated with this signal. void unlock(); private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Signal Wrapper Class Declaration /// A class which encapsulates internal platform-specific Signal code. class SignalWrapper; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Members /// A wrapper of the internal platform-specific state of the signal. SignalWrapper* wrapper; }; //########################################################################################## //*************************** End Rim Threads Namespace ********************************** RIM_THREADS_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_SIGNAL_H <file_sep>/* * rimBigFloat.h * Rim Software * * Created by <NAME> on 2/16/14. * Copyright 2014 __MyCompanyName__. All rights reserved. * */ #ifndef INCLUDE_RIM_BIG_FLOAT_H #define INCLUDE_RIM_BIG_FLOAT_H #include "rimLanguageConfig.h" //########################################################################################## //*************************** Start Rim Language Namespace ******************************* RIM_LANGUAGE_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class which stores a high-precision floating point number. /** * The precision should be at least great enough to accurately represent the * locations of objects on a galactic scale down to sub-millimeter precision. * The class uses a signed integer + signed fractional component representation * in order to enable high precision. The arithmetic operators defined for the * type are implemented so that there is minimal loss in precision. * * The class uses a template parameter type to specify the maximum value allowed * for the fractional component of the number. This determines the smallest and largest * values that the number is able to represent accurately. A bigger unit size will * allow bigger number to be represented at the expense of small-scale precision, while * a larger unit size will allow better small-scale precision at the expense of * the maximum range of the type. */ template < UInt unit = 1 > class BigFloat { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Public Type Definitions /// The type to use for the integer component of this big float. typedef Int64 IntegerType; /// The type to use for the fractional component of this big float. typedef Float32 FloatType; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructors /// Create a BigFloat object with the value 0. RIM_FORCE_INLINE BigFloat() : integer( 0 ), fraction( 0 ) { } /// Create a BigFloat object with the value of the specified byte. RIM_FORCE_INLINE BigFloat( Byte value ) { floatToBigFloat( (Float)value, integer, fraction ); } /// Create a BigFloat object with the value of the specified short number. RIM_FORCE_INLINE BigFloat( Short value ) { floatToBigFloat( (Float)value, integer, fraction ); } /// Create a BigFloat object with the value of the specified int number. RIM_FORCE_INLINE BigFloat( Int value ) { doubleToBigFloat( (Double)value, integer, fraction ); } /// Create a BigFloat object with the value of the specified long number. RIM_FORCE_INLINE BigFloat( Long value ) { doubleToBigFloat( (Double)value, integer, fraction ); } /// Create a BigFloat object with the value of the specified long-long number. RIM_FORCE_INLINE BigFloat( LongLong value ) { doubleToBigFloat( (Double)value, integer, fraction ); } /// Create a BigFloat object with the value of the specified float number. RIM_FORCE_INLINE BigFloat( Float value ) { floatToBigFloat( value, integer, fraction ); } /// Create a BigFloat object with the value of the specified double number. RIM_FORCE_INLINE BigFloat( Double value ) { doubleToBigFloat( value, integer, fraction ); } /// Create a new big float which uses the specified integer and fractional components. RIM_FORCE_INLINE BigFloat( IntegerType newInteger, Float newFraction ) : integer( newInteger ), fraction( newFraction ) { normalize( integer, fraction ); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Arithmetic Assignment Operators /// Add another BigFloat to this big float's value. RIM_FORCE_INLINE BigFloat& operator += ( const BigFloat& other ) { integer += other.integer; fraction += other.fraction; normalize( integer, fraction ); return *this; } /// Subtract another BigFloat from this big float's value. RIM_FORCE_INLINE BigFloat& operator -= ( const BigFloat& other ) { integer -= other.integer; fraction -= other.fraction; normalize( integer, fraction ); return *this; } /// Multiply this big float's value by another BigFloat. RIM_FORCE_INLINE BigFloat& operator *= ( const BigFloat& other ) { IntegerType i = integer*other.integer; FloatType f = fraction*other.fraction; Double d = Double(integer)*Double(other.fraction) + Double(fraction)*Double(other.integer); IntegerType i2; FloatType f2; doubleToBigFloat( d, i2, f2 ); integer = i + i2; fraction = f + f2; return *this; } /// Divide this big float's value by another BigFloat. RIM_FORCE_INLINE BigFloat& operator /= ( const BigFloat& other ) { doubleToBigFloat( (Double)(*this) / (Double)other, integer, fraction ); return *this; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Arithmetic Operators /// Add another BigFloat to this big float's value. RIM_FORCE_INLINE BigFloat operator + ( const BigFloat& other ) { IntegerType i = integer + other.integer; FloatType f = fraction + other.fraction; return BigFloat( i, f ); } /// Subtract another BigFloat from this big float's value. RIM_FORCE_INLINE BigFloat operator - ( const BigFloat& other ) { IntegerType i = integer - other.integer; FloatType f = fraction - other.fraction; return BigFloat( i, f ); } /// Multiply this big float's value by another BigFloat. RIM_FORCE_INLINE BigFloat operator * ( const BigFloat& other ) { IntegerType i = integer*other.integer; FloatType f = fraction*other.fraction; Double d = Double(integer)*Double(other.fraction) + Double(fraction)*Double(other.integer); IntegerType i2; FloatType f2; doubleToBigFloat( d, i2, f2 ); i += i2; f += f2; return BigFloat( i, f ); } /// Divide this big float's value by another BigFloat. RIM_FORCE_INLINE BigFloat operator / ( const BigFloat& other ) { return BigFloat( (Double)(*this) / (Double)other ); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Internal Representation Accessor Methods /// Return the integral component of this big float. RIM_FORCE_INLINE IntegerType getInteger() const { return integer; } /// Set the integral component of this big float. RIM_FORCE_INLINE void setInteger( IntegerType newInteger ) { integer = newInteger; } /// Return the fractional component of this big float. RIM_FORCE_INLINE FloatType getFraction() const { return fraction; } /// Set the fractional component of this big float. /** * This causes the big float to be renormalized to make sure the fractional * component is less than the unit size. */ RIM_FORCE_INLINE void setFraction( FloatType newFraction ) { fraction = newFraction; normalize( integer, fraction ); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Cast Operators /// Cast the big float object to a single-precision floating point number. RIM_FORCE_INLINE operator Float () const { return bigFloatToFloat( integer, fraction ); } /// Cast the big float object to a double-precision floating point number. RIM_FORCE_INLINE operator Double () const { return bigFloatToDouble( integer, fraction ); } private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Static Helper Methods /// Convert the specified single precision float number to a big float number. RIM_FORCE_INLINE static void floatToBigFloat( Float floatValue, IntegerType& integer, FloatType& fraction ) { Float floor = math::floor( floatValue/(Float)unit ); integer = IntegerType(floor); fraction = FloatType(floatValue - floor*unit); } /// Convert the specified double precision float number to a big float number. RIM_FORCE_INLINE static void doubleToBigFloat( Double doubleValue, IntegerType& integer, FloatType& fraction ) { Double floor = math::floor( doubleValue/(Double)unit ); integer = IntegerType(floor); fraction = FloatType(doubleValue - floor*unit); } /// Convert the specified big float number to a single precision float number. RIM_FORCE_INLINE static Float bigFloatToFloat( IntegerType integer, FloatType fraction ) { return Float(integer)*Float(unit) + fraction; } /// Convert the specified big float number to a double precision float number. RIM_FORCE_INLINE static Double bigFloatToDouble( IntegerType integer, FloatType fraction ) { return Double(integer)*Double(unit) + Double(fraction); } /// Normalize the specified big float so that the fractional component lies between 0 and 1. RIM_FORCE_INLINE static void normalize( IntegerType& integer, FloatType& fraction ) { FloatType floor = math::floor( fraction/(Float)unit ); integer += IntegerType(floor); fraction = FloatType(fraction - floor*unit); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Members /// The integer portion of the big floating point number. IntegerType integer; /// The fractional portion of the big floating point number. FloatType fraction; }; //########################################################################################## //*************************** End Rim Language Namespace ********************************* RIM_LANGUAGE_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_BIG_FLOAT_H <file_sep>/* * rimSIMDScalarFloat64_2.h * Rim Framework * * Created by <NAME> on 1/19/13. * Copyright 2013 __MyCompanyName__. All rights reserved. * */ #ifndef INCLUDE_RIM_SIMD_SCALAR_FLOAT_64_2_H #define INCLUDE_RIM_SIMD_SCALAR_FLOAT_64_2_H #include "rimMathConfig.h" #include "rimSIMDScalar.h" #include "rimSIMDScalarInt64_2.h" //########################################################################################## //***************************** Start Rim Math Namespace ********************************* RIM_MATH_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class representing a 4-component 32-bit floating-point SIMD scalar. /** * This specialization of the SIMDScalar class uses a 128-bit value to encode * 4 32-bit floating-point values. All basic arithmetic operations are supported, * plus a subset of standard scalar operations: abs(), min(), max(), sqrt(). */ template <> class RIM_ALIGN(16) SIMDScalar<Float64,2> { private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Type Declarations /// Define the type for a 2x double scalar structure. #if RIM_USE_SIMD && defined(RIM_SIMD_SSE) && RIM_SSE_VERSION_IS_SUPPORTED(1,0) typedef __m128d SIMDDouble2; #endif //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Constructor #if RIM_USE_SIMD && (defined(RIM_SIMD_SSE) && RIM_SSE_VERSION_IS_SUPPORTED(1,0)) /// Create a new 2D scalar with the specified 2D SIMD scalar value. RIM_FORCE_INLINE SIMDScalar( SIMDDouble2 simdScalar ) : v( simdScalar ) { } #endif public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructors /// Create a new 2D SIMD scalar with all elements left uninitialized. RIM_FORCE_INLINE SIMDScalar() { } /// Create a new 2D SIMD scalar with all elements equal to the specified value. RIM_FORCE_INLINE SIMDScalar( Float64 value ) { #if RIM_USE_SIMD && defined(RIM_SIMD_SSE) && RIM_SSE_VERSION_IS_SUPPORTED(2,0) v = _mm_set1_pd( value ); #else a = b = value; #endif } /// Create a new 2D SIMD scalar with the elements equal to the specified 2 values. RIM_FORCE_INLINE SIMDScalar( Float64 newA, Float64 newB ) { #if RIM_USE_SIMD && defined(RIM_SIMD_SSE) && RIM_SSE_VERSION_IS_SUPPORTED(2,0) // The parameters are reversed to keep things consistent with loading from an address. v = _mm_set_pd( newB, newA ); #else a = newA; b = newB; #endif } /// Create a new 2D SIMD scalar from the first 4 values stored at specified pointer's location. RIM_FORCE_INLINE SIMDScalar( const Float64* array ) { #if RIM_USE_SIMD && defined(RIM_SIMD_SSE) && RIM_SSE_VERSION_IS_SUPPORTED(2,0) v = _mm_load_pd( array ); #else a = array[0]; b = array[1]; #endif } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Copy Constructor /// Create a new SIMD scalar with the same contents as another. /** * This shouldn't have to be overloaded, but for some reason the compiler (GCC) * optimizes SIMD code better with it overloaded. Before, the compiler would * store the result of a SIMD operation on the stack before transfering it to * the destination, resulting in an extra 8+ load/stores per computation. */ RIM_FORCE_INLINE SIMDScalar( const SIMDScalar& other ) { #if RIM_USE_SIMD && defined(RIM_SIMD_SSE) && RIM_SSE_VERSION_IS_SUPPORTED(2,0) v = other.v; #else a = other.a; b = other.b; #endif } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Assignment Operator /// Assign the contents of one SIMDScalar object to another. /** * This shouldn't have to be overloaded, but for some reason the compiler (GCC) * optimizes SIMD code better with it overloaded. Before, the compiler would * store the result of a SIMD operation on the stack before transfering it to * the destination, resulting in an extra 8+ load/stores per computation. */ RIM_FORCE_INLINE SIMDScalar& operator = ( const SIMDScalar& other ) { #if RIM_USE_SIMD && defined(RIM_SIMD_SSE) && RIM_SSE_VERSION_IS_SUPPORTED(2,0) v = other.v; #else a = other.a; b = other.b; #endif return *this; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Load Methods RIM_FORCE_INLINE static SIMDScalar load( const Float64* array ) { #if RIM_USE_SIMD && defined(RIM_SIMD_SSE) && RIM_SSE_VERSION_IS_SUPPORTED(2,0) return SIMDScalar( _mm_load_pd( array ) ); #else return SIMDScalar( array[0], array[1], array[2], array[3] ); #endif } RIM_FORCE_INLINE static SIMDScalar loadUnaligned( const Float64* array ) { #if RIM_USE_SIMD && defined(RIM_SIMD_SSE) && RIM_SSE_VERSION_IS_SUPPORTED(2,0) return SIMDScalar( _mm_loadu_pd( array ) ); #else return SIMDScalar( array[0], array[1] ); #endif } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Store Method RIM_FORCE_INLINE void store( Float64* destination ) const { #if RIM_USE_SIMD && defined(RIM_SIMD_SSE) && RIM_SSE_VERSION_IS_SUPPORTED(2,0) _mm_store_pd( destination, v ); #else destination[0] = a; destination[1] = b; #endif } RIM_FORCE_INLINE void storeUnaligned( Float64* destination ) const { #if RIM_USE_SIMD && defined(RIM_SIMD_SSE) && RIM_SSE_VERSION_IS_SUPPORTED(2,0) _mm_storeu_pd( destination, v ); #else destination[0] = a; destination[1] = b; #endif } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Accessor Methods /// Get a reference to the value stored at the specified component index in this scalar. RIM_FORCE_INLINE Float64& operator [] ( Index i ) { return x[i]; } /// Get the value stored at the specified component index in this scalar. RIM_FORCE_INLINE Float64 operator [] ( Index i ) const { return x[i]; } /// Get a pointer to the first element in this scalar. /** * The remaining values are in the next 3 locations after the * first element. */ RIM_FORCE_INLINE const Float64* toArray() const { return x; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Comparison Operators /// Compare two 2D SIMD scalars component-wise for equality. /** * Return a 2D scalar of integers indicating the result of the comparison. * If each corresponding pair of components is equal, the corresponding result * component is non-zero. Otherwise, that result component is equal to zero. */ RIM_FORCE_INLINE SIMDScalar<Int64,2> operator == ( const SIMDScalar& scalar ) const { #if RIM_USE_SIMD && defined(RIM_SIMD_SSE) && RIM_SSE_VERSION_IS_SUPPORTED(2,0) return SIMDScalar<Int64,2>( _mm_cmpeq_pd( v, scalar.v ) ); #else return SIMDScalar<Int64,2>( a == scalar.a, b == scalar.b ); #endif } /// Compare this scalar to a single floating point value for equality. /** * Return a 2D scalar of integers indicating the result of the comparison. * The float value is expanded to a 4-wide SIMD scalar and compared with this scalar. * If each corresponding pair of components is equal, the corresponding result * component is non-zero. Otherwise, that result component is equal to zero. */ RIM_FORCE_INLINE SIMDScalar<Int64,2> operator == ( const Float64 value ) const { #if RIM_USE_SIMD && defined(RIM_SIMD_SSE) && RIM_SSE_VERSION_IS_SUPPORTED(2,0) return SIMDScalar<Int64,2>( _mm_cmpeq_pd( v, _mm_set1_pd( value ) ) ); #else return SIMDScalar<Int64,2>( a == value, b == value ); #endif } /// Compare two 2D SIMD scalars component-wise for inequality /** * Return a 2D scalar of integers indicating the result of the comparison. * If each corresponding pair of components is not equal, the corresponding result * component is non-zero. Otherwise, that result component is equal to zero. */ RIM_FORCE_INLINE SIMDScalar<Int64,2> operator != ( const SIMDScalar& scalar ) const { #if RIM_USE_SIMD && defined(RIM_SIMD_SSE) && RIM_SSE_VERSION_IS_SUPPORTED(2,0) return SIMDScalar<Int64,2>( _mm_cmpneq_pd( v, scalar.v ) ); #else return SIMDScalar<Int64,2>( a != scalar.a, b != scalar.b ); #endif } /// Compare this scalar to a single floating point value for inequality. /** * Return a 2D scalar of integers indicating the result of the comparison. * The float value is expanded to a 4-wide SIMD scalar and compared with this scalar. * If each corresponding pair of components is not equal, the corresponding result * component is non-zero. Otherwise, that result component is equal to zero. */ RIM_FORCE_INLINE SIMDScalar<Int64,2> operator != ( const Float64 value ) const { #if RIM_USE_SIMD && defined(RIM_SIMD_SSE) && RIM_SSE_VERSION_IS_SUPPORTED(2,0) return SIMDScalar<Int64,2>( _mm_cmpneq_pd( v, _mm_set1_pd( value ) ) ); #else return SIMDScalar<Int64,2>( a != value, b != value ); #endif } /// Perform a component-wise less-than comparison between this and another 2D SIMD scalar. /** * Return a 2D scalar of integers indicating the result of the comparison. * If each corresponding pair of components has this scalar's component less than * the other scalar's component, the corresponding result component is non-zero. * Otherwise, that result component is equal to zero. */ RIM_FORCE_INLINE SIMDScalar<Int64,2> operator < ( const SIMDScalar& scalar ) const { #if RIM_USE_SIMD && defined(RIM_SIMD_SSE) && RIM_SSE_VERSION_IS_SUPPORTED(2,0) return SIMDScalar<Int64,2>( _mm_cmplt_pd( v, scalar.v ) ); #else return SIMDScalar<Int64,2>( a < scalar.a, b < scalar.b ); #endif } /// Perform a component-wise less-than comparison between this 2D SIMD scalar and an expanded scalar. /** * Return a 2D scalar of integers indicating the result of the comparison. * The float value is expanded to a 4-wide SIMD scalar and compared with this scalar. * If each corresponding pair of components has this scalar's component less than * the other scalar's component, the corresponding result component is non-zero. * Otherwise, that result component is equal to zero. */ RIM_FORCE_INLINE SIMDScalar<Int64,2> operator < ( const Float64 value ) const { #if RIM_USE_SIMD && defined(RIM_SIMD_SSE) && RIM_SSE_VERSION_IS_SUPPORTED(2,0) return SIMDScalar<Int64,2>( _mm_cmplt_pd( v, _mm_set1_pd( value ) ) ); #else return SIMDScalar<Int64,2>( a < value, b < value ); #endif } /// Perform a component-wise greater-than comparison between this an another 2D SIMD scalar. /** * Return a 2D scalar of integers indicating the result of the comparison. * If each corresponding pair of components has this scalar's component greater than * the other scalar's component, the corresponding result component is non-zero. * Otherwise, that result component is equal to zero. */ RIM_FORCE_INLINE SIMDScalar<Int64,2> operator > ( const SIMDScalar& scalar ) const { #if RIM_USE_SIMD && defined(RIM_SIMD_SSE) && RIM_SSE_VERSION_IS_SUPPORTED(2,0) return SIMDScalar<Int64,2>( _mm_cmpgt_pd( v, scalar.v ) ); #else return SIMDScalar<Int64,2>( a > scalar.a, b > scalar.b ); #endif } /// Perform a component-wise greater-than comparison between this 2D SIMD scalar and an expanded scalar. /** * Return a 2D scalar of integers indicating the result of the comparison. * The float value is expanded to a 4-wide SIMD scalar and compared with this scalar. * If each corresponding pair of components has this scalar's component greater than * the other scalar's component, the corresponding result component is non-zero. * Otherwise, that result component is equal to zero. */ RIM_FORCE_INLINE SIMDScalar<Int64,2> operator > ( const Float64 value ) const { #if RIM_USE_SIMD && defined(RIM_SIMD_SSE) && RIM_SSE_VERSION_IS_SUPPORTED(2,0) return SIMDScalar<Int64,2>( _mm_cmpgt_pd( v, _mm_set1_pd( value ) ) ); #else return SIMDScalar<Int64,2>( a > value, b > value ); #endif } /// Perform a component-wise less-than-or-equal-to comparison between this an another 2D SIMD scalar. /** * Return a 2D scalar of integers indicating the result of the comparison. * If each corresponding pair of components has this scalar's component less than * or equal to the other scalar's component, the corresponding result component is non-zero. * Otherwise, that result component is equal to zero. */ RIM_FORCE_INLINE SIMDScalar<Int64,2> operator <= ( const SIMDScalar& scalar ) const { #if RIM_USE_SIMD && defined(RIM_SIMD_SSE) && RIM_SSE_VERSION_IS_SUPPORTED(2,0) return SIMDScalar<Int64,2>( _mm_cmple_pd( v, scalar.v ) ); #else return SIMDScalar<Int64,2>( a <= scalar.a, b <= scalar.b ); #endif } /// Perform a component-wise less-than-or-equal-to comparison between this 2D SIMD scalar and an expanded scalar. /** * Return a 2D scalar of integers indicating the result of the comparison. * The float value is expanded to a 4-wide SIMD scalar and compared with this scalar. * If each corresponding pair of components has this scalar's component less than * or equal to the other scalar's component, the corresponding result component is non-zero. * Otherwise, that result component is equal to zero. */ RIM_FORCE_INLINE SIMDScalar<Int64,2> operator <= ( const Float64 value ) const { #if RIM_USE_SIMD && defined(RIM_SIMD_SSE) && RIM_SSE_VERSION_IS_SUPPORTED(2,0) return SIMDScalar<Int64,2>( _mm_cmple_pd( v, _mm_set1_pd( value ) ) ); #else return SIMDScalar<Int64,2>( a <= value, b <= value ); #endif } /// Perform a component-wise greater-than-or-equal-to comparison between this an another 2D SIMD scalar. /** * Return a 2D scalar of integers indicating the result of the comparison. * If each corresponding pair of components has this scalar's component greater than * or equal to the other scalar's component, the corresponding result component is non-zero. * Otherwise, that result component is equal to zero. */ RIM_FORCE_INLINE SIMDScalar<Int64,2> operator >= ( const SIMDScalar& scalar ) const { #if RIM_USE_SIMD && defined(RIM_SIMD_SSE) && RIM_SSE_VERSION_IS_SUPPORTED(2,0) return SIMDScalar<Int64,2>( _mm_cmpge_pd( v, scalar.v ) ); #else return SIMDScalar<Int64,2>( a >= scalar.a, b >= scalar.b ); #endif } /// Perform a component-wise greater-than-or-equal-to comparison between this 2D SIMD scalar and an expanded scalar. /** * Return a 2D scalar of integers indicating the result of the comparison. * The float value is expanded to a 4-wide SIMD scalar and compared with this scalar. * If each corresponding pair of components has this scalar's component greater than * or equal to the other scalar's component, the corresponding result component is non-zero. * Otherwise, that result component is equal to zero. */ RIM_FORCE_INLINE SIMDScalar<Int64,2> operator >= ( const Float64 value ) const { #if RIM_USE_SIMD && defined(RIM_SIMD_SSE) && RIM_SSE_VERSION_IS_SUPPORTED(2,0) return SIMDScalar<Int64,2>( _mm_cmpge_pd( v, _mm_set1_pd( value ) ) ); #else return SIMDScalar<Int64,2>( a >= value, b >= value ); #endif } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Sum Method RIM_FORCE_INLINE Float64 sum() const { #if RIM_USE_SIMD && defined(RIM_SIMD_SSE) && RIM_SSE_VERSION_IS_SUPPORTED(3,0) return SIMDScalar( _mm_hadd_pd( v, v ) ).a; #else return a + b; #endif } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Negation/Positivation Operators /// Negate a scalar. /** * This method negates every component of this 2D SIMD scalar * and returns the result, leaving this scalar unmodified. * * @return the negation of the original scalar. */ RIM_FORCE_INLINE SIMDScalar operator - () const { #if RIM_USE_SIMD && defined(RIM_SIMD_SSE) && RIM_SSE_VERSION_IS_SUPPORTED(2,0) return SIMDScalar( _mm_sub_pd( _mm_set1_pd(Float64(0)), v ) ); #else return SIMDScalar( -a, -b ); #endif } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Arithmetic Operators /// Add this scalar to another and return the result. /** * This method adds another scalar to this one, component-wise, * and returns this addition. It does not modify either of the original * scalars. * * @param scalar - The scalar to add to this one. * @return The addition of this scalar and the parameter. */ RIM_FORCE_INLINE SIMDScalar operator + ( const SIMDScalar& scalar ) const { #if RIM_USE_SIMD && defined(RIM_SIMD_SSE) && RIM_SSE_VERSION_IS_SUPPORTED(2,0) return SIMDScalar( _mm_add_pd( v, scalar.v ) ); #else return SIMDScalar( a + scalar.a, b + scalar.b ); #endif } /// Add a value to every component of this scalar. /** * This method adds the value parameter to every component * of the scalar, and returns a scalar representing this result. * It does not modifiy the original scalar. * * @param value - The value to add to all components of this scalar. * @return The resulting scalar of this addition. */ RIM_FORCE_INLINE SIMDScalar operator + ( const Float64 value ) const { #if RIM_USE_SIMD && defined(RIM_SIMD_SSE) && RIM_SSE_VERSION_IS_SUPPORTED(2,0) return SIMDScalar( _mm_add_pd( v, _mm_set1_pd(value) ) ); #else return SIMDScalar( a + value, b + value ); #endif } /// Subtract a scalar from this scalar component-wise and return the result. /** * This method subtracts another scalar from this one, component-wise, * and returns this subtraction. It does not modify either of the original * scalars. * * @param scalar - The scalar to subtract from this one. * @return The subtraction of the the parameter from this scalar. */ RIM_FORCE_INLINE SIMDScalar operator - ( const SIMDScalar& scalar ) const { #if RIM_USE_SIMD && defined(RIM_SIMD_SSE) && RIM_SSE_VERSION_IS_SUPPORTED(2,0) return SIMDScalar( _mm_sub_pd( v, scalar.v ) ); #else return SIMDScalar( a - scalar.a, b - scalar.b ); #endif } /// Subtract a value from every component of this scalar. /** * This method subtracts the value parameter from every component * of the scalar, and returns a scalar representing this result. * It does not modifiy the original scalar. * * @param value - The value to subtract from all components of this scalar. * @return The resulting scalar of this subtraction. */ RIM_FORCE_INLINE SIMDScalar operator - ( const Float64 value ) const { #if RIM_USE_SIMD && defined(RIM_SIMD_SSE) && RIM_SSE_VERSION_IS_SUPPORTED(2,0) return SIMDScalar( _mm_sub_pd( v, _mm_set1_pd(value) ) ); #else return SIMDScalar( a - value, b - value ); #endif } /// Multiply component-wise this scalar and another scalar. /** * This operator multiplies each component of this scalar * by the corresponding component of the other scalar and * returns a scalar representing this result. It does not modify * either original scalar. * * @param scalar - The scalar to multiply this scalar by. * @return The result of the multiplication. */ RIM_FORCE_INLINE SIMDScalar operator * ( const SIMDScalar& scalar ) const { #if RIM_USE_SIMD && defined(RIM_SIMD_SSE) && RIM_SSE_VERSION_IS_SUPPORTED(2,0) return SIMDScalar( _mm_mul_pd( v, scalar.v ) ); #else return SIMDScalar( a*scalar.a, b*scalar.b ); #endif } /// Multiply every component of this scalar by a value and return the result. /** * This method multiplies the value parameter with every component * of the scalar, and returns a scalar representing this result. * It does not modifiy the original scalar. * * @param value - The value to multiplly with all components of this scalar. * @return The resulting scalar of this multiplication. */ RIM_FORCE_INLINE SIMDScalar operator * ( const Float64 value ) const { #if RIM_USE_SIMD && defined(RIM_SIMD_SSE) && RIM_SSE_VERSION_IS_SUPPORTED(2,0) return SIMDScalar( _mm_mul_pd( v, _mm_set1_pd(value) ) ); #else return SIMDScalar( a*value, b*value ); #endif } /// Divide this scalar by another scalar component-wise. /** * This operator divides each component of this scalar * by the corresponding component of the other scalar and * returns a scalar representing this result. It does not modify * either original scalar. * * @param scalar - The scalar to multiply this scalar by. * @return The result of the division. */ RIM_FORCE_INLINE SIMDScalar operator / ( const SIMDScalar& scalar ) const { #if RIM_USE_SIMD && defined(RIM_SIMD_SSE) && RIM_SSE_VERSION_IS_SUPPORTED(2,0) return SIMDScalar( _mm_div_pd( v, scalar.v ) ); #else return SIMDScalar( a/scalar.a, b/scalar.b ); #endif } /// Divide every component of this scalar by a value and return the result. /** * This method Divides every component of the scalar by the value parameter, * and returns a scalar representing this result. * It does not modifiy the original scalar. * * @param value - The value to divide all components of this scalar by. * @return The resulting scalar of this division. */ RIM_FORCE_INLINE SIMDScalar operator / ( const Float64 value ) const { #if RIM_USE_SIMD && defined(RIM_SIMD_SSE) && RIM_SSE_VERSION_IS_SUPPORTED(2,0) return SIMDScalar( _mm_mul_pd( v, _mm_set1_pd(Float64(1) / value) ) ); #else Float64 inverse = Float64(1) / value; return SIMDScalar( a*inverse, b*inverse ); #endif } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Arithmetic Assignment Operators /// Add a scalar to this scalar, modifying this original scalar. /** * This method adds another scalar to this scalar, component-wise, * and sets this scalar to have the result of this addition. * * @param scalar - The scalar to add to this scalar. * @return A reference to this modified scalar. */ RIM_FORCE_INLINE SIMDScalar& operator += ( const SIMDScalar& scalar ) { #if RIM_USE_SIMD && defined(RIM_SIMD_SSE) && RIM_SSE_VERSION_IS_SUPPORTED(2,0) v = _mm_add_pd( v, scalar.v ); #else a += scalar.a; b += scalar.b; #endif return *this; } /// Subtract a scalar from this scalar, modifying this original scalar. /** * This method subtracts another scalar from this scalar, component-wise, * and sets this scalar to have the result of this subtraction. * * @param scalar - The scalar to subtract from this scalar. * @return A reference to this modified scalar. */ RIM_FORCE_INLINE SIMDScalar& operator -= ( const SIMDScalar& scalar ) { #if RIM_USE_SIMD && defined(RIM_SIMD_SSE) && RIM_SSE_VERSION_IS_SUPPORTED(2,0) v = _mm_sub_pd( v, scalar.v ); #else a -= scalar.a; b -= scalar.b; #endif return *this; } /// Multiply component-wise this scalar and another scalar and modify this scalar. /** * This operator multiplies each component of this scalar * by the corresponding component of the other scalar and * modifies this scalar to contain the result. * * @param scalar - The scalar to multiply this scalar by. * @return A reference to this modified scalar. */ RIM_FORCE_INLINE SIMDScalar& operator *= ( const SIMDScalar& scalar ) { #if RIM_USE_SIMD && defined(RIM_SIMD_SSE) && RIM_SSE_VERSION_IS_SUPPORTED(2,0) v = _mm_mul_pd( v, scalar.v ); #else a *= scalar.a; b *= scalar.b; #endif return *this; } /// Divide this scalar by another scalar component-wise and modify this scalar. /** * This operator divides each component of this scalar * by the corresponding component of the other scalar and * modifies this scalar to contain the result. * * @param scalar - The scalar to divide this scalar by. * @return A reference to this modified scalar. */ RIM_FORCE_INLINE SIMDScalar& operator /= ( const SIMDScalar& scalar ) { #if RIM_USE_SIMD && defined(RIM_SIMD_SSE) && RIM_SSE_VERSION_IS_SUPPORTED(2,0) v = _mm_div_pd( v, scalar.v ); #else a /= scalar.a; b /= scalar.b; #endif return *this; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Required Alignment Accessor Methods /// Return the alignment required for objects of this type. /** * For most SIMD types this value will be 16 bytes. If there is * no alignment required, 0 is returned. */ RIM_FORCE_INLINE static Size getRequiredAlignment() { #if RIM_USE_SIMD && defined(RIM_SIMD_SSE) && RIM_SSE_VERSION_IS_SUPPORTED(1,0) return 16; #else return 0; #endif } /// Get the width of this scalar (number of components it has). RIM_FORCE_INLINE static Size getWidth() { return 2; } /// Return whether or not this SIMD type is supported by the current CPU. RIM_FORCE_INLINE static Bool isSupported() { SIMDFlags flags = SIMDFlags::get(); return (flags & SIMDFlags::SSE_2) != 0; } private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Members RIM_ALIGN(16) union { #if RIM_USE_SIMD && defined(RIM_SIMD_SSE) && RIM_SSE_VERSION_IS_SUPPORTED(1,0) /// The 2D SIMD vector used internally. SIMDDouble2 v; #endif struct { /// The A component of a 2D SIMD scalar. Float64 a; /// The B component of a 2D SIMD scalar. Float64 b; }; /// The components of a 2D SIMD scalar in array format. Float64 x[2]; }; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Friend Declarations template < typename T, Size width > friend class SIMDVector3D; friend RIM_FORCE_INLINE SIMDScalar abs( const SIMDScalar& scalar ); friend RIM_FORCE_INLINE SIMDScalar ceiling( const SIMDScalar& scalar ); friend RIM_FORCE_INLINE SIMDScalar floor( const SIMDScalar& scalar ); friend RIM_FORCE_INLINE SIMDScalar sqrt( const SIMDScalar& scalar ); friend RIM_FORCE_INLINE SIMDScalar min( const SIMDScalar& scalar1, const SIMDScalar& scalar2 ); friend RIM_FORCE_INLINE SIMDScalar max( const SIMDScalar& scalar1, const SIMDScalar& scalar2 ); template < UInt i1, UInt i2 > friend RIM_FORCE_INLINE SIMDScalar shuffle( const SIMDScalar& scalar1 ); template < UInt i1, UInt i2 > friend RIM_FORCE_INLINE SIMDScalar shuffle( const SIMDScalar& scalar1, const SIMDScalar& scalar2 ); friend RIM_FORCE_INLINE SIMDScalar select( const SIMDScalar<Int64,2>& selector, const SIMDScalar& scalar1, const SIMDScalar& scalar2 ); friend RIM_FORCE_INLINE SIMDScalar subAdd( const SIMDScalar& scalar1, const SIMDScalar& scalar2 ); }; //########################################################################################## //########################################################################################## //############ //############ Associative SIMD Scalar Operators //############ //########################################################################################## //########################################################################################## /// Add a scalar value to each component of this scalar and return the resulting scalar. RIM_FORCE_INLINE SIMDScalar<Float64,2> operator + ( const Float64 value, const SIMDScalar<Float64,2>& scalar ) { return SIMDScalar<Float64,2>(value) + scalar; } /// Subtract a scalar value from each component of this scalar and return the resulting scalar. RIM_FORCE_INLINE SIMDScalar<Float64,2> operator - ( const Float64 value, const SIMDScalar<Float64,2>& scalar ) { return SIMDScalar<Float64,2>(value) - scalar; } /// Multiply a scalar value by each component of this scalar and return the resulting scalar. RIM_FORCE_INLINE SIMDScalar<Float64,2> operator * ( const Float64 value, const SIMDScalar<Float64,2>& scalar ) { return SIMDScalar<Float64,2>(value) * scalar; } /// Divide each component of this scalar by a scalar value and return the resulting scalar. RIM_FORCE_INLINE SIMDScalar<Float64,2> operator / ( const Float64 value, const SIMDScalar<Float64,2>& scalar ) { return SIMDScalar<Float64,2>(value) / scalar; } //########################################################################################## //########################################################################################## //############ //############ Free Vector Functions //############ //########################################################################################## //########################################################################################## /// Compute the absolute value of each component of the specified SIMD scalar and return the result. RIM_FORCE_INLINE SIMDScalar<Float64,2> abs( const SIMDScalar<Float64,2>& scalar ) { #if RIM_USE_SIMD && defined(RIM_SIMD_SSE) && RIM_SSE_VERSION_IS_SUPPORTED(1,0) RIM_ALIGN(16) const UInt64 absMask[2] = { UInt64(0x7FFFFFFFFFFFFFFFull), UInt64(0x7FFFFFFFFFFFFFFFull) }; return SIMDScalar<Float64,2>( _mm_and_pd( scalar.v, _mm_load_pd( reinterpret_cast<const Float64*>(absMask) ) ) ); #else return SIMDScalar<Float64,2>( math::abs(scalar.a), math::abs(scalar.b) ); #endif } /// Compute the ceiling of each component of the specified SIMD scalar and return the result. /** * This method is emulated in software on x86 platforms where SSE 4.1 is not available. */ RIM_FORCE_INLINE SIMDScalar<Float64,2> ceiling( const SIMDScalar<Float64,2>& scalar ) { #if RIM_USE_SIMD && defined(RIM_SIMD_SSE) && RIM_SSE_VERSION_IS_SUPPORTED(4,1) return SIMDScalar<Float64,2>( _mm_ceil_pd( scalar.v ) ); #else return SIMDScalar<Float64,2>( math::ceiling(scalar.a), math::ceiling(scalar.b) ); #endif } /// Compute the floor of each component of the specified SIMD scalar and return the result. /** * This method is emulated in software on x86 platforms where SSE 4.1 is not available. */ RIM_FORCE_INLINE SIMDScalar<Float64,2> floor( const SIMDScalar<Float64,2>& scalar ) { #if RIM_USE_SIMD && defined(RIM_SIMD_SSE) && RIM_SSE_VERSION_IS_SUPPORTED(4,1) return SIMDScalar<Float64,2>( _mm_floor_pd( scalar.v ) ); #else return SIMDScalar<Float64,2>( math::floor(scalar.a), math::floor(scalar.b) ); #endif } /// Compute the square root of each component of the specified SIMD scalar and return the result. RIM_FORCE_INLINE SIMDScalar<Float64,2> sqrt( const SIMDScalar<Float64,2>& scalar ) { #if RIM_USE_SIMD && defined(RIM_SIMD_SSE) && RIM_SSE_VERSION_IS_SUPPORTED(2,0) return SIMDScalar<Float64,2>( _mm_sqrt_pd( scalar.v ) ); #else return SIMDScalar<Float64,2>( math::sqrt(scalar.a), math::sqrt(scalar.b) ); #endif } /// Compute the minimum of each component of the specified SIMD scalars and return the result. RIM_FORCE_INLINE SIMDScalar<Float64,2> min( const SIMDScalar<Float64,2>& scalar1, const SIMDScalar<Float64,2>& scalar2 ) { #if RIM_USE_SIMD && defined(RIM_SIMD_SSE) && RIM_SSE_VERSION_IS_SUPPORTED(2,0) return SIMDScalar<Float64,2>( _mm_min_pd( scalar1.v, scalar2.v ) ); #else return SIMDScalar<Float64,2>( math::min(scalar1.a, scalar2.a), math::min(scalar1.b, scalar2.b) ); #endif } /// Compute the maximum of each component of the specified SIMD scalars and return the result. RIM_FORCE_INLINE SIMDScalar<Float64,2> max( const SIMDScalar<Float64,2>& scalar1, const SIMDScalar<Float64,2>& scalar2 ) { #if RIM_USE_SIMD && defined(RIM_SIMD_SSE) && RIM_SSE_VERSION_IS_SUPPORTED(2,0) return SIMDScalar<Float64,2>( _mm_max_pd( scalar1.v, scalar2.v ) ); #else return SIMDScalar<Float64,2>( math::max(scalar1.a, scalar2.a), math::max(scalar1.b, scalar2.b) ); #endif } /// Pick 2 elements from the specified SIMD scalar and return the result. template < UInt i1, UInt i2 > RIM_FORCE_INLINE SIMDScalar<Float64,2> shuffle( const SIMDScalar<Float64,2>& scalar ) { #if RIM_USE_SIMD && defined(RIM_SIMD_SSE) && RIM_SSE_VERSION_IS_SUPPORTED(2,0) return SIMDScalar<Float64,2>( _mm_shuffle_pd( scalar.v, scalar.v, _MM_SHUFFLE2(i2, i1) ) ); #else return SIMDScalar<Float64,2>( scalar[i1], scalar[i2] ); #endif } /// Pick one element from each SIMD scalar and return the result. template < UInt i1, UInt i2 > RIM_FORCE_INLINE SIMDScalar<Float64,2> shuffle( const SIMDScalar<Float64,2>& scalar1, const SIMDScalar<Float64,2>& scalar2 ) { #if RIM_USE_SIMD && defined(RIM_SIMD_SSE) && RIM_SSE_VERSION_IS_SUPPORTED(1,0) return SIMDScalar<Float64,2>( _mm_shuffle_pd( scalar1.v, scalar2.v, _MM_SHUFFLE2(i2, i1) ) ); #else return SIMDScalar<Float64,2>( scalar1[i1], scalar1[i2] ); #endif } /// Select elements from the first SIMD scalar if the selector is TRUE, otherwise from the second. RIM_FORCE_INLINE SIMDScalar<Float64,2> select( const SIMDScalar<Int64,2>& selector, const SIMDScalar<Float64,2>& scalar1, const SIMDScalar<Float64,2>& scalar2 ) { #if RIM_USE_SIMD && defined(RIM_SIMD_SSE) && RIM_SSE_VERSION_IS_SUPPORTED(1,0) // (((b^a) & selector) ^ a) return SIMDScalar<Float64,2>( _mm_xor_pd( scalar2.v, _mm_and_pd( selector.vDouble, _mm_xor_pd( scalar1.v, scalar2.v ) ) ) ); #else return SIMDScalar<Float64,2>( selector.a ? scalar1.a : scalar2.a, selector.b ? scalar1.b : scalar2.b ); #endif } /// Subtract the first and third elements and add the second and fourth. RIM_FORCE_INLINE SIMDScalar<Float64,2> subAdd( const SIMDScalar<Float64,2>& scalar1, const SIMDScalar<Float64,2>& scalar2 ) { #if RIM_USE_SIMD && defined(RIM_SIMD_SSE) && RIM_SSE_VERSION_IS_SUPPORTED(3,0) return SIMDScalar<Float64,2>( _mm_addsub_pd( scalar1.v, scalar2.v ) ); #else return SIMDScalar<Float64,2>( scalar1.a - scalar2.a, scalar1.b + scalar2.b ); #endif } //########################################################################################## //***************************** End Rim Math Namespace *********************************** RIM_MATH_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_SIMD_SCALAR_FLOAT_64_2_H <file_sep>/* * rimGraphicsOpenGLFramebuffer.h * Rim Graphics * * Created by <NAME> on 3/11/13. * Copyright 2013 __MyCompanyName__. All rights reserved. * */ #ifndef INCLUDE_RIM_GRAPHICS_OPENGL_FRAMEBUFFER_H #define INCLUDE_RIM_GRAPHICS_OPENGL_FRAMEBUFFER_H #include "rimGraphicsOpenGLConfig.h" //########################################################################################## //******************** Start Rim Graphics Devices OpenGL Namespace *********************** RIM_GRAPHICS_DEVICES_OPENGL_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class which enables render-to-texture for OpenGL by specifying textures and their attachment points. class OpenGLFramebuffer : public Framebuffer { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Destructor /// Destroy this framebuffer and all associated state. ~OpenGLFramebuffer(); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Target Texture Accessor Methods /// Return the total number of attached target textures for this framebuffer. virtual Size getTargetCount() const; /// Return the total number of attached target textures with the specified attachment type for this framebuffer. virtual Size getTargetCount( FramebufferAttachment::Type attachmentType ) const; /// Return the texture which is attached at the specified framebuffer attachment point. /** * If there is no target texture for that attachment point, a NULL texture resource * is returned. */ virtual Resource<Texture> getTarget( const FramebufferAttachment& attachment ) const; /// Return whether or not this framebuffer has a valid texture attached to the specified attachment point. virtual Bool hasTarget( const FramebufferAttachment& attachment ) const; /// Set the target texture for the specified framebuffer attachment point. /** * If the specified Texture is valid and supports the specified texture face, * and if the specified attachment point is supported and valid, the texture * is used as the target for the specified attachment point and TRUE is returned * indicating success. Otherwise, FALSE is returned indicating failure, leaving * the framebuffer unchanged. */ virtual Bool setTarget( const FramebufferAttachment& attachment, const Resource<Texture>& newTarget, TextureFace face = TextureFace::FRONT ); /// Remove any previously attached texture from the specified framebuffer attachment point. /** * If a texture was successfully removed, TRUE is returned. Otherwise, FALSE is * returned, indicating that no texture target was removed. */ virtual Bool removeTarget( const FramebufferAttachment& attachment ); /// Remove all attached target textures with the specified attachment type from this framebuffer. virtual void removeTargets( FramebufferAttachment::Type attachmentType ); /// Remove all attached target textures from this framebuffer. virtual void clearTargets(); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Target Texture Face Accessor Methods /// Return an object representing which face of the texture at the specified attachment point is being used. /** * If there is no texture at that attachment point, and UNDEFINED texture face * is returned. Otherwise, the texture face that is being used is returned. * This will be FRONT, unless the texture is a cube map. */ virtual TextureFace getTargetFace( const FramebufferAttachment& attachment ); /// Set the face of the texture at the specified attachment point that is being used. /** * If there is no texture at that attachment point or if the attached texture * doesn't support the specified face type, FALSE is returned and the target * face is not changed. Otherwise, the framebuffer uses the specified texture * face for the attachment point and returns TRUE. */ virtual Bool setTargetFace( const FramebufferAttachment& attachment, TextureFace newFace ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Framebuffer Size Accessor Methods /// Return the minimum size of the framebuffer in pixels along the specified dimension index. /** * This method finds the smallest size of the attached textures along the given dimension. * Indices start from 0 and count to d-1 for a framebuffer with d dimensions. * Since framebuffers are almost always 1D or 2D, dimension indices greater than 1 will * result in a size of 1 being returned, since even a 1x1 framebuffer has a 3D depth * of 1 pixel. * * If there are no attached textures, 0 is returned. */ virtual Size getMinimumSize( Index dimension ) const; /// Return the maximum size of the framebuffer in pixels along the specified dimension index. /** * This method finds the largest size of the attached textures along the given dimension. * Indices start from 0 and count to d-1 for a framebuffer with d dimensions. * Since framebuffers are almost always 1D or 2D, dimension indices greater than 1 will * result in a size of 1 being returned, since even a 1x1 framebuffer has a 3D depth * of 1 pixel. * * If there are no attached textures, 0 is returned. */ virtual Size getMaximumSize( Index dimension ) const; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Framebuffer Validity Accessor Method /// Return whether or not the framebuffer is valid and can be used as a render target. /** * A framebuffer may not be valid if it has no target textures, has an incomplete * set of target textures (missing a required attachment), or if some of the target textures * have an unsupported format. */ virtual Bool isValid() const; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Framebuffer ID Accessor Method /// Get a unique integral identifier for this framebuffer. RIM_INLINE OpenGLID getID() const { return framebufferID; } private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Class Definitions /// A class which stores an association between a framebuffer attachment and its target texture. class Target { public: /// Create a new target texture which uses the specified texture and face for a framebuffer attachment. RIM_INLINE Target( const FramebufferAttachment& newAttachment, const Resource<Texture>& newTexture, TextureFace newFace ) : attachment( newAttachment ), texture( newTexture ), face( newFace ) { } /// An object representing the location where this target is attached. FramebufferAttachment attachment; /// The texture which is to be used as the target for an attachment point. Resource<Texture> texture; /// An object indicating the face of the texture to use for the attachment point. TextureFace face; }; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Friend Class Declaration /// Declare the OpenGLContext class as a friend so that it can create instances of this class. friend class OpenGLContext; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Constructor /// Create an empty framebuffer for the specified context with no attachements. OpenGLFramebuffer( const GraphicsContext* context ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Helper Methods /// Bind the specified target texture and face to the specified attachment point of the OpenGL FBO. /** * The method returns whether or not the bind operation was successful. */ Bool bindTarget( const FramebufferAttachment& attachment, const Resource<Texture>& newTarget, TextureFace face ); /// Unbind the specified target texture from a framebuffer attachment point. void unbindTarget( const Target& target ); /// Update and inform OpenGL of the buffers that should be drawn to. void updateDrawBufferStatus(); /// Find the index of any target texture for the specified attachment point. RIM_FORCE_INLINE Bool findTargetForAttachment( const FramebufferAttachment& attachment, Index& index ) const; /// Get the OpenGL enum value for the specified cube map face. RIM_INLINE static Bool getGLCubeMapFace( const TextureFace& face, OpenGLEnum& glFace ); /// Get the OpenGL enum value for the specified attachment point. RIM_INLINE static Bool getGLAttachmentPoint( const FramebufferAttachment& attachment, OpenGLEnum& glAttachment ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Members /// The OpenGL ID for the framebuffer object associated with this Framebuffer. OpenGLID framebufferID; /// A list of targets associated with this framebuffer. ArrayList<Target> targets; }; //########################################################################################## //******************** End Rim Graphics Devices OpenGL Namespace ************************* RIM_GRAPHICS_DEVICES_OPENGL_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_GRAPHICS_OPENGL_FRAMEBUFFER_H <file_sep>/* * rimGraphicsGenericMeshGroup.h * Rim Software * * Created by <NAME> on 2/2/14. * Copyright 2014 __MyCompanyName__. All rights reserved. * */ #ifndef INCLUDE_RIM_GENERIC_GROUP_H #define INCLUDE_RIM_GENERIC_GROUP_H #include "rimGraphicsShapesConfig.h" //########################################################################################## //*********************** Start Rim Graphics Shapes Namespace **************************** RIM_GRAPHICS_SHAPES_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class which contains information about a group of geometric primitives that have the same attributes. /** * Each group defines a set of vertex indices (into the vertex buffers) * a primitive type for the group, and a material to use when rendering * the group. */ class GenericMeshGroup { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructors /// Create a defalut generic mesh group with no vertex or index buffers, material. RIM_INLINE GenericMeshGroup() : vertexBuffers(), indexBuffer(), primitiveType(), material() { } /// Create a new generic group with the specified material and index buffer pointers. RIM_INLINE GenericMeshGroup( const Pointer<GenericBufferList>& newVertexBuffers, const Pointer<GenericBuffer>& newIndexBuffer, const BufferRange& newBufferRange, const Pointer<GenericMaterial>& newMaterial ) : vertexBuffers( newVertexBuffers ), indexBuffer( newIndexBuffer ), bufferRange( newBufferRange ), material( newMaterial ) { updateBoundingBox(); } /// Create a new generic group with the specified material and index buffer pointers. RIM_INLINE GenericMeshGroup( const Pointer<GenericBufferList>& newVertexBuffers, const Pointer<GenericBuffer>& newIndexBuffer, const BufferRange& newBufferRange, const Pointer<GenericMaterial>& newMaterial, const String& newName ) : vertexBuffers( newVertexBuffers ), indexBuffer( newIndexBuffer ), bufferRange( newBufferRange ), material( newMaterial ), name( newName ) { updateBoundingBox(); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Name Accessor Methods /// Return a the name of this mesh group. RIM_INLINE const String& getName() const { return name; } /// Set the name of this mesh group. RIM_INLINE void setName( const String& newName ) { name = newName; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Vertex Buffer List Accessor Methods /// Get the index buffer associated with this generic group. RIM_INLINE const Pointer<GenericBufferList>& getVertexBuffers() const { return vertexBuffers; } /// Set the index buffer associated with this generic group. RIM_INLINE void setVertexBuffers( const Pointer<GenericBufferList>& newVertexBuffers ) { vertexBuffers = newVertexBuffers; updateBoundingBox(); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Index Buffer Accessor Methods /// Get the index buffer associated with this generic group. RIM_INLINE const Pointer<GenericBuffer>& getIndexBuffer() const { return indexBuffer; } /// Set the index buffer associated with this generic group. RIM_INLINE void setIndexBuffer( const Pointer<GenericBuffer>& newIndexBuffer ) { indexBuffer = newIndexBuffer; updateBoundingBox(); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Buffer Range Accessor Methods /// Return a reference to the buffer range for this mesh group. /** * If the mesh group has an index buffer, the valid range refers to the indices * which should be used when drawing the group. Otherwise, the range refers * to the valid contiguous range of vertices to use. */ RIM_FORCE_INLINE const BufferRange& getBufferRange() const { return bufferRange; } /// Set the buffer range for this mesh group. /** * If the mesh group has an index buffer, the valid range refers to the indices * which should be used when drawing the group. Otherwise, the range refers * to the valid contiguous range of vertices to use. */ RIM_FORCE_INLINE void setBufferRange( const BufferRange& newBufferRange ) { bufferRange = newBufferRange; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Material Accessor Methods /// Return a pointer to the material of this generic group. RIM_INLINE const Pointer<GenericMaterial>& getMaterial() const { return material; } /// Set the material of this generic group. RIM_INLINE void setMaterial( const Pointer<GenericMaterial>& newMaterial ) { material = newMaterial; updateBoundingBox(); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Bounding Box Accessor Methods /// Return a reference to the bounding box for this mesh group. /** * The bounding box returned here may not represent an accurate bounding volume for the * mesh group if any of the underlying geometry changes without notice. If this * occurs, call the updateBoundingBox() method directly to force an update * of the bounding box. */ RIM_FORCE_INLINE const AABB3& getBoundingBox() const { return boundingBox; } /// Force an update the bounding box for this mesh group. /** * This method is automatically called whenever a mesh group is * first created and anytime the vertex or index buffer of a * group is changed. It is declared publicly so that a user can make * sure that the bounding box matches the geometry (which might be * shared and could changed without notice). */ void updateBoundingBox(); private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Members /// An object representing the axis-aligned bounding box for this generic mesh group. AABB3 boundingBox; /// A pointer to a list of vertex buffer which contains the vertex data for this generic group's geometry. Pointer<GenericBufferList> vertexBuffers; /// A pointer to an index buffer which contains the indices for this generic group's geometry. Pointer<GenericBuffer> indexBuffer; /// An object representing the type of geometric primitives this group's index buffer describes. IndexedPrimitiveType primitiveType; /// A pointer to the material associated with this generic group. Pointer<GenericMaterial> material; /// A pointer to string containing a name for this generic group. String name; /// An object which describes the range of vertices or indices to use from the group's buffers. BufferRange bufferRange; }; //########################################################################################## //*********************** End Rim Graphics Shapes Namespace ****************************** RIM_GRAPHICS_SHAPES_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_GENERIC_GROUP_H <file_sep>/* * rimGraphicsOpenGLTexture.h * Rim Graphics * * Created by <NAME> on 3/2/13. * Copyright 2013 __MyCompanyName__. All rights reserved. * */ #ifndef INCLUDE_RIM_GRAPHICS_OPENGL_TEXTURE_H #define INCLUDE_RIM_GRAPHICS_OPENGL_TEXTURE_H #include "rimGraphicsOpenGLConfig.h" //########################################################################################## //******************** Start Rim Graphics Devices OpenGL Namespace *********************** RIM_GRAPHICS_DEVICES_OPENGL_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class which represents an image stored on the graphics hardware. /** * A texture can be either 1D, 2D, 3D, or a cube map (six 2D faces), with * any common texture format (Alpha, Gray, RGB, RGBA, etc.). */ class OpenGLTexture : public Texture { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Destructor /// Destroy a texture and all resources associated with it. ~OpenGLTexture(); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Size Accessor Methods /// Return the number of dimensions in this texture, usually 1, 2, or 3. virtual Size getDimensionCount() const; /// Return the size of the texture along the specified dimension index. virtual Size getSize( Index dimension ) const; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Texture Type Accessor Methods /// Return whether or not this texture is a cube map texture. virtual Bool isACubeMap() const; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Texture Format Accessor Method /// Return a object which represents the internal storage format for the texture. virtual TextureFormat getFormat() const; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Image Data Accessor Methods /// Get the texture's image data for the specified face index with the data in the specified pixel type. virtual Bool getImage( Image& image, const PixelFormat& pixelType, TextureFace face = TextureFace::FRONT, Index mipmapLevel = 0 ) const; /// Replace the current contents of the texture with the specified image. virtual Bool setImage( const Image& newImage, TextureFormat newTextureFormat, TextureFace face = TextureFace::FRONT, Index mipmapLevel = 0 ); /// Update a region of the texture with the specified image. virtual Bool updateImage( const Image& newImage, const Vector3i& position = Vector3i(), TextureFace face = TextureFace::FRONT, Index mipmapLevel = 0 ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Texture Clear Method /// Clear this texture's image using the specified clear color component for the given face and mipmap level. virtual Bool clear( Float channelColor, TextureFace face = TextureFace::FRONT, Index mipmapLevel = 0 ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Texture Wrap Type Accessor Methods /// Get the type of texture wrapping to do when texture coordinates are outside of the range [0,1]. virtual TextureWrapType getWrapType() const; /// Set the type of texture wrapping to do when texture coordinates are outside of the range [0,1]. virtual Bool setWrapType( const TextureWrapType& newWrapType ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Texture Minification Filter Type Accessor Methods /// Get the type of texture filtering which is used when the texture is reduced in size. virtual TextureFilterType getMinificationFilterType() const; /// Set the type of texture filtering which is used when the texture is reduced in size. virtual Bool setMinificationFilterType( const TextureFilterType& newMinificationFilterType ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Texture Magnification Filter Type Accessor Methods /// Get the type of texture filtering which is used when the texture is increased in size. virtual TextureFilterType getMagnificationFilterType() const; /// Set the type of texture filtering which is used when the texture is increased in size. virtual Bool setMagnificationFilterType( const TextureFilterType& newMagnificationFilterType ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Mipmap Accessor Methods /// Generate smaller mipmaps of the texture from the largest texture image (level 0). virtual Bool generateMipmaps(); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Texture Residency Accessor Methods /// Return whether or not the texture is currently in memory on the GPU. virtual Bool isResident() const; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Texture ID Accessor Method /// Get a unique OpenGL integer identifier for this texture. RIM_INLINE OpenGLID getID() const { return textureID; } private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Friend Class Declaration /// Declare the OpenGLContext class as a friend so that it can create instances of this class. friend class OpenGLContext; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Constructors /// Create a 1D texture object with the specified pixel type and width and no pixel data. OpenGLTexture( const GraphicsContext* context ); /// Create a 1D texture object with the specified pixel type and width and no pixel data. OpenGLTexture( const GraphicsContext* context, TextureFormat newTextureFormat, Size width, Bool isCubeMap = false ); /// Create a 2D texture object with the specified pixel type, width and height and no pixel data. OpenGLTexture( const GraphicsContext* context, TextureFormat newTextureFormat, Size width, Size height ); /// Create a 3D texture object with the specified pixel type, width, height and depth and no pixel data. OpenGLTexture( const GraphicsContext* context, TextureFormat newTextureFormat, Size width, Size height, Size depth ); /// Create a new texture object with the specified image and texture format. OpenGLTexture( const GraphicsContext* context, const Image& newImage, TextureFormat newTextureFormat ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Helper Methods /// Allocate space for a texture with the specified format and size but with undefined pixel content. Bool setEmptyImage( TextureFormat newFormat, Size width, Size height, Size depth, Index mipmapLevel ); /// Return an enum value representing the OpenGL pipeline to use for this texture. OpenGLEnum getGLTexturePipeline() const; /// Return an enum value representing the OpenGL pipeline to use for the given texture face. OpenGLEnum getGLTexturePipeline( TextureFace face ) const; /// Get the internal OpenGL texture format for the specified texture format. RIM_INLINE static Bool getGLInternalFormatForTextureFormat( const TextureFormat& format, OpenGLEnum& glFormat ); /// Get the OpenGL texture format for the specified texture format. RIM_INLINE static Bool getGLFormatForTextureFormat( const TextureFormat& format, OpenGLEnum& glFormat ); /// Get the pixel component type for the specified pixel type. RIM_INLINE static Bool getGLPixelComponentType( const PixelFormat& pixelType, OpenGLEnum& glComponentType ); /// Get the OpenGL enum value for the specified cube map face. RIM_INLINE static Bool getGLCubeMapFace( const TextureFace& face, OpenGLEnum& glFace ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Static Data Members /// The maximum number of dimensions that an OpenGL texture can have. static const Size MAX_DIMENSION_COUNT = 3; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Members /// The OpenGL ID uniquely representing this texture. OpenGLID textureID; /// An object representing the internal storage format for this texture. TextureFormat format; /// The type of texture wrapping to do when texture coordinates are outside of the range [0,1]. TextureWrapType wrapType; /// The type of texture filtering to use when sampling a smaller version of this texture. TextureFilterType minificationFilterType; /// The type of texture filtering to use when sampling a smaller version of this texture. TextureFilterType magnificationFilterType; /// An integer value indicating the dimension of this texture (usually 1, 2 or 3). Size numDimensions; /// A fixed-size array which stores the size of this texture along each axis. StaticArray<Size,MAX_DIMENSION_COUNT> size; /// A boolean value indicating whether or not this texture is a cube map. Bool cubeMap; /// A boolean value indicating whether or not this texture is able to be used. Bool valid; }; //########################################################################################## //******************** End Rim Graphics Devices OpenGL Namespace ************************* RIM_GRAPHICS_DEVICES_OPENGL_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_GRAPHICS_OPENGL_TEXTURE_H <file_sep>/* * rimPhysicsMath.h * Rim Physics * * Created by <NAME> on 6/6/12. * Copyright 2012 __MyCompanyName__. All rights reserved. * */ #ifndef INCLUDE_RIM_PHYSICS_UTILITIES_H #define INCLUDE_RIM_PHYSICS_UTILITIES_H #include "rimPhysicsConfig.h" #include "util/rimPhysicsUtilitiesConfig.h" #include "util/rimPhysicsConvexHull.h" #include "util/rimPhysicsInertiaTensor.h" #include "util/rimPhysicsPrimitiveIntersectionTests.h" #include "util/rimPhysicsGJKSolver.h" #include "util/rimPhysicsEPASolver.h" #include "util/rimPhysicsEPAResult.h" #include "util/rimPhysicsVertex.h" #include "util/rimPhysicsTriangle.h" #endif // INCLUDE_RIM_PHYSICS_UTILITIES_H <file_sep>/* * rimGraphicsLightType.h * Rim Graphics * * Created by <NAME> on 10/9/12. * Copyright 2012 __MyCompanyName__. All rights reserved. * */ #ifndef INCLUDE_RIM_GRAPHICS_LIGHT_TYPE_H #define INCLUDE_RIM_GRAPHICS_LIGHT_TYPE_H #include "rimGraphicsLightsConfig.h" //########################################################################################## //************************ Start Rim Graphics Lights Namespace *************************** RIM_GRAPHICS_LIGHTS_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class which represents the type of a light. class LightType { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Public Enum Declaration /// An enum which specifies the different allowed texture faces. typedef enum Enum { /// A light which radiates light evenly in all directions from single point. /** * All Light objects that have this type value can be assumed to be instances * of the class PointLight. */ POINT = 1, /// A light which radiates light from a single point to a cone-shaped area. /** * All Light objects that have this type value can be assumed to be instances * of the class SpotLight. */ SPOT = 2, /// A light which has no position and only direction. /** * This light type is equivalent to an infinitely far away point light and * is often used to approximate these cases. * * All Light objects that have this type value can be assumed to be instances * of the class DirectionalLight. */ DIRECTIONAL = 3, /// The base value for user-defined light types. /** * Users can define new types of lights using this value as a base value, * plus some positive integer offset. All types greater than or equal to * this value are valid user light types. */ USER = 0x1000, /// An undefined light type. UNDEFINED = 0 }; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructors /// Create a new light type with the specified light type enum value. RIM_INLINE LightType( Enum newType ) : type( newType ) { } /// Create a new light type with the specified user-defined light type value. /** * This value should be greater than or equal to the value of LightType::USER * in order to avoid collisions with predefined light types. */ RIM_INLINE LightType( UInt newUserType ) : userType( newUserType ) { } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Enum Cast Operator /// Convert this light type to an enum value. RIM_INLINE operator Enum () const { return type; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** String Representation Accessor Methods /// Return a string representation of the light type. String toString() const; /// Convert this light type into a string representation. RIM_INLINE operator String () const { return this->toString(); } private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Members union { /// An enum value which represents the light type. Enum type; /// An integer value that represents a user-defined light type. UInt userType; }; }; //########################################################################################## //************************ End Rim Graphics Lights Namespace ***************************** RIM_GRAPHICS_LIGHTS_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_GRAPHICS_LIGHT_TYPE_H <file_sep>/* * rimPhysicsObjectCollider.h * Rim Physics * * Created by <NAME> on 11/28/09. * Copyright 2009 Rim Software. All rights reserved. * */ #ifndef INCLUDE_RIM_PHYSICS_OBJECT_COLLIDER_H #define INCLUDE_RIM_PHYSICS_OBJECT_COLLIDER_H #include "rimPhysicsObjectsConfig.h" //########################################################################################## //*********************** Start Rim Physics Objects Namespace **************************** RIM_PHYSICS_OBJECTS_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class which encapsulates concrete collision data for a templated type of object. /** * In practice, one would specialize this class template for each type of object * used in the simulation (rigid, particle, etc.) to encapsulate specific collision * information about each object. For instance, particles are simple and don't need * to specify additional collision information. However, rigid objects can have multiple * shapes and needs to specify which shape instance is being used. * * This default template instantiation contains a pointer to a templated object type * and nothing else. */ template < typename ObjectType > class ObjectCollider { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructors /// Create a ObjectCollider object which encapsulates the specified object. RIM_FORCE_INLINE ObjectCollider( const ObjectType* newObject ) : object( newObject ) { } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Object Accessor Methods /// Return a pointer to the object that constitutes this ObjectCollider. RIM_FORCE_INLINE const ObjectType* getObject() const { return object; } /// Set a pointer to the object that constitutes this ObjectCollider. RIM_FORCE_INLINE void setObject( const ObjectType* newObject ) { object = newObject; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Collider Type Accessor Methods /// Return a const reference the collision shape type for this ObjectCollider. RIM_FORCE_INLINE const CollisionShapeType& getType() const { return type; } /// Return an integral identifier for this collider's collision shape type. RIM_FORCE_INLINE CollisionShapeTypeID getTypeID() const { return type.getID(); } private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Members /// A pointer to the object that constitutes this ObjectCollider. const ObjectType* object; /// An object representing the type of this collider, created from the collider's object type. static const CollisionShapeType type; }; template < typename ObjectType > const CollisionShapeType ObjectCollider<ObjectType>:: type = CollisionShapeType::of<ObjectType>(); //########################################################################################## //*********************** End Rim Physics Objects Namespace ****************************** RIM_PHYSICS_OBJECTS_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_PHYSICS_OBJECT_COLLIDER_H <file_sep>/* * rimSoundFilterParameterCurve.h * Rim Sound * * Created by <NAME> on 8/4/13. * Copyright 2013 __MyCompanyName__. All rights reserved. * */ #ifndef INCLUDE_RIM_SOUND_FILTER_PARAMETER_CURVE_H #define INCLUDE_RIM_SOUND_FILTER_PARAMETER_CURVE_H #include "rimSoundFiltersConfig.h" //########################################################################################## //************************ Start Rim Sound Filters Namespace ***************************** RIM_SOUND_FILTERS_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class which represents the scaling curve to use when displaying a SoundFilter parameter. /** * This class allows the user to specify how to display slider values, graphs, etc. * Certain types of data are better visualized with a log scale, for instance. */ class FilterParameterCurve { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Parameter Type Enum Declaration /// An enum which specifies the different kinds of scaling curves. typedef enum Enum { /// The values are spaced evenly in a linear fashion. LINEAR = 0, /// The value are spaced logarithmically along the number line from the minimum to maximum value. LOGARITHMIC = 1, /// The values are spaced using the function x^2. SQUARE = 2, /// The values are spaced using the function sqrt(x). SQUARE_ROOT = 3, /// The values are spaced using the function x^3. CUBE = 4, /// The values are spaced using the function x^(1/3). CUBE_ROOT = 5 }; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructors /// Create a new filter parameter curve object with the LINEAR parameter curve. RIM_INLINE FilterParameterCurve() : curve( (UByte)LINEAR ) { } /// Create a new filter parameter curve object with the specified units enum value. RIM_INLINE FilterParameterCurve( Enum newCurve ) : curve( (UByte)newCurve ) { } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Enum Cast Operator /// Convert this filter parameter curve type to an enum value. /** * This operator is provided so that the FilterParameterCurve object can be used * directly in a switch statement without the need to explicitly access * the underlying enum value. * * @return the enum representation of this parameter curve type. */ RIM_INLINE operator Enum () const { return (Enum)curve; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** String Representation Accessor Methods /// Return a string representation of the parameter curve type. UTF8String toString() const; /// Convert this parameter curve type into a string representation. RIM_INLINE operator UTF8String () const { return this->toString(); } private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Members /// An enum value indicating the scaling curve type of a SoundFilter parameter. UByte curve; }; //########################################################################################## //************************ End Rim Sound Filters Namespace ******************************* RIM_SOUND_FILTERS_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_SOUND_FILTER_PARAMETER_CURVE_H <file_sep>/* * rimTransformableAnimationTarget.h * Rim Software * * Created by <NAME> on 7/1/14. * Copyright 2014 __MyCompanyName__. All rights reserved. * */ #ifndef INCLUDE_RIM_GRAPHICS_TRANSFORMABLE_ANIMATION_TARGET_H #define INCLUDE_RIM_GRAPHICS_TRANSFORMABLE_ANIMATION_TARGET_H #include "rimGraphicsAnimationConfig.h" #include "rimGraphicsAnimationTarget.h" #include "rimGraphicsAnimationTrackUsage.h" //########################################################################################## //********************** Start Rim Graphics Animation Namespace ************************** RIM_GRAPHICS_ANIMATION_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class that controls a transformable object via animation input data. class TransformableAnimationTarget : public AnimationTarget { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructor /// Create a new object animation target for the specified graphics object and usage. /** * The animation target will only function properly if the object and usage are * compatible. */ TransformableAnimationTarget( const Pointer<Transformable>& newObject, const AnimationTrackUsage& newUsage ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Target Methods /// Return whether or not this target is the same as another. virtual Bool operator == ( const AnimationTarget& other ) const; /// Return whether or not the specified attribute type is compatible with this animation target. virtual Bool isValidType( const AttributeType& type ) const; // Set the target to have the given value. virtual Bool setValue( const AttributeValue& value ); private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Helper Methods template < typename T > RIM_FORCE_INLINE static T convertValue( const AttributeValue& value ); static Bool convertComponents( const UByte* componentData, const AttributeType& type, Real* output ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Members /// A pointer to the graphics object that is being animated. Pointer<Transformable> object; /// An object that determines the object attribute that is animated. AnimationTrackUsage usage; }; //########################################################################################## //********************** End Rim Graphics Animation Namespace **************************** RIM_GRAPHICS_ANIMATION_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_GRAPHICS_TRANSFORMABLE_ANIMATION_TARGET_H <file_sep>/* * rimGraphicsGUIUtilitiesConfig.h * Rim Graphics GUI * * Created by <NAME> on 2/11/13. * Copyright 2013 Headspace Systems. All rights reserved. * */ #ifndef INCLUDE_RIM_GRAPHICS_GUI_UTILITIES_CONFIG_H #define INCLUDE_RIM_GRAPHICS_GUI_UTILITIES_CONFIG_H #include "../rimGraphicsGUIConfig.h" //########################################################################################## //########################################################################################## //############ //############ Library Namespace Configuration //############ //########################################################################################## //########################################################################################## #ifndef RIM_GRAPHICS_GUI_UTILITIES_NAMESPACE_START #define RIM_GRAPHICS_GUI_UTILITIES_NAMESPACE_START RIM_GRAPHICS_GUI_NAMESPACE_START namespace util { #endif #ifndef RIM_GRAPHICS_GUI_UTILITIES_NAMESPACE_END #define RIM_GRAPHICS_GUI_UTILITIES_NAMESPACE_END }; RIM_GRAPHICS_GUI_NAMESPACE_END #endif //########################################################################################## //******************* Start Rim Graphics GUI Utilities Namespace ************************* RIM_GRAPHICS_GUI_UTILITIES_NAMESPACE_START //****************************************************************************************** //########################################################################################## //########################################################################################## //******************* End Rim Graphics GUI Utilities Namespace *************************** RIM_GRAPHICS_GUI_UTILITIES_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_GRAPHICS_GUI_UTILITIES_CONFIG_H <file_sep>/* * rimGraphicsShapeType.h * Rim Graphics * * Created by <NAME> on 2/27/13. * Copyright 2013 __MyCompanyName__. All rights reserved. * */ #ifndef INCLUDE_RIM_GRAPHICS_SHAPE_TYPE_H #define INCLUDE_RIM_GRAPHICS_SHAPE_TYPE_H #include "rimGraphicsShapesConfig.h" //########################################################################################## //*********************** Start Rim Graphics Shapes Namespace **************************** RIM_GRAPHICS_SHAPES_NAMESPACE_START //****************************************************************************************** //########################################################################################## /// Define the integer type to use for a shape type hashed identifier. typedef Hash ShapeTypeID; //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class which encapsulates a RTTI-determined type for a Shape. class ShapeType { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructors /// Create a ShapeType object with the specified internal type. RIM_FORCE_INLINE ShapeType( const Type& newType ) : type( newType.getName() ) { } /// Create a ShapeType object with the specified string type. RIM_FORCE_INLINE ShapeType( const String& newTypeString ) : type( newTypeString ) { } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Static Type Creation Methods /// Return a ShapeType object for the specified type template parameter. template < typename T > RIM_FORCE_INLINE static ShapeType of() { return ShapeType( Type::of<T>() ); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Equality Comparison Operators /// Return whether or not this shape type is equal to another. RIM_FORCE_INLINE Bool operator == ( const ShapeType& other ) const { return type == other.type; } /// Return whether or not this shape type is not equal to another. RIM_FORCE_INLINE Bool operator != ( const ShapeType& other ) const { return type != other.type; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Type ID Accessor Methods /// Return an integer identifying this shape type. /** * This ID is a 32-bit integer that is generated by hashing the string * generated for a type template parameter. While the posibility of * ID collisions is very low, duplicates are nonetheless a possibility. */ RIM_FORCE_INLINE ShapeTypeID getID() const { return type.getHashCode(); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Type String Accessor Methods /// Get a string representing the implementation-defined name of this type. RIM_FORCE_INLINE operator const String& () const { return type; } /// Get a string representing the implementation-defined name of this type. RIM_FORCE_INLINE const String& toString() const { return type; } /// Get a string representing the implementation-defined name of this type. RIM_FORCE_INLINE const String& getName() const { return type; } public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Members /// A string object representing the internal type for this ShapeType. String type; }; //########################################################################################## //*********************** End Rim Graphics Shapes Namespace ****************************** RIM_GRAPHICS_SHAPES_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_GRAPHICS_SHAPE_TYPE_H <file_sep>/* * rimGraphicsDeferredRenderer.h * Rim Graphics * * Created by <NAME> on 5/16/12. * Copyright 2012 __MyCompanyName__. All rights reserved. * */ <file_sep>/* * rimGUIInputMouseButtonEvent.h * Rim GUI * * Created by <NAME> on 1/30/08. * Copyright 2008 __MyCompanyName__. All rights reserved. * */ #ifndef INCLUDE_RIM_GUI_INPUT_MOUSE_BUTTON_EVENT_H #define INCLUDE_RIM_GUI_INPUT_MOUSE_BUTTON_EVENT_H #include "rimGUIInputConfig.h" #include "rimGUIInputMouseButton.h" //########################################################################################## //************************ Start Rim GUI Input Namespace *************************** RIM_GUI_INPUT_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class representing a button press or release event. /** * A mouse button event contains information regarding a particular mouse button * press or release event, such as the mouse button for the event, the new state of the * mouse button, and the position of the mouse when the event occurred. */ class MouseButtonEvent { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructor /// Construct a new mouse button event with button, it's state, and position. RIM_INLINE MouseButtonEvent( const MouseButton& newButton, Bool newButtonIsPressed, const Vector2f& newPosition ) : button( newButton ), position( newPosition ), buttonIsPressed( newButtonIsPressed ) { } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Event Button Accessor Methods /// Return a const reference to the MouseButton that this event relates to. RIM_INLINE const MouseButton& getButton() const { return button; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Event Type Accessor Methods /// Return whether or not the button was pressed. RIM_INLINE Bool isAPress() const { return buttonIsPressed; } /// Return whether or not the button was released. RIM_INLINE Bool isARelease() const { return !buttonIsPressed; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Mouse Position Accessor Methods /// Return the position of the mouse when the mouse button event occurred. RIM_INLINE const Vector2f& getPosition() const { return position; } /// Set the position of the mouse when the mouse button event occurred. RIM_INLINE void setPosition( const Vector2f& newPosition ) { position = newPosition; } private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Members /// A reference to the button this event relates to. const MouseButton& button; /// The position of the mouse when the mouse button event occurred. Vector2f position; /// Whether or not the button is in a pressed or released state. Bool buttonIsPressed; }; //########################################################################################## //************************ End Rim GUI Input Namespace ***************************** RIM_GUI_INPUT_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_GUI_INPUT_MOUSE_BUTTON_EVENT_H <file_sep>/* * rimGraphicsGUIContentView.h * Rim Graphics GUI * * Created by <NAME> on 2/13/13. * Copyright 2013 Headspace Systems. All rights reserved. * */ #ifndef INCLUDE_RIM_GRAPHICS_GUI_CONTENT_VIEW_H #define INCLUDE_RIM_GRAPHICS_GUI_CONTENT_VIEW_H #include "rimGraphicsGUIBase.h" #include "rimGraphicsGUIObject.h" #include "rimGraphicsGUIContentViewDelegate.h" //########################################################################################## //************************ Start Rim Graphics GUI Namespace ****************************** RIM_GRAPHICS_GUI_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class which contains a collection of GUI objects positioned within a 2D rectangle. /** * A content view delegates UI actions to the objects that it contains, as well * as maintains a sorted order for drawing objects based on their depth. */ class ContentView : public GUIObject { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructors /// Create a new content view with no width or height positioned at the origin. ContentView(); /// Create a new empty content view which occupies the specified rectangular region. ContentView( const Rectangle& newRectangle ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Object Accessor Methods /// Return the total number of GUIObjects that are part of this content view. RIM_INLINE Size getObjectCount() const { return objects.getSize(); } /// Return a pointer to the object at the specified index in this content view. /** * Objects are stored in back-to-front sorted order, such that the object * with index 0 is the furthest toward the back of the object ordering. */ RIM_INLINE const Pointer<GUIObject>& getObject( Index objectIndex ) const { return objects[objectIndex]; } /// Add the specified object to this content view. /** * If the specified object pointer is NULL, the method fails and FALSE * is returned. Otherwise, the object is inserted in the front-to-back order * of the content view's objects and TRUE is returned. */ Bool addObject( const Pointer<GUIObject>& newObject ); /// Remove the specified object from this content view. /** * If the given object is part of this content view, the method removes it * and returns TRUE. Otherwise, if the specified object is not found, * the method doesn't modify the content view and FALSE is returned. */ Bool removeObject( const GUIObject* oldObject ); /// Remove all objects from this content view. void clearObjects(); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Border Accessor Methods /// Return a mutable object which describes this content view's border. RIM_INLINE Border& getBorder() { return border; } /// Return an object which describes this content view's border. RIM_INLINE const Border& getBorder() const { return border; } /// Set an object which describes this content view's border. RIM_INLINE void setBorder( const Border& newBorder ) { border = newBorder; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Content Bounding Box Accessor Methods /// Return the 3D bounding box for the content view's content display area in its local coordinate frame. RIM_INLINE AABB3f getLocalContentBounds() const { return AABB3f( this->getLocalContentBoundsXY(), AABB1f( Float(0), this->getSize().z ) ); } /// Return the 2D bounding box for the content view's content display area in its local coordinate frame. RIM_INLINE AABB2f getLocalContentBoundsXY() const { return border.getContentBounds( AABB2f( Vector2f(), this->getSizeXY() ) ); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Color Accessor Methods /// Return the background color for this content view's main area. RIM_INLINE const Color4f& getBackgroundColor() const { return backgroundColor; } /// Set the background color for this content view's main area. RIM_INLINE void setBackgroundColor( const Color4f& newBackgroundColor ) { backgroundColor = newBackgroundColor; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Border Color Accessor Methods /// Return the border color used when rendering a content view. RIM_INLINE const Color4f& getBorderColor() const { return borderColor; } /// Set the border color used when rendering a content view. RIM_INLINE void setBorderColor( const Color4f& newBorderColor ) { borderColor = newBorderColor; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Update Method /// Update the current internal state of this content view for the specified time interval in seconds. /** * This method recursively calls the update() methods for all child objects * so that they are updated. */ virtual void update( Float dt ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Drawing Method /// Draw this content view using the specified GUI renderer to the given parent coordinate system bounds. /** * The method returns whether or not the content view was successfully drawn. */ virtual Bool drawSelf( GUIRenderer& renderer, const AABB3f& parentBounds ) const; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Input Handling Methods /// Handle the specified keyboard event for the entire content view. virtual void keyEvent( const KeyboardEvent& event ); /// Handle the specified mouse motion event for the entire content view. virtual void mouseMotionEvent( const MouseMotionEvent& event ); /// Handle the specified mouse button event for the entire content view. virtual void mouseButtonEvent( const MouseButtonEvent& event ); /// Handle the specified mouse wheel event for the entire content view. virtual void mouseWheelEvent( const MouseWheelEvent& event ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Delegate Accessor Methods /// Return a reference to the delegate which responds to events for this content view. RIM_INLINE ContentViewDelegate& getDelegate() { return delegate; } /// Return a reference to the delegate which responds to events for this content view. RIM_INLINE const ContentViewDelegate& getDelegate() const { return delegate; } /// Return a reference to the delegate which responds to events for this content view. RIM_INLINE void setDelegate( const ContentViewDelegate& newDelegate ) { delegate = newDelegate; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Static Construction Methods /// Construct a smart-pointer-wrapped instance of this class using the constructor with the given arguments. RIM_INLINE static Pointer<ContentView> construct() { return Pointer<ContentView>::construct(); } /// Construct a smart-pointer-wrapped instance of this class using the constructor with the given arguments. RIM_INLINE static Pointer<ContentView> construct( const Rectangle& newRectangle ) { return Pointer<ContentView>::construct( newRectangle ); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Public Static Data Members /// The default border that is used for a content view. static const Border DEFAULT_BORDER; /// The default background color that is used for a content view's area. static const Color4f DEFAULT_BACKGROUND_COLOR; /// The default border color that is used for a content view. static const Color4f DEFAULT_BORDER_COLOR; private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Helper Methods /// Make sure that the list of objects is in sorted order based on their depths. void sortObjectsByDepth(); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Members /// A list of all of the objects that are part of this content view. ArrayList< Pointer<GUIObject> > objects; /// An object which describes the border for this content view. Border border; /// The background color for the content view's area. Color4f backgroundColor; /// The border color for the content view's background area. Color4f borderColor; /// An object which contains function pointers that respond to content view events. ContentViewDelegate delegate; }; //########################################################################################## //************************ End Rim Graphics GUI Namespace ******************************** RIM_GRAPHICS_GUI_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_GRAPHICS_GUI_CONTENT_VIEW_H <file_sep>/* * rimPrimitiveInterface.h * Rim BVH * * Created by <NAME> on 12/28/08. * Copyright 2008 Rim Software. All rights reserved. * */ #ifndef INCLUDE_RIM_BVH_PRIMITIVE_INTERFACE_H #define INCLUDE_RIM_BVH_PRIMITIVE_INTERFACE_H #include "rimBVHConfig.h" #include "rimBoundingSphere.h" #include "rimPrimitiveInterfaceType.h" //########################################################################################## //***************************** Start Rim BVH Namespace ********************************** RIM_BVH_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// An interface to an opaque collection of generic geometric primitives. /** * This class allows a BVH to not have to know the concrete type of the * geometric primitives that it contains, only generic attributes and operations. */ class PrimitiveInterface { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Destructor /// Destroy this primitive interface. virtual ~PrimitiveInterface() { } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Attribute Accessor Methods /// Return the number of primitives contained in this primitive interface. virtual Size getSize() const = 0; /// Return an object indicating the type of primitives that this inteface uses. /** * The default implementation returns an UNDEFINED primitive interface type, * meaning that the slower generic methods will be used instead of the BVH * caching the primitive data in a faster format. */ virtual PrimitiveInterfaceType getType() const; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Bounding Volume Accessor Methods /// Return an axis-aligned bounding box for the primitive with the specified index. virtual AABB3f getAABB( Index primitiveIndex ) const = 0; /// Return a bounding sphere for the primitive with the specified index. virtual BoundingSphere<Float> getBoundingSphere( Index primitiveIndex ) const = 0; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Intersections Methods /// Return whether or not the primitive with the specified index is intersected by the specified ray. /** * If there is an intersection, TRUE is returned and the distance along the ray is * placed in the output parameter. Otherwise, FALSE is returned. */ virtual Bool intersectRay( Index primitiveIndex, const Ray3f& ray, Float& distance ) const = 0; /// Return whether or not the primitives with the specified indices are intersected by the specified ray. /** * If there is an intersection, TRUE is returned and the distance to the * closest intersection along the ray is placed in the output parameter. * Otherwise, FALSE is returned. */ virtual Bool intersectRay( const Index* primitiveIndices, Size numPrimitives, const Ray3f& ray, Float& distance, Index& closestPrimitive ) const = 0; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Concrete-Type Primitive Accessor Methods /// Get the vertices of the triangle at the specified index in this primitive set. /** * The method returns whether or not the triangle was able to be accessed * and if so, places the vertices of the triangle in the output parameters. * The method should only succeed when the type of this primitive interface * is PrimitiveInterfaceType::TRIANGLES. */ virtual Bool getTriangle( Index index, Vector3f& v0, Vector3f& v1, Vector3f& v2 ) const; /// Get the center and radius of the sphere at the specified index in this primitive set. /** * The method returns whether or not the sphere was able to be accessed * and if so, places the vertices of the sphere in the output parameters. * The method should only succeed when the type of this primitive interface * is PrimitiveInterfaceType::SPHERES. */ virtual Bool getSphere( Index index, Vector3f& center, Float& radius ) const; }; //########################################################################################## //***************************** End Rim BVH Namespace ************************************ RIM_BVH_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_BVH_PRIMITIVE_INTERFACE_H <file_sep>/* * rimGraphicsLightCullerSimple.h * Rim Graphics * * Created by <NAME> on 5/16/12. * Copyright 2012 __MyCompanyName__. All rights reserved. * */ #ifndef INCLUDE_RIM_GRAPHICS_LIGHT_CULLER_SIMPLE_H #define INCLUDE_RIM_GRAPHICS_LIGHT_CULLER_SIMPLE_H #include "rimGraphicsLightsConfig.h" #include "rimGraphicsLightCuller.h" //########################################################################################## //************************ Start Rim Graphics Lights Namespace *************************** RIM_GRAPHICS_LIGHTS_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A simple implementation of the LightCuller interface that provides O(n) performance. class LightCullerSimple : public LightCuller { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructors /// Create a new simple light culler with no lights. LightCullerSimple(); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Visible Light Accessor Methods /// Add a pointer for each light that intersects the specified view volume to the output list. virtual void getIntersectingLights( const ViewVolume& viewVolume, LightBuffer& outputBuffer ) const; /// Add a pointer for each light that intersects the specified bounding sphere to the output list. virtual void getIntersectingLights( const BoundingSphere& sphere, LightBuffer& outputBuffer ) const; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Update Method /// Update the bounding volumes of all lights that are part of this light culler and any spatial data structures. virtual void update(); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Light Accessor Methods /// Return the number of lights that are in this light culler. virtual Size getLightCount() const; /// Return whether or not this light culler contains the specified light. virtual Bool containsLight( const Pointer<Light>& light ) const; /// Add the specified light to this light culler. virtual Bool addLight( const Pointer<Light>& light ); /// Remove the specified light from this light culler and return whether or not it was removed. virtual Bool removeLight( const Pointer<Light>& light ); /// Remove all lights from this light culler. virtual void clearLights(); private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Members /// A list of all of the lights in this simple light culler. ArrayList< Pointer<Light> > lights; }; //########################################################################################## //************************ End Rim Graphics Lights Namespace ***************************** RIM_GRAPHICS_LIGHTS_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_GRAPHICS_LIGHT_MANAGER_H <file_sep>/* * rimGUIElementMenu.h * Rim GUI * * Created by <NAME> on 6/3/09. * Copyright 2009 Rim Software. All rights reserved. * */ #ifndef INCLUDE_RIM_GUI_ELEMENT_MENU_H #define INCLUDE_RIM_GUI_ELEMENT_MENU_H #include "rimGUIConfig.h" #include "rimGUIElement.h" #include "rimGUIMenuItem.h" #include "rimGUIMenuDelegate.h" //########################################################################################## //*************************** Start Rim GUI Namespace ****************************** RIM_GUI_NAMESPACE_START //****************************************************************************************** //########################################################################################## class MenuBar; //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class which represents a dropdown menu that contains a series of menu items. class Menu : public GUIElement { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructors /// Create a new menu with no name and no menu items. Menu(); /// Create a new menu with the specified name (title), and no menu items. Menu( const UTF8String& name ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Destructor /// Destroy a Menu object and all state associated with it. /** * The destructor for a menu should not be called until it is not being * used as part of any active GUI. */ ~Menu(); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Menu Item Accessor Methods /// Return the number of menu items that this Menu has. Size getItemCount() const; /// Get the menu item at the specified index in the Menu. /** * If the specified index is invalid, a NULL pointer is returned. * * @param index - the index of the menu item to be retrieved. * @return a pointer to the menu item at the specified index. */ Pointer<MenuItem> getItem( Index index ) const; /// Place the index of the specified menu item in the output parameter and return if it was found. /** * If the menu contains the specified menu item, it places the index of that item in * the output index parameter and returns TRUE. Otherwise, if the menu item is not found, * the method returns FALSE and no index is retrieved. */ Bool getItemIndex( const MenuItem* item, Index& index ) const; /// Add the specified MenuItem to the end of the list of items, placing it at the bottom of the Menu. /** * If the new menu item pointer is NULL, the add operation is ignored and FALSE is returned. * Otherwise, the menu item is added and TRUE is returned, indicating success. * * @param newItem - the menu item to add to the end of the menu item list. */ Bool addItem( const Pointer<MenuItem>& newItem ); /// Insert the specified MenuItem at the specified item index in this menu. /** * If the new menu item pointer is NULL or if the specified insertion index is * greater than the number of items in the menu, FALSE is returned indicating that * the insertion operation failed. Otherwise, TRUE is returned and the item is inserted * at the specified index. * * @param newItem - the menu item to insert in the menu item list. * @param index - the index in the menu item list at which to insert the new item. */ Bool insertItem( const Pointer<MenuItem>& newItem, Index index ); /// Set the specified MenuItem at the specified index in the list of menu items. /** * This method replaces the menu item at the specified index with a new menu * item. If the new menu item pointer is NULL, the set operation is ignored. * * @param newItem - the menu item to set in the menu item list. * @param index - the index at which to set the new item. */ Bool setItem( const Pointer<MenuItem>& newItem, Index index ); /// Remove the specified MenuItem from this Menu. /** * If the menu item pointer is NULL or if the specified item is not contained * in this menu, FALSE is returned indicating failure. Otherwise, that * menu item is removed and TRUE is returned. * * @param item - the menu item to remove from the menu item list. * @return whether or not the remove operation was successful. */ Bool removeItem( const MenuItem* item ); /// Remove the menu item at the specified index in the menu item list. /** * If the specified index is invalid, FALSE is returned and the Menu * is unaltered. Otherwise, the item at that index is removed and * TRUE is returned. * * @param index - the index at which to remove a menu item from the menu. * @return whether or not the remove operation was successful. */ Bool removeItemAtIndex( Index index ); /// Remove all menu items from this menu. void clearItems(); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Menu Name Accessor Methods /// Return the name (title) of this Menu. UTF8String getName() const; /// Set the name (title) of this Menu. void setName( const UTF8String& newName ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Menu State Accessor Methods /// Return whether or not the menu is currently open, with the user in the process of selecting an item. Bool isOpen() const; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Delegate Accessor Methods /// Get a reference to the delegate object associated with this menu item. const MenuDelegate& getDelegate() const; /// Set the delegate object to which this menu item sends events. void setDelegate( const MenuDelegate& delegate ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Parent Object Accessor Methods /// Return a pointer to the menu bar that this menu belongs to. /** * This method returns a NULL pointer if the menu doesn't have a parent * menu bar. Use the hasParentMenuBar() function to detect if the menu * has a parent menu bar. */ MenuBar* getParentMenuBar() const; /// Return whether or not this menu is part of a menu bar. Bool hasParentMenuBar() const; /// Return a pointer to the menu item that this menu belongs to. /** * This method returns a NULL pointer if the menu doesn't have a parent * menu item. Use the hasParentMenuItem() function to detect if the menu * has a parent menu item. */ MenuItem* getParentMenuItem() const; /// Return whether or not this menu is a submenu of a menu item. Bool hasParentMenuItem() const; /// Return whether or not this menu has either a parent menu bar or parent menu item. Bool hasParent() const; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Platform-Specific Element Pointer Accessor Method /// Get a pointer to this menu's platform-specific internal representation. /** * On Mac OS X, this method returns a pointer to a subclass of NSMenu which * represents the menu. * * On Windows, this method returns */ virtual void* getInternalPointer() const; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Static Shared Construction Methods /// Create a shared-pointer menu object, calling the default constructor. RIM_INLINE static Pointer<Menu> construct() { return Pointer<Menu>( util::construct<Menu>() ); } /// Create a shared-pointer menu object, calling the constructor with the same arguments. RIM_INLINE static Pointer<Menu> construct( const UTF8String& name ) { return Pointer<Menu>( util::construct<Menu>( name ) ); } private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Class Declarations. /// A class which hides internal platform-specific state for a menu. class Wrapper; /// Declare the MenuBar class as a friend so that it can make itself a parent privately. friend class MenuBar; /// Declare the MenuItem class as a friend so that it can make itself a parent privately. friend class MenuItem; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Helper Methods /// Set a pointer to this menu's parent menu bar. void setParentMenuBar( MenuBar* menuBar ); /// Set a pointer to this menu's parent menu item. void setParentMenuItem( MenuItem* menuItem ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Members /// A pointer to an object which wraps internal platform-specific state for this Menu. Wrapper* wrapper; }; //########################################################################################## //*************************** End Rim GUI Namespace ******************************** RIM_GUI_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_GUI_MENU_H <file_sep>/* * rimGraphicsAnimationController.h * Rim Software * * Created by <NAME> on 6/24/14. * Copyright 2014 __MyCompanyName__. All rights reserved. * */ #ifndef INCLUDE_RIM_GRAPHICS_ANIMATION_CONTROLLER_H #define INCLUDE_RIM_GRAPHICS_ANIMATION_CONTROLLER_H #include "rimGraphicsAnimationConfig.h" #include "rimGraphicsAnimationTarget.h" #include "rimGraphicsAnimationTrack.h" #include "rimGraphicsAnimationSampler.h" //########################################################################################## //********************** Start Rim Graphics Animation Namespace ************************** RIM_GRAPHICS_ANIMATION_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class that controls the animation of a set of animation targets. /** * An animation controller manages a set of named animations that are bound * to targets. Multiple animations may affect the same target simultaneously, * and can be weighted differently with smooth transitions. * * The class allows smooth playback control of all animations that are bound to a * controller, and automatically handles all animation interpolation. */ class AnimationController { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructors /// Create a new animation controller with no animation bindings. AnimationController(); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Animation Update Method /// Update the animation state for the targets in this controller, advancing by the specified time interval. void update( const Time& dt ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Animation Accessor Methods /// Return the number of animations there are in this controller. RIM_INLINE Size getAnimationCount() const { return animations.getSize(); } /// Remove the animation with the specified name from this controller. /** * The method returns whether or not the given animation was successfully removed. * In order to have fluid motion when removing an animation, it is recommended * to stop it playing before removing. */ Bool removeAnimation( const String& animationName ); /// Remove all animation and target bindings from this controller. void clearAnimations(); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Animation State Accessor Methods /// Return whether or not the animation with the specified name is playing in this controller. Bool isPlaying( const String& animationName ) const; /// Start playing the animation with the given name and attributes. /** * The method returns whether or not the animation was able to be started. */ Bool play( const String& animationName, Float weight = Float(1), Time fadeInTime = 0, Bool looping = false, Float speed = Float(1) ); /// Pause the animation with the specified name, fading out its weight over the given time. Bool pause( const String& animationName, Time pauseTime = 0 ); /// Resume the animation with the specified name at its previous time, fading in its weight over the given time. Bool resume( const String& animationName, Time resumeTime = 0 ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Animation Weight Accessor Methods /// Return the weight for the animation with the specified name. /** * If there is no animation for that name, the method returns a weight of 0. */ Float getWeight( const String& animationName ) const; /// Set the weight of the animation with the specified name. /** * This method causes the animation to interpolate to the given weight * over the specified interpolation time. This enables smooth transitions * between animations. * * The method returns whether or not the weight was able to be changed. * The method can fail if there is no animation with that name. */ Bool setWeight( const String& animationName, Float weight, Time interpolationTime = 0 ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Target Accessor Methods /// Return the number of animation targets there are for this controller. RIM_INLINE Size getTargetCount() const { return targets.getSize(); } /// Bind the specified target to the given animation track and animation name. /** * The method returns whether or not the target and track were able to be * bound. The method can fail if the target or track is NULL, or if they * have different attribute types. */ Bool bindTarget( const Pointer<AnimationTarget>& target, const Pointer<AnimationTrack>& track, const String& animationName ); /// Unbind all tracks from the specified target. /** * The method returns whether or not the target was able to be unbound * from this controller. */ Bool unbindTarget( const Pointer<AnimationTarget>& target ); // Unbind the specified target from the given animation. Bool unbindTarget( const Pointer<AnimationTarget>& target, const String& animationName ); private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Class Declarations class AnimationInfo; class AnimationTargetInfo; /// A class that stores information about a track-to-target binding for an animation. class AnimationTrackInfo { public: RIM_INLINE AnimationTrackInfo( const Pointer<AnimationTargetInfo>& newTarget, const Pointer<AnimationTrack>& newTrack, AnimationInfo* newAnimation ) : target( newTarget ), sampler( newTrack ), animation( newAnimation ) { } /// A pointer to the target info for this track. Pointer<AnimationTargetInfo> target; /// A pointer to the animation info that this track info belongs to. AnimationInfo* animation; /// An animation sampler that handles this track's interpolation. AnimationSampler sampler; }; /// A class that stores information about a named animation. class AnimationInfo { public: /// Create a new animation information object with the specified name. RIM_INLINE AnimationInfo( const String& newName ) : name( newName ), currentTime( 0 ), length( 0 ), speed( 1 ), weight( 0 ), targetWeight( 0 ), weightInterpolationTime( 0 ), playbackWeight( 0 ), targetPlaybackWeight( 0 ), playbackWeightInterpolationTime( 0 ), timestamp( 0 ), playing( false ), looping( false ) { } /// A string that stores the name for this animation. String name; /// A list of the tracks and track targets for this animation. ArrayList< Pointer<AnimationTrackInfo> > tracks; /// The current playback time in the animation, relative to its start. Time currentTime; /// The maximum length of any of this animation's tracks. Time length; /// The playback speed multiplier for this animation. Float speed; /// The weight given to this animation for its targets. Float weight; /// The target weight for this animation that it is interpolating to. Float targetWeight; /// The time that the interpolation to the target weight should take. Time weightInterpolationTime; /// The playback weight given to this animation for its targets. Float playbackWeight; /// The target playback weight for this animation that it is interpolating to. Float targetPlaybackWeight; /// The time that the interpolation to the target playback weight should take. Time playbackWeightInterpolationTime; /// An integer indicating the current update index. Index timestamp; /// A boolean value indicating whether or not this animation is currently playing. Bool playing; /// A boolean value indicating whether or not this animation should loop. Bool looping; }; /// A class that stores information about a single animation target. class AnimationTargetInfo { public: RIM_INLINE AnimationTargetInfo( const Pointer<AnimationTarget>& newTarget ) : target( newTarget ) { } RIM_INLINE Bool removeTrack( const Pointer<AnimationTrackInfo>& track ) { return tracks.removeUnordered( track ); } /// A pointer to the animation target. Pointer<AnimationTarget> target; /// A list pointers to the tracks that are affecting this target. ArrayList< Pointer<AnimationTrackInfo> > tracks; }; /// A class that enables comparison of animation targets. class AnimationTargetComparator { public: RIM_INLINE AnimationTargetComparator( const AnimationTarget* newTarget ) : target( newTarget ) { } RIM_INLINE Bool operator == ( const AnimationTargetComparator& other ) const { return *target == *other.target; } RIM_INLINE Hash getHashCode() const { return (Hash)PointerInt( target ); } const AnimationTarget* target; }; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Helper Methods template < typename T > RIM_FORCE_INLINE static void multiplyAdd( T* destination, const T* source, T multiplicand, Size numComponents ); RIM_FORCE_INLINE static void multiplyAdd( AttributeValue& destination, const AttributeValue& source, Float multiplicand ); template < typename T > RIM_FORCE_INLINE static void multiply( T* destination, T multiplicand, Size numComponents ); RIM_FORCE_INLINE static void multiply( AttributeValue& destination, Float multiplicand ); template < typename T > RIM_FORCE_INLINE static void divide( T* destination, T divisor, Size numComponents ); RIM_FORCE_INLINE static void divide( AttributeValue& destination, Float divisor ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Members /// A map containing the animation targets for this controller. HashMap< AnimationTargetComparator, Pointer<AnimationTargetInfo> > targets; /// A map from animation name to animations for this controller. HashMap< String, Pointer<AnimationInfo> > animations; /// An attribute value that is used to accumulate weighted attribute values. AttributeValue accumulator; /// An attribute value that is used to temporarily hold track attribute values. AttributeValue tempValue; /// The global update timestamp for this animation controller. Index timestamp; }; //########################################################################################## //********************** End Rim Graphics Animation Namespace **************************** RIM_GRAPHICS_ANIMATION_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_GRAPHICS_ANIMATION_CONTROLLER_H <file_sep>/* * rimGraphicsSpotLight.h * Rim Graphics * * Created by <NAME> on 5/16/12. * Copyright 2012 __MyCompanyName__. All rights reserved. * */ #ifndef INCLUDE_RIM_GRAPHICS_SPOT_LIGHT_H #define INCLUDE_RIM_GRAPHICS_SPOT_LIGHT_H #include "rimGraphicsLightsConfig.h" #include "rimGraphicsLight.h" #include "rimGraphicsLightAttenuation.h" //########################################################################################## //************************ Start Rim Graphics Lights Namespace *************************** RIM_GRAPHICS_LIGHTS_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class which represents a conical spot light source. class SpotLight : public Light { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructors /// Create a default 90 degree spot light positioned at the origin, pointing the positive X direction. SpotLight(); /// Create a new spot light with the specified position, direction, and spot cutoff. SpotLight( const Vector3& newPosition, const Vector3& newDirection, Real newSpotCutoff ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Position Accessor Methods /// Get the position of this spot light in world space. RIM_INLINE const Vector3& getPosition() const { return position; } /// Set the position of this spot light in world space. RIM_INLINE void setPosition( const Vector3& newPosition ) { position = newPosition; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Direction Accessor Methods /// Get the direction that this spot light is facing. RIM_INLINE const Vector3& getDirection() const { return direction; } /// Set the direction that this spot light is facing. RIM_INLINE void setDirection( const Vector3& newDirection ) { direction = newDirection; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Spot Cutoff Angle Accessor Methods /// Get the spot cutoff angle of this spot light in degrees. /** * This is the maximum angle from the spot light's direction that * light will be produced. */ RIM_INLINE Real getCutoff() const { return cutoff; } /// Set the spot cutoff angle of this spot light in degrees. /** * This is the maximum angle from the spot light's direction that * light will be produced. The input value is clamped to the valid range of * [0,90]. */ RIM_INLINE void setCutoff( Real newCutoffAngle ) { cutoff = math::clamp( newCutoffAngle, Real(0), Real(90) ); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Spot Exponent Accessor Methods /// Return the spot exponent for this spot light. /** * If this value is 0, it will result in a spot light with uniform * light distribution across the spot area. A value greater than 0 will * cause the light to be more focused toward the center of the light spot. */ RIM_INLINE Real getExponent() const { return exponent; } /// Set the spot exponent for this spot light. /** * If this value is 0, it will result in a spot light with uniform * light distribution across the spot area. A value greater than 0 will * cause the light to be more focused toward the center of the light spot. */ RIM_INLINE void setExponent( Real newSpotExponent ) { exponent = newSpotExponent; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Falloff Accessor Methods /// Return the falloff size of this spot light. /** * This value is used to create a smooth transition from 100% illuination to * 0% illumination outside of the spot light's cutoff angle. This value is * multiplied by the cutoff angle to determine how many degrees that falloff * spans. */ RIM_INLINE Real getFalloff() const { return falloff; } /// Set the falloff size of this spot light. /** * This value is used to create a smooth transition from 100% illuination to * 0% illumination outside of the spot light's cutoff angle. This value is * multiplied by the cutoff angle to determine how many degrees that falloff * spans. * * The new falloff value is clamped to the range [0,1]. */ RIM_INLINE void setFalloff( Real newFallOff ) { falloff = math::clamp( newFallOff, Real(0), Real(1) ); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Attenuation Accessor Methods /// Get an object representing how this spot light is attenuated with distance. RIM_INLINE LightAttenuation& getAttenuation() { return attenuation; } /// Get an object representing how this spot light is attenuated with distance. RIM_INLINE const LightAttenuation& getAttenuation() const { return attenuation; } /// Set the object representing how this spot light is attenuated with distance. RIM_INLINE void setAttenuation( const LightAttenuation& newAttenuation ) { attenuation = newAttenuation; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Bounding Cone Accessor Method /// Get a bounding cone for this light's area of effect with the specified cutoff intensity. BoundingCone getBoundingCone( Real cutoffIntensity ) const; private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Members /// The position of this spot light in world space. Vector3 position; /// The direction that this spot light is facing. Vector3 direction; /// An object which models the distance attenuation from this light source. LightAttenuation attenuation; /// This value determines the fraction of the spot light's angular width where the spot intensity falls off. /** * This value is used to create a smooth transition from 100% illuination to * 0% illumination outside of the spot light's cutoff angle. This value is * multiplied by the cutoff angle to determine how many degrees that falloff * spans. */ Real falloff; /// The exponent of the spot light. /** * This value determines how focused the light is towards the center of the spot. */ Real exponent; /// The cutoff angle of the spot light in degrees. /** * This is the maximum angle from the spot light's direction that * light will be produced. */ Real cutoff; }; //########################################################################################## //************************ End Rim Graphics Lights Namespace ***************************** RIM_GRAPHICS_LIGHTS_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_GRAPHICS_SPOT_LIGHT_H <file_sep>/* * rimLanguageConfig.h * Rim Framework * * Created by <NAME> on 12/28/08. * Copyright 2008 Rim Software. All rights reserved. * */ #ifndef INCLUDE_RIM_LANGUAGE_CONFIG_H #define INCLUDE_RIM_LANGUAGE_CONFIG_H #include "../rimConfig.h" #include "../util/rimAllocator.h" //########################################################################################## //########################################################################################## //############ //############ Library Namespace Configuration //############ //########################################################################################## //########################################################################################## /// Define the name of the language library namespace. #ifndef RIM_LANGUAGE_NAMESPACE #define RIM_LANGUAGE_NAMESPACE lang #endif #ifndef RIM_LANGUAGE_NAMESPACE_START #define RIM_LANGUAGE_NAMESPACE_START RIM_NAMESPACE_START namespace RIM_LANGUAGE_NAMESPACE { #endif #ifndef RIM_LANGUAGE_NAMESPACE_END #define RIM_LANGUAGE_NAMESPACE_END }; RIM_NAMESPACE_END #endif RIM_NAMESPACE_START /// A namespace containing classes which extend the basic functionality of C++. namespace RIM_LANGUAGE_NAMESPACE { }; RIM_NAMESPACE_END //########################################################################################## //*************************** Start Rim Language Namespace ******************************* RIM_LANGUAGE_NAMESPACE_START //****************************************************************************************** //########################################################################################## //########################################################################################## //*************************** End Rim Language Namespace ********************************* RIM_LANGUAGE_NAMESPACE_END //****************************************************************************************** //########################################################################################## //########################################################################################## //########################################################################################## //############ //############ Library Internal Namespace Configuration //############ //########################################################################################## //########################################################################################## #ifndef RIM_LANGUAGE_INTERNAL_NAMESPACE_START #define RIM_LANGUAGE_INTERNAL_NAMESPACE_START RIM_LANGUAGE_NAMESPACE_START namespace internal { #endif #ifndef RIM_LANGUAGE_INTERNAL_NAMESPACE_END #define RIM_LANGUAGE_INTERNAL_NAMESPACE_END }; RIM_LANGUAGE_NAMESPACE_END #endif //########################################################################################## //*********************** Start Rim Language Internal Namespace ************************** RIM_LANGUAGE_INTERNAL_NAMESPACE_START //****************************************************************************************** //########################################################################################## //########################################################################################## //*********************** End Rim Language Internal Namespace **************************** RIM_LANGUAGE_INTERNAL_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_LANGUAGE_CONFIG_H <file_sep>/* * rimGraphicsObjectFlags.h * Rim Software * * Created by <NAME> on 2/16/14. * Copyright 2014 __MyCompanyName__. All rights reserved. * */ #ifndef INCLUDE_RIM_GRAPHICS_OBJECT_FLAGS_H #define INCLUDE_RIM_GRAPHICS_OBJECT_FLAGS_H #include "rimGraphicsObjectsConfig.h" //########################################################################################## //************************ Start Rim Graphics Objects Namespace ************************** RIM_GRAPHICS_OBJECTS_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class which encapsulates the different boolean flags that a graphics object can have. /** * These flags provide boolean information about a certain graphics object. Flags * are indicated by setting a single bit of a 32-bit unsigned integer to 1. * * Enum values for the different flags are defined as members of the class. Typically, * the user would bitwise-OR the flag enum values together to produce a final set * of set flags. */ class GraphicsObjectFlags { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Graphics Object Flags Enum Declaration /// An enum which specifies the different graphics object flags. typedef enum Flag { /// A flag indicating that an object should be drawn. VISIBLE = (1 << 0), /// A flag indicating whether or not the object can cast shadows. SHADOWS_ENABLED = (1 << 1), /// The flag value when all flags are not set. UNDEFINED = 0 }; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructors /// Create a new graphics object flags object with no flags set. RIM_INLINE GraphicsObjectFlags() : flags( UNDEFINED ) { } /// Create a new graphics object flags object with the specified flag value initially set. RIM_INLINE GraphicsObjectFlags( Flag flag ) : flags( flag ) { } /// Create a new graphics object flags object with the specified initial combined flags value. RIM_INLINE GraphicsObjectFlags( UInt32 newFlags ) : flags( newFlags ) { } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Integer Cast Operator /// Convert this graphics object flags object to an integer value. /** * This operator is provided so that the GraphicsObjectFlags object * can be used as an integer value for bitwise logical operations. */ RIM_INLINE operator UInt32 () const { return flags; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Flag Status Accessor Methods /// Return whether or not the specified flag value is set for this flags object. RIM_INLINE Bool isSet( Flag flag ) const { return (flags & flag) != UNDEFINED; } /// Set whether or not the specified flag value is set for this flags object. RIM_INLINE void set( Flag flag, Bool newIsSet ) { if ( newIsSet ) flags |= flag; else flags &= ~flag; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Flag String Accessor Methods /// Return the flag for the specified literal string representation. static Flag fromEnumString( const String& enumString ); /// Convert the specified flag to its literal string representation. static String toEnumString( Flag flag ); /// Convert the specified flag to human-readable string representation. static String toString( Flag flag ); private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Members /// A value indicating the flags that are set for a graphics object. UInt32 flags; }; //########################################################################################## //************************ End Rim Graphics Objects Namespace **************************** RIM_GRAPHICS_OBJECTS_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_GRAPHICS_OBJECT_FLAGS_H <file_sep>/* * rimGraphicsAttributeValue.h * Rim Graphics * * Created by <NAME> on 11/29/09. * Copyright 2009 Rim Software. All rights reserved. * */ #ifndef INCLUDE_RIM_GRAPHICS_ATTRIBUTE_VALUE_H #define INCLUDE_RIM_GRAPHICS_ATTRIBUTE_VALUE_H #include "rimGraphicsUtilitiesConfig.h" #include "rimGraphicsAttributeType.h" //########################################################################################## //********************** Start Rim Graphics Utilities Namespace ************************** RIM_GRAPHICS_UTILITIES_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class which is used to store the value of a shader attribute of any common type. class AttributeValue { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructors /// Create a AttributeValue with undefined type and no value set. RIM_INLINE AttributeValue() : value( localBuffer ), type(), arraySize( 0 ), capacityInBytes( LOCAL_BUFFER_SIZE ) { } /// Create a AttributeValue with the specified type and an undefined value. /** * If the new attribute value's type is undefined, the shader attribute is * constructed with no value stored. */ RIM_INLINE AttributeValue( const AttributeType& newType, Size newArraySize = Size(1) ) : type( newType ), arraySize( (UShort)newArraySize ) { Size typeSize = arraySize*type.getSizeInBytes(); // Check to see if we should allocate a buffer for the value or use the local buffer. if ( typeSize > LOCAL_BUFFER_SIZE ) { value = util::allocate<UByte>( typeSize ); capacityInBytes = typeSize; } else { value = localBuffer; capacityInBytes = LOCAL_BUFFER_SIZE; } } /// Create a AttributeValue with the specified value and type from a packed array. /** * If the new attribute value's type is undefined, the shader attribute is * constructed with no value stored. */ template < typename PrimType > RIM_INLINE AttributeValue( const PrimType* newAttribute, const AttributeType& newType, Size newArraySize = Size(1) ) : type( newType ), arraySize( (UShort)newArraySize ) { // Statically verify the primitive type. PrimitiveType::check<PrimType>(); Size typeSize = arraySize*type.getSizeInBytes(); // Check to see if we should allocate a buffer for the value or use the local buffer. if ( typeSize > LOCAL_BUFFER_SIZE ) { value = util::allocate<UByte>( typeSize ); capacityInBytes = typeSize; } else { value = localBuffer; capacityInBytes = LOCAL_BUFFER_SIZE; } // Copy the new attribute components. if ( newAttribute ) util::copy( (UByte*)value, (const UByte*)newAttribute, typeSize ); } /// Create a AttributeValue with the type and value of the specified parameter and given array size. /** * If the new attribute value's type is undefined, the shader attribute is * constructed with no value stored. The specified attribute value is * copied for each element in the attribute array size. */ template < typename T > RIM_INLINE AttributeValue( const T& newAttribute, Size newArraySize = Size(1) ) : type( AttributeType::get<T>() ), arraySize( (UShort)newArraySize ) { // Statically verify the attribute type. AttributeType::check<T>(); Size typeSize = arraySize*type.getSizeInBytes(); // Check to see if we should allocate a buffer for the value or use the local buffer. if ( typeSize > LOCAL_BUFFER_SIZE ) { value = util::allocate<UByte>( typeSize ); capacityInBytes = typeSize; } else { value = localBuffer; capacityInBytes = LOCAL_BUFFER_SIZE; } assignArrayValues( newAttribute ); } /// Create a copy of the specified shader attribute. RIM_INLINE AttributeValue( const AttributeValue& other ) : type( other.type ), arraySize( other.arraySize ) { if ( other.isSet() ) { Size typeSize = arraySize*type.getSizeInBytes(); if ( typeSize > LOCAL_BUFFER_SIZE ) { value = util::allocate<UByte>( typeSize ); capacityInBytes = typeSize; } else { value = localBuffer; capacityInBytes = LOCAL_BUFFER_SIZE; } util::copy( (UByte*)value, (UByte*)other.value, typeSize ); } else { value = localBuffer; capacityInBytes = LOCAL_BUFFER_SIZE; } } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Destructor /// Destroy a AttributeValue object and its associated value. RIM_INLINE ~AttributeValue() { if ( value != localBuffer ) util::deallocate( value ); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Assignment Operator /// Assign the value and type of another shader attribute to this attribute. RIM_INLINE AttributeValue& operator = ( const AttributeValue& other ) { if ( this != &other ) { type = other.type; arraySize = other.arraySize; if ( other.isSet() ) { Size typeSize = arraySize*type.getSizeInBytes(); if ( typeSize > capacityInBytes ) { if ( value != localBuffer ) util::deallocate( value ); value = util::allocate<UByte>( typeSize ); capacityInBytes = typeSize; } util::copy( (UByte*)value, (UByte*)other.value, typeSize ); } } return *this; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Attribute Type Accessor Method /// Return the type of value that this AttributeValue represents. RIM_INLINE const AttributeType& getType() const { return type; } /// Set the type of value that this AttributeValue represents. /** * The internal memory for this value is enlarged if necessary to * contain the specified type and array size. The contents of the * value are undefined after this method is called. */ void setType( const AttributeType& newType, Size newArraySize = Size(1) ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Attribute Value Get Methods /// Store the value of the AttributeValue in the specified reference. /** * If the templated type of the output object matches the type of the * shader attribute, TRUE is returned and the value is placed in the location * specified by the output reference. Otherwise FALSE is returned and no value * is retrieved. */ template < typename T > RIM_INLINE Bool getValue( T& output, Index arrayIndex = 0 ) const { // Statically verify the output attribute type. AttributeType::check<T>(); if ( value == NULL || AttributeType::get<T>() != type ) return false; output = ((T*)value)[arrayIndex]; return true; } /// Store the components of the AttributeValue in the specified pointer. /** * If the templated type of the output pointer matches the type of the * shader attribute's component type, TRUE is returned and the attribute is * placed in the location specified by the output pointer. Otherwise FALSE is * returned and no value is retrieved. */ template < typename T > RIM_INLINE Bool getComponents( T* output ) const { // Statically check the output component type. PrimitiveType::check<T>(); if ( value == NULL || PrimitiveType::get<T>() != type.getPrimitiveType() ) return false; util::copy( output, (T*)value, type.getComponentCount() ); return true; } /// Return a pointer to the components of this Shader attribute, stored in column major order. /** * If the templated type of the function matches the type of the * shader attribute's component type, the function is successful and * the component pointer is returned. Otherwise, NULL is * returned indicating failure. */ template < typename T > RIM_INLINE T* getComponents() { // Statically check the output component type. PrimitiveType::check<T>(); if ( PrimitiveType::get<T>() != type.getPrimitiveType() ) return NULL; return (T*)value; } /// Return a pointer to the components of this Shader attribute, stored in column major order. /** * If the templated type of the function matches the type of the * shader attribute's component type, the function is successful and * the component pointer is returned. Otherwise, NULL is * returned indicating failure. */ template < typename T > RIM_INLINE const T* getComponents() const { // Statically check the output component type. PrimitiveType::check<T>(); if ( PrimitiveType::get<T>() != type.getPrimitiveType() ) return NULL; return (T*)value; } /// Return a raw pointer to the underlying data storage for this attribute value. RIM_INLINE UByte* getPointer() { return value; } /// Return a raw pointer to the underlying data storage for this attribute value. RIM_INLINE const UByte* getPointer() const { return value; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Attribute Value Set Method /// Set the value stored in this AttributeValue object. /** * If the type of the new attribute value is undefined, the AttributeValue * is unmodified and FALSE is returned. Otherwise, the value and type * of the AttributeValue object are replaced by the new attribute value * and type. */ template < typename T > RIM_INLINE Bool setValue( const T& newAttribute, Index arrayIndex = 0 ) { // Statically verify the input attribute type. AttributeType::check<T>(); // Don't reallocate the attribute value data array if not necessary. if ( sizeof(T) > capacityInBytes ) { if ( value != localBuffer ) util::deallocate( value ); value = util::allocate<UByte>( sizeof(T) ); capacityInBytes = sizeof(T); } assignValue( newAttribute, arrayIndex ); type = AttributeType::get<T>(); return true; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Array Size Accessor Methods /// Return the size of the stored attribute array. RIM_INLINE Size getArraySize() const { return arraySize; } /// Set the size of the stored attribute array. /** * New attributes are filled in with the previous last * value in the array. */ void setArraySize( Size newArraySize ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Status Accessor Method /// Return whether or not the AttributeValue is not set. RIM_INLINE Bool isNull() const { return type.getPrimitiveType() == PrimitiveType::UNDEFINED; } /// Return whether or not the AttributeValue has a value set. RIM_INLINE Bool isSet() const { return type.getPrimitiveType() != PrimitiveType::UNDEFINED; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** String Representation Accessor Methods /// Return a string representation of the attribute value. String toString() const; /// Convert this attribute value into a string representation. RIM_FORCE_INLINE operator String () const { return this->toString(); } private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Helper Methods template < typename T > RIM_FORCE_INLINE static void* allocateSpaceFor() { return util::allocate<UByte>( sizeof(T) ); } template < typename T > RIM_FORCE_INLINE void assignValue( const T& newValue, Index arrayIndex = 0 ) { ((T*)value)[arrayIndex] = newValue; } template < typename T > RIM_FORCE_INLINE void assignArrayValues( const T& newValue ) { for ( Index i = 0; i < arraySize; i++ ) ((T*)value)[i] = newValue; } template < typename T > static String convertComponentsToString( const T* components, Size numRows, Size numColumns ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Static Data Members /// Define the size in bytes of the fixed-size local buffer for this shader attribute. /** * Make the buffer 16 bytes - enough to hold a 4-component floating point vector. */ static const Size LOCAL_BUFFER_SIZE = 16; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Members /// An opaque pointer to the data type stored by this shader attribute. UByte* value; /// An object representing the type of the data stored by this shader attribute. AttributeType type; /// The size of the array of attributes stored in this attribute value. UShort arraySize; /// The capacity in bytes of this shader attribute's internal data array. Size capacityInBytes; /// A local buffer of bytes that can store small shader attributes without a memory allocation. UByte localBuffer[LOCAL_BUFFER_SIZE]; }; //########################################################################################## //********************** End Rim Graphics Utilities Namespace **************************** RIM_GRAPHICS_UTILITIES_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_GRAPHICS_ATTRIBUTE_VALUE_H <file_sep>/* * rimUtilitiesConfig.h * Rim Framework * * Created by <NAME> on 12/28/08. * Copyright 2008 Rim Software. All rights reserved. * */ #ifndef INCLUDE_RIM_UTILITIES_CONFIG_H #define INCLUDE_RIM_UTILITIES_CONFIG_H #include "../rimConfig.h" #include <cstdlib> #include <new> #include "../math/rimScalarMath.h" //########################################################################################## //########################################################################################## //############ //############ Library Namespace Configuration //############ //########################################################################################## //########################################################################################## /// Define the name of the utility library namespace. #ifndef RIM_UTILITIES_NAMESPACE #define RIM_UTILITIES_NAMESPACE util #endif #ifndef RIM_UTILITIES_NAMESPACE_START #define RIM_UTILITIES_NAMESPACE_START RIM_NAMESPACE_START namespace RIM_UTILITIES_NAMESPACE { #endif #ifndef RIM_UTILITIES_NAMESPACE_END #define RIM_UTILITIES_NAMESPACE_END }; RIM_NAMESPACE_END #endif RIM_NAMESPACE_START /// A namespace containing data structure classes and memory manipulation methods. namespace RIM_UTILITIES_NAMESPACE { }; RIM_NAMESPACE_END //########################################################################################## //*************************** Start Rim Utilities Namespace ****************************** RIM_UTILITIES_NAMESPACE_START //****************************************************************************************** //########################################################################################## //########################################################################################## //*************************** End Rim Utilities Namespace ******************************** RIM_UTILITIES_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_UTILITIES_CONFIG_H <file_sep>/* * rimPrimitiveType.h * Rim Framework * * Created by <NAME> on 9/13/10. * Copyright 2010 Rim Software. All rights reserved. * */ #ifndef INCLUDE_RIM_PRIMITIVE_TYPE_H #define INCLUDE_RIM_PRIMITIVE_TYPE_H #include "rimLanguageConfig.h" #include "../data/rimBasicString.h" #include "rimHalfFloat.h" //########################################################################################## //*************************** Start Rim Language Namespace ******************************* RIM_LANGUAGE_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class which represents a kind of primitive built-in type. class PrimitiveType { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Primitive Type Enum Definition typedef enum Enum { /// An undefined primitive type. UNDEFINED = 0, /// A primitive type representing the 'bool' type. BOOLEAN = 1, /// A primitive type representing an 8-bit signed integer type. BYTE = 2, /// A primitive type representing an 8-bit unsigned integer type. UNSIGNED_BYTE = 3, /// A primitive type representing an 16-bit signed signed integer type. SHORT = 4, /// A primitive type representing an 16-bit unsigned integer type. UNSIGNED_SHORT = 5, /// A primitive type representing a 32-bit signed integer type. INT = 6, /// A primitive type representing a 32-bit unsigned integer type. UNSIGNED_INT = 7, /// A primitive type representing an 16-bit floating-point type. HALF_FLOAT = 8, /// A primitive type representing a 32-bit floating-point type. FLOAT = 9, /// A primitive type representing a 64-bit floating-point type. DOUBLE = 10 }; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructors /// Create a new primitive type with the specified primitive type enum value. RIM_INLINE PrimitiveType( Enum newType ) : type( (UByte)newType ) { } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Primitive Type Static Templated Accessor Method /// Get the primitive type of a templated type. /** * If the templated type is not a primitive type, an UNDEFINED * primitive type is returned. */ template < typename T > RIM_INLINE static PrimitiveType get() { return UNDEFINED; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Primitive Type Checking Method /// Check to see if the templated type is a supported primitive type. /** * Calling this empty method will produce a compiler error if the * templated type is not a supported primitive type. */ template < typename T > RIM_FORCE_INLINE static void check(); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Enum Cast Operator /// Convert this primitive type to an enum value. RIM_INLINE operator Enum () const { return (Enum)type; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Byte Size Accessor Method /// Return the size of this primitive type in bits. RIM_INLINE Size getSizeInBits() const { return this->getSizeInBytes() << 3; } /// Return the size of this primitive type in bytes. RIM_INLINE Size getSizeInBytes() const { switch ( type ) { case PrimitiveType::BOOLEAN: return sizeof(Bool); case PrimitiveType::BYTE: return sizeof(Byte); case PrimitiveType::UNSIGNED_BYTE: return sizeof(UByte); case PrimitiveType::SHORT: return sizeof(Short); case PrimitiveType::UNSIGNED_SHORT: return sizeof(UShort); case PrimitiveType::INT: return sizeof(Int); case PrimitiveType::UNSIGNED_INT: return sizeof(UInt); case PrimitiveType::HALF_FLOAT: return sizeof(HalfFloat); case PrimitiveType::FLOAT: return sizeof(Float); case PrimitiveType::DOUBLE: return sizeof(Double); default: return 0; } } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** String Representation Accessor Methods /// Return a string representation of the primitive type. data::String toString() const; /// Convert this primitive type into a string representation. RIM_INLINE operator data::String () const { return this->toString(); } private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Members /// An enum for the primitive type. UByte type; }; //########################################################################################## //########################################################################################## //############ //############ Primitive Type Accessor Method Specializations //############ //########################################################################################## //########################################################################################## template <> RIM_INLINE PrimitiveType PrimitiveType:: get<Bool>() { return BOOLEAN; } template <> RIM_INLINE PrimitiveType PrimitiveType:: get<Byte>() { return BYTE; } template <> RIM_INLINE PrimitiveType PrimitiveType:: get<UByte>() { return UNSIGNED_BYTE; } template <> RIM_INLINE PrimitiveType PrimitiveType:: get<Short>() { return SHORT; } template <> RIM_INLINE PrimitiveType PrimitiveType:: get<UShort>() { return UNSIGNED_SHORT; } template <> RIM_INLINE PrimitiveType PrimitiveType:: get<Int>() { return INT; } template <> RIM_INLINE PrimitiveType PrimitiveType:: get<UInt>() { return UNSIGNED_INT; } template <> RIM_INLINE PrimitiveType PrimitiveType:: get<HalfFloat>() { return HALF_FLOAT; } template <> RIM_INLINE PrimitiveType PrimitiveType:: get<Float>() { return FLOAT; } template <> RIM_INLINE PrimitiveType PrimitiveType:: get<Double>() { return DOUBLE; } //########################################################################################## //########################################################################################## //############ //############ Primitive Type Checking Method Specializations //############ //########################################################################################## //########################################################################################## template <> RIM_INLINE void PrimitiveType:: check<Bool>() { } template <> RIM_INLINE void PrimitiveType:: check<Byte>() { } template <> RIM_INLINE void PrimitiveType:: check<UByte>() { } template <> RIM_INLINE void PrimitiveType:: check<Short>() { } template <> RIM_INLINE void PrimitiveType:: check<UShort>() { } template <> RIM_INLINE void PrimitiveType:: check<Int>() { } template <> RIM_INLINE void PrimitiveType:: check<UInt>() { } template <> RIM_INLINE void PrimitiveType:: check<HalfFloat>() { } template <> RIM_INLINE void PrimitiveType:: check<Float>() { } template <> RIM_INLINE void PrimitiveType:: check<Double>() { } //########################################################################################## //*************************** End Rim Language Namespace ********************************* RIM_LANGUAGE_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_PRIMITIVE_TYPE_H <file_sep>/* * rimGraphicsGUIGraphViewAxis.h * Rim Graphics GUI * * Created by <NAME> on 7/10/13. * Copyright 2013 __MyCompanyName__. All rights reserved. * */ #ifndef INCLUDE_RIM_GRAPHICS_GUI_GRAPH_VIEW_AXIS_H #define INCLUDE_RIM_GRAPHICS_GUI_GRAPH_VIEW_AXIS_H #include "rimGraphicsGUIBase.h" //########################################################################################## //************************ Start Rim Graphics GUI Namespace ****************************** RIM_GRAPHICS_GUI_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class which stores information about a single graph axis. class GraphViewAxis { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Flags Enum Declaration /// An enum of the various boolean flags for a graph view axis. typedef enum Flag { /// A flag indicating that major divisions should be drawn for a graph view axis. MAJOR_DIVISIONS = (1 << 0), /// A flag indicating that minor divisions should be drawn for a graph view axis. MINOR_DIVISIONS = (1 << 1), /// A flag indicating that major division labels should be drawn for a graph view axis. MAJOR_LABELS = (1 << 2), /// A flag indicating that minor division labels should be drawn for a graph view axis. MINOR_LABELS = (1 << 3), /// A flag indicating that the main label for a graph view axis should be drawn. LABEL = (1 << 4) }; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructors /// Create a new graph axis with the default attributes. GraphViewAxis(); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Label Accessor Methods /// Return a reference to the string for the name of this axis, describing what it represents. RIM_INLINE const UTF8String& getLabel() const { return label; } /// Set a string for the name of this axis, describing what it represents. RIM_INLINE void setLabel( const UTF8String& newLabel ) { label = newLabel; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Label Enable Methods /// Return whether or not the main label for this axis is enabeld. RIM_INLINE Bool getLabelIsEnabled() const { return (flags & LABEL) != 0; } /// Set whether or not the main label for this axis is enabeld. RIM_INLINE void setLabelIsEnabled( Bool newLabelIsEnabled ) { if ( newLabelIsEnabled ) flags |= LABEL; else flags &= ~LABEL; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** User Label Accessor Methods /// Return the total number of user-defined labels that are part of this graph axis. RIM_INLINE Size getUserLabelCount() const { return userLabels.getSize(); } /// Add a new user-defined label to this graph view with the specified name, value, and enable status. /** * The result of this method is that a new label will be drawn at the specified value * on the graph (if visible). A label can be drawn as a dividing line with no text label, * or as a label with no dividing line, depending on the values of the boolean parameters. */ RIM_INLINE Index addUserLabel( const UTF8String& label, Float value, Bool labelEnabled = true, Bool divisionEnabled = true ) { Index index = userLabels.getSize(); userLabels.add( GraphLabel( label, value, labelEnabled, divisionEnabled ) ); return index; } /// Remove the user-defined label at the specified index in this graph axis. RIM_INLINE Bool removeUserLabel( Index index ) { return userLabels.removeAtIndex( index ); } /// Remove all user-defined labels from this graph axis. RIM_INLINE void clearUserLabels() { userLabels.clear(); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** User Label Attribute Accessor Methods /// Return the label string for the user-defined label at the specified index. RIM_INLINE const UTF8String& getUserLabel( Index labelIndex ) const { return userLabels[labelIndex].label; } /// Set the label string for the user-defined label at the specified index. RIM_INLINE void setUserLabel( Index labelIndex, const UTF8String& newLabel ) { if ( labelIndex < userLabels.getSize() ) userLabels[labelIndex].label = newLabel; } /// Return the value at which the user-defined label at the specified index should be displayed. RIM_INLINE Float getUserLabelValue( Index labelIndex ) const { return userLabels[labelIndex].value; } /// Set the value at which the user-defined label at the specified index should be displayed. RIM_INLINE void setUserLabelValue( Index labelIndex, Float newValue ) { if ( labelIndex < userLabels.getSize() ) userLabels[labelIndex].value = newValue; } /// Return whether or not the user-defined label at the specified index should display its text label. RIM_INLINE Bool getUserLabelIsEnabled( Index labelIndex ) const { return userLabels[labelIndex].labelEnabled; } /// Set whether or not the user-defined label at the specified index should display its text label. RIM_INLINE void setUserLabelIsEnabled( Index labelIndex, Bool newLabelEnabled ) { if ( labelIndex < userLabels.getSize() ) userLabels[labelIndex].labelEnabled = newLabelEnabled; } /// Return whether or not the user-defined label at the specified index should display its dividing line. RIM_INLINE Bool getUserDivisionIsEnabled( Index labelIndex ) const { return userLabels[labelIndex].divisionEnabled; } /// Set whether or not the user-defined label at the specified index should display its dividing line. RIM_INLINE void setUserDivisionIsEnabled( Index labelIndex, Bool newDivisionEnabled ) { if ( labelIndex < userLabels.getSize() ) userLabels[labelIndex].divisionEnabled = newDivisionEnabled; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Units Accessor Methods /// Return a string representing a short name or abbreviation for the units which this axis represents. RIM_INLINE const UTF8String& getUnits() const { return units; } /// Set a string representing a short name or abbreviation for the units which this axis represents. RIM_INLINE void setUnits( const UTF8String& newUnits ) { units = newUnits; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Value Curve Accessor Methods /// Return an object which describes the scale which is used to display values along this axis. RIM_INLINE const ValueCurve& getValueCurve() const { return valueCurve; } /// Set an object which describes the scale which is used to display values along this axis. RIM_INLINE void setValueCurve( const ValueCurve& newCurve ) { valueCurve = newCurve; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Division Size Accessor Methods /// Return a value indicating how far apart major divisions are spaced on the graph view. RIM_INLINE Float getMajorDivision() const { return majorDivision; } /// Return a value indicating how far apart minor divisions are spaced on the graph view. RIM_INLINE Float getMinorDivision() const { return minorDivision; } /// Set a value indicating how far apart major divisions are spaced on the graph view. RIM_INLINE void setMajorDivision( Float newMajorDivision ) { majorDivision = math::abs( newMajorDivision ); } /// Set a value indicating how far apart minor divisions are spaced on the graph view. RIM_INLINE void setMinorDivision( Float newMinorDivision ) { minorDivision = math::abs( newMinorDivision ); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Division Enable Accessor Methods /// Return whether or not major dividing lines should be drawn for this axis. RIM_INLINE Bool getMajorDivisionsEnabled() const { return (flags & MAJOR_DIVISIONS) != 0; } /// Return whether or not minor dividing lines should be drawn for this axis. RIM_INLINE Bool getMinorDivisionsEnabled() const { return (flags & MINOR_DIVISIONS) != 0; } /// Set whether or not major dividing lines should be drawn for this axis. RIM_INLINE void setMajorDivisionsEnabled( Bool newMajorDivisionsEnabled ) { if ( newMajorDivisionsEnabled ) flags |= MAJOR_DIVISIONS; else flags &= ~MAJOR_DIVISIONS; } /// Set whether or not minor dividing lines should be drawn for this axis. RIM_INLINE void setMinorDivisionsEnabled( Bool newMinorDivisionsEnabled ) { if ( newMinorDivisionsEnabled ) flags |= MINOR_DIVISIONS; else flags &= ~MINOR_DIVISIONS; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Division Label Enable Accessor Methods /// Return whether or not major dividing labels should be drawn for this axis. RIM_INLINE Bool getMajorLabelsEnabled() const { return (flags & MAJOR_LABELS) != 0; } /// Return whether or not minor dividing labels should be drawn for this axis. RIM_INLINE Bool getMinorLabelsEnabled() const { return (flags & MINOR_LABELS) != 0; } /// Set whether or not major dividing labels should be drawn for this axis. RIM_INLINE void setMajorLabelsEnabled( Bool newMajorLabelsEnabled ) { if ( newMajorLabelsEnabled ) flags |= MAJOR_LABELS; else flags &= ~MAJOR_LABELS; } /// Set whether or not minor dividing labels should be drawn for this axis. RIM_INLINE void setMinorLabelsEnabled( Bool newMinorLabelsEnabled ) { if ( newMinorLabelsEnabled ) flags |= MINOR_LABELS; else flags &= ~MINOR_LABELS; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Major Division Color Accessor Methods /// Return the color to use for this axis's major grid lines. RIM_INLINE const Color4f& getMajorDivisionColor() const { return majorDivisionColor; } /// Set the color to use for this axis's major grid lines. RIM_INLINE void setMajorDivisionColor( const Color4f& newMajorDivisionColor ) { majorDivisionColor = newMajorDivisionColor; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Minor Division Color Accessor Methods /// Return the color to use for this axis's minor grid lines. RIM_INLINE const Color4f& getMinorDivisionColor() const { return minorDivisionColor; } /// Set the color to use for this axis's minor grid lines. RIM_INLINE void setMinorDivisionColor( const Color4f& newMinorDivisionColor ) { minorDivisionColor = newMinorDivisionColor; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Public Static Data Members /// The default width for a major dividing line in a graph view. static const Float DEFAULT_MAJOR_DIVISION_WIDTH; /// The default width for a minor dividing line in a graph view. static const Float DEFAULT_MINOR_DIVISION_WIDTH; /// The default background color that is used for a graph view's area. static const Color4f DEFAULT_MAJOR_DIVISION_COLOR; /// The default border color that is used for a graph view. static const Color4f DEFAULT_MINOR_DIVISION_COLOR; private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Class Declaration /// A class which stores information about a single label for a graph axis. class GraphLabel { public: /// Create a new graph label with the specified attributes. RIM_INLINE GraphLabel( const UTF8String& newLabel, Float newValue, Bool newLabelEnabled, Bool newDivisionEnabled ) : label( newLabel ), value( newValue ), labelEnabled( newLabelEnabled ), divisionEnabled( newDivisionEnabled ) { } /// A string representing the label for this UTF8String label; /// The value at which this label should be positioned. Float value; /// A boolean value indicating whether or not the text label should be visible for this label. Bool labelEnabled; /// A boolean value indicating whether or not a dividing line should be visible for this label. Bool divisionEnabled; }; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Members /// The main label for the axis which indicates what the axis represents. UTF8String label; /// A string representing a short name or abbreviation for the units which this axis represents. UTF8String units; /// A list of user-defined labels for the axis which allows the user to arbitrarily space marking labels. ArrayList<GraphLabel> userLabels; /// An object which describes the scale which is used to display values along this axis. ValueCurve valueCurve; /// A value indicating how far apart major divisions are spaced on the graph view. Float majorDivision; /// A value indicating how far apart minor divisions are spaced on the graph view. Float minorDivision; /// The width of the major division gridlines for the graph. Float majorDivisionWidth; /// The width of the minor division gridlines for the graph. Float minorDivisionWidth; /// The color to use when drawing major graph divisions. Color4f majorDivisionColor; /// The color to use when drawing major graph divisions. Color4f minorDivisionColor; /// An integer containing boolean flags for this graph view axis. UInt32 flags; }; //########################################################################################## //************************ End Rim Graphics GUI Namespace ******************************** RIM_GRAPHICS_GUI_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_GRAPHICS_GUI_GRAPH_VIEW_AXIS_H <file_sep>/* * rimGraphicsShadowMap.h * Rim Software * * Created by <NAME> on 12/5/13. * Copyright 2013 __MyCompanyName__. All rights reserved. * */ #ifndef INCLUDE_RIM_GRAPHICS_SHADOW_MAP_H #define INCLUDE_RIM_GRAPHICS_SHADOW_MAP_H #include "rimGraphicsTexturesConfig.h" #include "rimGraphicsTexture.h" //########################################################################################## //********************** Start Rim Graphics Textures Namespace *************************** RIM_GRAPHICS_TEXTURES_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class which stores a shadow map texture and shadow map texture matrix for that texture. /** * The texture matrix transforms points from world space into the normalized texture coordinate * space for the light's shadow map. */ class ShadowMap { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructor /// Create a shadow map object with no associated texture. RIM_INLINE ShadowMap() : texture() { } /// Create a shadow map object for the given shadow map texture and shadow texture matrix. RIM_INLINE ShadowMap( const Resource<Texture>& newTexture, const Matrix4& newShadowTextureMatrix ) : texture( newTexture ), shadowTextureMatrix( newShadowTextureMatrix ) { } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Texture Accessor Methods /// Return a pointer to the texture which is used to store this shadow map. RIM_INLINE const Resource<Texture>& getTexture() const { return texture; } /// Set a pointer to the texture which is used to store this shadow map. RIM_INLINE void setTexture( const Resource<Texture>& newTexture ) { texture = newTexture; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Shadow Texture Matrix Accessor Methods /// Return a reference to the shadow texture matrix for this shadow map. /** * The texture matrix transforms points from world space into the normalized texture coordinate * space for the light's shadow map. */ RIM_INLINE const Matrix4& getMatrix() const { return shadowTextureMatrix; } /// Set a pointer to the texture which is used to store this shadow map. /** * The texture matrix transforms points from world space into the normalized texture coordinate * space for the light's shadow map. */ RIM_INLINE void setMatrix( const Matrix4& newShadowTextureMatrix ) { shadowTextureMatrix = newShadowTextureMatrix; } private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Members Resource<Texture> texture; Matrix4 shadowTextureMatrix; }; //########################################################################################## //********************** End Rim Graphics Textures Namespace ***************************** RIM_GRAPHICS_TEXTURES_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_GRAPHICS_SHADOW_MAP_H <file_sep>/* * rimPhysicsCollisionConstraintRigidVsRigid.h * Rim Physics * * Created by <NAME> on 11/28/09. * Copyright 2009 Rim Software. All rights reserved. * */ #ifndef INCLUDE_RIM_PHYSICS_COLLISION_CONSTRAINT_RIGID_VS_RIGID_H #define INCLUDE_RIM_PHYSICS_COLLISION_CONSTRAINT_RIGID_VS_RIGID_H #include "rimPhysicsConstraintsConfig.h" #include "rimPhysicsConstraint.h" #include "rimPhysicsCollisionConstraint.h" //########################################################################################## //********************* Start Rim Physics Constraints Namespace ************************** RIM_PHYSICS_CONSTRAINTS_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class which solves collision constraints between arbitrary template object types. template <> class CollisionConstraint<RigidObject,RigidObject> : public Constraint { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Public Constraint Instance Declaration /// A class which represents an instance of a collision constraint. class Instance; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constraint Instance Accessor Methods /// Return a pointer to the constraint instance between the specified rigid objects. /** * If there is no constraint instance between those objects, NULL is returned. */ RIM_INLINE const Instance* getInstance( const RigidObject* object1, const RigidObject* object2 ) const { ObjectPair<RigidObject,RigidObject> pair( object1, object2 ); const Instance* instance; if ( instances.find( pair.getHashCode(), pair, instance ) ) return instance; else return NULL; } /// Return the total number of object-object collision constraint instances in this constraint. RIM_INLINE Size getInstanceCount() const { return instances.getSize(); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constraint Solving Methods /// Solve all instances of this constraint for the specified time step and number of solver iterations. /** * In this method, the collision result set for this constraint is examined * and collision constraint instances are created for each pair of colliding * objects in the collision manifold. */ virtual void solve( Real dt, Size numIterations ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Collision Result Set Accessor Methods /// Return a const reference to the collision result set for this collision constraint. RIM_INLINE const CollisionResultSet<RigidObject,RigidObject>& getCollisionResultSet() const { return collisionResultSet; } /// Return a reference to the collision result set for this collision constraint. RIM_INLINE CollisionResultSet<RigidObject,RigidObject>& getCollisionResultSet() { return collisionResultSet; } /// Set the collision result set for this collision constraint. RIM_INLINE void setCollisionResultSet( const CollisionResultSet<RigidObject,RigidObject>& newResultSet ) { collisionResultSet = newResultSet; } private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Solver Point Class Declaration /// A class which represents a single collision point constraint solver state. class SolverPoint; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Members /// A set of collision results that this constraint uses to create constraint instances. CollisionResultSet<RigidObject,RigidObject> collisionResultSet; /// A map from object pairs to collision constraint instances. HashMap<ObjectPair<RigidObject,RigidObject>,Instance> instances; /// The current frame index for this constraint. /** * This value is used to keep track of which constraint instances have * not been updated recently and need to be removed from this constraint. */ Index timestamp; }; //########################################################################################## //########################################################################################## //############ //############ Collision Constraint Solver Point Class Definition //############ //########################################################################################## //########################################################################################## class CollisionConstraint<RigidObject,RigidObject>:: SolverPoint { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructor /// Create a new collision constraint solver point for the specified objects and collision point. RIM_INLINE SolverPoint( const RigidObject& object1, const RigidObject& object2, const CollisionPoint& point, Index newTimestamp = 0 ) : frame( Matrix3::planeBasis( point.getNormal() ) ), r1( point.getWorldSpacePoint1() - object1.getCenterOfMass() ), r2( point.getWorldSpacePoint2() - object2.getCenterOfMass() ), separationDistance( point.getSeparationDistance() ), material( point.getMaterial() ), biasAmount( 0 ), accumulatedBiasImpulse( 0 ), timestamp( newTimestamp ) { objectSpaceR1 = object1.getTransform().transformToObjectSpace( r1 ); objectSpaceR2 = object2.getTransform().transformToObjectSpace( r2 ); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Public Collision Configuration Update Method /// Update the specified collision configuration data members. RIM_INLINE void update( const Vector3& newNormal, const Vector3& newR1, const Vector3& newR2, const Vector3& newObjectSpaceR1, const Vector3& newObjectSpaceR2, Real newSeparationDistance, const CollisionShapeMaterial& newMaterial, Index newTimestamp ) { frame = Matrix3::planeBasis( newNormal ); r1 = newR1; r2 = newR2; objectSpaceR1 = newObjectSpaceR1; objectSpaceR2 = newObjectSpaceR2; separationDistance = newSeparationDistance; material = newMaterial; timestamp = newTimestamp; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Public Collision Configuration Data Members /// A 3x3 matrix representing the coordinate frame axes of this solver point. /** * The collision normal is the Z-vector of this matrix, the other vectors * are tangent vectors to the normal. */ Matrix3 frame; /// The vector from the first object's center of mass to the collision point in world space. Vector3 r1; /// The vector from the second object's center of mass to the collision point in world space. Vector3 r2; /// The vector from the first object's center of mass to the collision point in object space. Vector3 objectSpaceR1; /// The vector from the second object's center of mass to the collision point in object space. Vector3 objectSpaceR2; /// The current negative penetration distance of the two objects. Real separationDistance; /// The combined material of the two objects at this collision solver point. CollisionShapeMaterial material; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Public Constraint Solving Data Members /// The inertial mass for each of the point's coordinate frame directions. /** * This mass is stored in (tangent1, tangent2, normal) diretion format. */ Vector3 massVector; /// The accumulated impulse for this constraint, stored in (tangent1, tangent2, normal) format. Vector3 accumulatedImpulse; /// The desired bias amount (in units of velocity). Real biasAmount; /// The accumulate bias impulse along the collision normal direction. Real accumulatedBiasImpulse; /// The velocity at which the objects should separate (if they collide elastically). Real bounceVelocity; /// An integral timestamp for this solver point indicating when it was last updated. Index timestamp; }; //########################################################################################## //########################################################################################## //############ //############ Collision Constraint Instance Class Definition //############ //########################################################################################## //########################################################################################## class CollisionConstraint<RigidObject,RigidObject>:: Instance { private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Object Accessor Methods /// Return a pointer to the first object that is a part of this collision constraint instance. RIM_INLINE RigidObject* getObject1() const { return object1; } /// Return a pointer to the second object that is a part of this collision constraint instance. RIM_INLINE RigidObject* getObject2() const { return object2; } private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Constructors /// Create a new collision constraint instance bewteen the specified rigid objects. /** * This constructor adds a constraint solver point for each collision point * in the specified manifold between these objects. */ RIM_INLINE Instance( RigidObject* newObject1, RigidObject* newObject2, const CollisionManifold& manifold, Index newTimestamp ) : object1( newObject1 ), object2( newObject2 ) { updateSolverPoints( manifold, newTimestamp ); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Constraint Instance Update Method /// Update this constraint instance with the collision points from the specified manifold. /** * When updating solver points, this method attempts to match old solver points * with new collision points if these points are within the specified update * threshold distance from each other. */ void updateSolverPoints( const CollisionManifold& newManifold, Index newTimestamp, Real updateThreshold = Real(0.01) ) { timestamp = newTimestamp; Real updateThresholdSquared = updateThreshold*updateThreshold; //************************************************************************* // Look through the set of manifold collision points and see if any // of them match old solver points. If not, add them to the list of points. Size numManifoldPoints = newManifold.getPointCount(); Size oldNumSolverPoints = solverPoints.getSize(); for ( Index i = 0; i < numManifoldPoints; i++ ) { const CollisionPoint& point = newManifold.getPoint(i); Index j = 0; for ( ; j < oldNumSolverPoints; j++ ) { SolverPoint& solverPoint = solverPoints[j]; // If this point has already been updated, skip it. if ( solverPoint.timestamp == timestamp ) continue; // Test to see if the new point is close to the old point in object space. Vector3 r1 = point.getObjectSpacePoint1() - object1->getCenterOfMass(); Vector3 r2 = point.getObjectSpacePoint2() - object2->getCenterOfMass(); Vector3 objectSpaceR1 = object1->getTransform().transformToObjectSpace( r1 ); Vector3 objectSpaceR2 = object2->getTransform().transformToObjectSpace( r2 ); if ( objectSpaceR1.getDistanceToSquared( solverPoint.objectSpaceR1 ) < updateThresholdSquared && objectSpaceR2.getDistanceToSquared( solverPoint.objectSpaceR2 ) < updateThresholdSquared ) { // This is a matching solver point, update it. solverPoint.update( point.getNormal(), r1, r2, objectSpaceR1, objectSpaceR2, point.getSeparationDistance(), point.getMaterial(), timestamp ); break; } } // If we didn't find a matching point, add a new solver point. if ( j == oldNumSolverPoints ) solverPoints.add( SolverPoint( *object1, *object2, point, timestamp ) ); } // Find all of the old solver points in this constraint instance and remove them. for ( Index i = 0; i < oldNumSolverPoints; i++ ) { if ( solverPoints[i].timestamp < timestamp ) solverPoints.removeAtIndexUnordered( i ); } } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Members /// The first object that is being affected by this collision constraint instance. RigidObject* object1; /// The second object that is being affected by this collision constraint instance. RigidObject* object2; /// An array of the solver points associated with this constraint instance. ArrayList<SolverPoint> solverPoints; /// The last integral frame timestamp when this constraint instance was updated. /** * This value is used to keep track of whether or not a collision constraint * is still valid. If there are no collision points between an object pair, * the constraint is not updated and it should be removed from simulation. */ Index timestamp; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Friend Class Declaration /// Declare the collision constraint class as a friend. friend class CollisionConstraint<RigidObject,RigidObject>; }; //########################################################################################## //********************* End Rim Physics Constraints Namespace **************************** RIM_PHYSICS_CONSTRAINTS_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_PHYSICS_COLLISION_CONSTRAINT_RIGID_VS_RIGID_H <file_sep>/* * rimGraphicsLODShape.h * Rim Graphics * * Created by <NAME> on 11/23/11. * Copyright 2011 __MyCompanyName__. All rights reserved. * */ #ifndef INCLUDE_RIM_GRAPHICS_LOD_SHAPE_H #define INCLUDE_RIM_GRAPHICS_LOD_SHAPE_H #include "rimGraphicsShapesConfig.h" #include "rimGraphicsShapeBase.h" //########################################################################################## //*********************** Start Rim Graphics Shapes Namespace **************************** RIM_GRAPHICS_SHAPES_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A shape type that allows the user to render an object with a varying level of detail. /** * A level-of-detail shape specifies a sorted list of shapes that should be used * to render an object at different effective screen-space sizes. This allows * simplified representations to be used for distant objects and detailed representations * for nearby objects. The projected screen-space radius (in pixels) of the shape's bounding sphere * for a given camera is used to determine the level of detail to use. * * The LODShape allows the user to bias the level-of-detail determination by a * multiplying factor. This factor scales the screen-space radius used when determining * the optimal level of detail. For instance, a factor of 2.0 will result in the * shape being rendered with a level of detail suitable for double the actual * screen space radius. This can be used to control the overall quality of rendering * on a per-shape basis. For less powerful hardware, a factor less than 1 can be used * to lower the rendering workload at the expense of some loss in visual quality. */ class LODShape : public GraphicsShapeBase<LODShape> { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructors /// Create an LOD shape with no levels of detail and an LOD bias of 1. LODShape(); /// Create an LOD shape with the specified shape level of detail and an LOD bias of 1. LODShape( const Pointer<GraphicsShape>& newShape, Real newPixelRadius ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Level of Detail Accessor Methods /// Add a new level of detail shape which is used for the specified maximum on-screen pixel radius. /** * If the required on-screen pixel radius of the shape's bounding sphere is smaller * than the specified value but larger than the next smallest level of detail, * the given shape is used to render this LOD shape. * * If the new level of detail shape is NULL, the method fails and FALSE is returned. * Otherwise, the method succeeds, the new level of detail is added, and TRUE is returned. */ Bool addLevel( const Pointer<GraphicsShape>& newShape, Real newPixelRadius ); /// Remove the level of detail at the specified index in this LOD shape. /** * Levels are stored in reverse sorted order, with the largest level of detail * first, index 0 corresponds to the largest level of detail. */ void removeLevel( Index i ); /// Clear all levels of detail from this shape. void clearLevels(); /// Get the number of levels of detail that this shape has. RIM_FORCE_INLINE Size getLevelCount() const { return levels.getSize(); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Level of Detail Shape Accessor Methods /// Return a pointer to the shape for the level of detail at the specified index. /** * Levels are stored in reverse sorted order, with the largest level of detail * first, index 0 corresponds to the largest level of detail. */ RIM_INLINE Pointer<GraphicsShape>& getLevelShape( Index i ) { RIM_DEBUG_ASSERT_MESSAGE( i < levels.getSize(), "Cannot get level of detail shape at invalid index." ); return levels[levels.getSize() - i - 1].shape; } /// Return a pointer to the shape for the level of detail at the specified index. /** * Levels are stored in reverse sorted order, with the largest level of detail * first, index 0 corresponds to the largest level of detail. */ RIM_INLINE const Pointer<GraphicsShape>& getLevelShape( Index i ) const { RIM_DEBUG_ASSERT_MESSAGE( i < levels.getSize(), "Cannot get level of detail shape at invalid index." ); return levels[levels.getSize() - i - 1].shape; } /// Set the shape for the level of detail at the specified index. /** * Levels are stored in reverse sorted order, with the largest level of detail * first, index 0 corresponds to the largest level of detail. */ RIM_INLINE Bool setLevelShape( Index i, const Pointer<GraphicsShape>& newShape ) { RIM_DEBUG_ASSERT_MESSAGE( i < levels.getSize(), "Cannot set level of detail shape at invalid index." ); if ( newShape.isNull() ) return false; levels[levels.getSize() - i - 1].shape = newShape; return true; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Level of Detail Pixel Radius Accessor Methods /// Return the maximum pixel radius for the level of detail at the specified index. /** * Levels are stored in reverse sorted order, with the largest level of detail * first, index 0 corresponds to the largest level of detail. */ RIM_INLINE Real getLevelPixelRadius( Index i ) const { RIM_DEBUG_ASSERT_MESSAGE( i < levels.getSize(), "Cannot get level of detail pixel radius at invalid index." ); return levels[levels.getSize() - i - 1].maximumPixelRadius; } /// Get the maximum pixel radius for the level of detail at the specified index. /** * Calling this method potentially reorders the level of details. Previously valid * indices will not necessarily be valid after calling this method. * * Levels are stored in reverse sorted order, with the largest level of detail * first, index 0 corresponds to the largest level of detail. */ void setLevelPixelRadius( Index i, Real newMaximumPixelRadius ); /// Get the level of detail which should be used when the shape has the specified screen-space radius. Pointer<GraphicsShape> getLevelForPixelRadius( Real pixelRadius ) const; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Level of Detail Bias Accessor Method /// Return a value which is used to multiplicatively bias the size of a pixel radius query. /** * The default value is 1, indicating that no bias is applied. For instance, * a bias of 0.5 means that any LOD query will be interpreted to have half the * requested on-screen pixel radius. */ RIM_FORCE_INLINE Real getLODBias() const { return lodBias; } /// Set a value which is used to multiplicatively bias the size of a pixel radius query. /** * The default value is 1, indicating that no bias is applied. For instance, * a bias of 0.5 means that any LOD query will be interpreted to have half the * requested on-screen pixel radius. */ RIM_FORCE_INLINE void setLODBias( Real newLODBias ) { lodBias = math::max( newLODBias, Real(0) ); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Bounding Volume Accessor Methods /// Update the level-of-detail shape's axis-aligned bounding box. virtual void updateBoundingBox(); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Shape Chunk Accessor Method /// Process the level-of-detail shape into a flat list of mesh chunk objects. /** * This method chooses the best level of detail to use for the specified * camera's viewpoint based on the projected screen-space radius of this * shape's bounding sphere. The getChunks() method for that level of detail * is then called to process it into mesh chunks. */ virtual Bool getChunks( const Transform3& worldTransform, const Camera& camera, const ViewVolume* viewVolume, const Vector2D<Size>& viewportSize, ArrayList<MeshChunk>& chunks ) const; private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Level of Detail Class /// A class which represents a level of detail for this LODShape. class Level { public: /// Create a new level of detail with the specified shape and maximum pixel radius. RIM_FORCE_INLINE Level( const Pointer<GraphicsShape>& newShape, Real newMaximumPixelRadius ) : shape( newShape ), maximumPixelRadius( newMaximumPixelRadius ) { } /// The shape to use for this level of detail. Pointer<GraphicsShape> shape; /// The maximum screen-space size of the bounding sphere of the LOD level where it should be used. Real maximumPixelRadius; }; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Members /// An array of the levels of detail for this LOD shape. ArrayList<Level> levels; /// A value which multiplicatively biases the size of the pixel radius query. /** * A value of 1 will result in normal operation. A value less than 1 * will result in less-detailed levels being chosen. A value greater * than 1 will result in higher-detailed levels being chosen. */ Real lodBias; }; //########################################################################################## //*********************** End Rim Graphics Shapes Namespace ****************************** RIM_GRAPHICS_SHAPES_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_GRAPHICS_LOD_SHAPE_H <file_sep>/* * Simulation.cpp * Quadcopter * * Created by <NAME> on 11/20/14. * Copyright 2014 __MyCompanyName__. All rights reserved. * */ #include "Simulation.h" //########################################################################################## //########################################################################################## //############ //############ Constructor //############ //########################################################################################## //########################################################################################## Simulation:: Simulation() : gravity( 0, -9.81f, 0 ), drag( 1 ) { } //########################################################################################## //########################################################################################## //############ //############ Update Method //############ //########################################################################################## //########################################################################################## void Simulation:: update( Float dt ) { integrateRK4( dt ); //integrateSemiImplicitEuler( dt ); } //########################################################################################## //########################################################################################## //############ //############ Semi-Implicite Euler Integration Method //############ //########################################################################################## //########################################################################################## void Simulation:: integrateSemiImplicitEuler( Float dt ) { // Update the simulation state of each quadcopter. const Size numQuadcopters = quadcopters.getSize(); for ( Index i = 0; i < numQuadcopters; i++ ) { Quadcopter& quadcopter = *quadcopters[i]; TransformState& state = quadcopter.currentState; const Vector3f& position = state.position; const Vector3f& velocity = state.velocity; const Matrix3f& rotation = state.rotation; const Vector3f& angularVelocity = state.angularVelocity; //**************************************************************** // Compute the linear and angular acceleration. Vector3f acceleration; Vector3f angularAcceleration; computeAcceleration( quadcopter, dt, position, velocity, rotation, angularVelocity, acceleration, angularAcceleration ); // Integrate acceleration to velocity. state.velocity += acceleration*dt; state.angularVelocity += angularAcceleration*dt; // Integrate velocity to position. state.position += state.velocity*dt; state.rotation = (state.rotation + Matrix3f::skewSymmetric( state.angularVelocity )*state.rotation*dt).orthonormalize(); } } //########################################################################################## //########################################################################################## //############ //############ RK4 Integration Method //############ //########################################################################################## //########################################################################################## void Simulation:: integrateRK4( Float dt ) { // Compute various constant factors of the timestep. const Float dt2 = (dt / Float(2)); const Float dt3 = (dt / Float(3)); const Float dt6 = (dt / Float(6)); // Intermediate linear and angular acceleration values. Vector3f ddP1, ddP2, ddP3, ddP4; Vector3f ddR1, ddR2, ddR3, ddR4; // Update the simulation state of each quadcopter. const Size numQuadcopters = quadcopters.getSize(); for ( Index i = 0; i < numQuadcopters; i++ ) { Quadcopter& quadcopter = *quadcopters[i]; TransformState& state = quadcopter.currentState; const Vector3f& position = state.position; const Vector3f& velocity = state.velocity; const Matrix3f& rotation = state.rotation; const Vector3f& angularVelocity = state.angularVelocity; //**************************************************************** // Integrate using RK4. // xk1 = v_n; // vk1 = a( x_n, v_n ); Vector3f p1 = position; Matrix3f r1 = rotation; Vector3f dP1 = velocity; Vector3f dR1 = angularVelocity; computeAcceleration( quadcopter, 0, p1, dP1, r1, dR1, ddP1, ddR1 ); // xk2 = v_n + 0.5*h*vk1; // vk2 = a( x_n + 0.5*h*xk1, xk2 ); Vector3f p2 = position + dP1*dt2; Matrix3f r2 = (rotation + Matrix3f::skewSymmetric( dR1 )*rotation*dt).orthonormalize(); Vector3f dP2 = velocity + ddP1*dt2; Vector3f dR2 = angularVelocity + ddR1*dt2; computeAcceleration( quadcopter, dt2, p2, dP2, r2, dR2, ddP2, ddR2 ); // xk3 = v_n + 0.5*h*vk2; // vk3 = a( x_n + 0.5*h*xk2, xk3 ); Vector3f p3 = position + dP2*dt2; Matrix3f r3 = (rotation + Matrix3f::skewSymmetric( dR2 )*rotation*dt).orthonormalize(); Vector3f dP3 = velocity + ddP2*dt2; Vector3f dR3 = angularVelocity + ddR2*dt2; computeAcceleration( quadcopter, dt2, p3, dP3, r3, dR3, ddP3, ddR3 ); // xk4 = v_n + h*vk3; // vk4 = a( x_n + h*xk3, xk4 ); Vector3f p4 = position + dP3*dt; Matrix3f r4 = (rotation + Matrix3f::skewSymmetric( dR3 )*rotation*dt).orthonormalize(); Vector3f dP4 = velocity + ddP3*dt; Vector3f dR4 = angularVelocity + ddR3*dt; computeAcceleration( quadcopter, dt, p4, dP4, r4, dR4, ddP4, ddR4 ); //**************************************************************** // Accumulate the final weighted position and velocity. state.position = position + dP1*dt6 + dP2*dt3 + dP3*dt3 + dP4*dt6; state.rotation = (rotation + Matrix3f::skewSymmetric( dR1 )*rotation*dt6 + Matrix3f::skewSymmetric( dR2 )*rotation*dt3 + Matrix3f::skewSymmetric( dR3 )*rotation*dt3 + Matrix3f::skewSymmetric( dR4 )*rotation*dt6).orthonormalize(); state.velocity = velocity + ddP1*dt6 + ddP2*dt3 + ddP3*dt3 + ddP4*dt6; state.angularVelocity = angularVelocity + ddR1*dt6 + ddR2*dt3 + ddR3*dt3 + ddR4*dt6; } } //########################################################################################## //########################################################################################## //############ //############ Acceleration Computation Method //############ //########################################################################################## //########################################################################################## void Simulation:: computeAcceleration( const Quadcopter& quadcopter, Float timeStep, const Vector3f& position, const Vector3f& velocity, const Matrix3f& rotation, const Vector3f& angularVelocity, Vector3f& linearAcceleration, Vector3f& angularAcceleration ) { // Compute the gravitational acceleration. linearAcceleration = gravity; // Add the effects of drag forces. linearAcceleration -= drag*velocity; // Compute the quadcopter acceleration based on the environmental forces. quadcopter.computeAcceleration( TransformState( position, rotation, velocity, angularVelocity ), timeStep, linearAcceleration, angularAcceleration ); } <file_sep>/* * rimImageFormat.h * Rim Images * * Created by <NAME> on 1/15/13. * Copyright 2013 __MyCompanyName__. All rights reserved. * */ #ifndef INCLUDE_RIM_IMAGE_FORMAT_H #define INCLUDE_RIM_IMAGE_FORMAT_H #include "rimImageIOConfig.h" //########################################################################################## //*************************** Start Rim Image IO Namespace ******************************* RIM_IMAGE_IO_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// An enum class representing the different kinds of image encoding formats. class ImageFormat { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Image Format Enum Declaration /// An enum type representing the different kinds of image encoding formats. typedef enum Enum { /// An undefined image format. UNDEFINED = ResourceFormat::UNDEFINED, /// The uncompressed .bmp image file format. BMP = ResourceFormat::BMP, /// The lossily-compressed .jpg image file format. JPEG = ResourceFormat::JPEG, /// The losslessly-compressed .png image file format. PNG = ResourceFormat::PNG, /// The .tga image file format. TGA = ResourceFormat::TGA, /// The .tiff image file format. TIFF = ResourceFormat::TIFF, /// The .gif image file format. GIF = ResourceFormat::GIF, /// The JPEG 2000 image file format. JPEG_2000 = ResourceFormat::JPEG_2000, /// The DDS image/texture file format. DDS = ResourceFormat::DDS }; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructors /// Create an image format object with an UNDEFINED image format. RIM_INLINE ImageFormat() : format( UNDEFINED ) { } /// Create a pixel type object from the specified image format Enum. RIM_INLINE ImageFormat( ImageFormat::Enum newFormat ) : format( newFormat ) { } /// Create a pixel type object from the specified image format Enum. ImageFormat( const ResourceFormat& newFormat ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Enum Cast Operator /// Convert this image format to an enum value. RIM_INLINE operator Enum () const { return format; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Image Format Extension Accessor Method /// Return the standard file extension used for this image format. UTF8String getExtension() const; /// Return an image format which corresponds to the format with the given extension string. static ImageFormat getFormatForExtension( const UTF8String& extension ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Image Format String Conversion Methods /// Return a string representation of the image format. String toString() const; /// Convert this image format into a string representation. RIM_INLINE operator String () const { return this->toString(); } private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Members /// An enum value specifying the image format. Enum format; }; //########################################################################################## //*************************** End Rim Image IO Namespace ********************************* RIM_IMAGE_IO_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_IMAGE_FORMAT_H <file_sep>/* * rimGraphicsGUIFontMetrics.h * Rim Graphics GUI * * Created by <NAME> on 1/16/13. * Copyright 2013 Headspace Systems. All rights reserved. * */ #ifndef INCLUDE_RIM_GRAPHICS_GUI_FONT_METRICS_H #define INCLUDE_RIM_GRAPHICS_GUI_FONT_METRICS_H #include "rimGraphicsGUIFontsConfig.h" //########################################################################################## //********************* Start Rim Graphics GUI Fonts Namespace *************************** RIM_GRAPHICS_GUI_FONTS_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class which describes sizing information for a particular Font. class FontMetrics { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructor /// Create a default font metrics object. RIM_INLINE FontMetrics() : size( 0 ) { } /// Create a font metrics object with the specified attributes. RIM_INLINE FontMetrics( Float newSize, const Vector2f& newLineAdvance, const AABB2f& newGlyphBounds, const Vector2f& newMaxAdvance ) : size( newSize ), lineAdvance( newLineAdvance ), glyphBounds( newGlyphBounds ), maxAdvance( newMaxAdvance ) { } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Font Size Accessor Methods /// Return the nominal size of the font in pixels. RIM_INLINE Float getSize() const { return size; } /// Set the nominal size of the font in pixels. RIM_INLINE void setSize( Float newSize ) { size = newSize; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Font Height Accessor Methods /// Return the vector in pixels between consecutive lines of text of the font. RIM_INLINE const Vector2f& getLineAdvance() const { return lineAdvance; } /// Set the vector in pixels between consecutive lines of text of the font. RIM_INLINE void setLineAdvance( const Vector2f& newLineAdvance ) { lineAdvance = newLineAdvance; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Bounding Box Accessor Methods /// Return a 2D bounding box which encloses all glyphs that are part of the font. /** * This bounding box is specified where (0,0) is the origin of a glyph. * The bounding box is expressed in units of pixels. */ RIM_INLINE const AABB2f& getBounds() const { return glyphBounds; } /// Set a 2D bounding box which encloses all glyphs that are part of the font. /** * This bounding box is specified where (0,0) is the origin of a glyph. * The bounding box is expressed in units of pixels. */ RIM_INLINE void setBounds( const AABB2f& newGlyphBounds ) { glyphBounds = newGlyphBounds; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Maximum Advance Accessor Methods /// Return the maximum distance in pixels from the origin of a first glyph to that of a second glyph for the font. /** * This value is returned for both the horizontal and vertical directions. */ RIM_INLINE const Vector2f& getMaxAdvance() const { return maxAdvance; } /// Set the maximum distance in pixels from the origin of a first glyph to that of a second glyph for the font. /** * This value is specified for both the horizontal and vertical directions. */ RIM_INLINE void setMaxAdvance( const Vector2f& newMaxAdvance ) { maxAdvance = newMaxAdvance; } private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Members /// The nominal size of the font. Float size; /// The vector in pixels between successive lines of the font. Vector2f lineAdvance; /// A 2D axis-aligned bounding box which encloses all glyphs that are part of the font. /** * This bounding box is specified where (0,0) is the origin of the glyph. * The bounding box is expressed in units of pixels. */ AABB2f glyphBounds; /// The largest advance vector between two successive characters in both directions. Vector2f maxAdvance; }; //########################################################################################## //********************* End Rim Graphics GUI Fonts Namespace ***************************** RIM_GRAPHICS_GUI_FONTS_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_GRAPHICS_GUI_FONT_METRICS_H <file_sep>/* * rimAssetsBase.h * Rim Assets * * Created by <NAME> on 11/7/07. * Copyright 2007 __MyCompanyName__. All rights reserved. * */ #ifndef INCLUDE_RIM_ASSETS_BASE_H #define INCLUDE_RIM_ASSETS_BASE_H #include "assets/rimAssetsConfig.h" #include "assets/rimAssetType.h" #include "assets/rimAssetTypeTranscoder.h" #include "assets/rimAssetObject.h" #include "assets/rimAsset.h" #include "assets/rimAssetScene.h" #include "assets/rimAssetTranscoder.h" #endif // INCLUDE_RIM_ASSETS_BASE_H <file_sep>/* * rimGraphicsGUIConfig.h * Rim Graphics * * Created by <NAME> on 6/7/08. * Copyright 2008 Rim Software. All rights reserved. * */ #ifndef INCLUDE_RIM_GRAPHICS_GUI_CONFIG_H #define INCLUDE_RIM_GRAPHICS_GUI_CONFIG_H #include "rim/rimFramework.h" #include "rim/rimImages.h" #include "rim/rimBVH.h" #include "rim/rimGraphics.h" #include "rim/rimGUI.h" //########################################################################################## //########################################################################################## //############ //############ Library Namespace Configuration //############ //########################################################################################## //########################################################################################## #ifndef RIM_GRAPHICS_GUI_NAMESPACE_START #define RIM_GRAPHICS_GUI_NAMESPACE_START RIM_GRAPHICS_NAMESPACE_START namespace gui { #endif #ifndef RIM_GRAPHICS_GUI_NAMESPACE_END #define RIM_GRAPHICS_GUI_NAMESPACE_END }; RIM_GRAPHICS_NAMESPACE_END #endif //########################################################################################## //************************ Start Rim Graphics GUI Namespace ****************************** RIM_GRAPHICS_GUI_NAMESPACE_START //****************************************************************************************** //########################################################################################## using rim::gui::input::KeyboardEvent; using rim::gui::input::MouseButtonEvent; using rim::gui::input::MouseMotionEvent; using rim::gui::input::MouseWheelEvent; using rim::gui::input::MouseButton; using rim::gui::input::Key; using rim::gui::input::KeyboardShortcut; class GUIRenderer; //########################################################################################## //************************ End Rim Graphics GUI Namespace ******************************** RIM_GRAPHICS_GUI_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_GRAPHICS_GUI_CONFIG_H <file_sep>/* * rimAssetObject.h * Rim Software * * Created by <NAME> on 6/13/14. * Copyright 2014 __MyCompanyName__. All rights reserved. * */ #ifndef INCLUDE_RIM_ASSET_OBJECT_H #define INCLUDE_RIM_ASSET_OBJECT_H #include "rimAssetsConfig.h" //########################################################################################## //**************************** Start Rim Assets Namespace ******************************** RIM_ASSETS_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class which contains a pre-parsed text-based asset object. class AssetObject { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Public Type Declarations /// A class representing a lightweight no-allocation string that points to external character data. class String { public: /// Create a new string with no character data. RIM_INLINE String() : string( NULL ), length( 0 ) { } /// Create a new string with the specified starting pointer and length. RIM_INLINE String( const UTF8Char* newString, Size newLength ) : string( newString ), length( newLength ) { } /// Return whether or not this string has any characters. RIM_INLINE Bool isSet() const { return string && length > Size(0); } /// Return whether or not this string has any characters. RIM_INLINE Bool isNull() const { return !string || length == Size(0); } /// A pointer to the first UTF8 character for this string. /** * This string may not be NULL-terminated. */ const UTF8Char* string; /// The number of characters in this string. Size length; }; /// A class representing a single name-value pair for an object field. class Field { public: /// Create a new field with the specified name and value strings. RIM_INLINE Field( const String& newName, const String& newValue ) : name( newName ), value( newValue ) { } /// A string representing the name of this field. String name; /// A string representing the value of this field. String value; }; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructors /// Create a new asset object with no fields. RIM_INLINE AssetObject() : localID( ResourceID::INVALID_LOCAL_ID ) { } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Field Accessor Methods /// Return the number of fields there are in this asset object. RIM_INLINE Size getFieldCount() const { return fields.getSize(); } /// Return a reference to the field at the specified index in this object. RIM_INLINE const Field& getField( Index fieldIndex ) const { return fields[fieldIndex]; } /// Add a new field to this asset object, specified as a name/value pair of strings. RIM_INLINE void addField( const UTF8Char* nameStart, Size nameLength, const UTF8Char* valueStart, Size valueLength ) { fields.add( Field( String( nameStart, nameLength ), String( valueStart, valueLength ) ) ); } /// Remove all fields from this asset object. RIM_INLINE void clearFields() { fields.clear(); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Asset Object Name Accessor Methods /// Return a reference to a string representing the name of this asset object. RIM_INLINE const String& getName() const { return name; } /// Set a string representing the name of this asset object. RIM_INLINE void setName( const String& newName ) { name = newName; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Asset Object Name Accessor Methods /// Return the file-local ID for this asset object. RIM_INLINE ResourceLocalID getLocalID() const { return localID; } /// Set the file-local ID for this asset object. RIM_INLINE void setLocalID( ResourceLocalID newLocalID ) { localID = newLocalID; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Asset Object Reset Method /// Reset this asset object to the defaut state with no fields and no name or local ID. RIM_INLINE void reset() { localID = ResourceID::INVALID_LOCAL_ID; name = String(); fields.clear(); } private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Members /// The file-local ID for this asset object. ResourceLocalID localID; /// The name of this asset object. String name; /// A list of the fields in this asset object. ShortArrayList<Field,8> fields; }; //########################################################################################## //**************************** End Rim Assets Namespace ********************************** RIM_ASSETS_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_ASSET_OBJECT_H <file_sep>/* * rimImages.h * Rim Images * * Created by <NAME> on 2/2/08. * Copyright 2008 Rim Software. All rights reserved. * */ #ifndef INCLUDE_RIM_IMAGES_H #define INCLUDE_RIM_IMAGES_H #include "images/rimImagesConfig.h" #include "images/rimColor3D.h" #include "images/rimColor4D.h" #include "images/rimPixelFormat.h" #include "images/rimImage.h" #include "images/rimImageIO.h" //########################################################################################## //**************************** Start Rim Images Namespace ******************************** RIM_IMAGES_NAMESPACE_START //****************************************************************************************** //########################################################################################## using rim::images::io::ImageFormat; using rim::images::io::ImageConverter; using rim::images::io::BMPTranscoder; using rim::images::io::TGATranscoder; using rim::images::io::PNGTranscoder; using rim::images::io::JPEGTranscoder; using rim::images::io::ImageEncodingParameters; //########################################################################################## //**************************** End Rim Images Namespace ********************************** RIM_IMAGES_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_IMAGES_H <file_sep>/* * rimImagesColor4D.h * Rim Images * * Created by <NAME> on 9/17/09. * Copyright 2009 Rim Software. All rights reserved. * */ #ifndef INCLUDE_RIM_IMAGES_COLOR_4D_H #define INCLUDE_RIM_IMAGES_COLOR_4D_H #include "rimImagesConfig.h" #include "rimColor3D.h" //########################################################################################## //**************************** Start Rim Images Namespace ******************************** RIM_IMAGES_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A template class representing a 4-component color. template < typename T > class Color4D { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructors /// Create a new 4D color with all elements equal to zero. RIM_INLINE Color4D<T>() : r( T(0) ), g( T(0) ), b( T(0) ), a( T(0) ) { } /// Create a new 4D color with all elements equal to a single value. /** * This constructor creates a uniform 4D color with all elements * equal to each other and equal to the single constructor parameter * value. * * @param value - The value to set all elements of the color to. */ explicit RIM_INLINE Color4D<T>( T value ) : r( value ), g( value ), b( value ), a( value ) { } /// Create a new 4D color by specifying it's x, y, z, and w values. /** * This constructor sets each of the color's x, y, z, and w component * values to be the 1st, 2nd, 3rd, and 4th parameters of the constructor, * respectively. * * @param newred - The red component of the new color. * @param newgreen - The green component of the new color. * @param newblue - The blue component of the new color. * @param newW - The W component of the new color. */ RIM_INLINE Color4D<T>( T newred, T newgreen, T newblue, T newW ) : r( newred ), g( newgreen ), b( newblue ), a( newW ) { } /// Create a new 4D color from an existing color (copy it). /** * This constructor takes the x, y, z, and w values of the * color parameter and sets the components of this color * to be the same. * * @param color - The color to be copied. */ RIM_INLINE Color4D<T>( const Color4D<T>& color ) : r( color.r ), g( color.g ), b( color.b ), a( color.a ) { } /// Create a new 4D color from an existing vector (copy it). /** * This constructor takes the x, y, z, and w values of the * vector parameter and sets the components of this color * to be the same. * * @param vector - The vector to be copied. */ RIM_INLINE Color4D<T>( const math::Vector4D<T>& vector ) : r( vector.r ), g( vector.g ), b( vector.b ), a( vector.a ) { } /// Create a new 4D color from an existing color (copy it), templatized version. /** * This constructor takes the x, y, z, and w values of the * color parameter and sets the components of this color * to be the same. This is a templatized version of the above copy constructor. * * @param color - The color to be copied. */ template < typename U > RIM_INLINE Color4D<T>( const Color4D<U>& color ) : r( color.r ), g( color.g ), b( color.b ), a( color.a ) { } /// Create a new 4D color from a 3D color and a value for the W component. /** * This constructor takes the red, green, and blue components of the first parameter, * a 2D color, and sets the red, green, and blue components of this color to be * the same. It then takes the 2nd paramter, a value, and sets the W * component of this color to be that value. * * @param color - A 3D color for the red, green, and blue components of this color. * @param newblue - The value for the W component of this color. */ RIM_INLINE Color4D<T>( const Color3D<T>& color, T newA ) : r( color.r ), g( color.g ), b( color.b ), a( newA ) { } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Element Accessor Methods /// Get a shallow array representation of this color. /** * This method returns a pointer to the address of the red component * of the color and does not do any copying of the elements. * Therefore, this method should only be used where one needs * an array representation of a color without having to * allocate more memory and copy the color. * * @return A pointer to a shallow array copy of this color. */ RIM_INLINE const T* toArray() const { return &r; } /// Get the red component of this color. RIM_INLINE T getRed() const { return r; } /// Get the green component of this color. RIM_INLINE T getGreen() const { return g; } /// Get the blue component of this color. RIM_INLINE T getBlue() const { return b; } /// Get the W component of this color. RIM_INLINE T getAlpha() const { return a; } /// Get a 3D color containing the red, green and blue elements of this 4D color. RIM_INLINE Color3D<T> getRGB() const { return Color3D<T>( r, g, b ); } /// Set the red component of the color to the specified value. RIM_INLINE void setRed( T newRed ) { r = newRed; } /// Set the green component of the color to the specified value. RIM_INLINE void setGreen( T newGreen ) { g = newGreen; } /// Set the blue component of the color to the specified value. RIM_INLINE void setBlue( T newBlue ) { b = newBlue; } /// Set the W component of the color to the specified value. RIM_INLINE void setAlpha( T newAlpha ) { a = newAlpha; } /// Set the R, G, blue, and W components of the color to the specified values. /** * This method takes 4 parameter representing the 4 components of this * color and sets this color's components to have those values. * * @param newRed - The new red component of the color. * @param newGreen - The new green component of the color. * @param newBlue - The new blue component of the color. * @param newAlpha - The new alpha component of the color. */ RIM_INLINE void set( T newRed, T newGreen, T newBlue, T newAlpha ) { r = newRed; g = newGreen; b = newBlue; a = newAlpha; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Casting Operators /// This operator casts this color to another with different template paramter. /** * This method provides an operator for the casting of this * color to another color with a potentially different template * paramter. * * @return the cast version of this color. */ template < typename U > RIM_INLINE operator Color4D<U>() { return Color4D<U>( (U)r, (U)g, (U)b, (U)a ); } /// This operator casts this color to another with different template paramter. /** * This method provides an operator for the casting of this * color to another color with a potentially different template * paramter. This is the const version of this operator. * * @return the cast version of this color. */ template < typename U > RIM_INLINE operator Color4D<U>() const { return Color4D<U>( (U)r, (U)g, (U)b, (U)a ); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Comparison Operators /// Compare two colors component-wise for equality RIM_INLINE bool operator == ( const Color4D<T>& v ) const { return r == v.r && g == v.g && b == v.b && a == v.a; } /// Compare two colors component-wise for inequality RIM_INLINE bool operator != ( const Color4D<T>& v ) const { return r != v.r || g != v.g || b != v.b || a != v.a; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Arithmatic Operators /// Add this color to another and return the result. /** * This method adds another color to this one, component-wise, * and returns this addition. It does not modify either of the original * colors. * * @param color - The color to add to this one. * @return The addition of this color and the parameter. */ RIM_INLINE Color4D<T> operator + ( const Color4D<T>& color ) const { return Color4D<T>( r + color.r, g + color.g, b + color.b, a + color.a ); } /// Add a value to every component of this color. /** * This method adds the value parameter to every component * of the color, and returns a color representing this result. * It does not modifiy the original color. * * @param value - The value to add to all components of this color. * @return The resulting color of this addition. */ RIM_INLINE Color4D<T> operator + ( const T& value ) const { return Color4D<T>( r + value, g + value, b + value, a + value ); } /// Subtract a color from this color component-wise and return the result. /** * This method subtracts another color from this one, component-wise, * and returns this subtraction. It does not modify either of the original * colors. * * @param color - The color to subtract from this one. * @return The subtraction of the the parameter from this color. */ RIM_INLINE Color4D<T> operator - ( const Color4D<T>& color ) const { return Color4D<T>( r - color.r, g - color.g, b - color.b, a - color.a ); } /// Subtract a value from every component of this color. /** * This method subtracts the value parameter from every component * of the color, and returns a color representing this result. * It does not modifiy the original color. * * @param value - The value to subtract from all components of this color. * @return The resulting color of this subtraction. */ RIM_INLINE Color4D<T> operator - ( const T& value ) const { return Color4D<T>( r - value, g - value, b - value, a - value ); } /// Multiply component-wise this color and another color. /** * This operator multiplies each component of this color * by the corresponding component of the other color and * returns a color representing this result. It does not modify * either original color. * * @param color - The color to multiply this color by. * @return The result of the multiplication. */ RIM_INLINE Color4D<T> operator * ( const Color4D<T>& color ) const { return Color4D<T>( r*color.r, g*color.g, b*color.b, a*color.a ); } /// Multiply every component of this color by a value and return the result. /** * This method multiplies the value parameter with every component * of the color, and returns a color representing this result. * It does not modifiy the original color. * * @param value - The value to multiplly with all components of this color. * @return The resulting color of this multiplication. */ RIM_INLINE Color4D<T> operator * ( const T& value ) const { return Color4D<T>( r*value, g*value, b*value, a*value ); } /// Divide every component of this color by a value and return the result. /** * This method Divides every component of the color by the value parameter, * and returns a color representing this result. * It does not modifiy the original color. * * @param value - The value to divide all components of this color by. * @return The resulting color of this division. */ RIM_INLINE Color4D<T> operator / ( const T& value ) const { T inverseValue = T(1) / value; return Color4D<T>( r*inverseValue, g*inverseValue, b*inverseValue, a*inverseValue ); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Arithmatic Assignment Operators with Colors /// Add a color to this color, modifying this original color. /** * This method adds another color to this color, component-wise, * and sets this color to have the result of this addition. * * @param color - The color to add to this color. * @return A reference to this modified color. */ RIM_INLINE Color4D<T>& operator += ( const Color4D<T>& color ) { r += color.r; g += color.g; b += color.b; a += color.a; return *this; } /// Subtract a color from this color, modifying this original color. /** * This method subtracts another color from this color, component-wise, * and sets this color to have the result of this subtraction. * * @param color - The color to subtract from this color. * @return A reference to this modified color. */ RIM_INLINE Color4D<T>& operator -= ( const Color4D<T>& color ) { r -= color.r; g -= color.g; b -= color.b; a -= color.a; return *this; } /// Multiply component-wise this color and another color and modify this color. /** * This operator multiplies each component of this color * by the corresponding component of the other color and * modifies this color to contain the result. * * @param color - The color to multiply this color by. * @return A reference to this modified color. */ RIM_INLINE Color4D<T>& operator *= ( const Color4D<T>& color ) { r *= color.r; g *= color.g; b *= color.b; a *= color.a; return *this; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Arithmatic Assignment Operators with Values /// Add a value to each component of this color, modifying it. /** * This operator adds a value to each component of this color * and modifies this color to store the result. * * @param value - The value to add to every component of this color. * @return A reference to this modified color. */ RIM_INLINE Color4D<T>& operator += ( const T& value ) { r += value; g += value; b += value; a += value; return *this; } /// Subtract a value from each component of this color, modifying it. /** * This operator subtracts a value from each component of this color * and modifies this color to store the result. * * @param value - The value to subtract from every component of this color. * @return A reference to this modified color. */ RIM_INLINE Color4D<T>& operator -= ( const T& value ) { r -= value; g -= value; b -= value; a -= value; return *this; } /// Multiply a value with each component of this color, modifying it. /** * This operator multiplies a value with each component of this color * and modifies this color to store the result. * * @param value - The value to multiply with every component of this color. * @return A reference to this modified color. */ RIM_INLINE Color4D<T>& operator *= ( const T& value ) { r *= value; g *= value; b *= value; a *= value; return *this; } /// Divide each component of this color by a value, modifying it. /** * This operator Divides each component of this color by value * and modifies this color to store the result. * * @param value - The value to multiply with every component of this color. * @return A reference to this modified color. */ RIM_INLINE Color4D<T>& operator /= ( const T& value ) { T inverseValue = T(1) / value; r *= inverseValue; g *= inverseValue; b *= inverseValue; a *= inverseValue; return *this; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** String Conversion Methods /// Convert this color into a human-readable string representation. RIM_NO_INLINE data::String toString() const { data::StringBuffer buffer; buffer << "( " << r << ", " << g << ", " << b << ", " << a << " )"; return buffer.toString(); } /// Convert this color into a human-readable string representation. RIM_FORCE_INLINE operator data::String () const { return this->toString(); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Public Data Members /// The red component of a 3D color. T r; /// The green component of a 3D color. T g; /// The blue component of a 3D color. T b; /// The W component of a 3D color. T a; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Public Static Data Members /// A constant color with all elements equal to zero. static const Color4D<T> ZERO; /// A constant color with R, G, and B equal to zero, and A equal to 1. static const Color4D<T> BLACK; /// A constant color with all elements equal to one. static const Color4D<T> WHITE; }; template <typename T> const Color4D<T> Color4D<T>:: ZERO( T(0), T(0), T(0), T(0) ); template <typename T> const Color4D<T> Color4D<T>:: BLACK( T(0), T(0), T(0), T(1) ); template <typename T> const Color4D<T> Color4D<T>:: WHITE( T(1), T(1), T(1), T(1) ); //########################################################################################## //########################################################################################## //############ //############ Commutative Arithmatic Operators //############ //########################################################################################## //########################################################################################## /// Add a value to every component of the color. /** * This operator adds the value parameter to every component * of the color, and returns a color representing this result. * It does not modifiy the original color. * * @param value - The value to add to all components of the color. * @param color - The color to be added to. * @return The resulting color of this addition. */ template < typename T > RIM_INLINE Color4D<T> operator + ( const T& value, const Color4D<T>& color ) { return Color4D<T>( color.r + value, color.g + value, color.b + value, color.a + value ); } /// Subtract every component of the color from the value, returning a color result. /** * This operator subtracts every component of the 2nd paramter, a color, * from the 1st paramter, a value, and then returns a color containing the * resulting coloral components. This operator does not modify the orignal color. * * @param value - The value to subtract all components of the color from. * @param color - The color to be subtracted. * @return The resulting color of this subtraction. */ template < typename T > RIM_INLINE Color4D<T> operator - ( const T& value, const Color4D<T>& color ) { return Color4D<T>( value - color.r, value - color.g, value - color.b, value - color.a ); } /// Multiply every component of the color with the value, returning a color result. /** * This operator multiplies every component of the 2nd paramter, a color, * from the 1st paramter, a value, and then returns a color containing the * resulting coloral components. This operator does not modify the orignal color. * * @param value - The value to multiply with all components of the color. * @param color - The color to be multiplied with. * @return The resulting color of this multiplication. */ template < typename T > RIM_INLINE Color4D<T> operator * ( const T& value, const Color4D<T>& color ) { return Color4D<T>( color.r*value, color.g*value, color.b*value, color.a*value ); } /// Divide a value by every component of the color, returning a color result. /** * This operator divides the provided value by every component of * the color, returning a color representing the component-wise division. * The operator does not modify the original color. * * @param value - The value to be divided by all components of the color. * @param color - The color to be divided by. * @return The resulting color of this division. */ template < typename T > RIM_INLINE Color4D<T> operator / ( const T& value, const Color4D<T>& color ) { return Color4D<T>( value/color.r, value/color.g, value/color.b, value/color.a ); } typedef Color4D<Int> Color4i; typedef Color4D<UByte> Color4b; typedef Color4D<Float> Color4f; typedef Color4D<Double> Color4d; //########################################################################################## //**************************** End Rim Images Namespace ********************************** RIM_IMAGES_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_IMAGES_COLOR_4D_H <file_sep>/* * rimTransform2D.h * Rim Math * * Created by <NAME> on 1/24/08. * Copyright 2008 Rim Software. All rights reserved. * */ #ifndef INCLUDE_RIM_TRANSFORM_2D_H #define INCLUDE_RIM_TRANSFORM_2D_H #include "rimMathConfig.h" #include "rimVector2D.h" #include "rimMatrix2D.h" #include "rimMatrix3D.h" #include "rimRay2D.h" #include "rimPlane2D.h" //########################################################################################## //***************************** Start Rim Math Namespace ********************************* RIM_MATH_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class which represents a 2-dimensional transformation. /** * The transformation is composed of translation, rotation, and scaling. * The components are assumed to be in the following order: translation, rotation, * and scaling. Thus, when transforming a point from world to object space by the * transformation, translation is first applied, followed by scaling, and finally * rotation. The reverse holds true for transformations from object to world space. */ template < typename T > class Transform2D { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructors /// Create an identity transformation that doesn't modify transformed points. RIM_FORCE_INLINE Transform2D() : position( Vector2D<T>::ZERO ), orientation( Matrix2D<T>::IDENTITY ), scale( 1 ) { } /// Create a transformation with the specified translation and no rotation or scaling. RIM_FORCE_INLINE Transform2D( const Vector2D<T>& newPosition ) : position( newPosition ), orientation( Matrix2D<T>::IDENTITY ), scale( 1 ) { } /// Create a transformation with the specified translation, rotation, and no scaling. RIM_FORCE_INLINE Transform2D( const Vector2D<T>& newPosition, const Matrix2D<T>& newOrientation ) : position( newPosition ), orientation( newOrientation ), scale( 1 ) { } /// Create a transformation with the specified translation, rotation, and uniform scaling. RIM_FORCE_INLINE Transform2D( const Vector2D<T>& newPosition, const Matrix2D<T>& newOrientation, T newScale ) : position( newPosition ), orientation( newOrientation ), scale( newScale ) { } /// Create a transformation with the specified translation, rotation, and uniform scaling. RIM_FORCE_INLINE Transform2D( const Vector2D<T>& newPosition, const Matrix2D<T>& newOrientation, const Vector2D<T>& newScale ) : position( newPosition ), orientation( newOrientation ), scale( newScale ) { } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Object Space Transforms /// Transform the specified scalar value to object space. /** * This will perform any scaling necessary to satisfy the transformation. */ RIM_FORCE_INLINE Vector2D<T> transformToObjectSpace( T original ) const { return original/scale; } /// Transform the specified position vector to object space. RIM_FORCE_INLINE Vector2D<T> transformToObjectSpace( const Vector2D<T>& original ) const { return ((original - position)*orientation)/scale; } /// Transform the specified matrix to object space. /** * This returns what the specified matrix would be in this transformation's * coordinate frame. This method does not perform any scaling on the input * matrix. The input matrix is assumed to be an orthonormal rotation matrix. */ RIM_FORCE_INLINE Matrix2D<T> transformToObjectSpace( const Matrix2D<T>& original ) const { return original*orientation; } /// Rotate the specified vector to object space. /** * This method does not perform any translation or scaling on the * input point. This function is ideal for transforming directional * quantities like surface normal vectors. */ RIM_FORCE_INLINE Vector2D<T> rotateToObjectSpace( const Vector2D<T>& original ) const { return original*orientation; } /// Scale a vector to object space. RIM_FORCE_INLINE Vector2D<T> scaleToObjectSpace( const Vector2D<T>& original ) const { return original*orientation; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** World Space Transforms /// Transform the specified scalar value to world space. /** * This will perform any scaling necessary to satisfy the transformation. */ RIM_FORCE_INLINE Vector2D<T> transformToWorldSpace( T original ) const { return original*scale; } /// Transform the specified position vector to world space. RIM_FORCE_INLINE Vector2D<T> transformToWorldSpace( const Vector2D<T>& original ) const { return position + (orientation*original)*scale; } /// Transform the specified matrix to world space. /** * This returns what the specified matrix would be in this transformation's * coordinate frame. This method does not perform any scaling on the input * matrix. The input matrix is assumed to be an orthonormal rotation matrix. */ RIM_FORCE_INLINE Matrix2D<T> transformToWorldSpace( const Matrix2D<T>& original ) const { return orientation*original; } /// Rotate the specified vector to world space. /** * This method does not perform any translation or scaling on the * input point. This function is ideal for transforming directional * quantities like surface normal vectors. */ RIM_FORCE_INLINE Vector2D<T> rotateToWorldSpace( const Vector2D<T>& original ) const { return orientation*original; } /// Scale a vector to world space. RIM_FORCE_INLINE Vector2D<T> scaleToWorldSpace( const Vector2D<T>& original ) const { return original*scale; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Transform Multiplication Operators /// Scale the specified value to world space with this transformation. RIM_FORCE_INLINE T operator * ( T value ) const { return this->transformToWorldSpace( value ); } /// Transform the specified vector to world space with this transformation. RIM_FORCE_INLINE Vector2D<T> operator * ( const Vector2D<T>& vector ) const { return this->transformToWorldSpace( vector ); } /// Transform the specified matrix to world space with this transformation. RIM_FORCE_INLINE Matrix2D<T> operator * ( const Matrix2D<T>& matrix ) const { return this->transformToWorldSpace( matrix ); } /// Transform the specified ray to world space with this transformation. RIM_FORCE_INLINE Ray2D<T> operator * ( const Ray2D<T>& ray ) const { return this->transformToWorldSpace( ray ); } /// Transform the specified plane to world space with this transformation. RIM_FORCE_INLINE Plane2D<T> operator * ( const Plane2D<T>& plane ) const { return this->transformToWorldSpace( plane ); } /// Concatenate this transformation with another and return the combined transformation. /** * This transformation represents the total transformation from object space of the * other, into this transformation's object space, and then to world space. */ RIM_FORCE_INLINE Transform2D<T> operator * ( const Transform2D<T>& other ) const { return Transform2D<T>( this->transformToWorldSpace( other.position ), this->transformToWorldSpace( other.orientation ), scale*this->rotateToWorldSpace( other.scale ) ); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Transform Inversion Method /// Return the inverse of this transformations that applys the opposite transformation. RIM_FORCE_INLINE Transform2D<T> invert() const { Vector2D<T> inverseScale = T(1)/scale; return Transform2D<T>( (position*(-inverseScale))*orientation, orientation.transpose(), inverseScale ); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Matrix Conversion Methods /// Convert this transformation into a 3x3 homogeneous-coordinate matrix. RIM_FORCE_INLINE Matrix3D<T> toMatrix() const { return Matrix3D<T>( scale.x*orientation.x.x, scale.y*orientation.y.x, position.x, scale.x*orientation.x.y, scale.y*orientation.y.y, position.y, T(0), T(0), T(1) ); } /// Convert the inverse of this transformation into a 3x3 homogeneous-coordinate matrix. RIM_FORCE_INLINE Matrix3D<T> toMatrixInverse() const { Vector2D<T> inverseScale = T(1)/scale; T zx = -(position.x*orientation.x.x + position.y*orientation.x.y); T zy = -(position.x*orientation.y.x + position.y*orientation.y.y); return Matrix3D<T>( inverseScale.x*orientation.x.x, inverseScale.x*orientation.x.y, zx, inverseScale.y*orientation.y.x, inverseScale.y*orientation.y.y, zy, T(0), T(0), T(1) ); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Public Data Members /// The translation component of the rigid transformation. Vector2D<T> position; /// The rotation component of the rigid transformation. Matrix2D<T> orientation; /// The scaling component of the rigid transformation. Vector2D<T> scale; }; //########################################################################################## //########################################################################################## //############ //############ Inverse Transform Multiplication Operators //############ //########################################################################################## //########################################################################################## /// Scale the specified scalar value to object space with the inverse of the specified transformation. template < typename T > RIM_FORCE_INLINE T operator * ( T value, const Transform2D<T>& transform ) { return transform.transformToWorldSpace( value ); } /// Transform the specified vector to object space with the inverse of the specified transformation. template < typename T > RIM_FORCE_INLINE Vector2D<T> operator * ( const Vector2D<T>& vector, const Transform2D<T>& transform ) { return transform.transformToObjectSpace( vector ); } /// Transform the specified matrix to object space with the inverse of the specified transformation. template < typename T > RIM_FORCE_INLINE Matrix2D<T> operator * ( const Matrix2D<T>& matrix, const Transform2D<T>& transform ) { return transform.transformToObjectSpace( matrix ); } /// Transform the specified ray to object space with the inverse of the specified transformation. template < typename T > RIM_FORCE_INLINE Ray2D<T> operator * ( const Ray2D<T>& ray, const Transform2D<T>& transform ) { return transform.transformToObjectSpace( ray ); } /// Transform the specified plane to object space with the inverse of the specified transformation. template < typename T > RIM_FORCE_INLINE Plane2D<T> operator * ( const Plane2D<T>& plane, const Transform2D<T>& transform ) { return transform.transformToObjectSpace( plane ); } //########################################################################################## //########################################################################################## //############ //############ 2D Transform Type Definitions //############ //########################################################################################## //########################################################################################## typedef Transform2D<int> Transform2i; typedef Transform2D<float> Transform2f; typedef Transform2D<double> Transform2d; //########################################################################################## //***************************** End Rim Math Namespace *********************************** RIM_MATH_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_TRANSFORM_2D_H <file_sep>/* * rimPhysicsCollisionDetectorOctree.h * Rim Physics * * Created by <NAME> on 10/7/12. * Copyright 2012 __MyCompanyName__. All rights reserved. * */ #ifndef INCLUDE_RIM_PHYSICS_COLLISION_DETECTOR_OCTREE_H #define INCLUDE_RIM_PHYSICS_COLLISION_DETECTOR_OCTREE_H #include "rimPhysicsCollisionConfig.h" #include "rimPhysicsCollisionDetector.h" //########################################################################################## //********************** Start Rim Physics Collision Namespace *************************** RIM_PHYSICS_COLLISION_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// An implementation of the CollisionDetector interface that uses a dynamic octree to detect collisions. class CollisionDetectorOctree : public CollisionDetector { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructor /// Create an octree-based collision detector which contains no objects. CollisionDetectorOctree(); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Collision Detection Methods /// Detect rigid-vs-rigid collisions that occurr over a timestep and add them to the result set. /** * This implementation of this method uses an O(n*log(n)) dynamic octree-based * algorithm to detect potentially colliding pairs of objects. */ virtual void testForCollisions( Real dt, CollisionResultSet<RigidObject,RigidObject>& resultSet ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Rigid Object Accessor Methods /// Add the specified rigid object to this octree collision detector. /** * If the specified rigid object pointer is NULL, the * collision detector is unchanged. */ virtual void addRigidObject( const RigidObject* rigidObject ); /// Remove the specified rigid object from this octree collision detector. /** * If this detector contains the specified rigid object, the * object is removed from the collision detector and TRUE is returned. * Otherwise, if the rigid object is not found, FALSE is returned * and the collision detector is unchanged. */ virtual Bool removeRigidObject( const RigidObject* rigidObject ); /// Remove all rigid objects from this octree collision detector. virtual void removeRigidObjects(); /// Return whether or not the specified rigid object is contained in this octree collision detector. /** * If this octree collision detector contains the specified rigid object, TRUE is returned. * Otherwise, if the rigid object is not found, FALSE is returned. */ virtual Bool containsRigidObject( const RigidObject* rigidObject ) const; /// Return the number of rigid objects that are contained in this octree collision detector. virtual Size getRigidObjectCount() const; private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Class Declarations /// A class which contains information for a single node of an octree. class Node; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Members /// A list of pointers to rigid objects that are being tested for collisions. ArrayList<const RigidObject*> rigidObjects; }; //########################################################################################## //********************** End Rim Physics Collision Namespace ***************************** RIM_PHYSICS_COLLISION_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_PHYSICS_COLLISION_DETECTOR_OCTREE_H <file_sep>/* * rimQuaternion.h * Rim Software * * Created by <NAME> on 1/24/14. * Copyright 2014 __MyCompanyName__. All rights reserved. * */ #ifndef INCLUDE_RIM_QUATERNION_H #define INCLUDE_RIM_QUATERNION_H #include "rimMathConfig.h" //########################################################################################## //***************************** Start Rim Math Namespace ********************************* RIM_MATH_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A templatized math class representing a 4-dimensional quaternion. template < typename T > class Quaternion { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructors /// Create a new quaternion corresponding to no rotation about the X axis. RIM_FORCE_INLINE Quaternion() : a( T(1) ), b( T(0) ), c( T(0) ), d( T(0) ) { } /// Create a new quaternion by specifying it's 4 component values. RIM_FORCE_INLINE Quaternion( T newA, T newB, T newC, T newD ) : a( newA ), b( newB ), c( newC ), d( newD ) { } /// Create a new quaternion from a pointer to a 4 element array specifying its components. RIM_FORCE_INLINE Quaternion( const T* array ) : a( array[0] ), b( array[1] ), c( array[2] ), d( array[3] ) { } /// Create a new quaternion from a 3x3 orthonormal rotation matrix. RIM_FORCE_INLINE Quaternion( const Matrix3D<T>& m ) { // Algorithm in Ken Shoemake's article in 1987 SIGGRAPH course notes // article "Quaternion Calculus and Fast Animation". T fTrace = m.x.x + m.y.y + m.z.z; if ( fTrace > T(0) ) { // |w| > 1/2, may as well choose w > 1/2 T fRoot = math::sqrt(fTrace + 1.0f); // 2w a = 0.5f*fRoot; fRoot = 0.5f/fRoot; // 1/(4w) b = (m.y.z - m.z.y)*fRoot; c = (m.z.x - m.x.z)*fRoot; d = (m.x.y - m.y.x)*fRoot; } else { // |w| <= 1/2 Index nextIndex[3] = { 1, 2, 0 }; Index i = 0; if ( m.y.y > m.x.x ) i = 1; if ( m.z.z > m[i][i] ) i = 2; Index j = nextIndex[i]; Index k = nextIndex[j]; T fRoot = math::sqrt( m[i][i] - m[j][j] - m[k][k] + T(1) ); T* apkQuat[3] = { &b, &c, &d }; *apkQuat[i] = T(0.5)*fRoot; fRoot = T(0.5)/fRoot; a = (m[j][k] - m[k][j])*fRoot; *apkQuat[j] = (m[i][j] + m[j][i])*fRoot; *apkQuat[k] = (m[i][k] + m[k][i])*fRoot; } } /// Create a new quaternion from an existing quaternion with different template type. /** * This constructor takes the x, y, z, and w values of the * quaternion parameter and sets the coordinates of this quaternion * to be the same. This is a templatized version of the copy constructor. * * @param quaternion - The quaternion to be copied. */ template < typename U > RIM_FORCE_INLINE Quaternion<T>( const Quaternion<U>& quaternion ) : a( (T)quaternion.a ), b( (T)quaternion.b ), c( (T)quaternion.c ), d( (T)quaternion.d ) { } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Magnitude Methods /// Return the magnitude (norm) of this quaternion. RIM_FORCE_INLINE T getMagnitude() const { return math::sqrt( a*a + b*b + c*c + d*d ); } /// Return the magnitude (norm) of this quaternion. RIM_FORCE_INLINE T getNorm() const { return this->getMagnitude(); } /// Return the squared magnitude (norm) of this quaternion. RIM_FORCE_INLINE T getMagnitudeSquared() const { return a*a + b*b + c*c + d*d; } /// Return a normalized version of this quaternion. /** * This method normalizes this quaternion by dividing * each component by the quaternion's magnitude and * returning the result. This method does not modify * the original quaternion. * * @return a normalized version of this quaternion. */ RIM_FORCE_INLINE Quaternion<T> normalize() const { T inverseMagnitude = T(1)/this->getMagnitude(); return Quaternion<T>( a*inverseMagnitude, b*inverseMagnitude, c*inverseMagnitude, d*inverseMagnitude ); } /// Return a normalized version of this quaternion, placing the quaternion's magnitude in the output parameter. /** * This method normalizes this quaternion by dividing * each component by the quaternion's magnitude and * returning the result. This method does not modify * the original quaternion. The magnitude of the original quaternion is * returned in the output parameter. * * @return a normalized version of this quaternion. */ RIM_FORCE_INLINE Quaternion<T> normalize( T& magnitude ) const { magnitude = this->getMagnitude(); T inverseMagnitude = T(1)/magnitude; return Quaternion<T>( a*inverseMagnitude, b*inverseMagnitude, c*inverseMagnitude, d*inverseMagnitude ); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Inversion Methods /// Return the inverse of this quaternion. /** * This method makes no assumptions about the quaternion's magnitude. * If inverting a unit-length quaternion, use invertNormalized() instead * because it is significantly fast. */ RIM_FORCE_INLINE Quaternion<T> invert() const { T magnitudeSquared = this->getMagnitudeSquared(); T inverseMagnitudeSquared = T(1)/magnitudeSquared; return Quaternion( a*inverseMagnitudeSquared, -b*inverseMagnitudeSquared, -c*inverseMagnitudeSquared, -d*inverseMagnitudeSquared ); } /// Return the inverse of this normalized quaternion. /** * This method assumes that the quaternion is of unit length. This * greatly simplifies the calculations needed to invert the quaternion. */ RIM_FORCE_INLINE Quaternion<T> invertNormalized() const { return Quaternion( a, -b, -c, -d ); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Matrix Conversion Methods /// Return the inverse of this quaternion. /** * This method makes no assumptions about the quaternion's magnitude. * If converting a unit-length quaternion, use toMatrixNormalized() instead * because it is significantly faster. */ RIM_FORCE_INLINE Matrix3D<T> toMatrix() const { T aa = a*a; T bb = b*b; T cc = c*c; T dd = d*d; T ab = a*b; T ac = a*c; T ad = a*d; T bc = b*c; T bd = b*d; T cd = c*d; return Matrix3D<T>( aa + bb - cc - dd, T(2)*(bc - ad), T(2)*(bd + ac), T(2)*(bc + ad), aa - bb + cc - dd, T(2)*(cd - ab), T(2)*(bd - ac), T(2)*(cd + ab), aa - bb - cc + dd ); } /// Return the inverse of this normalized quaternion. /** * This method assumes that the quaternion is of unit length. This * greatly simplifies the calculations needed to convert the quaternion * to a matrix. */ RIM_FORCE_INLINE Matrix3D<T> toMatrixNormalized() const { T temp_b = b + b; T temp_c = c + c; T temp_d = d + d; T temp_ab = temp_b*a; T temp_ac = temp_c*a; T temp_ad = temp_d*a; T temp_bb = temp_b*b; T temp_bc = temp_c*b; T temp_bd = temp_d*b; T temp_cc = temp_c*c; T temp_cd = temp_d*c; T temp_dd = temp_d*d; return Matrix3D<T>( T(1) - (temp_cc + temp_dd), temp_bc - temp_ad, temp_bd + temp_ac, temp_bc + temp_ad, T(1) - (temp_bb + temp_dd), temp_cd - temp_ab, temp_bd - temp_ac, temp_cd + temp_ab, T(1) - (temp_bb + temp_cc) ); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Element Accessor Methods /// Get a shallow array representation of this quaternion. /** * This method returns a pointer to the address of the X coordinate * of the quaternion and does not do any copying of the elements. * Therefore, this method should only be used where one needs * an array representation of a quaternion without having to * allocate more memory and copy the quaternion. * * @return A pointer to a shallow array copy of this quaternion. */ RIM_FORCE_INLINE const T* toArray() const { return &a; } /// Return the A coordinate of this quaternion. RIM_FORCE_INLINE T getA() const { return a; } /// Return the B coordinate of this quaternion. RIM_FORCE_INLINE T getB() const { return b; } /// Return the C coordinate of this quaternion. RIM_FORCE_INLINE T getC() const { return c; } /// Return the D coordinate of this quaternion. RIM_FORCE_INLINE T getD() const { return d; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Comparison Operators /// Compare two quaternions component-wise for equality RIM_FORCE_INLINE Bool operator == ( const Quaternion<T>& q ) const { return a == q.a && b == q.b && c == q.c && d == q.d; } /// Compare two quaternions component-wise for inequality RIM_FORCE_INLINE Bool operator != ( const Quaternion<T>& q ) const { return a != q.a || b != q.b || c != q.c || d != q.d; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Arithmetic Operators /// Add this quaternion to another and return the result. /** * This method adds another quaternion to this one, component-wise, * and returns this addition. It does not modify either of the original * quaternions. * * @param quaternion - The quaternion to add to this one. * @return The addition of this quaternion and the parameter. */ RIM_FORCE_INLINE Quaternion<T> operator + ( const Quaternion<T>& quaternion ) const { return Quaternion<T>( a + quaternion.a, b + quaternion.b, c + quaternion.c, d + quaternion.d ); } /// Subtract a quaternion from this quaternion component-wise and return the result. /** * This method subtracts another quaternion from this one, component-wise, * and returns this subtraction. It does not modify either of the original * quaternions. * * @param quaternion - The quaternion to subtract from this one. * @return The subtraction of the the parameter from this quaternion. */ RIM_FORCE_INLINE Quaternion<T> operator - ( const Quaternion<T>& quaternion ) const { return Quaternion<T>( a - quaternion.a, b - quaternion.b, c - quaternion.c, d - quaternion.d ); } /// Multiply this quaternion and another quaternion. /** * This operation, like matrix multiplication, is not commutative. */ RIM_FORCE_INLINE Quaternion<T> operator * ( const Quaternion<T>& q ) const { return Quaternion<T>( a*q.a - b*q.b - c*q.c - d*q.d, a*q.b + b*q.a + c*q.d - d*q.c, a*q.c - b*q.d + c*q.a + d*q.b, a*q.d + b*q.c - c*q.b + d*q.a ); } /// Multiply every component of this quaternion by a value and return the result. /** * This method multiplies the value parameter with every component * of the quaternion, and returns a quaternion representing this result. * It does not modifiy the original quaternion. * * @param value - The value to multiplly with all components of this quaternion. * @return The resulting quaternion of this multiplication. */ RIM_FORCE_INLINE Quaternion<T> operator * ( const T& value ) const { return Quaternion<T>( a*value, b*value, c*value, d*value ); } /// Divide every component of this quaternion by a value and return the result. /** * This method divides every component of the quaternion by the value parameter, * and returns a quaternion representing this result. * It does not modifiy the original quaternion. * * @param value - The value to divide all components of this quaternion by. * @return The resulting quaternion of this division. */ RIM_FORCE_INLINE Quaternion<T> operator / ( const T& value ) const { T inverseValue = T(1) / value; return Quaternion<T>( a*inverseValue, b*inverseValue, c*inverseValue, d*inverseValue ); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Arithmatic Assignment Operators with Vectors /// Add a quaternion to this quaternion, modifying this original quaternion. /** * This method adds another quaternion to this quaternion, component-wise, * and sets this quaternion to have the result of this addition. * * @param quaternion - The quaternion to add to this quaternion. * @return A reference to this modified quaternion. */ RIM_FORCE_INLINE Quaternion<T>& operator += ( const Quaternion<T>& quaternion ) { a += quaternion.a; b += quaternion.b; c += quaternion.c; d += quaternion.d; return *this; } /// Subtract a quaternion from this quaternion, modifying this original quaternion. /** * This method subtracts another quaternion from this quaternion, component-wise, * and sets this quaternion to have the result of this subtraction. * * @param quaternion - The quaternion to subtract from this quaternion. * @return A reference to this modified quaternion. */ RIM_FORCE_INLINE Quaternion<T>& operator -= ( const Quaternion<T>& quaternion ) { a -= quaternion.a; b -= quaternion.b; c -= quaternion.c; d -= quaternion.d; return *this; } /// Multiply component-wise this quaternion and another quaternion and modify this quaternion. /** * This operator multiplies each component of this quaternion * by the corresponding component of the other quaternion and * modifies this quaternion to contain the result. * * @param quaternion - The quaternion to multiply this quaternion by. * @return A reference to this modified quaternion. */ RIM_FORCE_INLINE Quaternion<T>& operator *= ( const Quaternion<T>& q ) { T tempA = a*q.a - b*q.b - c*q.c - d*q.d; T tempB = a*q.b + b*q.a + c*q.d - d*q.c; T tempC = a*q.c - b*q.d + c*q.a + d*q.b; T tempD = a*q.d + b*q.c - c*q.b + d*q.a; a = tempA; b = tempB; c = tempC; d = tempD; return *this; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Arithmatic Assignment Operators with Values /// Multiply a value with each component of this quaternion, modifying it. /** * This operator multiplies a value with each component of this quaternion * and modifies this quaternion to store the result. * * @param value - The value to multiply with every component of this quaternion. * @return A reference to this modified quaternion. */ RIM_FORCE_INLINE Quaternion<T>& operator *= ( const T& value ) { a *= value; b *= value; c *= value; d *= value; return *this; } /// Divide each component of this quaternion by a value, modifying it. /** * This operator Divides each component of this quaternion by value * and modifies this quaternion to store the result. * * @param value - The value to multiply with every component of this quaternion. * @return A reference to this modified quaternion. */ RIM_FORCE_INLINE Quaternion<T>& operator /= ( const T& value ) { T inverseValue = T(1) / value; a *= inverseValue; b *= inverseValue; c *= inverseValue; d *= inverseValue; return *this; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** String Conversion Methods /// Convert this quaternion into a human-readable string representation. RIM_NO_INLINE data::String toString() const { data::StringBuffer buffer; buffer << "( " << a << ", " << b << ", " << c << ", " << d << " )"; return buffer.toString(); } /// Convert this quaternion into a human-readable string representation. RIM_FORCE_INLINE operator data::String () const { return this->toString(); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Public Data Members union { struct { /// The A coordinate of a quaternion. T a; /// The B coordinate of a quaternion. T b; /// The C coordinate of a quaternion. T c; /// The D coordinate of a quaternion. T d; }; /* struct { /// The W coordinate of a quaternion. T w; /// The X coordinate of a quaternion. T x; /// The Y coordinate of a quaternion. T y; /// The Z coordinate of a quaternion. T z; };*/ }; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Public Static Data Members /// A constant quaternion with all elements equal to zero static const Quaternion<T> ZERO; /// A constant quaternion representing no rotation. static const Quaternion<T> IDENTITY; }; template <typename T> const Quaternion<T> Quaternion<T>:: ZERO( 0, 0, 0, 0 ); template <typename T> const Quaternion<T> Quaternion<T>:: IDENTITY( 1, 0, 0, 0 ); //########################################################################################## //########################################################################################## //############ //############ Commutative Arithmatic Operators //############ //########################################################################################## //########################################################################################## /// Multiply every component of the quaternion with the value, returning a quaternion result. /** * This operator multiplies every component of the 2nd paramter, a quaternion, * from the 1st paramter, a value, and then returns a quaternion containing the * resulting quaternional components. This operator does not modify the orignal quaternion. * * @param value - The value to multiply with all components of the quaternion. * @param quaternion - The quaternion to be multiplied with. * @return The resulting quaternion of this multiplication. */ template < typename T > RIM_FORCE_INLINE Quaternion<T> operator * ( const T& value, const Quaternion<T>& quaternion ) { return Quaternion<T>( quaternion.x*value, quaternion.y*value, quaternion.z*value, quaternion.w*value ); } //########################################################################################## //########################################################################################## //############ //############ Other Vector Functions //############ //########################################################################################## //########################################################################################## /// Compute and return the dot product of two quaternions. /** * This method adds all components of the component-wise multiplication * of the two quaternions together and returns the scalar result. It does * not modify either of the original quaternions. If the dot product is * zero, then the two quaternions are perpendicular. * * @param quaternion1 - The first quaternion of the dot product. * @param quaternion2 - The second quaternion of the dot product. * @return The dot product of the two quaternion parameters. */ template < typename T > RIM_FORCE_INLINE T dot( const Quaternion<T>& q1, const Quaternion<T>& q2 ) { return q1.a*q2.a + q1.b*q2.b + q1.c*q2.c + q1.d*q2.d; } //########################################################################################## //***************************** End Rim Math Namespace *********************************** RIM_MATH_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_QUATERNION_H <file_sep>/* * rimGraphicsGUIFontInfo.h * Rim Graphics GUI * * Created by <NAME> on 1/15/13. * Copyright 2013 Headspace Systems. All rights reserved. * */ #ifndef INCLUDE_RIM_GRAPHICS_GUI_FONT_INFO_H #define INCLUDE_RIM_GRAPHICS_GUI_FONT_INFO_H #include "rimGraphicsGUIFontsConfig.h" //########################################################################################## //********************* Start Rim Graphics GUI Fonts Namespace *************************** RIM_GRAPHICS_GUI_FONTS_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class which describes information about an installed font file. class FontInfo { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructor /// Create a default font information object which doesn't represent a valid font. RIM_INLINE FontInfo() { } /// Create a new font information object with the specified path to a font file. RIM_INLINE FontInfo( const UTF8String& newFontPath ) : fontPath( newFontPath ) { } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Font Path Accessor Methods /// Return a string representing the path to the font that is being described. RIM_INLINE const UTF8String& getPathString() const { return fontPath; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Font Family Name Accessor Methods /// Return a string which represents a human-readable name for the font family that is being described. RIM_INLINE const UTF8String& getFamilyName() const { return fontFamilyName; } /// Set a string which represents a human-readable name for the font family that is being described. RIM_INLINE void setFamilyName( const UTF8String& newFamilyName ) { fontFamilyName = newFamilyName; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Font Style Name Accessor Methods /// Return a string which represents a human-readable name for the font style that is being described. RIM_INLINE const UTF8String& getStyleName() const { return fontStyleName; } /// Set a string which represents a human-readable name for the font style that is being described. RIM_INLINE void setStyleName( const UTF8String& newStyleName ) { fontStyleName = newStyleName; } private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Members /// A string representing the path to the font file that is being described by this font info. UTF8String fontPath; /// A string representing the name of the font family described by this font info. UTF8String fontFamilyName; /// A string representing the name of the font style described by this font info. UTF8String fontStyleName; }; //########################################################################################## //********************* End Rim Graphics GUI Fonts Namespace ***************************** RIM_GRAPHICS_GUI_FONTS_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_GRAPHICS_GUI_FONT_INFO_H <file_sep>/* * rimGraphicsShapeAssetTranscoder.h * Rim Software * * Created by <NAME> on 6/14/14. * Copyright 2014 __MyCompanyName__. All rights reserved. * */ #ifndef INCLUDE_RIM_GRAPHICS_SHAPE_ASSET_TRANSCODER_H #define INCLUDE_RIM_GRAPHICS_SHAPE_ASSET_TRANSCODER_H #include "rimGraphicsAssetsConfig.h" #include "rimGraphicsMaterialAssetTranscoder.h" #include "rimGraphicsMeshGroupAssetTranscoder.h" //########################################################################################## //*********************** Start Rim Graphics Assets Namespace **************************** RIM_GRAPHICS_ASSETS_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class which encodes and decodes graphics shapes to the asset format. class GraphicsShapeAssetTranscoder : public AssetTypeTranscoder<GraphicsShape> { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Destructor //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Text Encoding/Decoding Methods /// Decode an object from the specified string stream, returning a pointer to the final object. virtual Pointer<GraphicsShape> decodeText( const AssetType& assetType, const AssetObject& assetObject, ResourceManager* resourceManager = NULL ); /// Encode an object of this asset type into a text-based format. virtual Bool encodeText( UTF8StringBuffer& buffer, ResourceManager* resourceManager, const GraphicsShape& data ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Public Static Data Members /// An object indicating the asset type for a GenericSphereShape shape. static const AssetType SPHERE_SHAPE_ASSET_TYPE; /// An object indicating the asset type for a GenericCylinderShape shape. static const AssetType CYLINDER_SHAPE_ASSET_TYPE; /// An object indicating the asset type for a GenericCapsuleShape shape. static const AssetType CAPSULE_SHAPE_ASSET_TYPE; /// An object indicating the asset type for a GenericBoxShape shape. static const AssetType BOX_SHAPE_ASSET_TYPE; /// An object indicating the asset type for a GenericMeshShape shape. static const AssetType MESH_SHAPE_ASSET_TYPE; private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Type Declarations /// An enum describing the fields that a graphics shape can have. typedef enum Field { /// An undefined field. UNDEFINED = 0, //******************************************************************** // Common Shape Fields /// "name" The name of this graphics shape. NAME, /// "position" The 3D position of the shape in its parent coordinate space. POSITION, /// "orientation" The 3D orientation of the shape in its parent coordinate space. ORIENTATION, /// "scale" The scale of the shape in its parent coordinate space. SCALE, //******************************************************************** // Sphere Shape Fields /// "radius" The radius of the sphere in its local coordinate frame. RADIUS, //******************************************************************** // Cylinder and Capsule Shape Fields /// "endpoint1" The position of the center of the first end cap of a cylinder or capsule. ENDPOINT_1, /// "endpoint2" The position of the center of the second end cap of a cylinder or capsule. ENDPOINT_2, /// "radius1" The radius of the first end cap of a cylinder or capsule. RADIUS_1, /// "radius2" The radius of the first end cap of a cylinder or capsule. RADIUS_2, //******************************************************************** // Box Shape Fields /// "size" The XYZ dimensions of this box. SIZE, //******************************************************************** // Mesh Shape Fields /// "groups" The material mesh groups for the mesh. GROUPS }; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Helper Methods /// Decode the given asset object as if it was a generic sphere shape. Pointer<GenericSphereShape> decodeTextSphere( const AssetObject& assetObject, ResourceManager* resourceManager ); /// Decode the given asset object as if it was a generic cylinder shape. Pointer<GenericCylinderShape> decodeTextCylinder( const AssetObject& assetObject, ResourceManager* resourceManager ); /// Decode the given asset object as if it was a generic capsule shape. Pointer<GenericCapsuleShape> decodeTextCapsule( const AssetObject& assetObject, ResourceManager* resourceManager ); /// Decode the given asset object as if it was an generic box shape. Pointer<GenericBoxShape> decodeTextBox( const AssetObject& assetObject, ResourceManager* resourceManager ); /// Decode the given asset object as if it was an generic mesh shape. Pointer<GenericMeshShape> decodeTextMesh( const AssetObject& assetObject, ResourceManager* resourceManager ); /// Decode the common shape field, returning if the field is a common field. Bool decodeCommonField( Field field, const AssetObject::String& fieldValue, GraphicsShape& shape ); /// Return an enum value indicating the field indicated by the given field name. static Field getFieldType( const AssetObject::String& name ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Members /// An object that handles encoding/decoding mesh groups. GraphicsMeshGroupAssetTranscoder meshGroupTranscoder; /// An object that handles encoding/decoding materials. GraphicsMaterialAssetTranscoder materialTranscoder; /// A temporary asset object used when parsing shape child objects. AssetObject tempObject; }; //########################################################################################## //*********************** End Rim Graphics Assets Namespace ****************************** RIM_GRAPHICS_ASSETS_NAMESPACE_END //****************************************************************************************** //########################################################################################## //########################################################################################## //**************************** Start Rim Assets Namespace ******************************** RIM_ASSETS_NAMESPACE_START //****************************************************************************************** //########################################################################################## template <> RIM_INLINE const AssetType& AssetType::of<rim::graphics::shapes::GenericSphereShape>() { return rim::graphics::assets::GraphicsShapeAssetTranscoder::SPHERE_SHAPE_ASSET_TYPE; } template <> RIM_INLINE const AssetType& AssetType::of<rim::graphics::shapes::GenericCylinderShape>() { return rim::graphics::assets::GraphicsShapeAssetTranscoder::CYLINDER_SHAPE_ASSET_TYPE; } template <> RIM_INLINE const AssetType& AssetType::of<rim::graphics::shapes::GenericCapsuleShape>() { return rim::graphics::assets::GraphicsShapeAssetTranscoder::CAPSULE_SHAPE_ASSET_TYPE; } template <> RIM_INLINE const AssetType& AssetType::of<rim::graphics::shapes::GenericBoxShape>() { return rim::graphics::assets::GraphicsShapeAssetTranscoder::BOX_SHAPE_ASSET_TYPE; } template <> RIM_INLINE const AssetType& AssetType::of<rim::graphics::shapes::GenericMeshShape>() { return rim::graphics::assets::GraphicsShapeAssetTranscoder::MESH_SHAPE_ASSET_TYPE; } //########################################################################################## //**************************** End Rim Assets Namespace ********************************** RIM_ASSETS_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_GRAPHICS_SHAPE_ASSET_TRANSCODER_H <file_sep>/* * rimGraphicsGUITextField.h * Rim Graphics GUI * * Created by <NAME> on 1/29/13. * Copyright 2013 Headspace Systems. All rights reserved. * */ #ifndef INCLUDE_RIM_GRAPHICS_GUI_TEXT_FIELD_H #define INCLUDE_RIM_GRAPHICS_GUI_TEXT_FIELD_H #include "rimGraphicsGUIBase.h" #include "rimGraphicsGUIObject.h" #include "rimGraphicsGUIFonts.h" //########################################################################################## //************************ Start Rim Graphics GUI Namespace ****************************** RIM_GRAPHICS_GUI_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class which represents a simple multi-line text area with a single text style. class TextField : public GUIObject { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructors /// Create a new text field with no text content and positioned at the origin of its coordinate system. TextField(); /// Create a new text field which occupies the specified rectangular region with no text contents. TextField( const Rectangle& newRectangle ); /// Create a new text field which places the specified text content within the given rectangle. TextField( const Rectangle& newRectangle, const UTF8String& newText ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Text Accessor Methods /// Return a reference to a string representing the text contents of this text view. RIM_INLINE const UTF8String& getText() const { return text; } /// Set a string representing the text contents of this text view. RIM_INLINE void setText( const UTF8String& newText ) { text = newText; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Text Alignment Accessor Methods /// Return an object which describes how this text field's text is aligned. RIM_INLINE const Origin& getTextAlignment() const { return textAlignment; } /// Set an object which describes how this text field's text is aligned. RIM_INLINE void setTextAlignment( const Origin& newTextAlignment ) { textAlignment = newTextAlignment; } /// Set an object which describes how this text field's text is aligned. RIM_INLINE void setTextAlignment( Origin::XOrigin newXOrigin, Origin::YOrigin newYOrigin ) { textAlignment = Origin( newXOrigin, newYOrigin ); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Text Wrap Accessor Methods /// Return whether or not this text field's text wraps within its display area. RIM_INLINE Bool getTextIsWrapped() const { return textIsWrapped; } /// Set whether or not this text field's text wraps within its display area. RIM_INLINE void setTextIsWrapped( Bool newTextIsWrapped ) { textIsWrapped = newTextIsWrapped; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Margin Accessor Methods /// Return an object which describes the size of this text field's margins. /** * The margin describes the padding distance between the text field's frame and the * box where text is drawn. */ RIM_INLINE const Margin& getMargin() const { return margin; } /// Set an object which describes the size of this text field's margins. /** * The margin describes the padding distance between the text field's frame and the * box where text is drawn. */ RIM_INLINE void setMargin( const Margin& newMargin ) { margin = newMargin; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Border Accessor Methods /// Return a mutable object which describes this text field's border. RIM_INLINE Border& getBorder() { return border; } /// Return an object which describes this text field's border. RIM_INLINE const Border& getBorder() const { return border; } /// Set an object which describes this text field's border. RIM_INLINE void setBorder( const Border& newBorder ) { border = newBorder; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Content Bounding Box Accessor Methods /// Return the 3D bounding box for the text field's text display area in its local coordinate frame. RIM_INLINE AABB3f getLocalContentBounds() const { return AABB3f( this->getLocalContentBoundsXY(), AABB1f( Float(0), this->getSize().z ) ); } /// Return the 2D bounding box for the text field's text display area in its local coordinate frame. RIM_INLINE AABB2f getLocalContentBoundsXY() const { return border.getContentBounds( AABB2f( Vector2f(), this->getSizeXY() ) ); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Background Color Accessor Methods /// Return the background color for this text field's text area. RIM_INLINE const Color4f& getBackgroundColor() const { return backgroundColor; } /// Set the background color for this text field's text area. RIM_INLINE void setBackgroundColor( const Color4f& newBackgroundColor ) { backgroundColor = newBackgroundColor; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Border Color Accessor Methods /// Return the border color for a text field. RIM_INLINE const Color4f& getBorderColor() const { return borderColor; } /// Set the border color for a text field. RIM_INLINE void setBorderColor( const Color4f& newBorderColor ) { borderColor = newBorderColor; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Text Style Accessor Methods /// Return a reference to the font style which is used to render the text for a text field. RIM_INLINE const fonts::FontStyle& getTextStyle() const { return textStyle; } /// Set the font style which is used to render the text for a text field. RIM_INLINE void setTextStyle( const fonts::FontStyle& newTextStyle ) { textStyle = newTextStyle; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Input Handling Methods /// Handle the specified keyboard event that occured when this object had focus. virtual void keyEvent( const KeyboardEvent& event ); /// Handle the specified mouse motion event that occurred. virtual void mouseMotionEvent( const MouseMotionEvent& event ); /// Handle the specified mouse button event that occurred. virtual void mouseButtonEvent( const MouseButtonEvent& event ); /// Handle the specified mouse wheel event that occurred. virtual void mouseWheelEvent( const MouseWheelEvent& event ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Drawing Method /// Draw this object using the specified GUI renderer to the given parent coordinate system bounds. /** * The method returns whether or not the object was successfully drawn. * * The default implementation draws nothing and returns TRUE. */ virtual Bool drawSelf( GUIRenderer& renderer, const AABB3f& parentBounds ) const; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Static Construction Methods /// Construct a smart-pointer-wrapped instance of this class using the constructor with the given arguments. RIM_INLINE static Pointer<TextField> construct() { return Pointer<TextField>( rim::util::construct<TextField>() ); } /// Construct a smart-pointer-wrapped instance of this class using the constructor with the given arguments. RIM_INLINE static Pointer<TextField> construct( const Rectangle& newRectangle ) { return Pointer<TextField>( rim::util::construct<TextField>( newRectangle ) ); } /// Construct a smart-pointer-wrapped instance of this class using the constructor with the given arguments. RIM_INLINE static Pointer<TextField> construct( const Rectangle& newRectangle, const UTF8String& newText ) { return Pointer<TextField>( rim::util::construct<TextField>( newRectangle, newText ) ); } private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Members /// A string representing the text contents of this text field. UTF8String text; /// An object which describes how this text field's text is aligned. Origin textAlignment; /// An object which describes the width of the 4-sided margins of this text field. Margin margin; /// An object which describes the border of this text field. Border border; /// The code point index within the text field's text where the current cursor is located. Index currentCursorIndex; /// The background color for the text field's text area. Color4f backgroundColor; /// The border color for the text field's text area. Color4f borderColor; /// An object which determines the style of the text contained by this text field. fonts::FontStyle textStyle; /// A boolean value indicating whether or not this text field's text wraps within its display area. Bool textIsWrapped; /// A boolean value which indicates whether or not this text field's text is able to be edited. Bool isEditable; /// A boolean value which indicates whether or not this text field's text is able to be selected. Bool isSelectable; }; //########################################################################################## //************************ End Rim Graphics GUI Namespace ******************************** RIM_GRAPHICS_GUI_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_GRAPHICS_GUI_TEXT_FIELD_H <file_sep>#pragma once /** * This class represents the state of the vehicle and includes fields for * position, <code>Orientation</code>, and velocity. * <p> * The <code>VehicleState</code> is only a data holder and values within it are * public and may be accessed and changed by anyone with a reference. If a safe * copy needs to be shared be sure to provide a deep copy instead of simply * passing the reference. * </p> * * Author: <NAME> * */ #include "Orientation.h" #include "AngularVelocity.h" #include "rim/rimEngine.h" using namespace rim; using namespace rim::math; class VehicleState { /** * A <code>Vector3f</code> object containing the position of the object. * <ul> * <li>The global x coordinate is stored in <code>x</code>.</li> * <li>The global y coordinate is stored in <code>y</code>.</li> * <li>The global z coordinate is stored in <code>z</code>.</li> * </ul> */ public: Vector3f position; /** * An <code>Orientation</code> object containing the roll, pitch, and yaw of * the object. * * <p> * The roll, pitch, and yaw are accessed with their respective getters and * are in radians. * </p> */ //Orientation orientation; Vector3f orientation; /** * A <code>Vector3f</code> object containing the velocity of the object. * <ul> * <li>The global x velocity is stored in <code>x</code>.</li> * <li>The global y velocity is stored in <code>y</code>.</li> * <li>The global z velocity is stored in <code>z</code>.</li> * </ul> */ Vector3f velocity; /** * Blank constructor which constructs a new <code>VehicleState</code> object * having position (0,0,0), orientation (0,0,0), and velocity, (0,0,0). */ VehicleState() { position = Vector3f(); orientation = Vector3f();//Orientation(); velocity = Vector3f(); } /** * Constructor for building a new <code>VehicleState</code> object with the * passed position, orientation, and velocity. * * @param position * A <code>Vector3f</code> object containing the position of the * object. * @param orientation * An <code>Orientation</code> object containing the roll, pitch, * and yaw of the object. * @param velocity * A <code>Vector3f</code> object containing the velocity of the * object. */ VehicleState(Vector3f pos, Vector3f ori, Vector3f vel) { position = pos; orientation = ori; velocity = vel; } /** * This function produces a safe deep copy of the <code>VehicleState</code> * object passed. * * @param state * The <code>VehicleState</code> object to be copied. * @return A new <code>VehicleState</code> object identical to the passed * object. */ static VehicleState deepCopy(VehicleState state) { Vector3f pos = Vector3f(state.position.x, state.position.y, state.position.z); Vector3f ori = Vector3f(state.orientation.x, state.orientation.y, state.orientation.z); //Orientation ori = Orientation(state.orientation); Vector3f vel = Vector3f(state.velocity.x, state.velocity.y, state.velocity.z); return VehicleState(pos, ori, vel); } }; <file_sep>/* * rimGUIWindowElement.h * Rim GUI * * Created by <NAME> on 9/23/12. * Copyright 2012 __MyCompanyName__. All rights reserved. * */ #ifndef INCLUDE_RIM_GUI_WINDOW_ELEMENT_H #define INCLUDE_RIM_GUI_WINDOW_ELEMENT_H #include "rimGUIConfig.h" #include "rimGUIElement.h" //########################################################################################## //*************************** Start Rim GUI Namespace ****************************** RIM_GUI_NAMESPACE_START //****************************************************************************************** //########################################################################################## class Window; //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class which represents a rectangular region that is part of a window. class WindowElement : public GUIElement { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Size Accessor Methods /// Return the horizontal size in pixels of this window element. RIM_INLINE Size getWidth() const { return this->getSize().x; } /// Return the vertical size in pixels of this window element. RIM_INLINE Size getHeight() const { return this->getSize().y; } /// Return a 2D vector indicating the size on the screen of this window element in pixels. virtual Size2D getSize() const = 0; /// Set the size on the screen of this window element in pixels. /** * The method returns whether or not the size change operation was * successful. */ RIM_INLINE Bool setSize( Size newWidth, Size newHeight ) { return this->setSize( Size2D( newWidth, newHeight ) ); } /// Set the size on the screen of this window element in pixels. /** * The method returns whether or not the size change operation was * successful. */ virtual Bool setSize( const Size2D& size ) = 0; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Position Accessor Methods /// Return the 2D position of this view in pixels, relative to the bottom left corner of the view. /** * The coordinate position is defined relative to its enclosing coordinate frame * where the origin will be the bottom left corner of the enclosing view or window. */ virtual Vector2i getPosition() const = 0; /// Set the 2D position of this view in pixels, relative to the bottom left corner of the view. /** * The coordinate position is defined relative to its enclosing coordinate frame * where the origin will be the bottom left corner of the enclosing view or window. * * If the position change operation is successful, TRUE is returned and the view is * moved. Otherwise, FALSE is returned and the view is not moved. */ virtual Bool setPosition( const Vector2i& position ) = 0; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Parent Window Accessor Methods /// Return the window which is a parent of this window element. /** * If NULL is returned, it indicates that the window element is not part of a window. */ virtual Window* getParentWindow() const = 0; /// Return whether or not this window element belongs to a window. RIM_INLINE Bool hasParentWindow() const { return this->getParentWindow() != NULL; } protected: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Friend Declarations /// Declare the Window class as a friend so that it can make itself a parent of a window element privately. friend class Window; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Parent Accessor Methods /// Set the window which is going to be a parent of this window. /** * Setting this value to NULL should indicate that the window element is no longer * part of a window. */ virtual void setParentWindow( Window* parentWindow ) = 0; }; //########################################################################################## //*************************** End Rim GUI Namespace ******************************** RIM_GUI_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_GUI_WINDOW_ELEMENT_H <file_sep>/* * rimGraphicsShaders.h * Rim Graphics * * Created by <NAME> on 11/28/11. * Copyright 2011 __MyCompanyName__. All rights reserved. * */ #ifndef INCLUDE_RIM_GRAPHICS_SHADERS_H #define INCLUDE_RIM_GRAPHICS_SHADERS_H #include "shaders/rimGraphicsShadersConfig.h" #include "shaders/rimGraphicsShaderLanguage.h" #include "shaders/rimGraphicsShaderLanguageVersion.h" #include "shaders/rimGraphicsShader.h" #include "shaders/rimGraphicsShaderProgram.h" #include "shaders/rimGraphicsConstantVariable.h" #include "shaders/rimGraphicsTextureVariable.h" #include "shaders/rimGraphicsVertexVariable.h" #include "shaders/rimGraphicsConstantBinding.h" #include "shaders/rimGraphicsTextureBinding.h" #include "shaders/rimGraphicsVertexBinding.h" #include "shaders/rimGraphicsShaderParameterFlags.h" #include "shaders/rimGraphicsShaderParameterUsage.h" #include "shaders/rimGraphicsShaderParameterInfo.h" #include "shaders/rimGraphicsShaderParameterValue.h" #include "shaders/rimGraphicsShaderParameter.h" #include "shaders/rimGraphicsShaderConfiguration.h" #include "shaders/rimGraphicsShaderPassSource.h" #include "shaders/rimGraphicsGenericShaderPass.h" #include "shaders/rimGraphicsShaderPassUsage.h" #include "shaders/rimGraphicsShaderPassLibrary.h" #include "shaders/rimGraphicsShaderPass.h" #include "shaders/rimGraphicsShaderBindingData.h" #include "shaders/rimGraphicsConstantBuffer.h" #endif // INCLUDE_RIM_GRAPHICS_SHADERS_H <file_sep>/* * rimGUIDisplayMode.h * Rim GUI * * Created by <NAME> on 9/3/12. * Copyright 2012 __MyCompanyName__. All rights reserved. * */ #ifndef INCLUDE_RIM_GUI_DISPLAY_MODE_H #define INCLUDE_RIM_GUI_DISPLAY_MODE_H #include "rimGUISystemConfig.h" //########################################################################################## //************************ Start Rim GUI System Namespace ************************** RIM_GUI_SYSTEM_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class which encapsulates a single possible configuration for a system video display. /** * A display mode configuration contains information related to a particular * mode of operation for a physical video display. This information includes the * size of the display in pixels (width and height), the refresh rate, and the * pixel type (color depth) for the display. */ class DisplayMode { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructors /// Create a default display mode with (0,0) size and 0 refresh rate. RIM_INLINE DisplayMode() : size( 0, 0 ), refreshRate( 0 ), bitsPerPixel( 0 ) { } /// Create a new display mode object with the specified size, refresh rate, and bits per pixel. RIM_INLINE DisplayMode( const Size2D& newSize, Double newRefreshRate, Size newBitsPerPixel ) : size( newSize ), refreshRate( newRefreshRate ), bitsPerPixel( newBitsPerPixel ) { } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Size Accessor Methods /// Return the horizontal size of this display mode in pixels. RIM_INLINE Size getWidth() const { return size.x; } /// Return the vertical size of this display mode in pixels. RIM_INLINE Size getHeight() const { return size.y; } /// Return a 2D vector representing the horizontal and vertical size of this display mode in pixels. RIM_INLINE Size2D getSize() const { return size; } /// Set the horizontal size of this display mode in pixels. RIM_INLINE void setWidth( Size width ) { size.x = width; } /// Set the vertical size of this display mode in pixels. RIM_INLINE void setHeight( Size height ) { size.y = height; } /// Set the horizontal and vertical size of this display mode in pixels. RIM_INLINE void setSize( Size width, Size height ) { size.x = width; size.y = height; } /// Set the horizontal and vertical size of this display mode in pixels. RIM_INLINE void setSize( const Size2D& newSize ) { size = newSize; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Refresh Rate Accessor Methods /// Return the refresh rate of this display mode in cycles per second (hertz). RIM_INLINE Double getRefreshRate() const { return refreshRate; } /// Set the refresh rate of this display mode in cycles per second (hertz). /** * The new refresh rate is clamped to the range of [0,+infinity]. */ RIM_INLINE void setRefreshRate( Double newRefreshRate ) { refreshRate = math::max( newRefreshRate, Double(0) ); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Bits Per Pixel Accessor Methods /// Return the number of bits used to represent each pixel of this display mode. RIM_INLINE Size getBitsPerPixel() const { return bitsPerPixel; } /// Set the number of bits used to represent each pixel of this display mode. RIM_INLINE void setBitsPerPixel( Size newBitsPerPixel ) { bitsPerPixel = newBitsPerPixel; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Comparison Operators /// Return whether or not this display mode is equivalent to another. RIM_INLINE Bool operator == ( const DisplayMode& other ) const { return size == other.size && refreshRate == other.refreshRate && bitsPerPixel == other.bitsPerPixel; } /// Return whether or not this display mode is not equivalent to another. RIM_INLINE Bool operator != ( const DisplayMode& other ) const { return !(*this == other); } private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Members /// The horizontal and vertical size of this display mode in pixels. Size2D size; /// The vertical refresh rate of this display mode in hertz. Double refreshRate; /// The number of bits per pixel of this display mode. Size bitsPerPixel; }; //########################################################################################## //************************ End Rim GUI System Namespace **************************** RIM_GUI_SYSTEM_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_GUI_DISPLAY_MODE_H <file_sep>/* * rimSoundExpander.h * Rim Sound * * Created by <NAME> on 8/8/12. * Copyright 2012 __MyCompanyName__. All rights reserved. * */ #ifndef INCLUDE_RIM_SOUND_EXPANDER_H #define INCLUDE_RIM_SOUND_EXPANDER_H #include "rimSoundFiltersConfig.h" #include "rimSoundFilter.h" //########################################################################################## //************************ Start Rim Sound Filters Namespace ***************************** RIM_SOUND_FILTERS_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class which reduces the level of sound which is below a certain threshold. /** * This expander class uses peak sensing to determine an envelope level at * each sample. If the envelope is below a user-defined * threshold, the expander applies gain reduction to the sound at the expander's * logarithmic compression ratio. The expander also has a variable-hardness * knee which allows the user to smooth the transition from gain reduction to no * gain reduction. * * This expander can also be used as a true noise gate by setting the ratio to be equal * to positive infinity. */ class Expander : public SoundFilter { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructors /// Create a new expander with the default compression parameters. /** * These are - threshold: -6dB, ratio: 2:1, knee: 0dB, attack: 2ms, * hold: 100ms, release: 300ms, with unlinked channels. */ Expander(); /// Create a new expander with specified threshold, ratio, attack, hold, and release. /** * This expander uses peak-sensing detection and has unlinked * channels. The expander has the default knee of 0dB. All gain and threshold * values are specified on a linear scale. The attack, hold, and release times * are specified in seconds. */ Expander( Gain threshold, Float ratio, Float attack, Float hold, Float release ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Threshold Accessor Methods /// Return the linear full-scale value below which the expander applies gain reduction. RIM_INLINE Gain getThreshold() const { return targetThreshold; } /// Return the logarithmic full-scale value below which the expander applies gain reduction. RIM_INLINE Gain getThresholdDB() const { return util::linearToDB( targetThreshold ); } /// Set the linear full-scale value below which the expander applies gain reduction. /** * The value is clamped to the valid range of [0,infinity] before being stored. */ RIM_INLINE void setThreshold( Gain newThreshold ) { lockMutex(); targetThreshold = math::max( newThreshold, Gain(0) ); unlockMutex(); } /// Set the logarithmic full-scale value below which the expander applies gain reduction. RIM_INLINE void setThresholdDB( Gain newThresholdDB ) { lockMutex(); targetThreshold = util::dbToLinear( newThresholdDB ); unlockMutex(); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Ratio Accessor Methods /// Return the downward expansion ratio that the expander is using. /** * This value is expressed as a ratio of input to output gain below * the compression threshold, expressed in decibels. For instance, a * ratio of 2 indicates that for ever 1 decibels that the signal is below * the threshold, the output signal will be attenuated by 2 dB. * Thus, higher ratios indicate more extreme expansion. A ratio of +infinity * is equivalent to a hard noise gate. */ RIM_INLINE Float getRatio() const { return targetRatio; } /// Set the downward expansion ratio that the expander is using. /** * This value is expressed as a ratio of input to output gain below * the compression threshold, expressed in decibels. For instance, a * ratio of 2 indicates that for ever 1 decibels that the signal is below * the threshold, the output signal will be attenuated by 2 dB. * Thus, higher ratios indicate more extreme expansion. A ratio of +infinity * is equivalent to a hard noise gate. * * The new ratio is clamped to the range of [1,100]. */ RIM_INLINE void setRatio( Float newRatio ) { lockMutex(); targetRatio = math::clamp( newRatio, Float(1), Float(100) ); unlockMutex(); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Knee Accessor Methods /// Return the knee radius of this expander in decibels. /** * This is the amount above the expander's threshold at which the expander first * starts reducing level, as well as the amount below the expander's threshold where * the actual expander ratio starts to be used. A higher knee will result it an expander * that starts to apply gain reduction to envelopes that approach the threshold, resulting * in a smoother transition from no gain reduction to full gain reduction. */ RIM_INLINE Gain getKnee() const { return targetKnee; } /// Set the knee radius of this expander in decibels. /** * This is the amount above the expander's threshold at which the expander first * starts reducing level, as well as the amount below the expander's threshold where * the actual expander ratio starts to be used. A higher knee will result it an expander * that starts to apply gain reduction to envelopes that approach the threshold, resulting * in a smoother transition from no gain reduction to full gain reduction. * * The new knee value is clamped to the valid range of [0,+infinity]. */ RIM_INLINE void setKnee( Gain newKnee ) { lockMutex(); targetKnee = math::max( newKnee, Float(0) ); unlockMutex(); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Attack Accessor Methods /// Return the attack of this expander in seconds. /** * This value indicates the time in seconds that it takes for the expander's * detection envelope to respond to a sudden increase in signal level. Thus, * a very small attack softens transients more than a slower attack which * lets the transients through the expander. */ RIM_INLINE Float getAttack() const { return attack; } /// Set the attack of this expander in seconds. /** * This value indicates the time in seconds that it takes for the expander's * detection envelope to respond to a sudden increase in signal level. Thus, * a very small attack softens transients more than a slower attack which * lets the transients through the expander. * * The new attack value is clamped to the range of [0,+infinity]. */ RIM_INLINE void setAttack( Float newAttack ) { lockMutex(); attack = math::max( newAttack, Float(0) ); unlockMutex(); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Hold Accessor Methods /// Return the hold time of this expander in seconds. /** * This value indicates the time in seconds that it takes for the expander's * detection envelope to start responding to a sudden decrease in signal level. Thus, * the hold time is a window after an initial transient in which the expander's * envelope doesn't decrease, resulting in no further gain reduction until the * hold time is expired, at which time the envelope release begins. */ RIM_INLINE Float getHold() const { return hold; } /// Set the hold time of this expander in seconds. /** * This value indicates the time in seconds that it takes for the expander's * detection envelope to start responding to a sudden decrease in signal level. Thus, * the hold time is a window after an initial transient in which the expander's * envelope doesn't decrease, resulting in no further gain reduction until the * hold time is expired, at which time the envelope release begins. * * The new hold value is clamped to the range of [0,+infinity]. */ RIM_INLINE void setHold( Float newHold ) { lockMutex(); hold = math::max( newHold, Float(0) ); unlockMutex(); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Release Accessor Methods /// Return the release of this expander in seconds. /** * This value indicates the time in seconds that it takes for the expander's * detection envelope to respond to a sudden decrease in signal level. Thus, * a very short release doesn't compress the signal after a transient for as * long as a longer release. Beware, very short release times (< 5ms) can result * in audible distortion. */ RIM_INLINE Float getRelease() const { return release; } /// Set the release of this expander in seconds. /** * This value indicates the time in seconds that it takes for the expander's * detection envelope to respond to a sudden decrease in signal level. Thus, * a very short release doesn't compress the signal after a transient for as * long as a longer release. Beware, very short release times (< 5ms) can result * in audible distortion. * * The new release value is clamped to the valid range of [0,+infinity]. */ RIM_INLINE void setRelease( Float newRelease ) { lockMutex(); release = math::max( newRelease, Float(0) ); unlockMutex(); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Channel Link Status Accessor Methods /// Return whether or not all channels in the expander are linked together. /** * If the value is TRUE, all channels are reduced by the maximum * amount selected from all channel envelopes. This allows the expander * to maintain the stereo image of the audio when expanding hard-panned sounds. */ RIM_INLINE Bool getChannelsAreLinked() const { return linkChannels; } /// Set whether or not all channels in the expander are linked together. /** * If the value is TRUE, all channels are reduced by the maximum * amount selected from all channel envelopes. This allows the expander * to maintain the stereo image of the audio when expanding hard-panned sounds. */ RIM_INLINE void setChannelsAreLinked( Bool newChannelsAreLinked ) { lockMutex(); linkChannels = newChannelsAreLinked; unlockMutex(); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Gain Reduction Accessor Methods /// Return the current gain reduction of the expander in decibels. /** * This value can be used as a way for humans to visualize how much the * expander is reducing the signal at any given time. */ RIM_INLINE Gain getGainReductionDB() const { return currentReduction; } /// Return the current gain reduction of the expander on a linear scale. /** * This value can be used as a way for humans to visualize how much the * expander is reducing the signal at any given time. */ RIM_INLINE Gain getGainReduction() const { return util::dbToLinear( currentReduction ); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Transfer Function Accessor Methods /// Evaluate the transfer function of the expander for an envelope with the specified amplitude. Gain evaluateTransferFunction( Gain input ) const; /// Evaluate the transfer function of the expander for an envelope with the specified amplitude in decibels. RIM_INLINE Gain evaluateTransferFunctionDB( Gain input ) const { return util::linearToDB( this->evaluateTransferFunction( util::dbToLinear( input ) ) ); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Input and Output Accessor Methods /// Return a human-readable name of the expander input at the specified index. /** * The expander has 2 inputs: * - 0: the expander's main input, the source of the signal that is going to be expanded. * - 1: the expander's sidechain input, the main input is expanded using this input if provided. * * The main input's name is "Main Input", while the sidechain's name is "Sidechain". */ virtual UTF8String getInputName( Index inputIndex ) const; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Filter Attribute Accessor Methods /// Return a human-readable name for this expander. /** * The method returns the string "Expander". */ virtual UTF8String getName() const; /// Return the manufacturer name of this expander. /** * The method returns the string "Headspace Sound". */ virtual UTF8String getManufacturer() const; /// Return an object representing the version of this expander. virtual SoundFilterVersion getVersion() const; /// Return an object which describes the category of effect that this filter implements. /** * This method returns the value SoundFilterCategory::DYNAMICS. */ virtual SoundFilterCategory getCategory() const; /// Return whether or not this expander can process audio data in-place. /** * This method always returns TRUE, expanders can process audio data in-place. */ virtual Bool allowsInPlaceProcessing() const; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Filter Parameter Accessor Methods /// Return the total number of generic accessible parameters this filter has. virtual Size getParameterCount() const; /// Get information about the filter parameter at the specified index. virtual Bool getParameterInfo( Index parameterIndex, FilterParameterInfo& info ) const; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Public Static Property Objects /// A string indicating the human-readable name of this expander. static const UTF8String NAME; /// A string indicating the manufacturer name of this expander. static const UTF8String MANUFACTURER; /// An object indicating the version of this expander. static const SoundFilterVersion VERSION; private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Filter Parameter Value Accessor Methods /// Place the value of the parameter at the specified index in the output parameter. virtual Bool getParameterValue( Index parameterIndex, FilterParameter& value ) const; /// Attempt to set the parameter value at the specified index. virtual Bool setParameterValue( Index parameterIndex, const FilterParameter& value ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Stream Reset Method /// A method which is called whenever the filter's stream of audio is being reset. /** * This method allows the filter to reset all parameter interpolation * and processing to its initial state to avoid coloration from previous * audio or parameter values. */ virtual void resetStream(); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Filter Processing Methods /// Downward expand soft passages in the input frame sound and write the result to the output frame. virtual SoundFilterResult processFrame( const SoundFilterFrame& inputFrame, SoundFilterFrame& outputFrame, Size numSamples ); /// Do expansion processing on the input buffer and place the results in the output buffer. /** * This method assumes that none of the expansion parameters changed since the last frame * and thus we can save time by not having to interpolate the parameters. */ RIM_INLINE void expandNoChanges( const SoundBuffer& inputBuffer, SoundBuffer& outputBuffer, Size numSamples, Gain envelopeAttack, Gain envelopeRelease ); /// Do expansion processing on the input buffer and place the results in the output buffer. /** * This method allows any of the expansion parameters to change and automatically interpolates * them based on the given changes per sample. */ RIM_INLINE void expand( const SoundBuffer& inputBuffer, SoundBuffer& outputBuffer, Size numSamples, Gain envelopeAttack, Gain envelopeRelease, Gain thresholdChangePerSample, Gain kneeChangePerSample, Float ratioChangePerSample ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Members /// The threshold, given as a linear full-scale value, below which expansion starts to occur. Gain threshold; /// The target threshold, used to smooth changes in the threshold parameter. Gain targetThreshold; /// The ratio at which the expander applies gain reduction to signals below the threshold. Float ratio; /// The target ratio of the expander, used to smooth ratio parameter changes. Float targetRatio; /// The radius of the expander's knee in decibels. /** * This is the amount above the expander's threshold at which the expander first * starts reducing level, as well as the amount below the expander's threshold where * the actual expander ratio starts to be used. A higher knee will result it an expander * that starts to apply gain reduction to envelopes that approach the threshold, resulting * in a smoother transition from no gain reduction to full gain reduction. */ Gain knee; /// The target knee for this expander, used to smooth knee parameter changes. Gain targetKnee; /// The time in seconds that the expander envelope takes to respond to an increase in level. Float attack; /// The time in seconds after the hold time that the expander envelope takes to respond to a decrease in level. Float release; /// The time in seconds that it takes for the expander envelope to move into its release phase. Float hold; /// The amount of time in seconds that each envelope channel has been in the 'hold' phase. Array<Float> holdTime; /// An array of current envelope values for each of the channels that this expander is processing. Array<Float> envelope; /// The current gain reduction of the expander, expressed in decibels. Gain currentReduction; /// A boolean value indicating whether or not all channels processed should be linked. /** * This means that the same gain reduction amount is applied to all channels. The * expander finds the channel which needs the most gain reduction and uses * that gain reduction for all other channels. This feature allows the expander * to maintain the original stereo (or multichannel) balance between channels. */ Bool linkChannels; }; //########################################################################################## //************************ End Rim Sound Filters Namespace ******************************* RIM_SOUND_FILTERS_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_SOUND_EXPANDER_H <file_sep>/* * rimSIMDRay3D.h * Rim Framework * * Created by <NAME> on 7/12/12. * Copyright 2012 __MyCompanyName__. All rights reserved. * */ #ifndef INCLUDE_RIM_SIMD_RAY_3D_H #define INCLUDE_RIM_SIMD_RAY_3D_H #include "rimMathConfig.h" #include "rimRay3D.h" #include "rimSIMDVector3D.h" //########################################################################################## //***************************** Start Rim Math Namespace ********************************* RIM_MATH_NAMESPACE_START //****************************************************************************************** //########################################################################################## template < typename T, Size width > class SIMDRay3D; //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class which represents a set of 3D rays stored in a SIMD-compatible format. /** * This class is used to store and operate on a set of 3D rays * in a SIMD fashion. The rays are stored in a structure-of-arrays format * that accelerates SIMD operations. Each ray is specified by an origin * point and a direction vector. */ template < typename T > class RIM_ALIGN(16) SIMDRay3D<T,4> { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructors /// Create a SIMD ray with N copies of the specified ray for a SIMD width of N. RIM_FORCE_INLINE SIMDRay3D( const Ray3D<T>& ray ) : origin( ray.origin ), direction( ray.direction ) { } /// Create a SIMD ray with the 4 rays it contains equal to the specified rays. RIM_FORCE_INLINE SIMDRay3D( const Ray3D<T>& ray1, const Ray3D<T>& ray2, const Ray3D<T>& ray3, const Ray3D<T>& ray4 ) : origin( ray1.origin, ray2.origin, ray3.origin, ray4.origin ), direction( ray1.direction, ray2.direction, ray3.direction, ray4.direction ) { } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Required Alignment Accessor Methods /// Return the alignment required for objects of this type. /** * For most SIMD types this value will be 16 bytes. If there is * no alignment required, 0 is returned. */ RIM_FORCE_INLINE static Size getRequiredAlignment() { return 16; } /// Get the width of this vector (number of 3D vectors it has). RIM_FORCE_INLINE static Size getWidth() { return 4; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Public Data Members /// A SIMD 3D vector indicating the origin of the ray(s). SIMDVector3D<T,4> origin; /// A SIMD 3D vector indicating the direction of the ray(s). SIMDVector3D<T,4> direction; }; //########################################################################################## //***************************** End Rim Math Namespace *********************************** RIM_MATH_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_SIMD_RAY_3D_H <file_sep>/* * rimPhysicsObjectTrajectory.h * Rim Software * * Created by <NAME> on 7/1/14. * Copyright 2014 __MyCompanyName__. All rights reserved. * */ #ifndef INCLUDE_RIM_ENGINE_PHYSICS_OBJECT_TRAJECTORY_H #define INCLUDE_RIM_ENGINE_PHYSICS_OBJECT_TRAJECTORY_H #include "rimEngineConfig.h" #include "rimEngineTrajectory.h" //########################################################################################## //*************************** Start Rim Engine Namespace ********************************* RIM_ENGINE_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class that handles the automatic control of a physics RigidObject's transformation from an external source. class PhysicsObjectTrajectory { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructors /// An enumeration of the ways that a physics object can interact with a trajectory. typedef enum Usage { /// With this usage, the physics object and trajectory do not interact. NONE = 0, /// With this usage, the physics object uses the trajectory to set its transformation. READ, /// With this usage, the physics object writes its transformation to the trajectory. WRITE }; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructors /// Create a default physics objects trajectory that doesn't have an object or trajectory. PhysicsObjectTrajectory(); /// Create a trajectory with the specified object, trajectory, and usage enum. PhysicsObjectTrajectory( const Pointer<RigidObject>& newObject, const Pointer<Trajectory>& newTrajectory, Usage newUsage = READ ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Update Method /// Update the state of the physics object and trajectory based on the trajectory usage. /** * The method returns whether or not the update succeeded. */ Bool update(); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Object Accessor Methods /// Return a pointer to the physics object that is being influenced by this trajectory. RIM_INLINE const Pointer<RigidObject>& getObject() const { return object; } /// Set a pointer to the physics object that should be influenced by this trajectory. RIM_INLINE void setObject( const Pointer<RigidObject>& newObject ) { object = newObject; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Trajectory Accessor Methods /// Return a pointer to the trajectory that is being used to influence the physics object. RIM_INLINE const Pointer<Trajectory>& getTrajectory() const { return trajectory; } /// Set a pointer to the trajectory that should be used to influence the physics object. RIM_INLINE void setTrajectory( const Pointer<Trajectory>& newTrajectory ) { trajectory = newTrajectory; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Usage Accessor Methods /// Return an enum value that indicates the current usage pattern for this object trajectory. RIM_INLINE Usage getUsage() const { return usage; } /// Set an enum value that determines the usage pattern for this object trajectory. RIM_INLINE void setUsage( Usage newUsage ) { usage = newUsage; } private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Members /// A pointer to the object that is using the trajectory. Pointer<RigidObject> object; /// A pointer to the trajectory which the physics object is using. Pointer<Trajectory> trajectory; /// An enum value that determines how the trajectory and physics object interact. Usage usage; }; //########################################################################################## //*************************** End Rim Engine Namespace *********************************** RIM_ENGINE_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_ENGINE_PHYSICS_OBJECT_TRAJECTORY_H <file_sep>/* * rimGraphicsViewportLayout.h * Rim Software * * Created by <NAME> on 7/3/14. * Copyright 2014 __MyCompanyName__. All rights reserved. * */ #ifndef INCLUDE_RIM_GRAPHICS_VIEWPORT_LAYOUT_H #define INCLUDE_RIM_GRAPHICS_VIEWPORT_LAYOUT_H #include "rimGraphicsRenderersConfig.h" //########################################################################################## //********************** Start Rim Graphics Renderers Namespace ************************** RIM_GRAPHICS_RENDERERS_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class that defines the viewports on the screen where camera views should be drawn. /** * The cameras are drawn to the screen in the order they are specified in the layout. */ class ViewportLayout { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Camera View Class Declaration /// A class that encapsulates a single camera viewport that should be drawn to the screen. class CameraView { public: /// Create a new camera view for the specified camera, scene, and viewport. RIM_INLINE CameraView( const Pointer<Camera>& newCamera, const Pointer<GraphicsScene>& newScene, const Viewport& newViewport ) : camera( newCamera ), scene( newScene ), viewport( newViewport ), clearColor( 0.0, 0.0, 0.0, 0.0 ), clearDepth( 1 ) { } /// A pointer to the camera whose view is to be drawn. Pointer<Camera> camera; /// A pointer to the scene which should be drawn for this camera's view. Pointer<GraphicsScene> scene; /// The viewport on the screen where the camera's view should be drawn. Viewport viewport; /// The color that the framebuffer is cleared to before the camera view is drawn. Color4d clearColor; /// The depth that the framebuffer is cleared to before the camera view is drawn. Double clearDepth; }; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructors /// Create a new viewport layout with no camera views. ViewportLayout(); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Camera View Accessor Methods /// Return the number of camera views that this viewport layout has. RIM_INLINE Size getCameraViewCount() const { return cameraViews.getSize(); } /// Return a reference to the camera view at the specified index in this viewport layout. RIM_INLINE CameraView& getCameraView( Index viewIndex ) { return cameraViews[viewIndex]; } /// Return a const reference to the camera view at the specified index in this viewport layout. RIM_INLINE const CameraView& getCameraView( Index viewIndex ) const { return cameraViews[viewIndex]; } /// Add a new camera view to this viewport layout that is rendered after the previously added camera views. /** * The method returns whether or not the camera view was successfully added. */ Bool addCameraView( const CameraView& newCameraView ); /// Insert a new camera view to this viewport layout that is rendered at the specified index. /** * The method returns whether or not the camera view was successfully added. */ Bool insertCameraView( Index viewIndex, const CameraView& newCameraView ); /// Remove the camera view at the specified index in this viewport layout. /** * The method returns whether or not the camera view was successfully removed. */ Bool removeCameraView( Index viewIndex ); /// Remove the specified camera's viewport(s) from this viewport layout. /** * The method returns whether or not any camera viewport was successfully removed. */ Bool removeCameraView( const Camera* camera ); /// Remove all camera views from this viewport layout. void clearCameraViews(); public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Members /// A list of the camera views that are rendered in order. ArrayList<CameraView> cameraViews; }; //########################################################################################## //********************** End Rim Graphics Renderers Namespace **************************** RIM_GRAPHICS_RENDERERS_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_GRAPHICS_VIEWPORT_LAYOUT_H <file_sep>/* * rimXMLNode.h * Rim XML * * Created by <NAME> on 9/18/13. * Copyright 2013 __MyCompanyName__. All rights reserved. * */ #ifndef INCLUDE_RIM_XML_NODE_H #define INCLUDE_RIM_XML_NODE_H #include "rimXMLConfig.h" #include "rimXMLAttribute.h" //########################################################################################## //****************************** Start Rim XML Namespace ********************************* RIM_XML_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class which stores a hierarchical representation of an XML node. /** * Each XML node has an associated value which has a meaning that depends on * the type of the node. A node with type XMLNode::ELEMENT can have a * list of attribute name-value pairs for that element, and can have * a list of child nodes. */ class XMLNode { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Node Type Enum Declaration typedef enum Type { /// A node type where the node represents the root node of a document. ROOT, /// A node type where the node represents a normal XML element. ELEMENT, /// A node type where the node corresponds to text data contained within another element. TEXT, /// A node type where the node represents an XML comment. COMMENT }; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructors /// Create a new XML node with no children, no attributes, and the specified node type. XMLNode( Type newType ); /// Create a new XML node with no children, no attributes, and the specified type and value string. XMLNode( Type newType, const UTF8String& newValue ); XMLNode( const XMLNode& other ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Destructor /// Destroy this XML node and release all resources that it contains. virtual ~XMLNode(); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Node Type Accessor Methods /// Return an enum value representing the type of this node. RIM_INLINE Type getType() const { return type; } /// Set an enum value representing the type of this node. RIM_INLINE void setType( Type newType ) { type = newType; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Node Value Accessor Methods /// Return a string representing the value for this node. /** * The purpose of this string depends on the node type: * - ROOT: this value is unused. * - ELEMENT: this value represents the element's tag. * - TEXT: this value represents the node's text string. * - COMMENT: this value represents the comment string. */ RIM_INLINE const UTF8String& getValue() const { return value; } /// Set a string representing the value for this node. /** * The purpose of this string depends on the node type: * - ROOT: this value is unused. * - ELEMENT: this value represents the element's tag. * - TEXT: this value represents the node's text string. * - COMMENT: this value represents the comment string. */ RIM_INLINE void setValue( const UTF8String& newValue ) { value = newValue; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Node Attribute Accessor Methods /// Return the total number of attributes that this XML node has. RIM_INLINE Size getAttributeCount() const { return attributes.getSize(); } /// Return a reference to the XML attribute at the specified index in this node. RIM_INLINE XMLAttribute& getAttribute( Index index ) { return attributes[index]; } /// Return a const reference to the XML attribute at the specified index in this node. RIM_INLINE const XMLAttribute& getAttribute( Index index ) const { return attributes[index]; } /// Return a pointer to the XML attribute with the specified name in this node. /** * The method returns NULL if there is no attribute with that name in this node. */ XMLAttribute* getAttribute( const UTF8String& name ); /// Return a const pointer to the XML attribute with the specified name in this node. /** * The method returns NULL if there is no attribute with that name in this node. */ const XMLAttribute* getAttribute( const UTF8String& name ) const; /// Get the value of the specified attribute in the output parameter. /** * The method returns whether or not there was an attribute with that name. * If there is no attribute with that name, the value reference is not changed. */ Bool getAttribute( const UTF8String& name, UTF8String& value ) const; /// Get an boolean value for the specified attribute in the output parameter. /** * The method returns whether or not the attribute was able to be accessed and * then successfully converted to the output value parameter's type. * If the method fails, the value reference is not changed. */ Bool getAttribute( const UTF8String& name, Bool& value ) const; /// Get a 32-bit integer value for the specified attribute in the output parameter. /** * The method returns whether or not the attribute was able to be accessed and * then successfully converted to the output value parameter's type. * If the method fails, the value reference is not changed. */ Bool getAttribute( const UTF8String& name, Int32& value ) const; /// Get an unsigned 32-bit integer value for the specified attribute in the output parameter. /** * The method returns whether or not the attribute was able to be accessed and * then successfully converted to the output value parameter's type. * If the method fails, the value reference is not changed. */ Bool getAttribute( const UTF8String& name, UInt32& value ) const; /// Get a 64-bit integer value for the specified attribute in the output parameter. /** * The method returns whether or not the attribute was able to be accessed and * then successfully converted to the output value parameter's type. * If the method fails, the value reference is not changed. */ Bool getAttribute( const UTF8String& name, Int64& value ) const; /// Get an unsigned 64-bit integer value for the specified attribute in the output parameter. /** * The method returns whether or not the attribute was able to be accessed and * then successfully converted to the output value parameter's type. * If the method fails, the value reference is not changed. */ Bool getAttribute( const UTF8String& name, UInt64& value ) const; /// Get a float value for the specified attribute in the output parameter. /** * The method returns whether or not the attribute was able to be accessed and * then successfully converted to the output value parameter's type. * If the method fails, the value reference is not changed. */ Bool getAttribute( const UTF8String& name, Float& value ) const; /// Get a double value for the specified attribute in the output parameter. /** * The method returns whether or not the attribute was able to be accessed and * then successfully converted to the output value parameter's type. * If the method fails, the value reference is not changed. */ Bool getAttribute( const UTF8String& name, Double& value ) const; /// Add an attribute with the specified name and value to this XML node. void addAttribute( const UTF8String& name, const UTF8String& value ); /// Add an attribute with the specified name and templated-type value to this XML node. /** * The template type must have an operator which allows conversion to a UTF8String. */ template < typename T > RIM_INLINE void addAttribute( const UTF8String& name, const T& value ) { this->addAttribute( name, (UTF8String)value ); } /// Set the value of the attribute with the specified name in this XML node /** * If the attribute was not already part of the node, a new attribute with that * name and value is added to the node. */ void setAttribute( const UTF8String& name, const UTF8String& value ); /// Set the value of the attribute with the specified name in this XML node /** * If the attribute was not already part of the node, a new attribute with that * name and value is added to the node. * * The template type must have an operator which allows conversion to a UTF8String. */ template < typename T > RIM_INLINE void setAttribute( const UTF8String& name, const T& value ) { this->setAttribute( name, (UTF8String)value ); } /// Remove the attribute with the specified name from this XML node. /** * The method returns whether or not there was an attribute with that * name that was removed successfully. */ Bool removeAttribute( const UTF8String& name ); /// Remove all attributes from this XML node. void clearAttributes(); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Child Node Accessor Methods /// Return the number of child nodes there are for this XML node. RIM_INLINE Size getChildCount() const { return children.getSize(); } /// Return a pointer to the child node of this node at the specified index in this node. RIM_INLINE const Pointer<XMLNode>& getChild( Index childIndex ) const { return children[childIndex]; } /// Return a pointer to the first child node of this node which has the specified node tag. /** * If there is no child with that tag, a NULL pointer is returned. * This method ignores any child nodes that don't have the node type ELEMENT. */ Pointer<XMLNode> getFirstChildWithTag( const UTF8String& tag ) const; /// Get a list of all of the children of this node that have the specified node tag. /** * The method places all of the children which have the specified tag into the * given output list. The method returns whether or not any children with * matching tags were found. This method ignores any child nodes * that don't have the node type ELEMENT. */ Bool getChildrenWithTag( const UTF8String& tag, ArrayList<Pointer<XMLNode> >& nodes ) const; /// Return a pointer to the first child node of this node which has the specified node type. /** * If there is no child with that node type, a NULL pointer is returned. */ Pointer<XMLNode> getFirstChildWithType( XMLNode::Type type ) const; /// Get a list of all of the children of this node that have the specified node type. /** * The method places all of the children which have the specified type into the * given output list. The method returns whether or not any children with * matching types were found. */ Bool getChildrenWithType( XMLNode::Type type, ArrayList<Pointer<XMLNode> >& nodes ) const; /// Add the specified node to the end of this node's list of children. /** * If the new child node pointer is NULL, the operation fails and FALSE * is returned. Otherwise, TRUE is returned. */ Bool addChild( const Pointer<XMLNode>& newNode ); /// Insert the specified node into the specified index in this node's list of children. /** * If the new child node pointer is NULL or the insertion index is not in the range [0,n], where * n is the previous number of children, the operation fails and FALSE * is returned. Otherwise, TRUE is returned. */ Bool insertChild( Index insertionIndex, const Pointer<XMLNode>& newNode ); /// Remove the child node at the specified index in this node's list of children. /** * If the specified index is invalid, the method fails and FALSE is returned. * Otherwise, the child is removed at that index and TRUE is returned. * This method ignores any child nodes that don't have the node type ELEMENT. */ Bool removeChild( Index childIndex ); /// Remove all children from this XML node that have the specified node tag. /** * The method returns the number of children that were removed from the node. */ Size removeChildrenWithTag( const UTF8String& tag ); /// Remove all child nodes from this node. void clearChildren(); private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Members /// An enum value indicating the type of this node. Type type; /// A string representing the value for this node. /** * The purpose of this string depends on the node type: * - ROOT: this value is unused. * - ELEMENT: this value represents the element's tag. * - TEXT: this value represents the node's text string. * - COMMENT: this value represents the comment string. */ UTF8String value; /// A list of pointers to the child nodes of this XML node. ArrayList< Pointer<XMLNode> > children; /// A list of the attributes for this node. ArrayList<XMLAttribute> attributes; }; //########################################################################################## //****************************** End Rim XML Namespace *********************************** RIM_XML_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_XML_NODE_H <file_sep>/* * rimGraphicsMeshGroupTranscoder.h * Rim Software * * Created by <NAME> on 6/28/14. * Copyright 2014 __MyCompanyName__. All rights reserved. * */ #ifndef INCLUDE_RIM_GRAPHICS_MESH_GROUP_ASSET_TRANSCODER_H #define INCLUDE_RIM_GRAPHICS_MESH_GROUP_ASSET_TRANSCODER_H #include "rimGraphicsAssetsConfig.h" #include "rimGraphicsMaterialAssetTranscoder.h" //########################################################################################## //*********************** Start Rim Graphics Assets Namespace **************************** RIM_GRAPHICS_ASSETS_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class which encodes and decodes graphics groups to the asset format. class GraphicsMeshGroupAssetTranscoder : public AssetTypeTranscoder<GenericMeshGroup> { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Destructor //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Text Encoding/Decoding Methods /// Decode an object from the specified string stream, returning a pointer to the final object. virtual Pointer<GenericMeshGroup> decodeText( const AssetType& assetType, const AssetObject& assetObject, ResourceManager* resourceManager = NULL ); /// Encode an object of this asset type into a text-based format. virtual Bool encodeText( UTF8StringBuffer& buffer, ResourceManager* resourceManager, const GenericMeshGroup& group ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Public Static Data Members /// An object indicating the asset type for a mesh group. static const AssetType MESH_GROUP_ASSET_TYPE; private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Type Declarations /// An enum describing the fields that a mesh group can have. typedef enum Field { /// An undefined field. UNDEFINED = 0, /// "name" The name of this mesh group. NAME, /// "material" The material of this mesh grouop. MATERIAL, /// "primitiveType" An enum indicating the primitive type of this mesh group. PRIMITIVE_TYPE, /// "indexBuffer" A buffer of vertex indices for the mesh group. INDEX_BUFFER, /// "vertexBuffers" A vertex buffer list for the mesh group. VERTEX_BUFFERS }; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Helper Methods /// Return an enum value indicating the field indicated by the given field name. static Field getFieldType( const AssetObject::String& name ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Members /// An object that handles encoding/decoding materials. GraphicsMaterialAssetTranscoder materialTranscoder; /// A temporary asset object used when parsing group child objects. AssetObject tempObject; }; //########################################################################################## //*********************** End Rim Graphics Assets Namespace ****************************** RIM_GRAPHICS_ASSETS_NAMESPACE_END //****************************************************************************************** //########################################################################################## //########################################################################################## //**************************** Start Rim Assets Namespace ******************************** RIM_ASSETS_NAMESPACE_START //****************************************************************************************** //########################################################################################## template <> RIM_INLINE const AssetType& AssetType::of<graphics::assets::GenericMeshGroup>() { return rim::graphics::assets::GraphicsMeshGroupAssetTranscoder::MESH_GROUP_ASSET_TYPE; } //########################################################################################## //**************************** End Rim Assets Namespace ********************************** RIM_ASSETS_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_GRAPHICS_MESH_GROUP_ASSET_TRANSCODER_H <file_sep>/* * rimGraphicsConverterFlags.h * Rim Software * * Created by <NAME> on 2/28/14. * Copyright 2014 __MyCompanyName__. All rights reserved. * */ #ifndef INCLUDE_RIM_GRAPHICS_CONVERTER_FLAGS_H #define INCLUDE_RIM_GRAPHICS_CONVERTER_FLAGS_H #include "rimGraphicsIOConfig.h" //########################################################################################## //************************** Start Rim Graphics IO Namespace ***************************** RIM_GRAPHICS_IO_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class which encapsulates the different flags that a graphics converter can have. /** * These flags provide boolean information about a certain graphics converter. Flags * are indicated by setting a single bit of a 32-bit unsigned integer to 1. * * Enum values for the different flags are defined as members of the class. Typically, * the user would bitwise-OR the flag enum values together to produce a final set * of set flags. */ class GraphicsConverterFlags { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Graphics Converter Flags Enum Declaration /// An enum which specifies the different graphics converter flags. typedef enum Flag { /// A flag which determines whether or not conversion caching is enabled. CACHE_ENABLED = (1 << 0), /// A flag which determines whether or not converted scene caching is enabled. SCENE_CACHE_ENABLED = (1 << 1), /// A flag which determines whether or not converted object caching is enabled. OBJECT_CACHE_ENABLED = (1 << 2), /// A flag which determines whether or not converted shape caching is enabled. SHAPE_CACHE_ENABLED = (1 << 3), /// A flag which determines whether or not converted material caching is enabled. MATERIAL_CACHE_ENABLED = (1 << 4), /// A flag which determines whether or not converted material technique caching is enabled. MATERIAL_TECHNIQUE_CACHE_ENABLED = (1 << 5), /// A flag which determines whether or not converted shader pass caching is enabled. SHADER_PASS_CACHE_ENABLED = (1 << 6), /// A flag which determines whether or not converted shader program caching is enabled. SHADER_PROGRAM_CACHE_ENABLED = (1 << 7), /// A flag which determines whether or not converted shader caching is enabled. SHADER_CACHE_ENABLED = (1 << 8), /// A flag which determines whether or not converted vertex buffer caching is enabled. VERTEX_BUFFER_CACHE_ENABLED = (1 << 9), /// A flag which determines whether or not converted vertex buffer caching is enabled. VERTEX_BUFFER_LIST_CACHE_ENABLED = (1 << 10), /// A flag which determines whether or not converted texture caching is enabled. TEXTURE_CACHE_ENABLED = (1 << 11), /// A flag which determines whether or not the graphics converter can load external resources. RESOURCE_LOADING_ENABLED = (1 << 12), /// A flag which determines whether or not the graphics converter uses deferred resource loading. /** * If this flag is set, the converter sets loading function callbacks for each resource, * deferring the loading of the resource until it is accessed. This allows resources * to be in use but not in memory, and allows the user to release resource data if it is * no longer needed while keeping the resource object. */ DEFERRED_LOADING_ENABLED = (1 << 13), /// The flag value when all flags are not set. UNDEFINED = 0 }; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructors /// Create a new graphics converter flags object with no flags set. RIM_INLINE GraphicsConverterFlags() : flags( UNDEFINED ) { } /// Create a new graphics converter flags object with the specified flag value initially set. RIM_INLINE GraphicsConverterFlags( Flag flag ) : flags( flag ) { } /// Create a new graphics converter flags object with the specified initial combined flags value. RIM_INLINE GraphicsConverterFlags( UInt32 newFlags ) : flags( newFlags ) { } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Integer Cast Operator /// Convert this graphics converter flags object to an integer value. /** * This operator is provided so that the GraphicsConverterFlags object * can be used as an integer value for bitwise logical operations. */ RIM_INLINE operator UInt32 () const { return flags; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Flag Status Accessor Methods /// Return whether or not the specified flag value is set for this flags object. RIM_INLINE Bool isSet( Flag flag ) const { return (flags & flag) != UNDEFINED; } /// Set whether or not the specified flag value is set for this flags object. RIM_INLINE void set( Flag flag, Bool newIsSet ) { if ( newIsSet ) flags |= flag; else flags &= ~flag; } private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Members /// A value indicating the flags that are set for a graphics converter. UInt32 flags; }; //########################################################################################## //************************** End Rim Graphics IO Namespace ******************************* RIM_GRAPHICS_IO_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_GRAPHICS_CONVERTER_FLAGS_H <file_sep>/* * rimException.h * Rim Framework * * Created by <NAME> on 1/27/08. * Copyright 2008 Rim Software. All rights reserved. * */ #ifndef INCLUDE_EXCEPTION_H #define INCLUDE_EXCEPTION_H #include <exception> #include "rimExceptionsConfig.h" //########################################################################################## //*************************** Start Rim Exceptions Namespace ***************************** RIM_EXCEPTIONS_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class that provides an exception abstraction. /** * It is meant to be thrown from the location of an error * and then to be caught by error correcting code somewhere * in the calling stack. Each exception provides a means to * encapsulate a message in the exception, so as to give the * exception catcher a better idea of why the error occurred. */ class Exception : public std::exception { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructors /// Create a default exception with no message to the catcher. Exception(); /// Create an exception with a character array message. /** * The message lets the thrower of the exception * tell the catcher the reason for the exception. */ Exception( const char* newMessage ); /// Create a new exception with a message from a string. /** * The message lets the thrower of the exception * tell the catcher the reason for the exception. */ Exception( const String& newMessage ); /// Create a copy of an exception (copy constructor). /** * This copy contructor duplicates the message of the * copied exception by doing a deep copy. */ Exception( const Exception& exception ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Destructor /// Destroy an exception, deallocating it's message. virtual ~Exception() throw(); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Assignment Operator /// Assign one exception to another Exception& operator = ( const Exception& exception ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Message Accessors /// Get the message for the exception. /** * The message is determined when the exception is * constructed, and lets the thrower of the exception * tell the catcher the reason for the throw of the * exception. * * @return the message from the exception's thrower */ virtual const char* what() const throw(); /// Get the message for the exception. /** * The message is determined when the exception is * constructed, and lets the thrower of the exception * tell the catcher the reason for the throw of the * exception. * * @return the message from the exception's thrower */ RIM_INLINE const String& getMessage() const { return *message; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Type Accessors /// Get a string representing the type of this exception virtual const String& getType() const { return *type; } /// Get a string representing the type of this exception (static version) static const String& getStaticType() { return *type; } private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Members /// The message for the exception. String* message; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Static Data Members /// A string representing the type of this exception static const String* type; }; //########################################################################################## //*************************** End Rim Exceptions Namespace ******************************* RIM_EXCEPTIONS_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_EXCEPTION_H <file_sep>/* * rimGraphicsShapes.h * Rim Graphics * * Created by <NAME> on 11/28/09. * Copyright 2009 Rim Software. All rights reserved. * */ #ifndef INCLUDE_RIM_GRAPHICS_SHAPES_H #define INCLUDE_RIM_GRAPHICS_SHAPES_H #include "shapes/rimGraphicsShapesConfig.h" #include "shapes/rimGraphicsSkeleton.h" #include "shapes/rimGraphicsMeshChunk.h" #include "shapes/rimGraphicsShapeType.h" #include "shapes/rimGraphicsShape.h" #include "shapes/rimGraphicsShapeBase.h" #include "shapes/rimGraphicsMeshShape.h" #include "shapes/rimGraphicsLODShape.h" #include "shapes/rimGraphicsSphereShape.h" #include "shapes/rimGraphicsCylinderShape.h" #include "shapes/rimGraphicsCapsuleShape.h" #include "shapes/rimGraphicsBoxShape.h" #include "shapes/rimGraphicsGridShape.h" #include "shapes/rimGraphicsGenericSphereShape.h" #include "shapes/rimGraphicsGenericCylinderShape.h" #include "shapes/rimGraphicsGenericCapsuleShape.h" #include "shapes/rimGraphicsGenericBoxShape.h" #include "shapes/rimGraphicsGenericMeshShape.h" #endif // INCLUDE_RIM_GRAPHICS_SHAPES_H <file_sep>/* * rimSoundIO.h * Rim Sound * * Created by <NAME> on 7/31/12. * Copyright 2012 __MyCompanyName__. All rights reserved. * */ #ifndef INCLUDE_RIM_SOUND_IO_H #define INCLUDE_RIM_SOUND_IO_H #include "io/rimSoundIOConfig.h" #include "io/rimSoundFormat.h" #include "io/rimSoundTranscoder.h" // .wav format encoder/decoder #include "io/rimSoundWaveDecoder.h" #include "io/rimSoundWaveEncoder.h" #include "io/rimSoundWaveTranscoder.h" // .aif format encoder/decoder #include "io/rimSoundAIFFDecoder.h" #include "io/rimSoundAIFFEncoder.h" #include "io/rimSoundAIFFTranscoder.h" // .ogg format encoder/decoder #include "io/rimSoundOggDecoder.h" #include "io/rimSoundOggEncoder.h" #include "io/rimSoundOggTranscoder.h" #endif // INCLUDE_RIM_SOUND_IO_H <file_sep>/* * rimPhysicsForces.h * Rim Physics * * Created by <NAME> on 5/8/08. * Copyright 2008 Rim Software. All rights reserved. * */ #ifndef INCLUDE_RIM_PHYSICS_FORCES_H #define INCLUDE_RIM_PHYSICS_FORCES_H #include "rimPhysicsConfig.h" #include "forces/rimPhysicsForcesConfig.h" #include "forces/rimPhysicsForce.h" #include "forces/rimPhysicsForceField.h" #include "forces/rimPhysicsForcePair.h" #include "forces/rimPhysicsForceFieldGravitySimple.h" #endif // INCLUDE_RIM_PHYSICS_FORCES_H <file_sep>/* * rimThreadsConfig.h * Rim Threads * * Created by <NAME> on 12/28/08. * Copyright 2008 Rim Software. All rights reserved. * */ #ifndef INCLUDE_RIM_THREADS_CONFIG_H #define INCLUDE_RIM_THREADS_CONFIG_H #include "../rimConfig.h" //########################################################################################## //########################################################################################## //############ //############ Library Namespace Configuration //############ //########################################################################################## //########################################################################################## /// Define the name of the thread library namespace. #ifndef RIM_THREADS_NAMESPACE #define RIM_THREADS_NAMESPACE threads #endif #ifndef RIM_THREADS_NAMESPACE_START #define RIM_THREADS_NAMESPACE_START RIM_NAMESPACE_START namespace RIM_THREADS_NAMESPACE { #endif #ifndef RIM_THREADS_NAMESPACE_END #define RIM_THREADS_NAMESPACE_END }; RIM_NAMESPACE_END #endif RIM_NAMESPACE_START /// A namespace containing classes which provide ways to create, manage, and synchronize threads. namespace RIM_THREADS_NAMESPACE { }; RIM_NAMESPACE_END //########################################################################################## //*************************** Start Rim Threads Namespace ******************************** RIM_THREADS_NAMESPACE_START //****************************************************************************************** //########################################################################################## //########################################################################################## //*************************** End Rim Threads Namespace ********************************** RIM_THREADS_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_THREADS_CONFIG_H <file_sep>/* * rimSoundTimeSignature.h * Rim Sound * * Created by <NAME> on 5/30/13. * Copyright 2013 __MyCompanyName__. All rights reserved. * */ #ifndef INCLUDE_RIM_SOUND_TIME_SIGNATURE_H #define INCLUDE_RIM_SOUND_TIME_SIGNATURE_H #include "rimSoundUtilitiesConfig.h" //########################################################################################## //*********************** Start Rim Sound Utilities Namespace **************************** RIM_SOUND_UTILITIES_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class which represents a standard musical time signature. /** * The numberator of the time signature indicates the number of beats per measure, * and the denominator indicates what note value represents a beat. The note value * is almost always a power of 2: 1, 2, 4, 8, 16, 32, etc. */ class TimeSignature { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructors /// Create a new default time signature representing 4/4 time. RIM_INLINE TimeSignature() : numerator( 4 ), denominator( 4 ) { } /// Create a new time signature with the specified time signature numberator and denominator. RIM_INLINE TimeSignature( UInt newNumerator, UInt newDenominator ) : numerator( newNumerator ), denominator( newDenominator ) { } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Numerator and Denominator Accessor Methods /// Return the numerator value of this time signature, indicating the number of beats per measure. RIM_INLINE UInt getNumerator() const { return numerator; } /// Set the numerator value of this time signature, indicating the number of beats per measure. RIM_INLINE void setNumerator( UInt newNumerator ) { numerator = UInt8(newNumerator); } /// Return the denominator value of this time signature, indicating which note value gets a beat. /** * The note value is almost always a power of 2: 1, 2, 4, 8, 16, 32, etc. */ RIM_INLINE UInt getDenominator() const { return denominator; } /// Set the denominator value of this time signature, indicating which note value gets a beat. /** * The note value is almost always a power of 2: 1, 2, 4, 8, 16, 32, etc. */ RIM_INLINE void setDenominator( UInt newDenominator ) { denominator = UInt8(newDenominator); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** String Representation Accessor Methods /// Return a string representation of the time signature, 'N/D' data::String toString() const { return String(numerator) + '/' + String(denominator); } /// Convert this time signature into a string representation, 'N/D'. RIM_INLINE operator data::String () const { return this->toString(); } private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Members /// The number of beats per measure of this time signature. UInt8 numerator; /// The note type that represents a beat, usually a power of two: 1, 2, 4, 8, 16, 32. UInt8 denominator; }; //########################################################################################## //*********************** End Rim Sound Utilities Namespace ****************************** RIM_SOUND_UTILITIES_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_SOUND_TIME_SIGNATURE_H <file_sep>/* * rimPlane2D.h * Rim Math * * Created by <NAME> on 10/15/10. * Copyright 2010 Rim Software. All rights reserved. * */ #ifndef INCLUDE_RIM_PLANE_2D_H #define INCLUDE_RIM_PLANE_2D_H #include "rimMathConfig.h" #include "rimVector2D.h" //########################################################################################## //***************************** Start Rim Math Namespace ********************************* RIM_MATH_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class which represents a plane in 2D space. /** * It uses the normal and offset plane representation as it is the most universally * useful in computational mathematics, especially relating to graphics and geometry. */ template < typename T > class Plane2D { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructors /// Create a plane in 2D space with the normal pointing along the positive Y axis with offset = 0. RIM_FORCE_INLINE Plane2D() : normal( 0, 1 ), offset( 0 ) { } /// Create a plane in 2D space with the specified normal and offset from the origin. RIM_FORCE_INLINE Plane2D( const Vector2D<T>& planeNormal, T planeOffset ) : normal( planeNormal ), offset( planeOffset ) { } /// Create a plane in 2D space from two points in that plane. RIM_FORCE_INLINE Plane2D( const Vector2D<T>& p1, const Vector2D<T>& p2 ) : normal( math::perp( p2 - p1 ).normalize() ) { offset = -math::dot( p1, normal ); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Point Distance Methods /// Get the perpendicular distance from the specified point to the plane. RIM_FORCE_INLINE T getDistanceTo( const Vector2D<T>& point ) const { return math::abs( math::dot( normal, point ) + offset ); } /// Get the perpendicular distance from the specified point to the plane. RIM_FORCE_INLINE T getSignedDistanceTo( const Vector2D<T>& point ) const { return math::dot( normal, point ) + offset; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Point Projection Methods /// Return the projection of the given point onto the plane. RIM_FORCE_INLINE Vector2D<T> getProjection( const Vector2D<T>& point ) const { T t = getSignedDistanceTo(point) / math::dot( normal, normal ); return point - t*normal; } /// Return the projection of the given point onto the plane. /** * The plane is assumed to have a normal vector of unit length. This * results in a significantly faster function, however the results are * meaningless if the precondition is not met. */ RIM_FORCE_INLINE Vector2D<T> getProjectionNormalized( const Vector2D<T>& point ) const { return point - getSignedDistanceTo(point)*normal; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Point Reflection Methods /// Get the reflection of a point over the plane. RIM_FORCE_INLINE Vector2D<T> getReflection( const Vector2D<T>& point ) const { T t = getSignedDistanceTo(point) / math::dot( normal, normal ); return point - T(2)*t*normal; } /// Get the reflection of a point over the plane. RIM_FORCE_INLINE Vector2D<T> getReflectionNormalized( const Vector2D<T>& point ) const { return point - T(2)*getSignedDistanceTo(point)*normal; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Plane Normalization Method /// Normalize the plane's normal vector and correct the offset to match. RIM_FORCE_INLINE Plane2D normalize() const { T inverseMagnitude = T(1)/normal.getMagnitude(); return Plane2D( normal*inverseMagnitude, offset*inverseMagnitude ); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Plane Inversion Operator /// Return the plane with the opposite normal vector and offset. /** * This plane is mathematically the same as the original plane. */ RIM_FORCE_INLINE Plane2D operator - () const { return Plane2D( -normal, -offset ); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Public Data Members /// A vector perpendicular to the plane. Vector2D<T> normal; /// The distance that the plane is offset from the origin. T offset; }; //########################################################################################## //########################################################################################## //############ //############ 2D Plane Type Definitions //############ //########################################################################################## //########################################################################################## typedef Plane2D<int> Plane2i; typedef Plane2D<float> Plane2f; typedef Plane2D<double> Plane2d; //########################################################################################## //***************************** End Rim Math Namespace *********************************** RIM_MATH_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_PLANE_2D_H <file_sep>/* * rimThreads.h * Rim Threads * * Created by <NAME> on 11/7/07. * Copyright 2007 __MyCompanyName__. All rights reserved. * */ #ifndef INCLUDE_RIM_THREADS_H #define INCLUDE_RIM_THREADS_H #include "threads/rimThreadsConfig.h" #include "threads/rimBasicThread.h" #include "threads/rimThreadPriority.h" #include "threads/rimThread.h" #include "threads/rimMutex.h" #include "threads/rimSignal.h" #include "threads/rimSemaphore.h" #include "threads/rimWorkerThread.h" #include "threads/rimThreadPool.h" #include "threads/rimAtomics.h" #endif // INCLUDE_RIM_THREADS_H <file_sep>/* * rimGraphicsShapesConfig.h * Rim Graphics * * Created by <NAME> on 11/28/11. * Copyright 2011 __MyCompanyName__. All rights reserved. * */ #ifndef INCLUDE_RIM_GRAPHICS_SHAPES_CONFIG_H #define INCLUDE_RIM_GRAPHICS_SHAPES_CONFIG_H #include "../rimGraphicsConfig.h" #include "../rimGraphicsUtilities.h" #include "../rimGraphicsMaterials.h" #include "../rimGraphicsBuffers.h" #include "../rimGraphicsCameras.h" #include "../devices/rimGraphicsContext.h" //########################################################################################## //########################################################################################## //############ //############ Library Namespace Configuration //############ //########################################################################################## //########################################################################################## #ifndef RIM_GRAPHICS_SHAPES_NAMESPACE_START #define RIM_GRAPHICS_SHAPES_NAMESPACE_START RIM_GRAPHICS_NAMESPACE_START namespace shapes { #endif #ifndef RIM_GRAPHICS_SHAPES_NAMESPACE_END #define RIM_GRAPHICS_SHAPES_NAMESPACE_END }; RIM_GRAPHICS_NAMESPACE_END #endif //########################################################################################## //*********************** Start Rim Graphics Shapes Namespace **************************** RIM_GRAPHICS_SHAPES_NAMESPACE_START //****************************************************************************************** //########################################################################################## using rim::graphics::util::AttributeType; using namespace rim::graphics::buffers; using namespace rim::graphics::materials; using rim::graphics::cameras::Camera; using rim::graphics::devices::GraphicsContext; //########################################################################################## //*********************** End Rim Graphics Shapes Namespace ****************************** RIM_GRAPHICS_SHAPES_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_GRAPHICS_SHAPES_CONFIG_H <file_sep>/* * rimPhysicsScenes.h * Rim Physics * * Created by <NAME> on 6/2/12. * Copyright 2012 __MyCompanyName__. All rights reserved. * */ #ifndef INCLUDE_RIM_PHYSICS_SCENES_H #define INCLUDE_RIM_PHYSICS_SCENES_H #include "rimPhysicsConfig.h" #include "scenes/rimPhysicsScenesConfig.h" #include "scenes/rimPhysicsScene.h" #include "scenes/rimPhysicsSceneSimple.h" #endif // INCLUDE_RIM_PHYSICS_SCENES_H <file_sep>/* * rimGraphicsShaderParameter.h * Rim Software * * Created by <NAME> on 1/30/14. * Copyright 2014 __MyCompanyName__. All rights reserved. * */ #ifndef INCLUDE_RIM_GRAPHICS_SHADER_PARAMETER_H #define INCLUDE_RIM_GRAPHICS_SHADER_PARAMETER_H #include "rimGraphicsShadersConfig.h" #include "rimGraphicsShaderParameterInfo.h" #include "rimGraphicsShaderParameterValue.h" //########################################################################################## //*********************** Start Rim Graphics Shaders Namespace *************************** RIM_GRAPHICS_SHADERS_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class which contains the entire state for a shader parameter. /** * This state includes information about the shader parameter as well as its * value. */ class ShaderParameter { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructors /// Create a new UNDEFINED shader parameter object with the value 0. RIM_INLINE ShaderParameter() : info(), value() { } /// Create a new shader parameter object with the specified info and value. RIM_INLINE ShaderParameter( const ShaderParameterInfo& newInfo, const ShaderParameterValue& newValue ) : info( newInfo ), value( newValue ) { } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Info Accessor Methods /// Return an object describing information about this shader parameter. RIM_INLINE const ShaderParameterInfo& getInfo() const { return info; } /// Set an object describing information about this shader parameter. RIM_INLINE void setInfo( const ShaderParameterInfo& newInfo ) { info = newInfo; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Name Accessor Methods /// Return a string representing the name for this shader parameter. RIM_INLINE const String& getName() const { return info.getName(); } /// Set a string representing the name for this shader parameter. RIM_INLINE void setName( const String& newName ) { info.setName( newName ); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Usage Accessor Methods /// Return an object describing the semantic usage of this shader parameter. RIM_INLINE const ShaderParameterUsage& getUsage() const { return info.getUsage(); } /// Set an object describing the semantic usage of this shader parameter. RIM_INLINE void setUsage( const ShaderParameterUsage& newInfo ) { info.setUsage( newInfo ); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Value Accessor Methods /// Return an object which contains the value for this shader parameter. RIM_INLINE const ShaderParameterValue& getValue() const { return value; } /// Set an object containing a new value for this shader parameter. RIM_INLINE void setValue( const ShaderParameterValue& newValue ) { value = newValue; } private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Members /// An object describing information about this shader parameter. ShaderParameterInfo info; /// The value for this shader parameter. ShaderParameterValue value; }; //########################################################################################## //*********************** End Rim Graphics Shaders Namespace ***************************** RIM_GRAPHICS_SHADERS_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_GRAPHICS_SHADER_PARAMETER_H <file_sep>/* * QuadcopterDemo.h * Quadcopter * * Created by <NAME> on 9/10/14. * Additions: <NAME> * Copyright 2014 __MyCompanyName__. All rights reserved. * */ #ifndef INCLUDE_QUADCOPTER_DEMO_H #define INCLUDE_QUADCOPTER_DEMO_H #include "rim/rimEngine.h" #include "rim/rimGraphicsGUI.h" using namespace rim; using namespace rim::graphics; using namespace rim::graphics::gui; using namespace rim::engine; #include "Quadcopter.h" #include "Simulation.h" #include "Roadmap.h" #include "Global_planner.h" class QuadcopterDemo : public SimpleDemo { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructors QuadcopterDemo(); protected: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Delegate Methods virtual Bool initialize( const Pointer<GraphicsContext>& context ); virtual void deinitialize(); virtual void update( const Time& dt ); void handleInput( const Time& dt ); virtual void keyEvent( const KeyboardEvent& event ); virtual void mouseButtonEvent( const MouseButtonEvent& event ); virtual void mouseMotionEvent( const MouseMotionEvent& event ); virtual void draw( const Pointer<GraphicsContext>& context ); virtual void resize( const Size2D& newSize ); private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Quadcopter Management Methods /// Create a new quadcopter with the specified initial position. Pointer<Quadcopter> newQuadcopter( const Vector3f& position ) const; /// Add the specified quadcopter to the current scene. Bool addQuadcopterToScene( const Pointer<Quadcopter>& newQuadcopter ); /// Try generating a roadmap and return whether or not a path was found. Bool generateRoadmap( Quadcopter& quadcopter, const AABB3f& bounds, const Vector3f& start, const Vector3f& goal, Size numSamples ); /// Draw the specified roadmap to the current viewport. void drawRoadmap( const Roadmap& roadmap ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Rendering Data Members Pointer<ForwardRenderer> sceneRenderer; Pointer<ImmediateRenderer> immediateRenderer; Pointer<fonts::GraphicsFontDrawer> fontDrawer; fonts::FontStyle fontStyle; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Scene Data Members Pointer<GraphicsScene> scene; Pointer<Roadmap> roadmap; Pointer<PerspectiveCamera> camera; Vector3f cameraVelocity; Float cameraSpeed; Float cameraFriction; Float cameraYaw; Float cameraPitch; /// The distance that the camera is from its target. Float cameraDistance; /// The target point that the camera is looking at. Vector3f cameraTarget; /// The current goal position for the quadcopter. Vector3f goal; /// A list of the quadcopters that are in the current scene. ArrayList< Pointer<Quadcopter> > quadcopters; /// A pointer to a mesh to use for quadcopters. Pointer<MeshShape> quadcopterMesh; /// 0 == camera view, 1 = first quadcopter, etc... Index currentView; Index frameNumber; Bool recording; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Simulation Data Members /// An object which handles the simulation of quadcopters in a virtual scene. Simulation simulation; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Other Data Members /// The time in seconds that the last simulation frame took to process. Time simulationTime; Path rootPath; Float timeStep; }; #endif // INCLUDE_BALLISTIC_DEMO_H <file_sep>/* * rimGraphicsLights.h * Rim Graphics * * Created by <NAME> on 5/16/12. * Copyright 2012 __MyCompanyName__. All rights reserved. * */ #ifndef INCLUDE_RIM_GRAPHICS_LIGHTS_H #define INCLUDE_RIM_GRAPHICS_LIGHTS_H #include "lights/rimGraphicsLightsConfig.h" #include "lights/rimGraphicsLight.h" #include "lights/rimGraphicsDirectionalLight.h" #include "lights/rimGraphicsPointLight.h" #include "lights/rimGraphicsSpotLight.h" #include "lights/rimGraphicsLightBuffer.h" #include "lights/rimGraphicsLightCuller.h" #include "lights/rimGraphicsLightCullerSimple.h" #endif // INCLUDE_RIM_GRAPHICS_LIGHTS_H <file_sep>/* * rimPhysicsForceField.h * Rim Physics * * Created by <NAME> on 11/28/09. * Copyright 2009 Rim Software. All rights reserved. * */ #ifndef INCLUDE_RIM_PHYSICS_FORCE_FIELD_H #define INCLUDE_RIM_PHYSICS_FORCE_FIELD_H #include "rimPhysicsForcesConfig.h" #include "rimPhysicsForce.h" //########################################################################################## //************************ Start Rim Physics Forces Namespace **************************** RIM_PHYSICS_FORCES_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// An extension of the Force interface which can apply forces to a pair of objects. /** * By deriving from this class, one can simulate various pair-wise force interactions * such as gravity, springs, etc. */ template < typename ObjectType1, typename ObjectType2 > class ForcePair : public Force { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructors /// Create a default force pair which affects no objects. RIM_INLINE ForcePair() : object1( NULL ), object2( NULL ) { } /// Create a force pair which affects the specified pair of objects. RIM_INLINE ForcePair( ObjectType1* newObject1, ObjectType2* newObject2 ) : object1( newObject1 ), object2( newObject2 ) { } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Force Application Method /// Apply force vectors to the pair of objects that this ForceField effects. /** * These force vectors should be based on the internal configuration * of the force system. */ virtual void applyForces( Real dt ) = 0; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Object Accessor Methods /// Return the first object in this force pair. /** * If this pair does not have a first object, NULL is returned. */ RIM_FORCE_INLINE ObjectType1* getObject1() const { return object1; } /// Set the first object in this pair. /** * Setting the first object pointer to a NULL value will remove * that object from this pair's force system. */ RIM_FORCE_INLINE void setObject1( ObjectType1* newObject1 ) { object1 = newObject1; } /// Return the second object in this force pair. /** * If this pair does not have a second object, NULL is returned. */ RIM_FORCE_INLINE ObjectType2* getObject2() const { return object2; } /// Set the second object in this pair. /** * Setting the second object pointer to a NULL value will remove * that object from this pair's force system. */ RIM_FORCE_INLINE void setObject2( ObjectType2* newObject2 ) { object2 = newObject2; } private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Members /// The first object of this force pair. ObjectType1* object1; /// The second object of this force pair. ObjectType2* object2; }; //########################################################################################## //************************ End Rim Physics Forces Namespace ****************************** RIM_PHYSICS_FORCES_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_PHYSICS_FORCE_FIELD_H <file_sep>/* * rimGraphicsGUI.h * Rim Graphics * * Created by <NAME> on 5/8/08. * Copyright 2008 Rim Software. All rights reserved. * */ #ifndef INCLUDE_RIM_GRAPHICS_GUI_H #define INCLUDE_RIM_GRAPHICS_GUI_H #include "graphics/gui/rimGraphicsGUIConfig.h" // Font Library #include "graphics/gui/rimGraphicsGUIFonts.h" // Utility Classes #include "graphics/gui/rimGraphicsGUIUtilities.h" // Object Classes #include "graphics/gui/rimGraphicsGUIObject.h" // Rendering Interface Classes #include "graphics/gui/rimGraphicsGUIRenderer.h" // GUI Element Classes #include "graphics/gui/rimGraphicsGUIScreen.h" #include "graphics/gui/rimGraphicsGUIScreenDelegate.h" #include "graphics/gui/rimGraphicsGUITextField.h" #include "graphics/gui/rimGraphicsGUIButton.h" #include "graphics/gui/rimGraphicsGUIButtonDelegate.h" #include "graphics/gui/rimGraphicsGUIButtonType.h" #include "graphics/gui/rimGraphicsGUIDivider.h" #include "graphics/gui/rimGraphicsGUISlider.h" #include "graphics/gui/rimGraphicsGUISliderDelegate.h" #include "graphics/gui/rimGraphicsGUIKnob.h" #include "graphics/gui/rimGraphicsGUIKnobDelegate.h" #include "graphics/gui/rimGraphicsGUIMeter.h" #include "graphics/gui/rimGraphicsGUIMeterDelegate.h" #include "graphics/gui/rimGraphicsGUIScrollView.h" #include "graphics/gui/rimGraphicsGUIRenderView.h" #include "graphics/gui/rimGraphicsGUIRenderViewDelegate.h" #include "graphics/gui/rimGraphicsGUIContentView.h" #include "graphics/gui/rimGraphicsGUISplitView.h" #include "graphics/gui/rimGraphicsGUISplitViewDelegate.h" #include "graphics/gui/rimGraphicsGUIGraphView.h" #include "graphics/gui/rimGraphicsGUIGraphViewDelegate.h" #include "graphics/gui/rimGraphicsGUIImageView.h" #include "graphics/gui/rimGraphicsGUIGridView.h" #include "graphics/gui/rimGraphicsGUIMenuItem.h" #include "graphics/gui/rimGraphicsGUIMenuItemDelegate.h" #include "graphics/gui/rimGraphicsGUIMenu.h" #include "graphics/gui/rimGraphicsGUIMenuDelegate.h" #include "graphics/gui/rimGraphicsGUIMenuBar.h" #include "graphics/gui/rimGraphicsGUIMenuBarDelegate.h" #include "graphics/gui/rimGraphicsGUIOptionMenu.h" #include "graphics/gui/rimGraphicsGUIOptionMenuDelegate.h" #endif // INCLUDE_RIM_GRAPHICS_GUI_H <file_sep>/* * rimResource.h * Rim Software * * Created by <NAME> on 11/27/09. * Copyright 2009 Rim Software. All rights reserved. * */ #ifndef INCLUDE_RIM_RESOURCE_H #define INCLUDE_RIM_RESOURCE_H #include "rimResourcesConfig.h" #include "rimResourceID.h" //########################################################################################## //************************** Start Rim Resources Namespace ******************************* RIM_RESOURCES_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class which encapsulates a handle to resource data. /** * The class allows the user to either load the resource data manually, or * to provide a unique identifier and ResourceLoader object to defer loading the * resource until it is needed. */ template < typename DataType > class Resource { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Public Type Declaration /// Define the type for a resource loading callback function. typedef lang::Function< lang::Pointer<DataType> ( const ResourceID& ) > LoadCallback; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructors /// Create a new default resource with no data and no resource identifier or loader. /** * The created resource is essentially unuseable and can be used to indicate an * invalid resource or a resource that has not yet been set. */ RIM_INLINE Resource() : info( NULL ) { } /// Create a new resource for the specified data pointer. /** * If the specified data pointer is NULL, the resource is unusable because it has * no way to load any data for the resource. */ RIM_INLINE Resource( const lang::Pointer<DataType>& newData ) : info( util::construct<ResourceInfo>( newData ) ) { } /// Create a new resource for the specified data which is associated with the specified unique identifier. /** * If the specified data pointer is NULL, the resource is unusable because it has * no way to load the resource associated with the given ID. */ RIM_INLINE Resource( const lang::Pointer<DataType>& newData, const ResourceID& newIdentifier ) : info( util::construct<ResourceInfo>( newData, newIdentifier ) ) { } /// Create a new resource for the specified unique resource identifier. RIM_INLINE Resource( const ResourceID& newIdentifier ) : info( util::construct<ResourceInfo>( newIdentifier ) ) { } /// Create a new resource for the specified unique resource identifier using the specified loader object. /** * A resource created using this constructor will lazily load the resource when it is first * dereferenced. The specified ID is used to load the resource using the given ResourceLoader * object. If the loader object pointer is NULL, the new resource will be useless because * it has no way to load any data for the resource. */ RIM_INLINE Resource( const ResourceID& newIdentifier, const LoadCallback& newLoadCallback ) : info( util::construct<ResourceInfo>( newIdentifier, newLoadCallback ) ) { } RIM_INLINE Resource( const Resource& other ) : info( other.info ) { if ( info ) info->referenceCount++; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Destructor RIM_INLINE ~Resource() { if ( info && (--info->referenceCount) == 0 ) util::destruct( info ); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Assignment Operator RIM_INLINE Resource& operator = ( const Resource& other ) { if ( info != other.info ) { if ( info && (--info->referenceCount) == 0 ) util::destruct( info ); info = other.info; if ( info ) info->referenceCount++; } return *this; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Comparison Operators /// Return whether or not this resource refers to the same resource as another. /** * This operator returns TRUE if the data pointer they refer to is equal, or * if they both have the same resource identifier/loader. Otherwise FALSE is * returned. */ RIM_INLINE Bool operator == ( const Resource& other ) const { if ( info == other.info ) return true; else if ( info && other.info && (info->data == other.info->data || info->identifier == other.info->indentifier) ) return true; else return false; } /// Return whether or not this resource refers to a different resource than another. /** * This operator returns FALSE if the data pointer they refer to is equal, or * if they both have the same resource identifier/loader. Otherwise TRUE is * returned. */ RIM_INLINE Bool operator != ( const Resource& other ) const { return !(*this == other); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Data Accessor Methods /// Return a pointer to the data associated with this resource. /** * The method can return NULL if the resource's data has not yet * been loaded. */ RIM_INLINE lang::Pointer<DataType> getData() const { if ( info ) return info->data; else return lang::Pointer<DataType>(); } /// Set a pointer to the data associated with this resource. RIM_INLINE void setData( const lang::Pointer<DataType>& newData ) { if ( info ) info->data = newData; else info = util::construct<ResourceInfo>( newData ); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Pointer Accesor Method /// Return a pointer to the data associated with this resource. /** * The method can return NULL if the resource's data has not yet * been loaded. */ RIM_INLINE const DataType* getPointer() const { if ( info ) return info->data; else return NULL; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Cast Operators /// Cast this Resource object to a reference-counted pointer. RIM_INLINE operator lang::Pointer<DataType> () const { if ( info ) return info->data; else return lang::Pointer<DataType>(); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Dereferencing Operators /// Return a reference to the data associated with this resource. /** * This operator dereferences the data for the resource. If the data * pointer is currently NULL, the resource attempts to use the associated resource * loader to load the resource data. An assertion is raised if there is no identifier * or loader for the resource if the data is NULL. */ RIM_INLINE DataType& operator * () const { RIM_DEBUG_ASSERT_MESSAGE( info != NULL && info->data.isSet(), "Tried to access resource with NULL info or data." ); return *info->data; } /// Return a pointer to the data associated with this resource. /** * This operator dereferences the data for the resource. If the data * pointer is currently NULL, the resource attempts to use the associated resource * loader to load the resource data. An assertion is raised if there is no identifier * or loader for the resource if the data is NULL. */ RIM_INLINE DataType* operator -> () const { if ( info == NULL ) return NULL; if ( info->data.isNull() && info->loadCallback.isSet() ) info->data = info->loadCallback( info->identifier ); return info->data; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Resource Identifier Accessor Methods /// Return whether or not this resource has a unique identifier associated with it. RIM_INLINE Bool hasID() const { return info != NULL; } /// Return a pointer to the unique identifier associated with this resource. /** * If the resource has no identifier associated with it, NULL is returned. */ RIM_INLINE ResourceID* getID() { if ( info ) return &info->identifier; else return NULL; } /// Return a pointer to the unique identifier associated with this resource. /** * If the resource has no identifier associated with it, NULL is returned. */ RIM_INLINE const ResourceID* getID() const { if ( info ) return &info->identifier; else return NULL; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Resource Loader Accessor Methods /// Return whether or not this resource has a ResourceLoader object associated with it. RIM_INLINE Bool hadLoadCallback() const { return info != NULL && info->loadCallback.isSet(); } /// Return a pointer to the resource loading callback function associated with this resource. /** * If the resource has no callback function associated with it, NULL is returned. */ RIM_INLINE const LoadCallback* getLoadCallback() const { if ( info ) return &info->loadCallback; else return NULL; } /// Set the resource loading callback function associated with this resource. /** * If the resource has no callback function associated with it, an assertion is raised. */ RIM_INLINE void setLoadCallback( const LoadCallback& newLoadCallback ) { if ( info == NULL ) info = util::construct<ResourceInfo>( newLoadCallback ); else info->loadCallback = newLoadCallback; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Resource Loading/Releasing Methods /// Attempt to load the data for this resource if necessary. /** * This method tries to ensure that the resource data is loaded and available * for use. If the data is already loaded, the method returns TRUE. Otherwise, * the method loads the data using the resource's ID and loader object and * returns TRUE. If there is no loader or ID for this resource, FALSE is returned, * indicating that the resource was unable to be loaded. */ RIM_INLINE Bool load() const { if ( info == NULL ) return false; else if ( info->data.isSet() ) return true; else { if ( info->loadCallback.isSet() ) info->data = info->loadCallback( info->identifier ); return info->data.isSet(); } } /// Release the data assoicated with this resource, but keep the same resource ID and loader. /** * This method just releases the reference to the data. If other resource objects reference * the same data, the data is not deallocated until they all release their data. */ RIM_INLINE void release() { if ( info ) info->data.release(); } /// Return whether or not the data associated with this resource is currently NULL. /** * The data can be NULL if the resource has not yet been loaded, or if the * resource is itself invalid. */ RIM_INLINE Bool isNull() const { return info == NULL || info->data.isNull(); } /// Return whether or not the data associated with this resource is currently set. /** * The data can be NULL if the resource has not yet been loaded, or if the * resource is itself invalid. */ RIM_INLINE Bool isSet() const { return info != NULL && info->data.isSet(); } /// Return the number of shared references that there are to this resource's data. /** * If the returned value is 1, this means that this resource is the only object * which owns the data associated with it. */ RIM_INLINE Size getReferenceCount() const { if ( info ) return info->referenceCount; else return 0; } private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Class Declaration /// A class which holds shared information about a particular resource. class ResourceInfo { public: RIM_INLINE ResourceInfo( const lang::Pointer<DataType>& newData ) : data( newData ), referenceCount( 1 ) { } RIM_INLINE ResourceInfo( const lang::Pointer<DataType>& newData, const ResourceID& newIdentifier ) : data( newData ), identifier( newIdentifier ), referenceCount( 1 ) { } RIM_INLINE ResourceInfo( const ResourceID& newIdentifier ) : referenceCount( 1 ), identifier( newIdentifier ) { } RIM_INLINE ResourceInfo( const LoadCallback& newLoadCallback ) : referenceCount( 1 ), loadCallback( newLoadCallback ) { } RIM_INLINE ResourceInfo( const ResourceID& newIdentifier, const LoadCallback& newLoadCallback ) : referenceCount( 1 ), identifier( newIdentifier ), loadCallback( newLoadCallback ) { } /// A smart pointer to the data associated with this resource. lang::Pointer<DataType> data; /// The reference count of this resource info object. Size referenceCount; /// An identifier associated with this resource which uniquely locates it. ResourceID identifier; /// A function which loads the data associated with this resource. LoadCallback loadCallback; }; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Members /// A pointer to information about this resource (possibly NULL). ResourceInfo* info; }; //########################################################################################## //************************** End Rim Resources Namespace ********************************* RIM_RESOURCES_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_RESOURCE_H <file_sep>/* * rimShortArray.h * Rim Framework * * Created by <NAME> on 9/7/13. * Copyright 2013 __MyCompanyName__. All rights reserved. * */ #ifndef INCLUDE_RIM_SHORT_ARRAY_H #define INCLUDE_RIM_SHORT_ARRAY_H #include "rimUtilitiesConfig.h" //########################################################################################## //*************************** Start Rim Utilities Namespace ****************************** RIM_UTILITIES_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class which represents a dynamically-sized sequence of objects stored contiguously in memory. /** * This class functions identically to the Array class, except that it has local * storage for a small number of objects that are stored as part of the array object, * eliminating an array allocation if the number of objects is small. */ template < typename T, Size localCapacity = Size(4) > class ShortArray { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructor /// Create an empty array. This constructor does not allocate any memory. RIM_INLINE ShortArray() : pointer( (T*)localStorage ), size( 0 ) { } /// Create an array of the specified size with default-constructed elements. RIM_INLINE explicit ShortArray( Size arraySize ) : size( arraySize ) { if ( arraySize <= localCapacity ) pointer = (T*)localStorage; else pointer = util::allocate<T>( arraySize ); initializeObjects( pointer, arraySize ); } /// Create an array of the specified size with elements created from the specified prototype. RIM_INLINE explicit ShortArray( Size arraySize, const T& prototype ) : size( arraySize ) { if ( arraySize <= localCapacity ) pointer = (T*)localStorage; else pointer = util::allocate<T>( arraySize ); initializeObjects( pointer, arraySize, prototype ); } /// Create an array which uses the specified pointer to a block of memory. /** * After calling this constructor, the array now owns the pointer and will * automatically delete it when the array is destructed. */ RIM_INLINE explicit ShortArray( T* newArray, Size arraySize ) { if ( newArray != NULL ) { pointer = newArray; size = arraySize; } else { pointer = (T*)localStorage; size = 0; } } /// Create an array with elements from the specified pointer, copying the data. RIM_INLINE explicit ShortArray( const T* newArray, Size arraySize ) { if ( newArray != NULL ) { if ( arraySize <= localCapacity ) pointer = (T*)localStorage; else pointer = util::allocate<T>( arraySize ); copyObjects( pointer, newArray, arraySize ); size = arraySize; } else { pointer = (T*)localStorage; size = 0; } } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Copy Constructors /// Create a deep copy of the specified array object. RIM_INLINE ShortArray( const ShortArray& other ) : size( other.size ) { if ( size <= localCapacity ) pointer = (T*)localStorage; else pointer = util::allocate<T>( size ); copyObjects( pointer, other.pointer, size ); } /// Create a deep copy of the specified array object. template < Size localCapacity2 > RIM_INLINE ShortArray( const ShortArray<T,localCapacity2>& other ) : size( other.size ) { if ( size <= localCapacity ) pointer = (T*)localStorage; else pointer = util::allocate<T>( size ); copyObjects( pointer, other.pointer, size ); } /// Create a deep copy of the specified array object, using only the specified number of elements. template < Size localCapacity2 > RIM_INLINE ShortArray( const ShortArray<T,localCapacity2>& other, Size number ) : size( number < other.size ? number : other.size ) { if ( size <= localCapacity ) pointer = (T*)localStorage; else pointer = util::allocate<T>( size ); copyObjects( pointer, other.pointer, size ); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Destructor /// Destroy an array object and deallocate its internal array. RIM_INLINE ~ShortArray() { callDestructors( pointer, size ); if ( pointer != (T*)localStorage ) util::deallocate( pointer ); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Assignment Operators /// Copy the contents from another array into this array, replacing the current contents. RIM_INLINE ShortArray& operator = ( const ShortArray& other ) { if ( this != &other ) { callDestructors( pointer, size ); if ( other.size > size ) { if ( pointer != (T*)localStorage ) util::deallocate( pointer ); if ( other.size > localCapacity ) pointer = util::allocate<T>( other.size ); else pointer = (T*)localStorage; } copyObjects( pointer, other.pointer, other.size ); size = other.size; } return *this; } /// Copy the contents from another array into this array, replacing the current contents. template < Size localCapacity2 > RIM_INLINE ShortArray<T,localCapacity>& operator = ( const ShortArray<T,localCapacity2>& other ) { if ( this != &other ) { callDestructors( pointer, size ); if ( other.size > size ) { if ( pointer != (T*)localStorage ) util::deallocate( pointer ); if ( other.size > localCapacity ) pointer = util::allocate<T>( other.size ); else pointer = (T*)localStorage; } copyObjects( pointer, other.pointer, other.size ); size = other.size; } return *this; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Array Pointer Accessor Methods /// Convert this array to a pointer and return the result. RIM_INLINE T* getPointer() { return pointer; } /// Convert this array to a pointer and return the result, const version. RIM_INLINE const T* getPointer() const { return pointer; } /// Convert this array to a pointer. RIM_INLINE operator T* () { return pointer; } /// Convert this array to a pointer, const version. RIM_INLINE operator const T* () const { return pointer; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Equality Operators /// Compare this array to another array for equality. /** * If this array has the same size as the other array and * has the same elements, the arrays are equal and TRUE is * returned. Otherwise, the arrays are not equal and FALSE is returned. */ template < Size localCapacity2 > RIM_INLINE Bool operator == ( const ShortArray<T,localCapacity2>& array ) const { if ( size != array.size ) return false; const T* compare1 = pointer; const T* compare1End = pointer + size; const T* compare2 = array.pointer; while ( compare1 != compare1End ) { if ( *compare1 != *compare2 ) return false; compare1++; compare2++; } return true; } /// Compare this array to another array for inequality. /** * If this array has a different size than the other array or * has different elements, the arrays are not equal and TRUE is * returned. Otherwise, the arrays are equal and FALSE is returned. */ template < Size localCapacity2 > RIM_INLINE Bool operator != ( const ShortArray<T,localCapacity2>& array ) const { return !(*this == array); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Array Concatenation Operators /// Concatenate the contents of this array with another array and return the resulting new array. template < Size localCapacity2 > RIM_NO_INLINE ShortArray<T,localCapacity> operator + ( const ShortArray<T,localCapacity2>& other ) const { Size newArraySize = size + other.size; T* newArray = util::allocate<T>( newArraySize ); T* destination = newArray; const T* source1 = pointer; const T* const source1End = source1 + size; const T* source2 = other.pointer; const T* const source2End = source2 + other.size; while ( source1 != source1End ) { new ( destination ) T( *source1 ); destination++; source1++; } while ( source2 != source2End ) { new ( destination ) T( *source2 ); destination++; source2++; } return ShortArray<T,localCapacity>( newArray, newArraySize ); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Array Size Accessor Methods /// Get the size of this array. RIM_INLINE Size getSize() const { return size; } /// Resize this array, copying as many elements from the old array to the new array as possible. /** * If there are new elements created at the end of the array, they are * default constructed. */ RIM_INLINE void setSize( Size newSize ) { this->setSize( newSize, T() ); } /// Resize this array, copying as many elements from the old array to the new array as possible. /** * If there are new elements created at the end of the array, they are * initialize to the specified default value. */ RIM_NO_INLINE void setSize( Size newSize, const T& prototype ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Array Element Accessor Methods /// Set all of the values in this array to the specified value. RIM_INLINE void setAll( const T& prototype ) { T* element = pointer; const T* const elementsEnd = element + size; while ( element != elementsEnd ) { *element = prototype; element++; } } private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Methods /// Call the destructors for teh specified number of objects in the given array pointer. static void callDestructors( T* array, Size number ) { const T* const arrayEnd = array + number; while ( array != arrayEnd ) { array->~T(); array++; } } /// Copy the specified number of objects from the source to the destination pointer. static void copyObjects( T* destination, const T* source, Size number ) { const T* const sourceEnd = source + number; while ( source != sourceEnd ) { new (destination) T(*source); destination++; source++; } } /// Move the specified number of objects from the source to the destination pointer, calling the previous object destructors. static void moveObjects( T* destination, const T* source, Size number ) { const T* const sourceEnd = source + number; while ( source != sourceEnd ) { new (destination) T(*source); source->~T(); destination++; source++; } } /// Initialize the specified number of objects stored at the specified pointer with their default constructor. static void initializeObjects( T* destination, Size number ) { T* const destinationEnd = destination + number; while ( destination != destinationEnd ) { new (destination) T(); destination++; } } /// Initialize the specified number of objects stored at the specified pointer as copies of the specified prototype object. static void initializeObjects( T* destination, Size number, const T& prototype ) { T* const destinationEnd = destination + number; while ( destination != destinationEnd ) { new (destination) T(prototype); destination++; } } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Members /// A pointer to the array data. T* pointer; /// The size of the array. Size size; /// An array of bytes with static size that hold the locally-stored elements in this short array. UByte localStorage[sizeof(T)*localCapacity]; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Friend Class template < typename U, Size localSize2 > friend class ShortArray; }; //########################################################################################## //########################################################################################## //############ //############ Array Size Set Method //############ //########################################################################################## //########################################################################################## template < typename T, Size localCapacity > void ShortArray<T,localCapacity>:: setSize( Size newSize, const T& prototype ) { if ( size == newSize ) return; if ( newSize < size ) callDestructors( pointer + newSize, size - newSize ); else { T* newPointer = (newSize <= localCapacity) ? (T*)localStorage : util::allocate<T>( newSize ); moveObjects( newPointer, pointer, size ); initializeObjects( newPointer + size, newSize - size, prototype ); if ( pointer != (T*)localStorage ) util::deallocate( pointer ); } size = newSize; } //########################################################################################## //*************************** End Rim Utilities Namespace ******************************** RIM_UTILITIES_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_SHORT_ARRAY_H <file_sep>/* * rimSoundFiltersConfig.h * Rim Sound * * Created by <NAME> on 6/7/08. * Copyright 2008 Rim Software. All rights reserved. * */ #ifndef INCLUDE_RIM_SOUND_FILTERS_CONFIG_H #define INCLUDE_RIM_SOUND_FILTERS_CONFIG_H #include "../rimSoundConfig.h" #include "../rimSoundUtilities.h" //########################################################################################## //########################################################################################## //############ //############ Library Namespace Configuration //############ //########################################################################################## //########################################################################################## #ifndef RIM_SOUND_FILTERS_NAMESPACE #define RIM_SOUND_FILTERS_NAMESPACE filters #endif #ifndef RIM_SOUND_FILTERS_NAMESPACE_START #define RIM_SOUND_FILTERS_NAMESPACE_START RIM_SOUND_NAMESPACE_START namespace RIM_SOUND_FILTERS_NAMESPACE { #endif #ifndef RIM_SOUND_FILTERS_NAMESPACE_END #define RIM_SOUND_FILTERS_NAMESPACE_END }; RIM_SOUND_NAMESPACE_END #endif RIM_SOUND_NAMESPACE_START /// A namespace containing simple classes which do processing on buffers of audio. namespace RIM_SOUND_FILTERS_NAMESPACE { }; RIM_SOUND_NAMESPACE_END //########################################################################################## //************************ Start Rim Sound Filters Namespace ***************************** RIM_SOUND_FILTERS_NAMESPACE_START //****************************************************************************************** //########################################################################################## using rim::sound::util::Gain; using rim::sound::util::Sample32f; using rim::sound::util::Sample64f; using rim::sound::util::ComplexSample; using rim::sound::util::SampleRate; using rim::sound::util::SampleType; using rim::sound::util::SoundBuffer; using rim::sound::util::SoundBufferQueue; using rim::sound::util::SharedBufferPool; using rim::sound::util::SharedSoundBuffer; using rim::sound::util::PanDirection; using rim::sound::util::ChannelLayout; using rim::sound::util::ChannelMixMatrix; using rim::sound::util::SoundInputStream; using rim::sound::util::SoundOutputStream; using rim::sound::util::SoundInputStream; using rim::sound::util::SoundOutputStream; using rim::sound::util::MIDIMessage; using rim::sound::util::MIDIEvent; using rim::sound::util::MIDIBuffer; using rim::sound::util::MIDITime; //########################################################################################## //************************ End Rim Sound Filters Namespace ******************************* RIM_SOUND_FILTERS_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_SOUND_FILTERS_CONFIG_H <file_sep>/* * rimSoundFilterParameter.h * Rim Sound * * Created by <NAME> on 8/21/12. * Copyright 2012 __MyCompanyName__. All rights reserved. * */ #ifndef INCLUDE_RIM_SOUND_FILTER_PARAMETER_H #define INCLUDE_RIM_SOUND_FILTER_PARAMETER_H #include "rimSoundFiltersConfig.h" #include "rimSoundFilterParameterValue.h" #include "rimSoundFilterParameterType.h" //########################################################################################## //************************ Start Rim Sound Filters Namespace ***************************** RIM_SOUND_FILTERS_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class which holds the type and value of a SoundFilter parameter. /** * The class provides ways to access the value of the generic parameter in a * type-safe manner. */ class FilterParameter { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructors /// Create a filter parameter with an undefined type and value. RIM_INLINE FilterParameter() : type( FilterParameterType::UNDEFINED ) { } /// Create a new filter parameter with the specified boolean value. RIM_INLINE FilterParameter( Bool newBoolean ) : value( newBoolean ), type( FilterParameterType::BOOLEAN ) { } /// Create a new filter parameter with the specified integer or enumeration value. RIM_INLINE FilterParameter( Int64 newInteger ) : value( newInteger ), type( FilterParameterType::INTEGER ) { } /// Create a new filter parameter with the specified float value. RIM_INLINE FilterParameter( Float32 newFloat ) : value( newFloat ), type( FilterParameterType::FLOAT ) { } /// Create a new filter parameter with the specified double value. RIM_INLINE FilterParameter( Float64 newDouble ) : value( newDouble ), type( FilterParameterType::DOUBLE ) { } /// Create a new filter parameter with the specified type and generic value union. RIM_INLINE FilterParameter( FilterParameterType newType, const FilterParameterValue& newValue ) : value( newValue ), type( newType ) { } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Parameter Type Accessor Methods /// Return the actual type of this filter parameter. RIM_INLINE FilterParameterType getType() const { return type; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Value Read Methods /// Read this filter parameter as a boolean value. /** * If the conversion succeeds, TRUE is returned. Otherwise, if the conversion fails, * FALSE is returned and no output is converted. */ RIM_INLINE Bool getValue( Bool& output ) const { return value.getValueAsType( type, output ); } /// Read this filter parameter as an integer value. /** * If the conversion succeeds, TRUE is returned. Otherwise, if the conversion fails, * FALSE is returned and no output is converted. */ RIM_INLINE Bool getValue( Int64& output ) const { return value.getValueAsType( type, output ); } /// Read this filter parameter as a float value. /** * If the conversion succeeds, TRUE is returned. Otherwise, if the conversion fails, * FALSE is returned and no output is converted. */ RIM_INLINE Bool getValue( Float32& output ) const { return value.getValueAsType( type, output ); } /// Read this filter parameter as a double value. /** * If the conversion succeeds, TRUE is returned. Otherwise, if the conversion fails, * FALSE is returned and no output is converted. */ RIM_INLINE Bool getValue( Float64& output ) const { return value.getValueAsType( type, output ); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Value Write Methods /// Write this filter parameter as a boolean value. /** * If the conversion succeeds, TRUE is returned. Otherwise, if the conversion fails, * FALSE is returned and no value is set. */ RIM_INLINE Bool setValue( Bool output ) { return value.setValueAsType( type, output ); } /// Write this filter parameter as an integer or enumeration value. /** * If the conversion succeeds, TRUE is returned. Otherwise, if the conversion fails, * FALSE is returned and no value is set. */ RIM_INLINE Bool setValue( Int64 output ) { return value.setValueAsType( type, output ); } /// Write this filter parameter as a float value. /** * If the conversion succeeds, TRUE is returned. Otherwise, if the conversion fails, * FALSE is returned and no value is set. */ RIM_INLINE Bool setValue( Float32 output ) { return value.setValueAsType( type, output ); } /// Write this filter parameter as a double value. /** * If the conversion succeeds, TRUE is returned. Otherwise, if the conversion fails, * FALSE is returned and no value is set. */ RIM_INLINE Bool setValue( Float64 output ) { return value.setValueAsType( type, output ); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Value String Representation Accessor Methods /// Return a string representation of this parameter's value. UTF8String toString() const; /// Return a string representation of this parameter's value. RIM_INLINE operator UTF8String () const { return this->toString(); } private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Members /// An object which stores the data representation of this parameter. FilterParameterValue value; /// The actual type of this filter parameter. FilterParameterType type; }; //########################################################################################## //************************ End Rim Sound Filters Namespace ******************************* RIM_SOUND_FILTERS_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_SOUND_FILTER_PARAMETER_H <file_sep>/* * rimGUIInputKey.h * Rim GUI * * Created by <NAME> on 1/30/08. * Copyright 2008 __MyCompanyName__. All rights reserved. * */ #ifndef INCLUDE_RIM_GUI_INPUT_KEY_H #define INCLUDE_RIM_GUI_INPUT_KEY_H #include "rimGUIInputConfig.h" //########################################################################################## //************************ Start Rim GUI Input Namespace *************************** RIM_GUI_INPUT_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class which represents a single key on a keyboard. /** * Each Key object has an integeral key code for that key, plus a * human-readable name string for that key. * * This class also provides statically-defined Key objects that encompass * most types of keyboards. These objects can be queried directly as public * static members or by hash table key code lookup. */ class Key { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Public Type Definitions /// The type to use for a key code. typedef UInt Code; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructors /// Create a key with an undefind code and name. RIM_INLINE Key() : code( UNKNOWN.getCode() ), name( UNKNOWN.getName() ) { } /// Create a key with the specified code and name string. RIM_INLINE Key( Code keyCode, const String& keyName ) : code( keyCode ), name( keyName ) { } /// Create a key with the specified code and name string. RIM_INLINE Key( Code keyCode, const Char* keyName ) : code( keyCode ), name( keyName ) { } /// Return a const reference to this key's name string. RIM_INLINE const String& getName() const { return name; } RIM_INLINE Code getCode() const { return code; } RIM_INLINE Hash getHashCode() const { return (Hash)code; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Key String Conversion Methods /// Return a const reference to this key's string representation (its name). RIM_INLINE const String& toString() const { return name; } /// Convert this key to a string representation (its name). RIM_INLINE operator String () const { return name; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Equality Comparison Operators /// Return whether or not this key is equal to another key. RIM_INLINE Bool operator == ( const Key& key ) const { return code == key.code; } /// Return whether or not this key is not equal to another key. RIM_INLINE Bool operator != ( const Key& key ) const { return code != key.code; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Static Key Accessor Methods /// Return a const reference to the statically-defined key with the specified code. static const Key& getKeyWithCode( Code keyCode ); /// Return a const reference to a list of all statically-defined keys. RIM_INLINE static const ArrayList<const Key*>& getKeys() { if ( !keyDataStructuresAreInitialized ) initializeKeyDataStructures(); return keys; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Statically Defined Unknown Key static const Key UNKNOWN; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Statically Defined Letter Keys static const Key A; static const Key B; static const Key C; static const Key D; static const Key E; static const Key F; static const Key G; static const Key H; static const Key I; static const Key J; static const Key K; static const Key L; static const Key M; static const Key N; static const Key O; static const Key P; static const Key Q; static const Key R; static const Key S; static const Key T; static const Key U; static const Key V; static const Key W; static const Key X; static const Key Y; static const Key Z; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Statically Defined Number Keys static const Key NUMBER_0; static const Key NUMBER_1; static const Key NUMBER_2; static const Key NUMBER_3; static const Key NUMBER_4; static const Key NUMBER_5; static const Key NUMBER_6; static const Key NUMBER_7; static const Key NUMBER_8; static const Key NUMBER_9; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Statically Defined Punctuation Keys static const Key QUOTE; static const Key COMMA; static const Key HYPHEN; static const Key PERIOD; static const Key SLASH; static const Key SEMICOLON; static const Key EQUALS; static const Key OPEN_BRACKET; static const Key CLOSE_BRACKET; static const Key BACKSLASH; static const Key TILDE; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Statically Defined Keypad Keys static const Key KEYPAD_0; static const Key KEYPAD_1; static const Key KEYPAD_2; static const Key KEYPAD_3; static const Key KEYPAD_4; static const Key KEYPAD_5; static const Key KEYPAD_6; static const Key KEYPAD_7; static const Key KEYPAD_8; static const Key KEYPAD_9; static const Key KEYPAD_PERIOD; static const Key KEYPAD_SLASH; static const Key KEYPAD_ASTERISK; static const Key KEYPAD_HYPHEN; static const Key KEYPAD_PLUS; static const Key KEYPAD_ENTER; static const Key KEYPAD_EQUALS; static const Key KEYPAD_COMMA; static const Key KEYPAD_EQUALS_AS400; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Statically Defined Keystate Modifier Keys static const Key NUM_LOCK; static const Key CAPS_LOCK; static const Key SCROLL_LOCK; static const Key LEFT_SHIFT; static const Key RIGHT_SHIFT; static const Key LEFT_CONTROL; static const Key RIGHT_CONTROL; static const Key LEFT_ALT; static const Key RIGHT_ALT; static const Key LEFT_GUI; static const Key RIGHT_GUI; static const Key LOCKING_CAPS_LOCK; static const Key LOCKING_NUM_LOCK; static const Key LOCKING_SCROLL_LOCK; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Statically Defined Arrow Keys static const Key UP_ARROW; static const Key DOWN_ARROW; static const Key LEFT_ARROW; static const Key RIGHT_ARROW; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Statically Defined Basic Function Keys static const Key BACKSPACE; static const Key DELETE; static const Key TAB; static const Key CLEAR; static const Key RETURN; static const Key PAUSE; static const Key ESCAPE; static const Key SPACE; static const Key ALTERNATE_ERASE; static const Key ALTERNATE_RETURN; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Statically Defined Miscellaneous Function Keys static const Key HELP; static const Key PRINT; static const Key SYS_REQ; static const Key MENU; static const Key POWER; static const Key UNDO; static const Key INSERT; static const Key HOME; static const Key END; static const Key PAGE_UP; static const Key PAGE_DOWN; static const Key APPLICATION; static const Key EXECUTE; static const Key SELECT; static const Key STOP; static const Key AGAIN; static const Key VOLUME_UP; static const Key VOLUME_DOWN; static const Key VOLUME_MUTE; static const Key CANCEL; static const Key PRIOR; static const Key SEPARATOR; static const Key OUT; static const Key OPERATE; static const Key CLEAR_OR_AGAIN; static const Key CR_SEL_OR_PROPS; static const Key EX_SEL; static const Key CUT; static const Key COPY; static const Key PASTE; static const Key FIND; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Statically Defined Programmable Function Keys static const Key F1; static const Key F2; static const Key F3; static const Key F4; static const Key F5; static const Key F6; static const Key F7; static const Key F8; static const Key F9; static const Key F10; static const Key F11; static const Key F12; static const Key F13; static const Key F14; static const Key F15; static const Key F16; static const Key F17; static const Key F18; static const Key F19; static const Key F20; static const Key F21; static const Key F22; static const Key F23; static const Key F24; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Statically Defined International Keys static const Key INTERNATIONAL_1; static const Key INTERNATIONAL_2; static const Key INTERNATIONAL_3; static const Key INTERNATIONAL_4; static const Key INTERNATIONAL_5; static const Key INTERNATIONAL_6; static const Key INTERNATIONAL_7; static const Key INTERNATIONAL_8; static const Key INTERNATIONAL_9; static const Key LANGUAGE_1; static const Key LANGUAGE_2; static const Key LANGUAGE_3; static const Key LANGUAGE_4; static const Key LANGUAGE_5; static const Key LANGUAGE_6; static const Key LANGUAGE_7; static const Key LANGUAGE_8; static const Key LANGUAGE_9; static const Key NON_US_POUND; static const Key NON_US_BACKSLASH; private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Static Key Data Structure Initializer Methods /// Add the specified key to the statically-defined key data structures. RIM_NO_INLINE static void addKeyToDataStructures( const Key& key ) { keys.add( &key ); keyMap.add( (Hash)key.getCode(), key.getCode(), &key ); } /// Initialize the statically-defined key data structures. static void initializeKeyDataStructures(); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Members /// An integer value which represents this key. Code code; /// A human-readable string representation for this key. String name; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Static Data Members /// A map from statically defined key codes to key objects. static HashMap<Code,const Key*> keyMap; /// A list of all statically defined keys. static ArrayList<const Key*> keys; /// A boolean indicating whether or not the static key data structures have been initialized. static Bool keyDataStructuresAreInitialized; }; //########################################################################################## //************************ End Rim GUI Input Namespace ***************************** RIM_GUI_INPUT_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_GUI_INPUT_KEY_H <file_sep>/* * rimGraphicsShaderType.h * Rim Graphics * * Created by <NAME> on 3/7/13. * Copyright 2013 __MyCompanyName__. All rights reserved. * */ #ifndef INCLUDE_RIM_GRAPHICS_SHADER_TYPE_H #define INCLUDE_RIM_GRAPHICS_SHADER_TYPE_H #include "rimGraphicsShadersConfig.h" //########################################################################################## //*********************** Start Rim Graphics Shaders Namespace *************************** RIM_GRAPHICS_SHADERS_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class which specifies a kind of Shader. /** * The type specified here is used to determine the kinds of operations that a * shader can perform, as well as how it may be structured (inputs/outputs). */ class ShaderType { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Vertex Attribute Buffer Usage Enum Definition /// An enum type which represents the type for a shader. typedef enum Enum { /// An undefined shader type. UNDEFINED = 0, /// A shader that handles processing of individual vertices. /** * This allows transformations and other operations to be * performed on a per-vertex basis. */ VERTEX, /// A shader that is executed for each output fragment (pixel) for a primitive. /** * This allows shading and other operations to be performed on * a per-pixel basis. The output of the fragment shader is the * final color value sent to the render target. */ FRAGMENT, /// A shader that takes an input primitive (i.e. triangles) and outputs 0 or more output primitives. /** * This allows things like geometry instancing. */ GEOMETRY, /// A shader that tessellates primitives into smaller primitives. /** * This allows additional geometric complexity to be generated * in the shader. */ TESSELLATION }; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructors /// Create a new shader type with the ShaderType::UNDEFINED type. RIM_INLINE ShaderType() : type( UNDEFINED ) { } /// Create a new shader type with the specified type enum value. RIM_INLINE ShaderType( Enum newType ) : type( newType ) { } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Enum Cast Operator /// Convert this shader type to an enum value. RIM_INLINE operator Enum () const { return type; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** String Representation Accessor Methods /// Return a shader type which corresponds to the given enum string. static ShaderType fromEnumString( const String& enumString ); /// Return a unique string for this shader type that matches its enum value name. String toEnumString() const; /// Return a string representation of the shader type. String toString() const; /// Convert this shader type into a string representation. RIM_INLINE operator String () const { return this->toString(); } private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Members /// An enum value for the shader type. Enum type; }; //########################################################################################## //*********************** End Rim Graphics Shaders Namespace ***************************** RIM_GRAPHICS_SHADERS_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_GRAPHICS_SHADER_TYPE_H <file_sep>/* * rimEntityEngine.h * Rim Software * * Created by <NAME> on 6/17/14. * Copyright 2014 __MyCompanyName__. All rights reserved. * */ #ifndef INCLUDE_RIM_ENTITY_ENGINE_H #define INCLUDE_RIM_ENTITY_ENGINE_H #include "rimEntitiesConfig.h" #include "rimEntityEvent.h" #include "rimEntity.h" #include "rimEntitySystem.h" //########################################################################################## //************************** Start Rim Entities Namespace ******************************** RIM_ENTITIES_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A collection of EntitySystem objects that operate on a set of entities and their components. class EntityEngine { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructors /// Create a new empty entity engine with no entity systems or entities. EntityEngine(); /// Create a copy of another entity engine. EntityEngine( const EntityEngine& other ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Destructor /// Destroy this entity engine, releasing all internal resources. virtual ~EntityEngine(); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Assignment Operator /// Assign the entire state of one entity engine to this one. virtual EntityEngine& operator = ( const EntityEngine& other ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Engine Update Method /// Update the state of all systems in this engine for the specified time interval. virtual void update( const Time& dt ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Entity Accessor Methods /// Return the total number of entities that are a part of this entity engine. virtual Size getEntityCount() const; /// Return whether or not this engine is using the specified entity. virtual Bool containsEntity( const Pointer<Entity>& entity ) const; /// Return whether or not this engine is using the entity with the specified name. virtual Bool containsEntity( const String& entityName ) const; /// Add an entity with no name to this engine. /** * The method returns whether or not the entity was successfully added. */ virtual Bool addEntity( const Pointer<Entity>& entity ); /// Add an entity with the specified name to this engine. /** * The method returns whether or not the entity was successfully added. */ virtual Bool addEntity( const Pointer<Entity>& entity, const String& entityName ); /// Remove the specified entity from this engine. /** * The method returns whether or not the entity was successfully removed. */ virtual Bool removeEntity( const Pointer<Entity>& entity ); /// Remove the entity with the specified name from this engine. /** * The method returns whether or not the entity was successfully removed. */ virtual Bool removeEntity( const String& entityName ); /// Remove all entities from this engine and all associated systems. virtual void clearEntities(); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** System Accessor Methods /// Return the number of entity systems there are in this engine. virtual Size getSystemCount() const; /// Return a pointer to the system with the specified name in this engine. virtual Pointer<EntitySystem> getSystem( const String& systemName ) const; /// Return whether or not this engine contains an entity system with the specified name. virtual Bool containsSystem( const String& systemName ) const; /// Return whether or not this engine contains the specified system. virtual Bool containsSystem( const Pointer<EntitySystem>& system ) const; /// Add a system to this entity engine with no name. /** * The method returns whether or not the given system was able to be added to the engine. * The method can fail if the system pointer is NULL. * * The system is associated with entities containing any component type, * i.e. all entities are given to the system. */ virtual Bool addSystem( const Pointer<EntitySystem>& system ); /// Add a system to this entity engine with the specified name. /** * The method returns whether or not the given system was able to be added to the engine. * The method can fail if the system pointer is NULL. If there is already a system * with the given name, the new system replaces the old one and the old system is removed. * * The system is associated with entities containing any component type, * i.e. all entities are given to the system. */ virtual Bool addSystem( const Pointer<EntitySystem>& system, const String& systemName ); /// Remove the system in this engine with the given name. /** * The method returns whether or not a system with that name * was able to be removed. */ virtual Bool removeSystem( const String& systemName ); /// Remove the system in this engine with the given pointer. /** * The method returns whether or not a system with that name * was able to be removed. */ virtual Bool removeSystem( const Pointer<EntitySystem>& system ); /// Remove all entity systems from this engine. /** * The entities in the engine are unaffected. */ virtual void clearSystems(); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Event Accessor Methods /// Return a pointer to the list of events for the specified event type in the engine. virtual const ArrayList<const Event*>* getEvents( const EventType& eventType ) const; /// Post the specified entity event to this engine, propagating it to all systems that want it. virtual Bool postEvent( const Event& newEvent ); /// Remove all previously posted events from this engine. virtual void clearEvents(); private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Class Declarations /// A class that stores information about a single entity system in an engine. class SystemInfo; /// A class that encapsulates information about an entity in this engine. class EntityInfo; /// A class that stores information about a singe type of event in this engine. class EventTypeInfo; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Helper Functions /// Create and return a pointer to a new entity info object for the specified entity. const Pointer<EntityInfo>& newEntityInfo( const Pointer<Entity>& entity ); /// Create and return a pointer to a new entity info object for the specified named entity. const Pointer<EntityInfo>& newEntityInfo( const Pointer<Entity>& entity, const String& entityName ); /// Add the specified system to the list of systems for the given event type Bool addSystemEventType( const EventType& eventType, const Pointer<SystemInfo>& system ); /// Remove the specified system to the list of systems for the given event type Bool removeSystemEventType( const EventType& eventType, const Pointer<SystemInfo>& system ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Members /// A map from system names to pointers to info objects for those systems. HashMap<String,Pointer<SystemInfo> > systemNameMap; /// A map from system pointers to pointers to info objects for those systems. HashMap< Pointer<EntitySystem>, Pointer<SystemInfo> > systemMap; /// A map from entity names to information about the entities. HashMap< String, Pointer<EntityInfo> > entityNameMap; /// A map from entities to information about the entities. HashMap< Pointer<Entity>, Pointer<EntityInfo> > entityMap; /// A list of information for all of the entities in this engine. ArrayList< Pointer<EntityInfo> > entities; /// A list of entity indices that were previously used but no longer. ArrayList<Index> unusedEntityIndices; /// A map from event types to the info objects associated with those types. HashMap< EventType, Pointer<EventTypeInfo> > eventTypeMap; /// A list of the events that are currently being processed by the engine on the current frame. ArrayList<Event> events; }; //########################################################################################## //************************** End Rim Entities Namespace ********************************** RIM_ENTITIES_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_ENTITY_ENGINE_H <file_sep>/* * rimGraphicsBlendMode.h * Rim Graphics * * Created by <NAME> on 3/13/13. * Copyright 2013 __MyCompanyName__. All rights reserved. * */ #ifndef INCLUDE_RIM_GRAPHICS_BLEND_MODE_H #define INCLUDE_RIM_GRAPHICS_BLEND_MODE_H #include "rimGraphicsUtilitiesConfig.h" #include "rimGraphicsBlendFactor.h" #include "rimGraphicsBlendFunction.h" //########################################################################################## //********************** Start Rim Graphics Utilities Namespace ************************** RIM_GRAPHICS_UTILITIES_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class which specifies how blending should be performed between a source and destination fragment. class BlendMode { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructors /// Create a new blend mode with the default blending parameters. /** * The default blend mode is SOURCE_ALPHA for the source factor, * INVERSE_SOURCE_ALPHA for the destination factor, and a blend * function of ADD. */ RIM_INLINE BlendMode() : sourceFactor( BlendFactor::SOURCE_ALPHA ), destinationFactor( BlendFactor::INVERSE_SOURCE_ALPHA ), function( BlendFunction::ADD ), constantColor() { } /// Create a new blend mode with the given source and destination blend factors and blend function. RIM_INLINE BlendMode( BlendFactor newSourceFactor, BlendFactor newDestinationFactor, BlendFunction newFunction ) : sourceFactor( newSourceFactor ), destinationFactor( newDestinationFactor ), function( newFunction ), constantColor() { } /// Create a new blend mode with the given source and destination blend factors, blend function, and color. RIM_INLINE BlendMode( BlendFactor newSourceFactor, BlendFactor newDestinationFactor, BlendFunction newFunction, const Color4f& newConstantColor ) : sourceFactor( newSourceFactor ), destinationFactor( newDestinationFactor ), function( newFunction ), constantColor( newConstantColor ) { } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Source Factor Accessor Methods /// Return an object which describes the source color blend factor for this blend mode. RIM_INLINE const BlendFactor& getSource() const { return sourceFactor; } /// Set the source color blend factor for this blend mode. RIM_INLINE void setSource( const BlendFactor& newSource ) { sourceFactor = newSource; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Destination Factor Accessor Methods /// Return an object which describes the destination color blend factor for this blend mode. RIM_INLINE const BlendFactor& getDestination() const { return destinationFactor; } /// Set the destination color blend factor for this blend mode. RIM_INLINE void setDestination( const BlendFactor& newDestination ) { destinationFactor = newDestination; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Blend Function Accessor Methods /// Return an object which describes the blending function used by this blend mode. RIM_INLINE const BlendFunction& getFunction() const { return function; } /// Set the blending function used by this blend mode. RIM_INLINE void setFunction( const BlendFunction& newFunction ) { function = newFunction; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constant Color Accessor Methods /// Return a constant color value which may be used as a blending factor in some operations. RIM_INLINE const Color4f& getConstantColor() const { return constantColor; } /// Set a constant color value which may be used as a blending factor in some operations. RIM_INLINE void setConstantColor( const Color4f& newConstantColor ) { constantColor = newConstantColor; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Comparison Operators /// Return whether or not this blend mode is equal to another blend mode. RIM_INLINE Bool operator == ( const BlendMode& other ) const { return sourceFactor == other.sourceFactor && destinationFactor == other.destinationFactor && function == other.function && constantColor == other.constantColor; } /// Return whether or not this blend mode is not equal to another blend mode. RIM_INLINE Bool operator != ( const BlendMode& other ) const { return !(*this == other); } private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Members /// An object which describes the blend factor for the source pixel color. BlendFactor sourceFactor; /// An object which describes the blend factor for the destination pixel color. BlendFactor destinationFactor; /// An object which describes the operation applied between the source and destionation blend factors. BlendFunction function; /// A constant color value which may be used as a blending factor in some operations. Color4f constantColor; }; //########################################################################################## //********************** End Rim Graphics Utilities Namespace **************************** RIM_GRAPHICS_UTILITIES_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_GRAPHICS_BLEND_MODE_H <file_sep>/* * rimGain.h * Rim Sound * * Created by <NAME> on 3/3/12. * Copyright 2012 __MyCompanyName__. All rights reserved. * */ #ifndef INCLUDE_RIM_GAIN_H #define INCLUDE_RIM_GAIN_H #include "rimSoundUtilitiesConfig.h" //########################################################################################## //*********************** Start Rim Sound Utilities Namespace **************************** RIM_SOUND_UTILITIES_NAMESPACE_START //****************************************************************************************** //########################################################################################## /// Define the type to represent a linear gain coefficient. typedef Float32 Gain; /// Convert the specfied linear gain ratio to a logarithmic gain in decibels. RIM_FORCE_INLINE Gain linearToDB( Gain linearGain ) { return Gain(20)*math::log10( linearGain ); } /// Convert the specfied logarithmic gain in decibels to a linear gain ratio. RIM_FORCE_INLINE Gain dbToLinear( Gain dbGain ) { return math::pow( Gain(10), dbGain/Gain(20) ); } //########################################################################################## //*********************** End Rim Sound Utilities Namespace ****************************** RIM_SOUND_UTILITIES_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_GAIN_H <file_sep>/* * rimSoundSharedBufferPool.h * Rim Sound * * Created by <NAME> on 12/1/12. * Copyright 2012 __MyCompanyName__. All rights reserved. * */ #ifndef INCLUDE_RIM_SOUND_SHARED_BUFFER_POOL_H #define INCLUDE_RIM_SOUND_SHARED_BUFFER_POOL_H #include "rimSoundUtilitiesConfig.h" #include "rimSoundBuffer.h" #include "rimSoundSharedBufferInfo.h" #include "rimSoundSharedSoundBuffer.h" //########################################################################################## //*********************** Start Rim Sound Utilities Namespace **************************** RIM_SOUND_UTILITIES_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class which provides a pool of thread-safe temporary SoundBuffer objects for efficient DSP processing. /** * Often when doing DSP, a temporary buffer of sound samples is needed for intermediate * processing. This class provides a way for DSP classes to access a reference to a * temporary buffer that is shared among them. These buffers are locked for use when requested * and unlocked when the returned SharedSoundBuffer goes out of scope. * * When requesting a buffer, the user can specify the attributes of that buffer, * and the buffer pool will return a buffer (creating one if necessary) that matches * those characteristics. */ class SharedBufferPool { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructors /// Create a new empty shared buffer pool. RIM_INLINE SharedBufferPool() { } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Buffer Accessor Methods /// Return a handle to a shared sound buffer. /** * This method looks at the available buffers in the pool and returns the first one, * ignoring its format. It then locks that buffer and returns a handle to it. * When that handle is destructed, the buffer is reclaimed by the pool and can no longer be used. */ SharedSoundBuffer getBuffer(); /// Return a handle to a shared sound buffer with the specified attributes. /** * This method looks at the available buffers in the pool and picks one that * matches the requested number of channels, number of samples, and sample rate. * It then locks that buffer and returns a handle to it. When that handle is destructed, * the buffer is reclaimed by the pool and can no longer be used. */ SharedSoundBuffer getBuffer( Size numChannels, Size numSamples, SampleRate sampleRate ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Pool Management Methods /// Clear all buffers from this buffer pool that are not in use. void reset(); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Global Buffer Accessor Methods /// Return a handle to a shared global sound buffer. RIM_INLINE static SharedSoundBuffer getGlobalBuffer() { return staticPool->getBuffer(); } /// Return a handle to a shared global sound buffer with the specified attributes. RIM_INLINE static SharedSoundBuffer getGlobalBuffer( Size numChannels, Size numSamples, SampleRate sampleRate ) { return staticPool->getBuffer( numChannels, numSamples, sampleRate ); } /// Clear all buffers from the global buffer pool that are not in use. RIM_INLINE static void globalReset() { staticPool->reset(); } private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Static Data Members /// A pointer to a global shared buffer pool. static SharedBufferPool* staticPool; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Members /// A list of the buffers that are a part of this shared buffer pool. ArrayList<SharedBufferInfo*> buffers; /// A mutex which prevents concurrent access to the list of shared buffers. Mutex bufferMutex; }; //########################################################################################## //*********************** End Rim Sound Utilities Namespace ****************************** RIM_SOUND_UTILITIES_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_SOUND_SHARED_BUFFER_POOL_H <file_sep>/* * rimGraphicsContext.h * Rim Graphics * * Created by <NAME> on 3/1/13. * Copyright 2013 __MyCompanyName__. All rights reserved. * */ #ifndef INCLUDE_RIM_GRAPHICS_CONTEXT_H #define INCLUDE_RIM_GRAPHICS_CONTEXT_H #include "rimGraphicsDevicesConfig.h" #include "../rimGraphicsBase.h" #include "rimGraphicsContextCapabilities.h" //########################################################################################## //*********************** Start Rim Graphics Devices Namespace *************************** RIM_GRAPHICS_DEVICES_NAMESPACE_START //****************************************************************************************** //########################################################################################## using rim::gui::RenderView; //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class which represents an instance of a graphics device renderer. /** * Specialized implementations inherit from this interface to provide * a way to provide uniform access to their underlying drivers. For instance, * there could be a class OpenGLContext which inherits from GraphicsContext * and represents an OpenGL device driver context. */ class GraphicsContext { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Destructor /// Destroy a graphics context, releasing all of its resources and internal state. virtual ~GraphicsContext() { } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Target View Accessor Methods /// Return a pointer to the target render view which this context should render to. /** * This view represents the area on the screen which this context is * rendering to. If this method returns NULL, it means that there is * no target render view and therefore the context will not be able * to render anything. */ virtual Pointer<RenderView> getTargetView() const = 0; /// Set the target render view which this context should render to. /** * This method effectively recreates the context for the given render view. * * Calling this method automatically resizes the context's viewport to * fill the entire area of the specified target render view. The method * returns whether or not the target view was successfully changed. * The method will fail if the specified view pointer is NULL. */ virtual Bool setTargetView( const Pointer<RenderView>& newTargetView ) = 0; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Context Validity Accessor Method /// Return whether or not this context is valid and can be used for rendering. /** * Users should check the return value of this method after context creation * to ensure that the context was successfully created. */ virtual Bool isValid() const = 0; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Context Capabilities Accessor Methods /// Return an object which describes the different capabilities of this graphics context. virtual const GraphicsContextCapabilities& getCapabilities() const = 0; /// Return whether or not this graphics context supports the specified capabilities. /** * This method allows testing for multiple capabilities at once. The function * returns TRUE only if all of the specified capability flags are set. */ RIM_INLINE Bool hasCapabilities( const GraphicsContextCapabilities& capabilities ) { return (this->getCapabilities() & capabilities) == capabilities; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Current Context Accessor Methods /// Return whether or not this context is the current context for the calling thread. virtual Bool isCurrent() = 0; /// Make this context the active context for the calling thread. /** * If the method fails and this context is not able to be made the current * context, FALSE is returned. Otherwise, TRUE is returned indicating success. */ virtual Bool makeCurrent() = 0; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Buffer Swap Method /// Flush all rendering commands and swap the front buffer with the back buffer. /** * This has the effect of displaying the frame which was just drawn * using the context. In practice, the user should call this method * after drawing each frame using the context. If v-sync is enabled, this method * waits until the next vertical screen refresh to copy the front buffer * to the back buffer. * * If the context is single-buffered, this method has no effect. */ virtual void swapBuffers() = 0; /// Return whether or not vertical screen refresh synchronization is enabled. virtual Bool getVSyncIsEnabled() const = 0; /// Set whether or not vertical screen refresh synchronization should be enabled. /** * The method returns whether or not setting the V-Sync status was successful. */ virtual Bool setVSyncIsEnabled( Bool newVSync ) = 0; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Flush Methods /// Flush all rendering commands into the graphics pipeline. /** * This method can be called to force all queued rendering commands * to be executed immediately by the context. */ virtual void flush() = 0; /// Flush all rendering commands into the graphics pipeline and wait until they are complete. /** * This method can be called to force all queued rendering commands * to be executed immediately by the context. The method waits until * all of the queued commands are executed and finish executing, * then returns. */ virtual void finish() = 0; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Render Mode Accessor Methods /// Return an object which contains information about the current state of the context's renderer. /** * A context's render mode encapsulates various attributes of the fixed-function * graphics pipeline, such as the blending mode, depth mode, and stencil * mode. */ virtual RenderMode getRenderMode() const = 0; /// Set the mode of the context's renderer. /** * If the method succeeds, the render mode of the context's graphics pipeline * is set to have the requested state and TRUE is returned. Otherwise, if * some part of the state was unable to be applied, FALSE is returned. */ virtual Bool setRenderMode( const RenderMode& newRenderMode ) = 0; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Render Flags Accessor Methods /// Return an object which contains boolan flags for the current state of the context's renderer. /** * These flags indicate the enabled/disabled state for various parts * of the fixed-function graphics pipeline. */ virtual RenderFlags getRenderFlags() const = 0; /// Set an object which contains boolan flags for the current state of the context's renderer. /** * If the method succeeds, the render flags of the context's graphics pipeline * are set to have the requested state and TRUE is returned. Otherwise, if * some part of the state was unable to be applied, FALSE is returned. */ virtual Bool setRenderFlags( const RenderFlags& newRenderFlags ) = 0; /// Return whether or not a certain render flag is currently set. virtual Bool getRenderFlagIsSet( RenderFlags::Flag flag ) const = 0; /// Set whether or not a certain render flag should be set. /** * If the method succeeds, the render flags of the context's graphics pipeline * are set so that the given flag has the specified value and TRUE is returned. * Otherwise, if the state was unable to be applied, FALSE is returned. */ virtual Bool setRenderFlag( RenderFlags::Flag flag, Bool value = true ) = 0; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Depth Mode Accessor Methods /// Return an object which contains information about the current state of the context's depth test pipeline. virtual DepthMode getDepthMode() const = 0; /// Set the mode of the context's depth test pipeline. /** * If the method succeeds, the depth mode of the context's graphics pipeline * is set to have the requested state and TRUE is returned. Otherwise, if * some part of the state was unable to be applied, FALSE is returned. */ virtual Bool setDepthMode( const DepthMode& newDepthMode ) = 0; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Stencil Mode Accessor Methods /// Return an object which contains information about the current state of the context's stencil test pipeline. virtual StencilMode getStencilMode() const = 0; /// Set the mode of the context's stencil test pipeline. /** * If the method succeeds, the stencil mode of the context's graphics pipeline * is set to have the requested state and TRUE is returned. Otherwise, if * some part of the state was unable to be applied, FALSE is returned. */ virtual Bool setStencilMode( const StencilMode& newStencilMode ) = 0; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Blend Mode Accessor Methods /// Return an object which contains information about the current state of the context's blending pipeline. virtual BlendMode getBlendMode() const = 0; /// Set the mode of the context's blending pipeline. /** * If the method succeeds, the blending mode of the context's graphics pipeline * is set to have the requested state and TRUE is returned. Otherwise, if * some part of the state was unable to be applied, FALSE is returned. */ virtual Bool setBlendMode( const BlendMode& newBlendMode ) = 0; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Line Width Accessor Methods /// Return the width in pixels to use when rendering lines. virtual Float getLineWidth() const = 0; /// Set the width in pixels to use when rendering lines. /** * If the method succeeds, the line width of the context's graphics pipeline * is set to have the requested size in pixels and TRUE is returned. Otherwise, if * the line width was unable to be set, FALSE is returned. */ virtual Bool setLineWidth( Float newLineWidth ) = 0; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Point Size Accessor Methods /// Return the size in pixels to use when rendering points. virtual Float getPointSize() const = 0; /// Set the size in pixels to use when rendering points. /** * If the method succeeds, the point size of the context's graphics pipeline * is set to have the requested size in pixels and TRUE is returned. Otherwise, if * the point size was unable to be set, FALSE is returned. */ virtual Bool setPointSize( Float newPointSize ) = 0; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Viewport Accessor Methods /// Return an object representing the current viewport for this graphics context. /** * This is the rectangular area of the context's target view which is being rendered to * by the context. Coordinates are specified where (0,0) is the lower left-corner of the * screen, and (1,1) is the upper-right corner. */ virtual Viewport getViewport() const = 0; /// Set the viewport to use for this graphics context. /** * This is the rectangular area of the context's target view which is being rendered to * by the context. Coordinates are specified where (0,0) is the lower left-corner of the * screen, and (1,1) is the upper-right corner. * * The method returns whether or not the viewport change operation was successful. */ virtual Bool setViewport( const Viewport& newViewport ) = 0; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Scissor Test Accessor Methods /// Return an object representing the current scissor test for this graphics context. /** * This is the rectangular area of the context's target view which is being rendered to * by the context. The scissor rectangle allows the user to clip rendering to a * rectangular region within a viewport without affecting the screen-space viewport transformation. * * Coordinates are specified where (0,0) is the lower left-corner of the * screen, and (1,1) is the upper-right corner. */ virtual ScissorTest getScissorTest() const = 0; /// Set an object representing the current scissor test for this graphics context. /** * This is the rectangular area of the context's target view which is being rendered to * by the context. The scissor rectangle allows the user to clip rendering to a * rectangular region within a viewport without affecting the screen-space viewport transformation. * * Coordinates are specified where (0,0) is the lower left-corner of the * screen, and (1,1) is the upper-right corner. * * The method returns whether or not the scissor test change operation was successful. */ virtual Bool setScissorTest( const ScissorTest& newScissorTest ) = 0; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Framebuffer Clearing Methods /// Clear the contents of the color buffer, writing the specified color to every pixel. virtual void clearColorBuffer( const Color4d& clearColor ) = 0; /// Clear the contents of the depth buffer, writing the specified depth to every pixel. virtual void clearDepthBuffer( Double clearDepth ) = 0; /// Clear the contents of the stencil buffer, writing the specified integer value to every pixel. /** * This integer value is masked so that the final N-bit stencil value contains the lower-order * N bits of the specified integer. */ virtual void clearStencilBuffer( Int clearStencil ) = 0; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Framebuffer Read Methods /// Read an image corresponding to the entire contents of the context's current color buffer. /** * The color buffer is read from and its contents are placed in the output image parameter * with the specified pixel type. If the pixel type is incompatible with the framebuffer * format, or if the read operation failed, FALSE is returned and no image is retrieved. * Otherwise, TRUE is returned and the method succeeds. */ virtual Bool readColorBuffer( const PixelFormat& pixelType, Image& image ) const = 0; /// Read an image corresponding to the specified contents of the context's current color buffer. /** * The color buffer is read from and its contents are placed in the output image parameter * with the specified pixel type. If the pixel type is incompatible with the framebuffer * format, or if the read operation failed, FALSE is returned and no image is retrieved. * Otherwise, TRUE is returned and the method succeeds. * * This method reads the framebuffer pixels that are in the given bounding box and * creates an image with the width and height of the box. Coordinates are specified so that * (0,0) is the lower left corner of the context. If the bounding box is outside the * range of the framebuffer, it is clamped to the edge of the framebuffer. */ virtual Bool readColorBuffer( const PixelFormat& pixelType, Image& image, const AABB2i& bounds ) const = 0; /// Read an image corresponding to the entire contents of the context's current depth buffer. /** * The depth buffer is read from and its contents are placed in the output image parameter * with the specified pixel type. If the pixel type is incompatible with the depthframebuffer * format, or if the read operation failed, FALSE is returned and no image is retrieved. * Otherwise, TRUE is returned and the method succeeds. */ virtual Bool readDepthBuffer( const PixelFormat& pixelType, Image& image ) const = 0; /// Read an image corresponding to the specified contents of the context's current depth buffer. /** * The depth buffer is read from and its contents are placed in the output image parameter * with the specified pixel type. If the pixel type is incompatible with the depth framebuffer * format, or if the read operation failed, FALSE is returned and no image is retrieved. * Otherwise, TRUE is returned and the method succeeds. * * This method reads the framebuffer pixels that are in the given bounding box and * creates an image with the width and height of the box. Coordinates are specified so that * (0,0) is the lower left corner of the context. If the bounding box is outside the * range of the framebuffer, it is clamped to the edge of the framebuffer. */ virtual Bool readDepthBuffer( const PixelFormat& pixelType, Image& image, const AABB2i& bounds ) const = 0; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Framebuffer Binding Methods /// Return a 2D vector containing the size in pixels of the currently bound framebuffer. virtual Vector2D<Size> getFramebufferSize() const = 0; /// Return a pointer to the currently bound framebuffer object. /** * A NULL return value indicates that no external framebuffer object is bound * to the context and that all drawing commands are being rendered to the main * screen (target view). */ virtual Pointer<Framebuffer> getFramebuffer() const = 0; /// Set the currently bound framebuffer object. /** * If the specified framebuffer is not valid, the method has no effect and * FALSE is returned. Otherwise, the framebuffer binding succeeds, it replaces * the previously bound framebuffer, and TRUE is returned. * * If a NULL framebuffer pointer is specified, the previously bound * framebuffer is unbound and the main target view is bound as the * framebuffer instead and TRUE is returned. */ virtual Bool bindFramebuffer( const Pointer<Framebuffer>& newFramebuffer ) = 0; /// Unbind the previously bound framebuffer, restoring the main screen as the target. /** * The previously bound framebuffer is unbound and the main target view is bound as the * framebuffer instead and TRUE is returned. */ virtual void unbindFramebuffer() = 0; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Drawing Methods /// Draw the specified shader pass, indexing vertices using a range of the given index buffer. /** * If the shader binding data pointer is not NULL, shader binding data is taken from * the data object, rather than the shader pass, and used in drawing the shader pass. * The specified shader data object should use the same bindings and data format as the specified shader * pass. It is used to provide scene-specific drawing information (such as lights) for the * shader pass without modifying the shader pass. * * The method returns whether or not the draw command was successfully executed. */ virtual Bool draw( const ShaderPass& shaderPass, const IndexBuffer& indices, const BufferRange& bufferRange, const ShaderBindingData* shaderData = NULL ) = 0; /// Draw the specified shader pass, using a range of vertices from the shader pass's vertex buffers. /** * If the shader binding data pointer is not NULL, shader binding data is taken from * the data object, rather than the shader pass, and used in drawing the shader pass. * The specified shader data object should use the same bindings and data format as the specified shader * pass. It is used to provide scene-specific drawing information (such as lights) for the * shader pass without modifying the shader pass. * * The method returns whether or not the draw command was successfully executed. */ virtual Bool draw( const ShaderPass& shaderPass, const BufferRange& bufferRange, const ShaderBindingData* shaderData = NULL ) = 0; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Vertex Buffer Creation Methods /// Create a vertex attribute buffer with undefined attribute type and capacity. virtual Pointer<VertexBuffer> createVertexBuffer( const HardwareBufferUsage& newUsage = HardwareBufferUsage::STATIC ) = 0; /// Create a vertex attribute buffer with the specified attribute type and capacity. /** * The contents of the created buffer are undefined. */ virtual Pointer<VertexBuffer> createVertexBuffer( const AttributeType& attributeType, Size capacity, const HardwareBufferUsage& newUsage = HardwareBufferUsage::STATIC ) = 0; /// Create a vertex attribute buffer with the specified attributes, attribute type and capacity. /** * This method uses data from the given attribute pointer to initialize the hardware * buffer up to the specified capacity. */ virtual Pointer<VertexBuffer> createVertexBuffer( const void* attributes, const AttributeType& attributeType, Size capacity, const HardwareBufferUsage& newUsage = HardwareBufferUsage::STATIC ) = 0; /// Create a vertex attribute buffer with the same capacity as the specified buffer's number of attributes. RIM_INLINE Pointer<VertexBuffer> createVertexBuffer( const GenericBuffer& attributes, const HardwareBufferUsage& newUsage = HardwareBufferUsage::STATIC ) { return this->createVertexBuffer( attributes.getPointer(), attributes.getAttributeType(), attributes.getSize(), newUsage ); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Index Buffer Creation Methods /// Create an index buffer with undefined attribute type and capacity. virtual Pointer<IndexBuffer> createIndexBuffer( const HardwareBufferUsage& newUsage = HardwareBufferUsage::STATIC ) = 0; /// Create an index buffer with the specified attribute type and capacity. /** * The contents of the created buffer are undefined. */ virtual Pointer<IndexBuffer> createIndexBuffer( const PrimitiveType& indexType, Size capacity, const HardwareBufferUsage& newUsage = HardwareBufferUsage::STATIC ) = 0; /// Create an index buffer with the specified attributes, attribute type and capacity. /** * This method uses data from the given pointer to initialize the hardware * buffer up to the specified capacity. The attribute buffer must have enough space * for all of the requested attributes. */ virtual Pointer<IndexBuffer> createIndexBuffer( const void* indices, const PrimitiveType& indexType, Size capacity, const HardwareBufferUsage& newUsage = HardwareBufferUsage::STATIC ) = 0; /// Create an index buffer with the same capacity as the specified buffer's number of indices. RIM_INLINE Pointer<IndexBuffer> createIndexBuffer( const GenericBuffer& indices, const HardwareBufferUsage& newUsage = HardwareBufferUsage::STATIC ) { if ( !indices.getAttributeType().isAScalar() ) return Pointer<IndexBuffer>(); return this->createIndexBuffer( indices.getPointer(), indices.getAttributeType().getPrimitiveType(), indices.getSize(), newUsage ); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Texture Creation Methods /// Create a default uninitialized texture with undefined format and size. /** * If the creation fails, a NULL pointer is returned. */ virtual Pointer<Texture> createTexture() = 0; /// Create a 1D texture with the specified internal format and size with undefined pixel data. /** * If the creation fails, a NULL pointer is returned. */ virtual Pointer<Texture> createTexture1D( TextureFormat format, Size width ) = 0; /// Create a 2D texture with the specified internal format and size with undefined pixel data. /** * If the creation fails, a NULL pointer is returned. */ virtual Pointer<Texture> createTexture2D( TextureFormat format, Size width, Size height ) = 0; /// Create a 3D texture with the specified internal format and size with undefined pixel data. /** * If the creation fails, a NULL pointer is returned. */ virtual Pointer<Texture> createTexture3D( TextureFormat format, Size width, Size height, Size depth ) = 0; /// Create a 2D cube map texture with the specified internal format and size with undefined pixel data. /** * Each face of the cube texture will be the specified size in each dimension. * * If the creation fails, a NULL pointer is returned. */ virtual Pointer<Texture> createTextureCube( TextureFormat format, Size width ) = 0; /// Create a texture for the specified image which uses an inferred internal texture format. /** * If the creation fails, a NULL pointer is returned. */ RIM_INLINE Pointer<Texture> createTexture( const Image& image ) { return this->createTexture( image, TextureFormat(image.getPixelFormat()) ); } /// Create a texture for the specified image which has the given internal texture format. /** * Since an image can have any number of dimensions, this method allows the user * to create any-dimension textures with a single interface. * * If the creation fails, a NULL pointer is returned. */ virtual Pointer<Texture> createTexture( const Image& image, TextureFormat format ) = 0; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Framebuffer Creation Methods /// Create a new framebuffer object for this context. /** * If the creation fails, a NULL pointer is returned. */ virtual Pointer<Framebuffer> createFramebuffer() = 0; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Shader Creation Methods /// Create and compile a new shader with the specified type and source code. /** * The shader type is used to influence how the shader's source code is * interpreted when compiled. If the shader type or language is unsupported, * or if the shader does not succesfully compile, the method fails and NULL is returned. */ virtual Pointer<Shader> createShader( const ShaderType& newShaderType, const ShaderSourceString& newSource, const ShaderLanguage& newLanguage = ShaderLanguage::DEFAULT ) = 0; /// Create a new shader program object with no attached shaders. virtual Pointer<ShaderProgram> createShaderProgram() = 0; /// Create a new shader program object that uses the specified shader program source code. /** * The context uses the source code and configuration in the specified generic program object * to create a new shader program object. If the program compilation or the method * fails, a NULL shader program is returned. */ virtual Pointer<ShaderProgram> createShaderProgram( const GenericShaderProgram& programSource ) = 0; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Shader Pass Creation Methods /// Create and return a shader pass object for the given shader program and rendering mode. /** * The new shader pass uses the specified shader program and rendering mode and has no bindings. * If the method fails, a NULL pointer is returned. */ virtual Pointer<ShaderPass> createShaderPass( const Pointer<ShaderProgram>& program, const RenderMode& renderMode ) = 0; /// Create and return a shader pass object for the given shader pass source code. /** * The context compiles the specified shader pass source code (if possible) and * and uses it to create a shader pass. If the method fails, * a NULL shader pass is returned. */ virtual Pointer<ShaderPass> createShaderPass( const Pointer<ShaderPassSource>& shaderPassSource ) = 0; /// Create and return a shader pass object for the given generic shader pass. /** * The context picks the best source code version from the specified generic shader pass * and uses it to create a shader pass. If the method fails, * a NULL shader pass is returned. */ virtual Pointer<ShaderPass> createShaderPass( const GenericShaderPass& genericShaderPass ) = 0; /// Return a pointer to the most compatible shader pass source version for the specified generic shader pass. /** * The context picks the best source code version from the specified generic shader pass * and returns a pointer to it. If the method fails, a NULL shader pass is returned. */ virtual Pointer<ShaderPassSource> getBestShaderPassSource( const GenericShaderPass& genericShaderPass ) = 0; /// Create and return a default shader pass source object for the given shader pass usage. /** * The context creates a new default shader pass source object * which renders geometry using the given type of shader pass usage. If the method fails, * a NULL shader pass source is returned. */ virtual Pointer<ShaderPassSource> getDefaultShaderPassSource( const ShaderPassUsage& usage ) = 0; /// Create and return a default shader pass object for the given shader pass usage. /** * The context creates a new default shader pass object * which renders geometry using the given type of shader pass usage. If the method fails, * a NULL shader pass is returned. */ virtual Pointer<ShaderPass> createDefaultShaderPass( const ShaderPassUsage& usage ) = 0; /// Recompile the specified shader pass object with the current state of its parameter configuration. /** * This method uses the shader pass's source object if available, plus the shader pass's current * configuration to recompile the shader pass. The shader pass's attribute bindings are reset * for the new shader program (but their values are kept if possible). * * The method returns whether or not the recompilation was successful. If the compilation * fails, the orignal shader pass is unmodified. */ virtual Bool recompileShaderPass( const Pointer<ShaderPass>& shaderPass ) = 0; }; //########################################################################################## //*********************** End Rim Graphics Devices Namespace ***************************** RIM_GRAPHICS_DEVICES_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_GRAPHICS_CONTEXT_H <file_sep>/* * rimPhysicsForcesConfig.h * Rim Physics * * Created by <NAME> on 6/7/08. * Copyright 2008 Rim Software. All rights reserved. * */ #ifndef INCLUDE_RIM_PHYSICS_FORCES_CONFIG_H #define INCLUDE_RIM_PHYSICS_FORCES_CONFIG_H #include "../rimPhysicsConfig.h" #include "../rimPhysicsObjects.h" //########################################################################################## //########################################################################################## //############ //############ Library Namespace Configuration //############ //########################################################################################## //########################################################################################## #ifndef RIM_PHYSICS_FORCES_NAMESPACE_START #define RIM_PHYSICS_FORCES_NAMESPACE_START RIM_PHYSICS_NAMESPACE_START namespace forces { #endif #ifndef RIM_PHYSICS_FORCES_NAMESPACE_END #define RIM_PHYSICS_FORCES_NAMESPACE_END }; RIM_PHYSICS_NAMESPACE_END #endif //########################################################################################## //************************ Start Rim Physics Forces Namespace **************************** RIM_PHYSICS_FORCES_NAMESPACE_START //****************************************************************************************** //########################################################################################## using rim::physics::objects::RigidObject; //########################################################################################## //************************ End Rim Physics Forces Namespace ****************************** RIM_PHYSICS_FORCES_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_PHYSICS_FORCES_CONFIG_H <file_sep>/* * rimGraphicsShaderConfiguration.h * Rim Software * * Created by <NAME> on 1/30/14. * Copyright 2014 __MyCompanyName__. All rights reserved. * */ #ifndef INCLUDE_RIM_GRAPHICS_SHADER_CONFIGURATION_H #define INCLUDE_RIM_GRAPHICS_SHADER_CONFIGURATION_H #include "rimGraphicsShadersConfig.h" #include "rimGraphicsShaderParameter.h" //########################################################################################## //*********************** Start Rim Graphics Shaders Namespace *************************** RIM_GRAPHICS_SHADERS_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class which contains a configuration for a shader. /** * A configuration consists of a list of ShaderParameter objects that determine * how a shader should be compiled. */ class ShaderConfiguration { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructors /// Create a new shader configuration with no parameters. RIM_INLINE ShaderConfiguration() { } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Parameter Accessor Methods /// Return the number of shader parameters that this configuration has. RIM_INLINE Size getParameterCount() const { return parameters.getSize(); } /// Return a reference to the shader parameter at the specified index in this configuration. RIM_INLINE ShaderParameter& getParameter( Index parameterIndex ) { return parameters[parameterIndex]; } /// Return a const reference to the shader parameter at the specified index in this configuration. RIM_INLINE const ShaderParameter& getParameter( Index parameterIndex ) const { return parameters[parameterIndex]; } /// Replace the shader parameter at the specified index in this configuration. RIM_INLINE void setParameter( Index parameterIndex, const ShaderParameter& newParameter ) { parameters[parameterIndex] = newParameter; } /// Set the value of the parameter in this configuration at the specified index. void setParameterValue( Index parameterIndex, const ShaderParameterValue& newValue ) { parameters[parameterIndex].setValue( newValue ); } /// Set the value of the parameter in this configuration with the specified usage. /** * If there is a parameter with that usage, its value is set to the new value * and TRUE is returned. Otherwise, the method fails and FALSE is returned. */ Bool setParameterValueForUsage( const ShaderParameterUsage& usage, const ShaderParameterValue& newValue ); /// Add a new shader parameter to the end of this configuration's list of parameters. RIM_INLINE void addParameter( const ShaderParameter& newParameter ) { parameters.add( newParameter ); } /// Add a new shader parameter with the given attributes to the end of this configuration's list of parameters. RIM_INLINE void addParameter( const String& parameterName, const ShaderParameterUsage& usage, const ShaderParameterValue& value ) { parameters.add( ShaderParameter( ShaderParameterInfo( parameterName, usage ), value ) ); } /// Remove the shader parameter at the specified index in this configuration. /** * This method maintains the order of the remaining parameters. */ RIM_INLINE void removeParameter( Index parameterIndex ) { parameters.removeAtIndex( parameterIndex ); } /// Clear all shader parameters from this shader configuration. RIM_INLINE void clearParameters() { parameters.clear(); } private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Members /// A list of the shader parameters that are part of this shader configuration. ArrayList<ShaderParameter> parameters; }; //########################################################################################## //*********************** End Rim Graphics Shaders Namespace ***************************** RIM_GRAPHICS_SHADERS_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_GRAPHICS_SHADER_CONFIGURATION_H <file_sep>/* * rimGraphicsAlphaTest.h * Rim Graphics * * Created by <NAME> on 3/16/13. * Copyright 2013 __MyCompanyName__. All rights reserved. * */ #ifndef INCLUDE_RIM_GRAPHICS_ALPHA_TEST_H #define INCLUDE_RIM_GRAPHICS_ALPHA_TEST_H #include "rimGraphicsUtilitiesConfig.h" //########################################################################################## //********************** Start Rim Graphics Utilities Namespace ************************** RIM_GRAPHICS_UTILITIES_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class which specifies the operation performed when testing the alpha of a fragment. /** * If the alpha test succeeds, the fragment is rendered. Otherwise, the fragment * is discarded and rendering for the fragment stops. */ class AlphaTest { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Depth Test Enum Definition /// An enum type which represents the type of alpha test. typedef enum Enum { /// An alpha test where the test never succeeds (no fragments ever pass or update the framebuffer). NEVER = 0, /// An alpha test where the test always succeeds (all fragments pass and update the framebuffer). ALWAYS = 1, /// An alpha test where the test succeeds if the fragment alpha and test alpha value are equal. EQUAL = 2, /// An alpha test where the test succeeds if the fragment alpha and test alpha value are not equal. NOT_EQUAL = 3, /// An alpha test where the test succeeds if the fragment alpha is less than the test alpha. LESS_THAN = 4, /// An alpha test where the test succeeds if the fragment alpha is less than or equal to the test alpha. LESS_THAN_OR_EQUAL = 5, /// An alpha test where the test succeeds if the fragment alpha is greater than the test alpha. GREATER_THAN = 6, /// An alpha test where the test succeeds if the fragment alpha is greater than or equal to the test alpha. GREATER_THAN_OR_EQUAL = 7 }; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructors /// Create a new alpha test with the specified alpha test enum value and test alpha value. RIM_INLINE AlphaTest( Enum newTest, Float newTestAlpha = Float(0) ) : testAlpha( newTestAlpha ), test( newTest ) { } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Enum Cast Operator /// Convert this alpha test type to an enum value. RIM_INLINE operator Enum () const { return (Enum)test; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Test Alpha Accessor Methods /// Return the reference alpha value with which incoming fragment alphas are compared. RIM_INLINE Float getTestAlpha() const { return testAlpha; } /// Set the reference alpha value with which incoming fragment alphas are compared. RIM_INLINE void setTestAlpha( Float newTestAlpha ) { testAlpha = newTestAlpha; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** String Representation Accessor Methods /// Return a alpha test enum which corresponds to the given enum string. static Enum fromEnumString( const String& enumString ); /// Return a unique string for this alpha test that matches its enum value name. String toEnumString() const; /// Return a string representation of the depth test. String toString() const; /// Convert this depth test into a string representation. RIM_FORCE_INLINE operator String () const { return this->toString(); } private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Members /// The reference alpha value with which incoming fragment alphas are compared. Float testAlpha; /// An enum value which indicates the type of depth test. UByte test; }; //########################################################################################## //********************** End Rim Graphics Utilities Namespace **************************** RIM_GRAPHICS_UTILITIES_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_GRAPHICS_ALPHA_TEST_H <file_sep>/* * rimGraphicsGUISlider.h * Rim Graphics GUI * * Created by <NAME> on 2/8/13. * Copyright 2013 Headspace Systems. All rights reserved. * */ #ifndef INCLUDE_RIM_GRAPHICS_GUI_SLIDER_H #define INCLUDE_RIM_GRAPHICS_GUI_SLIDER_H #include "rimGraphicsGUIBase.h" #include "rimGraphicsGUIObject.h" #include "rimGraphicsGUISliderDelegate.h" //########################################################################################## //************************ Start Rim Graphics GUI Namespace ****************************** RIM_GRAPHICS_GUI_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class which represents a sliding rectangular region that allows the user to modify a ranged value. class Slider : public GUIObject { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructors /// Create a new sizeless slider positioned at the origin of its coordinate system. Slider(); /// Create a new slider which occupies the specified rectangle and has the default range. Slider( const Rectangle& newRectangle ); /// Create a new slider which has the specified rectangle, orientation, range, and value. Slider( const Rectangle& newRectangle, const Orientation& newOrientation, const AABB1f& newRange, Float newValue ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Value Accessor Methods /// Return the current value for the slider. RIM_INLINE Float getValue() const { return value; } /// Set the current value for the slider. /** * The new slider value is clamped to lie within the slider's valid * range of values. */ void setValue( Float newValue ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Range Accessor Methods /// Return an object which describes the minimum and maximum allowed values for the slider. /** * The range's minimum value is placed at the minimum coordinate of the slider's major axis, * and the maximum value is placed at the maximum coordinate of the slider's major axis. * * The minimum and maximum values do not have to be properly ordered - they can be * reversed in order to reverse the effective direction of the slider. */ RIM_INLINE const AABB1f& getRange() const { return range; } /// Set an object which describes the minimum and maximum allowed values for the slider. /** * The range's minimum value is placed at the minimum coordinate of the slider's major axis, * and the maximum value is placed at the maximum coordinate of the slider's major axis. * * The minimum and maximum values do not have to be properly ordered - they can be * reversed in order to reverse the effective direction of the slider. * * The slider's value is clamped so that is lies within the new range. */ void setRange( const AABB1f& newRange ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Number Of Steps Accessor Methods /// Return the total number of value steps there are for this slider. /** * This allows the user to quantize the slider's allowed values to * a fixed number of evenly-spaced steps. * * If this value is 0, the default, the slider's resolution is unquantized * and can be used to represent any value in the valid range. */ RIM_INLINE Size getStepCount() const { return numSteps; } /// Set the total number of value steps there are for this slider. /** * This allows the user to quantize the slider's allowed values to * a fixed number of evenly-spaced steps. * * If this value is 0, the default, the slider's resolution is unquantized * and can be used to represent any value in the valid range. */ RIM_INLINE void setStepCount( Size newNumSteps ) { numSteps = newNumSteps; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Value Curve Accessor Methods /// Return an object representing the curve which is used to map from slider positions to values. RIM_INLINE ValueCurve getValueCurve() const { return valueCurve; } /// Set an object representing the curve which is used to map from slider positions to values. RIM_INLINE void setValueCurve( ValueCurve newCurve ) { valueCurve = newCurve; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Orientation Accessor Methods /// Return an object which describes how this divider's dividing line is rotated. RIM_INLINE const Orientation& getOrientation() const { return orientation; } /// Set an object which describes how this divider's dividing line is rotated. RIM_INLINE void setOrientation( const Orientation& newOrientation ) { orientation = newOrientation; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Border Accessor Methods /// Return a mutable object which describes this slider's border. RIM_INLINE Border& getBorder() { return border; } /// Return an object which describes this slider's border. RIM_INLINE const Border& getBorder() const { return border; } /// Set an object which describes this slider's border. RIM_INLINE void setBorder( const Border& newBorder ) { border = newBorder; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Content Bounding Box Accessor Methods /// Return the 3D bounding box for the slider's content display area in its local coordinate frame. RIM_INLINE AABB3f getLocalContentBounds() const { return AABB3f( this->getLocalContentBoundsXY(), AABB1f( Float(0), this->getSize().z ) ); } /// Return the 2D bounding box for the slider's content display area in its local coordinate frame. RIM_INLINE AABB2f getLocalContentBoundsXY() const { return border.getContentBounds( AABB2f( Vector2f(), this->getSizeXY() ) ); } /// Return the local bounding box for the slider's moving area. AABB2f getLocalSliderBounds() const; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Slider Border Accessor Methods /// Return a mutable object which describes the border for this slider's moving area. RIM_INLINE Border& getSliderBorder() { return sliderBorder; } /// Return an object which describes the border for this slider's moving area. RIM_INLINE const Border& getSliderBorder() const { return sliderBorder; } /// Set an object which describes the border for this slider's moving area. RIM_INLINE void setSliderBorder( const Border& newSliderBorder ) { sliderBorder = newSliderBorder; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Slider Size Accessor Methods /// Return the size of the slider's moveable area along the major axis of the slider in vertical screen units. RIM_INLINE Float getSliderSize() const { return sliderSize; } /// Set the size of the slider's moveable area along the major axis of the slider in vertical screen units. RIM_INLINE void setSliderSize( Float newSliderSize ) { sliderSize = newSliderSize; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Slider State Accessor Methods /// Return whether or not this slider is currently active. RIM_INLINE Bool getIsEnabled() const { return isEnabled; } /// Set whether or not this slider is currently active. RIM_INLINE void setIsEnabled( Bool newIsEnabled ) { isEnabled = newIsEnabled; } /// Return whether or not this slider is able to be edited by the user. RIM_INLINE Bool getIsEditable() const { return isEditable; } /// Return whether or not this slider is able to be edited by the user. RIM_INLINE void setIsEditable( Bool newIsEditable ) { isEditable = newIsEditable; } /// Return whether or not this slider is currently grabbed by the mouse. RIM_INLINE Bool getIsGrabbed() const { return isGrabbed; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Color Accessor Methods /// Return the background color for this slider's area. RIM_INLINE const Color4f& getBackgroundColor() const { return backgroundColor; } /// Set the background color for this slider's area. /** * The method returns whether or not the slider's background color was successfully changed. */ RIM_INLINE void setBackgroundColor( const Color4f& newBackgroundColor ) { backgroundColor = newBackgroundColor; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Border Color Accessor Methods /// Return the border color used when rendering a slider. RIM_INLINE const Color4f& getBorderColor() const { return borderColor; } /// Set the border color used when rendering a slider. RIM_INLINE void setBorderColor( const Color4f& newBorderColor ) { borderColor = newBorderColor; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Slider Color Accessor Methods /// Return the color used when rendering a slider's moving area. RIM_INLINE const Color4f& getSliderColor() const { return sliderColor; } /// Set the color used when rendering a slider's moving area. RIM_INLINE void setSliderColor( const Color4f& newSliderColor ) { sliderColor = newSliderColor; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Slider Border Color Accessor Methods /// Return the border color used when rendering a slider's moving area. RIM_INLINE const Color4f& getSliderBorderColor() const { return sliderBorderColor; } /// Set the border color used when rendering a slider's moving area. RIM_INLINE void setSliderBorderColor( const Color4f& newSliderBorderColor ) { sliderBorderColor = newSliderBorderColor; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Update Method /// Update the current internal state of this slider for the specified time interval in seconds. virtual void update( Float dt ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Drawing Method /// Draw this object using the specified GUI renderer to the given parent coordinate system bounds. /** * The method returns whether or not the object was successfully drawn. * * The default implementation draws nothing and returns TRUE. */ virtual Bool drawSelf( GUIRenderer& renderer, const AABB3f& parentBounds ) const; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Input Handling Methods /// Handle the specified keyboard event that occured when this object had focus. virtual void keyEvent( const KeyboardEvent& event ); /// Handle the specified mouse motion event that occurred. virtual void mouseMotionEvent( const MouseMotionEvent& event ); /// Handle the specified mouse button event that occurred. virtual void mouseButtonEvent( const MouseButtonEvent& event ); /// Handle the specified mouse wheel event that occurred. virtual void mouseWheelEvent( const MouseWheelEvent& event ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Delegate Accessor Methods /// Return a reference to the delegate which responds to events for this slider. RIM_INLINE SliderDelegate& getDelegate() { return delegate; } /// Return a reference to the delegate which responds to events for this slider. RIM_INLINE const SliderDelegate& getDelegate() const { return delegate; } /// Return a reference to the delegate which responds to events for this slider. RIM_INLINE void setDelegate( const SliderDelegate& newDelegate ) { delegate = newDelegate; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Static Construction Methods /// Construct a smart-pointer-wrapped instance of this class using the constructor with the given arguments. RIM_INLINE static Pointer<Slider> construct() { return Pointer<Slider>::construct(); } /// Construct a smart-pointer-wrapped instance of this class using the constructor with the given arguments. RIM_INLINE static Pointer<Slider> construct( const Rectangle& newRectangle ) { return Pointer<Slider>::construct( newRectangle ); } /// Construct a smart-pointer-wrapped instance of this class using the constructor with the given arguments. RIM_INLINE static Pointer<Slider> construct( const Rectangle& newRectangle, const Orientation& newOrientation, const AABB1f& newRange, Float newValue ) { return Pointer<Slider>::construct( newRectangle, newOrientation, newRange, newValue ); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Public Static Data Members /// The default size of a slider's moving area. static const Float DEFAULT_SLIDER_SIZE; /// The default border that is used for a slider. static const Border DEFAULT_BORDER; /// The default meter border that is used for a slider's moving area. static const Border DEFAULT_SLIDER_BORDER; /// The default background color that is used for a slider's area. static const Color4f DEFAULT_BACKGROUND_COLOR; /// The default border color that is used for a slider's area. static const Color4f DEFAULT_BORDER_COLOR; /// The default color that is used for a slider's moving area. static const Color4f DEFAULT_SLIDER_COLOR; /// The default meter border color that is used for a slider's moving area. static const Color4f DEFAULT_SLIDER_BORDER_COLOR; private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Helper Methods /// Return the bounding box for this slider's moving area given the bounds for its content area. RIM_INLINE AABB2f getSliderBoundsForContentBounds( const AABB2f& contentBounds ) const; /// Return the position of the slider from [0,1], based on the current value within the slider's range. RIM_INLINE Float getSliderPosition() const { return this->getSliderPositionFromValue( value ); } /// Return the position of the slider from [0,1], based on the specified value within the slider's range. RIM_INLINE Float getSliderPositionFromValue( Float v ) const { if ( range.min <= range.max ) return valueCurve.evaluateInverse( v, range ); else return Float(1) - valueCurve.evaluateInverse( v, AABB1f( range.max, range.min ) ); } /// Return the position of the slider from [0,1], based on the current value within the slider's range. RIM_INLINE Float getValueFromSliderPosition( Float a ) const { if ( numSteps > 0 ) a = math::round( numSteps*a ) / numSteps; if ( range.min <= range.max ) return valueCurve.evaluate( a, range ); else return valueCurve.evaluate( Float(1) - a, AABB1f( range.max, range.min ) ); } /// Convert the specified slider value to a quantized value if this slider has a discrete number of steps. RIM_INLINE Float stepifyValue( Float newValue ) { return this->getValueFromSliderPosition( this->getSliderPositionFromValue( newValue ) ); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Members /// An object which describes how this slider is rotated within its area. Orientation orientation; /// The range of allowed values for this slider. /** * The range's minimum value is placed at the minimum coordinate of the slider's major axis, * and the maximum value is placed at the maximum coordinate of the slider's major axis. * * The minimum and maximum values do not have to be properly ordered - they can be * reversed in order to reverse the effective direction of the slider. */ AABB1f range; /// The current value for the slider. Float value; /// The total number of value steps there are for this slider. /** * This allows the user to quantize the slider's allowed values to * a fixed number of evenly-spaced steps. * * If this value is 0, the default, the slider's resolution is unquantized * and can be used to represent any value in the valid range. */ Size numSteps; /// An object representing the curve which is used to map from slider positions to values. ValueCurve valueCurve; /// The size of the slider's moveable area along the major axis of the slider in vertical screen units. Float sliderSize; /// An object which describes the border for this slider. Border border; /// An object which describes the border for this slider's moving area. Border sliderBorder; /// An object which contains function pointers that respond to slider events. SliderDelegate delegate; /// The background color for the slider's area. Color4f backgroundColor; /// The border color for the slider's background area. Color4f borderColor; /// The color used for the moving part of the slider's area. Color4f sliderColor; /// The border color used for the moving part of the slider's area. Color4f sliderBorderColor; /// The offset vector of the mouse location from the minimum slider bounding coordinate. /** * This value keeps the slider from warping to the mouse's location when it is * grabbed off-center. */ Vector2f grabOffset; /// A boolean value indicating whether or not this slider is active. /** * If the slider is not enabled, it will not display its moving slider area * and will not indicate a value or allow the user to edit the slider. */ Bool isEnabled; /// A boolean value indicating whether or not this slider's value can be changed by the user. Bool isEditable; /// A boolean value which indicates whether or not this slider is currently grabbed by the mouse. Bool isGrabbed; }; //########################################################################################## //************************ End Rim Graphics GUI Namespace ******************************** RIM_GRAPHICS_GUI_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_GRAPHICS_GUI_SLIDER_H <file_sep>/* * rimGraphicsAssetsConfig.h * Rim Software * * Created by <NAME> on 6/11/14. * Copyright 2014 __MyCompanyName__. All rights reserved. * */ #ifndef INCLUDE_RIM_GRAPHICS_ASSETS_CONFIG_H #define INCLUDE_RIM_GRAPHICS_ASSETS_CONFIG_H #include "../rimGraphicsConfig.h" #include "../rimGraphicsUtilities.h" #include "../rimGraphicsBase.h" #include "../rimGraphicsObjects.h" #include "../rimGraphicsScenes.h" //########################################################################################## //########################################################################################## //############ //############ Library Namespace Configuration //############ //########################################################################################## //########################################################################################## #ifndef RIM_GRAPHICS_ASSETS_NAMESPACE_START #define RIM_GRAPHICS_ASSETS_NAMESPACE_START RIM_GRAPHICS_NAMESPACE_START namespace assets { #endif #ifndef RIM_GRAPHICS_ASSETS_NAMESPACE_END #define RIM_GRAPHICS_ASSETS_NAMESPACE_END }; RIM_GRAPHICS_NAMESPACE_END #endif //########################################################################################## //*********************** Start Rim Graphics Assets Namespace **************************** RIM_GRAPHICS_ASSETS_NAMESPACE_START //****************************************************************************************** //########################################################################################## using rim::assets::AssetType; using rim::assets::AssetTypeTranscoder; using rim::assets::AssetTranscoder; using rim::assets::AssetObject; using rim::graphics::scenes::GraphicsScene; using rim::graphics::objects::GraphicsObject; using rim::graphics::objects::GraphicsObjectFlags; using rim::graphics::materials::GenericMaterial; using rim::graphics::materials::GenericMaterialTechnique; using rim::graphics::shaders::GenericShaderPass; using rim::graphics::cameras::Camera; using rim::graphics::cameras::OrthographicCamera; using rim::graphics::cameras::PerspectiveCamera; using rim::graphics::lights::Light; using rim::graphics::lights::LightFlags; using rim::graphics::lights::SpotLight; using rim::graphics::lights::PointLight; using rim::graphics::lights::DirectionalLight; using rim::graphics::shapes::GraphicsShape; using rim::graphics::shapes::GenericMeshShape; using rim::graphics::shapes::GenericMeshGroup; using rim::graphics::shapes::GenericSphereShape; using rim::graphics::shapes::GenericCylinderShape; using rim::graphics::shapes::GenericCapsuleShape; using rim::graphics::shapes::GenericBoxShape; //########################################################################################## //*********************** End Rim Graphics Assets Namespace ****************************** RIM_GRAPHICS_ASSETS_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_GRAPHICS_ASSETS_CONFIG_H <file_sep>/* * rimPhysicsCollisionAlgorithmBase.h * Rim Physics * * Created by <NAME> on 11/28/09. * Copyright 2009 Rim Software. All rights reserved. * */ #ifndef INCLUDE_RIM_PHYSICS_COLLISION_ALGORITHM_BASE_H #define INCLUDE_RIM_PHYSICS_COLLISION_ALGORITHM_BASE_H #include "rimPhysicsCollisionConfig.h" #include "rimPhysicsCollisionAlgorithm.h" //########################################################################################## //********************** Start Rim Physics Collision Namespace *************************** RIM_PHYSICS_COLLISION_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class from which all collision algorithms should derive that simplifies algorithm implementation. /** * This class simplifies CollisionAlgorithm implementation by automatically providing * CollisionShapeType information to the CollisionAlgorithm based on the * ShapeType1 and ShapeType2 template parameters. */ template < typename ObjectType1, typename ObjectType2, typename ShapeType1, typename ShapeType2 > class CollisionAlgorithmBase : public CollisionAlgorithm<ObjectType1,ObjectType2> { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructors /// Create a default base collision algorithm. RIM_FORCE_INLINE CollisionAlgorithmBase() : CollisionAlgorithm<ObjectType1,ObjectType2>( &shapeType1, &shapeType2 ) { } private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Members /// The first shape type that this algorithm operates on. static const CollisionShapeType shapeType1; /// The second shape type that this algorithm operates on. static const CollisionShapeType shapeType2; }; template < typename ObjectType1, typename ObjectType2, typename ShapeType1, typename ShapeType2 > const CollisionShapeType CollisionAlgorithmBase<ObjectType1,ObjectType2,ShapeType1,ShapeType2>:: shapeType1 = CollisionShapeType::of<ShapeType1>(); template < typename ObjectType1, typename ObjectType2, typename ShapeType1, typename ShapeType2 > const CollisionShapeType CollisionAlgorithmBase<ObjectType1,ObjectType2,ShapeType1,ShapeType2>:: shapeType2 = CollisionShapeType::of<ShapeType2>(); //########################################################################################## //********************** End Rim Physics Collision Namespace ***************************** RIM_PHYSICS_COLLISION_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_PHYSICS_COLLISION_ALGORITHM_BASE_H <file_sep>/* * rimSoundMIDIMessage.h * Rim Sound * * Created by <NAME> on 7/15/12. * Copyright 2012 __MyCompanyName__. All rights reserved. * */ #ifndef INCLUDE_RIM_SOUND_MIDI_MESSAGE_H #define INCLUDE_RIM_SOUND_MIDI_MESSAGE_H #include "rimSoundUtilitiesConfig.h" //########################################################################################## //*********************** Start Rim Sound Utilities Namespace **************************** RIM_SOUND_UTILITIES_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class which represents a single MIDI message. /** * This particular implementation does not support SysEx MIDI messages. */ class MIDIMessage { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Type Enum Declaration /// An enum which indicates the type of a MIDI message. typedef enum Type { /// A message type indicating that a note was turned on. NOTE_ON, /// A message type indicating that a note was turned off. NOTE_OFF, /// A message type indicating that a control parameter was changed. CONTROL_CHANGE, /// A message type indicating a change in a key's current pressure. AFTERTOUCH, /// A message type indicating a change in a MIDI channel's global pressure. CHANNEL_PRESSURE, /// A message type indicating a change in the pitch wheel's position. PITCH_WHEEL, /// A message type indicating that the current patch should be changed. PROGRAM_CHANGE, /// A message type indicating that a slave device should start playback from the start of a song. START, /// A message type indicating that a slave device should stop playback. STOP, /// A message type indicating that a slave device should continue playback from its current position. CONTINUE, /// An undefined message type. UNDEFINED }; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructors /// Create a default MIDI message with undefined type. RIM_INLINE MIDIMessage() : type( UNDEFINED ), channel( 0 ), data1( 0 ), data2( 0 ) { } /// Create a MIDI message with the specified type with all other data members set to 0. RIM_INLINE MIDIMessage( Type newType ) : type( newType ), channel( 0 ), data1( 0 ), data2( 0 ) { } /// Create a MIDI message with the specified type, channel, and integral data member. RIM_INLINE MIDIMessage( Type newType, Index newChannel, UByte newData1 ) : type( newType ), channel( (UByte)newChannel ), data1( newData1 ), data2( 0 ) { } /// Create a MIDI message with the specified type, channel, and floating point data member. RIM_INLINE MIDIMessage( Type newType, Index newChannel, Float newData2 ) : type( newType ), channel( (UByte)newChannel ), data1( 0 ), data2( newData2 ) { } /// Create a MIDI message with the specified type, channel, integral data member, and floating point data member. RIM_INLINE MIDIMessage( Type newType, Index newChannel, UByte newData1, Float newData2 ) : type( newType ), channel( (UByte)newChannel ), data1( newData1 ), data2( newData2 ) { } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Message Attribute Accessor Methods /// Return the type of this MIDI message. RIM_INLINE Type getType() const { return (Type)type; } /// Return the number of the channel associated with this MIDI message (if applicable). /** * This value has no meaning if the message type is one with global effect, * such as START, STOP, or CONTINUE. */ RIM_INLINE Index getChannel() const { return (Index)channel; } /// Return the integer data element for this midi message. /** * The information carried in this first data member is dependent on the message type: * - NOTE_ON: The note number which is to be turned on, ranging from 0 to 127. * - NOTE_OFF: The note number which is to be turned off, ranging from 0 to 127. * - CONTROL_CHANGE: The index of the control, ranging from 0 to 127. * - AFTERTOUCH: The note number which should have its pressure value updated, ranging from 0 to 127. * - CHANNEL_PRESSURE: Unused. * - PITCH_WHEEL: Unused. * - PROGRAM_CHANGE: The index of the program to select, ranging from 0 to 127. * - Otherwise: The data stored in this value has no meaning and should be ignored. */ RIM_INLINE UByte getData1() const { return data1; } /// Return the floating-point data element for this midi message. /** * The information carried in this second data member is dependent on the message type: * - NOTE_ON: The velocity of the note-on message, ranging from 0 to 1, 1 being the highest velocity. * - NOTE_OFF: The release velocity of the note-on message, ranging from 0 to 1, 1 being the highest velocity. * - CONTROL_CHANGE: The value that the control should be set to, ranging from 0 to 1. * - AFTERTOUCH: The new pressure value that the aftertouch key should have, ranging from 0 to 1. * - CHANNEL_PRESSURE: The new pressure value that the midi channel should have, ranging from 0 to 1. * - PITCH_WHEEL: The pitch shift amount the midi channel should have, given a value from -1 to 1. * - Otherwise: The data stored in this value has no meaning and should be ignored. */ RIM_INLINE Float getData2() const { return data2; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Message-Specific Data Accessor Methods /// Return the note number associated with this MIDI message. /** * The returned note number is valid only if the message type is NOTE_ON, * NOTE_OFF, or AFTERTOUCH. */ RIM_INLINE UByte getNote() const { return data1; } /// Return the note velocity associated with this MIDI message. /** * The returned note velocity is valid only if the message type is NOTE_ON or * NOTE_OFF. The velocity is in the range [0,1], where 1 is the highest * note velocity. */ RIM_INLINE Float getVelocity() const { return data2; } /// Return the control index associated with this MIDI message. /** * The returned control index is valid only if the message type is CONTROL_CHANGE. */ RIM_INLINE UByte getControl() const { return data1; } /// Return the control value associated with this MIDI message. /** * The returned value is valid only if the message type is CONTROL_CHANGE. * The value is unitless and in the range [0,1]. */ RIM_INLINE Float getControlValue() const { return data2; } /// Return the pressure value associated with this MIDI message. /** * The returned pressure is valid only if the message type is AFTERTOUCH or * CHANNEL_PRESSURE. The pressure is in the range [0,1]. */ RIM_INLINE Float getPressure() const { return data2; } /// Return the pitch shift amount associated with this MIDI message. /** * The returned value is valid only if the message type is PITCH_WHEEL. * The pitch shift amount is unitless and in the range [-1,1]. Users * should define a mapping from this range to semitones, etc. */ RIM_INLINE Float getPitch() const { return data2; } /// Return the program index associated with this MIDI message. /** * The returned program index is valid only if the message type is PROGRAM_CHANGE. */ RIM_INLINE UByte getProgram() const { return data1; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Message Conversion Methods /// Parse a MIDI message object from a pointer to an array of bytes for the MIDI message. /** * If the method succeeds, TRUE is returned and the output message parameter is * set to be the parsed MIDI message. The length of the message in bytes is placed * in the message length parameter. * * If the method fails, indicating a parse error, FALSE is returned. */ static Bool fromBytes( const UByte* bytes, MIDIMessage& message, Size& messageLengthInBytes ); /// Convert the specified MIDIMessage object to a sequence of MIDI data stream bytes. /** * If the method succeeds, TRUE is returned and the message data is written to the * byte array pointer. The length of the message in bytes is placed in the message * length parameter. * * The specified byte array must be at least 3 bytes long, the length of a standard * (non-sysex) MIDI message. * * If the method fails, indicating a conversion error, FALSE is returned. */ static Bool toBytes( const MIDIMessage& message, UByte* bytes, Size& messageLengthInBytes ); private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Members /// An enum representinng the type of this midi message. UByte type; /// A byte indicating the midi channel on which the event occurred (if applicable). UByte channel; /// A byte indicating an integer data element for this midi message. /** * The information carried in this first data member is dependent on the message type: * - NOTE_ON: The note number which is to be turned on, ranging from 0 to 127. * - NOTE_OFF: The note number which is to be turned off, ranging from 0 to 127. * - CONTROL: The index of the control, ranging from 0 to 127. * - AFTERTOUCH: The note number which should have its pressure value updated, ranging from 0 to 127. * - CHANNEL_PRESSURE: Unused. * - PITCH_WHEEL: Unused. * - PROGRAM_CHANGE: The index of the program to select, ranging from 0 to 127. * - Otherwise: The data stored in this value has no meaning and should be ignored. */ UByte data1; /// A floating-point data member representing secondary data for this midi message. /** * The information carried in this second data member is dependent on the message type: * - NOTE_ON: The velocity of the note-on message, ranging from 0 to 1, 1 being the highest velocity. * - NOTE_OFF: The release velocity of the note-on message, ranging from 0 to 1, 1 being the highest velocity. * - CONTROL: The value that the control should be set to, ranging from 0 to 1. * - AFTERTOUCH: The new pressure value that the aftertouch key should have, ranging from 0 to 1. * - CHANNEL_PRESSURE: The new pressure value that the midi channel should have, ranging from 0 to 1. * - PITCH_WHEEL: The pitch shift amount the midi channel should have, given a value from -1 to 1. * - Otherwise: The data stored in this value has no meaning and should be ignored. */ Float data2; }; //########################################################################################## //*********************** End Rim Sound Utilities Namespace ****************************** RIM_SOUND_UTILITIES_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_SOUND_MIDI_MESSAGE_H <file_sep>/* * rimGraphicsPostProcessEffect.h * Rim Software * * Created by <NAME> on 6/22/14. * Copyright 2014 __MyCompanyName__. All rights reserved. * */ #ifndef INCLUDE_RIM_GRAPHICS_POST_PROCESS_EFFECT_H #define INCLUDE_RIM_GRAPHICS_POST_PROCESS_EFFECT_H #include "rimGraphicsRenderersConfig.h" #include "rimGraphicsRenderer.h" //########################################################################################## //********************** Start Rim Graphics Renderers Namespace ************************** RIM_GRAPHICS_RENDERERS_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class that encapsulates the information needed for rendering a post-process effect. /** * A post-process effect is defined by a shader pass that contains the buffers, * textures, and shaders needed for rendering, a range of vertex indices in those buffers, * and a viewport for the effect. * * A post process effect is by default rendered to the main render target, but * can optionally be rendered to a different render target if one is specified. */ class PostProcessEffect { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructors /// Create a post process effect that renders the specified shader pass to the main framebuffer. RIM_INLINE PostProcessEffect( const Pointer<ShaderPass>& newShaderPass, const BufferRange& newBufferRange ) : shaderPass( newShaderPass ), bufferRange( newBufferRange ) { } /// Create a post process effect that renders the specified shader pass to the given framebuffer target. RIM_INLINE PostProcessEffect( const Pointer<Framebuffer>& newTarget, const Pointer<ShaderPass>& newShaderPass, const BufferRange& newBufferRange ) : target( newTarget ), shaderPass( newShaderPass ), bufferRange( newBufferRange ) { } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Shader Pass Accessor Methods /// Return a pointer to the shader pass that is used to render this post process effect. RIM_INLINE const Pointer<ShaderPass>& getShaderPass() const { return shaderPass; } /// Set a pointer to the shader pass that is used to render this post process effect. /** * The method returns whether or not the specified shader pass is valid and can be used * for rendering. */ RIM_INLINE Bool setShaderPass( const Pointer<ShaderPass>& newShaderPass ) { shaderPass = newShaderPass; return shaderPass.isSet(); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Buffer Range Accessor Methods /// Return a reference to the buffer range for this mesh chunk. /** * If the mesh chunk has an index buffer, the valid range refers to the indices * which should be used when drawing the chunk. Otherwise, the range refers * to the valid contiguous range of vertices to use. */ RIM_FORCE_INLINE const BufferRange& getBufferRange() const { return bufferRange; } /// Set the buffer range for this mesh chunk. /** * If the mesh chunk has an index buffer, the valid range refers to the indices * which should be used when drawing the chunk. Otherwise, the range refers * to the valid contiguous range of vertices to use. */ RIM_FORCE_INLINE void setBufferRange( const BufferRange& newBufferRange ) { bufferRange = newBufferRange; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Render Target Accessor Methods /// Return a pointer to the render target that is used to output this post process effect. /** * If the pointer is NULL, the post process renderer uses the main render target instead. */ RIM_INLINE const Pointer<Framebuffer>& getTarget() const { return target; } /// Set a pointer to the render target that is used to output this post process effect. /** * If the pointer is NULL, the post process renderer uses the main render target instead. */ RIM_INLINE void setTarget( const Pointer<Framebuffer>& newTarget ) { target = newTarget; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Viewport Accessor Methods /// Return the viewport on the screen where the shader pass should be rendered. /** * The shader pass is rendered to this rectangular area on the screen. * The default viewport covers the entire screen. */ RIM_INLINE const Viewport& getViewport() const { return viewport; } /// Set the viewport on the screen where the shader pass should be rendered. /** * The shader pass is rendered to this rectangular area on the screen. * The default viewport covers the entire screen. */ RIM_INLINE void setViewport( const Viewport& newViewport ) { viewport = newViewport; } public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Members /// The shader pass that is being used to render this post process effect. Pointer<ShaderPass> shaderPass; /// An object describing the range of vertices to use from the shader pass. BufferRange bufferRange; /// A pointer to the framebuffer render target for this post process renderer, or NULL. Pointer<Framebuffer> target; /// The viewport on the screen where the shader pass should be rendered. /** * The shader pass is rendered to this rectangular area on the screen. * The default viewport covers the entire screen. */ Viewport viewport; }; //########################################################################################## //********************** End Rim Graphics Renderers Namespace **************************** RIM_GRAPHICS_RENDERERS_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_GRAPHICS_POST_PROCESS_EFFECT_H <file_sep>/* * rimUniformDistribution.h * Rim Math * * Created by <NAME> on 5/8/08. * Copyright 2008 Rim Software. All rights reserved. * */ #ifndef INCLUDE_RIM_UNIFORM_DISTRIBUTION_H #define INCLUDE_RIM_UNIFORM_DISTRIBUTION_H #include "rimMathConfig.h" #include "rimRandomVariable.h" //########################################################################################## //***************************** Start Rim Math Namespace ********************************* RIM_MATH_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class which represents a uniform distribution of numbers of a certain type. template < typename T > class UniformDistribution { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructors /// Create a uniform distribution on the interval [0,1]. RIM_INLINE UniformDistribution() : minimum( 0 ), maximum( 1 ), randomVariable() { } /// Create a uniform distribution on the interval [0,1] with the specified random variable. /** * The created uniform distribution will produce samples using the * specified random variable. */ RIM_INLINE UniformDistribution( const RandomVariable<T>& newRandomVariable ) : minimum( 0 ), maximum( 1 ), randomVariable( newRandomVariable ) { } /// Create a uniform distribution on the interval [ min, max ]. RIM_INLINE UniformDistribution( T min, T max ) : minimum( min ), maximum( max ), randomVariable() { } /// Create a uniform distribution on the interval [ min, max ] using the specified random variable. /** * The created uniform distribution will produce samples using the * specified random variable. */ RIM_INLINE UniformDistribution( T min, T max, const RandomVariable<T>& newRandomVariable ) : minimum( min ), maximum( max ), randomVariable( newRandomVariable ) { } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Distribution Sample Generation Method /// Generate a sample from the uniform distribution. RIM_INLINE T sample() { return randomVariable.sample( minimum, maximum ); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Distribution Minimum Accessor Methods /// Get the minimum value that the uniform distribution can generate. RIM_INLINE T getMinimum() const { return minimum; } /// Set the minimum value that the uniform distribution can generate. RIM_INLINE void setMinimum( T min ) { minimum = min; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Distribution Maximum Accessor Methods /// Get the maximum value that the uniform distribution can generate. RIM_INLINE T getMaximum() const { return maximum; } /// Set the maximum value that the uniform distribution can generate. RIM_INLINE void setMaximum( T max ) { maximum = max; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Random Variable Accessor Methods /// Get the random variable used to generate samples for this distribution. RIM_INLINE RandomVariable<T>& getRandomVariable() { return randomVariable; } /// Get the random variable used to generate samples for this distribution. RIM_INLINE const RandomVariable<T>& getRandomVariable() const { return randomVariable; } /// Set the random variable used to generate samples for this distribution. RIM_INLINE void getRandomVariable( const RandomVariable<T>& newRandomVariable ) { randomVariable = newRandomVariable; } private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Members /// The minimum value that can be generated by the distribution. T minimum; /// The maximum value that can be generated by the distribution. T maximum; /// The random variable that the uniform distribution uses to generate samples. RandomVariable<T> randomVariable; }; //########################################################################################## //***************************** End Rim Math Namespace *********************************** RIM_MATH_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_NORMAL_DISTRIBUTION_H <file_sep>/* * rimGraphicsGenericTextureBinding.h * Rim Graphics * * Created by <NAME> on 9/26/13. * Copyright 2013 __MyCompanyName__. All rights reserved. * */ #ifndef INCLUDE_RIM_GRAPHICS_GENERIC_TEXTURE_BINDING_H #define INCLUDE_RIM_GRAPHICS_GENERIC_TEXTURE_BINDING_H #include "rimGraphicsShadersConfig.h" //########################################################################################## //*********************** Start Rim Graphics Shaders Namespace *************************** RIM_GRAPHICS_SHADERS_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// An object that encapsulates information about the binding of a texture to a name and usage. class GenericTextureBinding { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructors /// Create a new generic texture binding object with no name, UNDEFINED usage, and NULL image. RIM_INLINE GenericTextureBinding() : name(), usage( TextureUsage::UNDEFINED ), texture(), isInput( true ) { } /// Create a new generic texture binding object with the specified name, usage, and texture image. RIM_INLINE GenericTextureBinding( const String& newName, const TextureUsage& newUsage ) : name( newName ), usage( newUsage ), texture(), isInput( true ) { } /// Create a new generic texture binding object with the specified name, usage, and texture image. RIM_INLINE GenericTextureBinding( const String& newName, const Resource<GenericTexture>& newTexture, const TextureUsage& newUsage, Bool newIsInput = true ) : name( newName ), usage( newUsage ), texture( newTexture ), isInput( true ) { } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Binding Name Accessor Methods /// Return a string representing the name of the texture binding. RIM_INLINE const String& getName() const { return name; } /// Set a string representing the name of the texture binding. RIM_INLINE void setName( const String& newName ) { name = newName; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Binding Usage Accessor Methods /// Return an enum value indicating the semantic usage of this texture binding. RIM_INLINE const TextureUsage& getUsage() const { return usage; } /// Set an enum value indicating the semantic usage of this texture binding. RIM_INLINE void setUsage( const TextureUsage& newUsage ) { usage = newUsage; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Texture Binding Image Accessor Methods /// Return a pointer to the texture used for this texture binding. RIM_INLINE const Resource<GenericTexture>& getTexture() const { return texture; } /// Set a pointer to the texture used for this texture binding. RIM_INLINE void setTexture( const Resource<GenericTexture>& newTexture ) { texture = newTexture; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Input Status Accessor Methods /// Return whether or not this texture binding is a dynamic input to a shader pass. /** * If so, the renderer can provide dynamic scene information for this binding * (such as nearby lights, textures, etc) that aren't explicitly part of this * binding. By default, all bindings are inputs. */ RIM_INLINE Bool getIsInput() const { return isInput; } /// Set whether or not this texture binding is a dynamic input to a shader pass. /** * If so, the renderer can provide dynamic scene information for this binding * (such as nearby lights, textures, etc) that aren't explicitly part of this * binding. */ RIM_INLINE void setIsInput( Bool newInput ) { isInput = newInput; } private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Members /// A string representing the name of the texture binding. String name; /// An enum value indicating the semantic usage of this texture binding. TextureUsage usage; /// A pointer to the texture used for this texture binding. Resource<GenericTexture> texture; /// A boolean value indicating whether or not this binding represents a dynamic input. Bool isInput; }; //########################################################################################## //*********************** End Rim Graphics Shaders Namespace ***************************** RIM_GRAPHICS_SHADERS_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_GRAPHICS_GENERIC_TEXTURE_BINDING_H <file_sep>/* * rimGraphicsScene.h * Rim Graphics * * Created by <NAME> on 12/5/10. * Copyright 2010 Rim Software. All rights reserved. * */ #ifndef INCLUDE_RIM_GRAPHICS_SCENE_H #define INCLUDE_RIM_GRAPHICS_SCENE_H #include "rimGraphicsScenesConfig.h" //########################################################################################## //************************ Start Rim Graphics Scenes Namespace *************************** RIM_GRAPHICS_SCENES_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class that contains all of the information necessary to draw a complete graphics scene. class GraphicsScene { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructor /// Create a new empty graphics scene with the default initial state. GraphicsScene(); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Destructor /// Destroy this scene, releasing all resources. virtual ~GraphicsScene(); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Update Method /// Update the scene from its previous state using the specified time step. /** * This allows the scene to update bounding volumes, animations, etc. with their * current states. */ virtual void update( const Time& dt ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Object Accessor Methods /// Return the number of objects that there are in this graphics scene. RIM_INLINE Size getObjectCount() const { return objects.getSize(); } /// Return a pointer to the object at the specified index in this scene. RIM_INLINE const Pointer<GraphicsObject>& getObject( Index objectIndex ) const { return objects[objectIndex]; } /// Add a new object to this scene. /** * The method returns whether or not the operation was successful. * The method fails if the specified object pointer is NULL. */ Bool addObject( const Pointer<GraphicsObject>& object ); /// Remove the object at the specified index from this scene. /** * The method returns whether or not the operation was successful. * The method fails if the specified index is out of bounds. */ Bool removeObject( Index objectIndex ); /// Remove the specified object from this scene. /** * The method returns whether or not the object was found and successfully removed. */ Bool removeObject( const Pointer<GraphicsObject>& object ); /// Remove all objects from this scene. void clearObjects(); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Light Accessor Methods /// Return the number of lights that are part of this scene. RIM_INLINE Size getLightCount() const { return lights.getSize(); } /// Return a pointer to the light at the specified index in this scene. RIM_INLINE const Pointer<Light>& getLight( Index lightIndex ) const { return lights[lightIndex]; } /// Add a new light to this scene. /** * The method returns whether or not the operation was successful. * The method fails if the specified light pointer is NULL. */ Bool addLight( const Pointer<Light>& light ); /// Remove the light at the specified index from this scene. /** * The method returns whether or not the operation was successful. * The method fails if the specified index is out of bounds. */ Bool removeLight( Index lightIndex ); /// Remove the specified light from this scene. /** * The method returns whether or not the light was found and successfully removed. */ Bool removeLight( const Pointer<Light>& light ); /// Remove all lights from this scene. void clearLights(); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Camera Accessor Methods /// Return the number of cameras that are part of this scene. RIM_INLINE Size getCameraCount() const { return cameras.getSize(); } /// Return a pointer to the camera in this scene at the specified index. RIM_INLINE const Pointer<Camera>& getCamera( Index cameraIndex ) const { return cameras[cameraIndex]; } /// Add a new camera to this scene. /** * The method returns whether or not the camera was successfully added. * The method can fail if the specified camera pointer is NULL. */ Bool addCamera( const Pointer<Camera>& camera ); /// Remove the specified camera from this scene. /** * The method returns whether or not the camera was found and * successfully removed. */ Bool removeCamera( Index cameraIndex ); /// Remove the specified camera from this scene. /** * The method returns whether or not the camera was found and * successfully removed. */ Bool removeCamera( const Pointer<Camera>& camera ); /// Remove all cameras from this scene. void clearCameras(); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Controller Accessor Methods /// Return the number of animation controllers that are part of this scene. RIM_INLINE Size getControllerCount() const { return controllers.getSize(); } /// Return a pointer to the animation controller in this scene at the specified index. RIM_INLINE const Pointer<AnimationController>& getController( Index controllerIndex ) const { return controllers[controllerIndex]; } /// Add a new animation controller to this scene. /** * The method returns whether or not the animation controller was successfully added. * The method can fail if the specified animation controller pointer is NULL. */ Bool addController( const Pointer<AnimationController>& controller ); /// Remove the specified animation controller from this scene. /** * The method returns whether or not the animation controller was found and * successfully removed. */ Bool removeController( Index controllerIndex ); /// Remove the specified animation controller from this scene. /** * The method returns whether or not the animation controller was found and * successfully removed. */ Bool removeController( const Pointer<AnimationController>& controller ); /// Remove all animation controllers from this scene. void clearControllers(); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Object Culler Accessor Methods /// Return a pointer to the object culler that this scene uses to cull hidden objects. RIM_INLINE const Pointer<ObjectCuller>& getObjectCuller() const { return objectCuller; } /// Set a pointer to the object culler that this scene uses to cull hidden objects. /** * The method returns whether or not the object culler was changed. The method * can fail if the specified object culler pointer is NULL. */ Bool setObjectCuller( const Pointer<ObjectCuller>& newObjectCuller ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Light Culler Accessor Methods /// Return a pointer to the hidden culler that this scene uses to cull hidden objects. RIM_INLINE const Pointer<LightCuller>& getLightCuller() const { return lightCuller; } /// Set a pointer to the light culler that this scene uses to cull hidden lights. /** * The method returns whether or not the light culler was changed. The method * can fail if the specified light culler pointer is NULL. */ Bool setLightCuller( const Pointer<LightCuller>& newLightCuller ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Name Accessor Methods /// Return the name of the generic graphics scene. RIM_INLINE const String& getName() const { return name; } /// Set the name of the generic graphics scene. RIM_INLINE void setName( const String& newName ) { name = newName; } private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Members /// A list of the objects that are part of this scene. ArrayList< Pointer<GraphicsObject> > objects; /// A list of the lights that are part of this scene. ArrayList< Pointer<Light> > lights; /// A list of the cameras that are part of this scene. ArrayList< Pointer<Camera> > cameras; /// A list of the animation controllers that are part of this scene. ArrayList< Pointer<AnimationController> > controllers; /// A pointer to an object which handles hidden object culling for this scene. Pointer<ObjectCuller> objectCuller; /// A pointer to an object which handles hidden light culling for this scene. Pointer<LightCuller> lightCuller; /// A string representing the name of this generic scene. String name; }; //########################################################################################## //************************ End Rim Graphics Scenes Namespace ***************************** RIM_GRAPHICS_SCENES_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_GRAPHICS_SCENE_H <file_sep>/* * rimGraphicsGenericShaderPass.h * Rim Software * * Created by <NAME> on 1/30/14. * Copyright 2014 __MyCompanyName__. All rights reserved. * */ #ifndef INCLUDE_RIM_GRAPHICS_GENERIC_SHADER_PASS_H #define INCLUDE_RIM_GRAPHICS_GENERIC_SHADER_PASS_H #include "rimGraphicsShadersConfig.h" #include "rimGraphicsShaderPassSource.h" #include "rimGraphicsShaderPassUsage.h" //########################################################################################## //*********************** Start Rim Graphics Shaders Namespace *************************** RIM_GRAPHICS_SHADERS_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class which contains a set of ShaderPassSource code implementations for different platforms. class GenericShaderPass { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructors /// Create a new generic shader pass that has no implementation sources. /** * The shader pass has an empty name string and ShaderPassUsage::UNDEFINED usage. */ RIM_INLINE GenericShaderPass() : name(), usage( ShaderPassUsage::UNDEFINED ) { } /// Create a new generic shader pass with the specified usage and no name. RIM_INLINE GenericShaderPass( const ShaderPassUsage& newUsage ) : name(), usage( newUsage ) { } /// Create a new generic shader pass with the specified name and usage. RIM_INLINE GenericShaderPass( const ShaderPassUsage& newUsage, const String& newName ) : name( newName ), usage( newUsage ) { } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Name Accessor Methods /// Return the name of this shader pass. RIM_INLINE const String& getName() const { return name; } /// Set the name of this generic shader pass. RIM_INLINE void setName( const String& newName ) { name = newName; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Usage Accessor Methods /// Return an object which describes the semantic usage of this generic shader pass. RIM_INLINE const ShaderPassUsage& getUsage() const { return usage; } /// Set an object which describes the semantic usage of this generic shader pass. RIM_INLINE void setUsage( const ShaderPassUsage& newUsage ) { usage = newUsage; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Source Accessor Methods /// Return the number of sources that this generic shader pass has. RIM_INLINE Size getSourceCount() const { return sources.getSize(); } /// Return a pointer to the source at the specified index in this generic shader pass. RIM_INLINE const Pointer<ShaderPassSource>& getSource( Index sourceIndex ) const { return sources[sourceIndex]; } /// Return a pointer to the source of this generic shader pass that uses the specified shader language. /** * If there is no shader pass source that uses the specified shader language, * a NULL pointer is returned. */ Pointer<ShaderPassSource> getSourceWithLanguage( const ShaderLanguage& language ) const; /// Replace the source at the specified index in this generic shader pass. /** * If the specified source is NULL, the method fails and returns FALSE. * Otherwise, the source at that index is replaced and TRUE is returned. */ Bool setSource( Index sourceIndex, const Pointer<ShaderPassSource>& newSource ); /// Add a new shader source to the end of this generic shader pass's list of sources. /** * If the specified source is NULL, the method fails and returns FALSE. * Otherwise, the new source is added and TRUE is returned. */ Bool addSource( const Pointer<ShaderPassSource>& newSource ); /// Remove the source at the specified index in this generic shader pass. /** * This method maintains the order of the remaining sources. */ void removeSource( Index sourceIndex ); /// Clear all sources from this generic shader pass. void clearSources(); private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Members /// A pointer to a string representing the name of this generic shader pass. String name; /// An enum value representing the semantic usage of this generic shader pass. ShaderPassUsage usage; /// A list of the different sources for this generic shader pass. ArrayList< Pointer<ShaderPassSource> > sources; }; //########################################################################################## //*********************** End Rim Graphics Shaders Namespace ***************************** RIM_GRAPHICS_SHADERS_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_GRAPHICS_GENERIC_SHADER_PASS_H <file_sep>/* * rimBasicString.h * Rim Framework * * Created by <NAME> on 7/13/11. * Copyright 2011 __MyCompanyName__. All rights reserved. * */ #ifndef INCLUDE_RIM_BASIC_STRING_H #define INCLUDE_RIM_BASIC_STRING_H #include "rimDataConfig.h" #include "rimHashCode.h" //########################################################################################## //******************************* Start Data Namespace ********************************* RIM_DATA_NAMESPACE_START //****************************************************************************************** //########################################################################################## template < typename CharType > class BasicStringBuffer; //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A string class supporting unicode and ASCII character sets. /** * The BasicString class is a template class which allows the user to use any of * four different specializations: Char for ASCII strings, UTF8Char for UTF-8 strings, * UTF16Char for UTF-16 strings, and UTF32Char for UTF-32 strings. In addition to this * functionality, it provides comprehensive number-to-string and string-to-number conversion * using constructors and cast operators. All strings are immutable after creation. * Use the BasicStringBuffer class to efficiently compose strings. * * Strings are reference-counted, so the overhead of copying a string object * is very small. */ template < typename CharType > class BasicString { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructors /// Create an empty string. RIM_INLINE BasicString() : shared( nullString ) { shared->referenceCount++; string = shared->getCharacters(); } /// Create a string consisting of a single character. RIM_INLINE BasicString( Char character ) : shared( allocateString( 2 ) ) { string = shared->getCharacters(); string[0] = character; string[1] = '\0'; } /// Create a string from a NULL-terminated character array. BasicString( const Char* array ); /// Create a string from a NULL-terminated character array. BasicString( const UTF8Char* array ); /// Create a string from a NULL-terminated character array. BasicString( const UTF16Char* array ); /// Create a string from a NULL-terminated character array. BasicString( const UTF32Char* array ); /// Create a string from a character array with the specified length. BasicString( const Char* array, Size length ); /// Create a string from a character array with the specified length. BasicString( const UTF8Char* array, Size length ); /// Create a string from a character array with the specified length. BasicString( const UTF16Char* array, Size length ); /// Create a string from a character array with the specified length. BasicString( const UTF32Char* array, Size length ); /// Create a copy of the specified other string. RIM_INLINE BasicString( const BasicString& other ) : shared( other.shared ), string( other.string ) { shared->referenceCount++; } /// Create a copy of the specified other string with a different character type. template < typename OtherCharType > explicit BasicString( const BasicString<OtherCharType>& other ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Number-To-String Conversion Constructors /// Create a new boolean literal string for the specified value. RIM_INLINE explicit BasicString( Bool boolean ) : shared( boolean ? trueString : falseString ) { shared->referenceCount++; string = shared->getCharacters(); } /// Create a string which represents the specified integer number in the given base system. RIM_INLINE explicit BasicString( Short number, Size base = 10 ) : shared( fromIntegerType( (Int32)number, base ) ) { string = shared->getCharacters(); } /// Create a string which represents the specified integer number in the given base system. RIM_INLINE explicit BasicString( UShort number, Size base = 10 ) : shared( fromIntegerType( (UInt32)number, base ) ) { string = shared->getCharacters(); } /// Create a string which represents the specified integer number in the given base system. RIM_INLINE explicit BasicString( Int number, Size base = 10 ) : shared( fromIntegerType( (Int32)number, base ) ) { string = shared->getCharacters(); } /// Create a string which represents the specified integer number in the given base system. RIM_INLINE explicit BasicString( UInt number, Size base = 10 ) : shared( fromIntegerType( (UInt32)number, base ) ) { string = shared->getCharacters(); } /// Create a string which represents the specified integer number in the given base system. RIM_INLINE explicit BasicString( Long number, Size base = 10 ) : shared( fromIntegerType( (Int32)number, base ) ) { string = shared->getCharacters(); } /// Create a string which represents the specified integer number in the given base system. RIM_INLINE explicit BasicString( ULong number, Size base = 10 ) : shared( fromIntegerType( (UInt32)number, base ) ) { string = shared->getCharacters(); } /// Create a string which represents the specified integer number in the given base system. RIM_INLINE explicit BasicString( LongLong number, Size base = 10 ) : shared( fromIntegerType( (Int64)number, base ) ) { string = shared->getCharacters(); } /// Create a string which represents the specified integer number in the given base system. RIM_INLINE explicit BasicString( ULongLong number, Size base = 10 ) : shared( fromIntegerType( (UInt64)number, base ) ) { string = shared->getCharacters(); } /// Create a string which represents the specified floating-point number with default formating. /** * The number is displayed with the maximum precision for its type in base 10, * and scientific notation is automatically used when necessary. */ RIM_INLINE explicit BasicString( Float number ) : shared( fromFloatType( number, 6, 10, true ) ) { string = shared->getCharacters(); } /// Create a string which represents the specified floating-point number in the given base system. /** * This method allows the user to determine the number of decimal places to display, * the base system, and whether or not the allow scientific notation. */ RIM_INLINE explicit BasicString( Float number, Size numDecimalPlaces, Size base = 10, Bool allowScientific = true ) : shared( fromFloatType( number, numDecimalPlaces, base, allowScientific ) ) { string = shared->getCharacters(); } /// Create a string which represents the specified double floating-point number with default formating. /** * The number is displayed with the maximum precision for its type in base 10, * and scientific notation is automatically used when necessary. */ RIM_INLINE explicit BasicString( Double number ) : shared( fromFloatType( number, 15, 10, true ) ) { string = shared->getCharacters(); } /// Create a string which represents the specified double floating-point number in the given base system. /** * This method allows the user to determine the number of decimal places to display, * the base system, and whether or not the allow scientific notation. */ RIM_INLINE explicit BasicString( Double number, Size numDecimalPlaces, Size base = 10, Bool allowScientific = true ) : shared( fromFloatType( number, numDecimalPlaces, base, allowScientific ) ) { string = shared->getCharacters(); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Destructor /// Destroy this string, releasing its internal character buffer if the reference count is 0. RIM_INLINE ~BasicString() { deallocateString( shared ); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Assignment Operator /// Assign the contents of another string to this string. /** * The reference count of the other string is increased by one * and it replaces the current string of this object, deallocating * the previous string if its reference count reaches 0. */ RIM_INLINE BasicString& operator = ( const BasicString& other ) { if ( shared != other.shared ) { deallocateString( shared ); shared = other.shared; shared->referenceCount++; string = shared->getCharacters(); } return *this; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** String Equality Comparison Methods /// Return whether or not this string is exactly equal to another. RIM_INLINE Bool equals( const BasicString& other ) const { if ( shared->length == other.shared->length ) return BasicString::equals( string, other.string ); else return false; } /// Return whether or not this string is equal to another if letter case is ignored. RIM_INLINE Bool equalsIgnoreCase( const BasicString& other ) const { if ( shared->length == other.shared->length ) return BasicString::equalsIgnoreCase( string, other.string ); else return false; } /// Return whether or not this string is exactly equal to a NULL-terminated character string. RIM_INLINE Bool equals( const CharType* characters ) const { return BasicString::equals( string, characters ); } /// Return whether or not this string is equal to a NULL-terminated character string if letter case is ignored. RIM_INLINE Bool equalsIgnoreCase( const CharType* characters ) const { return BasicString::equalsIgnoreCase( string, characters ); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** String Equality Comparison Operators /// Return whether or not this string is exactly equal to another. RIM_INLINE Bool operator == ( const BasicString& other ) const { return BasicString::equals( string, other.string ); } /// Return whether or not this string is not equal to another. RIM_INLINE Bool operator != ( const BasicString& other ) const { return !BasicString::equals( string, other.string ); } /// Return whether or not this string is exactly equal to a NULL-terminated character string. RIM_INLINE Bool operator == ( const CharType* other ) const { return BasicString::equals( string, string ); } /// Return whether or not this string is not equal to a NULL-terminated character string. RIM_INLINE Bool operator != ( const CharType* other ) const { return !BasicString::equals( string, string ); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** String Sorting Comparison Methods /// Return an integer indicating the lexical order of this string when compared to another. /** * If this string should come before the other, -1 is returned. * If this string is equal to the other, 0 is returned. * If this string should come after the other, 1 is returned. */ RIM_INLINE Int compareTo( const BasicString& other ) const { return BasicString::compare( string, other.string ); } /// Return an integer indicating the lexical order of this string when compared to another, ignoring letter case. /** * If this string should come before the other, -1 is returned. * If this string is equal to the other, 0 is returned. * If this string should come after the other, 1 is returned. */ RIM_INLINE Int compareToIgnoreCase( const BasicString& other ) const { return BasicString::compareIgnoreCase( string, other.string ); } /// Return an integer indicating the lexical order of this string when compared to a C-string. /** * If this string should come before the other, -1 is returned. * If this string is equal to the other, 0 is returned. * If this string should come after the other, 1 is returned. */ RIM_INLINE Int compareTo( const CharType* characters ) const { return BasicString::compare( string, characters ); } /// Return an integer indicating the lexical order of this string when compared to a C-string, ignoring letter case. /** * If this string should come before the other, -1 is returned. * If this string is equal to the other, 0 is returned. * If this string should come after the other, 1 is returned. */ RIM_INLINE Int compareToIgnoreCase( const CharType* characters ) const { return BasicString::compareIgnoreCase( string, characters ); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** String Sorting Operators /// Return whether or not this string comes before another one in the lexical order. RIM_INLINE Bool operator < ( const BasicString& other ) const { return BasicString::compare( string, string.string ) == -1; } /// Return whether or not this string comes after another one in the lexical order. RIM_INLINE Bool operator > ( const BasicString& other ) const { return BasicString::compare( string, string.string ) == 1; } /// Return whether or not this string comes before or is the same as another one in the lexical order. RIM_INLINE Bool operator <= ( const BasicString& other ) const { return BasicString::compare( string, string.string ) <= 0; } /// Return whether or not this string comes after or is the same as another one in the lexical order. RIM_INLINE Bool operator >= ( const BasicString& other ) const { return BasicString::compare( string, string.string ) >= 0; } /// Return whether or not this string comes before a C-string in the lexical order. RIM_INLINE Bool operator < ( const CharType* characters ) const { return BasicString::compare( string, characters ) == -1; } /// Return whether or not this string comes after a C-string in the lexical order. RIM_INLINE Bool operator > ( const CharType* characters ) const { return BasicString::compare( string, characters ) == 1; } /// Return whether or not this string comes before or is the same as a C-string in the lexical order. RIM_INLINE Bool operator <= ( const CharType* characters ) const { return BasicString::compare( string, characters ) < 1; } /// Return whether or not this string comes after or is the same as a C-string in the lexical order. RIM_INLINE Bool operator >= ( const CharType* characters ) const { return BasicString::compare( string, characters ) > -1; } /// Return whether or not this string comes before another one in the lexical order, ignoring letter case. RIM_INLINE Bool operator << ( const BasicString& other ) const { return BasicString::compareIgnoreCase( string, string.string ) == -1; } /// Return whether or not this string comes after another one in the lexical order, ignoring letter case. RIM_INLINE Bool operator >> ( const BasicString& other ) const { return BasicString::compareIgnoreCase( string, string.string ) == 1; } /// Return whether or not this string comes before or is the same as another one in the lexical order, ignoring letter case. RIM_INLINE Bool operator <<= ( const BasicString& other ) const { return BasicString::compareIgnoreCase( string, string.string ) < 1; } /// Return whether or not this string comes after or is the same as another one in the lexical order, ignoring letter case. RIM_INLINE Bool operator >>= ( const BasicString& other ) const { return BasicString::compareIgnoreCase( string, string.string ) > -1; } /// Return whether or not this string comes before a C-string in the lexical order, ignoring letter case. RIM_INLINE Bool operator << ( const CharType* characters ) const { return BasicString::compareIgnoreCase( string, characters ) == -1; } /// Return whether or not this string comes before a C-string in the lexical order, ignoring letter case. RIM_INLINE Bool operator >> ( const CharType* characters ) const { return BasicString::compareIgnoreCase( string, characters ) == 1; } /// Return whether or not this string comes before or is the same as a C-string in the lexical order, ignoring letter case. RIM_INLINE Bool operator <<= ( const CharType* characters ) const { return BasicString::compareIgnoreCase( string, characters ) < 1; } /// Return whether or not this string comes after or is the same as a C-string in the lexical order, ignoring letter case. RIM_INLINE Bool operator >>= ( const CharType* characters ) const { return BasicString::compareIgnoreCase( string, characters ) > -1; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Concatenation Operators BasicString operator + ( const BasicString& other ) const; RIM_INLINE BasicString operator + ( const Char* characters ) const { return (*this) + BasicString(characters); } RIM_INLINE BasicString operator + ( Char character ) const { return (*this) + BasicString(character); } RIM_INLINE BasicString operator + ( Short value ) const { return (*this) + BasicString(value); } RIM_INLINE BasicString operator + ( UShort value ) const { return (*this) + BasicString(value); } RIM_INLINE BasicString operator + ( Int value ) const { return (*this) + BasicString(value); } RIM_INLINE BasicString operator + ( UInt value ) const { return (*this) + BasicString(value); } RIM_INLINE BasicString operator + ( Long value ) const { return (*this) + BasicString(value); } RIM_INLINE BasicString operator + ( ULong value ) const { return (*this) + BasicString(value); } RIM_INLINE BasicString operator + ( LongLong value ) const { return (*this) + BasicString(value); } RIM_INLINE BasicString operator + ( ULongLong value ) const { return (*this) + BasicString(value); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** String to Number Conversion Operators /// Cast this string to an integer, returning math::nan<Int32>() if the conversion fails. RIM_INLINE operator Int () const { return (Long)*this; } /// Cast this string to an integer, returning math::nan<UInt32>() if the conversion fails. RIM_INLINE operator UInt () const { return (ULong)*this; } /// Cast this string to an integer, returning math::nan<Int32>() if the conversion fails. RIM_INLINE operator Long () const { Int32 value; if ( this->toInt32( value ) ) return value; else return math::nan<Int32>(); } /// Cast this string to an integer, returning math::nan<UInt32>() if the conversion fails. RIM_INLINE operator ULong () const { UInt32 value; if ( this->toUInt32( value ) ) return value; else return math::nan<UInt32>(); } /// Cast this string to an integer, returning math::nan<Int64>() if the conversion fails. RIM_INLINE operator LongLong () const { Int64 value; if ( this->toInt64( value ) ) return value; else return math::nan<Int64>(); } /// Cast this string to an integer, returning math::nan<UInt64>() if the conversion fails. RIM_INLINE operator ULongLong () const { UInt64 value; if ( this->toUInt64( value ) ) return value; else return math::nan<UInt64>(); } /// Cast this string to a floating-point number, returning math::nan<Float>() if the conversion fails. RIM_INLINE operator Float () const { Float value; if ( this->toFloat( value ) ) return value; else return math::nan<Float>(); } /// Cast this string to a double floating-point number, returning math::nan<Double>() if the conversion fails. RIM_INLINE operator Double () const { Double value; if ( this->toDouble( value ) ) return value; else return math::nan<Double>(); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** String to Number Conversion Methods /// Convert this string to a boolean value, returning whether or not the conversion was successful. /** * If the conversion is successful, the converted value is placed in the output parameter. */ Bool toBool( Bool& value ) const; /// Convert this string to a float value, returning whether or not the conversion was successful. /** * If the conversion is successful, the converted value is placed in the output parameter. */ Bool toFloat( Float& value ) const; /// Convert this string to a double value, returning whether or not the conversion was successful. /** * If the conversion is successful, the converted value is placed in the output parameter. */ Bool toDouble( Double& value ) const; /// Convert this string to an integer value, returning whether or not the conversion was successful. /** * If the conversion is successful, the converted value is placed in the output parameter. */ RIM_INLINE Bool toInt( Int& value ) const { Double d; if ( this->toDouble( d ) ) { value = safeTypeConversion<Int>( d ); return true; } return false; } /// Convert this string to an unsigned integer value, returning TRUE if the conversion was successful. /** * If the conversion is successful, the converted value is placed in the output parameter. */ Bool toUInt( UInt32& value ) const { Double d; if ( this->toDouble( d ) ) { value = safeTypeConversion<UInt>( d ); return true; } return false; } /// Convert this string to a 32-bit integer value, returning whether or not the conversion was successful. /** * If the conversion is successful, the converted value is placed in the output parameter. */ RIM_INLINE Bool toInt32( Int32& value ) const { Double d; if ( this->toDouble( d ) ) { value = safeTypeConversion<Int32>( d ); return true; } return false; } /// Convert this string to a 32-bit unsigned integer value, returning TRUE if the conversion was successful. /** * If the conversion is successful, the converted value is placed in the output parameter. */ RIM_INLINE Bool toUInt32( UInt32& value ) const { Double d; if ( this->toDouble( d ) ) { value = safeTypeConversion<UInt32>( d ); return true; } return false; } /// Convert this string to a 64-bit integer value, returning whether or not the conversion was successful. /** * If the conversion is successful, the converted value is placed in the output parameter. */ RIM_INLINE Bool toInt64( Int64& value ) const { Double d; if ( this->toDouble( d ) ) { value = safeTypeConversion<Int64>( d ); return true; } return false; } /// Convert this string to a 64-bit unsigned integer value, returning TRUE if the conversion was successful. /** * If the conversion is successful, the converted value is placed in the output parameter. */ RIM_INLINE Bool toUInt64( UInt64& value ) const { Double d; if ( this->toDouble( d ) ) { value = safeTypeConversion<UInt64>( d ); return true; } return false; } /// Convert this string to a templated number value, returning TRUE if the conversion was successful. /** * If the conversion is successful, the converted value is placed in the output parameter. * This method will not compile for non-primitive types. */ template < typename T > RIM_INLINE Bool toNumber( T& value ) const { Double d; if ( this->toDouble( d ) ) { value = safeTypeConversion<T>( d ); return true; } return false; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Static String to Number Conversion Methods /// Convert a string specified by starting and ending pointers to a boolean value. /** * The method returns whether or not the conversion was successful. */ static Bool convertToBool( const CharType* stringStart, const CharType* stringEnd, Bool& result ) { if ( !stringStart || stringStart >= stringEnd ) return false; return convertStringToBoolean( stringStart, stringEnd, result ); } /// Convert a string specified by starting and ending pointers to an integer value. /** * The method returns whether or not the conversion was successful. */ static Bool convertToInt( const CharType* stringStart, const CharType* stringEnd, Int& result ) { if ( !stringStart || stringStart >= stringEnd ) return false; Double d; if ( convertStringToNumber( stringStart, stringEnd, d ) ) { result = safeTypeConversion<Int>( d ); return true; } return false; } /// Convert a string specified by starting and ending pointers to an integer value. /** * The method returns whether or not the conversion was successful. */ static Bool convertToInt32( const CharType* stringStart, const CharType* stringEnd, Int32& result ) { if ( !stringStart || stringStart >= stringEnd ) return false; Double d; if ( convertStringToNumber( stringStart, stringEnd, d ) ) { result = safeTypeConversion<Int32>( d ); return true; } return false; } /// Convert a string specified by starting and ending pointers to an integer value. /** * The method returns whether or not the conversion was successful. */ static Bool convertToUInt32( const CharType* stringStart, const CharType* stringEnd, UInt32& result ) { if ( !stringStart || stringStart >= stringEnd ) return false; Double d; if ( convertStringToNumber( stringStart, stringEnd, d ) ) { result = safeTypeConversion<UInt32>( d ); return true; } return false; } /// Convert a string specified by starting and ending pointers to an integer value. /** * The method returns whether or not the conversion was successful. */ static Bool convertToInt64( const CharType* stringStart, const CharType* stringEnd, Int64& result ) { if ( !stringStart || stringStart >= stringEnd ) return false; Double d; if ( convertStringToNumber( stringStart, stringEnd, d ) ) { result = safeTypeConversion<Int64>( d ); return true; } return false; } /// Convert a string specified by starting and ending pointers to an integer value. /** * The method returns whether or not the conversion was successful. */ static Bool convertToUInt64( const CharType* stringStart, const CharType* stringEnd, UInt64& result ) { if ( !stringStart || stringStart >= stringEnd ) return false; Double d; if ( convertStringToNumber( stringStart, stringEnd, d ) ) { result = safeTypeConversion<UInt64>( d ); return true; } return false; } /// Convert a string specified by starting and ending pointers to a float value. /** * The method returns whether or not the conversion was successful. */ static Bool convertToFloat( const CharType* stringStart, const CharType* stringEnd, Float& result ) { if ( !stringStart || stringStart >= stringEnd ) return false; return convertStringToNumber( stringStart, stringEnd, result ); } /// Convert a string specified by starting and ending pointers to a float value. /** * The method returns whether or not the conversion was successful. */ static Bool convertToDouble( const CharType* stringStart, const CharType* stringEnd, Double& result ) { if ( !stringStart || stringStart >= stringEnd ) return false; return convertStringToNumber( stringStart, stringEnd, result ); } /// Convert a string specified by starting and ending pointers to a number value. /** * The method returns whether or not the conversion was successful. */ template < typename T > static Bool convertToNumber( const CharType* stringStart, const CharType* stringEnd, T& result ) { if ( !stringStart || stringStart >= stringEnd ) return false; Double d; if ( convertStringToNumber( stringStart, stringEnd, d ) ) { result = safeTypeConversion<T>( d ); return true; } return false; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** String to Number Conversion Test Methods /// Return whether or not this string represents a valid number. RIM_INLINE Bool isANumber() const { return isANumber( string, shared->length ); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Character Accessor Methods /// Return the character at the specified index in this string. /** * A debug assertion is raised if the index is invalid. */ RIM_INLINE CharType get( Index index ) const { RIM_DEBUG_ASSERT_MESSAGE( index < length - 1, "String index is out-of-bounds" ); return string[index]; } /// Return the character at the specified index in this string. /** * A debug assertion is raised if the index is invalid. */ RIM_INLINE CharType operator [] ( Index index ) const { RIM_DEBUG_ASSERT_MESSAGE( index < length - 1, "String index is out-of-bounds" ); return string[index]; } /// Return the character at the specified index in this string. /** * A debug assertion is raised if the index is invalid. */ RIM_INLINE CharType operator () ( Index index ) const { RIM_DEBUG_ASSERT_MESSAGE( index < length - 1, "String index is out-of-bounds" ); return string[index]; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Substring Accessor Method /// Return a sub-string of this string, specified by the start index and number of code points (characters). RIM_INLINE BasicString getSubString( Index start, Size number ) const { RIM_DEBUG_ASSERT_MESSAGE( start < length - 1, "Substring start index is out of string bounds" ); RIM_DEBUG_ASSERT_MESSAGE( start + number < length, "Substring end index is out of string bounds" ); return BasicString( string + start, number ); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** String Character Array Accessor Method /// Return a pointer to a NULL-terminated character array representing this string. RIM_INLINE const CharType* getCString() const { return string; } /// Return a pointer to a NULL-terminated character array representing this string. RIM_INLINE const CharType* getPointer() const { return string; } /// Return a pointer to a NULL-terminated character array representing this string. RIM_INLINE operator const CharType* () const { return string; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** String Length Accessor Methods /// Return the number of character code points that are part of this string, not including the NULL terminator. RIM_FORCE_INLINE Size getLength() const { return shared->length - 1; } /// Return the actual length of this string in characters. /** * This method parses the multi-byte encoded string and determines * the actual number of characters that it contains (which will be less * than or equal to the number of code points). */ Size getLengthInCharacters() const; /// Return the number of code points that are part of the specified NULL-terminated string. /** * The value returned does not include the NULL termination character. */ static Size getLength( const CharType* characters ); /// Return the number of characters that are part of the specified NULL-terminated string. /** * This method parses the multi-byte encoded string and determines * the actual number of characters that it contains (which will be less * than or equal to the number of code points). */ static Size getLengthInCharacters( const CharType* characters ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Hash Code Accessor Method /// Return a hash code for this string. RIM_INLINE Hash getHashCode() const { Hash& hash = shared->hashCode; if ( hash != 0 ) return hash; else { hash = HashCode( string, shared->length ); return hash; } } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Static Character Trait Accessor Methods /// Convert this string to lower case. BasicString toLowerCase() const; /// Convert this string to lower case. BasicString toUpperCase() const; // If the specified character is an upper-case character, convert it a lower-case one. RIM_INLINE static CharType toLowerCase( CharType character ) { if ( character >= 'A' && character <= 'Z' ) return character + 32; else return character; } // If the specified character is a lower-case character, convert it an upper-case one. RIM_INLINE static CharType toUpperCase( CharType character ) { if ( character >= 'a' && character <= 'z' ) return character - 32; else return character; } /// Return whether or not the specified character is a letter character. RIM_INLINE static Bool isALetter( CharType character ) { return (character >= 'A' && character <= 'Z') || (character >= 'a' && character <= 'z'); } /// Return whether or not the specified character is an upper-case character. RIM_INLINE static Bool isUpperCase( CharType character ) { return character >= 'A' && character <= 'Z'; } /// Return whether or not the specified character is a lower-case character. RIM_INLINE static Bool isLowerCase( CharType character ) { return character >= 'a' && character <= 'z'; } /// Return whether or not the specified character is a decimal digit (0 to 9). RIM_INLINE static Bool isADigit( CharType character ) { return character >= '0' && character <= '9'; } /// Return whether or not the specified character is an octal digit (0 to 7). RIM_INLINE static Bool isAnOctalDigit( CharType character ) { return character >= '0' && character <= '7'; } /// Return whether or not the specified character is an binary digit (0 or 1). RIM_INLINE static Bool isABinaryDigit( CharType character ) { return character == '0' || character == '1'; } /// Return whether or not the specified character is a hexidecimal digit (0 to 9, A to F). RIM_INLINE static Bool isAHexDigit( CharType character ) { return (character >= '0' && character <= '9') || (character >= 'A' && character <= 'F') || (character >= 'a' && character <= 'f'); } /// Return whether or not the specified character is a whitespace character (i.e. space, tab, new line, etc). RIM_INLINE static Bool isWhitespace( CharType character ) { return character == ' ' || character == '\t' || character == '\n' || character == '\r'; } private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Class Declarations class SharedString { public: /// Create a new shared string which uses the specified pointer to a character buffer. RIM_INLINE SharedString( Size newLength ) : length( newLength ), referenceCount( 1 ), hashCode( 0 ) { } /// Return a pointer to the characters that are part of this shared string object. /** * The characters are allocated contiguously after the end of the object. */ RIM_INLINE CharType* getCharacters() { return (CharType*)((UByte*)this + sizeof(SharedString)); } /// The length in characters (including the NULL terminator) of this string. Size length; /// The number of strings that reference this shared string. /** * When this number reaches 0, the string is deallocated. */ Size referenceCount; /// A hash code for this string, lazily computed when it is first needed. /** * A value of 0 indicates that the hash code has not been computed. */ Hash hashCode; }; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Constructor /// Create a new string with the specified shared string. RIM_INLINE BasicString( SharedString* sharedString ) : shared( sharedString ) { string = shared->getCharacters(); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** String Allocation Methods static SharedString* allocateString( Size length ) { Size sharedStringSize = sizeof(SharedString) + sizeof(CharType)*length; UByte* sharedStringBytes = util::allocate<UByte>( sharedStringSize ); new ( sharedStringBytes ) SharedString( length ); return (SharedString*)sharedStringBytes; } static void deallocateString( SharedString* sharedString ) { if ( --sharedString->referenceCount == Size(0) ) util::deallocate( (UByte*)sharedString ); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Static Unicode Conversion Methods template < typename CharType2 > RIM_INLINE static SharedString* convertUnicode( const CharType2* unicodeString ); template < typename CharType2 > RIM_INLINE static SharedString* convertUnicode( const CharType2* unicodeString, const CharType2* unicodeStringEnd ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Static String Concatenation Methods RIM_INLINE static SharedString* concatenateStrings( const CharType* string1, Size length1, const CharType* string2, Size length2 ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Static String Comparison Methods static Bool equals( const CharType* string1, const CharType* string2 ); static Bool equalsIgnoreCase( const CharType* string1, const CharType* string2 ); static Int compare( const CharType* string1, const CharType* string2 ); static Int compareIgnoreCase( const CharType* string1, const CharType* string2 ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Static String-Number Conversion Methods static SharedString* fromIntegerType( Int32 value, Size base ); static SharedString* fromIntegerType( UInt32 value, Size base ); static SharedString* fromIntegerType( Int64 value, Size base ); static SharedString* fromIntegerType( UInt64 value, Size base ); template < typename ValueType > RIM_INLINE static SharedString* fromSignedIntegerType( ValueType value, Size base ); template < typename ValueType > RIM_INLINE static SharedString* fromUnsignedIntegerType( ValueType value, Size base ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Static String-Number Conversion Methods static SharedString* fromFloatType( Float value, Size numDecimalPlaces, Size base, Bool allowScientific ); static SharedString* fromFloatType( Double value, Size numDecimalPlaces, Size base, Bool allowScientific ); template < typename ValueType > RIM_INLINE static SharedString* fromFloatingPointType( ValueType value, Size numDecimalDigits, Size precision, Size base, Bool allowScientific ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Static String-Number Conversion Methods template < typename ValueType > RIM_NO_INLINE static Bool parseSimpleNumber( const CharType* numberStart, const CharType* numberEnd, Size base, ValueType& number ); template < typename ValueType > RIM_NO_INLINE static Bool convertStringToNumber( const CharType* stringStart, const CharType* stringEnd, ValueType& result ); RIM_NO_INLINE static Bool convertStringToBoolean( const CharType* stringStart, const CharType* stringEnd, Bool& result ); static Bool isANumber( const CharType* string, Size length ); template < typename ValueType, typename FloatType > RIM_FORCE_INLINE static ValueType safeTypeConversion( FloatType value ) { if ( value < (FloatType)math::min<ValueType>() ) return math::min<ValueType>(); else if ( value > (FloatType)math::max<ValueType>() ) return math::max<ValueType>(); else return (ValueType)value; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** New Literal String Methods /// Create and return a new reference counted string which represents a null string. static SharedString* newNullString() { SharedString* string = allocateString( 1 ); CharType* characters = string->getCharacters(); *characters = '\0'; return string; } /// Create and return a new reference counted string which represents the 'true' boolean literal. static SharedString* newTrueString() { SharedString* string = allocateString( 5 ); CharType* characters = string->getCharacters(); characters[0] = 't'; characters[1] = 'r'; characters[2] = 'u'; characters[3] = 'e'; characters[4] = '\0'; return string; } /// Create and return a new reference counted string which represents the 'false' boolean literal. static SharedString* newFalseString() { SharedString* string = allocateString( 6 ); CharType* characters = string->getCharacters(); characters[0] = 'f'; characters[1] = 'a'; characters[2] = 'l'; characters[3] = 's'; characters[4] = 'e'; characters[5] = '\0'; return string; } /// Create and return a new reference counted string which represents the +infinity literal. static SharedString* newPositiveInfinityString() { SharedString* string = allocateString( 9 ); CharType* characters = string->getCharacters(); characters[0] = 'I'; characters[1] = 'n'; characters[2] = 'f'; characters[3] = 'i'; characters[4] = 'n'; characters[5] = 'i'; characters[6] = 't'; characters[7] = 'y'; characters[8] = '\0'; return string; } /// Create and return a new reference counted string which represents the -infinity literal. static SharedString* newNegativeInfinityString() { SharedString* string = allocateString( 10 ); CharType* characters = string->getCharacters(); characters[0] = '-'; characters[1] = 'I'; characters[2] = 'n'; characters[3] = 'f'; characters[4] = 'i'; characters[5] = 'n'; characters[6] = 'i'; characters[7] = 't'; characters[8] = 'y'; characters[9] = '\0'; return string; } /// Create and return a new reference counted string which represents the not-a-number literal. static SharedString* newNaNString() { SharedString* string = allocateString( 4 ); CharType* characters = string->getCharacters(); characters[0] = 'N'; characters[1] = 'a'; characters[2] = 'N'; characters[3] = '\0'; return string; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Members /// A pointer to the character buffer for this string. CharType* string; /// A pointer to the shared string object which stores this string's reference-counted characters. SharedString* shared; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Static Data Members /// A static shared string which represents the null string (that has 0 characters, with a null terminator). static SharedString* nullString; /// A static shared string which represents the boolean 'true' literal string. static SharedString* trueString; /// A static shared string which represents the boolean 'false' literal string. static SharedString* falseString; /// A static shared string which represents the +infinity literal string. static SharedString* positiveInfinityString; /// A static shared string which represents the -infinity literal string. static SharedString* negativeInfinityString; /// A static shared string which represents the not-a-number literal string. static SharedString* nanString; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Friend Class Declarations template < typename OtherCharType > friend class BasicString; }; //########################################################################################## //########################################################################################## //############ //############ Commutative Comparison Operators //############ //########################################################################################## //########################################################################################## template < typename CharType > RIM_INLINE BasicString<CharType> operator == ( const CharType* characters, const BasicString<CharType>& string ) { return BasicString<CharType>::equals( characters, string ); } template < typename CharType > RIM_INLINE BasicString<CharType> operator != ( const CharType* characters, const BasicString<CharType>& string ) { return !BasicString<CharType>::equals( characters, string ); } template < typename CharType > RIM_INLINE BasicString<CharType> operator < ( const CharType* characters, const BasicString<CharType>& string ) { return BasicString<CharType>::compare( characters, string ) == -1; } template < typename CharType > RIM_INLINE BasicString<CharType> operator > ( const CharType* characters, const BasicString<CharType>& string ) { return BasicString<CharType>::compare( characters, string ) == 1; } template < typename CharType > RIM_INLINE BasicString<CharType> operator <= ( const CharType* characters, const BasicString<CharType>& string ) { return BasicString<CharType>::compare( characters, string ) < 1; } template < typename CharType > RIM_INLINE BasicString<CharType> operator >= ( const CharType* characters, const BasicString<CharType>& string ) { return BasicString<CharType>::compare( characters, string ) > -1; } template < typename CharType > RIM_INLINE BasicString<CharType> operator << ( const CharType* characters, const BasicString<CharType>& string ) { return BasicString<CharType>::compareIgnoreCase( characters, string ) == -1; } template < typename CharType > RIM_INLINE BasicString<CharType> operator >> ( const CharType* characters, const BasicString<CharType>& string ) { return BasicString<CharType>::compareIgnoreCase( characters, string ) == 1; } template < typename CharType > RIM_INLINE BasicString<CharType> operator <<= ( const CharType* characters, const BasicString<CharType>& string ) { return BasicString<CharType>::compareIgnoreCase( characters, string ) < 1; } template < typename CharType > RIM_INLINE BasicString<CharType> operator >>= ( const CharType* characters, const BasicString<CharType>& string ) { return BasicString<CharType>::compareIgnoreCase( characters, string ) > -1; } //########################################################################################## //########################################################################################## //############ //############ Commutative Concatenation Operators //############ //########################################################################################## //########################################################################################## template < typename CharType > RIM_INLINE BasicString<CharType> operator + ( const Char* characters, const BasicString<CharType>& string ) { return BasicString<CharType>( characters ) + string; } template < typename CharType > RIM_INLINE BasicString<CharType> operator + ( Char character, const BasicString<CharType>& string ) { return BasicString<CharType>( character ) + string; } template < typename CharType > RIM_INLINE BasicString<CharType> operator + ( Short value, const BasicString<CharType>& string ) { return BasicString<CharType>(value) + string; } template < typename CharType > RIM_INLINE BasicString<CharType> operator + ( UShort value, const BasicString<CharType>& string ) { return BasicString<CharType>(value) + string; } template < typename CharType > RIM_INLINE BasicString<CharType> operator + ( Int value, const BasicString<CharType>& string ) { return BasicString<CharType>(value) + string; } template < typename CharType > RIM_INLINE BasicString<CharType> operator + ( UInt value, const BasicString<CharType>& string ) { return BasicString<CharType>(value) + string; } template < typename CharType > RIM_INLINE BasicString<CharType> operator + ( Long value, const BasicString<CharType>& string ) { return BasicString<CharType>(value) + string; } template < typename CharType > RIM_INLINE BasicString<CharType> operator + ( ULong value, const BasicString<CharType>& string ) { return BasicString<CharType>(value) + string; } template < typename CharType > RIM_INLINE BasicString<CharType> operator + ( LongLong value, const BasicString<CharType>& string ) { return BasicString<CharType>(value) + string; } template < typename CharType > RIM_INLINE BasicString<CharType> operator + ( ULongLong value, const BasicString<CharType>& string ) { return BasicString<CharType>(value) + string; } //########################################################################################## //########################################################################################## //############ //############ String Type Definitions //############ //########################################################################################## //########################################################################################## /// A class which represents a standard NULL-terminated ASCII-encoded string of characters. typedef BasicString<Char> String; /// A class which represents a NULL-terminated UTF8-encoded string of characters. typedef BasicString<UTF8Char> UTF8String; /// A class which represents a NULL-terminated UTF16-encoded string of characters. typedef BasicString<UTF16Char> UTF16String; /// A class which represents a NULL-terminated UTF32-encoded string of characters. typedef BasicString<UTF32Char> UTF32String; //########################################################################################## //******************************* End Data Namespace *********************************** RIM_DATA_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_BASIC_STRING_H <file_sep>/* * rimGraphicsGUIMenuItemDelegate.h * Rim Graphics GUI * * Created by <NAME> on 2/18/13. * Copyright 2013 Headspace Systems. All rights reserved. * */ #ifndef INCLUDE_RIM_GRAPHICS_GUI_MENU_ITEM_DELEGATE_H #define INCLUDE_RIM_GRAPHICS_GUI_MENU_ITEM_DELEGATE_H #include "rimGraphicsGUIConfig.h" //########################################################################################## //************************ Start Rim Graphics GUI Namespace ****************************** RIM_GRAPHICS_GUI_NAMESPACE_START //****************************************************************************************** //########################################################################################## class MenuItem; //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class which contains function objects that recieve menu item events. /** * Any menu-item-related event that might be processed has an appropriate callback * function object. Each callback function is called by the menu item * whenever such an event is received. If a callback function in the delegate * is not initialized, a menu item simply ignores it. */ class MenuItemDelegate { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** MenuItem Delegate Callback Functions /// A function object which is called whenever an attached menu item is selected by the user. Function<void ( MenuItem& item )> select; }; //########################################################################################## //************************ End Rim Graphics GUI Namespace ******************************** RIM_GRAPHICS_GUI_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_GRAPHICS_GUI_MENU_ITEM_DELEGATE_H <file_sep>/* * rimImagesPNGTranscoder.h * Rim Images * * Created by <NAME> on 3/25/08. * Copyright 2008 Rim Software. All rights reserved. * */ #ifndef INCLUDE_RIM_IMAGES_PNG_TRANSCODER_H #define INCLUDE_RIM_IMAGES_PNG_TRANSCODER_H #include "rimImageTranscoder.h" //########################################################################################## //*************************** Start Rim Image IO Namespace ******************************* RIM_IMAGE_IO_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class which handles encoding and decoding image data to/from the portable network graphics format (.png) class PNGTranscoder : public ImageTranscoder { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Image Format Accessor Method /// Return an object which represents the resource format that this transcoder can read and write. virtual ResourceFormat getResourceFormat() const; /// Return an object which represents the format that this transcoder can encode and decode. virtual ImageFormat getFormat() const; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Image Encoding Methods /// Return whether or not the specified image can be encoded using this transcoder. /** * If TRUE is returned, the image is in a format that is compatible with this * transcoder. Otherwise, the image is not compatible and cannot be encoded. */ RIM_INLINE Bool canEncode( const Image& image, const ImageEncodingParameters& parameters = ImageEncodingParameters() ) const { return ImageTranscoder::canEncode( image, parameters ); } /// Return whether or not the specified image can be encoded using this transcoder. /** * The image is specified by a pointer to pixel data, dimensions, and pixel type. * * If TRUE is returned, the image is in a format that is compatible with this * transcoder. Otherwise, the image is not compatible and cannot be encoded. */ virtual Bool canEncode( const UByte* pixelData, const PixelFormat& pixelType, Size width, Size height, const ImageEncodingParameters& parameters = ImageEncodingParameters() ) const; /// Encode the specified image and send the output to the specified data output stream. /** * If the encoding succeeds, the encoded image data is sent to the * data output stream and TRUE is returned. Otherwise, FALSE is returned * and no data is sent to the stream. */ RIM_INLINE Bool encode( const Image& image, DataOutputStream& stream, const ImageEncodingParameters& parameters = ImageEncodingParameters() ) const { return ImageTranscoder::encode( image, stream, parameters ); } /// Encode the specified image and place the output in the specified Data object. /** * If the encoding succeeds, the encoded image data is placed in the * Data object and TRUE is returned. Otherwise, FALSE is returned * and no data is placed in the Data object. */ RIM_INLINE Bool encode( const Image& image, Data& data, const ImageEncodingParameters& parameters = ImageEncodingParameters() ) const { return ImageTranscoder::encode( image, data, parameters ); } /// Encode the specified image and place the output in the specified data pointer. /** * If the encoding succeeds, the function allocates the necessary output data * array and places the pointer to that array in the output data pointer reference, * the number of bytes in the output array is placed in the numBytes output reference, * and TRUE is returned. Otherwise, FALSE is returned and no data is * placed in the output references. */ RIM_INLINE Bool encode( const Image& image, UByte*& outputData, Size& numBytes, const ImageEncodingParameters& parameters = ImageEncodingParameters() ) const { return ImageTranscoder::encode( image, outputData, numBytes, parameters ); } /// Encode the specified image and place the output in the specified data pointer. /** * The image is specified by a pointer to pixel data, dimensions, and pixel type. * * If the encoding succeeds, the function allocates the necessary output data * array and places the pointer to that array in the output data pointer reference, * the number of bytes in the output array is placed in the numBytes output reference, * and TRUE is returned. Otherwise, FALSE is returned and no data is * placed in the output references. */ virtual Bool encode( const UByte* pixelData, const PixelFormat& pixelType, Size width, Size height, UByte*& outputData, Size& numBytes, const ImageEncodingParameters& parameters = ImageEncodingParameters() ) const; /// Encode the specified image and send the output to the specified data output stream. /** * The image is specified by a pointer to pixel data, dimensions, and pixel type. * * If the encoding succeeds, the encoded image data is sent to the * data output stream and TRUE is returned. Otherwise, FALSE is returned * and no data is sent to the stream. */ virtual Bool encode( const UByte* pixelData, const PixelFormat& pixelType, Size width, Size height, DataOutputStream& stream, const ImageEncodingParameters& parameters = ImageEncodingParameters() ) const; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Image Decoding Methods /// Return whether or not the specified data can be decode using this transcoder. /** * The transcoder examines the specified data and determines if the data specifies * a valid image in the transcoder's format. If so, TRUE is returned. * Otherwise, FALSE is returned. */ RIM_INLINE Bool canDecode( const Data& data ) const { return ImageTranscoder::canDecode( data ); } /// Return whether or not the specified data can be decode using this transcoder. /** * The transcoder examines the specified data and determines if the data specifies * a valid image in the transcoder's format. If so, TRUE is returned. * Otherwise, FALSE is returned. */ virtual Bool canDecode( const UByte* inputData, Size inputDataSizeInBytes ) const; /// Decode the specified data and return an image. /** * The image is returned in the specified output image reference. * * If the decoding succeeds, the function creates an image and places * it in the image output reference paramter and TRUE is returned. * Otherwise, if the decoding fails, FALSE is returned. */ RIM_INLINE Bool decode( const Data& data, Image& image ) const { return ImageTranscoder::decode( data, image ); } /// Decode the data from the specified data pointer and return an image. /** * The image is returned in the specified output image reference. * * If the decoding succeeds, the function creates an image and places * it in the image output reference paramter and TRUE is returned. * Otherwise, if the decoding fails, FALSE is returned. */ RIM_INLINE Bool decode( const UByte* inputData, Size inputDataSizeInBytes, Image& image ) const { return ImageTranscoder::decode( inputData, inputDataSizeInBytes, image ); } /// Decode the data from the specified DataInputStream and return an image. /** * The image is returned in the specified output image reference. * * If the decoding succeeds, the function creates an image and places * it in the image output reference paramter and TRUE is returned. * Otherwise, if the decoding fails, FALSE is returned. */ RIM_INLINE Bool decode( DataInputStream& stream, Image& image ) const { return ImageTranscoder::decode( stream, image ); } /// Decode the data from the specified DataInputStream and return an image. /** * The image is returned as a pointer to pixel data, dimensions, and * pixel type, all given as reference parameters. * * The decoding method can use the in/out parameter pixelType to hint at the * desired pixel format for the output image. The decoder should try to match * this format as closely as possible without degrading image quality. * * If the decoding succeeds, the function allocates the necessary space * for the image's pixel data and places the pointer to that data * in the output pixel data reference, along with the image's dimensions * and pixel type, and TRUE is returned. Otherwise, if the decoding fails, * FALSE is returned. */ virtual Bool decode( DataInputStream& stream, UByte*& pixelData, PixelFormat& pixelType, Size& width, Size& height ) const; /// Decode the data from the specified data pointer and return an image. /** * The image is returned as a pointer to pixel data, dimensions, and * pixel type, all given as reference parameters. * * The decoding method can use the in/out parameter pixelType to hint at the * desired pixel format for the output image. The decoder should try to match * this format as closely as possible without degrading image quality. * * If the decoding succeeds, the function allocates the necessary space * for the image's pixel data and places the pointer to that data * in the output pixel data reference, along with the image's dimensions * and pixel type, and TRUE is returned. Otherwise, if the decoding fails, * FALSE is returned. */ virtual Bool decode( const UByte* inputData, Size inputDataSizeInBytes, UByte*& pixelData, PixelFormat& pixelType, Size& width, Size& height ) const; private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Class Declarations /// A class which handles streaming reads from a memory data buffer. class PNGDataInputStream; /// A class which handles streaming writes to a memory data buffer. class PNGDataOutputStream; }; //########################################################################################## //*************************** End Rim Image IO Namespace ********************************* RIM_IMAGE_IO_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_IMAGES_PNG_TRANSCODER_H <file_sep>/* * rimAssetTranscoder.h * Rim Software * * Created by <NAME> on 6/10/14. * Copyright 2014 __MyCompanyName__. All rights reserved. * */ #ifndef INCLUDE_RIM_ASSET_TRANSCODER_H #define INCLUDE_RIM_ASSET_TRANSCODER_H #include "rimAssetsConfig.h" #include "rimAssetType.h" #include "rimAssetScene.h" #include "rimAssetTypeTranscoder.h" //########################################################################################## //**************************** Start Rim Assets Namespace ******************************** RIM_ASSETS_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class which reads and writes asset resources. class AssetTranscoder : public resources::ResourceTranscoder<AssetScene> { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructor /// Create a new asset transcoder that has no types it can handle. AssetTranscoder(); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Destructor /// Destroy this asset transcoder and release all associated resources. virtual ~AssetTranscoder(); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Asset Type Accessor Methods /// Return the number of asset types that this transcoder can handle. RIM_INLINE Size getTypeCount() const { return assetTypes.getSize(); } /// Add a new type to this asset transcoder that is can decode and encode. /** * The method returns whether or not the new type was able to be added. * If the asset type already exists in this transcoder, the method * fails and returns FALSE. Otherwise it is added to the transcoder. */ template < typename DataType > RIM_INLINE Bool addType( const AssetType& type, const Pointer<AssetTypeTranscoder<DataType> >& transcoder ) { if ( type == AssetType::UNDEFINED || transcoder.isNull() ) return false; /// Check to see if this type is already handled by the transcoder. if ( assetTypes.contains( type.getHashCode(), type ) ) return false; /// Add the new type delegate. assetTypes.add( type.getHashCode(), type, Pointer< AssetTypeInfo<DataType> >::construct( type, transcoder ) ); return true; } /// Remove the specified asset type from this asset transcoder. /** * The method returns whether or not the type was able to be removed. */ Bool removeType( const AssetType& type ); /// Remove all asset types from this asset transcoder. void clearTypes(); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Model Format Accessor Methods /// Return an object which represents the resource type that this transcoder can read and write. virtual resources::ResourceType getResourceType() const; /// Return an object which represents the resource format that this transcoder can read and write. virtual resources::ResourceFormat getResourceFormat() const; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Encoding Methods /// Return whether or not this asset transcoder is able to encode the specified resource. virtual Bool canEncode( const AssetScene& scene ) const; /// Encode the specified generic scene to the file at the specified path. /** * If the method fails, FALSE is returned. */ virtual Bool encode( const resources::ResourceID& resourceID, const AssetScene& scene ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Decoding Methods /// Return whether or not the specified identifier refers to a valid asset file for this transcoder. virtual Bool canDecode( const resources::ResourceID& identifier ) const; /// Decode the asset file at the specified path and return a pointer to the decoded scene. /** * If the method fails, a NULL pointer is returned. */ virtual Pointer<AssetScene> decode( const resources::ResourceID& resourceID, ResourceManager* manager = NULL ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Public Text Scalar Parsing Helper Methods /// Attempt to parse a boolean value from the given string, placing it in the output parameter value. /** * The method returns whether or not the value was successfully parsed. */ static Bool parse( const UTF8Char* string, Size numCharacters, Bool& value ); /// Attempt to parse a 32-bit signed integer value from the given string, placing it in the output parameter value. /** * The method returns whether or not the value was successfully parsed. */ static Bool parse( const UTF8Char* string, Size numCharacters, Int32& value ); /// Attempt to parse a 32-bit unsigned integer value from the given string, placing it in the output parameter value. /** * The method returns whether or not the value was successfully parsed. */ static Bool parse( const UTF8Char* string, Size numCharacters, UInt32& value ); /// Attempt to parse a 64-bit signed integer value from the given string, placing it in the output parameter value. /** * The method returns whether or not the value was successfully parsed. */ static Bool parse( const UTF8Char* string, Size numCharacters, Int64& value ); /// Attempt to parse a 64-bit unsigned integer value from the given string, placing it in the output parameter value. /** * The method returns whether or not the value was successfully parsed. */ static Bool parse( const UTF8Char* string, Size numCharacters, UInt64& value ); /// Attempt to parse a 32-bit float value from the given string, placing it in the output parameter value. /** * The method returns whether or not the value was successfully parsed. */ static Bool parse( const UTF8Char* string, Size numCharacters, Float32& value ); /// Attempt to parse a 64-bit float value from the given string, placing it in the output parameter value. /** * The method returns whether or not the value was successfully parsed. */ static Bool parse( const UTF8Char* string, Size numCharacters, Float64& value ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Public Text Vector Parsing Helper Methods /// Attempt to parse a 32-bit 2-float vector from the given string, placing it in the output parameter value. /** * The method returns whether or not the matrix was successfully parsed. */ static Bool parse( const UTF8Char* string, Size numCharacters, math::Vector2f& vector ); /// Attempt to parse a 32-bit 3-float vector from the given string, placing it in the output parameter value. /** * The method returns whether or not the matrix was successfully parsed. */ static Bool parse( const UTF8Char* string, Size numCharacters, math::Vector3f& vector ); /// Attempt to parse a 32-bit 4-float vector from the given string, placing it in the output parameter value. /** * The method returns whether or not the matrix was successfully parsed. */ static Bool parse( const UTF8Char* string, Size numCharacters, math::Vector4f& vector ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Public Text Matrix Parsing Helper Methods /// Attempt to parse a 32-bit 2x2 float matrix from the given string, placing it in the output parameter value. /** * The method returns whether or not the matrix was successfully parsed. */ static Bool parse( const UTF8Char* string, Size numCharacters, math::Matrix2f& matrix ); /// Attempt to parse a 32-bit 3x3 float matrix from the given string, placing it in the output parameter value. /** * The method returns whether or not the matrix was successfully parsed. */ static Bool parse( const UTF8Char* string, Size numCharacters, math::Matrix3f& matrix ); /// Attempt to parse a 32-bit 4x4 float matrix from the given string, placing it in the output parameter value. /** * The method returns whether or not the matrix was successfully parsed. */ static Bool parse( const UTF8Char* string, Size numCharacters, math::Matrix4f& matrix ); /// Attempt to parse a 32-bit float matrix of arbitrary size from the given string, placing it in the output parameter value. /** * The method returns whether or not the matrix was successfully parsed. */ template < Size numRows, Size numColumns > RIM_INLINE static Bool parse( const UTF8Char* string, Size numCharacters, math::MatrixND<Float,numRows,numColumns>& matrix ) { return parseMatrix( string, numCharacters, numRows, numColumns, matrix.toArrayColumnMajor() ); } /// Attempt to parse a 32-bit float matrix of arbitrary size from the given string, placing it in the output parameter value. /** * The method returns whether or not the matrix was successfully parsed. */ RIM_INLINE static Bool parse( const UTF8Char* string, Size numCharacters, math::Matrix<Float>& matrix ) { if ( matrix.getRowCount() == 0 || matrix.getColumnCount() == 0 ) return false; return parseMatrix( string, numCharacters, matrix.getRowCount(), matrix.getColumnCount(), matrix.toArrayColumnMajor() ); } /// Attempt to parse a 32-bit float matrix of arbitrary size from the given string, placing it in the output parameter value. /** * The method returns whether or not the matrix was successfully parsed. */ RIM_INLINE static Bool parse( const UTF8Char* string, Size numCharacters, Size numRows, Size numColumns, math::Matrix<Float>& matrix ) { if ( matrix.getRowCount() != numRows || matrix.getColumnCount() != numColumns ) matrix = math::Matrix<Float>( numRows, numColumns ); return parseMatrix( string, numCharacters, numRows, numColumns, matrix.toArrayColumnMajor() ); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Public Text Range Parsing Helper Methods /// Attempt to parse a 32-bit float 1D range from the given string, placing it in the output parameter value. /** * The method returns whether or not the range was successfully parsed. */ RIM_INLINE static Bool parse( const UTF8Char* string, Size numCharacters, math::AABB1f& range ) { return parseVector( string, numCharacters, 2, &range.min ); } /// Attempt to parse a 32-bit float 2D range from the given string, placing it in the output parameter value. /** * The method returns whether or not the range was successfully parsed. */ RIM_INLINE static Bool parse( const UTF8Char* string, Size numCharacters, math::AABB2f& range ) { return parseMatrix( string, numCharacters, 2, 2, &range.min.x ); } /// Attempt to parse a 32-bit float 3D range from the given string, placing it in the output parameter value. /** * The method returns whether or not the range was successfully parsed. */ RIM_INLINE static Bool parse( const UTF8Char* string, Size numCharacters, math::AABB3f& range ) { return parseMatrix( string, numCharacters, 3, 2, &range.min.x ); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Public Text String Parsing Helper Methods /// Attempt to parse a string, populating the output parameter object with the parsed string pointer and length. /** * The method returns whether or not the string was successfully parsed. */ static Bool parseString( const UTF8Char* string, Size numCharacters, const UTF8Char*& result, Size& resultLength ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Public Text Object Parsing Helper Methods /// Attempt to parse an object type declaration. /** * The method returns whether or not the object type was successfully parsed. * The string pointer is advanced to the next character after the object type, * or until parsing fails. * The method is insensitive to whitespace before, after, and between tokens. */ static Bool parseObjectType( const UTF8Char*& string, Size numCharacters, AssetType& type ); /// Attempt to parse an object, populating the output parameter object with the parsed fields and object attributes. /** * The method returns whether or not the object was successfully parsed. * The string pointer is advanced to the next character after the object, * or until parsing fails. * The method is insensitive to whitespace before, after, and between tokens. */ static Bool parseObject( const UTF8Char*& string, Size numCharacters, AssetObject& object ); /// Attempt to parse an object, populating the output parameter object with the parsed fields and object attributes. /** * The method returns whether or not the object was successfully parsed. * The string pointer is advanced to the next character after the object, * or until parsing fails. * The method is insensitive to whitespace before, after, and between tokens. */ static Bool parseObject( const UTF8Char*& string, Size numCharacters, AssetObject& object, AssetType& type ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Public Text Object Parsing Helper Methods /// Determine the length in character code points of an object, advancing the iterator by that amount. static void skipObject( const UTF8Char*& string, const UTF8Char* stringEnd ); /// Determine the length in character code points of an object, advancing the iterator by that amount. static void skipObjectType( const UTF8Char*& string, const UTF8Char* stringEnd ); private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Class Declarations /// The base class for objects that contain encoding/decoding information for an asset type. class AssetTypeInfoBase { public: /// Destroy this asset type info object. virtual ~AssetTypeInfoBase() { } /// Create and return a copy of this asset type info object. virtual AssetTypeInfoBase* copy() const = 0; virtual Bool encodeText( UTF8StringBuffer& buffer, ResourceManager* manager, const void* asset ) = 0; virtual Bool decodeText( const AssetObject& object, ResourceManager* manager, AssetScene& scene ) = 0; }; template < typename DataType > class AssetTypeInfo; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Type Declarations /// An enum type that defines the values that can be stored in a file header. typedef enum HeaderField { UNDEFINED_HEADER_FIELD = 0, /// An integer indicating the version number of this file format. VERSION, /// A boolean value that indicates the endianness of embedded binary data. IS_BIG_ENDIAN, /// A string value that provides a global name for the file. NAME, /// A string value that provides a global description for the file. DESCRIPTION }; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Parsing Methods Bool parseHeader( const UTF8Char*& string, Size stringLength, AssetScene& scene ); Bool parseObjects( const UTF8Char*& string, Size stringLength, ResourceManager* resourceManager, AssetScene& scene ); template < typename T > static Bool parseVector( const UTF8Char* string, Size numCharacters, Size numComponents, T* result ); template < typename T > static Bool parseMatrix( const UTF8Char* string, Size numCharacters, Size numRows, Size numColumns, T* result ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Helper Methods //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Parsing Helper Methods static void skipWhitespace( const UTF8Char*& string, const UTF8Char* stringEnd ) { while ( string != stringEnd && isWhitespace(*string) ) string++; } static void skipToAfterNext( const UTF8Char*& string, const UTF8Char* stringEnd, UTF32Char c ) { Size numUnclosedBraces = 0; while ( string < stringEnd && (*string != c || numUnclosedBraces > 0) ) { if ( *string == '{' ) numUnclosedBraces++; else if ( *string == '}' && numUnclosedBraces > 0 ) numUnclosedBraces--; string++; } // We are at the character, so skip to next character. if ( string < stringEnd ) string++; } /// Determine the length in character code points of an object field name, advancing the iterator by that amount. static void getWordLength( const UTF8Char*& string, const UTF8Char* stringEnd, Size& length ) { length = 0; while ( string < stringEnd && isWordCharacter(*string) ) { length++; string++; } } /// Determine the length in character code points of an object field value, advancing the iterator by that amount. static void getFieldValueLength( const UTF8Char*& string, const UTF8Char* stringEnd, Size& length ) { length = 0; Size numUnclosedBraces = 0; while ( string < stringEnd && (*string != ';' || numUnclosedBraces > 0) ) { if ( *string == '{' ) numUnclosedBraces++; else if ( *string == '}' && numUnclosedBraces > 0 ) numUnclosedBraces--; length++; string++; } } /// Return whether or not the specified character is a word character. RIM_INLINE static Bool isWordCharacter( UTF8Char c ) { return UTF8String::isALetter(c) || UTF8String::isADigit(c) || c == '_'; } /// Return whether or not the specified character is a whitespace character. RIM_INLINE static Bool isWhitespace( UTF32Char c ) { return c == ' ' || c == '\t' || c == '\n' || c == '\r'; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Static Data Members static HeaderField getHeaderFieldType( const AssetObject::String& name ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Members /// A map from asset types to objects that decode and encode those types. HashMap<AssetType,Pointer<AssetTypeInfoBase> > assetTypes; /// An asset object used to temporarily hold parsed asset objects. AssetObject tempObject; }; //########################################################################################## //########################################################################################## //############ //############ Asset Type Info Class Declaration //############ //########################################################################################## //########################################################################################## template < typename DataType > class AssetTranscoder:: AssetTypeInfo : public AssetTypeInfoBase { public: RIM_INLINE AssetTypeInfo( const AssetType& newType, const Pointer< AssetTypeTranscoder<DataType> >& newTranscoder ) : type( newType ), transcoder( newTranscoder ) { } virtual AssetTypeInfo* copy() const { return util::construct<AssetTypeInfo<DataType> >( *this ); } virtual Bool encodeText( UTF8StringBuffer& buffer, ResourceManager* manager, const void* asset ) { if ( asset == NULL || transcoder.isNull() ) return false; return transcoder->encodeText( buffer, manager, *static_cast<const DataType*>( asset ) ); } virtual Bool decodeText( const AssetObject& object, ResourceManager* manager, AssetScene& scene ) { if ( transcoder.isNull() ) return false; Pointer<DataType> asset = transcoder->decodeText( type, object, manager ); if ( asset.isNull() ) return false; scene.addAsset<DataType>( asset, UTF8String(object.getName().string, object.getName().length) ); return true; } /// The type of asset that this asset type info handles. AssetType type; /// An object that handles encoding and decoding this asset type. Pointer< AssetTypeTranscoder<DataType> > transcoder; }; //########################################################################################## //**************************** End Rim Assets Namespace ********************************** RIM_ASSETS_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_ASSET_TRANSCODER_H <file_sep>/* * rimMonth.h * Rim Time * * Created by <NAME> on 11/2/08. * Copyright 2008 __MyCompanyName__. All rights reserved. * */ #ifndef INCLUDE_RIM_MONTH_H #define INCLUDE_RIM_MONTH_H #include "rimTimeConfig.h" //########################################################################################## //******************************* Start Time Namespace ********************************* RIM_TIME_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class which represents a particular month in the modern calendar. class Month { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructor /// Create a Month object representing the first month of the year. RIM_INLINE Month() : number( 1 ) { } /// Create a Month object with the specified index within the year, starting at 1. RIM_INLINE Month( Index newNumber ) : number( newNumber ) { } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Name Accessor Methods /// Get the standard name for the month with this index. /** * If the month does not have a standard name, the empty string is returned. */ RIM_INLINE data::String getName() const { if ( !hasInitializedStandardNames ) initializeStandardNames(); const data::String* name; if ( names.find( Hash(number), number, name ) ) return *name; else return data::String(); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Number Accessor Methods /// Get the index of the month within the year, starting at 1. RIM_INLINE Index getNumber() const { return number; } /// Set the index of the month within the year, starting at 1. RIM_INLINE void setNumber( Index newNumber ) { number = newNumber; } private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Static Methods /// Initialize the standard month names. static void initializeStandardNames(); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Member /// The number of the month within the year, starting at 1. Index number; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Static Data Members /// Standard names for months with standard indices. static util::HashMap<Index,data::String> names; /// Whether or not the standard month names have been initialized. static Bool hasInitializedStandardNames; }; //########################################################################################## //******************************* End Time Namespace *********************************** RIM_TIME_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_MONTH_H <file_sep>/* * rimSoundChannelLayoutType.h * Rim Sound * * Created by <NAME> on 12/18/12. * Copyright 2012 __MyCompanyName__. All rights reserved. * */ #ifndef INCLUDE_RIM_SOUND_CHANNEL_LAYOUT_TYPE_H #define INCLUDE_RIM_SOUND_CHANNEL_LAYOUT_TYPE_H #include "rimSoundUtilitiesConfig.h" #include "rimSoundChannelLayout.h" //########################################################################################## //*********************** Start Rim Sound Utilities Namespace **************************** RIM_SOUND_UTILITIES_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// An enum wrapper class which specifies various predefined types of channel layouts. /** * See the ChannelLayout::Type declaration for more information on the predefined layout types. */ class ChannelLayoutType { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructors /// Create a new channel layout type object with the undefined channel layout type enum value. RIM_INLINE ChannelLayoutType() : type( ChannelLayout::UNDEFINED ) { } /// Create a new channel layout type object with the specified channel layout type enum value. RIM_INLINE ChannelLayoutType( ChannelLayout::Type newType ) : type( newType ) { } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Enum Cast Operator /// Convert this channel layout type to an enum value. /** * This operator is provided so that the ChannelLayoutType object can be used * directly in a switch statement without the need to explicitly access * the underlying enum value. * * @return the enum representation of this channel layout type. */ RIM_INLINE operator ChannelLayout::Type () const { return type; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** String Representation Accessor Methods /// Return a string representation of the channel layout type. data::String toString() const; /// Return a string representing the name of this channel layout type. RIM_INLINE data::String getName() const { return this->toString(); } /// Convert this channel type into a string representation. RIM_INLINE operator data::String () const { return this->toString(); } private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Members /// The underlying enum representing the type of layout for this ChannelLayoutType object. ChannelLayout::Type type; }; //########################################################################################## //*********************** End Rim Sound Utilities Namespace ****************************** RIM_SOUND_UTILITIES_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_SOUND_CHANNEL_LAYOUT_TYPE_H <file_sep>/* * rimPhysicsCollisionConstraint.h * Rim Physics * * Created by <NAME> on 11/28/09. * Copyright 2009 Rim Software. All rights reserved. * */ #ifndef INCLUDE_RIM_PHYSICS_COLLISION_CONSTRAINT_H #define INCLUDE_RIM_PHYSICS_COLLISION_CONSTRAINT_H #include "rimPhysicsConstraintsConfig.h" #include "rimPhysicsConstraint.h" //########################################################################################## //********************* Start Rim Physics Constraints Namespace ************************** RIM_PHYSICS_CONSTRAINTS_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class which solves collision constraints between arbitrary template object types. template < typename ObjectType1, typename ObjectType2 > class CollisionConstraint; //########################################################################################## //********************* End Rim Physics Constraints Namespace **************************** RIM_PHYSICS_CONSTRAINTS_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_PHYSICS_COLLISION_CONSTRAINT_H <file_sep>/* * rimSoundFilterParameterValue.h * Rim Sound * * Created by <NAME> on 8/21/12. * Copyright 2012 __MyCompanyName__. All rights reserved. * */ #ifndef INCLUDE_RIM_SOUND_FILTER_PARAMETER_VALUE_H #define INCLUDE_RIM_SOUND_FILTER_PARAMETER_VALUE_H #include "rimSoundFiltersConfig.h" #include "rimSoundFilterParameterType.h" //########################################################################################## //************************ Start Rim Sound Filters Namespace ***************************** RIM_SOUND_FILTERS_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class which holds a union of data representing a filter parameter value. /** * This class is essentially just a wrapper around a union value which * contains accessor methods and conversion methods for all necessary types. * * The user shouldn't have to interact with this class directly - the filter * framework should automatically handle value conversions from this class to * user types. */ class FilterParameterValue { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructors /// Create a filter parameter value with an undefined (unset) value. RIM_INLINE FilterParameterValue() { } /// Create a new filter parameter value with the specified boolean value. RIM_INLINE FilterParameterValue( Bool newBoolean ) : booleanValue( newBoolean ) { } /// Create a new filter parameter value with the specified integer value. /** * This constructor works for parameters with INTEGER or ENUMERATION * types. */ RIM_INLINE FilterParameterValue( Int64 newInteger ) : integerValue( newInteger ) { } /// Create a new filter parameter value with the specified float value. RIM_INLINE FilterParameterValue( Float32 newFloat ) : floatValue( newFloat ) { } /// Create a new filter parameter value with the specified double value. RIM_INLINE FilterParameterValue( Float64 newDouble ) : doubleValue( newDouble ) { } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Value Read Methods /// Interpret this value as the specified type and convert it to a boolean value. /** * If the conversion succeeds, TRUE is returned. Otherwise, if the conversion fails, * FALSE is returned and no output is converted. */ RIM_INLINE Bool getValueAsType( FilterParameterType type, Bool& output ) const { switch ( type ) { case FilterParameterType::BOOLEAN: output = (booleanValue != UInt64(0)); return true; case FilterParameterType::INTEGER: output = (integerValue != Int64(0)); return true; case FilterParameterType::FLOAT: output = (floatValue != Float32(0)); return true; case FilterParameterType::DOUBLE: output = (doubleValue != Float64(0)); return true; default: return false; } } /// Interpret this value as the specified type and convert it to an integer value. /** * If the conversion succeeds, TRUE is returned. Otherwise, if the conversion fails, * FALSE is returned and no output is converted. */ RIM_INLINE Bool getValueAsType( FilterParameterType type, Int64& output ) const { switch ( type ) { case FilterParameterType::BOOLEAN: output = (Int64)booleanValue; return true; case FilterParameterType::INTEGER: output = integerValue; return true; case FilterParameterType::ENUMERATION: output = enumValue; return true; case FilterParameterType::FLOAT: output = (Int64)floatValue; return true; case FilterParameterType::DOUBLE: output = (Int64)doubleValue; return true; default: return false; } } /// Interpret this value as the specified type and convert it to a float value. /** * If the conversion succeeds, TRUE is returned. Otherwise, if the conversion fails, * FALSE is returned and no output is converted. */ RIM_INLINE Bool getValueAsType( FilterParameterType type, Float32& output ) const { switch ( type ) { case FilterParameterType::BOOLEAN: output = (Float32)booleanValue; return true; case FilterParameterType::INTEGER: output = (Float32)integerValue; return true; case FilterParameterType::FLOAT: output = floatValue; return true; case FilterParameterType::DOUBLE: output = (Float32)doubleValue; return true; default: return false; } } /// Interpret this value as the specified type and convert it to a double value. /** * If the conversion succeeds, TRUE is returned. Otherwise, if the conversion fails, * FALSE is returned and no output is converted. */ RIM_INLINE Bool getValueAsType( FilterParameterType type, Float64& output ) const { switch ( type ) { case FilterParameterType::BOOLEAN: output = (Float64)booleanValue; return true; case FilterParameterType::INTEGER: output = (Float64)integerValue; return true; case FilterParameterType::FLOAT: output = (Float64)floatValue; return true; case FilterParameterType::DOUBLE: output = doubleValue; return true; default: return false; } } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Value Write Methods /// Interpret this value as the specified type and set it to a boolean value. /** * If the conversion succeeds, TRUE is returned. Otherwise, if the conversion fails, * FALSE is returned and no output is converted. */ RIM_INLINE Bool setValueAsType( FilterParameterType type, Bool newValue ) { switch ( type ) { case FilterParameterType::BOOLEAN: booleanValue = newValue; return true; case FilterParameterType::INTEGER: integerValue = (Int64)newValue; return true; case FilterParameterType::FLOAT: floatValue = (Float32)newValue; return true; case FilterParameterType::DOUBLE: doubleValue = (Float64)newValue; return true; default: return false; } } /// Interpret this value as the specified type and set it to an integer value. /** * If the conversion succeeds, TRUE is returned. Otherwise, if the conversion fails, * FALSE is returned and no output is converted. */ RIM_INLINE Bool setValueAsType( FilterParameterType type, Int64 newValue ) { switch ( type ) { case FilterParameterType::BOOLEAN: booleanValue = (newValue != Int64(0)); return true; case FilterParameterType::INTEGER: integerValue = (Int64)newValue; return true; case FilterParameterType::ENUMERATION: enumValue = (Int64)newValue; return true; case FilterParameterType::FLOAT: floatValue = (Float32)newValue; return true; case FilterParameterType::DOUBLE: doubleValue = (Float64)newValue; return true; default: return false; } } /// Interpret this value as the specified type and set it to a float value. /** * If the conversion succeeds, TRUE is returned. Otherwise, if the conversion fails, * FALSE is returned and no output is converted. */ RIM_INLINE Bool setValueAsType( FilterParameterType type, Float32 newValue ) { switch ( type ) { case FilterParameterType::BOOLEAN: booleanValue = (newValue != Float32(0)); return true; case FilterParameterType::INTEGER: integerValue = (Int64)newValue; return true; case FilterParameterType::FLOAT: floatValue = newValue; return true; case FilterParameterType::DOUBLE: doubleValue = (Float64)newValue; return true; default: return false; } } /// Interpret this value as the specified type and set it to a double value. /** * If the conversion succeeds, TRUE is returned. Otherwise, if the conversion fails, * FALSE is returned and no output is converted. */ RIM_INLINE Bool setValueAsType( FilterParameterType type, Float64 newValue ) { switch ( type ) { case FilterParameterType::BOOLEAN: booleanValue = (newValue != Float64(0)); return true; case FilterParameterType::INTEGER: integerValue = (Int64)newValue; return true; case FilterParameterType::FLOAT: floatValue = (Float32)newValue; return true; case FilterParameterType::DOUBLE: doubleValue = newValue; return true; default: return false; } } private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Members /// A union which contains the possible storage types for a parameter value. union { UInt64 booleanValue; Int64 integerValue; Int64 enumValue; Float32 floatValue; Float64 doubleValue; }; }; //########################################################################################## //************************ End Rim Sound Filters Namespace ******************************* RIM_SOUND_FILTERS_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_SOUND_FILTER_PARAMETER_VALUE_H <file_sep>/* * rimGraphicsObjectsConfig.h * Rim Graphics * * Created by <NAME> on 5/16/12. * Copyright 2012 __MyCompanyName__. All rights reserved. * */ #ifndef INCLUDE_RIM_GRAPHICS_OBJECTS_CONFIG_H #define INCLUDE_RIM_GRAPHICS_OBJECTS_CONFIG_H #include "../rimGraphicsConfig.h" #include "../rimGraphicsShapes.h" #include "../rimGraphicsUtilities.h" #include "../rimGraphicsCameras.h" //########################################################################################## //########################################################################################## //############ //############ Library Namespace Configuration //############ //########################################################################################## //########################################################################################## #ifndef RIM_GRAPHICS_OBJECTS_NAMESPACE_START #define RIM_GRAPHICS_OBJECTS_NAMESPACE_START RIM_GRAPHICS_NAMESPACE_START namespace objects { #endif #ifndef RIM_GRAPHICS_OBJECTS_NAMESPACE_END #define RIM_GRAPHICS_OBJECTS_NAMESPACE_END }; RIM_GRAPHICS_NAMESPACE_END #endif //########################################################################################## //************************ Start Rim Graphics Objects Namespace ************************** RIM_GRAPHICS_OBJECTS_NAMESPACE_START //****************************************************************************************** //########################################################################################## using rim::graphics::shapes::GraphicsShape; using rim::graphics::shapes::MeshChunk; using rim::graphics::util::BoundingCone; using rim::graphics::cameras::ViewVolume; //########################################################################################## //************************ End Rim Graphics Objects Namespace **************************** RIM_GRAPHICS_OBJECTS_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_GRAPHICS_OBJECTS_CONFIG_H <file_sep>/* * rimGraphicsConverter.h * Rim Software * * Created by <NAME> on 2/18/14. * Copyright 2014 __MyCompanyName__. All rights reserved. * */ #ifndef INCLUDE_RIM_GRAPHICS_CONVERTER_H #define INCLUDE_RIM_GRAPHICS_CONVERTER_H #include "rimGraphicsIOConfig.h" #include "rimGraphicsConverterFlags.h" //########################################################################################## //************************** Start Rim Graphics IO Namespace ***************************** RIM_GRAPHICS_IO_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class which handles conversions from an intermediate format a hardware-based graphics format. class GraphicsConverter { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructors /// Create a generic graphics converter which uses the specified context when converting graphics. /** * This converter won't have access to a resource manager which it uses to * load resources that haven't been loaded yet, and so may not be able to convert * all inputs successfully. */ GraphicsConverter( const Pointer<GraphicsContext>& context ); /// Create a generic graphics converter which uses the specified context and resource manager when converting graphics. GraphicsConverter( const Pointer<GraphicsContext>& context, const Pointer<ResourceManager>& resourceManager ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Destructor /// Destroy this graphics converter, releasing all resources. virtual ~GraphicsConverter(); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Context Accessor Methods /// Return a pointer to the graphics context that this converter is using. /** * If the context pointer is NULL, the converter cannot be used to convert * generic graphics objects to a hardware representation. */ RIM_INLINE const Pointer<GraphicsContext>& getContext() const { return context; } /// Set the graphics context that this converter is using. /** * If the specified context pointer is NULL, the converter cannot be used to convert * generic graphics objects to a hardware representation. * * Calling this method causes the caches for this converter to be cleared. */ void setContext( const Pointer<GraphicsContext>& newContext ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Resource Manager Accessor Methods /// Return a pointer to the resource manager that this converter is using to load external resources. /** * If the manager pointer is NULL, the converter cannot load external resources * that aren't provided as input. */ RIM_INLINE const Pointer<ResourceManager>& getResourceManager() const { return resourceManager; } /// Set the resource manager that this converter is using to load external resources. /** * If the manager pointer is NULL, the converter cannot load external resources * that aren't provided as input. * * Calling this method causes the caches for this converter to be cleared. */ void setResourceManager( const Pointer<ResourceManager>& newResourceManager ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Flags Accessor Methods /// Return a reference to an object which contains boolean parameters of the graphics converter. RIM_INLINE GraphicsConverterFlags& getFlags() { return flags; } /// Return an object which contains boolean parameters of the graphics converter. RIM_INLINE const GraphicsConverterFlags& getFlags() const { return flags; } /// Set an object which contains boolean parameters of the graphics converter. RIM_INLINE void setFlags( const GraphicsConverterFlags& newFlags ) { flags = newFlags; } /// Return whether or not the specified boolan flag is set for this graphics converter. RIM_INLINE Bool flagIsSet( GraphicsConverterFlags::Flag flag ) const { return flags.isSet( flag ); } /// Set whether or not the specified boolan flag is set for this graphics converter. RIM_INLINE void setFlag( GraphicsConverterFlags::Flag flag, Bool newIsSet = true ) { flags.set( flag, newIsSet ); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Cache Accessor Methods /// Return whether or not conversion caching is enabled for the templated data type. template < typename DataType > RIM_INLINE Bool getCacheEnabled() const { return false; } /// Set whether or not conversion caching is enabled for the templated data type. template < typename DataType > RIM_INLINE Bool setCacheEnabled( Bool newCacheEnabled ) { return false; } /// Clear the conversion cache for the templated data type. template < typename DataType > RIM_INLINE Bool clearCache() { return false; } /// Clear all conversion caches for this graphics converter. void clearCaches(); /// Remove all entries in the conversion cache that are not being used (have reference count == 1). void trimCaches(); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Scene Conversion Methods /// Convert the specified generic graphics scene into a hardware-based graphics scene. /** * If the method fails, a NULL pointer is returned. The method can fail if the * specified scene pointer is NULL or if the converter doesn't have a valid * context. */ //Pointer<GraphicsScene> convertGenericScene( const Pointer<GenericGraphicsScene>& genericScene ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Object Conversion Methods /// Convert the specified generic graphics object into a hardware-based graphics object. /** * If the method fails, a NULL pointer is returned. The method can fail if the * specified object pointer is NULL or if the converter doesn't have a valid * context. */ //Pointer<GraphicsObject> convertGenericObject( const Pointer<GenericGraphicsObject>& genericObject ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Shape Conversion Methods /// Convert the specified generic shape into a hardware-based graphics shape. /** * If the method fails, a NULL pointer is returned. The method can fail if the * specified shape pointer is NULL or if the converter doesn't have a valid * context, or if there is no valid conversion for the specified shape's type. */ Pointer<GraphicsShape> convertShape( const Pointer<GraphicsShape>& shape ); /// Convert the specified generic mesh into a hardware-based graphics shape. /** * If the method fails, a NULL pointer is returned. The method can fail if the * specified mesh pointer is NULL or if the converter doesn't have a valid * context. */ Pointer<MeshShape> convertGenericMesh( const Pointer<GenericMeshShape>& mesh ); /// Convert the specified generic sphere into a hardware-based graphics shape. /** * If the method fails, a NULL pointer is returned. The method can fail if the * specified mesh pointer is NULL or if the converter doesn't have a valid * context. */ Pointer<SphereShape> convertGenericSphere( const Pointer<GenericSphereShape>& sphere ); /// Convert the specified generic cylinder into a hardware-based graphics shape. /** * If the method fails, a NULL pointer is returned. The method can fail if the * specified mesh pointer is NULL or if the converter doesn't have a valid * context. */ Pointer<CylinderShape> convertGenericCylinder( const Pointer<GenericCylinderShape>& cylinder ); /// Convert the specified generic capsule into a hardware-based graphics shape. /** * If the method fails, a NULL pointer is returned. The method can fail if the * specified mesh pointer is NULL or if the converter doesn't have a valid * context. */ Pointer<CapsuleShape> convertGenericCapsule( const Pointer<GenericCapsuleShape>& capsule ); /// Convert the specified generic box into a hardware-based graphics shape. /** * If the method fails, a NULL pointer is returned. The method can fail if the * specified mesh pointer is NULL or if the converter doesn't have a valid * context. */ Pointer<BoxShape> convertGenericBox( const Pointer<GenericBoxShape>& box ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Buffer Conversion Methods /// Convert the specified generic buffer into a hardware-based graphics vertex buffer. /** * If the method fails, a NULL pointer is returned. The method can fail if the * specified generic buffer pointer is NULL or if the converter doesn't have a valid * context. */ Pointer<VertexBuffer> convertVertexBuffer( const Pointer<GenericBuffer>& buffer ); /// Convert the specified generic buffer and primitive type into a hardware-based graphics index buffer. /** * If the method fails, a NULL pointer is returned. The method can fail if the * specified generic buffer pointer is NULL or if the converter doesn't have a valid * context. */ Pointer<IndexBuffer> convertIndexBuffer( const Pointer<GenericBuffer>& buffer ); /// Convert the specified generic buffer list into a hardware-based graphics vertex buffer list. /** * If the method fails, a NULL pointer is returned. The method can fail if the * specified generic buffer list pointer is NULL or if the converter doesn't have a valid * context. */ Pointer<VertexBufferList> convertGenericBufferList( const Pointer<GenericBufferList>& bufferList ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Material/Shader Conversion Methods /// Convert the specified generic material into a hardware-based graphics material. /** * If the method fails, a NULL pointer is returned. The method can fail if the * specified generic material pointer is NULL or if the converter doesn't have a valid * context. */ Pointer<Material> convertGenericMaterial( const Pointer<GenericMaterial>& material ); /// Convert the specified generic material technique into a hardware-based graphics material technique. /** * If the method fails, a NULL pointer is returned. The method can fail if the * specified generic material technique pointer is NULL or if the converter doesn't have a valid * context. */ Pointer<MaterialTechnique> convertGenericMaterialTechnique( const Pointer<GenericMaterialTechnique>& materialTechnique ); /// Convert the specified generic shader pass into a hardware-based shader pass. /** * If the method fails, a NULL pointer is returned. The method can fail if the * specified generic shader pass pointer is NULL or if the converter doesn't have a valid * context. */ Pointer<ShaderPass> convertGenericShaderPass( const Pointer<GenericShaderPass>& shaderPass ); /// Convert the specified generic shader program into a hardware-based shader program. /** * If the method fails, a NULL pointer is returned. The method can fail if the * specified generic shader program pointer is NULL or if the converter doesn't have a valid * context. */ Pointer<ShaderProgram> convertGenericShaderProgram( const Pointer<GenericShaderProgram>& shaderProgram ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Texture Conversion Methods /// Convert the specified generic texture into a hardware-based texture. /** * If the method fails, a NULL pointer is returned. The method can fail if the * specified generic texture resource is NULL or if the converter doesn't have a valid * context. */ Resource<Texture> convertGenericTexture( const Resource<GenericTexture>& texture ); private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Helper Methods template < typename DataType > Bool loadGenericResource( const Resource<DataType>& resource ) { // Check to see if the texture is already loaded or can load itself. if ( resource.load() ) return true; // Return failure if the generic texture has no resource ID. const ResourceID* identifier = resource.getID(); if ( identifier == NULL ) return false; // Return failure if resource loading is not enabled. if ( !flags.isSet( GraphicsConverterFlags::RESOURCE_LOADING_ENABLED ) || resourceManager.isNull() ) return false; // Try loading the resource. Resource<DataType> temp = resource; return resourceManager->getResource<DataType>( temp ); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Static Data Members /// The default set of flags for a graphics converter. static const UInt32 DEFAULT_FLAGS = GraphicsConverterFlags::CACHE_ENABLED | GraphicsConverterFlags::SCENE_CACHE_ENABLED | GraphicsConverterFlags::OBJECT_CACHE_ENABLED | GraphicsConverterFlags::SHAPE_CACHE_ENABLED | GraphicsConverterFlags::MATERIAL_CACHE_ENABLED | GraphicsConverterFlags::MATERIAL_TECHNIQUE_CACHE_ENABLED | GraphicsConverterFlags::SHADER_PASS_CACHE_ENABLED | GraphicsConverterFlags::SHADER_PROGRAM_CACHE_ENABLED | GraphicsConverterFlags::SHADER_CACHE_ENABLED | GraphicsConverterFlags::VERTEX_BUFFER_CACHE_ENABLED | GraphicsConverterFlags::VERTEX_BUFFER_LIST_CACHE_ENABLED | GraphicsConverterFlags::TEXTURE_CACHE_ENABLED | GraphicsConverterFlags::RESOURCE_LOADING_ENABLED | GraphicsConverterFlags::DEFERRED_LOADING_ENABLED; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Members /// A pointer to the graphics context to use when converting intermediate data into a hardware-renderable format. Pointer<GraphicsContext> context; /// A pointer to an object which is managing resources for this converter. Pointer<ResourceManager> resourceManager; /// An object which stores boolean configuration information about this graphics converter. GraphicsConverterFlags flags; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Cache Data Members /// A cache of previously converted materials. HashMap< const GenericMaterial*, Pointer<Material> > materialCache; /// A cache of previously converted materials. HashMap< const GenericMaterialTechnique*, Pointer<MaterialTechnique> > materialTechniqueCache; /// A cache of previously converted shader passes. HashMap< const GenericShaderPass*, Pointer<ShaderPass> > shaderPassCache; /// A cache of previously converted shader programs. HashMap< const GenericShaderProgram*, Pointer<ShaderProgram> > shaderProgramCache; /// A cache of previously converted textures. HashMap< const GenericBufferList*, Pointer<VertexBufferList> > bufferListCache; /// A cache of previously converted textures. HashMap< const GenericBuffer*, Pointer<VertexBuffer> > vertexBufferCache; /// A cache of previously converted textures. HashMap< const GenericTexture*, Resource<Texture> > textureCache; }; //########################################################################################## //########################################################################################## //############ //############ Get Cache Enabled Template Specializations //############ //########################################################################################## //########################################################################################## template <> RIM_INLINE Bool GraphicsConverter:: getCacheEnabled<Material>() const { return flags.isSet( GraphicsConverterFlags::MATERIAL_CACHE_ENABLED ); } template <> RIM_INLINE Bool GraphicsConverter:: getCacheEnabled<MaterialTechnique>() const { return flags.isSet( GraphicsConverterFlags::MATERIAL_TECHNIQUE_CACHE_ENABLED ); } template <> RIM_INLINE Bool GraphicsConverter:: getCacheEnabled<ShaderPass>() const { return flags.isSet( GraphicsConverterFlags::SHADER_PASS_CACHE_ENABLED ); } template <> RIM_INLINE Bool GraphicsConverter:: getCacheEnabled<ShaderProgram>() const { return flags.isSet( GraphicsConverterFlags::SHADER_PROGRAM_CACHE_ENABLED ); } template <> RIM_INLINE Bool GraphicsConverter:: getCacheEnabled<VertexBufferList>() const { return flags.isSet( GraphicsConverterFlags::VERTEX_BUFFER_LIST_CACHE_ENABLED ); } template <> RIM_INLINE Bool GraphicsConverter:: getCacheEnabled<VertexBuffer>() const { return flags.isSet( GraphicsConverterFlags::VERTEX_BUFFER_CACHE_ENABLED ); } template <> RIM_INLINE Bool GraphicsConverter:: getCacheEnabled<Texture>() const { return flags.isSet( GraphicsConverterFlags::TEXTURE_CACHE_ENABLED ); } //########################################################################################## //########################################################################################## //############ //############ Set Cache Enabled Template Specializations //############ //########################################################################################## //########################################################################################## template <> RIM_INLINE Bool GraphicsConverter:: setCacheEnabled<Material>( Bool newCacheEnabled ) { flags.set( GraphicsConverterFlags::MATERIAL_CACHE_ENABLED, newCacheEnabled ); return true; } template <> RIM_INLINE Bool GraphicsConverter:: setCacheEnabled<MaterialTechnique>( Bool newCacheEnabled ) { flags.set( GraphicsConverterFlags::MATERIAL_TECHNIQUE_CACHE_ENABLED, newCacheEnabled ); return true; } template <> RIM_INLINE Bool GraphicsConverter:: setCacheEnabled<ShaderPass>( Bool newCacheEnabled ) { flags.set( GraphicsConverterFlags::SHADER_PASS_CACHE_ENABLED, newCacheEnabled ); return true; } template <> RIM_INLINE Bool GraphicsConverter:: setCacheEnabled<ShaderProgram>( Bool newCacheEnabled ) { flags.set( GraphicsConverterFlags::SHADER_PROGRAM_CACHE_ENABLED, newCacheEnabled ); return true; } template <> RIM_INLINE Bool GraphicsConverter:: setCacheEnabled<VertexBufferList>( Bool newCacheEnabled ) { flags.set( GraphicsConverterFlags::VERTEX_BUFFER_LIST_CACHE_ENABLED, newCacheEnabled ); return true; } template <> RIM_INLINE Bool GraphicsConverter:: setCacheEnabled<VertexBuffer>( Bool newCacheEnabled ) { flags.set( GraphicsConverterFlags::VERTEX_BUFFER_CACHE_ENABLED, newCacheEnabled ); return true; } template <> RIM_INLINE Bool GraphicsConverter:: setCacheEnabled<Texture>( Bool newCacheEnabled ) { flags.set( GraphicsConverterFlags::TEXTURE_CACHE_ENABLED, newCacheEnabled ); return true; } //########################################################################################## //########################################################################################## //############ //############ Conversion Cache Clear Method Specializations //############ //########################################################################################## //########################################################################################## template <> RIM_INLINE Bool GraphicsConverter:: clearCache<Material>() { materialCache.clear(); return true; } template <> RIM_INLINE Bool GraphicsConverter:: clearCache<MaterialTechnique>() { materialTechniqueCache.clear(); return true; } template <> RIM_INLINE Bool GraphicsConverter:: clearCache<ShaderPass>() { shaderPassCache.clear(); return true; } template <> RIM_INLINE Bool GraphicsConverter:: clearCache<ShaderProgram>() { shaderProgramCache.clear(); return true; } template <> RIM_INLINE Bool GraphicsConverter:: clearCache<VertexBufferList>() { bufferListCache.clear(); return true; } template <> RIM_INLINE Bool GraphicsConverter:: clearCache<VertexBuffer>() { vertexBufferCache.clear(); return true; } template <> RIM_INLINE Bool GraphicsConverter:: clearCache<Texture>() { textureCache.clear(); return true; } //########################################################################################## //************************** End Rim Graphics IO Namespace ******************************* RIM_GRAPHICS_IO_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_GRAPHICS_CONVERTER_H <file_sep>/* * rimGraphicsOpenGLShaderPass.h * Rim Software * * Created by <NAME> on 2/2/14. * Copyright 2014 __MyCompanyName__. All rights reserved. * */ #ifndef INCLUDE_RIM_GRAPHICS_OPENGL_SHADER_PASS_H #define INCLUDE_RIM_GRAPHICS_OPENGL_SHADER_PASS_H #include "rimGraphicsOpenGLConfig.h" //########################################################################################## //******************** Start Rim Graphics Devices OpenGL Namespace *********************** RIM_GRAPHICS_DEVICES_OPENGL_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class which represents an OpenGL hardware-executed shader pass. class OpenGLShaderPass : public ShaderPass { private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Friend Declaration /// Make the shader program class a friend so that it can create instances of this class. friend class OpenGLContext; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructors /// Create a new shader pass which doesn't have an associated shader program. RIM_INLINE OpenGLShaderPass( const devices::GraphicsContext* context ) : ShaderPass( context ) { } /// Create a new shader pass which uses the specified shader program and the default render mode. RIM_INLINE OpenGLShaderPass( const devices::GraphicsContext* context, const Pointer<ShaderProgram>& newProgram ) : ShaderPass( context, newProgram ) { } /// Create a new shader pass which uses the specified shader program and render mode. RIM_INLINE OpenGLShaderPass( const devices::GraphicsContext* context, const Pointer<ShaderProgram>& newProgram, const RenderMode& newRenderMode ) : ShaderPass( context, newProgram, newRenderMode ) { } }; //########################################################################################## //******************** End Rim Graphics Devices OpenGL Namespace ************************* RIM_GRAPHICS_DEVICES_OPENGL_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_GRAPHICS_OPENGL_SHADER_PASS_H <file_sep>/* * rimWorkerThread.h * Rim Threads * * Created by <NAME> on 10/31/08. * Copyright 2008 __MyCompanyName__. All rights reserved. * */ #ifndef INCLUDE_RIM_WORKER_THREAD_H #define INCLUDE_RIM_WORKER_THREAD_H #include "rimThreadsConfig.h" #include "rimBasicThread.h" #include "rimMutex.h" //########################################################################################## //*************************** Start Rim Threads Namespace ******************************** RIM_THREADS_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class which creates a thread that performs a series of jobs. /** * A worker thread is a thread that runs in the background until a job is submitted * to it. At this point it starts executing the job (a function object) on its thread. * After the job is finished, the worker thread checks to see if there are any more * jobs available. If so, it continues processing. Otherwise, it goes to sleep * until a new job is added. */ class WorkerThread : public BasicThread { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructor /// Create a new worker thread object with no jobs queued. WorkerThread(); /// Create a copy of the specified worker thread, getting a copy of its remaining jobs. /** * If the other worker thread is already running, the newly created worker thread * starts its processing thread. Thus, both worker threads may continue to process * the same jobs until they finish. */ WorkerThread( const WorkerThread& other ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Destructor /// Destroy this worker thread. The current job finishes but the remaining jobs go unprocessed. /** * The destructor does not return until the worker thread terminates. */ ~WorkerThread(); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Assignment Operator /// Assign the jobs of another thread to this thread and match the thread's state. /** * If the other worker thread is already running, the newly created worker thread * starts its processing thread. Thus, both worker threads may continue to process * the same jobs until they finish. */ WorkerThread& operator = ( const WorkerThread& other ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Worker Thread State Control /// Start this worker thread's processing loop, processing any queued jobs. RIM_INLINE void start() { BasicThread::startThread(); } /// Wait for the worker thread to finish processing all of its jobs and return. RIM_INLINE void join() { BasicThread::joinThread(); } /// Request that the worker thread should stop processing after its current job and return. void requestStop(); /// Request that the worker thread should return after finishing all queued jobs. void requestFinish(); /// Return whether or not the worker thread has been requested to stop processing and return. Bool stopIsRequested() const; /// Return whether or not the worker thread has been requested to finish processing and return. Bool finishIsRequested() const; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Job Accessor Methods /// Return the number of jobs that are currently in this work thread's job queue. Size getJobCount() const; /// Add the specified function call object to the list of jobs for this thread to perform. /** * The given function will be called whenever the worker thread is able * to execute the new job and all other jobs with higher priority have been * completed. The function allows the user to specify a priority for the new job * which indicates how soon this job should run. Jobs with the highest priority numbers * are run first. */ void addJob( const lang::FunctionCall<void ( void* )>& job, Int priority = 1 ); /// Clear all jobs from this worker thread. /** * This removes all jobs that have not yet been executed from the worker thread's * job queue. The job which is currently being processed is not affected. */ void clearJobs(); protected: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Protected Virtual Run Function /// The method called by BasicThread as the entry point for a new worker thread. virtual void run(); private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Job Class Declaration /// A class which encapsulates a single job for this worker thread. class Job { public: /// Create a new worker thread job object which runs the given function call with its priority. RIM_INLINE Job( const lang::FunctionCall<void ( void* )>& newJob, Int newPriority ) : priority( newPriority ), job( newJob ) { } /// Return whether or not this job has a higher priority than another job. RIM_INLINE Bool operator < ( const Job& other ) const { return priority < other.priority; } /// The priority of this job. /** * A higher priority means that the job will preempt other jobs with lower * priorities. */ Int priority; /// A function call object specifying what job to perform on the thread. lang::FunctionCall<void ( void* )> job; }; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Members /// A queue of the jobs that this worker thread should perform, sorted by priority. util::PriorityQueue<Job> jobs; /// A mutex object used to provide thread synchronization for access to the queue of jobs. mutable Mutex jobMutex; /// A mutex used to protect the current state of the worker thread from unsafe access. mutable Mutex threadStateMutex; /// A boolean flag indicating that the user requested that this worker thread halt job processing and return. Bool stopRequested; /// A boolean flag indicating that the user requested that this worker thread finish job processing and return. Bool finishRequested; }; //########################################################################################## //*************************** End Rim Threads Namespace ********************************** RIM_THREADS_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_WORKER_THREAD_H <file_sep>/* * rimThread.h * Rim Threads * * Created by <NAME> on 11/7/07. * Copyright 2007 __MyCompanyName__. All rights reserved. * */ #ifndef INCLUDE_RIM_THREAD_H #define INCLUDE_RIM_THREAD_H #include "rimThreadsConfig.h" #include "rimBasicThread.h" //########################################################################################## //*************************** Start Rim Threads Namespace ******************************** RIM_THREADS_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class that provides a function-based interface for creating threads. template < typename Signature > class FunctionThread : public BasicThread { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructors / Destructor /// Create a default thread with no runnable to execute. RIM_INLINE FunctionThread() : BasicThread(), function() { } /// Destroy and clean up the thread, stopping it if necessary. RIM_INLINE ~FunctionThread() { this->join(); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Thread Instance Control /// Start the execution of a thread. /** * This method creates a new thread if the thread is not already running. * The protected run() method of the thread class is then called. A user * of the class can either constuct the thread with a runnable, * subclass Thread and override the run method, or pass a function in to be run. * It is much more flexible to use a runnable or function than inheritance, * but either works equally well. if neither a runnable or function is * specified nor the run() method is overridden, then the thead does nothing. * * @param runnable - a pointer to a class implementing the interface Runnable */ void start( const lang::FunctionCall<Signature>& aFunctionCall ) { if ( !BasicThread::isRunning() ) { function = lang::Pointer< lang::FunctionCall<Signature> >::construct( aFunctionCall ); BasicThread::startThread(); } } RIM_INLINE lang::Optional<typename lang::FunctionCall<Signature>::ReturnType> join() { BasicThread::joinThread(); return returnValue; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Current Thread Control Methods /// Sleep the calling thread for the specified number of milliseconds. RIM_INLINE static void sleep( int milliseconds ) { BasicThread::sleep( milliseconds ); } /// Sleep the calling thread for the specified number of seconds. RIM_INLINE static void sleep( double seconds ) { BasicThread::sleep( seconds ); } /// Relinquish the calling thread's CPU time until it's rescheduled. RIM_INLINE static void yield() { BasicThread::yield(); } /// Terminate the current calling thread RIM_INLINE static void exit() { BasicThread::exit(); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** System Thread Info Methods /// Return the total number of available hardware threads on this system. RIM_INLINE static Size getCPUCount() { return BasicThread::getCPUCount(); } protected: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Protected Type Declarations /// A class which is used to facilitate accessing the return values of function threads. template < typename Sig, typename ReturnType > class ReturnValueWrapper { public: RIM_INLINE lang::Optional<ReturnType> operator () ( const lang::Pointer< lang::FunctionCall<Sig> >& function ) { return (*function)(); } }; /// A class specialization which is used to handle void return values of function threads. template < typename Sig > class ReturnValueWrapper<Sig,void> { public: RIM_INLINE lang::Optional<void> operator () ( const lang::Pointer< lang::FunctionCall<Sig> >& function ) { (*function)(); return lang::Optional<void>(); } }; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Protected Virtual Run Function /// Start the execution of subclass client code on a new thread. virtual void run() { if ( !function.isNull() ) { ReturnValueWrapper<Signature, typename lang::FunctionCall<Signature>::ReturnType> wrapper; returnValue = wrapper( function ); } } private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Members /// The function that is being run by the thread. lang::Pointer< lang::FunctionCall<Signature> > function; /// An object which stores the optionally-NULL return value for this thread. lang::Optional< typename lang::FunctionCall<Signature>::ReturnType > returnValue; }; typedef FunctionThread<void()> Thread; //########################################################################################## //*************************** End Rim Threads Namespace ********************************** RIM_THREADS_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_THREAD_H <file_sep>/* * rimSIMDAABB3D.h * Rim Framework * * Created by <NAME> on 7/12/12. * Copyright 2012 __MyCompanyName__. All rights reserved. * */ #ifndef INCLUDE_RIM_SIMD_AABB_3D_H #define INCLUDE_RIM_SIMD_AABB_3D_H #include "rimMathConfig.h" #include "rimAABB3D.h" #include "rimSIMDVector3D.h" //########################################################################################## //***************************** Start Rim Math Namespace ********************************* RIM_MATH_NAMESPACE_START //****************************************************************************************** //########################################################################################## template < typename T, Size width > class SIMDAABB3D; //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class which represents a set of 3D vectors stored in a SIMD-compatible format. /** * This class is used to store and operate on a set of axis-aligned bounding boxes * in a SIMD fashion. The bounding boxes are stored in a structure-of-arrays format * that accelerates SIMD operations. Each bounding box is specified by a minimum * and maximum vertex coordinate. */ template < typename T > class RIM_ALIGN(16) SIMDAABB3D<T,4> { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructors /// Create a SIMD axis-aligned bounding box that has all components initialized to zero. RIM_FORCE_INLINE SIMDAABB3D() { } /// Create a SIMD axis-aligned bounding box from a single bounding box. RIM_FORCE_INLINE SIMDAABB3D( const AABB3D<T>& aabb ) : min( aabb.min ), max( aabb.max ) { } /// Create a SIMD axis-aligned bounding box from the four specified bounding boxes. RIM_FORCE_INLINE SIMDAABB3D( const AABB3D<T>& aabb1, const AABB3D<T>& aabb2, const AABB3D<T>& aabb3, const AABB3D<T>& aabb4 ) : min( aabb1.min, aabb2.min, aabb3.min, aabb4.min ), max( aabb1.max, aabb2.max, aabb3.max, aabb4.max ) { } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Accessor Methods /// Get either the minimal or maximal vertex of this AABB. /** * If the index parameter is 0, the minimal vertex is returned, if the * index parameter is 1, the maximal vertex is returned. Otherwise the * result is undefined. */ RIM_FORCE_INLINE const SIMDVector3D<T,4>& getMinMax( Index i ) const { return (&min)[i]; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Required Alignment Accessor Methods /// Return the alignment required for objects of this type. /** * For most SIMD types this value will be 16 bytes. If there is * no alignment required, 0 is returned. */ RIM_FORCE_INLINE static Size getRequiredAlignment() { return 16; } /// Get the width of this vector (number of 3D vectors it has). RIM_FORCE_INLINE static Size getWidth() { return 4; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Public Data Members /// The minimum coordinate vectors for this SIMD axis-aligned bounding box. SIMDVector3D<T,4> min; /// The maximum coordinate vectors for this SIMD axis-aligned bounding box. SIMDVector3D<T,4> max; }; //########################################################################################## //***************************** End Rim Math Namespace *********************************** RIM_MATH_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_SIMD_AABB_3D_H <file_sep>#pragma once /** * * This class has been roughly tested but due to the importance of the * operations in the class to the rest of the simulation system, extensive * testing should be performed on all of the contained functions. * * This class contains static helper functions for calculating coordinate * matrices and various transformations and rotations upon them. * * * Author: <NAME> * */ //#include "vmath.h" #include <math.h> #include "AngularVelocity.h" #include "Orientation.h" #include "VehicleState.h" #include "rim/rimEngine.h" using namespace rim; using namespace rim::math; #define PI 3.1416 class VehicleAttitudeHelpers { /** * The i index for the components of a coordinate system represented as a * matrix. * * \(\begin{bmatrix} xi&yi&zi\\ xj&yj&zj\\ xk&yk&zk \end{bmatrix}\) * */ public: const static int INDEX_i = 0; /** * The j index for the components of a coordinate system represented as a * matrix. * <p> * \(\begin{bmatrix} xi&yi&zi\\ xj&yj&zj\\ xk&yk&zk \end{bmatrix}\) * </p> */ const static int INDEX_j = 1; /** * The k index for the components of a coordinate system represented as a * matrix. * <p> * \(\begin{bmatrix} xi&yi&zi\\ xj&yj&zj\\ xk&yk&zk \end{bmatrix}\) * </p> */ const static int INDEX_k = 2; /** * The x index for the components of a coordinate system represented as a * matrix. * <p> * \(\begin{bmatrix} xi&yi&zi\\ xj&yj&zj\\ xk&yk&zk \end{bmatrix}\) * </p> */ const static int INDEX_X = 0; /** * The y index for the components of a coordinate system represented as a * matrix. * <p> * \(\begin{bmatrix} xi&yi&zi\\ xj&yj&zj\\ xk&yk&zk \end{bmatrix}\) * </p> */ const static int INDEX_Y = 1; /** * The z index for the components of a coordinate system represented as a * matrix. * <p> * \(\begin{bmatrix} xi&yi&zi\\ xj&yj&zj\\ xk&yk&zk \end{bmatrix}\) * </p> */ const static int INDEX_Z = 2; /** * This function translates yaw, pitch, and roll angles to a * <code>Matrix3f</code> representing the X, Y, and Z-axis attitude of a * vehicle. Rotations are performed, roll, then pitch, and finally yaw. * * <p> * \(\begin{bmatrix} xi&yi&zi\\ xj&yj&zj\\ xk&yk&zk \end{bmatrix}\) * </p> * * @param yawRadians * The angle in radians of rotation about the Z-axis. * @param pitchRadians * The angle in radians of rotation about the Y-axis. * @param rollRadians * The angle in radians of rotation about the X-axis. * @return A <code>Matrix3f</code> representation of the body frame * coordinate system that coincides with the passed yaw, pitch, and * roll. */ public: static Matrix3f getAttitudeMatrix(float yawRadians, float pitchRadians, float rollRadians) { float alpha = yawRadians; float beta = pitchRadians; float gamma = rollRadians; float cosAlpha = cos(alpha); float sinAlpha = sin(alpha); float cosBeta = cos(beta); float sinBeta = sin(beta); float cosGamma = cos(gamma); float sinGamma = sin(gamma); float bxi = cosAlpha * cosBeta; float bxj = sinAlpha * cosBeta; float bxk = -sinBeta; float byi = (cosAlpha * sinBeta * sinGamma) - (sinAlpha * cosGamma); float byj = (sinAlpha * sinBeta * sinGamma) + (cosAlpha * cosGamma); float byk = cosBeta * sinGamma; float bzi = (cosAlpha * sinBeta * cosGamma) + (sinAlpha * sinGamma); float bzj = (sinAlpha * sinBeta * cosGamma) - (cosAlpha * sinGamma); float bzk = cosBeta * cosGamma; float barray[9] = {bxi, byi, bzi, bxj, byj, bzj, bxk, byk, bzk}; //return Matrix3f(barray); return Matrix3f(bxi, bxj, bxk, byi, byj, byk, bzi, bzj, bzk); } /** * This function returns a <code>Vector3f</code> of the Z-axis of the * coordinate system defined by the yaw, pitch, and roll angles passed. * * @param yawRadians * The angle in radians of rotation about the Z-axis. * @param pitchRadians * The angle in radians of rotation about the Y-axis. * @param rollRadians * The angle in radians of rotation about the X-axis. * @return <code>Vector3f</code> representation of the Z-axis of the * coordinates system defined by the angles passed */ static Vector3f getZAxisFromRadians(float yawRadians, float pitchRadians, float rollRadians) { float beta = pitchRadians; float gamma = rollRadians; float cosBeta = cos(beta); float sinBeta = sin(beta); float cosGamma = cos(gamma); float sinGamma = sin(gamma); float m20 = sinBeta; float m21 = cosBeta * sinGamma; float m22 = cosBeta * cosGamma; return Vector3f(m20, m21, m22); } /** * This function translates a coordinate system defined in the global * reference frame to the coordinate system passed in's frame. * <p> * The <code>Matrix3f</code> objects represent the X, Y, and Z-axis of a * coordinate system. * </p> * <p> * \(\begin{bmatrix} xi&yi&zi\\ xj&yj&zj\\ xk&yk&zk \end{bmatrix}\) * </p> * * @param bodyAttitudeG * A <code>Matrix3f</code> of the current body attitude in the * Global reference frame. * @param newBodyAttitudeG * A <code>Matrix3f</code> of the target body attitude in the * Global reference frame. * @return A <code>Matrix3f</code> of the newBodyAttitude in the Body frame. */ static Matrix3f translateCoordinateSystemToBodyFrame( Matrix3f bodyAttitudeG, Matrix3f newBodyAttitudeG) { Matrix3f bodyAttitudeGTranspose = bodyAttitudeG.transpose(); // Multiplies newBodyAttitudeG by bodyAttitudeGTranspose return bodyAttitudeGTranspose*(newBodyAttitudeG); } /** * This function translates a <code>Vector3f</code> defined in the global * reference frame to the coordinate system passed in's frame represented as * a <code>Matrix3f</code> object. * * <p> * The <code>Matrix3f</code> object represents the X, Y, and Z-axis of a * coordinate system as follows, * </p> * <p> * \(\begin{bmatrix} xi&yi&zi\\ xj&yj&zj\\ xk&yk&zk \end{bmatrix}\) * </p> * * @param bodyAttitudeG * A <code>Matrix3f</code> of the current body attitude in the * Global reference frame. * @param vectorG * The <code>Vector3f</code> to be translated to the passed body * frame. * @return The <code>Vector3f</code> vectorG in the Body frame. */ static Vector3f translateVectorToBodyFrame(Matrix3f bodyAttitudeG, Vector3f vectorG) { Matrix3f bodyAttitudeGTranspose = bodyAttitudeG.transpose(); // Multiplies newBodyAttitudeG by bodyAttitudeGTranspose return bodyAttitudeGTranspose*(vectorG); } /** * This function takes a <code>Matrix3f</code> object representing an * orientation and returns a rotation matrix that should be applied the * identity matrix to achieve the new orientation represented by applying * the roll, then pitch, and finally yaw to the original orientation. * <p> * The currentAttitude <code>Matrix3f</code> represent the X, Y, and Z-axis * of a body coordinate system in the global frame. * </p> * <p> * \(\begin{bmatrix} xi&yi&zi\\ xj&yj&zj\\ xk&yk&zk \end{bmatrix}\) * </p> * * @param currentAttitude * A <code>Matrix3f</code> representing the X, Y, and Z-axis of a * body coordinate system in the global frame. * @param yawRadians * The radians of rotation to apply about the Z-axis to the * currentAttitude. * @param pitchRadians * The radians of rotation to apply about the Y-axis to the * currentAttitude. * @param rollRadians * The radians of rotation to apply about the X-axis to the * currentAttitude. * @return A new <code>Matrix3f</code> rotation matrix which if applied to * the identity matrix will result in the new attitude. */ static Matrix3f getRotationMatrix(Matrix3f currentAttitude, float yawRadians, float pitchRadians, float rollRadians) { float alpha = yawRadians; float beta = pitchRadians; float gamma = rollRadians; float cosAlpha = cos(alpha); float sinAlpha = sin(alpha); float cosBeta = cos(beta); float sinBeta = sin(beta); float cosGamma = cos(gamma); float sinGamma = sin(gamma); float bxi = cosAlpha * cosBeta; float bxj = sinAlpha * cosBeta; float bxk = -sinBeta; float byi = (cosAlpha * sinBeta * sinGamma) - (sinAlpha * cosGamma); float byj = (sinAlpha * sinBeta * sinGamma) + (cosAlpha * cosGamma); float byk = cosBeta * sinGamma; float bzi = (cosAlpha * sinBeta * cosGamma) + (sinAlpha * sinGamma); float bzj = (sinAlpha * sinBeta * cosGamma) - (cosAlpha * sinGamma); float bzk = cosBeta * cosGamma; float barray[9] = {bxi, byi, bzi, bxj, byj, bzj, bxk, byk, bzk}; Matrix3f rotationMatrix = Matrix3f(bxi, bxj, bxk, byi, byj, byk, bzi, bzj, bzk); //Matrix3f(barray); return rotationMatrix*(currentAttitude).transpose(); } /** * This function takes a <code>Matrix3f</code> object representing an * orientation and returns a new matrix that represents the new attitude by * applying the roll, then pitch, and finally yaw to the original * orientation. * <p> * The currentAttitude <code>Matrix3f</code> represent the X, Y, and Z-axis * of a body coordinate system in the global frame. * </p> * <p> * \(\begin{bmatrix} xi&yi&zi\\ xj&yj&zj\\ xk&yk&zk \end{bmatrix}\) * </p> * * @param currentAttitude * A <code>Matrix3f</code> representing the X, Y, and Z-axis of a * body coordinate system in the global frame. * @param yawRadians * The radians of rotation to apply about the Z-axis to the * currentAttitude. * @param pitchRadians * The radians of rotation to apply about the Y-axis to the * currentAttitude. * @param rollRadians * The radians of rotation to apply about the X-axis to the * currentAttitude. * @return A new <code>Matrix3f</code> that represents the new attitude by * applying the <code>rollRadians</code>, then * <code>pitchRadians</code>, and finally <code>yawRadians</code> to * the original orientation. */ static Matrix3f getNewAttitudeMatrix(Matrix3f currentAttitude, float yawRadians, float pitchRadians, float rollRadians) { float alpha = yawRadians; float beta = pitchRadians; float gamma = rollRadians; float cosAlpha = cos(alpha); float sinAlpha = sin(alpha); float cosBeta = cos(beta); float sinBeta = sin(beta); float cosGamma = cos(gamma); float sinGamma = sin(gamma); float bxi = cosAlpha * cosBeta; float bxj = sinAlpha * cosBeta; float bxk = -sinBeta; float byi = (cosAlpha * sinBeta * sinGamma) - (sinAlpha * cosGamma); float byj = (sinAlpha * sinBeta * sinGamma) + (cosAlpha * cosGamma); float byk = cosBeta * sinGamma; float bzi = (cosAlpha * sinBeta * cosGamma) + (sinAlpha * sinGamma); float bzj = (sinAlpha * sinBeta * cosGamma) - (cosAlpha * sinGamma); float bzk = cosBeta * cosGamma; float barray[9] = {bxi, byi, bzi, bxj, byj, bzj, bxk, byk, bzk}; Matrix3f rotationMatrix = Matrix3f(bxi, bxj, bxk, byi, byj, byk, bzi, bzj, bzk); //Matrix3f(barray); return rotationMatrix*(currentAttitude); } /** * <FONT COLOR="DC143C">WARNING!</FONT><br> * TEST THIS FUNCTION * <p> * This function returns a <code>Vector3f</code> object containing the yaw, * pitch, and roll angles given a new coordinate system from the global * system. * <ul> * <li>The yaw is stored in the <code>x</code> variable.</li> * <li>The pitch is stored in the <code>y</code> variable.</li> * <li>The roll is stored in the <code>z</code> variable.</li> * </ul> * </p> * * @param newAttitude * A <code>Matrix3f</code> representing the X, Y, and Z-axis of a * body coordinate system in the global frame. * @return A <code>Vector3f</code> containing the yaw in radians in the * <code>x</code> value, the pitch in radians in the <code>y</code> * value, and the roll in radians in the<code> z</code> value. */ static Vector3f getYawPitchRollFromCoordinateSystemInRadians( Matrix3f newAttitude) { Matrix3f normalAttitude = Matrix3f(); normalAttitude.setColumn(0, newAttitude.getColumn(0).normalize()); normalAttitude.setColumn(1, newAttitude.getColumn(1).normalize()); normalAttitude.setColumn(2, newAttitude.getColumn(2).normalize()); float xi = newAttitude.get(INDEX_i, INDEX_X); float xj = newAttitude.get(INDEX_j, INDEX_X); float xk = newAttitude.get(INDEX_k, INDEX_X); float zk = newAttitude.get(INDEX_k, INDEX_Z); float yk = newAttitude.get(INDEX_k, INDEX_Y); float yaw = 0; float pitch = 0; float roll = 0; if (xi == 0 && xj > 0) { // can not divide by zero and if xj is positive, angle is Pi/2 yaw = PI/2; } else if (xi == 0 && xj < 0) { // can not divide by zero and if xj is negative, angle is 3Pi/2 yaw = 3 * PI/4; } else if (xj >= 0 && xi > 0) { // if xj and xi are positive then atan returns the correct value yaw = atan(xj / xi); } else if (xj < 0 && xi > 0) { // if xj is negative and xi is positive, atan returns a negative // angle and we want positive ones yaw = atan(xj / xi); } else { // if xj is negative or positive and xi is negative, atan returns an // angle reflected about the origin yaw = atan(xj / xi) + PI; } if (xk >= 0 && xi >= 0) { // if xk and xi are positive then asin returns the correct value pitch = asin(-xk); } else if (xk >= 0 && xi < 0) { // if xk is positive and xi is negative, asin returns an angle // reflected about the y axis pitch = -asin(-xk); } else if (xk < 0 && xi < 0) { // if xk is negative and xi is negative, asin returns an angle // reflected about the y axis pitch = 2*PI + asin(-xk); } else if (xk < 0 && xi >= 0) { // if xk is negative and xi is positive, asin returns a negative // angle and we want positive ones pitch = asin(-xk); } if (zk == 0 && yk > 0) { // can not divide by zero and if yk is positive, angle is Pi/2 roll = PI/2; } else if (zk == 0 && yk < 0) { // can not divide by zero and if yk is negative, angle is 3Pi/2 roll = 3 * PI/4; } else if (yk >= 0 && zk > 0) { // if yk and zk are positive then atan returns the correct value roll = atan(yk / zk); } else if (yk < 0 && zk > 0) { // if yk is negative and zk is positive, atan returns a negative // angle and we want positive ones roll = atan(yk / zk); } else { // if yk is negative or positive and zk is negative, atan returns an // angle reflected about the origin roll = atan(yk / zk) + PI; } return Vector3f(yaw, pitch, roll); } /** * <FONT COLOR="DC143C">WARNING!</FONT><br> * This function may be wrong. It should be tested throughly. * <p> * This function returns the pitch and roll angles necessary to achieve the * given Z-axis if the yaw angle is fixed at zero. * </p> * @param zAxis * The Z-axis which defines the new attitude * @return A Vector3f that contains zero in the x variable, the pitch angle * in radians in the y variable, and the roll angle in radians in * the z variable. */ static Vector3f getPitchAndRollFromZWhenYawIsZero(Vector3f zAxis) { Vector3f normalizedZAxis = zAxis; normalizedZAxis.normalize(); float beta = 0; float gamma = 0; if (normalizedZAxis.z == 0 && normalizedZAxis.x >= 0) { beta = PI/2; } else if (normalizedZAxis.z == 0 && normalizedZAxis.x < 0) { beta = -PI/2; } else if (normalizedZAxis.z > 0 && normalizedZAxis.x >= 0) { beta = (float) atan(normalizedZAxis.x / normalizedZAxis.z); } else if (normalizedZAxis.z > 0 && normalizedZAxis.x < 0) { beta = (float) atan(normalizedZAxis.x / normalizedZAxis.z); } else if (normalizedZAxis.z < 0 && normalizedZAxis.x >= 0) { beta = (float) (PI - atan(normalizedZAxis.x / normalizedZAxis.z)); } else { beta = (float) (-PI + atan(normalizedZAxis.x / normalizedZAxis.z)); } if (normalizedZAxis.y >= 0 && normalizedZAxis.z >= 0) { // if xk and xi are positive then asin returns the correct value gamma = (float) -asin(normalizedZAxis.y); } else if (normalizedZAxis.y >= 0 && normalizedZAxis.z < 0) { // if xk is positive and xi is negative, asin returns an angle // reflected about the y axis gamma = (float) (-PI + asin(normalizedZAxis.y)); } else if (normalizedZAxis.y < 0 && normalizedZAxis.z < 0) { // if xk is negative and xi is negative, asin returns an angle // reflected about the y axis gamma = (float) (PI + asin(normalizedZAxis.y)); } else { // if xk is negative and xi is positive, asin returns a negative // angle and we want positive ones gamma = (float) (-asin(normalizedZAxis.y)); } return Vector3f(0, beta, gamma); } }; <file_sep>/* * rimGraphicsGUIFontStyle.h * Rim Graphics GUI * * Created by <NAME> on 1/22/13. * Copyright 2013 Headspace Systems. All rights reserved. * */ #ifndef INCLUDE_RIM_GRAPHICS_GUI_FONT_STYLE_H #define INCLUDE_RIM_GRAPHICS_GUI_FONT_STYLE_H #include "rimGraphicsGUIFontsConfig.h" #include "rimGraphicsGUIFont.h" #include "rimGraphicsGUIFontLayout.h" //########################################################################################## //********************* Start Rim Graphics GUI Fonts Namespace *************************** RIM_GRAPHICS_GUI_FONTS_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class which describes information about appearance of a particular font style. /** * This information includes the font itself, the size of the font and the font's color. */ class FontStyle { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructor /// Create a default font style object which doesn't represent a valid font style. RIM_INLINE FontStyle() : font(), fontSize( 0 ), color(), layout( FontLayout::HORIZONTAL ) { } /// Create a new font style object which has the specified attributes. RIM_INLINE FontStyle( const Pointer<Font>& newFont, Float newFontSize, const Color4f& newColor ) : font( newFont ), fontSize( newFontSize ), color( newColor ), layout( FontLayout::HORIZONTAL ) { } /// Create a new font style object which has the specified attributes. RIM_INLINE FontStyle( const Pointer<Font>& newFont, Float newFontSize, const Color4f& newColor, const FontLayout& newLayout ) : font( newFont ), fontSize( newFontSize ), color( newColor ), layout( newLayout ) { } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Font Accessor Methods /// Return a pointer to a Font object which determines the appearance of the style. RIM_INLINE const Pointer<Font>& getFont() const { return font; } /// Set a pointer to a Font object which determines the appearance of the style. RIM_INLINE void setFont( const Pointer<Font>& newFont ) { font = newFont; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Font Size Accessor Methods /// Return a number which indicates the nominal size of the font for the style. RIM_INLINE Float getFontSize() const { return fontSize; } /// Set a number which indicates the nominal size of the font for the style. RIM_INLINE void setFontSize( Float newFontSize ) { fontSize = newFontSize; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Font Style Name Accessor Methods /// Return a reference to an object that describes the RGBA color of the font style. RIM_INLINE const Color4f& getColor() const { return color; } /// Set an object that describes the RGBA color of the font style. RIM_INLINE void setColor( const Color4f& newColor ) { color = newColor; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Font Style Name Accessor Methods /// Return a reference to an object that describes the direction that the font style is layed out. RIM_INLINE const FontLayout& getLayout() const { return layout; } /// Set an object that describes the direction that the font style is layed out. RIM_INLINE void setLayout( const FontLayout& newLayout ) { layout = newLayout; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Static Font Style Accessor Methods /// Return the default font style. RIM_INLINE static FontStyle getDefault() { return FontStyle( Font::getDefault(), 12, Color4f::BLACK ); } private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Members /// An RGBA color which indicates the desired color of the font style, including transparency. Color4f color; /// A number which indicates the nominal size of the font for the style. Float fontSize; /// An object which specifies the direction in which this font style should be layed out. FontLayout layout; /// A pointer to an object which determines the appearance of the font style. Pointer<Font> font; }; //########################################################################################## //********************* End Rim Graphics GUI Fonts Namespace ***************************** RIM_GRAPHICS_GUI_FONTS_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_GRAPHICS_GUI_FONT_STYLE_H <file_sep>/* * rimPhysicsIntersectionPoint.h * Rim Physics * * Created by <NAME> on 6/23/12. * Copyright 2012 __MyCompanyName__. All rights reserved. * */ #ifndef INCLUDE_RIM_PHYSICS_INTERSECTION_POINT_H #define INCLUDE_RIM_PHYSICS_INTERSECTION_POINT_H #include "rimPhysicsUtilitiesConfig.h" //########################################################################################## //********************** Start Rim Physics Utilities Namespace *************************** RIM_PHYSICS_UTILITIES_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class used to encapsulate basic information about a point of intersection between two shapes. class IntersectionPoint { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructors RIM_INLINE IntersectionPoint() { } RIM_INLINE IntersectionPoint( const Vector3& newPoint1, const Vector3& newPoint2, const Vector3& newNormal, Real newDistance ) : point1( newPoint1 ), point2( newPoint2 ), normal( newNormal ), penetrationDistance( newDistance ) { } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Reverse Method /// Reverse this intersection point by swapping the shape intersection points and negating the normal vector. RIM_INLINE void reverse() { Vector3 temp = point1; point1 = point2; point2 = temp; normal = -normal; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Public Data Members /// The intersection point on the surface of the first intersecting shape. Vector3 point1; /// The intersection point on the surface of the second intersecting shape. Vector3 point2; /// The normal pointing from the intersection on shape 1 to the intersection on shape 2. Vector3 normal; /// The positive penetration distance of the two shapes. Real penetrationDistance; }; //########################################################################################## //********************** End Rim Physics Utilities Namespace ***************************** RIM_PHYSICS_UTILITES_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_PHYSICS_INTERSECTION_POINT_H <file_sep>/* * rimSoundMIDIBuffer.h * Rim Sound * * Created by <NAME> on 4/25/13. * Copyright 2013 __MyCompanyName__. All rights reserved. * */ #ifndef INCLUDE_RIM_SOUND_MIDI_BUFFER_H #define INCLUDE_RIM_SOUND_MIDI_BUFFER_H #include "rimSoundUtilitiesConfig.h" #include "rimSoundMIDIEvent.h" #include "rimSoundMIDITime.h" //########################################################################################## //*********************** Start Rim Sound Utilities Namespace **************************** RIM_SOUND_UTILITIES_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class which represents a sequence of MIDI events. /** * A MIDI buffer keeps a small local storage space for events which avoids * allocating any extra memory when the total number of events in a buffer * small (less than a few). */ class MIDIBuffer { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructors /// Create an empty MIDI buffer with the default initial capacity. RIM_INLINE MIDIBuffer() : events( (MIDIEvent*)eventArray ), numEvents( 0 ), eventCapacity( FIXED_EVENT_ARRAY_SIZE ) { } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Destructor /// Destroy a MIDI buffer, deallocating its internal array of events. RIM_INLINE ~MIDIBuffer() { if ( events != (MIDIEvent*)eventArray ) rim::util::deallocate( events ); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Assignment Operator /// Assign the contents of the specified MIDI buffer to this one. MIDIBuffer& operator = ( const MIDIBuffer& other ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Event Accessor Methods /// Return the total number of valid events that are part of this MIDI buffer. RIM_INLINE Size getEventCount() const { return numEvents; } /// Return a reference to the MIDI event at the specified index in this MIDI buffer. RIM_INLINE MIDIEvent& getEvent( Index eventIndex ) { RIM_DEBUG_ASSERT_MESSAGE( eventIndex < numEvents, "Invalid MIDI event buffer index" ); return events[eventIndex]; } /// Return a const reference to the MIDI event at the specified index in this MIDI buffer. RIM_INLINE const MIDIEvent& getEvent( Index eventIndex ) const { RIM_DEBUG_ASSERT_MESSAGE( eventIndex < numEvents, "Invalid MIDI event buffer index" ); return events[eventIndex]; } /// Add a new MIDI event to the end of this MIDI buffer. RIM_INLINE void addEvent( const MIDIEvent& newEvent ) { if ( numEvents == eventCapacity ) reallocateEvents( eventCapacity*2 ); events[numEvents] = newEvent; numEvents++; } /// Remove all events from this MIDI buffer. RIM_INLINE void clearEvents() { numEvents = 0; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Buffer Capacity Accessor Methods /// Return the maximum number of events that can be stored in this buffer without any buffer reallocations. RIM_INLINE Size getCapacity() const { return eventCapacity; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Buffer MIDI Time Accessor Methods /// Return the musical time within the MIDI sequence for the start of this frame. RIM_INLINE const MIDITime& getTime() const { return time; } /// Set the musical time within the MIDI sequence for the start of this frame. RIM_INLINE void setTime( const MIDITime& newTime ) { time = newTime; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Buffer Copy Method /// Copy the entire contents of this buffer to another MIDI buffer, including the MIDI time. void copyTo( MIDIBuffer& other ) const; private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Helper Methods /// Double the capacity of the internal event array, copying the old events. void reallocateEvents( Size newCapacity ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Static Data Members /// Define the size of the fixed-size array of MIDI events that is part of a MIDIBuffer. static const Size FIXED_EVENT_ARRAY_SIZE = 2; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Members /// A pointer to the internal buffer of events. MIDIEvent* events; /// The number of events that are currently valid in this MIDI buffer. Size numEvents; /// The total number of events that can be stored in the current data buffer used by this MIDI buffer. Size eventCapacity; /// An object representing the musical time within the MIDI sequence for the start of this buffer. MIDITime time; /// A fixed-size array of bytes that localy store a few MIDI events to avoid allocations. UByte eventArray[FIXED_EVENT_ARRAY_SIZE*sizeof(MIDIEvent)]; }; //########################################################################################## //*********************** End Rim Sound Utilities Namespace ****************************** RIM_SOUND_UTILITIES_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_SOUND_MIDI_BUFFER_H <file_sep>/* * rimStack.h * Rim Framework * * Created by <NAME> on 11/26/07. * Copyright 2007 Rim Software. All rights reserved. * */ #ifndef INCLUDE_RIM_STACK_H #define INCLUDE_RIM_STACK_H #include "rimUtilitiesConfig.h" //########################################################################################## //*************************** Start Rim Framework Namespace ****************************** RIM_UTILITIES_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A simple stack class which implements the standard push, pop, and peek methods. /** * This class is an array-based stack class. It is a first-in-first-out data * structure. One places an element on the stack by calling add(), and * removes an element by calling remove(). One can return the top value on the * stack without changing the stack by calling get(). Other attributes such * as the size of the stack can be queried. This data structure is not thread safe. */ template < typename T > class Stack { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructors /// Create a new empty stack with the default capacity of 8 elements. /** * This is a lightweight operation and the stack doesn't allocate any * memory until an element is pushed onto the stack. */ RIM_INLINE Stack() : numElements( 0 ), capacity( 0 ), stack( NULL ) { } /// Create a new empty stack with the specified initial capacity. /** * The initial capacity of the stack array can be set by the * parameter, which can be used to pad the stack to avoid having * to resize the stack often. * * @param newCapacity - the initial capacity of the stack array */ RIM_INLINE Stack( Size newCapacity ) : numElements( 0 ), capacity( newCapacity ), stack( util::allocate<T>(newCapacity) ) { } /// Create a copy of an existing stack. This is a deep copy. RIM_INLINE Stack( const Stack& otherStack ) : numElements( otherStack.numElements ), capacity( otherStack.capacity ), stack( util::allocate<T>(otherStack.capacity) ) { // copy the elements from the old array to the new array. Stack<T>::copyObjects( stack, otherStack.array, numElements ); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Destructor RIM_INLINE ~Stack() { if ( stack != NULL ) { // Call the destructors of all objects that were constructed and deallocate the internal array. util::destructArray( stack, numElements ); } } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Assignment Operator /// Assign the contents of one stack to another, performing a deep copy. RIM_INLINE Stack<T>& operator = ( const Stack<T>& other ) { if ( this != &other ) { if ( stack != NULL ) { // Call the destructors of all objects that were constructed. Stack<T>::callDestructors( stack, numElements ); } numElements = other.numElements; if ( numElements == Size(0) ) return *this; else { if ( numElements > capacity || stack == NULL ) { // Deallocate the internal array. if ( stack != NULL ) util::deallocate( stack ); // Allocate a new array. capacity = other.capacity; stack = util::allocate<T>( capacity ); } // copy the elements from the other Stack. Stack<T>::copyObjects( stack, other.stack, numElements ); } } return *this; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Push Method /// Push a new element onto the stack. /** * If the current size of the stack is equal to its capacity, * then the stack is resized by calling the private resize() method * which reallocates the internal stack array to double the original * size. * * @param newElement - the new element to be pushed onto the stack. */ void add( const T& newElement ) { if ( numElements == capacity ) doubleCapacity(); new (stack + numElements) T( newElement ); numElements++; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Get Methods /// Return the top element of the stack without removing it. /** * If there are no elements in the stack, then an exception is * thrown indicating the error. This is the const version which * returns a const reference to the element, disallowing its * modification. * * @return a const reference to the top element of the stack. */ RIM_INLINE const T& get() const { RIM_DEBUG_ASSERT_MESSAGE( numElements > 0, "Attempted to get the top of an empty stack." ); return *(stack + numElements - 1); } /// Return the top element of the stack without removing it. /** * If there are no elements in the stack, then an exception is * thrown indicating the error. This is the non-const version which * returns a non-const reference to the element, allowing its * modification. * * @return a reference to the top element of the stack. */ RIM_INLINE T& get() { RIM_DEBUG_ASSERT_MESSAGE( numElements > 0, "Attempted to get the top of an empty stack." ); return *(stack + numElements - 1); } /// Return the element of the stack at the specified depth without removing it. /** * The depth at which one is peeking is an integer ranging from 0 to * the size of the stack minus 1. Depth zero specifies the element at the top * of the stack. If the depth index is outside of the valid range, then * an exception is thrown indicating the error. This is the const version which * returns a const reference to the element, disallowing its * modification. * * @return a const reference to the element of the stack at the specified depth. */ RIM_INLINE const T& get( Index depth ) const { Index index = numElements - depth - 1; RIM_DEBUG_ASSERT_MESSAGE( index < numElements, "Attempted to get stack element at an invalid index." ); return *(stack + index); } /// Return the element of the stack at the specified depth without removing it. /** * The depth at which one is peeking is an integer ranging from 0 to * the size of the stack minus 1. Depth zero specifies the element at the top * of the stack. If the depth index is outside of the valid range, then * an exception is thrown indicating the error. This is the non-const version which * returns a non-const reference to the element, disallowing its * modification. * * @return a reference to the element of the stack at the specified depth. */ RIM_INLINE T& get( Index depth ) { Index index = numElements - depth - 1; RIM_DEBUG_ASSERT_MESSAGE( index < numElements, "Attempted to get stack element at an invalid index." ); return *(stack + index); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Remove Method /// Return the top element of the stack and remove it in the process. /** * If there are no elements in the stack, then an exception is * thrown indicating the error. * * @return the top element of the stack. */ RIM_INLINE T remove() { RIM_DEBUG_ASSERT_MESSAGE( numElements > 0, "Attempted to remove element from an empty stack." ); // Extract the element to be removed. numElements--; T temp = *(stack + numElements); // Destroy the element that was stored. (stack + numElements)->~T(); return temp; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Clear Methods //// Clear the contents of this stack. /** * This method calls the destructors of all elements in the stack * and sets the number of elements to zero while maintaining the * stack's capacity. */ RIM_INLINE void clear() { if ( stack != NULL ) Stack<T>::callDestructors( stack, numElements ); numElements = Size(0); } /// Clear the contents of this stack and reclaim the allocated memory. /** * This method performs the same function as the clear() method, but * also deallocates the previously allocated internal array and reallocates * it to a small initial starting size. Calling this method is equivalent * to assigning a brand new stack instance to this one. */ RIM_INLINE void reset() { if ( stack != NULL ) util::destructArray( stack, numElements ); capacity = Size(0); stack = NULL; numElements = Size(0); } /// Clear the contents of this stack and reclaim the allocated memory. /** * This method performs the same function as the clear() method, but * also deallocates the previously allocated internal array and reallocates * it to an initial starting size. Calling this method is equivalent * to assigning a brand new stack instance to this one. This version of * the reset() method allows the caller to specify the new starting * capacity of the array list. */ RIM_INLINE void reset( Size newCapacity ) { if ( stack != NULL ) util::destructArray( stack, numElements ); capacity = newCapacity; stack = util::allocate<T>( capacity ); numElements = Size(0); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Size Accessor Methods /// Return whether or not the stack has any elements. /** * This method returns TRUE if the size of the stack * is greater than zero, and FALSE otherwise. * This method is here for convenience. * * @return whether or not the stack has any elements. */ RIM_INLINE Bool isEmpty() const { return numElements == Size(0); } /// Return the number of elements in the stack. /** * @return the number of elements in the stack. */ RIM_INLINE Size getSize() const { return numElements; } /// Get the current capacity of the stack. /** * The capacity is the maximum number of elements that the * stack can hold before it will have to resize its * internal array. * * @return the current capacity of the stack. */ RIM_INLINE Size getCapacity() const { return capacity; } private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Stack Methods RIM_INLINE void doubleCapacity() { // check to see if the array has not yet been allocated. if ( capacity == 0 ) { // allocate the array to hold elements. capacity = DEFAULT_INITIAL_CAPACITY; stack = util::allocate<T>( capacity ); } else resize( capacity << 1 ); } /// Double the size of the element array to increase the capacity of the stack. /** * This method deallocates the previously used array, and then allocates * a new block of memory with a size equal to double the previous size. * It then copies over all of the previous elements into the new array. */ void resize( Size newCapacity ) { // Update the capacity and allocate a new array. capacity = newCapacity; T* oldStack = stack; stack = util::allocate<T>( capacity ); // copy the elements from the old array to the new array. Stack<T>::moveObjects( stack, oldStack, numElements ); // deallocate the old array. util::deallocate( oldStack ); } RIM_INLINE static void callDestructors( T* array, Size number ) { const T* const arrayEnd = array + number; while ( array != arrayEnd ) { array->~T(); array++; } } RIM_INLINE static void copyObjects( T* destination, const T* source, Size number ) { const T* const sourceEnd = source + number; while ( source != sourceEnd ) { new (destination) T(*source); destination++; source++; } } RIM_INLINE static void moveObjects( T* destination, const T* source, Size number ) { const T* const sourceEnd = source + number; while ( source != sourceEnd ) { // copy the object from the source to destination new (destination) T(*source); // call the destructors on the source source->~T(); destination++; source++; } } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Members /// A pointer to the array containing all elements in the stack. T* stack; /// The number of elements in the stack. Size numElements; /// The number of possible elements that the current stack array could hold. Size capacity; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Static Data Members /// The default initial capacity of a stack. /** * This value is used whenever the creator of the stack does * not specify the initial capacity of the stack. */ static const Size DEFAULT_INITIAL_CAPACITY = 8; }; //########################################################################################## //*************************** End Rim Framework Namespace ******************************** RIM_UTILITIES_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_STACK_H <file_sep>/* * rimGUIConfig.h * Rim Application * * Created by <NAME> on 10/28/08. * Copyright 2008 __MyCompanyName__. All rights reserved. * */ #ifndef INCLUDE_RIM_GUI_CONFIG_H #define INCLUDE_RIM_GUI_CONFIG_H #include "rim/rimFramework.h" #include "rim/rimImages.h" //########################################################################################## //########################################################################################## //############ //############ Library Namespace Configuration //############ //########################################################################################## //########################################################################################## #ifndef RIM_GUI_NAMESPACE #define RIM_GUI_NAMESPACE gui #endif #ifndef RIM_GUI_NAMESPACE_START #define RIM_GUI_NAMESPACE_START RIM_NAMESPACE_START namespace RIM_GUI_NAMESPACE { #endif #ifndef RIM_GUI_NAMESPACE_END #define RIM_GUI_NAMESPACE_END }; RIM_NAMESPACE_END #endif RIM_NAMESPACE_START /// The enclosing namespace for the GUI library. namespace RIM_GUI_NAMESPACE { }; RIM_NAMESPACE_END //########################################################################################## //########################################################################################## //############ //############ Other Library Configuration //############ //########################################################################################## //########################################################################################## // Define the types of user-defined windows events, where 0x8000 corresponds to the value of WM_APP. #if defined(RIM_PLATFORM_WINDOWS) /// Define the windows message number to use for a Window class creation event. #define RIM_WM_WINDOW_WANTS_CREATION (0x8000 + 0x1000) /// Define the windows message number to use for an OpenGLView class creation event. #define RIM_WM_RENDER_VIEW_WANTS_CREATION (0x8000 + 0x1001) /// Define the windows message number to use for a Button class creation event. #define RIM_WM_BUTTON_WANTS_CREATION (0x8000 + 0x1002) /// Define the windows message number to use for a TextField class creation event. #define RIM_WM_TEXT_FIELD_WANTS_CREATION (0x8000 + 0x1003) /// Define the windows message number to use when showing the mouse cursor. #define RIM_WM_SHOW_CURSOR (0x8000 + 0x1004) /// Define the windows message number to use when showing the mouse cursor. #define RIM_WM_HIDE_CURSOR (0x8000 + 0x1005) #endif //########################################################################################## //*************************** Start Rim GUI Namespace ****************************** RIM_GUI_NAMESPACE_START //****************************************************************************************** //########################################################################################## using namespace rim::threads; using rim::math::Vector2i; using rim::math::Vector2f; typedef rim::math::Vector2D<Size> Size2D; using rim::images::Image; //########################################################################################## //*************************** End Rim GUI Namespace ******************************** RIM_GUI_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_GUI_CONFIG_H <file_sep>/* * rimMathPrimitives.h * Rim Math * * Created by <NAME> on 9/3/08. * Copyright 2008 Rim Software. All rights reserved. * */ #ifndef INCLUDE_RIM_MATH_PRIMITIVES_H #define INCLUDE_RIM_MATH_PRIMITIVES_H #include "rimMathConfig.h" #include "rimVector2D.h" #include "rimVector3D.h" //########################################################################################## //***************************** Start Rim Math Namespace ********************************* RIM_MATH_NAMESPACE_START //****************************************************************************************** //########################################################################################## //########################################################################################## //########################################################################################## //############ //############ Edge Class //############ //########################################################################################## //########################################################################################## template < typename VertexType > class Edge { public: RIM_INLINE Edge() { } RIM_INLINE Edge( const VertexType& newV1, const VertexType& newV2 ) : v1( newV1 ), v2( newV2 ) { } VertexType v1; VertexType v2; }; //########################################################################################## //########################################################################################## //############ //############ Triangle Class //############ //########################################################################################## //########################################################################################## template < typename VertexType > class Triangle { public: RIM_INLINE Triangle() { } RIM_INLINE Triangle( const VertexType& newV1, const VertexType& newV2, const VertexType& newV3 ) : v1( newV1 ), v2( newV2 ), v3( newV3 ) { } VertexType v1; VertexType v2; VertexType v3; }; //########################################################################################## //########################################################################################## //############ //############ Sphere Class //############ //########################################################################################## //########################################################################################## template < typename T > class Sphere3D { public: RIM_INLINE Sphere3D() : radius( 0 ) { } RIM_INLINE Sphere3D( T newRadius ) : radius( newRadius ) { } RIM_INLINE Sphere3D( const Vector3D<T>& newPosition, T newRadius ) : position( newPosition ), radius( newRadius ) { } Vector3D<T> position; T radius; }; //########################################################################################## //########################################################################################## //############ //############ Sphere Class //############ //########################################################################################## //########################################################################################## template < typename T > class Circle2D { public: RIM_INLINE Circle2D() : radius( 0 ) { } RIM_INLINE Circle2D( T newRadius ) : radius( newRadius ) { } RIM_INLINE Circle2D( const Vector2D<T>& newPosition, T newRadius ) : position( newPosition ), radius( newRadius ) { } RIM_INLINE bool intersects( const Circle2D<T>& circle ) const { register T distanceSquared = position.getDistanceToSquared( circle.position ); register T radii = radius + circle.radius; return distanceSquared < radii*radii; } Vector2D<T> position; T radius; }; //########################################################################################## //***************************** End Rim Math Namespace *********************************** RIM_MATH_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_MATH_PRIMITIVES_H <file_sep>/* * rimGraphicsOpenGLShader.h * Rim Graphics * * Created by <NAME> on 3/2/13. * Copyright 2013 __MyCompanyName__. All rights reserved. * */ #ifndef INCLUDE_RIM_GRAPHICS_OPENGL_SHADER_H #define INCLUDE_RIM_GRAPHICS_OPENGL_SHADER_H #include "rimGraphicsOpenGLConfig.h" //########################################################################################## //******************** Start Rim Graphics Devices OpenGL Namespace *********************** RIM_GRAPHICS_DEVICES_OPENGL_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class which represents an OpenGL hardware-executed shader program. class OpenGLShader : public Shader { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Destructor /// Destroy this shader and release all resources associated with it. virtual ~OpenGLShader(); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Source Code Accessor Methods /// Get the source code used by this shader. virtual const ShaderSourceString& getSourceCode() const; /// Set the source code used by the shader. virtual Bool setSourceCode( const ShaderSourceString& newSource, const ShaderLanguage& language = ShaderLanguage::DEFAULT ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** OpenGLShader Compile Method /// Compile the shader's source code and return whether or not the operation was successful. virtual Bool compile(); /// Compile the shader's source code and return whether or not the operation was successful. virtual Bool compile( String& compilationLog ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Compilation Status Accessor Method /// Return whether or not this shader has been compiled. virtual Bool isCompiled() const; /// Return whether or not the shader was successfully compiled. virtual Bool isValid() const; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** OpenGL ID Accessor Method /// Get a unique integral identifier of this shader for OpenGL. RIM_INLINE OpenGLID getID() const { return shaderID; } private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Friend Declaration /// Make the shader program class a friend so that it can create instances of this class. friend class OpenGLContext; /// Make the shader program class a friend so that it can access the shader ID of this shader. friend class OpenGLShaderProgram; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Protected Constructors /// Create a new shader for the specified context with no preprocessor symbols defined. OpenGLShader( const GraphicsContext* context, ShaderType shaderType, const ShaderSourceString& newSource, const ShaderLanguage& newLanguage ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Helper Methods /// Submit the current shader source code to OpenGL. void submitSourceCode(); /// Convert the specified shader type enum to an OpenGL shader type enum value. RIM_INLINE static Bool getGLShaderType( ShaderType shaderType, OpenGLEnum& glOpenGLShaderType ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Members /// An integer which uniquely identifies this shader within OpenGL. OpenGLID shaderID; /// A string representing the complete source code of the shader. ShaderSourceString sourceCode; /// A boolean value indicating whether or not this shader has been compiled. Bool compiled; /// A boolean value which indicates whether or not this shader was created successfully. Bool valid; }; //########################################################################################## //******************** End Rim Graphics Devices OpenGL Namespace ************************* RIM_GRAPHICS_DEVICES_OPENGL_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_GRAPHICS_OPENGL_SHADER_H <file_sep>/* * rimGraphicsLight.h * Rim Graphics * * Created by <NAME> on 9/17/09. * Copyright 2009 Rim Software. All rights reserved. * */ #ifndef INCLUDE_RIM_GRAPHICS_LIGHT_H #define INCLUDE_RIM_GRAPHICS_LIGHT_H #include "rimGraphicsLightsConfig.h" #include "rimGraphicsLightType.h" #include "rimGraphicsLightFlags.h" //########################################################################################## //************************ Start Rim Graphics Lights Namespace *************************** RIM_GRAPHICS_LIGHTS_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class which represents a source of light in a scene. class Light { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Destructor /// Destroy a light object. RIM_INLINE virtual ~Light() { } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Light Type Accessor Method /// Return an object representing the type of this light. /** * This value can be used to efficiently determine the derived class of this * light object. */ RIM_INLINE LightType getType() const { return type; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Intensity Accessor Methods /// Get the intensity of the light source. RIM_INLINE Real getIntensity() const { return intensity; } /// Set the intensity of the light source. RIM_INLINE void setIntensity( Real newIntensity ) { intensity = math::max( newIntensity, Real(0) ); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Ambient Contribution Accessor Methods /// Get the ambient contribution of the light source. RIM_INLINE Real getAmbientContribution() const { return ambient; } /// Set the ambient contribution of the light source. RIM_INLINE void setAmbientContribution( Real newAmbient ) { ambient = math::max( newAmbient, Real(0) ); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Color Accessor Methods /// Get the color of the light source. RIM_INLINE const Color3f& getColor() const { return color; } /// Set the color of the light source. RIM_INLINE void setColor( const Color3f& newColor ) { color = newColor; } /// Get the color of the light source scaled by the light source's intensity. RIM_INLINE Color3f getScaledColor() const { return color*intensity; } /// Get the ambient color of the light source scaled by the source's intensity and ambient contribution. RIM_INLINE Color3f getAmbientColor() const { return color*ambient*intensity; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Shadow Casting Accessor Methods /// Return whether or not this light can produce shadows. RIM_INLINE Bool getShadowsEnabled() const { return flags.isSet( LightFlags::SHADOWS_ENABLED ); } /// Set whether or not this light can produce shadows. RIM_INLINE void setShadowsEnabled( Bool newCanCastShadows ) { flags.set( LightFlags::SHADOWS_ENABLED, newCanCastShadows ); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Flags Accessor Methods /// Return a reference to an object which contains boolean parameters of the light. RIM_INLINE LightFlags& getFlags() { return flags; } /// Return an object which contains boolean parameters of the light. RIM_INLINE const LightFlags& getFlags() const { return flags; } /// Set an object which contains boolean parameters of the light. RIM_INLINE void setFlags( const LightFlags& newFlags ) { flags = newFlags; } /// Return whether or not the specified boolan flag is set for this light. RIM_INLINE Bool flagIsSet( LightFlags::Flag flag ) const { return flags.isSet( flag ); } /// Set whether or not the specified boolan flag is set for this light. RIM_INLINE void setFlag( LightFlags::Flag flag, Bool newIsSet = true ) { flags.set( flag, newIsSet ); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Name Accessor Methods /// Return the name of the light. RIM_INLINE const String& getName() const { return name; } /// Set the name of the light. RIM_INLINE void setName( const String& newName ) { name = newName; } protected: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructors /// Create a default white light with intensity of 1 and no ambient component. RIM_INLINE Light( LightType newType ) : type( newType ), color( Color3f::WHITE ), intensity( 1 ), ambient( 0 ), flags( DEFAULT_LIGHT_FLAGS ) { } /// Create a light with the specified color and an intensity of 1 and no ambient component. RIM_INLINE Light( LightType newType, const Color3f& newColor ) : type( newType ), color( newColor ), intensity( 1 ), ambient( 0 ), flags( DEFAULT_LIGHT_FLAGS ) { } /// Create a light with the specified color, intensity, and ambient component. RIM_INLINE Light( LightType newType, const Color3f& newColor, Real newIntensity, Real newAmbient ) : type( newType ), color( newColor ), intensity( math::max( newIntensity, Real(0) ) ), ambient( math::max( newAmbient, Real(0) ) ), flags( DEFAULT_LIGHT_FLAGS ) { } private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Static Data Members /// The bitwise-or of the default LightFlags for a light. static const UInt32 DEFAULT_LIGHT_FLAGS = LightFlags::SHADOWS_ENABLED; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Members /// An object representing the type of this light. LightType type; /// The 3-component (RGB) color of the light. Color3f color; /// The brightness of the light. This is used to compensate for attenuation. /** * Valid values are in the range of [0,infinity]. */ Real intensity; /// The ambient intensity of the light. /** * This is multiplied with the light's intensity to get the final ambient brightness. * Values will typically range from 0 to 1, depending on the ambient illumination of the scene. */ Real ambient; /// An object that contains boolean flags for this light. LightFlags flags; /// A name string for this light. String name; }; //########################################################################################## //************************ End Rim Graphics Lights Namespace ***************************** RIM_GRAPHICS_LIGHTS_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_GRAPHICS_LIGHT_H <file_sep>/* * rimGraphicsGenericMaterialTechnique.h * Rim Graphics * * Created by <NAME> on 9/25/13. * Copyright 2013 __MyCompanyName__. All rights reserved. * */ #ifndef INCLUDE_RIM_GRAPHICS_GENERIC_MATERIAL_TECHNIQUE_H #define INCLUDE_RIM_GRAPHICS_GENERIC_MATERIAL_TECHNIQUE_H #include "rimGraphicsMaterialsConfig.h" #include "rimGraphicsMaterialTechniqueUsage.h" //########################################################################################## //********************** Start Rim Graphics Materials Namespace ************************** RIM_GRAPHICS_MATERIALS_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class which represents a kind of visual effect that uses an ordered series of shader passes. /** * A material technique contains an ordered list of shader passes which indicate * the different passes that are part of rendering a particular visual effect. * These passes are performed in series during rendering in the order stored in the * technique. * * A material technique may be simply a different visual style (shiny or not shiny) * or a totally different rendering technique (standard versus shadow map rendering). */ class GenericMaterialTechnique { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructors /// Create a new generic material technique with no shader passes. GenericMaterialTechnique(); /// Create a new generic material technique with no shader passes and the specified usage. GenericMaterialTechnique( const MaterialTechniqueUsage& newUsgae ); /// Create a new generic material technique with no shader passes and the specified usage and name. GenericMaterialTechnique( const MaterialTechniqueUsage& newUsgae, const String& newName ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Name Accessor Methods /// Return the name of the material technique. RIM_INLINE const String& getName() const { return name; } /// Set the name of the material technique. RIM_INLINE void setName( const String& newName ) { name = newName; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Usage Accessor Methods /// Return an enum value indicating the semantic usage of this material technique. RIM_INLINE const MaterialTechniqueUsage& getUsage() const { return usage; } /// Set an enum value indicating the semantic usage of this material technique. RIM_INLINE void setUsage( const MaterialTechniqueUsage& newUsage ) { usage = newUsage; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Shader Pass Accessor Methods /// Return the number of shader passes that are part of this generic material technique. RIM_INLINE Size getPassCount() const { return passes.getSize(); } /// Return a pointer to the shader pass at the specified index in this generic material technique. RIM_INLINE const Pointer<GenericShaderPass>& getPass( Index index ) const { return passes.get( index ); } /// Add the specified shader pass to the end of this generic material technique's list of passes. /** * If the pointer to the pass is NULL, the method fails and FALSE is returned. * Otherise, the shader pass is added and TRUE is returned. */ Bool addPass( const Pointer<GenericShaderPass>& newPass ); /// Insert the specified shader pass at the given position in this generic material technique's list of passes. /** * If the pointer to the pass is NULL, the method fails and FALSE is returned. * Otherise, the shader pass is inserted and TRUE is returned. */ Bool insertPass( Index index, const Pointer<GenericShaderPass>& newPass ); /// Replace the shader pass at the specified index in this generic material technique. /** * If the pointer to the pass is NULL, the method fails and FALSE is returned. * Otherise, the shader pass is replaced and TRUE is returned. */ Bool setPass( Index index, const Pointer<GenericShaderPass>& newPass ); /// Remove the shader pass at the specified index in this generic material technique. /** * This method shifts all shader passes after the removed one back one index * in the shader pass list. */ void removePass( Index index ); /// Remove all shader passes from this generic material technique. void clearPasses(); private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Members /// A list of the different shader passes that are used when rendering this technique. ArrayList< Pointer<GenericShaderPass> > passes; /// An enum value indicating the semantic usage of this material technique. MaterialTechniqueUsage usage; /// A pointer to a string representing the name of this material technique. String name; }; //########################################################################################## //********************** End Rim Graphics Materials Namespace **************************** RIM_GRAPHICS_MATERIALS_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_GRAPHICS_GENERIC_MATERIAL_TECHNIQUE_H <file_sep>/* * rimSoundSampler.h * Rim Sound * * Created by <NAME> on 12/9/12. * Copyright 2012 __MyCompanyName__. All rights reserved. * */ #ifndef INCLUDE_RIM_SOUND_SAMPLER_H #define INCLUDE_RIM_SOUND_SAMPLER_H #include "rimSoundFiltersConfig.h" #include "rimSoundFilter.h" #include "rimSoundSampleRateConverter.h" //########################################################################################## //************************ Start Rim Sound Filters Namespace ***************************** RIM_SOUND_FILTERS_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class that allows the user to trigger multiple sound stream to be played. /** * These triggered streams are then played back using the provided parameters * and mixed together at the output of the sampler. The streams are automatically * mapped to the output channel layout and sample rate converted to the output * sample rate if necessary. */ class Sampler : public SoundFilter, public SoundInputStream { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructors /// Create a new sampler which has no streams currently playing and the default maximum number of streams. /** * The sampler has the default stereo output channel layout and output sample rate of * 44100 kHz. */ Sampler(); /// Create a new sampler which has no streams currently playing and the specified attributes. /** * This constructor allows the user to specify the output channel layout for the sampler, * the output sample rate, and the maximum number of simultaneously playing streams. * * If the specified sample rate is less than or equal to zero, the default sample rate of * 44100 kHz is used instead. */ Sampler( const ChannelLayout& newOutputChannelLayout, SampleRate newSampleRate = SampleRate(44100), Size newMaxSimultaneousStreams = Size(100) ); /// Create a copy of the specified sampler with all stream playback state exactly the same. Sampler( const Sampler& other ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Destructor /// Destroy this sampler and any associated resources. ~Sampler(); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Assignment Operator /// Assign the entire state of another sampler to this one, including stream playback state. Sampler& operator = ( const Sampler& other ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Stream Count Limit Accessor Methods /// Return the maximum number of simultaneous streams that this sampler is allowed to play. /** * If an attempt is made to play a stream using a sampler that is at its maximum capacity will * cause the sampler to replace the previously playing stream with the lowest priority * and/or the oldest age. */ RIM_INLINE Size getMaximumNumberOfStreams() const { return maxSimultaneousStreams; } /// Set the maximum number of simultaneous streams that this sampler is allowed to play. /** * If an attempt is made to play a stream using a sampler that is at its maximum capacity will * cause the sampler to replace the previously playing stream with the lowest priority * and/or the oldest age. */ RIM_INLINE void setMaximumNumberOfStreams( Size newMaxNumberOfStreams ) { maxSimultaneousStreams = newMaxNumberOfStreams; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Stream Accessor Methods /// Return the total number of streams that are currently playing in this sampler. RIM_INLINE Size getStreamCount() const { return numPlayingStreams; } /// Play a sound stream with the specified parameters. /** * This method attempts to play the specified stream if the stream * pointer is not NULL. If the maximum number of simultaneously playing streams * is already playing, the new stream replaces the stream with the smallest * priority which is already playing. If no stream has a smaller priority, * the new stream is ignored. * * The method returns 0 if playing the stream failed, otherwise, the returned * integer indicates an ID for the newly playing stream which can be used to modify * its parameters during playback. */ Index playStream( const Pointer<SoundInputStream>& newStream, Bool loop = false, Int priority = 1, Gain gain = Gain(1.0), const PanDirection& pan = PanDirection(), SoundFilter* insert = NULL ); /// Stop playing and remove the stream with the specified ID from this sampler. Bool removeStream( Index streamID ); /// Stop playing and remove the stream with the specified stream pointer from this sampler. Bool removeStream( const SoundInputStream* stream ); /// Remove and stop playing all currently playing streams from this sampler. void clearStreams(); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Stream Playback State Accessor Methods /// Return whether or not the stream with the specified ID is currently playing. /** * If TRUE is returned, the stream with that ID is playing. If FALSE is returned * the stream must be paused. The method returns FALSE if an invalid stream ID * is specified. */ RIM_INLINE Bool getStreamIsPlaying( Index streamID ) const { Index streamIndex = streamID - 1; if ( streamIndex < streams.getSize() && !streams[streamIndex].stream.isNull() ) return streams[streamIndex].playingEnabled; else return false; } /// Set whether or not the stream with the specified ID is currently playing. /** * If the new playback state is FALSE, not playing, the stream with that ID * is paused but kept active until it is played again. Any paused stream will * still be counted as a playing stream, so it is important to either restart * or remove any streams that shouldn't be a part of the sampler anymore because * they will not be removed automatically. */ RIM_INLINE void setStreamIsPlaying( Index streamID, Bool newIsPlaying ) { Index streamIndex = streamID - 1; lockMutex(); if ( streamIndex < streams.getSize() && !streams[streamIndex].stream.isNull() ) streams[streamIndex].playingEnabled = newIsPlaying; unlockMutex(); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Stream Looping State Accessor Methods /// Return whether or not the stream with the specified ID is currently playing. /** * If TRUE is returned, the stream with that ID is looping. If FALSE is returned * the stream does not loop. The method returns FALSE if an invalid stream ID * is specified. */ RIM_INLINE Bool getStreamIsLooping( Index streamID ) const { Index streamIndex = streamID - 1; if ( streamIndex < streams.getSize() && !streams[streamIndex].stream.isNull() ) return streams[streamIndex].loopingEnabled; else return false; } /// Set whether or not the stream with the specified ID is currently looping. /** * If the new looping state is FALSE, not looping, the stream with that ID * will continue to play until its end is reached, where it will be removed * from the sampler. If the new looping state is TRUE, the stream will continue * to play and loop until it is paused or removed from the sampler. */ RIM_INLINE void setStreamIsLooping( Index streamID, Bool newIsLooping ) { Index streamIndex = streamID - 1; lockMutex(); if ( streamIndex < streams.getSize() && !streams[streamIndex].stream.isNull() ) streams[streamIndex].loopingEnabled = newIsLooping && streams[streamIndex].stream->canSeek(); unlockMutex(); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Stream Priority Accessor Methods /// Return an integer representing the priority of the stream with the specified ID. /** * This number controls what happens when the sampler's maximum number of simultaneous * streams is reached. Streams with a larger priority cannot be replaced by streams * with a smaller priority, and the sampler always replaces the stream with the lowest * priority first. If an invalid stream ID is specified, the priority 0 is returned. */ RIM_INLINE Int getStreamPriority( Index streamID ) const { Index streamIndex = streamID - 1; if ( streamIndex < streams.getSize() && !streams[streamIndex].stream.isNull() ) return streams[streamIndex].priority; else return 0; } /// Set the priority of the stream with the specified ID. /** * This number controls what happens when the sampler's maximum number of simultaneous * streams is reached. Streams with a larger priority cannot be replaced by streams * with a smaller priority, and the sampler always replaces the stream with the lowest * priority first. */ RIM_INLINE void setStreamPriority( Index streamID, Bool newPriority ) { Index streamIndex = streamID - 1; lockMutex(); if ( streamIndex < streams.getSize() && !streams[streamIndex].stream.isNull() ) streams[streamIndex].priority = newPriority; unlockMutex(); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Stream Gain Accessor Methods /// Return the linear gain applied to the stream with the specified ID. /** * If the specified ID is invalid, a gain of 1 is returned. */ RIM_INLINE Gain getStreamGain( Index streamID ) const { Index streamIndex = streamID - 1; if ( streamIndex < streams.getSize() && !streams[streamIndex].stream.isNull() ) return streams[streamIndex].targetGain; else return Gain(1.0); } /// Set the linear gain applied to the stream with the specified ID. /** * If the specified ID is invalid, the method has no effect. */ RIM_INLINE void setStreamGain( Index streamID, Gain newGain ) { Index streamIndex = streamID - 1; lockMutex(); if ( streamIndex < streams.getSize() && !streams[streamIndex].stream.isNull() ) streams[streamIndex].targetGain = newGain; unlockMutex(); } /// Return the gain in decibels applied to the stream with the specified ID. /** * If the specified ID is invalid, a gain of 0 dB is returned. */ RIM_INLINE Gain getStreamGainDB( Index streamID ) const { Index streamIndex = streamID - 1; if ( streamIndex < streams.getSize() && !streams[streamIndex].stream.isNull() ) return util::linearToDB( streams[streamIndex].targetGain ); else return Gain(0); } /// Set the gain in decibels applied to the stream with the specified ID. /** * If the specified ID is invalid, the method has no effect. */ RIM_INLINE void setStreamGainDB( Index streamID, Gain newDBGain ) { Index streamIndex = streamID - 1; lockMutex(); if ( streamIndex < streams.getSize() && !streams[streamIndex].stream.isNull() ) streams[streamIndex].targetGain = util::dbToLinear( newDBGain ); unlockMutex(); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Stream Pan Accessor Methods /// Return the panning direction for the stream with the specified ID. /** * This direction pans the stream within the output buffer's channel layout * in order to localize the stream in the stereo (or surround) field. * * If the specified ID is invalid, the default forward panning direction is returned. */ RIM_INLINE const PanDirection& getStreamPan( Index streamID ) const { Index streamIndex = streamID - 1; if ( streamIndex < streams.getSize() && !streams[streamIndex].stream.isNull() ) return streams[streamIndex].pan; else return UNDEFINED_STREAM_PAN; } /// Set the panning direction for the stream with the specified ID. /** * This direction pans the stream within the output buffer's channel layout * in order to localize the stream in the stereo (or surround) field. * * If the specified ID is invalid, the method has no effect. */ RIM_INLINE void setStreamPan( Index streamID, const PanDirection& newPan ) { Index streamIndex = streamID - 1; lockMutex(); if ( streamIndex < streams.getSize() && !streams[streamIndex].stream.isNull() ) streams[streamIndex].pan = newPan; unlockMutex(); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Stream Insert Accessor Methods /// Return a pointer to the filter insert for the stream with the specified ID. /** * This filter (if not NULL) is used to affect the stream's sound before it is * panned within the sampler's output channel layout and mixed to the output buffer * with any applied gain. This allows the user to individually affect each stream's * sound. * * If the specified ID is invalid, NULL is returned. */ RIM_INLINE SoundFilter* getStreamInsert( Index streamID ) const { Index streamIndex = streamID - 1; if ( streamIndex < streams.getSize() && !streams[streamIndex].stream.isNull() ) return streams[streamIndex].insert; else return NULL; } /// Set a pointer to the filter insert for the stream with the specified ID. /** * This filter (if not NULL) is used to affect the stream's sound before it is * panned within the sampler's output channel layout and mixed to the output buffer * with any applied gain. This allows the user to individually affect each stream's * sound. * * If the specified ID is invalid, the method has no effect. */ RIM_INLINE void setStreamInsert( Index streamID, SoundFilter* newInsert ) { Index streamIndex = streamID - 1; lockMutex(); if ( streamIndex < streams.getSize() && !streams[streamIndex].stream.isNull() ) streams[streamIndex].insert = newInsert; unlockMutex(); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Output Channel Layout Accessor Methods /// Return a reference to an object which describes the output channel format for this sampler. RIM_INLINE const ChannelLayout& getOutputChannelLayout() const { return outputChannelLayout; } /// Change the output channel format for this sampler. void setOutputChannelLayout( const ChannelLayout& newChannelLayout ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Output Sample Rate Accessor Methods /// Return the output sample rate for this sampler. /** * The default sample rate is 44100 kHz. */ RIM_INLINE SampleRate getOutputSampleRate() const { return outputSampleRate; } /// Set the output sample rate for this sampler. /** * If the new sample rate is less than or equal to 0, the method * fails and has no effect. * The default sample rate is 44100 kHz. */ void setOutputSampleRate( SampleRate newSampleRate ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Public Seek Status Accessor Methods /// Return whether or not seeking is allowed in this input stream. virtual Bool canSeek() const; /// Return whether or not this input stream's current position can be moved by the specified signed sample offset. virtual Bool canSeek( Int64 relativeSampleOffset ) const; /// Move the current sample frame position in the stream by the specified signed amount. virtual Int64 seek( Int64 relativeSampleOffset ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Stream Size Accessor Methods /// Return the number of samples remaining in the sound input stream. /** * The value returned must only be a lower bound on the total number of sample * frames in the stream. For instance, if there are samples remaining, the method * should return at least 1. If there are no samples remaining, the method should * return 0. This behavior is allowed in order to support never-ending streams * which might not have a defined endpoint. */ virtual SoundSize getSamplesRemaining() const; /// Return the current position of the stream in samples relative to the start of the stream. /** * The returned value indicates the sample index of the current read * position within the sound stream. For unbounded streams, this indicates * the number of samples that have been read by the stream since it was opened. */ virtual SampleIndex getPosition() const; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Stream Format Accessor Methods /// Return the number of channels that are in the sound input stream. virtual Size getChannelCount() const; /// Return the sample rate of the sound input stream's source audio data. virtual SampleRate getSampleRate() const; /// Return the actual sample type used in the stream. virtual SampleType getNativeSampleType() const; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Stream Status Accessor Method /// Return whether or not the stream has a valid source of sound data. virtual Bool isValid() const; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Filter Attribute Accessor Methods /// Return a human-readable name for this sampler. /** * The method returns the string "Sampler". */ virtual UTF8String getName() const; /// Return the manufacturer name of this sampler. /** * The method returns the string "Headspace Sound". */ virtual UTF8String getManufacturer() const; /// Return an object representing the version of this sampler. virtual SoundFilterVersion getVersion() const; /// Return an object which describes the category of effect that this filter implements. /** * This method returns the value SoundFilterCategory::PLAYBACK. */ virtual SoundFilterCategory getCategory() const; /// Return whether or not this sampler can process audio data in-place. /** * This method always returns TRUE, sampler can process audio data in-place. */ virtual Bool allowsInPlaceProcessing() const; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Public Static Property Objects /// A string indicating the human-readable name of this sampler. static const UTF8String NAME; /// A string indicating the manufacturer name of this sampler. static const UTF8String MANUFACTURER; /// An object indicating the version of this sampler. static const SoundFilterVersion VERSION; private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Class Declaration /// A class which holds information about a currently queued sound stream. class StreamInfo { public: /// Create a new playback stream information object with the specified stream and playback state. RIM_INLINE StreamInfo( const Pointer<SoundInputStream>& newStream, Bool loop, Int newPriority, Gain newGain, const PanDirection& newPan, SoundFilter* newInsert ) : stream( newStream ), priority( newPriority ), gain( newGain ), targetGain( newGain ), pan( newPan ), insert( newInsert ), sampleRateConverter( NULL ), currentStreamPosition( 0 ), playingEnabled( true ), loopingEnabled( loop ) { } /// A sound stream which provides the audio for this playback slot. Pointer<SoundInputStream> stream; /// An integer representing the priority of this stream. Int priority; /// A linear gain factor which is applied to the stream's audio during playback. Gain gain; /// The target linear gain factor which is used to interpolate changes in the playback gain. Gain targetGain; /// An object representing how this stream should be panned in the output channel configuration. PanDirection pan; /// An optionally NULL pointer to a filter which is inserted on this stream's output (pre gain and pan). SoundFilter* insert; /// A pointer to an object (sometimes NULL) which handles sample rate conversion for this stream. SampleRateConverter* sampleRateConverter; /// A mix matrix which stores the current channel mix matrix of the stream panning. ChannelMixMatrix channelGains; /// A mix matrix which stores the target channel mix matrix of the stream panning. ChannelMixMatrix targetChannelGains; /// The current position within the stream, relative to the stream's starting position. SampleIndex currentStreamPosition; /// A boolean value indicating whether or not the sampler should be playing the stream. Bool playingEnabled; /// A boolean value indicating whether or not the sampler should be looping the stream. Bool loopingEnabled; }; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Filter Processing Methods /// Play the specified number of samples from the sound input stream and place them in the output frame. virtual SoundFilterResult processFrame( const SoundFilterFrame& inputFrame, SoundFilterFrame& outputFrame, Size numSamples ); /// Read the specified number of samples from the input stream into the output buffer. virtual Size readSamples( SoundBuffer& outputBuffer, Size numSamples ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Static Data Members /// The default maximum number of simultaneously playing streams. static const Size DEFAULT_MAX_NUMBER_OF_STREAMS = 100; /// An object representing the pan direction of an invalid stream. static const PanDirection UNDEFINED_STREAM_PAN; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Members /// A list of all of the slots for streams that can play as part of this sampler. ArrayList<StreamInfo> streams; /// An object describing the output channel layout for this sampler. ChannelLayout outputChannelLayout; /// The output sample rate for this sampler. SampleRate outputSampleRate; /// The total number of streams in the sampler which are currently playing. Size numPlayingStreams; /// An integer representing the maximum number of simultaneously playing streams. Size maxSimultaneousStreams; /// A boolean value indicating whether or not the sampler should be playing any stream. Bool globalPlayingEnabled; }; //########################################################################################## //************************ End Rim Sound Filters Namespace ******************************* RIM_SOUND_FILTERS_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_SOUND_SAMPLER_H <file_sep>/* * rimGraphicsGUIMargin.h * Rim Graphics GUI * * Created by <NAME> on 1/29/13. * Copyright 2013 Headspace Systems. All rights reserved. * */ #ifndef INCLUDE_RIM_GRAPHICS_GUI_MARGIN_H #define INCLUDE_RIM_GRAPHICS_GUI_MARGIN_H #include "rimGraphicsGUIUtilitiesConfig.h" //########################################################################################## //******************* Start Rim Graphics GUI Utilities Namespace ************************* RIM_GRAPHICS_GUI_UTILITIES_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class which represents a 4-sided margin for a rectangular GUI object. /** * Each side of the rectangle can have a different margin width. */ class Margin { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructors /// Create a new default margin object which has a width on all sides of 0. RIM_INLINE Margin() : left( 0 ), right( 0 ), bottom( 0 ), top( 0 ) { } /// Create a new margin object using the specified margin size for all sides. RIM_INLINE Margin( Float newMargin ) : left( newMargin ), right( newMargin ), bottom( newMargin ), top( newMargin ) { } /// Create a new margin object using the specified sizes for each rectangular side. RIM_INLINE Margin( Float newLeft, Float newRight, Float newBottom, Float newTop ) : left( newLeft ), right( newRight ), bottom( newBottom ), top( newTop ) { } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Margin Size Accessor Method /// Set all of the sides for this margin to have the specified size. RIM_INLINE void setSize( Float newSize ) { left = right = bottom = top = newSize; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Content Bounds Accessor Method /// Return the bounding box for the specified area if this margin is applied inwardly. /** * This method shrinks the specified bounding box by the margin and returns * the resulting bounding box. */ RIM_INLINE AABB2f getInnerBounds( const AABB2f& bounds ) const { return AABB2f( bounds.min.x + left, bounds.max.x - right, bounds.min.y + bottom, bounds.max.y - top ); } /// Return the bounding box for the specified area if this margin is applied externally. /** * This method grows the specified bounding box by the margin and returns * the resulting bounding box. */ RIM_INLINE AABB2f getOuterBounds( const AABB2f& bounds ) const { return AABB2f( bounds.min.x - left, bounds.max.x + right, bounds.min.y - bottom, bounds.max.y + top ); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Margin Arithmetic Operators /// Scale this margin on all sides by the specified value and return the result. RIM_INLINE Margin operator * ( Float scale ) const { return Margin( left*scale, right*scale, bottom*scale, top*scale ); } /// Scale this margin on all sides by the specified vector scaling and return the result. RIM_INLINE Margin operator * ( const Vector2f& scale ) const { return Margin( left*scale.x, right*scale.x, bottom*scale.y, top*scale.y ); } /// Scale this margin on all sides by the specified value and store the result. RIM_INLINE Margin& operator *= ( Float scale ) { left *= scale; right *= scale; bottom *= scale; top *= scale; return *this; } /// Scale this margin on all sides by the specified vector scaling and store the result. RIM_INLINE Margin& operator *= ( const Vector2f& scale ) { left *= scale.x; right *= scale.x; bottom *= scale.y; top *= scale.y; return *this; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Public Data Members /// The size of the left-side margin, in vertical screen coordinates. Float left; /// The size of the right-side margin, in vertical screen coordinates. Float right; /// The size of the bottom-side margin, in vertical screen coordinates. Float bottom; /// The size of the top-side margin, in vertical screen coordinates. Float top; }; //########################################################################################## //########################################################################################## //############ //############ Commutative Margin Arithmetic Operators //############ //########################################################################################## //########################################################################################## /// Scale a margin on all sides by the specified value and return the result. RIM_INLINE Margin operator * ( Float scale, const Margin& margin ) { return Margin( margin.left*scale, margin.right*scale, margin.bottom*scale, margin.top*scale ); } /// Scale a margin on all sides by the specified vector scaling and return the result. RIM_INLINE Margin operator * ( const Vector2f& scale, const Margin& margin ) { return Margin( margin.left*scale.x, margin.right*scale.x, margin.bottom*scale.y, margin.top*scale.y ); } //########################################################################################## //******************* End Rim Graphics GUI Utilities Namespace *************************** RIM_GRAPHICS_GUI_UTILITIES_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_GRAPHICS_GUI_MARGIN_H <file_sep>/* * rimGraphicsMeshGroup.h * Rim Graphics * * Created by <NAME> on 9/14/10. * Copyright 2010 Rim Software. All rights reserved. * */ #ifndef INCLUDE_RIM_GRAPHICS_MESH_GROUP_H #define INCLUDE_RIM_GRAPHICS_MESH_GROUP_H #include "rimGraphicsShapesConfig.h" //########################################################################################## //*********************** Start Rim Graphics Shapes Namespace **************************** RIM_GRAPHICS_SHAPES_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class which encapsulates geometry and a material with which it should be rendered. /** * A MeshGroup specifies its geometry relative to the origin of its parent * shape and does not have its own transformation. */ class MeshGroup { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructors /// Create a new mesh group with the specified material and vertex buffer pointers. MeshGroup( const Pointer<VertexBufferList>& newVertexBuffers, const Pointer<IndexBuffer>& newIndexBuffer, const BufferRange& newBufferRange, const Pointer<Material>& newMaterial ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Vertex Buffer List Accessor Methods /// Get the index buffer associated with this mesh group. RIM_INLINE const Pointer<VertexBufferList>& getVertexBuffers() const { return vertexBuffers; } /// Set the index buffer associated with this mesh group. RIM_INLINE void setVertexBuffers( const Pointer<VertexBufferList>& newVertexBuffers ) { vertexBuffers = newVertexBuffers; updateBoundingBox(); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Index Buffer Accessor Methods /// Get the index buffer associated with this mesh group. RIM_INLINE const Pointer<IndexBuffer>& getIndexBuffer() const { return indexBuffer; } /// Set the index buffer associated with this mesh group. RIM_INLINE void setIndexBuffer( const Pointer<IndexBuffer>& newIndexBuffer ) { indexBuffer = newIndexBuffer; updateBoundingBox(); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Buffer Range Accessor Methods /// Return a reference to the buffer range for this mesh group. /** * If the mesh group has an index buffer, the valid range refers to the indices * which should be used when drawing the group. Otherwise, the range refers * to the valid contiguous range of vertices to use. */ RIM_FORCE_INLINE const BufferRange& getBufferRange() const { return bufferRange; } /// Set the buffer range for this mesh group. /** * If the mesh group has an index buffer, the valid range refers to the indices * which should be used when drawing the group. Otherwise, the range refers * to the valid contiguous range of vertices to use. */ RIM_FORCE_INLINE void setBufferRange( const BufferRange& newBufferRange ) { bufferRange = newBufferRange; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Material Accessor Methods /// Return a pointer to the material of this mesh group. RIM_INLINE const Pointer<Material>& getMaterial() const { return material; } /// Set the material of this mesh group. RIM_INLINE void setMaterial( const Pointer<Material>& newMaterial ) { material = newMaterial; updateBoundingBox(); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Bounding Box Accessor Methods /// Return a reference to the bounding box for this mesh group. /** * The bounding box returned here may not represent an accurate bounding volume for the * mesh group if any of the underlying geometry changes without notice. If this * occurs, call the updateBoundingBox() method directly to force an update * of the bounding box. */ RIM_FORCE_INLINE const AABB3& getBoundingBox() const { return boundingBox; } /// Force an update the bounding box for this mesh group. /** * This method is automatically called whenever a mesh group is * first created and anytime the vertex or index buffer of a * group is changed. It is declared publicly so that a user can make * sure that the bounding box matches the geometry (which might be * shared and could changed without notice). */ void updateBoundingBox(); private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Members /// An object representing the axis-aligned bounding box for this mesh group. AABB3 boundingBox; /// A pointer to a list of vertex buffer which contains the vertex data for this mesh group's geometry. Pointer<VertexBufferList> vertexBuffers; /// A pointer to an index buffer which contains the indices for this mesh group's geometry. Pointer<IndexBuffer> indexBuffer; /// A pointer to the material associated with this mesh group. Pointer<Material> material; /// An object which describes the range of vertices or indices to use from the group's buffers. BufferRange bufferRange; }; //########################################################################################## //*********************** End Rim Graphics Shapes Namespace ****************************** RIM_GRAPHICS_SHAPES_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_GRAPHICS_MESH_GROUP_H <file_sep>/* * rimPhysicsPrimitiveIntersectionTests.h * Rim Physics * * Created by <NAME> on 6/7/12. * Copyright 2012 __MyCompanyName__. All rights reserved. * */ #ifndef INCLUDE_RIM_PHYSICS_PRIMITIVE_INTERSECTION_TESTS_H #define INCLUDE_RIM_PHYSICS_PRIMITIVE_INTERSECTION_TESTS_H #include "rimPhysicsUtilitiesConfig.h" #include "rimPhysicsIntersectionPoint.h" //########################################################################################## //********************** Start Rim Physics Utilities Namespace *************************** RIM_PHYSICS_UTILITIES_NAMESPACE_START //****************************************************************************************** //########################################################################################## //########################################################################################## //########################################################################################## //############ //############ Sphere Vs Sphere Intersection Tests //############ //########################################################################################## //########################################################################################## /// Return whether or not the two specified spheres intersect. /** * Each sphere is specified by a 3D position and radius. */ RIM_FORCE_INLINE Bool sphereIntersectsSphere( const Vector3& position1, Real radius1, const Vector3& position2, Real radius2 ) { Real distanceSquared = (position2 - position1).getMagnitudeSquared(); Real radii = radius1 + radius2; return distanceSquared > radii*radii; } /// Return whether or not the two specified spheres intersect and return the point of intersection. /** * Each sphere is specified by a 3D position and radius. If the spheres * intersect, the intersection point on each sphere is computed and returned * in the specified IntersectionPoint object. */ RIM_INLINE Bool sphereIntersectsSphere( const Vector3& position1, Real radius1, const Vector3& position2, Real radius2, IntersectionPoint& intersectionPoint ) { Vector3 normal = position2 - position1; Real distanceSquared = normal.getMagnitudeSquared(); Real radii = radius1 + radius2; if ( distanceSquared > radii*radii ) { Real distance = math::sqrt( distanceSquared ); normal /= distance; intersectionPoint.point1 = position1 + normal*radius1; intersectionPoint.point2 = position2 - normal*radius2; intersectionPoint.normal = normal; intersectionPoint.penetrationDistance = radii - distance; return true; } return false; } //########################################################################################## //########################################################################################## //############ //############ Other Intersection Tests //############ //########################################################################################## //########################################################################################## /// Return whether or not the specified sphere intersects a box and return the collision point. Bool sphereIntersectsBox( const Vector3& spherePosition, Real sphereRadius, const Vector3& boxPosition, const Matrix3& boxOrientation, const Vector3& boxSize, IntersectionPoint& intersectionPoint ); /// Return whether or not the specified sphere intersects a cylinder and return the collision point. Bool sphereIntersectsCylinder( const Vector3& spherePosition, Real sphereRadius, const Vector3& cylinderPoint1, const Vector3& cylinderAxis, Real cylinderHeight, Real cylinderRadius1, Real cylinderRadius2, IntersectionPoint& intersectionPoint ); //########################################################################################## //********************** End Rim Physics Utilities Namespace ***************************** RIM_PHYSICS_UTILITES_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_PHYSICS_PRIMITIVE_INTERSECTION_TESTS_H <file_sep>/* * rimGUIInputMouse.h * Rim GUI * * Created by <NAME> on 2/1/08. * Copyright 2008 __MyCompanyName__. All rights reserved. * */ #ifndef INCLUDE_RIM_GUI_INPUT_MOUSE_H #define INCLUDE_RIM_GUI_INPUT_MOUSE_H #include "rimGUIInputConfig.h" #include "rimGUIInputMouseButton.h" #include "rimGUIInputMouseButtonEvent.h" #include "rimGUIInputMouseMotionEvent.h" #include "rimGUIInputMouseWheelEvent.h" //########################################################################################## //************************ Start Rim GUI Input Namespace *************************** RIM_GUI_INPUT_NAMESPACE_START //****************************************************************************************** //########################################################################################## class Mouse { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Position Accessor Methods /// Return the current position of the global system mouse pointer in screen-space pixels. /** * This value is specified relative to the lower left corner of the main system display. */ static Vector2f getPosition(); /// Move the global system mouse pointer to the specified screen-space position in pixels. /** * This value is specified relative to the lower left corner of the main system display. */ static Bool setPosition( const Vector2f& newPosition ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Visibility State Accessor Methods /// Return whether or not the current global system mouse pointer is visible. static Bool getIsVisible(); /// Set whether or not the current global system mouse pointer is visible. /** * This method attempts to set the global system mouse pointer to be * either visible or hidden based on the specified boolean value. If the * visibility change operation is successful, TRUE is returned. Otherwise, * false is returned and no visiblity is changed. */ static Bool setIsVisible( Bool newIsVisible ); private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Members }; //########################################################################################## //************************ End Rim GUI Input Namespace ***************************** RIM_GUI_INPUT_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_GUI_INPUT_MOUSE_H <file_sep>/* * QuadcopterDemo.cpp * Quadcopter * * Created by <NAME> on 9/10/14. * Additions : <NAME> * Copyright 2014 __MyCompanyName__. All rights reserved. * */ #include "QuadcopterDemo.h" //########################################################################################## //########################################################################################## //############ //############ Constructor //############ //########################################################################################## //########################################################################################## QuadcopterDemo:: QuadcopterDemo() : SimpleDemo( "Quadcopter Demo", Size2D( 1024, 768 ) ), cameraSpeed( 300.0f ), cameraFriction( 0.15f ), cameraPitch( 40.0f ), cameraYaw( 0 ), cameraDistance( 50.0f ), timeStep( 0.5/60.0f ), currentView( 0 ), recording( false ) { } //########################################################################################## //########################################################################################## //############ //############ Initialize Method //############ //########################################################################################## //########################################################################################## Bool QuadcopterDemo:: initialize( const Pointer<GraphicsContext>& context ) { rootPath = Directory::getExecutable(); //******************************************************************************** // Initialize the renderers. sceneRenderer = Pointer<ForwardRenderer>::construct( context ); immediateRenderer = Pointer<ImmediateRenderer>::construct( context ); sceneRenderer->setFlag( SceneRendererFlags::SHADOWS_ENABLED, false ); sceneRenderer->setFlag( SceneRendererFlags::DEBUG_CAMERAS, false ); sceneRenderer->setFlag( SceneRendererFlags::DEBUG_BOUNDING_BOXES, false ); sceneRenderer->setFlag( SceneRendererFlags::DEBUG_OBJECTS, false ); // Initialize the viewport. Pointer<ViewportLayout> viewportLayout = Pointer<ViewportLayout>::construct(); sceneRenderer->setViewportLayout( viewportLayout ); fontDrawer = Pointer<fonts::GraphicsFontDrawer>::construct( context ); fontStyle.setFont( fonts::Font::getDefault() ); fontStyle.setColor( Color4f( 1.0, 1.0, 1.0, 1.0 ) ); fontStyle.setFontSize( 20 ); //******************************************************************************** // Initialize the scene. scene = Pointer<GraphicsScene>::construct(); camera = Pointer<PerspectiveCamera>::construct(); camera->setPosition( Vector3f( 5, 2, 5 ) ); camera->setNearPlaneDistance( 0.5f ); camera->setFarPlaneDistance( 2000.0f ); camera->setHorizontalFieldOfView( 75.0f ); scene->addCamera( camera ); ViewportLayout::CameraView cameraView( camera, scene, Viewport() ); cameraView.clearColor = Color4D<Double>(0.2,0.2,0.2,1); viewportLayout->addCameraView( cameraView ); // Add a light. { Pointer<DirectionalLight> light = Pointer<DirectionalLight>::construct(); light->setColor( Color3f( 1.0f, 1.0f, 1.0f ) ); light->setIntensity( 1.0f ); light->setAmbientContribution( 0.1f ); light->setDirection( Vector3f( -0.5f, -1.0f, -0.5f ).normalize() ); light->setFlag( LightFlags::SHADOWS_ENABLED, true ); scene->addLight( light ); } // Add a sky light. { Pointer<PointLight> light = Pointer<PointLight>::construct(); light->setPosition( Vector3f( 0, 500, 0 ) ); light->setColor( Color3f( 1.0f, 1.0f, 1.0f ) ); light->setIntensity( 50000.0 ); light->setAttenuation( LightAttenuation( 1, 0, 1 ) ); light->setAmbientContribution( 0.0 ); light->setFlag( LightFlags::SHADOWS_ENABLED, false ); scene->addLight( light ); } // Load a mesh for the scene. { Resource<GraphicsShape> mesh = getResourceManager()->getResource<GraphicsShape>( ResourceID( rootPath + "Data/Port City/Port City.obj" ) ); Pointer<GenericMeshShape> genericMesh = mesh.getData().dynamicCast<GenericMeshShape>(); roadmap = Pointer<Roadmap>::construct( genericMesh ); Pointer<MeshShape> shape = getGraphicsConverter()->convertGenericMesh( genericMesh ); Pointer<GraphicsObject> object = Pointer<GraphicsObject>::construct( shape ); object->setPosition( Vector3f( 0, 0, 0 ) ); scene->addObject( object ); } // Load a mesh for the sky. { Resource<GraphicsShape> mesh = getResourceManager()->getResource<GraphicsShape>( ResourceID( rootPath + "Data/Skydome/Skydome.obj" ) ); Pointer<MeshShape> shape = getGraphicsConverter()->convertGenericMesh( mesh.getData().dynamicCast<GenericMeshShape>() ); Pointer<GraphicsObject> object = Pointer<GraphicsObject>::construct( shape ); object->setPosition( Vector3f( 0, 0, 0 ) ); object->setScale( Vector3f( 0.5 ) ); object->setFlag( GraphicsObjectFlags::SHADOWS_ENABLED, false ); scene->addObject( object ); } // Load a mesh for the quadcopter. { Resource<GraphicsShape> mesh = getResourceManager()->getResource<GraphicsShape>( ResourceID( rootPath + "Data/Quadcopter/Quadcopter.obj" ) ); quadcopterMesh = getGraphicsConverter()->convertGenericMesh( mesh.getData().dynamicCast<GenericMeshShape>() ); quadcopterMesh->setScale( 2.0f ); } //******************************************************************************** goal = Vector3f( 0, 20, 0 ); // Create a quadcopter. addQuadcopterToScene( newQuadcopter( Vector3f( 0, 1, 0 ) ) ); return true; } //########################################################################################## //########################################################################################## //############ //############ Deinitialize Method //############ //########################################################################################## //########################################################################################## void QuadcopterDemo:: deinitialize() { sceneRenderer.release(); immediateRenderer.release(); } //########################################################################################## //########################################################################################## //############ //############ Update Method //############ //########################################################################################## //########################################################################################## void QuadcopterDemo:: update( const Time& dt ) { handleInput( dt ); Mouse::setIsVisible( true ); //******************************************************************************** // Update the simulation. Timer timer; // Update the simulation using a fixed time step. simulation.update( timeStep ); simulationTime = timer.getElapsedTime(); //******************************************************************************** // Update the graphics. // Update all of the quadcopter graphical representations with their new positions. for ( Index i = 0; i < quadcopters.getSize(); i++ ) { quadcopters[i]->tracer.add( quadcopters[i]->currentState.position ); quadcopters[i]->updateGraphics(); } // Update the camera's orientation and position. if ( currentView == 0 || currentView - 1 >= quadcopters.getSize() ) { camera->setOrientation( Matrix3f::rotationYDegrees( cameraYaw )*Matrix3f::rotationXDegrees( cameraPitch ) ); camera->setPosition( cameraTarget - camera->getViewDirection()*cameraDistance ); } else { Quadcopter& quadcopter = *quadcopters[currentView - 1]; camera->setOrientation( Matrix3f::rotationYDegrees( cameraYaw )*Matrix3f::rotationXDegrees( cameraPitch ) ); camera->setPosition( quadcopter.currentState.position - camera->getViewDirection()*5.0f ); } scene->update( dt ); } //########################################################################################## //########################################################################################## //############ //############ Input Handle Method //############ //########################################################################################## //########################################################################################## void QuadcopterDemo:: handleInput( const Time& dt ) { const Pointer<Keyboard>& keyboard = getKeyboard(); //******************************************************************************** // Turn the camera. const Float yawSpeed = 120.0f*Float(dt); const Float pitchSpeed = 60.0f*Float(dt); if ( keyboard->keyIsPressed( Key::LEFT_ARROW ) ) cameraYaw -= yawSpeed; if ( keyboard->keyIsPressed( Key::RIGHT_ARROW ) ) cameraYaw += yawSpeed; if ( keyboard->keyIsPressed( Key::UP_ARROW ) ) cameraPitch = math::clamp( cameraPitch - pitchSpeed, -90.0f, 90.0f ); if ( keyboard->keyIsPressed( Key::DOWN_ARROW ) ) cameraPitch = math::clamp( cameraPitch + pitchSpeed, -90.0f, 90.0f ); camera->setOrientation( Matrix3f::rotationYDegrees( cameraYaw )*Matrix3f::rotationXDegrees( cameraPitch ) ); //******************************************************************************** // Move the camera. Vector3f cameraAcceleration = Vector3f::ZERO; if ( keyboard->keyIsPressed( Key::W ) ) cameraAcceleration += camera->getViewDirection()*cameraSpeed; if ( keyboard->keyIsPressed( Key::S ) ) cameraAcceleration -= camera->getViewDirection()*cameraSpeed; if ( keyboard->keyIsPressed( Key::A ) ) cameraAcceleration += camera->getLeftDirection()*cameraSpeed; if ( keyboard->keyIsPressed( Key::D ) ) cameraAcceleration -= camera->getLeftDirection()*cameraSpeed; // Integrate the camera's velocity. cameraVelocity += cameraAcceleration*Float(dt); // Apply camera friction. cameraVelocity *= (Float(1) - cameraFriction); // Integrate the camera's position. cameraTarget += cameraVelocity*Float(dt); } //########################################################################################## //########################################################################################## //############ //############ Key Event Method //############ //########################################################################################## //########################################################################################## void QuadcopterDemo:: keyEvent( const KeyboardEvent& event ) { if ( event.isAPress() ) { if ( event.getKey() == Key::ESCAPE ) this->stop(); if ( event.getKey() == Key::Q ) currentView = (currentView + 1) % (quadcopters.getSize()+1); if ( event.getKey() == Key::R ) recording = !recording; } } //########################################################################################## //########################################################################################## //############ //############ Mouse Button Method //############ //########################################################################################## //########################################################################################## void QuadcopterDemo:: mouseButtonEvent( const MouseButtonEvent& event ) { if ( !event.isAPress() ) return; // Compute the ray direction where the mouse is clicking in 3D space. const Pointer<rim::gui::RenderView>& renderView = getContext()->getTargetView(); Vector2f viewportPosition = 2.0f*(event.getPosition() / renderView->getSize() - 0.5f); // Compute the basis vectors that parameterize the camera's near plane from [-1,1]. Vector3f nearPlaneCenter = camera->getPosition() + camera->getViewDirection()*camera->getNearPlaneDistance(); Float horizontalSlope = math::tan( 0.5f*math::degreesToRadians( camera->getHorizontalFieldOfView() ) ); Float halfNearWidth = camera->getNearPlaneDistance()*horizontalSlope; Float halfNearHeight = halfNearWidth / camera->getAspectRatio(); Vector3f nearX = camera->getRightDirection()*halfNearWidth; Vector3f nearY = camera->getUpDirection()*halfNearHeight; // Compute the position on the near plane. Vector3f nearPosition = nearPlaneCenter + viewportPosition.x*nearX + viewportPosition.y*nearY; // The final ray direction is the vector from the camera's position. Vector3f mouseDirection = (nearPosition - camera->getPosition()).normalize(); // Set the camera target to be the intersection of the mouse ray with the XZ plane. const Float targetY = 15.0f; Float t = (targetY - camera->getPosition().y) / mouseDirection.y; goal = (camera->getPosition() + mouseDirection*t); if ( roadmap->traceRay( camera->getPosition(), mouseDirection, math::max<Float>(), t ) ) { goal = (camera->getPosition() + mouseDirection*t); Vector3f offset = mouseDirection*(-math::min( t, 2.0f )); goal += offset; } if ( goal.y < targetY ) goal.y = targetY; const AABB3f sceneBounds( -300, 300, 0, 50, -500, 300 ); const Size numSceneSamples = 1000; const Size minNumSamples = 100; const Size maxNumSamples = 1000; const Size maxInitialTrys = 10; const Size maxExpandedTrys = 3; // Set the goal for each quadcopter. for ( Index i = 0; i < quadcopters.getSize(); i++ ) { const Vector3f& start = quadcopters[i]->currentState.position; quadcopters[i]->goalpoint = goal; AABB3f startGoalBounds( start ); startGoalBounds.enlargeFor( goal ); const Float samplesPerM3 = 0.001; const Size roadmapSamples = math::clamp( Size(samplesPerM3*startGoalBounds.getVolume()), minNumSamples, maxNumSamples ); Bool foundPath = false; for ( Index j = 0; j < maxInitialTrys; j++ ) { if ( foundPath = generateRoadmap( *quadcopters[i], startGoalBounds, start, goal, roadmapSamples ) ) break; } if ( !foundPath ) { for ( Index j = 0; j < maxExpandedTrys; j++ ) { if ( foundPath = generateRoadmap( *quadcopters[i], sceneBounds, start, goal, numSceneSamples ) ) break; } } quadcopters[i]->nextid = 1; if ( quadcopters[i]->path.size() > 0 ) quadcopters[i]->nextWaypoint = quadcopters[i]->path[quadcopters[i]->nextid]; quadcopters[i]->tracer.clear(); } } Bool QuadcopterDemo:: generateRoadmap( Quadcopter& quadcopter, const AABB3f& bounds, const Vector3f& start, const Vector3f& goal, Size numSamples ) { quadcopter.roadmap->rebuild( bounds, numSamples, start, goal ); Global_planner gplan = Global_planner(); quadcopter.path = gplan.prm( start, goal, quadcopter.roadmap ); return quadcopter.path.size() > 0; } //########################################################################################## //########################################################################################## //############ //############ Mouse Motion Method //############ //########################################################################################## //########################################################################################## void QuadcopterDemo:: mouseMotionEvent( const MouseMotionEvent& event ) { //**************************************************************************** // Turn the camera based on the mouse motion. /* Float fov = camera->getHorizontalFieldOfView(); Float dx = event.getRelativeMotion().x*(90/fov)/10.0f; Float dy = event.getRelativeMotion().y*(90/fov)/10.0f; cameraPitch = math::clamp( cameraPitch - dy, -90.0f, 90.0f ); cameraYaw += dx; */ } //########################################################################################## //########################################################################################## //############ //############ Input Handle Method //############ //########################################################################################## //########################################################################################## void QuadcopterDemo:: draw( const Pointer<GraphicsContext>& context ) { sceneRenderer->render(); immediateRenderer->synchronizeContext(); immediateRenderer->setTransform( camera->getInverseTransformMatrix() ); immediateRenderer->setProjection( camera->getProjectionMatrix() ); //**************************************************************************** // Draw debug information in the scene. immediateRenderer->getRenderMode().setFlag( RenderFlags::BLENDING, true ); // Draw the goal location. immediateRenderer->setPointSize( 10 ); immediateRenderer->begin( IndexedPrimitiveType::POINTS ); immediateRenderer->color( 0.0f, 1.0f, 0.0f ); immediateRenderer->vertex( goal ); immediateRenderer->render(); // Draw quadcopter positions. immediateRenderer->begin( IndexedPrimitiveType::POINTS ); immediateRenderer->color( 1.0f, 0.0f, 0.0f ); for ( Index i = 0; i < quadcopters.getSize(); i++ ) immediateRenderer->vertex( quadcopters[i]->graphics->getPosition() ); immediateRenderer->render(); // Draw the quadcopter thrusters. immediateRenderer->setLineWidth( 1 ); immediateRenderer->begin( IndexedPrimitiveType::LINES ); immediateRenderer->color( 0.0f, 1.0f, 0.0f ); for ( Index i = 0; i < quadcopters.getSize(); i++ ) { const Quadcopter& quadcopter = *quadcopters[i]; for ( Index m = 0; m < quadcopter.motors.getSize(); m++ ) { const Quadcopter::Motor& motor = quadcopter.motors[m]; Vector3f motorPoint = quadcopter.currentState.transformToWorld( motor.comOffset ); Vector3f motorVector = quadcopter.currentState.rotateVectorToWorld( motor.thrustDirection ); immediateRenderer->vertex( motorPoint ); immediateRenderer->vertex( motorPoint - motorVector ); } } immediateRenderer->render(); immediateRenderer->getRenderMode().setFlag( RenderFlags::DEPTH_WRITE, false ); for ( Index q = 0; q < quadcopters.getSize(); q++ ) { drawRoadmap( *quadcopters[q]->roadmap ); } immediateRenderer->getRenderMode().setFlag( RenderFlags::DEPTH_TEST, false ); // Draw the path nodes. immediateRenderer->setPointSize( 5 ); immediateRenderer->color( 0.5f, 0.0f, 0.5f ); immediateRenderer->begin( IndexedPrimitiveType::POINTS ); for (Index q = 0; q < quadcopters.getSize(); q++) { if ( quadcopters[q]->path.size() == 0 ) continue; for ( Index i = 0; i < quadcopters[q]->path.size(); i++ ) { immediateRenderer->vertex( quadcopters[q]->path[i]); } immediateRenderer->render(); // Draw the path connections. immediateRenderer->setLineWidth( 2 ); immediateRenderer->color( 1.0f, 0.0f, 0.0f, 1.0f ); immediateRenderer->begin( IndexedPrimitiveType::LINES ); for ( Index i = 0; i < (quadcopters[q]->path.size()-1); i++ ) { immediateRenderer->vertex( quadcopters[q]->path[i] ); immediateRenderer->vertex( quadcopters[q]->path[i+1] ); } immediateRenderer->render(); // Draw the path history. immediateRenderer->setLineWidth( 1 ); immediateRenderer->color( 0.0f, 1.0f, 1.0f, 1.0f ); immediateRenderer->begin( IndexedPrimitiveType::LINES ); for ( Index i = 0; i < (quadcopters[q]->tracer.getSize()-1); i++ ) { immediateRenderer->vertex( quadcopters[q]->tracer[i] ); immediateRenderer->vertex( quadcopters[q]->tracer[i+1] ); } immediateRenderer->render(); } immediateRenderer->getRenderMode().setFlag( RenderFlags::DEPTH_TEST, true ); immediateRenderer->getRenderMode().setFlag( RenderFlags::DEPTH_WRITE, true ); // Save the graphics frame to an image file. if ( recording ) { context->flush(); Image screen; if ( context->readColorBuffer( PixelFormat::RGB, screen ) ) { Path imagePath( Directory::getExecutable(), Path("frames/" + UTF8String(frameNumber) + ".tga") ); FileWriter writer( imagePath ); if ( writer.open() ) { images::io::ImageConverter imageConverter; imageConverter.encode( images::ImageFormat::TGA, screen, writer ); writer.close(); } frameNumber++; } } //**************************************************************************** // Draw the UI Vector2f textPosition( 20, context->getFramebufferSize().y - fontStyle.getFontSize() - 20 ); fontDrawer->drawString( UTF8String("Time Step: ") + UTF8String(timeStep*1000,2) + " ms\n" + UTF8String("Simulation Time: ") + UTF8String(simulationTime*1000,3) + " ms\n" , fontStyle, textPosition ); } void QuadcopterDemo:: drawRoadmap( const Roadmap& roadmap ) { immediateRenderer->setPointSize( 5 ); immediateRenderer->color( 0.0f, 0.0f, 0.5f ); immediateRenderer->begin( IndexedPrimitiveType::POINTS ); for ( Index i = 0; i < roadmap.getNodeCount(); i++ ) { immediateRenderer->vertex( roadmap.getNode(i).position ); } immediateRenderer->render(); // Draw the roadmap connections. immediateRenderer->setLineWidth( 1 ); immediateRenderer->color( 1.0f, 1.0f, 1.0f, 0.05f ); immediateRenderer->begin( IndexedPrimitiveType::LINES ); for ( Index i = 0; i < roadmap.getNodeCount(); i++ ) { const ArrayList<Index>& neighbors = roadmap.getNode(i).neighbors; const Size numNeighbors = neighbors.getSize(); for ( Index n = 0; n < numNeighbors; n++ ) { immediateRenderer->vertex( roadmap.getNode(i).position ); immediateRenderer->vertex( roadmap.getNode(neighbors[n]).position ); } } immediateRenderer->render(); } //########################################################################################## //########################################################################################## //############ //############ Window Resize Handle Method //############ //########################################################################################## //########################################################################################## void QuadcopterDemo:: resize( const Size2D& newSize ) { camera->setAspectRatio( Float(newSize.x)/Float(newSize.y) ); } //########################################################################################## //########################################################################################## //############ //############ Quadcopter Management Methods //############ //########################################################################################## //########################################################################################## Pointer<Quadcopter> QuadcopterDemo:: newQuadcopter( const Vector3f& position ) const { // Create a new quadcopter at the given position. Pointer<Quadcopter> quadcopter = Pointer<Quadcopter>::construct(); quadcopter->currentState.position = position; // Create a graphics object for the quadcopter. Pointer<GraphicsObject> graphics = Pointer<GraphicsObject>::construct( quadcopterMesh ); graphics->setPosition( Vector3f( 0, 0, 0 ) ); graphics->setScale( Vector3f( 1 ) ); graphics->setFlag( GraphicsObjectFlags::SHADOWS_ENABLED, true ); quadcopter->graphics = graphics; // Configure the cameras. quadcopter->frontCamera->setHorizontalFieldOfView( 90 ); quadcopter->frontCamera->setNearPlaneDistance( 1.0f ); quadcopter->frontCamera->setFarPlaneDistance( 1000 ); quadcopter->downCamera->setHorizontalFieldOfView( 90 ); quadcopter->downCamera->setNearPlaneDistance( 1.0f ); quadcopter->downCamera->setFarPlaneDistance( 1000 ); Float l = 0.5f; // distance to motors from center, // Configure the motors of the quadcopter. quadcopter->motors.add( Quadcopter::Motor( l*Vector3f( -1, 0, -1 ).normalize(), Vector3f( 0, 1, 0 ) ) ); quadcopter->motors.add( Quadcopter::Motor( l*Vector3f( 1, 0, -1 ).normalize(), Vector3f( 0, 1, 0 ) ) ); quadcopter->motors.add( Quadcopter::Motor( l*Vector3f( 1, 0, 1 ).normalize(), Vector3f( 0, 1, 0 ) ) ); quadcopter->motors.add( Quadcopter::Motor( l*Vector3f( -1, 0, 1 ).normalize(), Vector3f( 0, 1, 0 ) ) ); Float mass = 1.0f; Float M = 0.6f; // mass of center Float R = 0.05f; // center sphere radius Float m = (mass - M) / quadcopter->motors.getSize(); // The mass of the quadcopter. quadcopter->mass = mass; quadcopter->inertia = Matrix3f( (2.0f/5.0f)*M*R*R + 2.0f*m*l*l, 0, 0, 0, (2.0f/5.0f)*M*R*R + 4.0f*m*l*l, 0, 0, 0, (2.0f/5.0f)*M*R*R + 2.0f*m*l*l ); // Set the goal position. quadcopter->goalpoint = goal; quadcopter->roadmap = Pointer<Roadmap>::construct( *roadmap ); quadcopter->nextWaypoint = position; return quadcopter; } Bool QuadcopterDemo:: addQuadcopterToScene( const Pointer<Quadcopter>& newQuadcopter ) { if ( newQuadcopter.isNull() ) return false; // Add the graphical representation to the scene. if ( newQuadcopter->graphics.isSet() ) scene->addObject( newQuadcopter->graphics ); // The size (as a fraction of screen size) of the quadcopter's viewport. const Float viewWidth = 0.25f; const Float viewHeight = 0.25f; // Add the cameras to the scene. if ( newQuadcopter->frontCamera.isSet() ) { // Determine where to place the camera. AABB2f viewport( 1.0f - viewWidth*2, 1.0f - viewWidth, 1.0f - (quadcopters.getSize() + 1)*viewHeight, 1.0f - quadcopters.getSize()*viewHeight ); Pointer<ViewportLayout> viewportLayout = sceneRenderer->getViewportLayout(); ViewportLayout::CameraView cameraView( newQuadcopter->frontCamera, scene, viewport ); cameraView.clearColor = Color4D<Double>(0.2,0.2,0.2,1); viewportLayout->addCameraView( cameraView ); scene->addCamera( newQuadcopter->frontCamera ); } if ( newQuadcopter->downCamera.isSet() ) { // Determine where to place the camera. AABB2f viewport( 1.0f - viewWidth, 1.0f, 1.0f - (quadcopters.getSize() + 1)*viewHeight, 1.0f - quadcopters.getSize()*viewHeight ); Pointer<ViewportLayout> viewportLayout = sceneRenderer->getViewportLayout(); ViewportLayout::CameraView cameraView( newQuadcopter->downCamera, scene, viewport ); cameraView.clearColor = Color4D<Double>(0.2,0.2,0.2,1); viewportLayout->addCameraView( cameraView ); scene->addCamera( newQuadcopter->downCamera ); } quadcopters.add( newQuadcopter ); simulation.addQuadcopter( newQuadcopter ); return true; } <file_sep>/* * rimBasicStringBuffer.h * Rim Framework * * Created by <NAME> on 11/26/07. * Copyright 2007 Rim Software. All rights reserved. * */ #ifndef INCLUDE_RIM_BASIC_STRING_BUFFER_H #define INCLUDE_RIM_BASIC_STRING_BUFFER_H #include "rimDataConfig.h" #include "../util/rimArray.h" #include "rimBasicString.h" // Forward-declare the StringInputStream class so that we can mark it as a friend. namespace rim { namespace io { class StringInputStream; }; }; //########################################################################################## //******************************* Start Data Namespace ********************************* RIM_DATA_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class which contains a buffer of characters of templated type. /** * This class allows the user to accumulate characters in a resizing buffer, * then convert the buffer's internal array to a string for other uses. */ template < typename CharType > class BasicStringBuffer { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructors /// Create an empty buffer with the default initial capacity. BasicStringBuffer(); /// Create an empty buffer with the specified initial capacity and resize factor. BasicStringBuffer( Size initialCapacity, Float newResizeFactor = DEFAULT_RESIZE_FACTOR ); /// Create an identical copy of the specified buffer. BasicStringBuffer( const BasicStringBuffer& other ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Destructor /// Destroy a buffer, deallocating all resources used. RIM_INLINE ~BasicStringBuffer() { util::deallocate( buffer ); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Assignment Operator /// Assign the contents of one string buffer to another, performing a deep copy. BasicStringBuffer& operator = ( const BasicStringBuffer& other ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Append Methods /// Append an element to the end of this buffer. BasicStringBuffer& append( const CharType& character ); /// Append all characters from the given NULL-terminated string. BasicStringBuffer& append( const CharType* source ); /// Append the specified number of elements from the given string. BasicStringBuffer& append( const CharType* source, Size numElements ); /// Append a string to this string buffer. RIM_INLINE BasicStringBuffer& append( const BasicString<CharType>& string ) { return append( string.getCString(), string.getLength() ); } template < typename OtherCharType > RIM_INLINE BasicStringBuffer& append( const BasicString<OtherCharType>& string ) { return append( BasicString<CharType>(string) ); } /// Append all elements from the specified character array to the end of the buffer. RIM_INLINE BasicStringBuffer& append( const util::Array<CharType>& array ) { return append( array.getPointer(), array.getSize() ); } /// Append a certain number of elements from the specified array to the end of the buffer. RIM_INLINE BasicStringBuffer& append( const util::Array<CharType>& array, Size number ) { return append( array.getPointer(), math::min( number, array.getSize() ) ); } /// Append all data from the specified buffer. RIM_INLINE BasicStringBuffer& append( const BasicStringBuffer& aBuffer ) { return append( aBuffer.buffer, aBuffer.getSize() ); } /// Convert the object of templated type to a string and append it to the buffer. template < typename T > RIM_INLINE BasicStringBuffer& append( const T& object ) { return append( (BasicString<CharType>)object ); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Append Operators /// Append a character to the end of this string buffer. RIM_INLINE BasicStringBuffer& operator << ( const CharType& character ) { return append( character ); } /// Append a NULL-terminated character string to the end of this buffer. RIM_INLINE BasicStringBuffer& operator << ( const CharType* character ) { return append( character ); } /// Append a string to the end of this buffer. RIM_INLINE BasicStringBuffer& operator << ( const BasicString<CharType>& string ) { return append( string ); } /// Append a string to the end of this buffer. template < typename OtherCharType > RIM_INLINE BasicStringBuffer& operator << ( const BasicString<OtherCharType>& string ) { return append( BasicString<CharType>(string) ); } /// Append all elements from the specified character array to the end of the string buffer. RIM_INLINE BasicStringBuffer& operator << ( const util::Array<CharType>& array ) { return append( array ); } /// Append all characters from the specified buffer to this buffer. RIM_INLINE BasicStringBuffer& operator << ( const BasicStringBuffer& aBuffer ) { return append( aBuffer ); } /// Convert the object of templated type to a string and append it to the buffer. template < typename T > RIM_INLINE BasicStringBuffer& operator << ( const T& object ) { return append( (BasicString<CharType>)object ); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Remove Methods /// Remove the specified number of code points from the end of this string buffer. /** * The method returns the number of character code points that were removed. */ Size remove( Size numCharacters ) { // Don't remove more characters than are in the buffer. numCharacters = math::min( numCharacters, Size(nextElement - buffer) ); // Rewind the next element pointer. nextElement -= numCharacters; // Make the string NULL-terminated. *nextElement = '\0'; return numCharacters; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Clear Method /// Clear the contents of the buffer, keeping its capacity intact. RIM_INLINE void clear() { nextElement = buffer; *nextElement = '\0'; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Content Accessor Methods /// Convert the contents of this buffer to a string object. RIM_INLINE BasicString<CharType> toString() const { return BasicString<CharType>( buffer, nextElement - buffer ); } /// Convert the contents of this buffer to a string object. RIM_INLINE operator BasicString<CharType> () { return BasicString<CharType>( buffer, nextElement - buffer ); } /// Get a pointer pointing to the buffer's internal array. RIM_INLINE const CharType* getPointer() const { return buffer; } /// Get a pointer pointing to the buffer's internal array. RIM_INLINE const CharType* getCString() const { return buffer; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Size Accessor Methods /// Get the number of characters in the buffer, excluding the NULL terminator. RIM_INLINE Size getSize() const { return nextElement - buffer; } /// Get the number of characters in the buffer, excluding the NULL terminator. RIM_INLINE Size getLength() const { return nextElement - buffer; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Capacity Accessor Methods /// Get the number of elements the buffer can hold without resizing. RIM_INLINE Size getCapacity() const { return capacity; } /// Set the number of elements the buffer can hold. RIM_INLINE Bool setCapacity( Size newCapacity ) { if ( newCapacity < getSize() ) return false; else { resize( newCapacity ); return true; } } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Resize Factor Accessor Methods /// Get the resize factor for this buffer. RIM_INLINE Float getResizeFactor() const { return resizeFactor; } /// Set the resize factor for this buffer, clamped to [1.1, 10.0] RIM_INLINE void setResizeFactor( Float newResizeFactor ) { resizeFactor = math::clamp( newResizeFactor, 1.1f, 10.0f ); } private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Methods /// Increase the capacity to at least the specified amount using the resize factor. RIM_INLINE void increaseCapacity( Size minimumCapacity ) { resize( math::max( minimumCapacity, Size(Float(capacity)*resizeFactor) ) ); } /// Increase the capacity to be the current factor multiplied by the resize factor. RIM_INLINE void increaseCapacity() { resize( Size(Float(capacity)*resizeFactor) ); } /// Resize the internal buffer to be the specified length. void resize( Size newCapacity ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Members /// An array of elements which is the buffer. CharType* buffer; /// A pointer to the location in the buffer where the next element should be inserted. CharType* nextElement; /// A pointer to the first element past the end of the buffer. const CharType* bufferEnd; /// The number of elements that the buffer can hold. Size capacity; /// How much the buffer's capacity increases when it needs to. Float resizeFactor; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Static Data Members /// The default capacity for a buffer if it is not specified. static const Size DEFAULT_CAPACITY = 32; /// The default factor by which the buffer resizes. static const Float DEFAULT_RESIZE_FACTOR; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Friend Class Declarations /// Mark the StringInputStream class as a friend so that it can modify a buffer's internals. friend class rim::io::StringInputStream; }; template < typename CharType > const Float BasicStringBuffer<CharType>:: DEFAULT_RESIZE_FACTOR = 2.0f; //########################################################################################## //########################################################################################## //############ //############ String Buffer Type Definitions //############ //########################################################################################## //########################################################################################## /// A class which represents a buffer of ASCII encoded characters. typedef BasicStringBuffer<Char> StringBuffer; /// A class which represents a buffer of UTF-8 encoded characters. typedef BasicStringBuffer<UTF8Char> UTF8StringBuffer; /// A class which represents a buffer of UTF-16 encoded characters. typedef BasicStringBuffer<UTF16Char> UTF16StringBuffer; /// A class which represents a buffer of UTF-32 encoded characters. typedef BasicStringBuffer<UTF32Char> UTF32StringBuffer; //########################################################################################## //******************************* End Data Namespace *********************************** RIM_DATA_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_BASIC_STRING_BUFFER_H <file_sep>/* * rimGraphicsPointLight.h * Rim Graphics * * Created by <NAME> on 5/16/12. * Copyright 2012 __MyCompanyName__. All rights reserved. * */ #ifndef INCLUDE_RIM_GRAPHICS_POINT_LIGHT_H #define INCLUDE_RIM_GRAPHICS_POINT_LIGHT_H #include "rimGraphicsLightsConfig.h" #include "rimGraphicsLight.h" #include "rimGraphicsLightAttenuation.h" //########################################################################################## //************************ Start Rim Graphics Lights Namespace *************************** RIM_GRAPHICS_LIGHTS_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class which represents a point light source. /** * A point light has all of the standard light attributes (color, intensity, etc), * but also has position and distance attenuation attributes. */ class PointLight : public Light { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructors /// Create a default point light centered at the origin. PointLight(); /// Create a default point light at the specified position. PointLight( const Vector3& newPosition ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Position Accessor Methods /// Get the position of this point light in world space. RIM_INLINE const Vector3& getPosition() const { return position; } /// Set the position of this point light in world space. RIM_INLINE void setPosition( const Vector3& newPosition ) { position = newPosition; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Attenuation Accessor Methods /// Get an object representing how this point light is attenuated with distance. RIM_INLINE LightAttenuation& getAttenuation() { return attenuation; } /// Get an object representing how this point light is attenuated with distance. RIM_INLINE const LightAttenuation& getAttenuation() const { return attenuation; } /// Set the object representing how this point light is attenuated with distance. RIM_INLINE void setAttenuation( const LightAttenuation& newAttenuation ) { attenuation = newAttenuation; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Bounding Sphere Accessor Method /// Get a bounding sphere for this light's area of effect with the specified cutoff intensity. BoundingSphere getBoundingSphere( Real cutoffIntensity ) const; private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Members /// The position of this point light in world space. Vector3 position; /// An object which models the distance attenuation of this light source. LightAttenuation attenuation; }; //########################################################################################## //************************ End Rim Graphics Lights Namespace ***************************** RIM_GRAPHICS_LIGHTS_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_GRAPHICS_POINT_LIGHT_H <file_sep>/* * rimGUIDisplayID.h * Rim GUI * * Created by <NAME> on 9/3/12. * Copyright 2012 __MyCompanyName__. All rights reserved. * */ #ifndef INCLUDE_RIM_GUI_DISPLAY_ID_H #define INCLUDE_RIM_GUI_DISPLAY_ID_H #include "rimGUISystemConfig.h" //########################################################################################## //************************ Start Rim GUI System Namespace ************************** RIM_GUI_SYSTEM_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class which is used to encapsulate a unique identifier for a system video display. /** * This opaque type uses a platform-dependent internal representation which uniquely * identifies a connected video display on this system. */ class DisplayID { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Public Constants /// An instance of DisplayID that represents an invalid video display. static const DisplayID INVALID; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Comparison Operators /// Return whether or not this display ID represents the same display as another. RIM_INLINE Bool operator == ( const DisplayID& other ) const { return displayID == other.displayID; } /// Return whether or not this display ID represents a different display than another. RIM_INLINE Bool operator != ( const DisplayID& other ) const { return displayID != other.displayID; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Device Status Accessor Method /// Return whether or not this DisplayID represents a valid display. /** * This condition is met whenever the display ID is not equal to INVALID_DISPLAY_ID. */ RIM_INLINE Bool isValid() const { return displayID != INVALID_DISPLAY_ID; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Platform-Specific ID Accessor Methods #if defined(RIM_PLATFORM_WINDOWS) /// Return a const reference to the wide-character string uniquely representing a video display on this system. RIM_INLINE const UTF16String& getIDString() const { return displayID; } #else /// Convert this DisplayID object to an unsigned integer which uniquely represents a dislay on this system. RIM_INLINE PointerInt getID() const { return displayID; } #endif private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Constructor #if defined(RIM_PLATFORM_WINDOWS) /// Create a DisplayID object which represents the display with the specified device ID. RIM_INLINE explicit DisplayID( const UTF16String& newDisplayID ) : displayID( newDisplayID ) { } #else /// Create a DisplayID object which represents the display with the specified display ID. RIM_INLINE explicit DisplayID( PointerInt newDisplayID ) : displayID( newDisplayID ) { } #endif //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Conversion Methods #if defined(RIM_PLATFORM_APPLE) /// Convert this DisplayID object to an unsigned integer which uniquely represents a dislay on this system. RIM_INLINE operator PointerInt () const { return displayID; } #endif //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Members #if defined(RIM_PLATFORM_WINDOWS) /// The underlying representation of a DisplayID on windows, a UTF-16 encoded ID string. UTF16String displayID; /// The reserved ID used to indicate an invalid display. static const UTF16String INVALID_DISPLAY_ID; #else /// The underlying representation of a DisplayID, an unsigned integer. PointerInt displayID; /// The reserved ID used to indicate an invalid display. static const PointerInt INVALID_DISPLAY_ID = -1; #endif //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Friend Declaration /// Declare the Display class a friend so that it can use opaque DisplayID objects. friend class Display; }; //########################################################################################## //************************ End Rim GUI System Namespace **************************** RIM_GUI_SYSTEM_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_GUI_DISPLAY_ID_H <file_sep>/* * rimSoundDevicesConfig.h * Rim Sound * * Created by <NAME> on 6/7/08. * Copyright 2008 Rim Software. All rights reserved. * */ #ifndef INCLUDE_RIM_SOUND_DEVICES_CONFIG_H #define INCLUDE_RIM_SOUND_DEVICES_CONFIG_H #include "../rimSoundConfig.h" #include "../rimSoundUtilities.h" //########################################################################################## //########################################################################################## //############ //############ Library Namespace Configuration //############ //########################################################################################## //########################################################################################## #ifndef RIM_SOUND_DEVICES_NAMESPACE #define RIM_SOUND_DEVICES_NAMESPACE devices #endif #ifndef RIM_SOUND_DEVICES_NAMESPACE_START #define RIM_SOUND_DEVICES_NAMESPACE_START RIM_SOUND_NAMESPACE_START namespace RIM_SOUND_DEVICES_NAMESPACE { #endif #ifndef RIM_SOUND_DEVICES_NAMESPACE_END #define RIM_SOUND_DEVICES_NAMESPACE_END }; RIM_SOUND_NAMESPACE_END #endif RIM_SOUND_NAMESPACE_START /// A namespace containing classes handling input and output from audio devicess. namespace RIM_SOUND_DEVICES_NAMESPACE { }; RIM_SOUND_NAMESPACE_END //########################################################################################## //************************ Start Rim Sound Devices Namespace ***************************** RIM_SOUND_DEVICES_NAMESPACE_START //****************************************************************************************** //########################################################################################## using rim::sound::util::Sample32f; using rim::sound::util::SampleRate; using rim::sound::util::SampleType; using rim::sound::util::SoundBuffer; using rim::sound::util::MIDIMessage; using rim::sound::util::MIDIEvent; using rim::sound::util::MIDIBuffer; //########################################################################################## //************************ End Rim Sound Devices Namespace ******************************* RIM_SOUND_DEVICES_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_SOUND_DEVICES_CONFIG_H <file_sep>/* * rimPhysicsVertex.h * Rim Physics * * Created by <NAME> on 7/9/12. * Copyright 2012 __MyCompanyName__. All rights reserved. * */ #ifndef INCLUDE_RIM_PHYSICS_VERTEX_H #define INCLUDE_RIM_PHYSICS_VERTEX_H #include "rimPhysicsUtilitiesConfig.h" //########################################################################################## //********************** Start Rim Physics Utilities Namespace *************************** RIM_PHYSICS_UTILITIES_NAMESPACE_START //****************************************************************************************** //########################################################################################## /// Define the type to use for a 2D vertex in this physics engine. typedef Vector2D<Real> PhysicsVertex2; /// Define the type to use for a 3D vertex in this physics engine. typedef Vector3D<Real> PhysicsVertex3; //########################################################################################## //********************** End Rim Physics Utilities Namespace ***************************** RIM_PHYSICS_UTILITES_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_PHYSICS_VERTEX_H <file_sep>/* * rimGraphicsShaderSource.h * Rim Software * * Created by <NAME> on 1/30/14. * Copyright 2014 __MyCompanyName__. All rights reserved. * */ #ifndef INCLUDE_RIM_GRAPHICS_SHADER_SOURCE_H #define INCLUDE_RIM_GRAPHICS_SHADER_SOURCE_H #include "rimGraphicsShadersConfig.h" #include "rimGraphicsShaderType.h" //########################################################################################## //*********************** Start Rim Graphics Shaders Namespace *************************** RIM_GRAPHICS_SHADERS_NAMESPACE_START //****************************************************************************************** //########################################################################################## /// The type of string to use to represent shader source code. typedef String ShaderSourceString; //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class which contains the source code for a shader. /** * In addition to a string specifying the source code for the shader, a ShaderSource * object also contains a ShaderType object specifying the type of shader the source * code describes. */ class ShaderSource { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructors /// Create a new shader source object with an empty source code string and ShaderType::UNDEFINED type. RIM_INLINE ShaderSource() : type( ShaderType::UNDEFINED ), source() { } /// Create a new shader source object with the specified type and source code. RIM_INLINE ShaderSource( const ShaderSourceString& newSource, const ShaderType& newType ) : type( newType ), source( newSource ) { } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Type Accessor Methods /// Return an object describing the type of shader this source code describes. RIM_INLINE const ShaderType& getType() const { return type; } /// Set an object describing the type of shader this source code describes. RIM_INLINE void setType( const ShaderType& newType ) { type = newType; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Source Accessor Methods /// Return a string containing the source code for this shader. RIM_INLINE const ShaderSourceString& getSource() const { return source; } /// Set a string containing the source code for this shader. RIM_INLINE void setSource( const ShaderSourceString& newSource ) { source = newSource; } private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Members /// An object describing the type of this shader. ShaderType type; /// A string containing the source code for this shader. ShaderSourceString source; }; //########################################################################################## //*********************** End Rim Graphics Shaders Namespace ***************************** RIM_GRAPHICS_SHADERS_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_GRAPHICS_SHADER_SOURCE_H <file_sep>/* * rimGraphicsConstantBuffer.h * Rim Software * * Created by <NAME> on 11/9/14. * Copyright 2014 __MyCompanyName__. All rights reserved. * */ #ifndef INCLUDE_RIM_GRAPHICS_CONSTANT_BUFFER_H #define INCLUDE_RIM_GRAPHICS_CONSTANT_BUFFER_H #include "rimGraphicsShadersConfig.h" #include "rimGraphicsConstantUsage.h" //########################################################################################## //*********************** Start Rim Graphics Shaders Namespace *************************** RIM_GRAPHICS_SHADERS_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class that stores a collection of shader constants with their associated usages. /** * This allows objects like meshes and shapes to store constants (such as color) * independently of the shader pass that is used to render the object. At render time, * the constant buffer is used as source of constant data for shader constant variables * that require input for certain constant usages. */ class ConstantBuffer { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructors /// Create a new constant buffer object with no constants stored. ConstantBuffer(); /// Create a new constant buffer object with the specified initial capacity in bytes. ConstantBuffer( Size constantDataCapacity ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Destructor /// Destroy a constant buffer, releasing all internal resources. ~ConstantBuffer(); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constant Accessor Methods /// Return the number of constants that are stored in this constant buffer. RIM_FORCE_INLINE Size getConstantCount() const { return numConstantBytes; } /// Return a pointer to the storage for the specified constant usage if it is part of this buffer. /** * If the method succeeds in finds a constant with that usage that is compatible * with the templated return type, a pointer to the stored value is returned. * Otherwise, the method fails and returns NULL. */ template < typename T > RIM_INLINE const T* getConstant( const ConstantUsage& usage ) const { return this->getConstantValue( usage, AttributeType::get<T>() ); } /// Get the value for the specified constant usage if it is part of this buffer. /** * If the method succeeds in finds a constant with that usage that is compatible * with the templated value output type, the constant's value is stored in the * output parameter and the method returns TRUE. * Otherwise the method has no effect and returns FALSE. */ template < typename T > RIM_INLINE Bool getConstant( const ConstantUsage& usage, T& value ) const { return this->getConstantValue( usage, AttributeType::get<T>(), &value ); } /// Get the value for the specified constant usage if it is part of this buffer. /** * If the method succeeds in finds a constant with that usage, the constant's value * is stored in the output parameter and the method returns TRUE. * Otherwise the method has no effect and returns FALSE. */ RIM_INLINE Bool getConstant( const ConstantUsage& usage, AttributeValue& value ) const { return this->getConstantValue( usage, value ); } /// Get the value for the specified constant usage if it is part of this buffer. /** * If the method succeeds in finds a constant with that usage that is compatible * with the specified value output type, the constant's value is stored in the * output value parameter and the method returns TRUE. * Otherwise the method has no effect and returns FALSE. */ RIM_INLINE Bool getConstant( const ConstantUsage& usage, const AttributeType& outputType, void* value ) const { return this->getConstantValue( usage, outputType, value ); } /// Add a new constant with the specified usage and value to this constant buffer. /** * The method returns whether or not a new constant was successfully added * to this buffer. The method can fail if the specified value does not * have a type that is compatible with the given usage. */ template < typename T > RIM_INLINE Bool addConstant( const ConstantUsage& usage, const T& value ) { return this->addConstantValue( usage, AttributeType::get<T>(), &value ); } /// Add a new constant with the specified usage and value to this constant buffer. /** * The method returns whether or not a new constant was successfully added * to this buffer. The method can fail if the specified value does not * have a type that is compatible with the given usage. */ template < typename T > RIM_INLINE Bool addConstant( const ConstantUsage& usage, const AttributeValue& value ) { return this->addConstantValue( usage, value.getType(), value.getPointer() ); } /// Set the value of the stored constant with the given usgae. /** * If the method finds a stored constant with the specified usage * and the given templated value type is compatible with the stored value, * the constants value is set to the new value and TRUE is returned. * If not found, the method adds the given constant value to the buffer * as if calling addConstant(). If the value is incompatible with the * usage, the method fails and FALSE is returned. */ template < typename T > RIM_INLINE Bool setConstant( const ConstantUsage& usage, const T& value ) { return this->setConstantValue( usage, AttributeType::get<T>(), &value ); } /// Set the value of the stored constant with the given usgae. /** * If the method finds a stored constant with the specified usage * and the given value type is compatible with the stored value, * the constants value is set to the new value and TRUE is returned. * If not found, the method adds the given constant value to the buffer * as if calling addConstant(). If the value is incompatible with the * usage, the method fails and FALSE is returned. */ RIM_INLINE Bool setConstant( const ConstantUsage& usage, const AttributeValue& value ) { return this->setConstantValue( usage, value.getType(), value.getPointer() ); } /// Remove all stored constants from this constant buffer object. RIM_INLINE void clearConstants() { constants.clear(); numConstantBytes = 0; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constant Data Accessor Methods /// Return an pointer to the internal array of shader constant data. RIM_FORCE_INLINE Size getConstantDataSize() const { return numConstantBytes; } /// Return a pointer to the internal array of shader constant data. RIM_FORCE_INLINE UByte* getConstantData() { return constantData.getPointer(); } /// Return a const pointer to the internal array of shader constant data. RIM_FORCE_INLINE const UByte* getConstantData() const { return constantData.getPointer(); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Static Constant Data Members /// The default size of a constant buffer's constant buffer in bytes. static const Size DEFAULT_CONSTANT_BUFFER_SIZE = 64; private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Entry Class Declaration /// A class that stores the usage and offset of a constant within this constant buffer. class Entry { public: /// Create a new entry with the specified usage, type, and storage offset in bytes. RIM_INLINE Entry( const ConstantUsage& newUsage, const AttributeType& newType, Index newByteOffset ) : usage( newUsage ), type( newType ), byteOffset( newByteOffset ) { } /// The usage associated with this constant buffer entry. ConstantUsage usage; /// The type of the value that is stored for this constant. AttributeType type; /// The offset in bytes of the constant value for this entry. Index byteOffset; }; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Helper Methods /// Find the index of the constant with the specified usage in this buffer. RIM_FORCE_INLINE Bool findUsage( const ConstantUsage& usage, Index& constantIndex ) const; /// Return a pointer to the storage for the constant with the specified usage. const void* getConstantValue( const ConstantUsage& usage, const AttributeType& valueType ) const; /// Get the value of a constant with the specified usage in the output parameter. Bool getConstantValue( const ConstantUsage& usage, const AttributeType& valueType, void* value ) const; /// Get the value of a constant with the specified usage in the output parameter. Bool getConstantValue( const ConstantUsage& usage, AttributeValue& value ) const; /// Set the value of a constant with the specified usage. Bool setConstantValue( const ConstantUsage& usage, const AttributeType& valueType, const void* value ); /// Add a new constant with the specified usage, type, and value. Bool addConstantValue( const ConstantUsage& usage, const AttributeType& valueType, const void* value ); /// Allocate a new constant for this constant buffer and return the byte offset for the constant storage. RIM_FORCE_INLINE Index allocateConstant( Size sizeInBytes ); /// Align the specified address to a 4-byte boundary. RIM_FORCE_INLINE static Index alignConstantAddress( Index address ) { return (address + (DEFAULT_CONSTANT_ALIGNMENT - 1)) & -(SignedIndex)DEFAULT_CONSTANT_ALIGNMENT; } /// The default alignment requirement in bytes for allocated constants. static const Index DEFAULT_CONSTANT_ALIGNMENT = 4; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Members /// A list of the constants and their usages that are stored in this buffer. ArrayList<Entry> constants; /// An array of bytes that stores the values for all constants that are part of this constant buffer. Array<UByte> constantData; /// The total number of bytes used for current bindings in the constant data buffer. Size numConstantBytes; }; //########################################################################################## //*********************** End Rim Graphics Shaders Namespace ***************************** RIM_GRAPHICS_SHADERS_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_GRAPHICS_CONSTANT_BUFFER_H <file_sep>/* * rimGraphicsDevicesConfig.h * Rim Graphics * * Created by <NAME> on 3/1/13. * Copyright 2013 __MyCompanyName__. All rights reserved. * */ #ifndef INCLUDE_RIM_GRAPHICS_DEVICES_CONFIG_H #define INCLUDE_RIM_GRAPHICS_DEVICES_CONFIG_H #include "../rimGraphicsConfig.h" //########################################################################################## //########################################################################################## //############ //############ Library Namespace Configuration //############ //########################################################################################## //########################################################################################## #ifndef RIM_GRAPHICS_DEVICES_NAMESPACE_START #define RIM_GRAPHICS_DEVICES_NAMESPACE_START RIM_GRAPHICS_NAMESPACE_START namespace devices { #endif #ifndef RIM_GRAPHICS_DEVICES_NAMESPACE_END #define RIM_GRAPHICS_DEVICES_NAMESPACE_END }; RIM_GRAPHICS_NAMESPACE_END #endif //########################################################################################## //*********************** Start Rim Graphics Devices Namespace *************************** RIM_GRAPHICS_DEVICES_NAMESPACE_START //****************************************************************************************** //########################################################################################## //########################################################################################## //*********************** End Rim Graphics Devices Namespace ***************************** RIM_GRAPHICS_DEVICES_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_GRAPHICS_DEVICES_CONFIG_H <file_sep>/* * rimSIMDVectorDoubleN.h * Rim Framework * * Created by <NAME> on 1/19/13. * Copyright 2013 __MyCompanyName__. All rights reserved. * */ <file_sep>/* * rimSIMDVector3D.h * Rim Framework * * Created by <NAME> on 7/12/12. * Copyright 2012 __MyCompanyName__. All rights reserved. * */ #ifndef INCLUDE_RIM_SIMD_VECTOR_3D_H #define INCLUDE_RIM_SIMD_VECTOR_3D_H #include "rimMathConfig.h" #include "rimVector3D.h" #include "rimSIMDScalar.h" //########################################################################################## //***************************** Start Rim Math Namespace ********************************* RIM_MATH_NAMESPACE_START //****************************************************************************************** //########################################################################################## template < typename T, Size width > class SIMDVector3D; //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class which represents a set of 3D vectors stored in a SIMD-compatible format. /** * This class is used to store and operate on a set of 3D vectors * in a SIMD fashion. The vectors are stored in a structure-of-arrays format * that accelerates SIMD operations. */ template < typename T > class RIM_ALIGN(16) SIMDVector3D<T,4> { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructors /// Create a quad 3D SIMD vector with all vector components equal to zero. RIM_FORCE_INLINE SIMDVector3D() : x(), y(), z() { } /// Create a quad 3D SIMD vector with all of the four vectors equal to the specified vector. RIM_FORCE_INLINE SIMDVector3D( const Vector3D<T>& vector ) : x( vector.x ), y( vector.y ), z( vector.z ) { } /// Create a quad 3D SIMD vector with each of the four vectors equal to the specified vector. RIM_FORCE_INLINE SIMDVector3D( const Vector3D<T>& v1, const Vector3D<T>& v2, const Vector3D<T>& v3, const Vector3D<T>& v4 ) #if !RIM_USE_SIMD || RIM_USE_SIMD && defined(RIM_SIMD_ALTIVEC) || defined(RIM_SIMD_SSE) && !RIM_SSE_VERSION_IS_SUPPORTED(1,0) : x( v1.x, v2.x, v3.x, v4.x ), y( v1.y, v2.y, v3.y, v4.y ), z( v1.z, v2.z, v3.z, v4.z ) #endif { #if RIM_USE_SIMD && defined(RIM_SIMD_SSE) && RIM_SSE_VERSION_IS_SUPPORTED(1,0) __m128 xy10 = _mm_setzero_ps(); __m128 zw10 = _mm_setzero_ps(); __m128 xy32 = _mm_setzero_ps(); __m128 zw32 = _mm_setzero_ps(); xy10 = _mm_loadl_pi( xy10, (__m64*)&v1.x ); zw10 = _mm_loadl_pi( zw10, (__m64*)&v1.z ); xy10 = _mm_loadh_pi( xy10, (__m64*)&v2.x ); zw10 = _mm_loadh_pi( zw10, (__m64*)&v2.z ); xy32 = _mm_loadl_pi( xy32, (__m64*)&v3.x ); zw32 = _mm_loadl_pi( zw32, (__m64*)&v3.z ); xy32 = _mm_loadh_pi( xy32, (__m64*)&v4.x ); zw32 = _mm_loadh_pi( zw32, (__m64*)&v4.z ); x.v = _mm_shuffle_ps( xy10, xy32, _MM_SHUFFLE(2,0,2,0) ); y.v = _mm_shuffle_ps( xy10, xy32, _MM_SHUFFLE(3,1,3,1) ); z.v = _mm_shuffle_ps( zw10, zw32, _MM_SHUFFLE(2,0,2,0) ); #endif } /// Create a quad 3D SIMD vector with the specified X, Y, and Z SIMDScalars. RIM_FORCE_INLINE SIMDVector3D( const SIMDScalar<T,4>& newX, const SIMDScalar<T,4>& newY, const SIMDScalar<T,4>& newZ ) : x( newX ), y( newY ), z( newZ ) { } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Magnitude Methods /// Return the 4-component SIMD scalar magnitude of this quad SIMD 3D vector. RIM_FORCE_INLINE SIMDScalar<T,4> getMagnitude() const { return math::sqrt( x*x + y*y + z*z ); } /// Return the 4-component SIMD scalar squared magnitude of this quad SIMD 3D vector. RIM_FORCE_INLINE SIMDScalar<T,4> getMagnitudeSquared() const { return x*x + y*y + z*z; } /// Return a normalized copy of this quad SIMD 3D vector. RIM_FORCE_INLINE SIMDVector3D normalize() const { T inverseMagnitude = T(1) / math::sqrt( x*x + y*y + z*z ); return SIMDVector3D( x*inverseMagnitude, y*inverseMagnitude, z*inverseMagnitude ); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Arithmetic Operators /// Compute and return the component-wise sum of this quad SIMD 3D vector with another. RIM_FORCE_INLINE SIMDVector3D operator + ( const SIMDVector3D& other ) const { return SIMDVector3D( x + other.x, y + other.y, z + other.z ); } /// Compute and return the component-wise sum of this quad SIMD 3D vector with a quad SIMD scalar. RIM_FORCE_INLINE SIMDVector3D operator + ( const SIMDScalar<T,4>& quadScalar ) const { return SIMDVector3D( x + quadScalar, y + quadScalar, z + quadScalar ); } /// Compute and return the component-wise difference of this quad SIMD 3D vector with another. RIM_FORCE_INLINE SIMDVector3D operator - ( const SIMDVector3D& other ) const { return SIMDVector3D( x - other.x, y - other.y, z - other.z ); } /// Compute and return the component-wise difference of this quad SIMD 3D vector with a quad SIMD scalar. RIM_FORCE_INLINE SIMDVector3D operator - ( const SIMDScalar<T,4>& quadScalar ) const { return SIMDVector3D( x - quadScalar, y - quadScalar, z - quadScalar ); } /// Compute and return the component-wise multiplication of this quad SIMD 3D vector with another. RIM_FORCE_INLINE SIMDVector3D operator * ( const SIMDVector3D& other ) const { return SIMDVector3D( x*other.x, y*other.y, z*other.z ); } /// Compute and return the component-wise multiplication of this quad SIMD 3D vector with a quad SIMD scalar. RIM_FORCE_INLINE SIMDVector3D operator * ( const SIMDScalar<T,4>& quadScalar ) const { return SIMDVector3D( x*quadScalar, y*quadScalar, z*quadScalar ); } /// Compute and return the component-wise quotient of this quad SIMD 3D vector divided by a quad SIMD scalar. RIM_FORCE_INLINE SIMDVector3D operator / ( const SIMDScalar<T,4>& quadScalar ) const { const SIMDScalar<T,4> inverseQuadScalar = T(1) / quadScalar; return SIMDVector3D( x*inverseQuadScalar, y*inverseQuadScalar, z*inverseQuadScalar ); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Arithmetic Assignment Operators /// Compute the component-wise sum of this quad SIMD 3D vector with another and assign it to this vector. RIM_FORCE_INLINE SIMDVector3D& operator += ( const SIMDVector3D& other ) const { x += other.x; y += other.y; z += other.z; return *this; } /// Compute the component-wise sum of this quad SIMD 3D vector with a quad SIMD scalar and assign it to this vector. RIM_FORCE_INLINE SIMDVector3D& operator += ( const SIMDScalar<T,4>& quadScalar ) const { x += quadScalar; y += quadScalar; z += quadScalar; return *this; } /// Compute the component-wise difference of this quad SIMD 3D vector with another and assign it to this vector. RIM_FORCE_INLINE SIMDVector3D& operator -= ( const SIMDVector3D& other ) const { x -= other.x; y -= other.y; z -= other.z; return *this; } /// Compute the component-wise difference of this quad SIMD 3D vector with a quad SIMD scalar and assign it to this vector. RIM_FORCE_INLINE SIMDVector3D& operator -= ( const SIMDScalar<T,4>& quadScalar ) const { x -= quadScalar; y -= quadScalar; z -= quadScalar; return *this; } /// Compute the component-wise multiplication of this quad SIMD 3D vector with another and assign it to this vector. RIM_FORCE_INLINE SIMDVector3D& operator *= ( const SIMDVector3D& other ) const { x *= other.x; y *= other.y; z *= other.z; return *this; } /// Compute the component-wise multiplication of this quad SIMD 3D vector with a quad SIMD scalar and assign it to this vector. RIM_FORCE_INLINE SIMDVector3D& operator *= ( const SIMDScalar<T,4>& quadScalar ) const { x *= quadScalar; y *= quadScalar; z *= quadScalar; return *this; } /// Compute the component-wise quotient of this quad SIMD 3D vector divided by a quad SIMD scalar and assign it to this vector. RIM_FORCE_INLINE SIMDVector3D& operator /= ( const SIMDScalar<T,4>& quadScalar ) const { const SIMDScalar<T,4> inverseQuadScalar = T(1) / quadScalar; x *= inverseQuadScalar; y *= inverseQuadScalar; z *= inverseQuadScalar; return *this; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Required Alignment Accessor Methods /// Return the alignment required for objects of this type. /** * For most SIMD types this value will be 16 bytes. If there is * no alignment required, 0 is returned. */ RIM_FORCE_INLINE static Size getRequiredAlignment() { return 16; } /// Get the width of this vector (number of 3D vectors it has). RIM_FORCE_INLINE static Size getWidth() { return 4; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Public Data Members /// The X component vector of this SIMDVector3D. RIM_ALIGN(16) SIMDScalar<T,4> x; /// The X component vector of this SIMDVector3D. RIM_ALIGN(16) SIMDScalar<T,4> y; /// The X component vector of this SIMDVector3D. RIM_ALIGN(16) SIMDScalar<T,4> z; }; //########################################################################################## //########################################################################################## //############ //############ Free Vector Functions //############ //########################################################################################## //########################################################################################## /// Compute and return the dot product of two SIMD 3D vectors. /** * This method performs N standard dot product operations for a SIMD width * of N values per register and returns the result as an N-wide SIMD scalar. * * @param vector1 - The first SIMD 3D vector of the dot product. * @param vector2 - The second SIMD 3D vector of the dot product. * @return The dot products of the two vector parameters. */ template < typename T, Size width > RIM_FORCE_INLINE SIMDScalar<T,width> dot( const SIMDVector3D<T,width>& vector1, const SIMDVector3D<T,width>& vector2 ) { const SIMDVector3D<T,width> temp = vector1*vector2; return temp.x + temp.y + temp.z; } /// Compute and return the cross product of two SIMD 3D vectors. /** * This method performs N standard cross product operations for a SIMD width * of N values per register and returns the result as a SIMD 3D vector which * contains the results of all cross products. * * @param vector1 - The first SIMD 3D vector of the cross product. * @param vector2 - The second SIMD 3D vector of the cross product. * @return The cross product vectors of the two vector parameters. */ template < typename T, Size width > RIM_FORCE_INLINE SIMDVector3D<T,width> cross( const SIMDVector3D<T,width>& vector1, const SIMDVector3D<T,width>& vector2 ) { return SIMDVector3D<T,width>( vector1.y*vector2.z - vector1.z*vector2.y, vector1.z*vector2.x - vector1.x*vector2.z, vector1.x*vector2.y - vector1.y*vector2.x ); } //########################################################################################## //***************************** End Rim Math Namespace *********************************** RIM_MATH_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_SIMD_VECTOR_3D_H <file_sep>/* * rimGraphicsGenericMeshShape.h * Rim Software * * Created by <NAME> on 2/2/14. * Copyright 2014 __MyCompanyName__. All rights reserved. * */ #ifndef INCLUDE_RIM_GRAPHICS_GENERIC_MESH_SHAPE_H #define INCLUDE_RIM_GRAPHICS_GENERIC_MESH_SHAPE_H #include "rimGraphicsShapesConfig.h" #include "rimGraphicsShapeBase.h" #include "rimGraphicsGenericMeshGroup.h" #include "rimGraphicsSkeleton.h" //########################################################################################## //*********************** Start Rim Graphics Shapes Namespace **************************** RIM_GRAPHICS_SHAPES_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class which represents a generic chunk of mesh data and its associated materials. class GenericMeshShape : public GraphicsShapeBase<GenericMeshShape> { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructors /// Create a new generic mesh with no vertex buffers or material groups. GenericMeshShape(); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Destructor /// Destroy this generic mesh and release all resources that it references. virtual ~GenericMeshShape(); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Group Accessor Methods /// Return the total number of groups that this mesh has. RIM_INLINE Size getGroupCount() const { return groups.getSize(); } /// Return a reference to the mesh group at the specified index. /** * If an out-of-bounds index is given, an assertion is raised. */ RIM_INLINE const Pointer<GenericMeshGroup>& getGroup( Index groupIndex ) const { RIM_DEBUG_ASSERT_MESSAGE( groupIndex < groups.getSize(), "Cannot get mesh material group at invalid index." ); return groups[groupIndex]; } /// Add a new group to this mesh. /** * The method returns whether or not the operation was successful. * The method can fail if the group's index buffer is NULL. The material is allowed to be NULL. */ Bool addGroup( const Pointer<GenericMeshGroup>& newGroup ); /// Remove the group at the specified index from this mesh. /** * The method returns whether or not the operation was successful. * The method can fail if the specified group index is not valid. */ Bool removeGroup( Index groupIndex ); /// Remove all groups from this mesh. void clearGroups(); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Skeleton Accessor Methods /// Return a pointer to the skeleton for this mesh, or NULL if it doesn't have one. RIM_INLINE const Pointer<Skeleton>& getSkeleton() const { return skeleton; } /// Set the skeleton for this mesh. RIM_INLINE void setSkeleton( const Pointer<Skeleton>& newSkeleton ) { skeleton = newSkeleton; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Bounding Volume Accessor Methods /// Update the local-space bounding sphere for this generic mesh shape. /** * This method is automatically called whenever a generic mesh shape is * first created and anytime the mesh groups of the shape are changed. * It is declared publicly so that a user can make sure that the bounding * box matches the geometry (which might be shared and could changed without notice). */ virtual void updateBoundingBox(); private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Members /// A list of the groups that this mesh uses. ArrayList< Pointer<GenericMeshGroup> > groups; /// A pointer to the skeleton for this mesh, or NULL if it doesn't have one. Pointer<Skeleton> skeleton; }; //########################################################################################## //*********************** End Rim Graphics Shapes Namespace ****************************** RIM_GRAPHICS_SHAPES_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_GRAPHICS_GENERIC_MESH_SHAPE_H <file_sep>/* * rimSoundBitcrusher.h * Rim Sound * * Created by <NAME> on 8/6/13. * Copyright 2013 __MyCompanyName__. All rights reserved. * */ #ifndef INCLUDE_RIM_SOUND_BITCRUSHER_H #define INCLUDE_RIM_SOUND_BITCRUSHER_H #include "rimSoundFiltersConfig.h" #include "rimSoundFilter.h" #include "rimSoundCutoffFilter.h" //########################################################################################## //************************ Start Rim Sound Filters Namespace ***************************** RIM_SOUND_FILTERS_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class that uses quantization-based methods to produce distortion. /** * The class uses a conversion to/from a lower bit-depth audio stream * in order to produce unique kinds of distortion. It also provides a way * to process that audio through a conversion to a lower sample rate, effectively * producing other kinds of distortion. */ class Bitcrusher : public SoundFilter { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Distortion Type Enum Declaration /// Define the different kinds of distortion effects that this filter can produce. typedef enum ClipMode { /// A kind of clipping where the waveform is chopped off when it goes above the threshold. HARD = 0, /// A kind of clipping where the waveform is inverted when it goes above the threshold. INVERT = 1, /// A kind of clipping where the waveform wraps around to 0 when it goes above the threshold. WRAP = 2 }; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructors /// Create a new distortion filter with the default input and output gains of 1 and hardness of 0. Bitcrusher(); /// Create an exact copy of another bitcrusher. Bitcrusher( const Bitcrusher& other ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Destructor /// Destroy this bitcrusher and clean up any resources. ~Bitcrusher(); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Assignment Operator /// Assign the state of another bitcrusher to this one. Bitcrusher& operator = ( const Bitcrusher& other ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Clipping Mode Accessor Methods /// Return the type of clipping that this bitcrusher is using. /** * This value determines what happens when the waveform exceeds the clipping threshold. */ RIM_INLINE ClipMode getClipMode() const { return clipMode; } /// Return the type of clipping that this bitcrusher is using. /** * This value determines what happens when the waveform exceeds the clipping threshold. */ RIM_INLINE void setClipMode( ClipMode newClipMode ) { lockMutex(); clipMode = newClipMode; unlockMutex(); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Input Gain Accessor Methods /// Return the current linear input gain factor of this bitcrusher. /** * This is the gain applied to the input signal before being sent to the * clipping function. A higher value will result in more noticeable clipping. */ RIM_INLINE Gain getInputGain() const { return targetInputGain; } /// Return the current input gain factor in decibels of this bitcrusher. /** * This is the gain applied to the input signal before being sent to the * clipping function. A higher value will result in more noticeable clipping. */ RIM_INLINE Gain getInputGainDB() const { return util::linearToDB( targetInputGain ); } /// Set the target linear input gain for this bitcrusher. /** * This is the gain applied to the input signal before being sent to the * clipping function. A higher value will result in more noticeable clipping. */ RIM_INLINE void setInputGain( Gain newInputGain ) { lockMutex(); targetInputGain = newInputGain; unlockMutex(); } /// Set the target input gain in decibels for this bitcrusher. /** * This is the gain applied to the input signal before being sent to the * clipping function. A higher value will result in more noticeable clipping. */ RIM_INLINE void setInputGainDB( Gain newDBInputGain ) { lockMutex(); targetInputGain = util::dbToLinear( newDBInputGain ); unlockMutex(); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Output Gain Accessor Methods /// Return the current linear output gain factor of this bitcrusher. /** * This is the gain applied to the signal after being sent to the * clipping function. This value is used to modify the final level * of the clipped signal. */ RIM_INLINE Gain getOutputGain() const { return targetOutputGain; } /// Return the current output gain factor in decibels of this bitcrusher. /** * This is the gain applied to the signal after being sent to the * clipping function. This value is used to modify the final level * of the clipped signal. */ RIM_INLINE Gain getOutputGainDB() const { return util::linearToDB( targetOutputGain ); } /// Set the target linear output gain for this bitcrusher. /** * This is the gain applied to the signal after being sent to the * clipping function. This value is used to modify the final level * of the clipped signal. */ RIM_INLINE void setOutputGain( Gain newOutputGain ) { lockMutex(); targetOutputGain = newOutputGain; unlockMutex(); } /// Set the target output gain in decibels for this bitcrusher. /** * This is the gain applied to the signal after being sent to the * clipping function. This value is used to modify the final level * of the clipped signal. */ RIM_INLINE void setOutputGainDB( Gain newDBOutputGain ) { lockMutex(); targetOutputGain = util::dbToLinear( newDBOutputGain ); unlockMutex(); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Mix Accessor Methods /// Return the ratio of input signal to distorted signal sent to the output of the bitcrusher. /** * Valid mix values are in the range [0,1]. * A mix value of 1 indicates that only the output of the distortion should be * heard at the output, while a value of 0 indicates that only the input of the * distortion should be heard at the output. A value of 0.5 indicates that both * should be mixed together equally at -6dB. */ RIM_INLINE Gain getMix() const { return targetMix; } /// Set the ratio of input signal to distorted signal sent to the output of the bitcrusher. /** * Valid mix values are in the range [0,1]. * A mix value of 1 indicates that only the output of the distortion should be * heard at the output, while a value of 0 indicates that only the input of the * distortion should be heard at the output. A value of 0.5 indicates that both * should be mixed together equally at -6dB. * * The new mix value is clamped to the valid range of [0,1]. */ RIM_INLINE void setMix( Gain newMix ) { lockMutex(); targetMix = math::clamp( newMix, Gain(0), Gain(1) ); unlockMutex(); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Threshold Accessor Methods /// Return the linear full-scale value at which clipping first occurs. RIM_INLINE Gain getThreshold() const { return targetThreshold; } /// Return the full-scale value in decibels at which clipping first occurs. RIM_INLINE Gain getThresholdDB() const { return util::linearToDB( targetThreshold ); } /// Set the linear full-scale value at which clipping first occurs. /** * The value is clamped to the valid range of [0,infinity] before being stored. */ RIM_INLINE void setThreshold( Gain newThreshold ) { lockMutex(); targetThreshold = math::max( newThreshold, Gain(0) ); unlockMutex(); } /// Set the full-scale value in decibels at which clipping first occurs. RIM_INLINE void setThresholdDB( Gain newThresholdDB ) { lockMutex(); targetThreshold = util::dbToLinear( newThresholdDB ); unlockMutex(); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Bit Reduction Accessor Methods /// Return whether or not this bitcrusher's bit reduction stage is enabled. RIM_INLINE Bool getBitReductionIsEnabled() const { return bitReduceEnabled; } /// Set whether or not this bitcrusher's bit reduction stage is enabled. RIM_INLINE void setBitReductionIsEnabled( Bool newBitReduceEnabled ) { lockMutex(); bitReduceEnabled = newBitReduceEnabled; unlockMutex(); } /// Return the amount of dithering that should be applied before bit reduction. /** * Valid dithering amounts are in the range [1,24]. * * This value indicates the number of bits of precision used when reducing * the bit depth of the input signal. */ RIM_INLINE UInt getBitResolution() const { return bitResolution; } /// Set the bit resolution of the bit reduction stage. /** * Valid bit resolutions are in the range [1,24]. * * This value indicates the number of bits of precision used when reducing * the bit depth of the input signal. * * The new bit resolution is clamped to the valid range of [1,24]. */ RIM_INLINE void setBitResolution( UInt newResolution ) { lockMutex(); bitResolution = math::clamp( newResolution, UInt(1), UInt(24) ); unlockMutex(); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Dithering Accessor Methods /// Return whether or not this bitcrusher's dithering stage is enabled. RIM_INLINE Bool getDitherIsEnabled() const { return ditherEnabled; } /// Set whether or not this bitcrusher's dithering stage is enabled. RIM_INLINE void setDitherIsEnabled( Bool newDitherEnabled ) { lockMutex(); ditherEnabled = newDitherEnabled; unlockMutex(); } /// Return the amount of dithering that should be applied before bit reduction. /** * Valid dithering amounts are in the range [0,1]. * * A dither amount of 1 indicates that 100% of the dithering for the current * bit resolution should be applied. A value of 0 indicates that no dithering * should be applied. */ RIM_INLINE Float getDitherAmount() const { return targetDither; } /// Set the amount of dithering that should be applied before bit reduction. /** * Valid dithering amounts are in the range [0,1]. * * A dither amount of 1 indicates that 100% of the dithering for the current * bit resolution should be applied. A value of 0 indicates that no dithering * should be applied. * * The new dithering amount is clamped to the valid range of [0,1]. */ RIM_INLINE void setDitherAmount( Float newDither ) { lockMutex(); targetDither = math::clamp( newDither, Float(0), Float(1) ); unlockMutex(); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Downsampling Accessor Methods /// Return the amount of dithering that should be applied before bit reduction. /** * Valid dithering amounts are in the range [1,24]. * * This value indicates the effective sample rate divisor used. A value of 1 * indicates the current sampling rate is used. A value of 2 indicates the sampling * rate is halved, etc. */ RIM_INLINE UInt getDownsampling() const { return downsampling; } /// Set the amount of downsampling performed. /** * Valid downsampling amounts are in the range [1,24]. * * This value indicates the effective sample rate divisor used. A value of 1 * indicates the current sampling rate is used. A value of 2 indicates the sampling * rate is halved, etc. * * The new downsampling amount is clamped to the valid range of [1,24]. */ RIM_INLINE void setDownsampling( UInt newDownsampling ) { lockMutex(); downsampling = math::clamp( newDownsampling, UInt(1), UInt(24) ); unlockMutex(); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Low Pass Filter Attribute Accessor Methods /// Return whether or not this bitcrusher's low pass filter is enabled. RIM_INLINE Bool getLowPassIsEnabled() const { return lowPassEnabled; } /// Set whether or not this bitcrusher's low pass filter is enabled. RIM_INLINE void setLowPassIsEnabled( Bool newLowPassIsEnabled ) { lockMutex(); lowPassEnabled = newLowPassIsEnabled; unlockMutex(); } /// Return the low pass filter frequency of this bitcrusher. RIM_INLINE Float getLowPassFrequency() const { return lowPassFrequency; } /// Set the low pass filter frequency of this bitcrusher. /** * The new low pass frequency is clamped to the range [0,infinity]. */ RIM_INLINE void setLowPassFrequency( Float newLowPassFrequency ) { lockMutex(); lowPassFrequency = math::max( newLowPassFrequency, Float(0) ); unlockMutex(); } /// Return the low pass filter order of this distortion filter. RIM_INLINE Size getLowPassOrder() const { return lowPassOrder; } /// Set the low pass filter order of this distortion filter. /** * The new low pass order is clamped to the range [1,100]. */ RIM_INLINE void setLowPassOrder( Size newLowPassOrder ) { lockMutex(); lowPassOrder = math::clamp( newLowPassOrder, Size(1), Size(100) ); unlockMutex(); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Filter Attribute Accessor Methods /// Return a human-readable name for this bitcrusher. /** * The method returns the string "Bitcrusher". */ virtual UTF8String getName() const; /// Return the manufacturer name of this bitcrusher. /** * The method returns the string "Headspace Sound". */ virtual UTF8String getManufacturer() const; /// Return an object representing the version of this bitcrusher. virtual SoundFilterVersion getVersion() const; /// Return an object which describes the category of effect that this filter implements. /** * This method returns the value SoundFilterCategory::DISTORTION. */ virtual SoundFilterCategory getCategory() const; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Filter Parameter Accessor Methods /// Return the total number of generic accessible parameters this bitcrusher has. virtual Size getParameterCount() const; /// Get information about the bitcrusher parameter at the specified index. virtual Bool getParameterInfo( Index parameterIndex, FilterParameterInfo& info ) const; /// Get any special name associated with the specified value of an indexed parameter. virtual Bool getParameterValueName( Index parameterIndex, const FilterParameter& value, UTF8String& name ) const; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Public Static Property Objects /// A string indicating the human-readable name of this bitcrusher. static const UTF8String NAME; /// A string indicating the manufacturer name of this bitcrusher. static const UTF8String MANUFACTURER; /// An object indicating the version of this distortion filter. static const SoundFilterVersion VERSION; private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Filter Parameter Value Accessor Methods /// Place the value of the parameter at the specified index in the output parameter. virtual Bool getParameterValue( Index parameterIndex, FilterParameter& value ) const; /// Attempt to set the parameter value at the specified index. virtual Bool setParameterValue( Index parameterIndex, const FilterParameter& value ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Stream Reset Method /// A method which is called whenever the filter's stream of audio is being reset. /** * This method allows the filter to reset all parameter interpolation * and processing to its initial state to avoid coloration from previous * audio or parameter values. */ virtual void resetStream(); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Filter Processing Methods /// Apply a distortion function to the samples in the input frame and write the output to the output frame. virtual SoundFilterResult processFrame( const SoundFilterFrame& inputFrame, SoundFilterFrame& outputFrame, Size numSamples ); /// Apply the specified clipping function to the input buffer, placing the result in the output buffer. template < Float (*clippingFunction)( Float /*input*/, Float /*threshold*/ ) > void processClipping( const SoundBuffer& inputBuffer, SoundBuffer& outputBuffer, Size numSamples ); /// Apply the specified clipping function to the input buffer, placing the result in the output buffer. template < Float (*clippingFunction)( Float /*input*/, Float /*threshold*/ ) > void processClipping( const SoundBuffer& inputBuffer, SoundBuffer& outputBuffer, Size numSamples, Gain inputGainChangePerSample, Float thresholdChangePerSample ); /// Reduce the bit resolution of the audio in the specified buffer, optionally applying dithering and downsampling. template < Bool reductionEnabled, Bool ditherEnabled, Bool downsampleEnabled > void processBitReduction( SoundBuffer& ioBuffer, Size numSamples, Float ditherChangePerSample ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Clipping Functions /// Apply standard hard clipping to the input signal. RIM_FORCE_INLINE static Float clipHard( Float input, Float threshold ) { if ( input > threshold ) return threshold; else if ( input < -threshold ) return -threshold; else return input; } /// Apply a clipping where the waveform is inverted when it goes above the threshold. RIM_FORCE_INLINE static Float clipInvert( Float input, Float threshold ) { Float sign = math::sign(input); Float absIn = sign*input; Float n = math::floor(absIn / threshold); Float remainder = absIn - n*threshold; Float output = absIn; if ( UInt(n) & 0x1 ) { if ( absIn > threshold ) output = threshold - remainder; } else { if ( absIn > threshold ) output = remainder; } return sign*output; } /// Apply a clipping where the waveform is wraps around to 0 when it goes above the threshold. RIM_FORCE_INLINE static Float clipWrap( Float input, Float threshold ) { if ( input > threshold ) return threshold - math::mod( input, threshold ); else if ( input < -threshold ) return -threshold - math::mod( input, threshold ); else return input; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Members /// The current linear input gain factor applied to all input audio before being clipped. Gain inputGain; /// The target linear input gain factor, used to smooth changes in the input gain. Gain targetInputGain; /// The current linear output gain factor applied to all input audio after being clipped. Gain outputGain; /// The target linear output gain factor, used to smooth changes in the output gain. Gain targetOutputGain; /// The current ratio of distorted to unaffected signal that is sent to the output. Float mix; /// The target mix, used to smooth changes in the mix parameter. Float targetMix; /// The type of clipping that this bitcrusher uses. ClipMode clipMode; /// The current threshold which indicates the full-scale threshold at which clipping first occurs. Float threshold; /// The target threshold, used to smooth changes in the threshold parameter. Float targetThreshold; /// The number of bits that the audio signal should be reduced to, between 1 and 24. UInt bitResolution; /// A value between 0 and 1 indicating the amount of dithering to apply to the audio signal. /** * This dither is applied based on the target bit resolution, so a value of 1 will always dither * the most necessary for a given resolution. */ Float dither; /// The target dither amount, used to smooth changes in the dither parameter. Float targetDither; /// The sample rate downsampling amount, an integer indicating the sample rate divisor. UInt downsampling; /// The number of remaining instances of the last sample that should be repeated during the next processing frame. UInt downsampleRemainder; /// The last samples for each channel that should be repeated as part of downsampling. Array<Sample32f> lastSamples; /// A low-pass filter used to smooth the output of the bitcrusher. CutoffFilter* lowPass; /// The frequency at which the low pass filter for the bitcrusher is at -3dB. Float lowPassFrequency; /// The order of the bitcrusher's low pass filter that determines its slope. Size lowPassOrder; /// A boolean value indicating whether or not this bitcrusher's low-pass filter is enabled. Bool lowPassEnabled; /// A boolean value indicating whether or not bit reduction should be performed. Bool bitReduceEnabled; /// A boolean value indicating whether or not a dithering step should be performed. Bool ditherEnabled; }; //########################################################################################## //************************ End Rim Sound Filters Namespace ******************************* RIM_SOUND_FILTERS_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_SOUND_BITCRUSHER_H <file_sep>/* * rimNormalDistribution.h * Rim Math * * Created by <NAME> on 5/8/08. * Copyright 2008 Rim Software. All rights reserved. * */ #ifndef INCLUDE_RIM_NORMAL_DISTRIBUTION_H #define INCLUDE_RIM_NORMAL_DISTRIBUTION_H #include "rimMathConfig.h" #include "rimRandomVariable.h" //########################################################################################## //***************************** Start Rim Math Namespace ********************************* RIM_MATH_NAMESPACE_START //****************************************************************************************** //########################################################################################## template < typename T > class NormalDistribution; /// A class which represents a normal (gaussian) distribution. template <> class NormalDistribution<float> { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructors /// Create a standard normal distribution with mean of 0 and standard deviation 1. RIM_INLINE NormalDistribution() : mean( 0.0f ), standardDeviation( 1.0f ), randomVariable() { } /// Create a standard normal distribution with mean of 0 and standard deviation 1. /** * The created normal distribution will produce samples using the * specified random variable. */ RIM_INLINE NormalDistribution( const RandomVariable<float>& newRandomVariable ) : mean( 0.0f ), standardDeviation( 1.0f ), randomVariable( newRandomVariable ) { } /// Create a normal distribution with the specified mean and standard deviation. RIM_INLINE NormalDistribution( float newMean, float newStandardDeviation ) : mean( newMean ), standardDeviation( newStandardDeviation ), randomVariable() { } /// Create a normal distribution with the specified mean and standard deviation. /** * The created normal distribution will produce samples using the * specified random variable. */ RIM_INLINE NormalDistribution( float newMean, float newStandardDeviation, const RandomVariable<float>& newRandomVariable ) : mean( newMean ), standardDeviation( newStandardDeviation ), randomVariable( newRandomVariable ) { } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Distribution Sample Generation Method /// Generate a sample from the normal distribution. RIM_INLINE float sample() { float a = randomVariable.sample( 0.0f, 1.0f ); float b = randomVariable.sample( 0.0f, 1.0f ); // standard normal random sample float z = math::sqrt( -2.0f*math::ln(a) ) * math::cos( 2.0f*float(math::pi<float>())*b ); // scale and translate the standard normal to match this distribution. return z*standardDeviation + mean; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Distribution Mean Accessor Methods /// Get the mean of the normal distribution. RIM_INLINE float getMean() const { return mean; } /// Set the mean of the normal distribution. RIM_INLINE void setMean( float newMean ) { mean = newMean; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Distribution Standard Deviation Accessor Methods /// Get the standard deviation of the normal distribution. RIM_INLINE float getStandardDeviation() const { return standardDeviation; } /// Set the standard deviation of the normal distribution. RIM_INLINE void setStandardDeviation( float newStandardDeviation ) { standardDeviation = newStandardDeviation; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Random Variable Accessor Methods /// Get the random variable used to generate samples for this distribution. RIM_INLINE RandomVariable<float>& getRandomVariable() { return randomVariable; } /// Get the random variable used to generate samples for this distribution. RIM_INLINE const RandomVariable<float>& getRandomVariable() const { return randomVariable; } /// Set the random variable used to generate samples for this distribution. RIM_INLINE void getRandomVariable( const RandomVariable<float>& newRandomVariable ) { randomVariable = newRandomVariable; } private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Members; /// The mean, or average, of the normal distribution. float mean; /// The standard deviation of the normal distribution. float standardDeviation; /// The random variable that the normal distribution uses to generate samples. RandomVariable<float> randomVariable; }; /// A class which represents a normal (gaussian) distribution. template <> class NormalDistribution<double> { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructors /// Create a standard normal distribution with mean of 0 and standard deviation 1. RIM_INLINE NormalDistribution() : mean( 0.0f ), standardDeviation( 1.0f ), randomVariable() { } /// Create a standard normal distribution with mean of 0 and standard deviation 1. /** * The created normal distribution will produce samples using the * specified random variable. */ RIM_INLINE NormalDistribution( const RandomVariable<double>& newRandomVariable ) : mean( 0.0f ), standardDeviation( 1.0f ), randomVariable( newRandomVariable ) { } /// Create a normal distribution with the specified mean and standard deviation. RIM_INLINE NormalDistribution( double newMean, double newStandardDeviation ) : mean( newMean ), standardDeviation( newStandardDeviation ), randomVariable() { } /// Create a normal distribution with the specified mean and standard deviation. /** * The created normal distribution will produce samples using the * specified random variable. */ RIM_INLINE NormalDistribution( double newMean, double newStandardDeviation, const RandomVariable<double>& newRandomVariable ) : mean( newMean ), standardDeviation( newStandardDeviation ), randomVariable( newRandomVariable ) { } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Distribution Sample Generation Method /// Generate a sample from the normal distribution. RIM_INLINE double sample() { double a = randomVariable.sample( 0.0f, 1.0f ); double b = randomVariable.sample( 0.0f, 1.0f ); // standard normal random sample double z = math::sqrt( -2.0f*math::ln(a) ) * math::cos( 2.0f*math::pi<double>()*b ); // scale and translate the standard normal to match this distribution. return z*standardDeviation + mean; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Distribution Mean Accessor Methods /// Get the mean of the normal distribution. RIM_INLINE double getMean() const { return mean; } /// Set the mean of the normal distribution. RIM_INLINE void setMean( double newMean ) { mean = newMean; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Distribution Standard Deviation Accessor Methods /// Get the standard deviation of the normal distribution. RIM_INLINE double getStandardDeviation() const { return standardDeviation; } /// Set the standard deviation of the normal distribution. RIM_INLINE void setStandardDeviation( double newStandardDeviation ) { standardDeviation = newStandardDeviation; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Random Variable Accessor Methods /// Get the random variable used to generate samples for this distribution. RIM_INLINE RandomVariable<double>& getRandomVariable() { return randomVariable; } /// Get the random variable used to generate samples for this distribution. RIM_INLINE const RandomVariable<double>& getRandomVariable() const { return randomVariable; } /// Set the random variable used to generate samples for this distribution. RIM_INLINE void getRandomVariable( const RandomVariable<double>& newRandomVariable ) { randomVariable = newRandomVariable; } private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Members; /// The mean, or average, of the normal distribution. double mean; /// The standard deviation of the normal distribution. double standardDeviation; /// The random variable that the normal distribution uses to generate samples. RandomVariable<double> randomVariable; }; //########################################################################################## //***************************** End Rim Math Namespace *********************************** RIM_MATH_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_NORMAL_DISTRIBUTION_H <file_sep>/* * rimGraphicsTextureUsage.h * Rim Graphics * * Created by <NAME> on 11/27/11. * Copyright 2011 __MyCompanyName__. All rights reserved. * */ #ifndef INCLUDE_RIM_GRAPHICS_TEXTURE_USAGE_H #define INCLUDE_RIM_GRAPHICS_TEXTURE_USAGE_H #include "rimGraphicsTexturesConfig.h" #include "rimGraphicsTexture.h" #include "rimGraphicsTextureType.h" //########################################################################################## //********************** Start Rim Graphics Textures Namespace *************************** RIM_GRAPHICS_TEXTURES_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class which specifies how a texture is semantically used for rendering. /** * Each instance allows the user to specify an enum value indicating the * type of usage and also an integral index for that usage. This allows the user * to specify multiple color map usages, for instance. */ class TextureUsage { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Texture Usage Enum Definition typedef enum Enum { /// An unfefined texture usage. UNDEFINED = 0, /// A usage which specifies that the texture is used as an ambient color texture map. AMBIENT_COLOR_MAP, /// A usage which specifies that the texture is used as a diffuse color texture map. DIFFUSE_COLOR_MAP, /// A usage which specifies that the texture is used as a specular color texture map. SPECULAR_COLOR_MAP, /// A usage which specifies that the texture is used as an object's normal map. NORMAL_MAP, /// A usage which specifies that the texture is used as an object's height/displacement map. DISPLACEMENT_MAP, /// A usage which specifies that the texture is used as an object's height/displacement map. HEIGHT_MAP = DISPLACEMENT_MAP, /// A usage which specifies that the texture is used as an object's environment map. ENVIRONMENT_MAP, /// A usage which specifies that the texture is used as a scene's light map. LIGHT_MAP, /// A usage which specifies that the texture is used as a directional light shadow map. DIRECTIONAL_LIGHT_SHADOW_MAP, /// A usage for the closest shadow map cascade to the camera. DIRECTIONAL_LIGHT_CSM_0, DIRECTIONAL_LIGHT_CSM_1 = DIRECTIONAL_LIGHT_CSM_0 + 1, DIRECTIONAL_LIGHT_CSM_2 = DIRECTIONAL_LIGHT_CSM_0 + 2, DIRECTIONAL_LIGHT_CSM_3 = DIRECTIONAL_LIGHT_CSM_0 + 3, DIRECTIONAL_LIGHT_CSM_4 = DIRECTIONAL_LIGHT_CSM_0 + 4, DIRECTIONAL_LIGHT_CSM_5 = DIRECTIONAL_LIGHT_CSM_0 + 5, DIRECTIONAL_LIGHT_CSM_6 = DIRECTIONAL_LIGHT_CSM_0 + 6, DIRECTIONAL_LIGHT_CSM_7 = DIRECTIONAL_LIGHT_CSM_0 + 7, /// A usage for a texture array of directional light shadow map cascades. DIRECTIONAL_LIGHT_CSM_ARRAY, /// A usage which specifies that the texture is used as a point light shadow cube map. POINT_LIGHT_SHADOW_CUBE_MAP, /// A usage which specifies that the texture is used as a spot light shadow map. SPOT_LIGHT_SHADOW_MAP }; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructors /// Create a new texture usage with the specified texture usage enum value. RIM_INLINE TextureUsage( Enum newUsage ) : usage( newUsage ), index( 0 ) { } /// Create a new texture usage with the specified texture usage enum value and index. RIM_INLINE TextureUsage( Enum newUsage, Index newIndex ) : usage( newUsage ), index( (UInt16)newIndex ) { } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Enum Cast Operator /// Convert this texture usage to an enum value. RIM_INLINE operator Enum () const { return (Enum)usage; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Equality Comparison Operators /// Return whether or not this texture usage is the same as another. /** * This operator does not compare any usage index, just the usage type. */ RIM_INLINE Bool operator == ( const TextureUsage::Enum otherEnum ) const { return usage == otherEnum; } /// Return whether or not this texture usage is the same as another. RIM_INLINE Bool operator == ( const TextureUsage& other ) const { return *((UInt32*)this) == *((UInt32*)&other); } /// Return whether or not this texture usage is different than another. /** * This operator does not compare any usage index, just the usage type. */ RIM_INLINE Bool operator != ( const TextureUsage::Enum otherEnum ) const { return usage != otherEnum; } /// Return whether or not this texture usage is different than another. RIM_INLINE Bool operator != ( const TextureUsage& other ) const { return *((UInt32*)this) != *((UInt32*)&other); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Shader Attribute Type Accessor Method /// Return whether or not the specified texture type is a valid type for this usage. Bool isValidType( const TextureType& type ) const; /// Return whether or not the specified texture is a valid type for this usage. Bool isValidType( const Texture& texture ) const; /// Return whether or not this texture usage represents a shadow map (depth texture) format. Bool isAShadowMap() const; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Index Accessor Methods /// Return an index for the shader attribute usage. /** * This value allows the user to keep track of multiple distinct * usages separately (i.e. for multiple color maps) that have the * same usage type. */ RIM_FORCE_INLINE Index getIndex() const { return index; } /// Return an index for the shader attribute usage. /** * This value allows the user to keep track of multiple distinct * usages separately (i.e. for multiple color maps) that have the * same usage type. */ RIM_FORCE_INLINE void setIndex( Index newIndex ) { index = (UInt16)newIndex; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** String Representation Accessor Methods /// Return a texture usage which corresponds to the given enum string. static TextureUsage fromEnumString( const String& enumString ); /// Return a unique string for this texture usage that matches its enum value name. String toEnumString() const; /// Return a string representation of the texture usage. String toString() const; /// Convert this texture usage into a string representation. RIM_FORCE_INLINE operator String () const { return this->toString(); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Hash Code Accessor Method /// Return a hash code for this texture usage. RIM_FORCE_INLINE Hash getHashCode() const { return Hash(usage)*14111677 + Hash(index); } private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Members /// An enum for the texture usage. UInt16 usage; /// The index of the usage specified by the enum value. /** * This value allows the user to keep track of multiple distinct * usages separately (i.e. for multiple color maps) that have the * same usage type. */ UInt16 index; }; //########################################################################################## //********************** End Rim Graphics Textures Namespace ***************************** RIM_GRAPHICS_TEXTURES_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_GRAPHICS_TEXTURE_USAGE_H <file_sep>/* * rimPhysicsConfig.h * Rim Physics * * Created by <NAME> on 6/7/08. * Copyright 2008 Rim Software. All rights reserved. * */ #ifndef INCLUDE_RIM_PHYSICS_COLLISION_CONFIG_H #define INCLUDE_RIM_PHYSICS_COLLISION_CONFIG_H #include "../rimPhysicsConfig.h" #include "../rimPhysicsShapes.h" #include "../rimPhysicsObjects.h" #include "../rimPhysicsUtilities.h" //########################################################################################## //########################################################################################## //############ //############ Library Namespace Configuration //############ //########################################################################################## //########################################################################################## #ifndef RIM_PHYSICS_COLLISION_NAMESPACE_START #define RIM_PHYSICS_COLLISION_NAMESPACE_START RIM_PHYSICS_NAMESPACE_START namespace collision { #endif #ifndef RIM_PHYSICS_COLLISION_NAMESPACE_END #define RIM_PHYSICS_COLLISION_NAMESPACE_END }; RIM_PHYSICS_NAMESPACE_END #endif //########################################################################################## //********************** Start Rim Physics Collision Namespace *************************** RIM_PHYSICS_COLLISION_NAMESPACE_START //****************************************************************************************** //########################################################################################## using namespace rim::physics::shapes; using rim::physics::objects::RigidObject; using rim::physics::objects::ObjectPair; using rim::physics::objects::ObjectCollider; using rim::physics::util::MinkowskiVertex3; using rim::physics::util::GJKSolver; using rim::physics::util::EPASolver; using rim::physics::util::EPAResult; using rim::physics::util::IntersectionPoint; //########################################################################################## //********************** End Rim Physics Collision Namespace ***************************** RIM_PHYSICS_COLLISION_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_PHYSICS_COLLISION_CONFIG_H <file_sep>/* * rimPhysicsScene.h * Rim Physics * * Created by <NAME> on 6/1/12. * Copyright 2012 __MyCompanyName__. All rights reserved. * */ #ifndef INCLUDE_RIM_PHYSICS_SCENE_H #define INCLUDE_RIM_PHYSICS_SCENE_H #include "rimPhysicsScenesConfig.h" //########################################################################################## //*********************** Start Rim Physics Scenes Namespace ***************************** RIM_PHYSICS_SCENES_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// An interface for classes that handle all aspects of physics simulation. class PhysicsScene { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Destructor /// Destroy this physics scene. virtual ~PhysicsScene() { } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Simulation Update Methods /// Update the physics simulation for this physics scene for the specified timestep. virtual void update( Real dt ) = 0; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Rigid Object Accessor Methods /// Add the specified rigid object to this PhysicsScene. /** * If the specified rigid object pointer is NULL, the * physics scene is unchanged. */ virtual void addRigidObject( RigidObject* rigidObject ) = 0; /// Remove the specified rigid object from this PhysicsScene. /** * If this detector contains the specified rigid object, the * object is removed from the physics scene and TRUE is returned. * Otherwise, if the rigid object is not found, FALSE is returned * and the physics scene is unchanged. */ virtual Bool removeRigidObject( RigidObject* rigidObject ) = 0; /// Remove all rigid objects from this PhysicsScene. virtual void removeRigidObjects() = 0; /// Return whether or not the specified rigid object is contained in this PhysicsScene. /** * If this PhysicsScene contains the specified rigid object, TRUE is returned. * Otherwise, if the rigid object is not found, FALSE is returned. */ virtual Bool containsRigidObject( RigidObject* rigidObject ) const = 0; /// Return the number of rigid objects that are contained in this PhysicsScene. virtual Size getRigidObjectCount() const = 0; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Force Field Accessor Methods /// Add the specified force field to this physics scene. /** * If the specified force field pointer is not equal to NULL, * it is added to this physics scene. Otherwise, the physics * scene is unchanged. */ virtual void addForceField( ForceField* forceField ) = 0; /// Remove the specified force field from this PhysicsScene. /** * If this detector contains the specified force field, the * field is removed from the physics scene and TRUE is returned. * Otherwise, if the force field is not found, FALSE is returned * and the physics scene is unchanged. */ virtual Bool removeForceField( ForceField* forceField ) = 0; /// Remove all force fields from this PhysicsScene. virtual void removeForceFields() = 0; /// Return whether or not the specified force field is contained in this PhysicsScene. /** * If this PhysicsScene contains the specified force field, TRUE is returned. * Otherwise, if the force field is not found, FALSE is returned. */ virtual Bool containsForceField( ForceField* forceField ) const = 0; /// Return the number of force fields that are contained in this PhysicsScene. virtual Size getForceFieldCount() const = 0; }; //########################################################################################## //*********************** End Rim Physics Scenes Namespace ******************************* RIM_PHYSICS_SCENES_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_PHYSICS_SCENE_H <file_sep>/* * rimGraphicsViewport.h * Rim Graphics * * Created by <NAME> on 6/7/08. * Copyright 2008 Rim Software. All rights reserved. * */ #ifndef INCLUDE_RIM_GRAPHICS_VIEWPORT_H #define INCLUDE_RIM_GRAPHICS_VIEWPORT_H #include "rimGraphicsUtilitiesConfig.h" //########################################################################################## //********************** Start Rim Graphics Utilities Namespace ************************** RIM_GRAPHICS_UTILITIES_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class which represents a rectangular axis-aligned portion of the screen which should be rendered to. /** * During rendering, all output is rendered to only the area of the framebuffer * specified by the current viewport, the rest is clipped to the outer edge of the * viewport. This viewport is given in terms of a rectangular axis-aligned region * where (0,0) is the lower left corner of the framebuffer, and (1,1) is the upper-right * corner of the framebuffer. */ class Viewport { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructors /// Create a new viewport which covers the entire framebuffer. RIM_INLINE Viewport() : bounds( 0, 1, 0, 1 ) { } /// Create a new viewport with the specified width and height with lower left corner at (0,0). RIM_INLINE Viewport( Float width, Float height ) : bounds( 0, width, 0, height ) { } /// Create a new viewport which uses the area defined by the given min and max coordinates for each axis. RIM_INLINE Viewport( Float xMin, Float xMax, Float yMin, Float yMax ) : bounds( xMin, xMax, yMin, yMax ) { } /// Create a new viewport which uses the specified minimum and maximum points to define its bounds. RIM_INLINE Viewport( const Vector2f& min, const Vector2f& max ) : bounds( min, max ) { } /// Create a new viewport which uses the specified 2D axis-aligned box to define its bounds. RIM_INLINE Viewport( const AABB2f& newBounds ) : bounds( newBounds ) { } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Size Accessor Methods /// Return the width of this viewport as a fraction of the framebuffer's width. RIM_INLINE Real getWidth() const { return bounds.getWidth(); } /// Return the height of this viewport as a fraction of the framebuffer's height. RIM_INLINE Real getHeight() const { return bounds.getHeight(); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Position Accessor Methods /// Return the position of this viewport's lower left corner on the framebuffer. RIM_INLINE Vector2f getPosition() const { return Vector2f( bounds.min.x, bounds.min.y ); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Bounding Box Accessor Methods /// Convert this viewport to a 2D axis-aligned bounding box representing the viewport's bounds. RIM_INLINE operator const AABB2f& () const { return bounds; } /// Return a 2D axis-aligned bounding box representing the bounds of this viewport. RIM_INLINE const AABB2f& getBounds() const { return bounds; } /// Set a 2D axis-aligned bounding box representing the bounds of this viewport. RIM_INLINE void setBounds( const AABB2f& newBounds ) { bounds = newBounds; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Comparison Operators /// Return whether or not this viewport is exactly the same as another. RIM_INLINE Bool operator == ( const Viewport& other ) const { return bounds == other.bounds; } /// Return whether or not this viewport is diferent than another. RIM_INLINE Bool operator != ( const Viewport& other ) const { return bounds != other.bounds; } private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Members /// A 2D axis-aligned bounding box representing the minimum and maximum coordinates for this viewport. /** * Coordinates are specified where (0,0) is the lower left corner of the framebuffer, * and (1,1) is the upper-right corner of the framebuffer. */ AABB2f bounds; }; //########################################################################################## //********************** End Rim Graphics Utilities Namespace **************************** RIM_GRAPHICS_UTILITIES_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_GRAPHICS_VIEWPORT_H <file_sep>/* * rimGraphicsOpenGLShaderProgram.h * Rim Graphics * * Created by <NAME> on 3/2/13. * Copyright 2013 __MyCompanyName__. All rights reserved. * */ #ifndef INCLUDE_RIM_GRAPHICS_OPENGL_SHADER_PROGRAM_H #define INCLUDE_RIM_GRAPHICS_OPENGL_SHADER_PROGRAM_H #include "rimGraphicsOpenGLConfig.h" //########################################################################################## //******************** Start Rim Graphics Devices OpenGL Namespace *********************** RIM_GRAPHICS_DEVICES_OPENGL_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class which represents an OpenGL hardware-executed shading program. class OpenGLShaderProgram : public ShaderProgram { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Destructor /// Destroy this shader program and release all resources associated with it. ~OpenGLShaderProgram(); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Shader Accessor Methods /// Return the total number of shaders that are attached to this shader program. virtual Size getShaderCount() const; /// Return a pointer to the shader object attached at the specified index to the shader program. /** * Shader indices range from 0 for the first attached shader to N for the * Nth attached shader. */ virtual Pointer<Shader> getShader( Index shaderIndex ) const; /// Attach the specified shader to this shader program. /** * The method returns whether or not the new shader was able to be attached. * The method can fail if the shader pointer is NULL, the shader was not able * to be compiled, or if there was an internal error. * * If the method succeeds, the shader program will need to be re-linked * before it can be used. */ virtual Bool addShader( const Pointer<Shader>& newShader ); /// Detach the shader at the specified index from this shader program. /** * The method returns whether or not the shader was able to be removed. * * If the method succeeds, the shader program will need to be re-linked * before it can be used. */ virtual Bool removeShader( Index shaderIndex ); /// Detach the shader with the specified address from this shader program. /** * The method returns whether or not the shader was able to be removed. * * If the method succeeds, the shader program will need to be re-linked * before it can be used. */ virtual Bool removeShader( const Shader* shader ); /// Remove all shaders that are attached to this shader program. /** * Shaders will need to be attatched to an empty program before * it can be used again. */ virtual void clearShaders(); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Shader Program Link Method /// Link the vertex and fragment shaders into a useable shader program. /** * The return value indicates wether or not the link operation was successful. */ Bool link(); /// Link the vertex and fragment shaders into a useable shader program. /** * The return value indicates wether or not the link operation was successful. * If an error was encountered during the link process, the linker's output * is written to the link log parameter. */ Bool link( String& linkLog ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Program Status Accessor Method /// Return whether or not a link operation has been attempted on this shader program. virtual Bool isLinked() const; /// Return whether or not the shader program was linked successfully and is ready for use. virtual Bool isValid() const; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constant Variable Accessor Methods /// Return the total number of constant variables that are part of this shader program. virtual Size getConstantVariableCount() const; /// Return a pointer to the constant variable for this shader program at the given index. /** * Variable indices range from 0 up to the number of constant variables minus one. * If an invalid variable index is specified, NULL is returned. */ virtual const ConstantVariable* getConstantVariable( Index variableIndex ) const; /// Get the constant variable that is part of this shader program with the specified name. /** * The constant variable, if found, is placed in the output reference parameter. * The method returns whether or not this shader program has a variable with * the given variable name. */ virtual Bool getConstantVariable( const String& variableName, const ConstantVariable*& variable ) const; /// Get the constant variable index for this shader program with the specified name. /** * The constant variable's index, if found, is placed in the output reference parameter. * The method returns whether or not this shader program has a variable with * the given variable name. */ virtual Bool getConstantVariableIndex( const String& variableName, Index& variableIndex ) const; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Texture Variable Accessor Methods /// Return the total number of texture variables that are part of this shader program. virtual Size getTextureVariableCount() const; /// Return a pointer to the texture variable for this shader program at the given index. /** * Variable indices range from 0 up to the number of texture variables minus one. * If an invalid variable index is specified, NULL is returned. */ virtual const TextureVariable* getTextureVariable( Index variableIndex ) const; /// Get the texture variable that is part of this shader program with the specified name. /** * The texture variable, if found, is placed in the output reference parameter. * The method returns whether or not this shader program has a variable with * the given variable name. */ virtual Bool getTextureVariable( const String& variableName, const TextureVariable*& variable ) const; /// Get the texture variable index for this shader program with the specified name. /** * The texture variable's index, if found, is placed in the output reference parameter. * The method returns whether or not this shader program has a variable with * the given variable name. */ virtual Bool getTextureVariableIndex( const String& variableName, Index& variableIndex ) const; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Vertex Variable Accessor Methods /// Return the total number of vertex variables that are part of this shader program. virtual Size getVertexVariableCount() const; /// Return a pointer to the vertex variable for this shader program at the given index. /** * Variable indices range from 0 up to the number of vertex variables minus one. * If an invalid variable index is specified, NULL is returned. */ virtual const VertexVariable* getVertexVariable( Index variableIndex ) const; /// Get the vertex variable that is part of this shader program with the specified name. /** * The vertex variable, if found, is placed in the output reference parameter. * The method returns whether or not this shader program has a variable with * the given variable name. */ virtual Bool getVertexVariable( const String& variableName, const VertexVariable*& variable ) const; /// Get the vertex variable index for this shader program with the specified name. /** * The vertex variable's index, if found, is placed in the output reference parameter. * The method returns whether or not this shader program has a variable with * the given variable name. */ virtual Bool getVertexVariableIndex( const String& variableName, Index& variableIndex ) const; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Shader Program ID Accessor Method /// Get a unique integral identifier for this shader program. RIM_INLINE OpenGLID getID() const { return programID; } private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Friend Declaration /// Make the shader program class a friend so that it can create instances of this class. friend class OpenGLContext; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Class Declaration /// An enum which describes the kind of a particular variable. typedef enum VariableType { CONSTANT_VARIABLE, TEXTURE_VARIABLE, VERTEX_VARIABLE }; /// A class which encapsulates an index and variable type. class VariableIndex { public: /// Create a new variable index with the specified variable type and index. RIM_INLINE VariableIndex( VariableType newType, Index newIndex ) : type( newType ), index( newIndex ) { } /// An enum value which describes the kind of variable this index is for. VariableType type; /// The index of the variable within the list of this index's variable type. Index index; }; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Constructors /// Create a shader program for the given context with no shaders attached to it. OpenGLShaderProgram( const GraphicsContext* context ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Helper Methods /// Query the shader for information about its attribute variables and store it in the shader program. void cacheShaderVariables(); /// Clear all previously cached shader variables from this shader program. RIM_INLINE void clearCachedVariables(); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Members /// An integer ID from OpenGL uniquely representing this shader program. OpenGLID programID; /// A list of the shader objects that are attached to this shader program. ArrayList< Pointer<Shader> > shaders; /// A list of the constant variables that are part of this shader program. ArrayList<ConstantVariable> constantVariables; /// A list of the texture variables that are part of this shader program. ArrayList<TextureVariable> textureVariables; /// A list of the per-vertex attribute variables that are part of this shader program. ArrayList<VertexVariable> vertexVariables; /// A hash map from variable names to HashMap<String,VariableIndex> variableNames; /// A boolean value which indicates whether or not the shader program has been linked successfully. Bool linked; /// A boolean value which indicates whether or not this shader program was created successfully. Bool valid; }; //########################################################################################## //******************** End Rim Graphics Devices OpenGL Namespace ************************* RIM_GRAPHICS_DEVICES_OPENGL_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_GRAPHICS_OPENGL_SHADER_PROGRAM_H <file_sep>/* * rimGraphicsCylinderShape.h * Rim Graphics * * Created by <NAME> on 6/7/12. * Copyright 2012 __MyCompanyName__. All rights reserved. * */ #ifndef INCLUDE_RIM_GRAPHICS_CYLINDER_SHAPE_H #define INCLUDE_RIM_GRAPHICS_CYLINDER_SHAPE_H #include "rimGraphicsShapesConfig.h" #include "rimGraphicsShapeBase.h" #include "rimGraphicsLODShape.h" //########################################################################################## //*********************** Start Rim Graphics Shapes Namespace **************************** RIM_GRAPHICS_SHAPES_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class which provides a simple means to draw a 3D cylinder shape. /** * A cylinder can have different radii that cause it to instead be a * truncated cone. * * This class handles all vertex and index buffer generation automatically, * simplifying the visualization of cylinders, such as for collision geometry. * Internally, this class automatically chooses the proper geometric level of * detail for the cylinder representation in order to acheive nearly pixel-perfect * accuracy when rendering from any perspective. */ class CylinderShape : public GraphicsShapeBase<CylinderShape> { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructors /// Create a cylinder shape centered at the origin with a radius and height of 1. CylinderShape( const Pointer<GraphicsContext>& context ); /// Create a cylinder shape with the specified endpoints and radius. CylinderShape( const Pointer<GraphicsContext>& context, const Vector3& newEndpoint1, const Vector3& newEndpoint2, Real newRadius ); /// Create a cylinder shape with the specified endpoints and radii. CylinderShape( const Pointer<GraphicsContext>& context, const Vector3& newEndpoint1, const Vector3& newEndpoint2, Real newRadius1, Real newRadius2 ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Endpoint Accessor Methods /// Return a const reference to the center of this cylinder shape's first endcap in local coordinates. RIM_FORCE_INLINE const Vector3& getEndpoint1() const { return endpoint1; } /// Set the center of this cylinder shape's first endcap in local coordinates. void setEndpoint1( const Vector3& newEndpoint1 ); /// Return a const reference to the center of this cylinder shape's second endcap in local coordinates. RIM_FORCE_INLINE const Vector3& getEndpoint2() const { return endpoint2; } /// Set the center of this cylinder shape's second endcap in local coordinates. void setEndpoint2( const Vector3& newEndpoint2 ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Axis Accessor Methods /// Return a normalized axis vector for this cylinder, directed from endpoint 1 to endpoint 2. RIM_FORCE_INLINE const Vector3& getAxis() const { return axis; } /// Set a normalized axis vector for this cylinder, directed from endpoint 1 to endpoint 2. /** * Setting this cylinder's axis keeps the cylinder's first endpoint stationary in shape * space and moves the second endpoint based on the new axis and cylinder's height. */ void setAxis( const Vector3& newAxis ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Height Accessor Methods /// Get the distance between the endpoints of this cylinder shape in local coordinates. RIM_FORCE_INLINE Real getHeight() const { return height; } /// Set the distance between the endpoints of this cylinder shape in local coordinates. /** * The value is clamed to the range of [0,+infinity). Setting this height value * causes the cylilnder's second endpoint to be repositioned, keeping the first * endpoint stationary, based on the cylinder's current axis vector. */ void setHeight( Real newHeight ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Radius Accessor Methods /// Get the first endcap radius of this cylinder shape in local coordinates. RIM_FORCE_INLINE Real getRadius1() const { return radius1; } /// Set the first endcap radius of this cylinder shape in local coordinates. /** * The radius is clamed to the range of [0,+infinity). */ void setRadius1( Real newRadius1 ); /// Get the second endcap radius of this cylinder shape in local coordinates. RIM_FORCE_INLINE Real getRadius2() const { return radius2; } /// Set the second endcap radius of this cylinder shape in local coordinates. /** * The radius is clamed to the range of [0,+infinity). */ void setRadius2( Real newRadius2 ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Material Accessor Methods /// Get the material of this cylinder shape. RIM_INLINE Pointer<Material>& getMaterial() { return material; } /// Get the material of this cylinder shape. RIM_INLINE const Pointer<Material>& getMaterial() const { return material; } /// Set the material of this cylinder shape. RIM_INLINE void setMaterial( const Pointer<Material>& newMaterial ) { material = newMaterial; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Context Accessor Methods /// Return a pointer to the graphics contet which is being used to create this cylinder shape. RIM_INLINE const Pointer<GraphicsContext>& getContext() const { return context; } /// Change the graphics context which is used to create this cylinder shape. /** * Calling this method causes the previously generated cylinder geometry to * be discarded and regenerated using the new context. */ void setContext( const Pointer<GraphicsContext>& newContext ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Level of Detail Accessor Methods /// Get the level of detail which should be used when the cylinder has the specified screen-space radius. Pointer<GraphicsShape> getLevelForPixelRadius( Real pixelRadius ) const; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Level Of Detail Bias Accessor Methods /// Get a value which multiplicatively biases the size of a pixel radius query. RIM_INLINE Real getLODBias() const { return lodShape.getLODBias(); } /// Set a value which multiplicatively biases the size of a pixel radius query. RIM_INLINE void setLODBias( Real newLODBias ) { lodShape.setLODBias( newLODBias ); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Bounding Volume Accessor Methods /// Update the cylinder's axis-aligned bounding box. virtual void updateBoundingBox(); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Shape Chunk Accessor Method /// Process the shape into a flat list of mesh chunk objects. /** * This method flattens the shape hierarchy and produces mesh chunks * for rendering from the specified camera's perspective. The method * converts its internal representation into one or more MeshChunk * objects which it appends to the specified output list of mesh chunks. * * The method returns whether or not the shape was successfully flattened * into chunks. */ virtual Bool getChunks( const Transform3& worldTransform, const Camera& camera, const ViewVolume* viewVolume, const Vector2D<Size>& viewportSize, ArrayList<MeshChunk>& chunks ) const; private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Helper Methods /// Generate a cylinder mesh instance with the specified subdivision level and material. /** * The first subdivision level is a square cylinder, and each addition subdivision * level doubles the number of radial division on the sphere, * effectivly doubling the triangle count for each additional subdivision. */ Pointer<GraphicsShape> getSubdivision( Size subdivisionLevel ) const; /// Return the point on this cylinder that is farthest in the specified direction. Vector3 getSupportPoint( const Vector3& direction ) const; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Static Data Members /// The maximum allowed cylinder subdivision. static const Size MAXIMUM_SUBDIVISION_LEVEL = 7; /// The predetermined pixel radii for the different subdivision levels. static const Real subdivisionPixelRadii[MAXIMUM_SUBDIVISION_LEVEL + 2]; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Members /// The center of the first circular cap of this cylinder in shape coordinates. Vector3 endpoint1; /// The center of the second circular cap of this cylinder in shape coordiantes. Vector3 endpoint2; /// The normalized axis vector for this cylinder in shape coordinates. Vector3 axis; /// The radius of the first endcap of this sphere in shape coordinates. Real radius1; /// The radius of the second endcap of this sphere in shape coordinates. Real radius2; /// The distance from one endpoint to another. Real height; /// The largest amount that this cylinder has been subdivided. mutable Size largestSubdivision; /// The graphics context which is used to create this cylinder shape. Pointer<GraphicsContext> context; /// The cylinder shape's material. Pointer<Material> material; /// An LODShape object that holds the levels of detail for this cylinder. mutable LODShape lodShape; }; //########################################################################################## //*********************** End Rim Graphics Shapes Namespace ****************************** RIM_GRAPHICS_SHAPES_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_GRAPHICS_CYLINDER_SHAPE_H <file_sep>/* * rimGraphicsUtilitesConfig.h * Rim Graphics * * Created by <NAME> on 11/28/11. * Copyright 2011 __MyCompanyName__. All rights reserved. * */ #ifndef INCLUDE_RIM_GRAPHICS_UTILITIES_CONFIG_H #define INCLUDE_RIM_GRAPHICS_UTILITIES_CONFIG_H #include "../rimGraphicsConfig.h" //########################################################################################## //########################################################################################## //############ //############ Library Namespace Configuration //############ //########################################################################################## //########################################################################################## #ifndef RIM_GRAPHICS_UTILITIES_NAMESPACE_START #define RIM_GRAPHICS_UTILITIES_NAMESPACE_START RIM_GRAPHICS_NAMESPACE_START namespace util { #endif #ifndef RIM_GRAPHICS_UTILITIES_NAMESPACE_END #define RIM_GRAPHICS_UTILITIES_NAMESPACE_END }; RIM_GRAPHICS_NAMESPACE_END #endif //########################################################################################## //********************** Start Rim Graphics Utilities Namespace ************************** RIM_GRAPHICS_UTILITIES_NAMESPACE_START //****************************************************************************************** //########################################################################################## using rim::util::allocate; using rim::util::deallocate; using rim::util::construct; using rim::util::destruct; using rim::util::constructArray; using rim::util::destructArray; using rim::util::copy; using rim::images::Color3D; using rim::images::Color4D; //########################################################################################## //********************** End Rim Graphics Utilities Namespace **************************** RIM_GRAPHICS_UTILITIES_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_GRAPHICS_UTILITIES_CONFIG_H <file_sep>/* * rimPhysicsCollisionShapeConvex.h * Rim Physics * * Created by <NAME> on 6/6/12. * Copyright 2012 __MyCompanyName__. All rights reserved. * */ #ifndef INCLUDE_RIM_PHYSICS_COLLISION_SHAPE_CONVEX_H #define INCLUDE_RIM_PHYSICS_COLLISION_SHAPE_CONVEX_H #include "rimPhysicsShapesConfig.h" #include "rimPhysicsCollisionShape.h" #include "rimPhysicsCollisionShapeBase.h" #include "rimPhysicsCollisionShapeInstance.h" //########################################################################################## //************************ Start Rim Physics Shapes Namespace **************************** RIM_PHYSICS_SHAPES_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class which represents a convex polyhedral collision shape. class CollisionShapeConvex : public CollisionShapeBase<CollisionShapeConvex> { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Public Class Declarations class Instance; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructors /// Create an empty convex hull shape with no vertices. CollisionShapeConvex(); /// Create a convex hull shape from the specified array of vertices. CollisionShapeConvex( const PhysicsVertex3* vertices, Size numVertices ); /// Create a convex hull shape from the specified array of vertices. CollisionShapeConvex( const ArrayList<PhysicsVertex3>& vertices ); /// Create a convex shape from the specified convex hull representation. CollisionShapeConvex( const ConvexHull& convexHull ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Convex Hull Accessor Methods /// Return a const reference to the convex hull which defines this convex shape. RIM_INLINE const ConvexHull& getConvexHull() const { return convexHull; } /// Return a const reference to the convex hull which defines this convex shape. void setConvexHull( const ConvexHull& newConvexHull ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Vertex Accessor Methods /// Return the number of vertices that define the convex hull of this convex shape. RIM_INLINE Size getVertexCount() const { return convexHull.getVertexCount(); } /// Return the vertex at the specified index in this convex shape. RIM_INLINE const ConvexHull::Vertex& getVertex( Index index ) const { return convexHull.getVertex( index ); } /// Replace this convex shape's convex hull with one built from the specified vertices. void setVertices( const ArrayList<Vector3>& newVertices ); /// Replace this convex shape's convex hull with one built from the specified vertices. void setVertices( const Vector3* newVertices, Size numVertices ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Triangle Accessor Methods /// Return the number of triangles that define the surface of the convex hull of this convex shape. RIM_INLINE Size getTriangleCount() const { return convexHull.getTriangleCount(); } /// Return the triangle at the specified index in this convex shape. RIM_INLINE const ConvexHull::Triangle& getTriangle( Index index ) const { return convexHull.getTriangle( index ); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Supporting Vertex Accessor Method /// Determine which vertex on this convex shape's hull is farthest in the specified direction. /** * If the convex hull of this convex shape has no points, the origin is returned. */ RIM_INLINE const PhysicsVertex3& getSupportVertex( const Vector3& direction ) const { lastSupportVertex = convexHull.getSupportVertexIndex( direction, lastSupportVertex ); if ( lastSupportVertex < convexHull.getVertexCount() ) return convexHull.getVertex(lastSupportVertex).getPosition(); else return PhysicsVertex3::ZERO; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Mass Distribution Accessor Methods /// Return a 3x3 matrix for the inertia tensor of this shape relative to its center of mass. virtual Matrix3 getInertiaTensor() const; /// Return a 3D vector representing the center-of-mass of this shape in its coordinate frame. virtual Vector3 getCenterOfMass() const; /// Return the volume of this shape in length units cubed (m^3). virtual Real getVolume() const; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Instance Creation Methods /// Create and return an instance of this shape. virtual Pointer<CollisionShapeInstance> getInstance() const; private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Helper Methods /// Recompute the bounding sphere, center of mass, volume, and inertia tensor for this convex shape. void updateDependentQuantities(); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Members /// The convex hull of this convex shape. ConvexHull convexHull; /// The center of mass of this convex shape. Vector3 centerOfMass; /// The volume of this convex shape in length units cubed (m^3). Real volume; /// The inertia tensor of this convex shape where volume is treated as mass. /** * This tensor is then multiplied by the density of the shape in order to produce * the final inertia tensor for the shape. */ Matrix3 volumeInertiaTensor; /// The index of the last returned support vertex. /** * This value is cached with each call to getSupportVertex() and is used to * speed up future queries to that method. */ mutable Index lastSupportVertex; }; //########################################################################################## //########################################################################################## //############ //############ Convex Shape Instance Class Definition //############ //########################################################################################## //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class which is used to instance a CollisionShapeConvex object with an arbitrary rigid transformation. class CollisionShapeConvex:: Instance : public CollisionShapeInstance { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Transform Update Method /// Update this convex shape instance with the specified 3D rigid transformation from shape to world space. virtual void setTransform( const Transform3& newTransform ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Support Vertex Accessor Method /// Determine which vertex on this convex shape instance's hull is farthest in the specified direction. RIM_INLINE PhysicsVertex3 getSupportVertex( const Vector3& direction ) const { // Transform the support vertex direction into the shape's coordinate frame. Vector3 objectSpaceDirection = transformation.rotateToObjectSpace( direction ); // Get the base shape for this convex shape instance. const ConvexHull& convexHull = ((const CollisionShapeConvex*)this->getShape())->getConvexHull(); // Get the object-space support point in the given object-space direction. lastSupportVertex = convexHull.getSupportVertexIndex( objectSpaceDirection, lastSupportVertex ); // Transform the resulting support point back to world space. if ( lastSupportVertex < convexHull.getVertexCount() ) return transformation.transformToWorldSpace( convexHull.getVertex(lastSupportVertex).getPosition() ); else return Vector3::ZERO; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Triangle Accessor Methods //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Vertex Accessor Methods private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Constructors /// Create a new convex shape instance which uses the specified base convex shape. RIM_INLINE Instance( const CollisionShapeConvex* newConvex ) : CollisionShapeInstance( newConvex ), lastSupportVertex( 0 ) { } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Members /// The transformation from shape-space to world space for this convex shape instance. Transform3 transformation; /// The index of the last returned support vertex. /** * This value is cached with each call to getSupportVertex() and is used to * speed up future queries to that method. */ mutable Index lastSupportVertex; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Friend Declarations /// Declare the convex collision shape as a friend so that it can construct instances. friend class CollisionShapeConvex; }; //########################################################################################## //************************ End Rim Physics Shapes Namespace ****************************** RIM_PHYSICS_SHAPES_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_PHYSICS_COLLISION_SHAPE_CONVEX_H <file_sep>/* * rimGraphicsMeshShape.h * Rim Graphics * * Created by <NAME> on 11/30/09. * Copyright 2009 Rim Software. All rights reserved. * */ #ifndef INCLUDE_RIM_GRAPHICS_MESH_SHAPE_H #define INCLUDE_RIM_GRAPHICS_MESH_SHAPE_H #include "rimGraphicsShapesConfig.h" #include "rimGraphicsShapeBase.h" #include "rimGraphicsMeshGroup.h" #include "rimGraphicsSkeleton.h" //########################################################################################## //*********************** Start Rim Graphics Shapes Namespace **************************** RIM_GRAPHICS_SHAPES_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class that represents a renderable mesh. class MeshShape : public GraphicsShapeBase<MeshShape> { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructors /// Create a new mesh shape with no mesh groups or geometry. MeshShape(); /// Create a new mesh shape with the specified vertices, indices, and material. MeshShape( const MeshGroup& newGroup ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Mesh Group Accessor Methods /// Return the total number of mesh groups that are a part of this mesh shape. RIM_INLINE Size getGroupCount() const { return groups.getSize(); } /// Return a reference to the mesh group for this mesh shape at the specified index. /** * If an out-of-bounds index is given, an assertion is raised. */ RIM_INLINE MeshGroup& getGroup( Index groupIndex ) { RIM_DEBUG_ASSERT_MESSAGE( groupIndex < groups.getSize(), "Cannot get mesh mesh group at invalid index." ); return groups[groupIndex]; } /// Return a reference to the mesh group for this mesh shape at the specified index. /** * If an out-of-bounds index is given, an assertion is raised. */ RIM_INLINE const MeshGroup& getGroup( Index groupIndex ) const { RIM_DEBUG_ASSERT_MESSAGE( groupIndex < groups.getSize(), "Cannot get mesh mesh group at invalid index." ); return groups[groupIndex]; } /// Add a new mesh group to this mesh shape. /** * Calling this method causes the shape's bounding sphere to be updated. */ void addGroup( const MeshGroup& newGroup ); /// Remove the mesh group from this mesh at the specified index. /** * If an out-of-bounds index is given, the method call is ignored. * * Calling this method causes the shape's bounding sphere to be updated. */ void removeGroup( Index groupIndex ); /// Remove all mesh groups and geometry from this mesh shape. /** * Calling this method causes the shape's bounding sphere to be updated. */ void clearGroups(); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Skeleton Accessor Methods /// Return a pointer to the skeleton for this mesh, or NULL if it doesn't have one. RIM_INLINE const Pointer<Skeleton>& getSkeleton() const { return skeleton; } /// Set the skeleton for this mesh. RIM_INLINE void setSkeleton( const Pointer<Skeleton>& newSkeleton ) { skeleton = newSkeleton; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Bounding Volume Accessor Methods /// Update the local-space bounding sphere for this mesh shape. /** * This method is automatically called whenever a mesh shape is * first created and anytime the mesh groups of the shape are changed. * It is declared publicly so that a user can make sure that the bounding * box matches the geometry (which might be shared and could changed without notice). */ virtual void updateBoundingBox(); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Shape Chunk Accessor Method /// Process the shape into a flat list of mesh chunk objects. /** * This method flattens the shape hierarchy and produces mesh chunks * for rendering from the specified camera's perspective. The method * converts its internal representation into one or more MeshChunk * objects which it appends to the specified output list of mesh chunks. * * The method returns whether or not the shape was successfully flattened * into chunks. */ virtual Bool getChunks( const Transform3& worldTransform, const Camera& camera, const ViewVolume* viewVolume, const Vector2D<Size>& viewportSize, ArrayList<MeshChunk>& chunks ) const; private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Members /// A list of objects which each store a group of geometry associated with a particular material. ArrayList<MeshGroup> groups; /// A pointer to the skeleton for this mesh, or NULL if it doesn't have one. Pointer<Skeleton> skeleton; }; //########################################################################################## //*********************** End Rim Graphics Shapes Namespace ****************************** RIM_GRAPHICS_SHAPES_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_GRAPHICS_MESH_SHAPE_H <file_sep>/* * rimGraphicsSceneRendererConfiguration.h * Rim Software * * Created by <NAME> on 7/8/14. * Copyright 2014 __MyCompanyName__. All rights reserved. * */ #ifndef INCLUDE_RIM_GRAPHICS_SCENE_RENDERER_CONFIGURATION_H #define INCLUDE_RIM_GRAPHICS_SCENE_RENDERER_CONFIGURATION_H #include "rimGraphicsRenderersConfig.h" #include "rimGraphicsSceneRendererFlags.h" //########################################################################################## //********************** Start Rim Graphics Renderers Namespace ************************** RIM_GRAPHICS_RENDERERS_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class which encapsulates the configuration for a scene renderer. class SceneRendererConfiguration { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructors /// Create a scene renderer configuration with the default configuration. RIM_INLINE SceneRendererConfiguration() : flags( DEFAULT_FLAGS ), maxNumSpotLights( math::max<Size>() ), maxNumPointLights( math::max<Size>() ), maxNumDirectionalLights( math::max<Size>() ), maxNumShadows( math::max<Size>() ), lightDebugColor( 1.0f, 1.0f, 0.0f, 1.0f ), cameraDebugColor( 0.0f, 0.0f, 1.0f, 1.0f ), objectDebugColor( 1.0f, 1.0f, 1.0f, 1.0f ), shapeDebugColor( 0.0f, 1.0f, 1.0f, 1.0f ), boundingBoxDebugColor( 1.0f, 0.0f, 0.0f, 1.0f ) { } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Public Data Members /// An object containing boolean configuration flags for a scene renderer. SceneRendererFlags flags; /// The maximum number of spot lights that can be used to illuminate an object. Size maxNumSpotLights; /// The maximum number of point lights that can be used to illuminate an object. Size maxNumPointLights; /// The maximum number of directional lights that can be used to illuminate an object. Size maxNumDirectionalLights; /// The maximum number of light shadows that can be rendered for a scene. Size maxNumShadows; /// The color to use when drawing debug info for lights. Color4f lightDebugColor; /// The color to use when drawing debug info for cameras. Color4f cameraDebugColor; /// The color to use when drawing debug info for objects. Color4f objectDebugColor; /// The color to use when drawing debug info for shapes. Color4f shapeDebugColor; /// The color to use when drawing debug bounding boxes. Color4f boundingBoxDebugColor; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Public Static Data Members /// An integer containing the OR-ed default scene renderer flags. static const UInt32 DEFAULT_FLAGS = SceneRendererFlags::OBJECTS_ENABLED | SceneRendererFlags::LIGHTS_ENABLED | SceneRendererFlags::SHADOWS_ENABLED; }; //########################################################################################## //********************** End Rim Graphics Renderers Namespace **************************** RIM_GRAPHICS_RENDERERS_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_GRAPHICS_SCENE_RENDERER_CONFIGURATION_H <file_sep>/* * rimGraphicsGUIRenderViewDelegate.h * Rim Graphics GUI * * Created by <NAME> on 2/13/13. * Copyright 2013 Headspace Systems. All rights reserved. * */ #ifndef INCLUDE_RIM_GRAPHICS_GUI_RENDER_VIEW_DELEGATE_H #define INCLUDE_RIM_GRAPHICS_GUI_RENDER_VIEW_DELEGATE_H #include "rimGraphicsGUIConfig.h" //########################################################################################## //************************ Start Rim Graphics GUI Namespace ****************************** RIM_GRAPHICS_GUI_NAMESPACE_START //****************************************************************************************** //########################################################################################## class RenderView; //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class which contains function objects that recieve RenderView events. /** * Any render-view-related event that might be processed has an appropriate callback * function object. Each callback function is called by the button * whenever such an event is received. If a callback function in the delegate * is not initialized, a render view simply ignores it. */ class RenderViewDelegate { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Render View Delegate Callback Functions /// A function object which is called whenever a render view's internal state is updated. /** * A render view calls this method when its update() method is called, allowing * the user to perform any logic updates for the specified time interval which * are needed for the RenderView. */ Function<void ( RenderView& renderView, Float dt )> update; /// A function object which is called whenever a render view's display should update. /** * A render view calls this method when it needs to display itself. This method * is called after the render view has already drawn its border and background. * The specified viewport indicates the area of the screen which should be drawn * to. * * The delegate function should return whether or not it successfully rendered * anything to the specified viewport. */ Function<Bool ( const RenderView& renderView, GUIRenderer& renderer, const Viewport& newViewport )> render; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** User Input Callback Functions /// A function object called whenever an attached render view receives a keyboard event. Function<void ( RenderView& renderView, const KeyboardEvent& keyEvent )> keyEvent; /// A function object called whenever an attached render view receives a mouse-motion event. Function<void ( RenderView& renderView, const MouseMotionEvent& mouseMotionEvent )> mouseMotionEvent; /// A function object called whenever an attached render view receives a mouse-button event. Function<void ( RenderView& renderView, const MouseButtonEvent& mouseButtonEvent )> mouseButtonEvent; /// A function object called whenever an attached render view receives a mouse-wheel event. Function<void ( RenderView& renderView, const MouseWheelEvent& mouseWheelEvent )> mouseWheelEvent; }; //########################################################################################## //************************ End Rim Graphics GUI Namespace ******************************** RIM_GRAPHICS_GUI_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_GRAPHICS_GUI_RENDER_VIEW_DELEGATE_H <file_sep>/* * rimGraphicsTextureBinding.h * Rim Graphics * * Created by <NAME> on 1/19/11. * Copyright 2011 Rim Software. All rights reserved. * */ #ifndef INCLUDE_RIM_GRAPHICS_TEXTURE_BINDING_H #define INCLUDE_RIM_GRAPHICS_TEXTURE_BINDING_H #include "rimGraphicsShadersConfig.h" #include "rimGraphicsTextureVariable.h" //########################################################################################## //*********************** Start Rim Graphics Shaders Namespace *************************** RIM_GRAPHICS_SHADERS_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class used to represent the binding between a texture shader variable and its texture and usage. class TextureBinding { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Texture Variable Accessor Methods /// Get a reference to the texture variable which this texture binding binds to. RIM_FORCE_INLINE const TextureVariable& getVariable() const { return *variable; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Shader Attribute Usage Accessor Methods /// Return the semantic usage for this texture binding. RIM_FORCE_INLINE const TextureUsage& getUsage() const { return usage; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Texture Offset Accessor Methods /// Return the starting index for the first texture of this binding in its shader pass's texture storage buffer. RIM_FORCE_INLINE UInt getTextureOffset() const { return textureOffset; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Input Status Accessor Methods /// Return whether or not this texture binding is a dynamic input to a shader pass. /** * If so, the renderer can provide dynamic scene information for this binding * (such as nearby lights, textures, etc) that aren't explicitly part of this * binding. By default, all bindings are inputs. */ RIM_INLINE Bool getIsInput() const { return isInput; } private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Friend Class Declarations /// Declare the ShaderPass class a friend so that it can manipulate internal data easily. friend class ShaderPass; /// Declare the ShaderBindingSet class a friend so that it can manipulate internal data easily. friend class ShaderBindingSet; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Constructors /// Create a texture binding for the specified shader variable, texture offset, and usage. RIM_INLINE TextureBinding( const TextureVariable* newVariable, const TextureUsage& newUsage, UInt newTextureOffset, Bool newIsInput ) : variable( newVariable ), usage( newUsage ), textureOffset( newTextureOffset ), isInput( newIsInput ) { RIM_DEBUG_ASSERT_MESSAGE( newVariable != NULL, "Cannot create TextureBinding with NULL shader texture variable." ); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Members /// A pointer to the texture variable which this texture binding binds to. const TextureVariable* variable; /// The semantic usage for this texture binding. /** * This object allows the creator to specify the semantic usage for the texture * variable. For instance, the usage could be to specify a shadowmap. This * allows the rendering system to automatically update certain shader parameters * that are environmental. */ TextureUsage usage; /// The starting index for the first texture of this binding in its shader pass's texture storage buffer. UInt textureOffset; /// A boolean value indicating whether or not this binding represents a dynamic input. Bool isInput; }; //########################################################################################## //*********************** End Rim Graphics Shaders Namespace ***************************** RIM_GRAPHICS_SHADERS_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_GRAPHICS_TEXTURE_BINDING_H <file_sep>/* * rimGraphicsGUIRenderer.h * Rim Graphics GUI * * Created by <NAME> on 1/22/13. * Copyright 2013 Headspace Systems. All rights reserved. * */ #ifndef INCLUDE_RIM_GRAPHICS_GUI_RENDERER_H #define INCLUDE_RIM_GRAPHICS_GUI_RENDERER_H #include "rimGraphicsGUIBase.h" #include "rimGraphicsGUIFonts.h" #include "rimGraphicsGUIObject.h" //########################################################################################## //************************ Start Rim Graphics GUI Namespace ****************************** RIM_GRAPHICS_GUI_NAMESPACE_START //****************************************************************************************** //########################################################################################## class Screen; class Button; class Slider; class Meter; class Knob; class TextField; class ImageView; class OptionMenu; class MenuBar; class Menu; class Divider; class ScrollView; class ContentView; class RenderView; class GraphView; class GridView; //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class which handles drawing GUI objects using a graphics rendering context. class GUIRenderer { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructors /// Create a new GUI renderer with no valid rendering context. /** * This renderer will not be able to draw anything until a valid context * is supplied via setContext(). */ GUIRenderer(); /// Create a new GUI renderer which uses the specified context for rendering. GUIRenderer( const Pointer<GraphicsContext>& newContext ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Context Accessor Methods /// Return a pointer to the graphics context which this GUI renderer is using to render. RIM_INLINE const Pointer<GraphicsContext>& getContext() const { return context; } /// Set a pointer to the graphics context which this GUI renderer is using to render. /** * This causes the renderer to use the specified context to do all of its rendering. * The renderer reinitializes all internal state using the new context. If the * new context is NULL or not valid, the renderer will not be able to render anything. */ void setContext( const Pointer<GraphicsContext>& newContext ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Viewport Accessor Methods /// Return the current viewport that this GUI renderer is drawing to. RIM_INLINE const Viewport& getViewport() const { return drawer.getViewport(); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Main Object Drawing Method /// Draw the specified object within the specified screen pixel coordinate bounds. /** * This method is typically called by GUIObject subclasses which have child * objects that need to be drawn where the concrete object type is unknown. */ virtual Bool drawObject( const GUIObject& object, const AABB3f& parentBounds ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Object Drawing Methods /// Draw a screen in the specified pixel bounds. virtual Bool drawScreen( const Screen& screen, const AABB3f& parentBounds ); /// Draw a content view in the specified pixel bounds. virtual Bool drawContentView( const ContentView& contentView, const AABB3f& parentBounds ); /// Draw a render view in the specified pixel bounds. virtual Bool drawRenderView( const RenderView& renderView, const AABB3f& parentBounds ); /// Draw a scroll view in the specified pixel bounds. virtual Bool drawScrollView( const ScrollView& scrollView, const AABB3f& parentBounds ); /// Draw a grid view in the specified pixel bounds. virtual Bool drawGridView( const GridView& gridView, const AABB3f& parentBounds ); /// Draw a graph view in the specified pixel bounds. virtual Bool drawGraphView( const GraphView& graphView, const AABB3f& parentBounds ); /// Draw a button in the specified pixel bounds. virtual Bool drawButton( const Button& button, const AABB3f& parentBounds ); /// Draw a meter in the specified pixel bounds. virtual Bool drawMeter( const Meter& meter, const AABB3f& parentBounds ); /// Draw a slider in the specified pixel bounds. virtual Bool drawSlider( const Slider& slider, const AABB3f& parentBounds ); /// Draw a knob in the specified pixel bounds. virtual Bool drawKnob( const Knob& knob, const AABB3f& parentBounds ); /// Draw a text field in the specified pixel bounds. virtual Bool drawTextField( const TextField& textField, const AABB3f& parentBounds ); /// Draw a image view in the specified pixel bounds. virtual Bool drawImageView( const ImageView& imageView, const AABB3f& parentBounds ); /// Draw a menu bar in the specified pixel bounds. virtual Bool drawMenuBar( const MenuBar& menuBar, const AABB3f& parentBounds ); /// Draw a menu in the specified pixel bounds. virtual Bool drawMenu( const Menu& menu, const AABB3f& parentBounds ); /// Draw an option menu in the specified pixel bounds. virtual Bool drawOptionMenu( const OptionMenu& optionMenu, const AABB3f& parentBounds ); /// Draw a divider in the specified pixel bounds. virtual Bool drawDivider( const Divider& divider, const AABB3f& parentBounds ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** String Drawing Methods /// Draw the specified unicode string using the provided font style. /** * The position and font size are assumed to be in normalized vertical-screen-unit * coordinates. The current viewport is assumed to represent the current dimensions * of the screen and so the specified position and size are scaled by the height * of the viewport to get their values in pixel units. */ virtual Bool drawString( const UTF8String& string, const fonts::FontStyle& style, Vector2f& position ); /// Draw the specified string within the specified bounding box with the given parameters. virtual Bool drawStringArea( const UTF8String& string, const fonts::FontStyle& style, const AABB2f& bounds, const Origin& textAlignment, Bool wrap ); /// Retrieve a bounding box for the specified string using the given font style. /** * This method computes a bounding box for the string where the starting * pen position is the origin (0,0). If the method succeeds, the string's * bounding box is placed in the output reference parameter and TRUE is returned. * If the method fails, FALSE is returned and no bounding box is computed. * * This method is useful for centering and laying out text before rendering it. */ virtual Bool getStringBounds( const UTF8String& string, const fonts::FontStyle& style, AABB2f& bounds ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Primitive Drawing Methods /// Draw a rectangle with the specified bounds and color. /** * All coordinates are specified in the current local coordinate system. */ virtual Bool drawRectangle( const AABB2f& pixelBounds, const Color4f& color ); /// Draw a point with the specified pixel position with the given color. /** * All coordinates are specified in the current local coordinate system. * The method returns whether or not the point was successfully drawn. */ virtual Bool drawPoint( const Vector2f& point, const Color4f& color, Float size = Float(1) ); /// Draw a series of circular points with the specified locations, color, and size. /** * All coordinates are specified in the current local coordinate system. * The method returns whether or not the points were successfully drawn. */ virtual Bool drawPoints( const ArrayList<Vector2f>& vertices, const Color4f& color, Float size = Float(1) ); /// Draw a line with the specified start and endpoints with the given start and ending color. /** * All coordinates are specified in the current local coordinate system. * The method returns whether or not the line was successfully drawn. */ virtual Bool drawLine( const Vector2f& start, const Vector2f& end, const Color4f& startColor, const Color4f& endColor, Float width = Float(1) ); /// Draw a series of disconnected lines with the specified vertices and color. /** * All coordinates are specified in the current local coordinate system. * Every 2 vertices represent the start and endpoints of a line. * The method returns whether or not the lines were successfully drawn. */ virtual Bool drawLines( const ArrayList<Vector2f>& vertices, const Color4f& color, Float width = Float(1) ); /// Draw a connected line strip with the specified vertices and color. /** * All coordinates are specified in the current local coordinate system. * The method returns whether or not the lines were successfully drawn. */ virtual Bool drawLineStrip( const ArrayList<Vector2f>& vertices, const Color4f& color, Float width = Float(1) ); /// Draw a circle with the specified position, radius, and color. /** * All coordinates are specified in the current local coordinate system. * The method returns whether or not the circle was successfully drawn. */ virtual Bool drawCircle( const Vector2f& position, Float radius, const Color4f& color ); /// Draw an image from a texture with the specified bounding box to the screen. /** * All coordinates are specified in the current local coordinate system. * If the specified texture image is not valid or drawing fails, FALSE is returned * indicating failure. Otherwise, TRUE is returned if the operation is successful. * * The method allows the user to specify a color with which the image will be * tinted with (multiplied) when drawn. The default color is white, indicating * that no tinting occurs. */ virtual Bool drawImage( const util::TextureImage& image, const AABB2f& parentBounds, const Color4f& color = Color4f::WHITE ); private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Helper Methods /// Create and initialize this drawer's vertex buffers and shaders to their default state. void initializeGraphicsState(); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Object Drawing Helper Methods /// Apply transformations and scissor test rectangles for the specified object in the given parent bounds. RIM_FORCE_INLINE void beginDrawingObject( const GUIObject& object, const AABB3f& parentBounds ); /// Finish drawing the specified object, and return the renderer state to the previous state. RIM_FORCE_INLINE void endDrawingObject( const GUIObject& object ); /// Apply a scissor test to the current rendering state. /** * The method returns the viewport-space scissor viewport BEFORE clipping * with the parent scissor rectangle. */ RIM_FORCE_INLINE AABB2f beginScissorTest( const AABB2f& localScissorViewport, Bool enabled = true, Bool respectParent = true ); /// Apply a scissor test to the current rendering state. /** * The method returns the viewport-space scissor viewport BEFORE clipping * with the parent scissor rectangle. */ RIM_FORCE_INLINE AABB2f beginScissorTest( const AABB3f& localScissorViewport, Bool enabled = true, Bool respectParent = true ); /// Restore the previous scissor test. RIM_FORCE_INLINE void endScissorTest(); /// Apply the model-view-projection transform and do the perspective divide to get into viewport space. RIM_FORCE_INLINE static Vector3f viewProjection( const Matrix4f& projectionTransform, const Vector4f& point ) { Vector4f homogeneous = projectionTransform * point; // Convert to normalized device coodinates by the perspective division. Vector3f ndc = homogeneous.getXYZ() / homogeneous.w; // Convert to viewport coordinates [0,1]. return Float(0.5)*ndc + Float(1); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Drawing Methods /// Draw a 2D bordered rectangle in the current coordinate system. void drawBorderedRectangle( const AABB2f& bounds, const Border& border, const Color4f& backgroundColor, const Color4f& borderColor, const GUIStyle* style = NULL ); /// Draw a 2D flat rectangle in the current coordinate system. void drawRectangle( const AABB2f& bounds, const Color4f& color, const GUIStyle* style ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Members /// An object which handles the drawing for this renderer. Pointer<GraphicsContext> context; /// An object that handles submitting vertices and drawing commands to the context. ImmediateRenderer drawer; /// An object which handles drawing text for this renderer. fonts::GraphicsFontDrawer fontDrawer; /// A pointer to the default style to use for drawing GUI objects with no style specified. Pointer<GUIStyle> defaultStyle; /// An object representing the shader pass to use for bordered objects (circles, rectangles). Pointer<ShaderPass> borderShaderPass; /// An object representing the shader pass to use for drawing lines. Pointer<ShaderPass> lineShaderPass; /// An object representing the shader pass to use for drawing images. Pointer<ShaderPass> imageShaderPass; }; //########################################################################################## //************************ End Rim Graphics GUI Namespace ******************************** RIM_GRAPHICS_GUI_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_GRAPHICS_GUI_RENDERER_H <file_sep>/* * rimBasicStringIterator.h * Rim Framework * * Created by <NAME> on 7/17/11. * Copyright 2011 __MyCompanyName__. All rights reserved. * */ #ifndef INCLUDE_RIM_BASIC_STRING_ITERATOR_H #define INCLUDE_RIM_BASIC_STRING_ITERATOR_H #include "rimDataConfig.h" #include "rimBasicString.h" //########################################################################################## //******************************* Start Data Namespace ********************************* RIM_DATA_NAMESPACE_START //****************************************************************************************** //########################################################################################## /// Declaration for a string iterator which iterates over strings with the specified character type. template < typename CharType > class BasicStringIterator; //########################################################################################## //########################################################################################## //############ //############ ASCII Basic String Iterator Specialization //############ //########################################################################################## //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class which iterates over ASCII character strings. template <> class BasicStringIterator<Char> { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructors /// Create a string iterator that iterates over the specified NULL-terminated string. RIM_INLINE BasicStringIterator( const Char* string ) : current( string ), start( string ), end( NULL ) { RIM_DEBUG_ASSERT_MESSAGE( string != NULL, "Cannot iterate over NULL string" ); } /// Create a string iterator that iterates over the specified string. RIM_INLINE BasicStringIterator( const Char* string, Size length ) : current( string ), start( string ), end( string + length ) { RIM_DEBUG_ASSERT_MESSAGE( string != NULL, "Cannot iterate over NULL string" ); } /// Create a string iterator that iterates over the specified string object. RIM_INLINE BasicStringIterator( const BasicString<Char>& string ) : current( string.getCString() ), start( string.getCString() ) { end = start + string.getLength(); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Increment Methods /// Increment the iterator to the next character in the string. RIM_INLINE void operator ++ () { current++; } /// Increment the iterator to the next character in the string. RIM_INLINE void operator ++ ( int ) { current++; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Iterator State Accessor Method /// Return whether or not the end of the string has been reached. RIM_INLINE operator Bool () const { if ( end ) return current != end; else return *current != '\0'; } /// Return the current code point index within the string being iterated over. RIM_INLINE Index getIndex() const { return current - start; } /// Return the index of the next character in the string. RIM_INLINE Index getCharacterIndex() const { return current - start; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Current Character Accessor Method /// Return the current character of the iterator. RIM_INLINE Char operator * () const { return *current; } /// Return a pointer to the current character of the iterator. RIM_INLINE operator const Char* () const { return current; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Iterator Reset Method /// Reset the iterator to the first character in the string it is iterating over. RIM_INLINE void reset() { current = start; } private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Members /// A pointer to the current character of the string iterator. const Char* current; /// A pointer to the first character of the string being iterated over. const Char* start; /// A pointer to just past the last character of the string being iterated over. const Char* end; }; //########################################################################################## //########################################################################################## //############ //############ UTF-8 Basic String Iterator Specialization //############ //########################################################################################## //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class which iterates over UTF-8 encoded character strings. template <> class BasicStringIterator<UTF8Char> { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructors /// Create a string iterator that iterates over the specified NULL-terminated string. RIM_INLINE BasicStringIterator( const UTF8Char* string ) : current( string ), start( string ), end( NULL ), characterIndex( 0 ) { RIM_DEBUG_ASSERT_MESSAGE( string != NULL, "Cannot iterate over NULL string" ); } /// Create a string iterator that iterates over the specified string. RIM_INLINE BasicStringIterator( const UTF8Char* string, Size length ) : current( string ), start( string ), end( string + length ), characterIndex( 0 ) { RIM_DEBUG_ASSERT_MESSAGE( string != NULL, "Cannot iterate over NULL string" ); } /// Create a string iterator that iterates over the specified string object. RIM_INLINE BasicStringIterator( const BasicString<UTF8Char>& string ) : current( string.getCString() ), start( string.getCString() ), characterIndex( 0 ) { end = start + string.getLength(); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Increment Methods /// Increment the iterator to the next character in the string. RIM_INLINE void operator ++ () { (*this)++; } /// Increment the iterator to the next character in the string. RIM_INLINE void operator ++ ( int ) { if ( *current < 0x80 ) { // This is a single-byte UTF-8 character, skip one byte. current++; } else this->advanceMultiByteCharacter(); characterIndex++; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Iterator State Accessor Method /// Return whether or not the end of the string has been reached. RIM_INLINE operator Bool () const { if ( end ) return current != end; else return *current != '\0'; } /// Return the current code point index within the string being iterated over. RIM_INLINE Index getIndex() const { return current - start; } /// Return the index of the next character in the string. /** * This is not the same as the code point index because there may be * characters which use more than one code point in their representation. */ RIM_INLINE Index getCharacterIndex() const { return characterIndex; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Current Character Accessor Method /// Return the current character of the iterator. RIM_INLINE UTF32Char operator * () const { if ( *current < 0x80 ) { // This is a single-byte UTF-8 character. return UTF32Char(*current); } else return this->getMultiByteCharacter(); } /// Return a pointer to the current character of the iterator. RIM_INLINE operator const UTF8Char* () const { return current; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Iterator Reset Method /// Reset the iterator to the first character in the string it is iterating over. RIM_INLINE void reset() { current = start; characterIndex = 0; } private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Helper Methods /// Return a UTF-32 character when the current character describes the start of multibyte character. UTF32Char getMultiByteCharacter() const; /// Advance to the next character if it the current character is a multibyte character. void advanceMultiByteCharacter(); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Members /// A pointer to the current character of the string iterator. const UTF8Char* current; /// A pointer to the first character of the string being iterated over. const UTF8Char* start; /// A pointer to just past the last character of the string being iterated over. const UTF8Char* end; /// The index of the next character in the string, independent of the code point index. Index characterIndex; }; //########################################################################################## //########################################################################################## //############ //############ UTF-16 Basic String Iterator Specialization //############ //########################################################################################## //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class which iterates over UTF-16 encoded character strings. template <> class BasicStringIterator<UTF16Char> { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructors /// Create a string iterator that iterates over the specified NULL-terminated string. RIM_INLINE BasicStringIterator( const UTF16Char* string ) : current( string ), start( string ), end( NULL ), characterIndex( 0 ) { RIM_DEBUG_ASSERT_MESSAGE( string != NULL, "Cannot iterate over NULL string" ); } /// Create a string iterator that iterates over the specified NULL-terminated string. RIM_INLINE BasicStringIterator( const UTF16Char* string, Size length ) : current( string ), start( string ), end( string + length ), characterIndex( 0 ) { RIM_DEBUG_ASSERT_MESSAGE( string != NULL, "Cannot iterate over NULL string" ); } /// Create a string iterator that iterates over the specified string object. RIM_INLINE BasicStringIterator( const BasicString<UTF16Char>& string ) : current( string.getCString() ), start( string.getCString() ), characterIndex( 0 ) { end = start + string.getLength(); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Increment Methods /// Increment the iterator to the next character in the string. RIM_INLINE void operator ++ () { (*this)++; } /// Increment the iterator to the next character in the string. RIM_INLINE void operator ++ ( int ) { if ( *current >= 0xD800 && *current <= 0xDBFF ) { // This is two-point UTF-16 character. Skip two points. current += 2; } else { // This is either a malformed character or a single point character. Skip one. current++; } characterIndex++; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Iterator State Accessor Method /// Return whether or not the end of the string has been reached. RIM_INLINE operator Bool () const { if ( end ) return current != end; else return *current != '\0'; } /// Return the current code point index within the string being iterated over. RIM_INLINE Index getIndex() const { return current - start; } /// Return the index of the next character in the string. /** * This is not the same as the code point index because there may be * characters which use more than one code point in their representation. */ RIM_INLINE Index getCharacterIndex() const { return characterIndex; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Current Character Accessor Method /// Return the current character of the iterator. UTF32Char operator * () const; /// Return a pointer to the current character of the iterator. RIM_INLINE operator const UTF16Char* () const { return current; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Iterator Reset Method /// Reset the iterator to the first character in the string it is iterating over. RIM_INLINE void reset() { current = start; characterIndex = 0; } private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Members /// A pointer to the current character of the string iterator. const UTF16Char* current; /// A pointer to the first character of the string being iterated over. const UTF16Char* start; /// A pointer to just past the last character of the string being iterated over. const UTF16Char* end; /// The index of the next character in the string, independent of the code point index. Index characterIndex; }; //########################################################################################## //########################################################################################## //############ //############ UTF-32 Basic String Iterator Specialization //############ //########################################################################################## //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class which iterates over UTF-32 encoded character strings. template <> class BasicStringIterator<UTF32Char> { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructors /// Create a string iterator that iterates over the specified NULL-terminated string. RIM_INLINE BasicStringIterator( const UTF32Char* string ) : current( string ), start( string ), end( NULL ) { RIM_DEBUG_ASSERT_MESSAGE( string != NULL, "Cannot iterate over NULL string" ); } /// Create a string iterator that iterates over the specified string. RIM_INLINE BasicStringIterator( const UTF32Char* string, Size length ) : current( string ), start( string ), end( string + length ) { RIM_DEBUG_ASSERT_MESSAGE( string != NULL, "Cannot iterate over NULL string" ); } /// Create a string iterator that iterates over the specified string object. RIM_INLINE BasicStringIterator( const BasicString<UTF32Char>& string ) : current( string.getCString() ), start( string.getCString() ) { end = start + string.getLength(); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Increment Methods /// Increment the iterator to the next character in the string. RIM_INLINE void operator ++ () { current++; } /// Increment the iterator to the next character in the string. RIM_INLINE void operator ++ ( int ) { current++; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Iterator State Accessor Method /// Return whether or not the end of the string has been reached. RIM_INLINE operator Bool () const { if ( end ) return current != end; else return *current != '\0'; } /// Return the current code point index within the string being iterated over. RIM_INLINE Index getIndex() const { return current - start; } /// Return the character index within the string being iterated over. RIM_INLINE Index getCharacterIndex() const { return current - start; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Current Character Accessor Method /// Return the current character of the iterator. RIM_INLINE UTF32Char operator * () const { return *current; } /// Return a pointer to the current character of the iterator. RIM_INLINE operator const UTF32Char* () const { return current; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Iterator Reset Method /// Reset the iterator to the first character in the string it is iterating over. RIM_INLINE void reset() { current = start; } private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Members /// A pointer to the current character of the string iterator. const UTF32Char* current; /// A pointer to the first character of the string being iterated over. const UTF32Char* start; /// A pointer to just past the last character of the string being iterated over. const UTF32Char* end; }; //########################################################################################## //########################################################################################## //############ //############ String Iterator Type Definitions //############ //########################################################################################## //########################################################################################## /// A class which iterates over ASCII encoded character strings. typedef BasicStringIterator<Char> StringIterator; /// A class which iterates over UTF-8 encoded character strings. typedef BasicStringIterator<UTF8Char> UTF8StringIterator; /// A class which iterates over UTF-16 encoded character strings. typedef BasicStringIterator<UTF16Char> UTF16StringIterator; /// A class which iterates over UTF-32 encoded character strings. typedef BasicStringIterator<UTF32Char> UTF32StringIterator; //########################################################################################## //******************************* End Data Namespace *********************************** RIM_DATA_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_BASIC_STRING_ITERATOR_H <file_sep>/* * rimSIMDTriangle3D.h * Rim Framework * * Created by <NAME> on 7/12/12. * Copyright 2012 __MyCompanyName__. All rights reserved. * */ #ifndef INCLUDE_RIM_SIMD_TRIANGLE_3D_H #define INCLUDE_RIM_SIMD_TRIANGLE_3D_H #include "rimMathConfig.h" #include "rimVector3D.h" #include "rimSIMDVector3D.h" //########################################################################################## //***************************** Start Rim Math Namespace ********************************* RIM_MATH_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A template prototype declaration for the SIMDAABB3D class. /** * This class is used to store and operate on a set of N 3D triangles * in a SIMD fashion. The triangles are stored in a structure-of-arrays format * that accelerates SIMD operations. Each triangle is specified by 3 vertex * coordinates that indicate the vertices of the triangle. */ template < typename T, Size dimension > class SIMDTriangle3D; //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A specialization for the SIMDTriangle3D class that has a SIMD width of 4. /** * This class is used to store and operate on a set of 4 3D triangles * in a SIMD fashion. The triangles are stored in a structure-of-arrays format * that accelerates SIMD operations. Each triangle is specified by 3 vertex * coordinates that indicate the vertices of the triangle. */ template < typename T > class RIM_ALIGN(16) SIMDTriangle3D<T,4> { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructors /// Create a SIMD triangle with N copies of the specified triangle for a SIMD width of N. RIM_FORCE_INLINE SIMDTriangle3D( const Vector3D<T>& newV0, const Vector3D<T>& newV1, const Vector3D<T>& newV2 ) : v0( newV0 ), v1( newV1 ), v2( newV2 ) { } /// Create a SIMD ray with the 4 rays it contains equal to the specified rays. RIM_FORCE_INLINE SIMDTriangle3D( const SIMDVector3D<T,4>& newV0, const SIMDVector3D<T,4>& newV1, const SIMDVector3D<T,4>& newV2 ) : v0( newV0 ), v1( newV1 ), v2( newV2 ) { } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Public Data Members /// The first vertex of the SIMD triangle. SIMDVector3D<T,4> v0; /// The second vertex of the SIMD triangle. SIMDVector3D<T,4> v1; /// The second vertex of the SIMD triangle. SIMDVector3D<T,4> v2; }; //########################################################################################## //***************************** End Rim Math Namespace *********************************** RIM_MATH_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_SIMD_TRIANGLE_3D_H <file_sep>/* * rimGraphicsCamera.h * Rim Graphics * * Created by <NAME> on 6/7/08. * Copyright 2008 Rim Software. All rights reserved. * */ #ifndef INCLUDE_RIM_GRAPHICS_CAMERA_H #define INCLUDE_RIM_GRAPHICS_CAMERA_H #include "rimGraphicsCamerasConfig.h" #include "rimGraphicsCameraFlags.h" //########################################################################################## //*********************** Start Rim Graphics Cameras Namespace *************************** RIM_GRAPHICS_CAMERAS_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class which represents a camera in 3D space with an implementation-defined projection transformation. class Camera : public Transformable { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructors /// Create a camera at the origin looking along the z axis. Camera(); /// Create a camera with the specified position, orientation, and viewport. Camera( const Vector3& newPosition, const Matrix3& newOrientation ); /// Create a camera with the specified transformation and viewport. Camera( const Transform3& newTransform ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Position Accessor Methods /// Get the position of the camera. RIM_INLINE const Vector3& getPosition() const { return transform.position; } /// Set the position of the camera. RIM_INLINE void setPosition( const Vector3& newPosition ) { transform.position = newPosition; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Orientation Accessor Methods /// Get the orientation of the camera. RIM_INLINE const Matrix3& getOrientation() const { return transform.orientation; } /// Set the orientation of the camera. /** * This method ensures that the new camera orientation matrix is orthonormal. */ RIM_NO_INLINE void setOrientation( const Matrix3& newOrientation ) { transform.orientation = newOrientation.orthonormalize(); } /// Get a unit vector along the camera's view direction. RIM_INLINE Vector3 getViewDirection() const { return -this->getOrientation().z; } /// Get a unit vector pointing to the camera's up direction. RIM_INLINE const Vector3& getUpDirection() const { return this->getOrientation().y; } /// Get a unit vector pointing to the camera's left. RIM_INLINE Vector3 getLeftDirection() const { return -this->getOrientation().x; } /// Get a unit vector pointing to the camera's left. RIM_INLINE const Vector3& getRightDirection() const { return this->getOrientation().x; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Clipping Plane Accessor Methods /// Get the distance to the near clipping plane. RIM_INLINE Real getNearPlaneDistance() const { return nearPlaneDistance; } /// Set the distance to the near clipping plane. RIM_INLINE void setNearPlaneDistance( Real newNearPlaneDistance ) { nearPlaneDistance = newNearPlaneDistance; } /// Get the distance to the far clipping plane. RIM_INLINE Real getFarPlaneDistance() const { return farPlaneDistance; } /// Set the distance to the far clipping plane. RIM_INLINE void setFarPlaneDistance( Real newFarPlaneDistance ) { farPlaneDistance = newFarPlaneDistance; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Look At Methods /// Rotate the camera at its current position so that the specified point is in the center of its view. /** * This method uses the camera's current up vector in determining the camera's * new orientation. */ void lookAt( const Vector3& point ); /// Rotate the camera at its current position so that the specified point is in the center of its view. /** * This method uses the specified up vector in determining the camera's * new orientation. */ void lookAt( const Vector3& point, const Vector3& up ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Transform Matrix Accessor Methods /// Get a matrix which projects points in camera space onto the near plane of the camera. virtual Matrix4 getProjectionMatrix() const = 0; /// Return a depth-biased projection matrix for this camera for the given depth and bias distance. virtual Matrix4 getDepthBiasProjectionMatrix( Real depth, Real bias ) const = 0; /// Return a 4x4 matrix which transforms points from camera space to world space. Matrix4 getTransformMatrix() const; /// Return a 4x4 matrix which transforms points from world space to camera space. Matrix4 getInverseTransformMatrix() const; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** View Volume Accessor Method /// Return an object specifying the volume of this camera's view. virtual ViewVolume getViewVolume() const = 0; /// Compute the 8 corners of this camera's view volume and place them in the output array. /** * The corners are stored in the following order: near bottom left, near bottom right, * near top left, near top right, far bottom left, far bottom right, far top left, * far top right. */ virtual void getViewVolumeCorners( StaticArray<Vector3,8>& corners ) const = 0; /// Return whether or not the specified direction is within the camera's field of view. virtual Bool canViewDirection( const Vector3f& direction ) const = 0; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Screen-Space Size Accessor Methods /// Return the screen-space radius in pixels of the specified world-space bounding sphere. virtual Real getScreenSpaceRadius( const BoundingSphere& sphere ) const = 0; /// Return the distance to the specified position along the view direction. virtual Real getDepth( const Vector3f& position ) const = 0; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Flags Accessor Methods /// Return a reference to an object which contains boolean parameters of the camera. RIM_INLINE CameraFlags& getFlags() { return flags; } /// Return an object which contains boolean parameters of the camera. RIM_INLINE const CameraFlags& getFlags() const { return flags; } /// Set an object which contains boolean parameters of the camera. RIM_INLINE void setFlags( const CameraFlags& newFlags ) { flags = newFlags; } /// Return whether or not the specified boolan flag is set for this camera. RIM_INLINE Bool flagIsSet( CameraFlags::Flag flag ) const { return flags.isSet( flag ); } /// Set whether or not the specified boolan flag is set for this camera. RIM_INLINE void setFlag( CameraFlags::Flag flag, Bool newIsSet = true ) { flags.set( flag, newIsSet ); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Name Accessor Methods /// Return the name of the camera. RIM_INLINE const String& getName() const { return name; } /// Set the name of the camera. RIM_INLINE void setName( const String& newName ) { name = newName; } protected: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Static Data Members /// An integer which contains the default boolean flags for a camera. static const UInt32 DEFAULT_FLAGS = CameraFlags::ENABLED; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Members /// The distance from the camera to the near plane along the view direction. Real nearPlaneDistance; /// The distance from the camera to the far plane along the view direction. Real farPlaneDistance; /// A name string for this camera. String name; /// An object containing boolean configuration data for this camera. CameraFlags flags; }; //########################################################################################## //*********************** End Rim Graphics Cameras Namespace ***************************** RIM_GRAPHICS_CAMERAS_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_GRAPHICS_CAMERA_H <file_sep>/* * rimGraphicsGUIGridView.h * Rim Graphics GUI * * Created by <NAME> on 3/19/13. * Copyright 2013 Headspace Systems. All rights reserved. * */ #ifndef INCLUDE_RIM_GRAPHICS_GUI_GRID_VIEW_H #define INCLUDE_RIM_GRAPHICS_GUI_GRID_VIEW_H #include "rimGraphicsGUIBase.h" #include "rimGraphicsGUIObject.h" //########################################################################################## //************************ Start Rim Graphics GUI Namespace ****************************** RIM_GRAPHICS_GUI_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class which contains a 2D grid of rectangular cells that can contain child GUI objects. /** * A grid view is an optionally-bordered rectangular area whose content area (inside * the border) is divided into a 2D grid of cells. Each cell can contain any number of * child GUI objects. */ class GridView : public GUIObject { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructors /// Create a new grid view with no width or height and no rows or columns positioned at the origin. GridView(); /// Create a new empty grid view with the given rectangle and number of rows and columns. /** * The area of the rectangle is equally divided into the specified number of rows * and columns. */ GridView( const Rectangle& newRectangle, Size newNumRows = 1, Size newNumColumns = 1 ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Row and Column Count Accessor Methods /// Return the total number of rows there are in this grid view. RIM_INLINE Size getRowCount() const { return rows.getSize(); } /// Return the total number of columns there are in this grid view. RIM_INLINE Size getColumnCount() const { return columns.getSize(); } /// Resize this grid view so that it has the specified number of rows and columns. /** * If the number of rows or columns in the grid view is less than the previous * number, some grid cells may be destroyed. If the number is greater, new * empty cells are created. */ //void setGridSize( Size newNumRows, Size newNumColumns ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Row Size Accessor Methods /// Return the height of the row with the specified index in this grid view. /** * If the row or column index is invalid, 0 is returned. Otherwise, the * height of the specified row is returned. */ Float getRowHeight( Index rowIndex ) const; /// Set the height of the row with the specified index in this grid view. /** * This method attempts to make the row with the given index have the * specified height. It does this by finding the nearest resizable row(s) * and using the space from those rows for the indexed row. If there isn't * enough space in the grid view to change the row height, FALSE is returned * indicating that the row was not resized. Otherwise, the row is resized * and TRUE is returned. */ Bool setRowHeight( Index rowIndex, Float newHeight ); /// Return whether or not the row with the specified index can be resized automatically. /** * A row may be resized automatically when other rows are resized. If the return value * is FALSE, the indexed row cannot be resized automatically. However, setRowHeight() * will still resize a non-resizable row. */ RIM_INLINE Bool getRowIsResizable( Index rowIndex ) const { if ( rowIndex < rows.getSize() ) return rows[rowIndex].isResizable; return false; } /// Set whether or not the row with the specified index can be resized automatically. /** * A row may be resized automatically when other rows are resized. If the return value * is FALSE, the indexed row cannot be resized automatically. However, setRowHeight() * will still resize a non-resizable row. * * If an invalid row index is specified, the method has no effect. */ RIM_INLINE void setRowIsResizable( Index rowIndex, Bool newIsResizable ) { if ( rowIndex < rows.getSize() ) rows[rowIndex].isResizable = newIsResizable; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Column Size Accessor Methods /// Return the width of the column with the specified index in this grid view. /** * If the column or column index is invalid, 0 is returned. Otherwise, the * width of the specified column is returned. */ Float getColumnWidth( Index columnIndex ) const; /// Set the width of the column with the specified index in this grid view. /** * This method attempts to make the column with the given index have the * specified width. It does this by finding the nearest resizable column(s) * and using the space from those columns for the indexed column. If there isn't * enough space in the grid view to change the column width, FALSE is returned * indicating that the column was not resized. Otherwise, the column is resized * and TRUE is returned. */ Bool setColumnWidth( Index columnIndex, Float newWidth ); /// Return whether or not the column with the specified index can be resized automatically. /** * A column may be resized automatically when other columns are resized. If the return value * is FALSE, the indexed column cannot be resized automatically. However, setColumnWidth() * will still resize a non-resizable column. */ RIM_INLINE Bool getColumnIsResizable( Index columnIndex ) const { if ( columnIndex < columns.getSize() ) return columns[columnIndex].isResizable; return false; } /// Set whether or not the column with the specified index can be resized automatically. /** * A column may be resized automatically when other columns are resized. If the return value * is FALSE, the indexed column cannot be resized automatically. However, setColumnWidth() * will still resize a non-resizable column. * * If an invalid column index is specified, the method has no effect. */ RIM_INLINE void setColumnIsResizable( Index columnIndex, Bool newIsResizable ) { if ( columnIndex < columns.getSize() ) columns[columnIndex].isResizable = newIsResizable; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Object Accessor Methods /// Return the total number of GUIObjects that are part of the specified cell of this grid view. /** * If the row or column index is invalid, 0 is returned. Otherwise, the * number of objects in the specified cell is returned. */ RIM_INLINE Size getObjectCount( Index rowIndex, Index columnIndex ) const { if ( rowIndex < rows.getSize() && columnIndex < columns.getSize() ) return getCell( rowIndex, columnIndex ).objects.getSize(); else return 0; } /// Return a pointer to the object at the given index in the specified cell of this grid view. /** * Objects are stored in back-to-front sorted order, such that the object * with index 0 is the furthest toward the back of the object ordering. */ RIM_INLINE Pointer<GUIObject> getObject( Index rowIndex, Index columnIndex, Index objectIndex ) const { if ( rowIndex < rows.getSize() && columnIndex < columns.getSize() ) { const GridCell& cell = getCell( rowIndex, columnIndex ); if ( objectIndex < cell.objects.getSize() ) return cell.objects[objectIndex]; } return Pointer<GUIObject>(); } /// Add the specified object to the given cell of this grid view. /** * If the specified object pointer is NULL, the method fails and FALSE * is returned. Otherwise, the object is inserted in the front-to-back order * of the grid view cell's objects and TRUE is returned. */ Bool addObject( Index rowIndex, Index columnIndex, const Pointer<GUIObject>& newObject ); /// Remove the specified object from the given cell of this grid view. /** * If the given object is part of this grid view, the method removes it * and returns TRUE. Otherwise, if the specified object is not found, * the method doesn't modify the grid view and FALSE is returned. */ Bool removeObject( Index rowIndex, Index columnIndex, const GUIObject* oldObject ); /// Remove all objects from the specified cell of this grid view. void clearObjects( Index rowIndex, Index columnIndex ); /// Remove all objects from all cells of this grid view. void clearObjects(); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Border Accessor Methods /// Return a mutable object which describes this grid view's border. RIM_INLINE Border& getBorder() { return border; } /// Return an object which describes this grid view's border. RIM_INLINE const Border& getBorder() const { return border; } /// Set an object which describes this grid view's border. RIM_INLINE void setBorder( const Border& newBorder ) { border = newBorder; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Content Bounding Box Accessor Methods /// Return the 3D bounding box for the grid view's content display area in its local coordinate frame. RIM_INLINE AABB3f getLocalContentBounds() const { return AABB3f( this->getLocalContentBoundsXY(), AABB1f( Float(0), this->getSize().z ) ); } /// Return the 2D bounding box for the grid view's content display area in its local coordinate frame. RIM_INLINE AABB2f getLocalContentBoundsXY() const { return border.getContentBounds( AABB2f( Vector2f(), this->getSizeXY() ) ); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Color Accessor Methods /// Return the background color for this grid view's main area. RIM_INLINE const Color4f& getBackgroundColor() const { return backgroundColor; } /// Set the background color for this grid view's main area. RIM_INLINE void setBackgroundColor( const Color4f& newBackgroundColor ) { backgroundColor = newBackgroundColor; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Border Color Accessor Methods /// Return the border color used when rendering a grid view. RIM_INLINE const Color4f& getBorderColor() const { return borderColor; } /// Set the border color used when rendering a grid view. RIM_INLINE void setBorderColor( const Color4f& newBorderColor ) { borderColor = newBorderColor; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Update Method /// Update the current internal state of this grid view for the specified time interval in seconds. /** * This method recursively calls the update() methods for all child objects * so that they are updated. */ virtual void update( Float dt ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Drawing Method /// Draw this grid view using the specified GUI renderer to the given parent coordinate system bounds. /** * The method returns whether or not the grid view was successfully drawn. */ virtual Bool drawSelf( GUIRenderer& renderer, const AABB3f& parentBounds ) const; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Input Handling Methods /// Handle the specified keyboard event for the entire grid view. virtual void keyEvent( const KeyboardEvent& event ); /// Handle the specified mouse motion event for the entire grid view. virtual void mouseMotionEvent( const MouseMotionEvent& event ); /// Handle the specified mouse button event for the entire grid view. virtual void mouseButtonEvent( const MouseButtonEvent& event ); /// Handle the specified mouse wheel event for the entire grid view. virtual void mouseWheelEvent( const MouseWheelEvent& event ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Static Construction Methods /// Construct a smart-pointer-wrapped instance of this class using the constructor with the given arguments. RIM_INLINE static Pointer<GridView> construct() { return Pointer<GridView>::construct(); } /// Construct a smart-pointer-wrapped instance of this class using the constructor with the given arguments. RIM_INLINE static Pointer<GridView> construct( const Rectangle& newRectangle, Size numRows = 1, Size numColumns = 1 ) { return Pointer<GridView>::construct( newRectangle, numRows, numColumns ); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Public Static Data Members /// The default border that is used for a grid view. static const Border DEFAULT_BORDER; /// The default background color that is used for a grid view's area. static const Color4f DEFAULT_BACKGROUND_COLOR; /// The default border color that is used for a grid view. static const Color4f DEFAULT_BORDER_COLOR; private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Class Declaration /// A class which contains information about a single cell for this grid view. class GridCell { public: /// A list of the child objects of the grid cell. ArrayList<Pointer<GUIObject> > objects; }; /// A class which contains information about a row for the grid view. class GridRow { public: /// Create a resizable grid row with 0 height. RIM_INLINE GridRow( Float newHeight = 0 ) : height( newHeight ), isResizable( true ) { } /// The height of this row as a fraction of the grid view's total content area height. Float height; /// A boolean value indicating whether or not this row can be automatically resized. Bool isResizable; }; /// A class which contains information about a column for the grid view. class GridColumn { public: /// Create a resizable grid column with 0 width. RIM_INLINE GridColumn( Float newWidth = 0 ) : width( newWidth ), isResizable( true ) { } /// The width of this row as a fraction of the grid view's total content area width. Float width; /// A boolean value indicating whether or not this column can be automatically resized. Bool isResizable; }; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Helper Methods /// Return the size for the grid view's content display area in its local coordinate frame. RIM_INLINE Vector2f getLocalContentSize() const { return this->getLocalContentBoundsXY().getSize(); } /// Return a reference to the grid cell at the specified (row, column) index. RIM_INLINE GridCell& getCell( Index rowIndex, Index columnIndex ) { return cells[rowIndex*columns.getSize() + columnIndex]; } /// Return a reference to the grid cell at the specified (row, column) index. RIM_INLINE const GridCell& getCell( Index rowIndex, Index columnIndex ) const { return cells[rowIndex*columns.getSize() + columnIndex]; } /// Initialize the (previously uninitialized) grid with the specified number of rows and columns. void initializeGrid( Size newNumRows, Size newNumColumns ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Members /// An array of the cells in this grid view, stored in a row-major 1D format. Array<GridCell> cells; /// An array of information about the rows in this grid view. Array<GridRow> rows; /// An array of information about the columns in this grid view. Array<GridColumn> columns; /// An object which describes the border for this grid view. Border border; /// The background color for the grid view's area. Color4f backgroundColor; /// The border color for the grid view's background area. Color4f borderColor; }; //########################################################################################## //************************ End Rim Graphics GUI Namespace ******************************** RIM_GRAPHICS_GUI_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_GRAPHICS_GUI_GRID_VIEW_H <file_sep>/* * rimSoundMIDIDecoder.h * Rim Sound * * Created by <NAME> on 5/31/13. * Copyright 2013 __MyCompanyName__. All rights reserved. * */ #ifndef INCLUDE_RIM_SOUND_MIDI_DECODER_H #define INCLUDE_RIM_SOUND_MIDI_DECODER_H #include "rimSoundIOConfig.h" //########################################################################################## //*************************** Start Rim Sound IO Namespace ******************************* RIM_SOUND_IO_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class which decodes MIDI file data into a stream of MIDI events. class MIDIDecoder : public MIDIInputStream { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Seeking Methods /// Return whether or not seeking is allowed for this MIDI decoder. virtual Bool canSeek() const; /// Return whether or not this MIDI decoder's current position can be moved by the specified signed event offset. /** * This event offset is specified as the signed number of MIDI events to move * in the stream. */ virtual Bool canSeek( Int64 relativeEventOffset ) const; /// Move the current event position in the stream by the specified signed amount of events. /** * This method attempts to seek the position in the stream by the specified amount of MIDI events. * The method returns the signed amount that the position in the stream was changed * by. Thus, if seeking is not allowed, 0 is returned. Otherwise, the stream should * seek as far as possible in the specified direction and return the actual change * in position. */ virtual Int64 seek( Int64 relativeEventOffset ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Stream Size Accessor Methods /// Return the number of MIDI events remaining for the MIDI decoder. /** * The value returned must only be a lower bound on the total number of MIDI * events in the stream. For instance, if there are events remaining, the method * should return at least 1. If there are no events remaining, the method should * return 0. This behavior is allowed in order to support never-ending streams * which might not have a defined endpoint. */ virtual Size getEventsRemaining() const; /// Return the current position of the stream in events relative to the start of the stream. /** * The returned value indicates the event index of the current read * position within the MIDI stream. For unbounded streams, this indicates * the number of samples that have been read by the stream since it was opened. */ virtual Index getPosition() const; protected: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Protected MIDI Stream Methods /// Read the specified number of MIDI events from the input stream into the output buffer. /** * This method attempts to read the specified number of MIDI events from the * stream into the buffer and then returns the total number of events that * were successfully read. The stream's current position is incremented by the * return value. * * The timestamps of the returned MIDI events are specified relative to the start * of the stream. */ virtual Size readEvents( MIDIBuffer& buffer, Size numEvents ); protected: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Members }; //########################################################################################## //*************************** End Rim Sound IO Namespace ********************************* RIM_SOUND_IO_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_SOUND_MIDI_DECODER_H <file_sep>/* * rimXMLAttribute.h * Rim XML * * Created by <NAME> on 9/23/13. * Copyright 2013 __MyCompanyName__. All rights reserved. * */ #ifndef INCLUDE_RIM_XML_ATTRIBUTE_H #define INCLUDE_RIM_XML_ATTRIBUTE_H #include "rimXMLConfig.h" //########################################################################################## //****************************** Start Rim XML Namespace ********************************* RIM_XML_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class which represents a name-value pair of data for an XML element. class XMLAttribute { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructors /// Create a new XML node attribute with the specified name and value strings. RIM_INLINE XMLAttribute( const UTF8String& newName, const UTF8String& newValue ) : name( newName ), value( newValue ) { } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Attribute Value Accessor Methods /// Return a string representing the name of this XML node attribute. RIM_INLINE const UTF8String& getName() const { return name; } /// Set a string representing the name of this XML node attribute. RIM_INLINE void setName( const UTF8String& newName ) { name = newName; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Attribute Value Accessor Methods /// Return a string representing the value of this XML node attribute. RIM_INLINE const UTF8String& getValue() const { return value; } /// Set a string representing the value of this XML node attribute. RIM_INLINE void setValue( const UTF8String& newValue ) { value = newValue; } private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Members /// A string representing the name of this XML node attribute. UTF8String name; /// A string representing the value of this XML node attribute. UTF8String value; }; //########################################################################################## //****************************** End Rim XML Namespace *********************************** RIM_XML_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_XML_ATTRIBUTE_H <file_sep>/* * rimGraphicsLightsConfig.h * Rim Graphics * * Created by <NAME> on 5/16/12. * Copyright 2012 __MyCompanyName__. All rights reserved. * */ #ifndef INCLUDE_RIM_GRAPHICS_LIGHTS_CONFIG_H #define INCLUDE_RIM_GRAPHICS_LIGHTS_CONFIG_H #include "../rimGraphicsConfig.h" #include "../rimGraphicsUtilities.h" //########################################################################################## //########################################################################################## //############ //############ Library Namespace Configuration //############ //########################################################################################## //########################################################################################## #ifndef RIM_GRAPHICS_LIGHTS_NAMESPACE_START #define RIM_GRAPHICS_LIGHTS_NAMESPACE_START RIM_GRAPHICS_NAMESPACE_START namespace lights { #endif #ifndef RIM_GRAPHICS_LIGHTS_NAMESPACE_END #define RIM_GRAPHICS_LIGHTS_NAMESPACE_END }; RIM_GRAPHICS_NAMESPACE_END #endif //########################################################################################## //************************ Start Rim Graphics Lights Namespace *************************** RIM_GRAPHICS_LIGHTS_NAMESPACE_START //****************************************************************************************** //########################################################################################## using rim::graphics::util::ViewVolume; using rim::graphics::util::BoundingCone; //########################################################################################## //************************ End Rim Graphics Lights Namespace ***************************** RIM_GRAPHICS_LIGHTS_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_GRAPHICS_LIGHTS_CONFIG_H <file_sep>/* * rimSoundFilterResult.h * Rim Sound * * Created by <NAME> on 12/10/12. * Copyright 2012 __MyCompanyName__. All rights reserved. * */ #ifndef INCLUDE_RIM_SOUND_FILTER_RESULT_H #define INCLUDE_RIM_SOUND_FILTER_RESULT_H #include "rimSoundFiltersConfig.h" //########################################################################################## //************************ Start Rim Sound Filters Namespace ***************************** RIM_SOUND_FILTERS_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class which represents the result of a sound filter processing step. class SoundFilterResult { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Status Enum Declaration /// An enum type which describes the different allowed SoundFilter result statuses. typedef enum Status { /// A result status indicating that filter processing was successful. /** * The number of samples that were successfully processed is stored in the result. */ SUCCESS, /// A result status indicating that filter processing was successful and that the result is silence. /** * This status means that all outputs of the given filter processing step should * be interpreted as silent for the number of samples given by the result. * This status can be used to ignore filter outputs that produce no sound and thus * don't need to be processed. */ SILENCE, /// A result status indicating that there are no more filter samples to process. /** * This status is primarily valid when used by a filter that does not depend on * any input (such as a sound player). It indicates that the end of the given sound * source has been reached and will not produce anymore sound. Therefore, this * status could be used to halt usage of a particular output-only filter once * it has produced all sound it can. */ END, /// A result status indicating that an error occurred during processing. /** * The number of samples that were successfully processed is stored in the result. * Therefore, a filter can indicate if an error occurred while still producing some * audio. */ ERROR }; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructors /// Create new result with the END status that has 0 valid output samples. RIM_INLINE SoundFilterResult() : status( END ), numSamples( 0 ) { } /// Create new result with the SUCCESS status that has the specified number of valid output samples. RIM_INLINE SoundFilterResult( Size newNumSamples ) : status( SUCCESS ), numSamples( newNumSamples ) { } /// Create new result with the specified status that has 0 valid output samples. RIM_INLINE SoundFilterResult( Status newStatus ) : status( newStatus ), numSamples( 0 ) { } /// Create new result with the given status that has the specified number of valid output samples. RIM_INLINE SoundFilterResult( Status newStatus, Size newNumSamples ) : status( newStatus ), numSamples( newNumSamples ) { } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Number of Samples Accessor Method /// Return the total number of samples that were produced as part of this filter result. RIM_INLINE Size getSampleCount() const { return numSamples; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Result Conversion Operators /// Convert this filter result to an enum value representing its status. RIM_INLINE operator Status () const { return status; } /// Convert this filter result to a boolean value indicating if the result is a successful one. /** * The result statuses that indicate a successful result are SUCCESS and SILENCE. */ RIM_INLINE operator Bool () const { return status == SUCCESS || status == SILENCE; } /// Convert this filter result into an integer representing the number of samples that were processed. RIM_INLINE operator Size () const { return numSamples; } private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Members /// An enum value indicating the type of filter result that this is. Status status; /// The number of valid samples that were processed by the filter. Size numSamples; }; //########################################################################################## //************************ End Rim Sound Filters Namespace ******************************* RIM_SOUND_FILTERS_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_SOUND_FILTER_RESULT_H <file_sep>#include "Global_planner.h" <file_sep>/* * rimPhysicsCollisionShapeCapsule.h * Rim Physics * * Created by <NAME> on 6/6/12. * Copyright 2012 __MyCompanyName__. All rights reserved. * */ #ifndef INCLUDE_RIM_PHYSICS_COLLISION_SHAPE_CAPSULE_H #define INCLUDE_RIM_PHYSICS_COLLISION_SHAPE_CAPSULE_H #include "rimPhysicsShapesConfig.h" #include "rimPhysicsCollisionShape.h" #include "rimPhysicsCollisionShapeBase.h" #include "rimPhysicsCollisionShapeInstance.h" //########################################################################################## //************************ Start Rim Physics Shapes Namespace **************************** RIM_PHYSICS_SHAPES_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class which represents a capsule collision shape. class CollisionShapeCapsule : public CollisionShapeBase<CollisionShapeCapsule> { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Public Class Declarations class Instance; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructors /// Create a default capsule shape with radius 1, height 1, and centered at the origin. CollisionShapeCapsule(); /// Create a capsule shape with the specified endpoints and radius. /** * This creates a Capsule with both circular end cap radii equal * to the specified radius value. */ CollisionShapeCapsule( const Vector3& newEndpoint1, const Vector3& newEndpoint2, Real newRadius ); /// Create a capsule shape with the specified endpoints and radii. CollisionShapeCapsule( const Vector3& newEndpoint1, const Vector3& newEndpoint2, Real newRadius1, Real newRadius2 ); /// Create a capsule shape with the specified endpoints, radii, and material CollisionShapeCapsule( const Vector3& newEndpoint1, const Vector3& newEndpoint2, Real newRadius1, Real newRadius2, const CollisionShapeMaterial& newMaterial ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Point 1 Accessor Methods /// Return a const reference to the center of this capsule's bottom circular cap. RIM_FORCE_INLINE const Vector3& getEndpoint1() const { return endpoint1; } /// Set the position of the center of the capsule's bottom circular cap. /** * This keeps the capsule's 2nd endpoint in the same location and * updates all other capsule properties to be consistent with the new * first endpoint. */ RIM_INLINE void setEndpoint1( const Vector3& newEndpoint1 ) { endpoint1 = newEndpoint1; axis = endpoint2 - endpoint1; height = axis.getMagnitude(); axis /= height; updateDependentQuantities(); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Point 2 Accessor Methods /// Return a const reference to the center of this capsule's top circular cap. RIM_FORCE_INLINE const Vector3& getEndpoint2() const { return endpoint2; } /// Set the position of the center of the capsule's top circular cap. /** * This keeps the capsule's 1st endpoint in the same location and * updates all other capsule properties to be consistent with the new * 2nd endpoint. */ RIM_INLINE void setEndpoint2( const Vector3& newEndpoint2 ) { endpoint2 = newEndpoint2; axis = endpoint2 - endpoint1; height = axis.getMagnitude(); axis /= height; updateDependentQuantities(); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Radius 1 Accessor Methods /// Return the radius of this capsule's bottom circular cap in shape space. RIM_FORCE_INLINE Real getRadius1() const { return radius1; } /// Set the radius of this capsule's bottom circular cap in shape space. /** * This radius value is clamped to the range of [0,+infinity]. */ RIM_INLINE void setRadius1( Real newRadius1 ) { radius1 = math::max( newRadius1, Real(0) ); updateDependentQuantities(); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Radius 2 Accessor Methods /// Return the radius of this capsule's top circular cap in shape space. RIM_FORCE_INLINE Real getRadius2() const { return radius2; } /// Set the radius of this capsule's bottom circular cap in shape space. /** * This radius value is clamped to the range of [0,+infinity]. */ RIM_INLINE void setRadius2( Real newRadius2 ) { radius2 = math::max( newRadius2, Real(0) ); updateDependentQuantities(); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Axis Accessor Methods /// Return a const reference to the normalized axis of this capsule. RIM_FORCE_INLINE const Vector3& getAxis() const { return axis; } /// Set the axis of this capsule's shaft. /** * This new axis vector is normalized and then the capsule's * 2nd endpoint is recomputed using the new axis vector and * the capsule's height and 1st endpoint. */ RIM_INLINE void setAxis( const Vector3& newAxis ) { axis = newAxis.normalize(); endpoint2 = endpoint1 + axis*height; updateDependentQuantities(); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Height Accessor Methods /// Return the distance from this capsule's top to bottom end caps. RIM_FORCE_INLINE Real getHeight() const { return height; } /// Set the distance from this capsule's top to bottom end caps. /** * This method keeps the capsule's first endpoint at the same location * and recomputes the capsule's 2nd endpoint based on the capsule's * axis and the new height value. * * This height value is clamped to the range of [0,+infinity]. */ RIM_INLINE void setHeight( Real newHeight ) { height = math::max( newHeight, Real(0) ); endpoint2 = endpoint1 + axis*height; updateDependentQuantities(); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Mass Distribution Accessor Methods /// Return a 3x3 matrix for the inertia tensor of this shape relative to its center of mass. virtual Matrix3 getInertiaTensor() const; /// Return a 3D vector representing the center-of-mass of this shape in its coordinate frame. virtual Vector3 getCenterOfMass() const; /// Return the volume of this shape in length units cubed (m^3). virtual Real getVolume() const; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Instance Creation Methods /// Create and return an instance of this shape. virtual Pointer<CollisionShapeInstance> getInstance() const; private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Helper Methods /// Recompute the bounding sphere, center of mass, volume, and inertia tensor for this convex shape. void updateDependentQuantities(); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Members /// The center of the bottom spherical cap of this capsule shape. Vector3 endpoint1; /// The radius of this capsule's bottom spherical cap. Real radius1; /// The center of the top spherical cap of this Capsule shape. Vector3 endpoint2; /// The radius of this Capsule's top spherical cap. Real radius2; /// The normalized vector along this Capsule's axis from its bottom face to top cap. Vector3 axis; /// The height of this Capsule, the distance between the top and bottom endpoints. Real height; /// The center of mass of this capsule shape. Vector3 centerOfMass; /// The volume of this capsule shape in length units cubed (m^3). Real volume; /// The inertia tensor of this capsule shape where volume is treated as mass. /** * This tensor is then multiplied by the density of the shape in order to produce * the final inertia tensor for the shape. */ Matrix3 volumeInertiaTensor; }; //########################################################################################## //########################################################################################## //############ //############ Sphere Shape Instance Class Definition //############ //########################################################################################## //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class which is used to instance a CollisionShapeCapsule object with an arbitrary rigid transformation. class CollisionShapeCapsule:: Instance : public CollisionShapeInstance { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Transform Update Method /// Update this capsule instance with the specified 3D rigid transformation from shape to world space. /** * This method transforms this instance's position and radius from * shape space to world space. */ virtual void setTransform( const Transform3& newTransform ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Attribute Accessor Methods /// Return a const reference to the center of this capsule's bottom spherical cap. RIM_FORCE_INLINE const Vector3& getEndpoint1() const { return endpoint1; } /// Return a const reference to the center of this capsule's top spherical cap. RIM_FORCE_INLINE const Vector3& getEndpoint2() const { return endpoint2; } /// Return the radius of this capsule's bottom spherical cap in world space. RIM_FORCE_INLINE Real getRadius1() const { return radius1; } /// Return the radius of this capsule's top spherical cap in world space. RIM_FORCE_INLINE Real getRadius2() const { return radius2; } /// Return a const reference to the normalized axis of this capsule. RIM_FORCE_INLINE const Vector3& getAxis() const { return axis; } /// Return the distance from this capsule's top to bottom end caps. RIM_FORCE_INLINE Real getHeight() const { return height; } private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Constructors /// Create a new capsule shape instance which uses the specified base capsule shape. RIM_INLINE Instance( const CollisionShapeCapsule* newCapsule ) : CollisionShapeInstance( newCapsule ) { } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Members /// The center of the bottom circular cap of this capsule shape instance. Vector3 endpoint1; /// The radius of this capsule's bottom circular face. Real radius1; /// The center of the top circular cap of this capsule shape instance. Vector3 endpoint2; /// The radius of this capsule's top circular face. Real radius2; /// The normalized vector along this capsule's axis from its bottom face to top face. Vector3 axis; /// The height of this capsule, the distance between the top and bottom faces. Real height; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Friend Declarations /// Declare the capsule collision shape as a friend so that it can construct instances. friend class CollisionShapeCapsule; }; //########################################################################################## //************************ End Rim Physics Shapes Namespace ****************************** RIM_PHYSICS_SHAPES_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_PHYSICS_COLLISION_SHAPE_CAPSULE_H <file_sep>/* * rimXMLSAXParser.h * Rim Software * * Created by <NAME> on 1/21/14. * Copyright 2014 __MyCompanyName__. All rights reserved. * */ #ifndef INCLUDE_RIM_XML_SAX_PARSER_H #define INCLUDE_RIM_XML_SAX_PARSER_H #include "rimXMLConfig.h" #include "rimXMLNode.h" //########################################################################################## //****************************** Start Rim XML Namespace ********************************* RIM_XML_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class which sequentially parses an XML file as a series of document events. /** * This XML parser allows the user to parse large XML files without being * required to store the entire documents in memory as with an XMLDOMParser. * It uses an event-based interface that uses callback functions to notify * the user that document elements have been parsed. */ class XMLSAXParser { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Delegate Class Declaration /// A class which contains callback functions that are used to recieve XML data by the user. /** * The callback functions may be NULL if the user does not need * access to a specific kind of document data (such as comments or parse errors). */ class Delegate { public: /// Create a new XML parser delegate object. RIM_INLINE Delegate() : userData( NULL ) { } /// The delegate callback function for when the start of an XML element is parsed. /** * The parser provides the tag string and a list of the attributes * for the element that is starting. */ Function<void ( const Delegate&, const UTF8String&, const ArrayList<XMLAttribute>& )> startElement; /// The delegate callback function for when the end of an XML element is parsed. /** * The parser provides the tag string for the element that is ending. */ Function<void ( const Delegate&, const UTF8String& )> endElement; /// The delegate callback function for when text data between elements is parsed. /** * The parser provides a string that contains the text between the * last element and the next. */ Function<void ( const Delegate&, const UTF8String& )> text; /// The delegate callback function for when a comment is parsed. /** * The parser provides the tag string for the element that is ending. */ Function<void ( const Delegate&, const UTF8String& )> comment; /// The delegate callback function for when a parse error occurs. /** * The parser provides a string which describes the error that occurred. */ Function<void ( const Delegate&, const UTF8String& )> error; /// A pointer to data that can store user-specific information for the delegate. void* userData; }; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructors /// Create a new XML parser with the default initial state. XMLSAXParser(); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Document Input Methods /// Parse an XML file located at the specified path location in the local file system. /** * The parser parses the specified file and sends the file data to the * delegate object's callback functions if they are set. * * If the parsing succeeds, the method returns TRUE. Otherwise, the method returns * FALSE. */ Bool readFile( const UTF8String& pathToFile, const Delegate& delegate ) const; /// Parse a memory-resident XML document string. /** * The parser parses the specified file and sends the file data to the * delegate object's callback functions if they are set. * * If the parsing succeeds, the method returns TRUE. Otherwise, the method returns * FALSE. */ Bool readString( const UTF8String& documentString, const Delegate& delegate ) const; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Document Output Methods private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** XML Input Helper Methods Bool parseUTF8Document( const UTF8String& documentString, const Delegate& delegate ) const; Bool parseElement( UTF8StringIterator& iterator, const Delegate& delegate ) const; Bool parseAttribute( UTF8StringIterator& iterator, UTF8String& name, UTF8String& value ) const; Bool parseIdentifier( UTF8StringIterator& iterator, UTF8String& identifier ) const; static Bool parseCharacterEntity( UTF8StringIterator& iterator, UTF32Char& character ); static Bool skipWhitespace( UTF8StringIterator& iterator ); /// Return whether or not the specified character is a word character (letter, number, or underscore). RIM_INLINE static Bool isWordCharacter( UTF32Char c ) { return UTF32String::isALetter(c) || UTF32String::isADigit(c) || c == '_'; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Members /// A string buffer used to accumulate a series of input characters. mutable UTF32StringBuffer buffer; /// A string buffer used to accumulate a series of output characters. mutable UTF8StringBuffer outputBuffer; /// A stack of the previously parsed element nodes that have not yet been ended. mutable ArrayList<UTF8String> elementStack; /// A list of temporary attributes for the current element that is being parsed. mutable ArrayList<XMLAttribute> attributes; }; //########################################################################################## //****************************** End Rim XML Namespace *********************************** RIM_XML_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_XML_SAX_PARSER_H <file_sep>/* * rimGraphicsOpenGLContext.h * Rim Graphics * * Created by <NAME> on 3/1/13. * Copyright 2013 __MyCompanyName__. All rights reserved. * */ #ifndef INCLUDE_RIM_GRAPHICS_OPENGL_CONTEXT_H #define INCLUDE_RIM_GRAPHICS_OPENGL_CONTEXT_H #include "rimGraphicsOpenGLConfig.h" //########################################################################################## //******************** Start Rim Graphics Devices OpenGL Namespace *********************** RIM_GRAPHICS_DEVICES_OPENGL_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class which represents an instance of an OpenGL-based renderer. class OpenGLContext : public GraphicsContext { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Destructor /// Destroy this OpenGL context and release all of its resources and internal state. ~OpenGLContext(); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Target View Accessor Methods /// Return a pointer to the target render view which this OpenGL context should render to. virtual Pointer<RenderView> getTargetView() const; /// Set the target render view which this OpenGL context should render to. virtual Bool setTargetView( const Pointer<RenderView>& newTargetView ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Context Validity Accessor Method /// Return whether or not this context is valid and can be used for rendering. /** * Users should check the return value of this method after context creation * to ensure that the context was successfully created. */ virtual Bool isValid() const; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Context Capabilities Accessor Methods /// Return an object which describes the different capabilities of this graphics context. virtual const GraphicsContextCapabilities& getCapabilities() const; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Current Context Accessor Methods /// Return whether or not this context is the current context for the calling thread. virtual Bool isCurrent(); /// Make this context the active context for the calling thread. virtual Bool makeCurrent(); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Buffer Swap Method /// Flush all rendering commands and swap the front buffer with the back buffer. virtual void swapBuffers(); /// Return whether or not vertical screen refresh synchronization is enabled. virtual Bool getVSyncIsEnabled() const; /// Set whether or not vertical screen refresh synchronization should be enabled. /** * The method returns whether or not setting the V-Sync status was successful. */ virtual Bool setVSyncIsEnabled( Bool newVSync ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Flush Methods /// Flush all rendering commands into the graphics pipeline. virtual void flush(); /// Flush all rendering commands into the graphics pipeline and wait until they are complete. virtual void finish(); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Render Mode Accessor Methods /// Return an object which contains information about the current state of the context's renderer. virtual RenderMode getRenderMode() const; /// Set the mode of the context's renderer. virtual Bool setRenderMode( const RenderMode& newRenderMode ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Render Flags Accessor Methods /// Return an object which contains boolan flags for the current state of the context's renderer. virtual RenderFlags getRenderFlags() const; /// Set an object which contains boolan flags for the current state of the context's renderer. virtual Bool setRenderFlags( const RenderFlags& newRenderFlags ); /// Return whether or not a certain render flag is currently set. virtual Bool getRenderFlagIsSet( RenderFlags::Flag flag ) const; /// Set whether or not a certain render flag should be set. virtual Bool setRenderFlag( RenderFlags::Flag flag, Bool value = true ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Depth Mode Accessor Methods /// Return an object which contains information about the current state of the context's depth test pipeline. virtual DepthMode getDepthMode() const; /// Set the mode of the context's depth test pipeline. virtual Bool setDepthMode( const DepthMode& newDepthMode ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Stencil Mode Accessor Methods /// Return an object which contains information about the current state of the context's stencil test pipeline. virtual StencilMode getStencilMode() const; /// Set the mode of the context's stencil test pipeline. virtual Bool setStencilMode( const StencilMode& newStencilMode ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Blend Mode Accessor Methods /// Return an object which contains information about the current state of the context's blending pipeline. virtual BlendMode getBlendMode() const; /// Set the mode of the context's blending pipeline. virtual Bool setBlendMode( const BlendMode& newBlendMode ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Line Width Accessor Methods /// Return the width in pixels to use when rendering lines. virtual Float getLineWidth() const; /// Set the width in pixels to use when rendering lines. virtual Bool setLineWidth( Float newLineWidth ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Point Size Accessor Methods /// Return the size in pixels to use when rendering points. virtual Float getPointSize() const; /// Set the size in pixels to use when rendering points. virtual Bool setPointSize( Float newPointSize ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Viewport Accessor Methods /// Return an object representing the current viewport for this OpenGL context. virtual Viewport getViewport() const; /// Set the viewport to use for this OpenGL context. virtual Bool setViewport( const Viewport& newViewport ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Scissor Test Accessor Methods /// Return an object representing the current scissor test for this graphics context. virtual ScissorTest getScissorTest() const; /// Set an object representing the current scissor test for this graphics context. virtual Bool setScissorTest( const ScissorTest& newScissorTest ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Framebuffer Clearing Methods /// Clear the contents of the color buffer, writing the specified color to every pixel. virtual void clearColorBuffer( const Color4d& clearColor ); /// Clear the contents of the depth buffer, writing the specified depth to every pixel. virtual void clearDepthBuffer( Double clearDepth ); /// Clear the contents of the stencil buffer, writing the specified integer value to every pixel. virtual void clearStencilBuffer( Int clearStencil ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Framebuffer Read Methods /// Read an image corresponding to the entire contents of the context's current color buffer. virtual Bool readColorBuffer( const PixelFormat& pixelType, Image& image ) const; /// Read an image corresponding to the specified contents of the context's current color buffer. virtual Bool readColorBuffer( const PixelFormat& pixelType, Image& image, const AABB2i& bounds ) const; /// Read an image corresponding to the entire contents of the context's current depth buffer. virtual Bool readDepthBuffer( const PixelFormat& pixelType, Image& image ) const; /// Read an image corresponding to the specified contents of the context's current depth buffer. virtual Bool readDepthBuffer( const PixelFormat& pixelType, Image& image, const AABB2i& bounds ) const; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Framebuffer Binding Methods /// Return a 2D vector containing the size in pixels of the currently bound framebuffer. virtual Vector2D<Size> getFramebufferSize() const; /// Return a pointer to the currently bound framebuffer object. virtual Pointer<Framebuffer> getFramebuffer() const; /// Set the currently bound framebuffer object. virtual Bool bindFramebuffer( const Pointer<Framebuffer>& newFramebuffer ); /// Unbind the previously bound framebuffer, restoring the main screen as the target. virtual void unbindFramebuffer(); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Drawing Methods /// Draw the specified shader pass, indexing vertices using a range of the given index buffer. virtual Bool draw( const ShaderPass& shaderPass, const IndexBuffer& indices, const BufferRange& bufferRange, const ShaderBindingData* shaderData = NULL ); /// Draw the specified shader pass, using a range of vertices from the shader pass's vertex buffers. virtual Bool draw( const ShaderPass& shaderPass, const BufferRange& bufferRange, const ShaderBindingData* shaderData = NULL ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Buffer Creation Methods /// Create a vertex attribute buffer with undefined attribute type and capacity. virtual Pointer<VertexBuffer> createVertexBuffer( const HardwareBufferUsage& newUsage = HardwareBufferUsage::STATIC ); /// Create a vertex attribute buffer with the specified attribute type and capacity. virtual Pointer<VertexBuffer> createVertexBuffer( const AttributeType& attributeType, Size capacity, const HardwareBufferUsage& newUsage = HardwareBufferUsage::STATIC ); /// Create a vertex attribute buffer with the specified attributes, attribute type and capacity. virtual Pointer<VertexBuffer> createVertexBuffer( const void* attributes, const AttributeType& attributeType, Size capacity, const HardwareBufferUsage& newUsage = HardwareBufferUsage::STATIC ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Index Buffer Creation Methods /// Create an index buffer with undefined attribute type and capacity. virtual Pointer<IndexBuffer> createIndexBuffer( const HardwareBufferUsage& newUsage = HardwareBufferUsage::STATIC ); /// Create an index buffer with the specified attribute type and capacity. virtual Pointer<IndexBuffer> createIndexBuffer( const PrimitiveType& indexType, Size capacity, const HardwareBufferUsage& newUsage = HardwareBufferUsage::STATIC ); /// Create an index buffer with the specified attributes, attribute type and capacity. virtual Pointer<IndexBuffer> createIndexBuffer( const void* indices, const PrimitiveType& indexType, Size capacity, const HardwareBufferUsage& newUsage = HardwareBufferUsage::STATIC ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Texture Creation Methods /// Create a default uninitialized texture with undefined format and size. virtual Pointer<Texture> createTexture(); /// Create a 1D texture with the specified internal format and size with undefined pixel data. virtual Pointer<Texture> createTexture1D( TextureFormat format, Size width ); /// Create a 2D texture with the specified internal format and size with undefined pixel data. virtual Pointer<Texture> createTexture2D( TextureFormat format, Size width, Size height ); /// Create a 3D texture with the specified internal format and size with undefined pixel data. virtual Pointer<Texture> createTexture3D( TextureFormat format, Size width, Size height, Size depth ); /// Create a 2D cube map texture with the specified internal format and size with undefined pixel data. virtual Pointer<Texture> createTextureCube( TextureFormat format, Size width ); /// Create a texture for the specified image which has the given internal texture format. virtual Pointer<Texture> createTexture( const Image& image, TextureFormat format ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Framebuffer Creation Methods /// Create a new framebuffer object for this context. virtual Pointer<Framebuffer> createFramebuffer(); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Shader Creation Methods /// Create a new shader with the specified type and source code. virtual Pointer<Shader> createShader( const ShaderType& newShaderType, const ShaderSourceString& newSource, const ShaderLanguage& newLanguage = ShaderLanguage::DEFAULT ); /// Create a new shader program object. virtual Pointer<ShaderProgram> createShaderProgram(); /// Create a new shader program object that uses the specified shader program source code. virtual Pointer<ShaderProgram> createShaderProgram( const GenericShaderProgram& programSource ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Shader Pass Creation Methods /// Create and return a shader pass object for the given shader program and rendering mode. virtual Pointer<ShaderPass> createShaderPass( const Pointer<ShaderProgram>& program, const RenderMode& renderMode ); /// Create and return a shader pass object for the given shader pass source code. virtual Pointer<ShaderPass> createShaderPass( const Pointer<ShaderPassSource>& shaderPassSource ); /// Create and return a shader pass object for the given generic shader pass. virtual Pointer<ShaderPass> createShaderPass( const GenericShaderPass& genericShaderPass ); /// Return a pointer to the most compatible shader pass source for the specified generic shader pass. virtual Pointer<ShaderPassSource> getBestShaderPassSource( const GenericShaderPass& genericShaderPass ); /// Create and return a default shader pass source object for the given shader pass usage. virtual Pointer<ShaderPassSource> getDefaultShaderPassSource( const ShaderPassUsage& usage ); /// Create and return a default shader pass object for the given shader pass usage. virtual Pointer<ShaderPass> createDefaultShaderPass( const ShaderPassUsage& usage ); /// Recompile the specified shader pass object with the current state of its parameter configuration. virtual Bool recompileShaderPass( const Pointer<ShaderPass>& shaderPass ); private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Wrapper Class Declaration /// A class which wraps platform-specific state for this OpenGL context. class Wrapper; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Friend Class Declaration /// Declare the OpenGLDevice class as a friend so that it can create instances of this class. friend class OpenGLDevice; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Constructors /// Create a new OpenGL context which most closely matches the specified pixel format and flags. /** * This constructor allows the user to share another context's resources with * this context. */ OpenGLContext( const Pointer<RenderView>& targetView, const RenderedPixelFormat& pixelFormat, const GraphicsContextFlags& flags ); /// Doesn't do anthing because you can't 'copy' OpenGL contexts. OpenGLContext( const OpenGLContext& other ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Assignment Operator /// Doesn't do anthing because you can't 'assign' OpenGL contexts. OpenGLContext& operator = ( const OpenGLContext& other ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Initialization Methods /// Initialize the OpenGL state to a reasonable default. void initializeOpenGL(); /// Determine the capabilities of this OpenGL context and store the result. void determineCapabilities(); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Binding Methods /// Bind the specified shader pass to the current draw context. Bool bindShaderPass( const ShaderPass& shaderPass, const ShaderBindingData* shaderData ); /// Submit the specified constant binding to the current OpenGL state. RIM_FORCE_INLINE void submitConstantBinding( const ConstantVariable& binding, const void* value ); /// Submit the specified texture binding to the current OpenGL state. RIM_FORCE_INLINE void submitTextureBinding( const TextureVariable& variable, Index& textureUnit, const Resource<Texture>* textures ); /// Submit the specified vertex binding to the current OpenGL state. RIM_FORCE_INLINE void submitVertexBinding( const VertexBinding& binding, const Pointer<VertexBuffer>* buffers ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Render Mode Helper Methods /// Update the current OpenGL pipeline with the specified render mode. RIM_FORCE_INLINE Bool updateRenderMode( const RenderMode& newRenderMode, Bool forceSet = false ); /// Update the current OpenGL pipeline with the specified render mode. /** * This variant doesn't bother to update any pipeline state if the * flag associated with that state is not enabled. For example, if * blending is disabled, its state will not be updated, increasing performance. */ RIM_FORCE_INLINE Bool updateRenderModeFast( const RenderMode& newRenderMode ); /// Update the current OpenGL pipeline with the specified render mode. RIM_FORCE_INLINE Bool updateRenderFlags( RenderFlags newFlags, Bool forceSet = false ); /// Update the current OpenGL pipeline with the specified rasterization mode. RIM_FORCE_INLINE Bool updateRasterMode( const RasterMode& newRasterMode, Bool forceSet = false ); /// Update the current OpenGL pipeline with the specified depth mode. RIM_FORCE_INLINE Bool updateDepthMode( const DepthMode& newDepthMode, Bool forceSet = false ); /// Update the current OpenGL pipeline with the specified stencil mode. RIM_FORCE_INLINE Bool updateStencilMode( const StencilMode& newStencilMode, Bool forceSet = false ); /// Update the current OpenGL pipeline with the specified blend mode. RIM_FORCE_INLINE Bool updateBlendMode( const BlendMode& newBlendMode, Bool forceSet = false ); /// Update the current OpenGL pipeline with the specified alpha test. RIM_FORCE_INLINE Bool updateAlphaTest( const AlphaTest& newAlphaTest, Bool forceSet = false ); /// Update the current OpenGL pipeline with the specified line width. RIM_FORCE_INLINE Bool updateLineWidth( Float newLineWidth, Bool forceSet = false ); /// Update the current OpenGL pipeline with the specified point size. RIM_FORCE_INLINE Bool updatePointSize( Float newPointSize, Bool forceSet = false ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Uniform Specification Helper Methods /// Submit an integer uniform value with the specified variable location, array size, and type. RIM_FORCE_INLINE static void glUniformInt( ShaderVariableLocation location, Size count, const AttributeType& type, const GLint* value ); /// Submit a floating point uniform value with the specified variable location, array size, and type. RIM_FORCE_INLINE static void glUniformFloat( ShaderVariableLocation location, Size count, const AttributeType& type, const GLfloat* value ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private OpenGL Enum Conversion Methods /// Convert the specified primitive type to an OpenGL index type enum. RIM_FORCE_INLINE static Bool getOpenGLIndexType( const PrimitiveType& type, OpenGLEnum& glIndexType ); /// Convert the specified primitive type to an OpenGL primitve type enum. RIM_FORCE_INLINE static Bool getOpenGLPrimitiveType( const PrimitiveType& type, OpenGLEnum& glPrimitiveType ); /// Convert the specified indexed primitive type to an OpenGL indexed primitve type enum. RIM_FORCE_INLINE static Bool getOpenGLIndexedPrimitiveType( const IndexedPrimitiveType& type, OpenGLEnum& glPrimitiveType ); /// Convert the specified stencil action to an OpenGL stencil action enum. RIM_FORCE_INLINE static Bool getOpenGLStencilAction( const StencilAction& action, OpenGLEnum& glStencilAction ); /// Convert the specified blend factor to an OpenGL blend factor enum. RIM_FORCE_INLINE static Bool getOpenGLBlendFactor( const BlendFactor& factor, OpenGLEnum& glBlendFactor ); /// Convert the specified blend function to an OpenGL blend function enum. RIM_FORCE_INLINE static Bool getOpenGLBlendFunction( const BlendFunction& function, OpenGLEnum& glBlendFunction ); /// Convert the specified alpha test to an OpenGL alpha test enum. RIM_FORCE_INLINE static Bool getOpenGLAlphaTest( const AlphaTest& test, OpenGLEnum& glAlphaTest ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Helper Methods /// Return whether or not this OpenGL context supports the specified shading language. Bool supportsShaderLanguage( const ShaderLanguage& language ); /// Return the combined GLSL version number for use in the #version preprocessor define. RIM_INLINE static Int getGLSLVersionNumber( const ShaderLanguageVersion& languageVersion ); /// Create a shader pass using the specified compiled program and shader pass source code. Pointer<ShaderPass> createShaderPass( const Pointer<ShaderProgram>& program, const Pointer<ShaderPassSource>& source ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Members /// A pointer to a class which wraps this OpenGL context's internal platform-specific state. Wrapper* wrapper; /// An object representing the pixel format for the OpenGL context's main framebuffer. RenderedPixelFormat pixelFormat; /// An object representing the flags for the OpenGL context. GraphicsContextFlags flags; /// An object describing the capabilities of this OpenGL context. GraphicsContextCapabilities capabilities; /// The major version number of this OpenGL context. Index majorVersion; /// The minor version number of this OpenGL context. Index minorVersion; /// The highest supported GLSL version for this OpenGL context. ShaderLanguageVersion glslVersion; /// A pointer to the target view for this OpenGL context. Pointer<RenderView> targetView; /// An object representing the current viewport for this OpenGL context. Viewport viewport; /// An object representing the scissor test for this OpenGL context. ScissorTest scissorTest; /// An object representing the current render mode of this OpenGL context. RenderMode renderMode; /// The OpenGL ID for the current shader program. OpenGLID currentShaderID; /// A pointer to the currently bound framebuffer object. Pointer<Framebuffer> currentFramebuffer; /// A string buffer used to accumulate the final shader source code strings. StringBuffer sourceBuffer; /// A pointer to an object that contains a library of default shader passes. Pointer<ShaderPassLibrary> defaultShaderPassLibrary; /// A default 1D placeholder texture, a 1 pixel white square. Resource<Texture> defaultTexture1D; /// A default 2D placeholder texture, a 1x1 pixel white square. Resource<Texture> defaultTexture2D; /// A default 3D placeholder texture, a 1x1x1 pixel white square. Resource<Texture> defaultTexture3D; /// A default 2D placeholder depth texture, a 1x1 pixel square with depth = 1. Resource<Texture> defaultDepthTexture2D; /// A default cube map placeholder texture, a 1x1 pixel white cube. Resource<Texture> defaultTextureCube; /// A default cube map placeholder depth texture, a 1x1 pixel cube with depth = 1. Resource<Texture> defaultDepthTextureCube; }; //########################################################################################## //******************** End Rim Graphics Devices OpenGL Namespace ************************* RIM_GRAPHICS_DEVICES_OPENGL_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_GRAPHICS_OPENGL_CONTEXT_H <file_sep>/* * rimGraphicsGenericBoxShape.h * Rim Software * * Created by <NAME> on 6/22/14. * Copyright 2014 __MyCompanyName__. All rights reserved. * */ #ifndef INCLUDE_RIM_GRAPHICS_GENERIC_BOX_SHAPE_H #define INCLUDE_RIM_GRAPHICS_GENERIC_BOX_SHAPE_H #include "rimGraphicsShapesConfig.h" #include "rimGraphicsShapeBase.h" //########################################################################################## //*********************** Start Rim Graphics Shapes Namespace **************************** RIM_GRAPHICS_SHAPES_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class which represents a generic box shape. /** * A box is specified by its width, height, and depth, as well as the position * of its center and the 3 orthonormal axis that define its orientation. * It has an associated generic material for use in drawing. */ class GenericBoxShape : public GraphicsShapeBase<GenericBoxShape> { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructors /// Create a box shape centered at the origin with a size of 1 along each axis. RIM_INLINE GenericBoxShape() : size( 1, 1, 1 ) { } /// Create a box shape centered at the origin with the specified width, height, and depth. RIM_INLINE GenericBoxShape( Real width, Real height, Real depth ) { this->setSize( Vector3( width, height, depth ) ); } /// Create a box shape centered at the given position with the specified width, height, and depth. RIM_INLINE GenericBoxShape( Real width, Real height, Real depth, const Vector3& newPosition ) { this->setSize( Vector3( width, height, depth ) ); this->setPosition( newPosition ); } /// Create a box shape centered at the given position with the specified width, height, and depth, and orientation. RIM_INLINE GenericBoxShape( Real width, Real height, Real depth, const Vector3& newPosition, const Matrix3& newOrientation ) { this->setSize( Vector3( width, height, depth ) ); this->setPosition( newPosition ); this->setOrientation( newOrientation ); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Size Accessor Methods /// Set the 3D dimensions of this box in its local coordinate frame. RIM_FORCE_INLINE const Vector3& getSize() const { return size; } /// Set the 3D dimensions of this box in its local coordinate frame. RIM_INLINE void setSize( const Vector3& newSize ) { size.x = math::max( newSize.x, Real(0) ); size.y = math::max( newSize.y, Real(0) ); size.z = math::max( newSize.z, Real(0) ); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Width Accessor Methods /// Return the width (X size) of this box in its local coordinate frame. RIM_FORCE_INLINE Real getWidth() const { return size.x; } /// Set the width (X size) of this box in its local coordinate frame. /** * This width value is clamped to the range of [0,+infinity]. */ RIM_INLINE void setWidth( Real newWidth ) { size.x = math::max( newWidth, Real(0) ); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Height Accessor Methods /// Return the height (Y size) of this box in its local coordinate frame. RIM_FORCE_INLINE Real getHeight() const { return size.y; } /// Set the height (Y size) of this box in its local coordinate frame. /** * This height value is clamped to the range of [0,+infinity]. */ RIM_INLINE void setHeight( Real newHeight ) { size.y = math::max( newHeight, Real(0) ); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Depth Accessor Methods /// Return the depth (Z size) of this box in its local coordinate frame. RIM_FORCE_INLINE Real getDepth() const { return size.z; } /// Set the depth (Z size) of this box in its local coordinate frame. /** * This depth value is clamped to the range of [0,+infinity]. */ RIM_INLINE void setDepth( Real newDepth ) { size.z = math::max( newDepth, Real(0) ); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Material Accessor Methods /// Get the material of this generic box shape. RIM_INLINE Pointer<GenericMaterial>& getMaterial() { return material; } /// Get the material of this generic box shape. RIM_INLINE const Pointer<GenericMaterial>& getMaterial() const { return material; } /// Set the material of this generic box shape. RIM_INLINE void setMaterial( const Pointer<GenericMaterial>& newMaterial ) { material = newMaterial; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Bounding Box Update Method /// Update the shape's bounding box based on its current geometric representation. virtual void updateBoundingBox() { Vector3 halfSize = size*Real(0.5); setLocalBoundingBox( AABB3( -halfSize, halfSize ) ); } private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Members /// The size of this box along each local coordinate axis. Vector3 size; /// A pointer to the material to use when rendering this generic box shape. Pointer<GenericMaterial> material; }; //########################################################################################## //*********************** End Rim Graphics Shapes Namespace ****************************** RIM_GRAPHICS_SHAPES_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_GRAPHICS_GENERIC_BOX_SHAPE_H <file_sep>/* * rimGraphicsSceneRendererFlags.h * Rim Software * * Created by <NAME> on 7/8/14. * Copyright 2014 __MyCompanyName__. All rights reserved. * */ #ifndef INCLUDE_RIM_GRAPHICS_SCENE_RENDERER_FLAGS_H #define INCLUDE_RIM_GRAPHICS_SCENE_RENDERER_FLAGS_H #include "rimGraphicsRenderersConfig.h" //########################################################################################## //********************** Start Rim Graphics Renderers Namespace ************************** RIM_GRAPHICS_RENDERERS_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class which encapsulates the different boolean flags that a scene renderer can have. /** * These flags provide boolean information about a certain scene renderer. Flags * are indicated by setting a single bit of a 32-bit unsigned integer to 1. * * Enum values for the different flags are defined as members of the class. Typically, * the user would bitwise-OR the flag enum values together to produce a final set * of set flags. */ class SceneRendererFlags { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Scene Renderer Flags Enum Declaration /// An enum which specifies the different scene renderer flags. typedef enum Flag { /// A flag indicating whether or not objects should be drawn. OBJECTS_ENABLED = (1 << 0), /// A flag indicating whether or not lighting is enabled. LIGHTS_ENABLED = (1 << 1), /// A flag indicating whether or not shadowing is enabled. SHADOWS_ENABLED = (1 << 2), /// A flag indicating whether or not debug info should be drawn for lights. DEBUG_LIGHTS = (1 << 3), /// A flag indicating whether or not debug info should be drawn for cameras. DEBUG_CAMERAS = (1 << 4), /// A flag indicating whether or not debug info should be drawn for objects. DEBUG_OBJECTS = (1 << 5), /// A flag indicating whether or not debug info should be drawn for shapes. DEBUG_SHAPES = (1 << 6), /// A flag indicating whether or not bounding boxes should be drawn. DEBUG_BOUNDING_BOXES = (1 << 7), /// The flag value when all flags are not set. UNDEFINED = 0 }; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructors /// Create a new scene renderer flags object with no flags set. RIM_INLINE SceneRendererFlags() : flags( UNDEFINED ) { } /// Create a new scene renderer flags object with the specified flag value initially set. RIM_INLINE SceneRendererFlags( Flag flag ) : flags( flag ) { } /// Create a new scene renderer flags object with the specified initial combined flags value. RIM_INLINE SceneRendererFlags( UInt32 newFlags ) : flags( newFlags ) { } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Integer Cast Operator /// Convert this scene renderer flags object to an integer value. /** * This operator is provided so that the SceneRendererFlags object * can be used as an integer value for bitwise logical operations. */ RIM_INLINE operator UInt32 () const { return flags; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Flag Status Accessor Methods /// Return whether or not the specified flag value is set for this flags object. RIM_INLINE Bool isSet( Flag flag ) const { return (flags & flag) != UNDEFINED; } /// Set whether or not the specified flag value is set for this flags object. RIM_INLINE void set( Flag flag, Bool newIsSet ) { if ( newIsSet ) flags |= flag; else flags &= ~flag; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Flag String Accessor Methods /// Return the flag for the specified literal string representation. static Flag fromEnumString( const String& enumString ); /// Convert the specified flag to its literal string representation. static String toEnumString( Flag flag ); /// Convert the specified flag to human-readable string representation. static String toString( Flag flag ); private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Members /// A value indicating the flags that are set for a scene renderer. UInt32 flags; }; //########################################################################################## //********************** End Rim Graphics Renderers Namespace **************************** RIM_GRAPHICS_RENDERERS_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_GRAPHICS_SCENE_RENDERER_FLAGS_H <file_sep>/* * rimPhysicsCollisionShapeInstance.h * Rim Physics * * Created by <NAME> on 11/28/09. * Copyright 2009 Rim Software. All rights reserved. * */ #ifndef INCLUDE_RIM_PHYSICS_COLLISION_SHAPE_INSTANCE_H #define INCLUDE_RIM_PHYSICS_COLLISION_SHAPE_INSTANCE_H #include "rimPhysicsShapesConfig.h" #include "rimPhysicsCollisionShape.h" //########################################################################################## //************************ Start Rim Physics Shapes Namespace **************************** RIM_PHYSICS_SHAPES_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// The base class for classes which instance a CollisionShape with a particular transformation in world space. class CollisionShapeInstance { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Destructor /// Destroy this collision shape instance and release all associated resources. virtual ~CollisionShapeInstance() { } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Transform Update Method /// Update this collision shape instance using the specified transformation. /** * This method should transform any necessary collision quantities stored in the * instance's base shape into world space using the specified transformation * object. In addition, it transforms the bounding sphere from shape to * world space. */ virtual void setTransform( const Transform3& newTransform ) = 0; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Material Accessor Methods /// Return a const reference to the material for this shape instance's base shape. RIM_INLINE const CollisionShapeMaterial& getMaterial() const { return shape->getMaterial(); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Bounding Sphere Accessor Methods /// Return a const reference to this collision shape instance's bounding sphere. RIM_FORCE_INLINE const BoundingSphere& getBoundingSphere() const { return boundingSphere; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Shape Accessor Methods /// Return a const pointer to the shape that this instance is derrived from. RIM_INLINE const CollisionShape* getShape() const { return shape; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Shape Type Accessor Methods /// Return an integer identifying the sub type of this collision shape. /** * This ID is a 32-bit integer that is generated by hashing the string * generated for the SubType template parameter. While the posibility of * ID collisions is very low, duplicates are nonetheless a possibility. */ RIM_FORCE_INLINE CollisionShapeTypeID getTypeID() const { return shape->getTypeID(); } /// Return an object representing the type of this CollisionShape. RIM_FORCE_INLINE const CollisionShapeType& getType() const { return shape->getType(); } protected: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Protected Constructor /// Create a collision shape instance with the specified template shape. RIM_FORCE_INLINE CollisionShapeInstance( const CollisionShape* newShape ) : shape( newShape ) { RIM_DEBUG_ASSERT_MESSAGE( newShape != NULL, "Cannot have NULL shape for collision shape instance." ); boundingSphere = shape->getBoundingSphere(); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Protected Shape Accessor Methods /// Set a const pointer to the shape that this instance is derrived from. RIM_INLINE void setShape( const CollisionShape* newShape ) { RIM_DEBUG_ASSERT_MESSAGE( newShape != NULL, "Cannot have NULL shape for collision shape instance." ); shape = newShape; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Protected Bounding Sphere Accessor Methods /// Set the bounding sphere for this shape instance in world coordinates. RIM_INLINE void setBoundingSphere( const BoundingSphere& newBoundingSphere ) { boundingSphere = newBoundingSphere; } private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Members /// A CollisionShape object representing the shape template from which this instance is derrived. const CollisionShape* shape; /// A bounding sphere for this collision shape instance in world coordinates. BoundingSphere boundingSphere; }; //########################################################################################## //************************ End Rim Physics Shapes Namespace ****************************** RIM_PHYSICS_SHAPES_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_PHYSICS_COLLISION_SHAPE_INSTANCE_H <file_sep>/* * rimGraphicsLightAssetTranscoder.h * Rim Software * * Created by <NAME> on 6/14/14. * Copyright 2014 __MyCompanyName__. All rights reserved. * */ #ifndef INCLUDE_RIM_GRAPHICS_LIGHT_ASSET_TRANSCODER_H #define INCLUDE_RIM_GRAPHICS_LIGHT_ASSET_TRANSCODER_H #include "rimGraphicsAssetsConfig.h" //########################################################################################## //*********************** Start Rim Graphics Assets Namespace **************************** RIM_GRAPHICS_ASSETS_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class which encodes and decodes graphics lights to the asset format. class GraphicsLightAssetTranscoder : public AssetTypeTranscoder<Light> { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Destructor //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Text Encoding/Decoding Methods /// Decode an object from the specified string stream, returning a pointer to the final object. virtual Pointer<Light> decodeText( const AssetType& assetType, const AssetObject& assetObject, ResourceManager* resourceManager = NULL ); /// Encode an object of this asset type into a text-based format. virtual Bool encodeText( UTF8StringBuffer& buffer, ResourceManager* resourceManager, const Light& data ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Public Static Data Members /// An object indicating the asset type for a spot light. static const AssetType SPOT_LIGHT_ASSET_TYPE; /// An object indicating the asset type for a point light. static const AssetType POINT_LIGHT_ASSET_TYPE; /// An object indicating the asset type for a directional light. static const AssetType DIRECTIONAL_LIGHT_ASSET_TYPE; private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Type Declarations /// An enum describing the fields that a graphics light can have. typedef enum Field { /// An undefined field. UNDEFINED = 0, //******************************************************************** // Common Light Fields /// "name" The name of this graphics light. NAME, /// "flags" Boolean configuration flags for this light source. FLAGS, /// "intensity" A float value indicating the light's intensity. INTENSITY, /// "color" The main color of the light. COLOR, //******************************************************************** // Directional Light Fields /// "direction" The 3D direction of the light, the direction the light travels. DIRECTION, //******************************************************************** // Point Light Fields /// "position" The 3D position of this light source in world space. POSITION, /// "attenuation" An object describing the distance attenuation of this point light. ATTENUATION, //******************************************************************** // Spot Light Fields /// "cutoff" The half angle width in degrees of the spot light's light cone. CUTOFF, /// "falloff" The fraction of the spot light's angular width where the intensity falls off. FALLOFF, /// "exponent" How focused the spot light is towards the center. EXPONENT }; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Helper Methods /// Decode the given asset object as if it was a spot light. Pointer<SpotLight> decodeTextSpot( const AssetObject& assetObject, ResourceManager* resourceManager ); /// Decode the given asset object as if it was a point light. Pointer<PointLight> decodeTextPoint( const AssetObject& assetObject, ResourceManager* resourceManager ); /// Decode the given asset object as if it was a directional light. Pointer<DirectionalLight> decodeTextDirectional( const AssetObject& assetObject, ResourceManager* resourceManager ); /// Decode the common light field, returning if the field is a common field. Bool decodeCommonField( Field field, const AssetObject::String& fieldValue, Light& light ); /// Return an enum value indicating the field indicated by the given field name. static Field getFieldType( const AssetObject::String& name ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Members /// A temporary asset object used when parsing light child objects. AssetObject tempObject; }; //########################################################################################## //*********************** End Rim Graphics Assets Namespace ****************************** RIM_GRAPHICS_ASSETS_NAMESPACE_END //****************************************************************************************** //########################################################################################## //########################################################################################## //**************************** Start Rim Assets Namespace ******************************** RIM_ASSETS_NAMESPACE_START //****************************************************************************************** //########################################################################################## template <> RIM_INLINE const AssetType& AssetType::of<rim::graphics::lights::SpotLight>() { return rim::graphics::assets::GraphicsLightAssetTranscoder::SPOT_LIGHT_ASSET_TYPE; } template <> RIM_INLINE const AssetType& AssetType::of<rim::graphics::lights::PointLight>() { return rim::graphics::assets::GraphicsLightAssetTranscoder::POINT_LIGHT_ASSET_TYPE; } template <> RIM_INLINE const AssetType& AssetType::of<rim::graphics::lights::DirectionalLight>() { return rim::graphics::assets::GraphicsLightAssetTranscoder::DIRECTIONAL_LIGHT_ASSET_TYPE; } //########################################################################################## //**************************** End Rim Assets Namespace ********************************** RIM_ASSETS_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_GRAPHICS_LIGHT_ASSET_TRANSCODER_H <file_sep>/* * rimMathConfig.h * Rim Math * * Created by <NAME> on 12/28/08. * Copyright 2008 Rim Software. All rights reserved. * */ #ifndef INCLUDE_RIM_MATH_CONFIG_H #define INCLUDE_RIM_MATH_CONFIG_H #include <cmath> #include <limits> #include "../rimConfig.h" //########################################################################################## //########################################################################################## //############ //############ Library Namespace Configuration //############ //########################################################################################## //########################################################################################## /// Define the name of the math library namespace. #ifndef RIM_MATH_NAMESPACE #define RIM_MATH_NAMESPACE math #endif #ifndef RIM_MATH_NAMESPACE_START #define RIM_MATH_NAMESPACE_START RIM_NAMESPACE_START namespace RIM_MATH_NAMESPACE { #endif #ifndef RIM_MATH_NAMESPACE_END #define RIM_MATH_NAMESPACE_END }; RIM_NAMESPACE_END #endif RIM_NAMESPACE_START /// A namespace containing 2D, 3D, 4D, and multi-dimensional math classes with SIMD acceleration. namespace RIM_MATH_NAMESPACE { }; RIM_NAMESPACE_END //########################################################################################## //***************************** Start Rim Math Namespace ********************************* RIM_MATH_NAMESPACE_START //****************************************************************************************** //########################################################################################## //########################################################################################## //***************************** End Rim Math Namespace *********************************** RIM_MATH_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_MATH_CONFIG_H <file_sep>/* * rimImageConverter.h * Rim Images * * Created by <NAME> on 3/25/08. * Copyright 2008 Rim Software. All rights reserved. * */ #ifndef INCLUDE_RIM_IMAGE_CONVERTER_H #define INCLUDE_RIM_IMAGE_CONVERTER_H #include "rimImageIOConfig.h" #include "rimImageFormat.h" #include "rimImageTranscoder.h" #include "rimImagesPNGTranscoder.h" #include "rimImagesJPEGTranscoder.h" #include "rimImagesBMPTranscoder.h" #include "rimImagesTGATranscoder.h" //########################################################################################## //*************************** Start Rim Image IO Namespace ******************************* RIM_IMAGE_IO_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class which handles encoding and decoding image data to/from various formats. class ImageConverter { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructor /// Create a default image converter which can encode or decode any of the basic image formats. /** * In order to encode unsupported image formats, the user should create a class that * inherits from ImageTranscoder and add it to this converter for the correct format. */ ImageConverter(); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Transcoder Accessor Methods /// Return the total number of transcoders that this image converter supports. RIM_INLINE Size getTranscoderCount() const { return transcoders.getSize(); } /// Access the transcoder for the specified image format. /** * If that format is supported by the converter, a pointer to transcoder for that * format is set in the output pointer and TRUE is returned. Otherwise, * there is no transcoder for that format and FALSE is returned indicating failure. */ Bool getTranscoder( ImageFormat format, Pointer<ImageTranscoder>& transcoder ) const; /// Add a new transcoder to this image converter. /** * If transcoder pointer is not NULL, the transcoder is added to the converter * for its format (accessed by calling getFormat() on the transcoder). * If there already exists a transcoder for that format, it is replaced. * The method returns whether or not the new transcoder was successfully added. */ Bool addTranscoder( const Pointer<ImageTranscoder>& newTranscoder ); /// Remove the transcoder from this converter with the specified image format. /** * If there is a transcoder with that format, it is removed and TRUE is returned. * Otherwise, the converter is unchanged and FALSE is returned. */ Bool removeTranscoder( ImageFormat format ); /// Remove all transcoders from this image converter. /** * After this operation, the image converter will not be able to decode or * encode images in any format until new transcoder objects are added to it. */ void clearTranscoders(); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Image Encoding Methods /// Return whether or not an image can be encoded in the specified format. /** * If TRUE is returned, the image is in a format that is compatible with this * image converter. Otherwise, the image is not compatible and cannot be encoded. */ RIM_INLINE Bool canEncode( ImageFormat format, const Image& image, const ImageEncodingParameters& parameters = ImageEncodingParameters() ) const { if ( !image.isValid() ) return false; return this->canEncode( format, image.getPixelData().getPointer(), image.getPixelFormat(), image.getWidth(), image.getHeight(), parameters ); } /// Return whether or not an image can be encoded in the specified format. /** * The image is specified by a pointer to pixel data, dimensions, and pixel type. * * If TRUE is returned, the image is in a format that is compatible with this * image converter. Otherwise, the image is not compatible and cannot be encoded. */ Bool canEncode( ImageFormat format, const UByte* pixelData, const PixelFormat& pixelType, Size width, Size height, const ImageEncodingParameters& parameters = ImageEncodingParameters() ) const; /// Encode an image using the specified format and place the output in the specified data object. /** * If the encoding succeeds, the encoded image data is placed in the * Data object and TRUE is returned. Otherwise, FALSE is returned * and no data is placed in the Data object. */ Bool encode( ImageFormat format, const Image& image, Data& data, const ImageEncodingParameters& parameters = ImageEncodingParameters() ) const; /// Encode an image using the specified format and place the output in the specified data pointer. /** * If the encoding succeeds, the function allocates the necessary output data * array and places the pointer to that array in the output data pointer reference, * the number of bytes in the output array is placed in the numBytes output reference, * and TRUE is returned. Otherwise, FALSE is returned and no data is * placed in the output references. */ RIM_INLINE Bool encode( ImageFormat format, const Image& image, UByte*& outputData, Size& numBytes, const ImageEncodingParameters& parameters = ImageEncodingParameters() ) const { if ( !image.isValid() ) return false; return this->encode( format, image.getPixelData().getPointer(), image.getPixelFormat(), image.getWidth(), image.getHeight(), outputData, numBytes, parameters ); } /// Encode an image using the specified format and place the output in the specified data pointer. /** * The image is specified by a pointer to pixel data, dimensions, and pixel type. * * If the encoding succeeds, the function allocates the necessary output data * array and places the pointer to that array in the output data pointer reference, * the number of bytes in the output array is placed in the numBytes output reference, * and TRUE is returned. Otherwise, FALSE is returned and no data is * placed in the output references. */ Bool encode( ImageFormat format, const UByte* pixelData, const PixelFormat& pixelType, Size width, Size height, UByte*& outputData, Size& numBytes, const ImageEncodingParameters& parameters = ImageEncodingParameters() ) const; /// Encode an image using the specified format and send the output to the specified data output stream. /** * If the encoding succeeds, the encoded image data is sent to the * data output stream and TRUE is returned. Otherwise, FALSE is returned * and no data is sent to the stream. */ RIM_INLINE Bool encode( ImageFormat format, const Image& image, DataOutputStream& stream, const ImageEncodingParameters& parameters = ImageEncodingParameters() ) const { if ( !image.isValid() ) return false; return this->encode( format, image.getPixelData().getPointer(), image.getPixelFormat(), image.getWidth(), image.getHeight(), stream, parameters ); } /// Encode an image using the specified format and send the output to the specified data output stream. /** * The image is specified by a pointer to pixel data, dimensions, and pixel type. * * If the encoding succeeds, the encoded image data is sent to the * data output stream and TRUE is returned. Otherwise, FALSE is returned * and no data is sent to the stream. */ Bool encode( ImageFormat format, const UByte* pixelData, const PixelFormat& pixelType, Size width, Size height, DataOutputStream& stream, const ImageEncodingParameters& parameters = ImageEncodingParameters() ) const; /// Encode an image using the specified format, writing the output to the specified file path. /** * The method encodes the image as the given format, or attempts to * guess the format if it is UNDEFINED. * * If the encoding succeeds, the encoded image data is sent to the * file location and TRUE is returned. Otherwise, FALSE is returned * and the file is not written. */ Bool encode( ImageFormat format, const Image& image, const UTF8String& filePath, const ImageEncodingParameters& parameters = ImageEncodingParameters() ) const; /// Encode an image using an inferred format, writing the output to the specified file path. /** * The method attempts to guess the output format for the image based on the file path extension. * * If the encoding succeeds, the encoded image data is sent to the * file location and TRUE is returned. Otherwise, FALSE is returned * and the file is not written. */ RIM_INLINE Bool encode( const Image& image, const UTF8String& filePath, const ImageEncodingParameters& parameters = ImageEncodingParameters() ) const { return this->encode( ImageFormat::UNDEFINED, image, filePath, parameters ); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Image Decoding Methods /// Return whether or not the specified data can be decoded. /** * If the ImageFormat::UNDEFINED is specified, the method tries all possible * decoders to see if any of them can decode the image data. */ RIM_INLINE Bool canDecode( ImageFormat format, const Data& data ) const { return this->canDecode( format, data.getPointer(), data.getSizeInBytes() ); } /// Return whether or not the specified data can be decoded. /** * If the ImageFormat::UNDEFINED is specified, the method tries all possible * decoders to see if any of them can decode the image data. */ Bool canDecode( ImageFormat format, const UByte* inputData, Size inputDataSizeInBytes ) const; /// Decode the specified data and return an image. /** * The image is returned in the specified output image reference. * If the ImageFormat::UNDEFINED is specified, the method attempts to * guess the format of the image. * * If the decoding succeeds, the function creates an image and places * it in the image output reference paramter and TRUE is returned. * Otherwise, if the decoding fails, FALSE is returned. */ RIM_INLINE Bool decode( ImageFormat format, const Data& data, Image& image ) const { return this->decode( format, data.getPointer(), data.getSizeInBytes(), image ); } /// Decode the data from the specified data pointer and return an image. /** * The image is returned in the specified output image reference. * If the ImageFormat::UNDEFINED is specified, the method attempts to * guess the format of the image. * * If the decoding succeeds, the function creates an image and places * it in the image output reference paramter and TRUE is returned. * Otherwise, if the decoding fails, FALSE is returned. */ Bool decode( ImageFormat format, const UByte* inputData, Size inputDataSizeInBytes, Image& image ) const; /// Decode the specified data and return an image. /** * The image is returned as a pointer to pixel data, dimensions, and * pixel type, all given as reference parameters. If the ImageFormat::UNDEFINED is * specified, the method attempts to guess the format of the image. * * If the decoding succeeds, the function creates an image and places * it in the image output reference paramter and TRUE is returned. * Otherwise, if the decoding fails, FALSE is returned. */ RIM_INLINE Bool decode( ImageFormat format, const Data& data, UByte*& pixelData, PixelFormat& pixelType, Size& width, Size& height ) const { return this->decode( format, data.getPointer(), data.getSizeInBytes(), pixelData, pixelType, width, height ); } /// Decode the data in the specified format from a data pointer and return an image. /** * The image is returned as a pointer to pixel data, dimensions, and * pixel type, all given as reference parameters. If the ImageFormat::UNDEFINED is * specified, the method attempts to guess the format of the image. * * The decoding method can use the in/out parameter pixelType to hint at the * desired pixel format for the output image. The decoder should try to match * this format as closely as possible without degrading image quality. * * If the decoding succeeds, the function allocates the necessary space * for the image's pixel data and places the pointer to that data * in the output pixel data reference, along with the image's dimensions * and pixel type, and TRUE is returned. Otherwise, if the decoding fails, * FALSE is returned. */ Bool decode( ImageFormat format, const UByte* inputData, Size inputDataSizeInBytes, UByte*& pixelData, PixelFormat& pixelType, Size& width, Size& height ) const; /// Decode the data from the specified DataInputStream and return an image. /** * The image is returned in the specified output image reference. * If the ImageFormat::UNDEFINED is specified, the method attempts to * guess the format of the image. * * If the decoding succeeds, the function creates an image and places * it in the image output reference paramter and TRUE is returned. * Otherwise, if the decoding fails, FALSE is returned. */ Bool decode( ImageFormat format, DataInputStream& stream, Image& image ) const; /// Decode image data in the specified format from a DataInputStream and return an image. /** * The image is returned as a pointer to pixel data, dimensions, and * pixel type, all given as reference parameters. If the ImageFormat::UNDEFINED is * specified, the method attempts to guess the format of the image. * * The decoding method can use the in/out parameter pixelType to hint at the * desired pixel format for the output image. The decoder should try to match * this format as closely as possible without degrading image quality. * * If the decoding succeeds, the function allocates the necessary space * for the image's pixel data and places the pointer to that data * in the output pixel data reference, along with the image's dimensions * and pixel type, and TRUE is returned. Otherwise, if the decoding fails, * FALSE is returned. */ Bool decode( ImageFormat format, DataInputStream& stream, UByte*& pixelData, PixelFormat& pixelType, Size& width, Size& height ) const; /// Decode the image at the specified file path. /** * The image is returned in the specified output image reference. * The method decodes the image as the given format, or attempts to * guess the format if it is UNDEFINED. * * If the decoding succeeds, the function creates an image and places * it in the image output reference paramter and TRUE is returned. * Otherwise, if the decoding fails, FALSE is returned. */ Bool decode( ImageFormat format, const UTF8String& filePath, Image& image ) const; /// Decode the image at the specified file path. /** * The image is returned in the specified output image reference. * The method attempts to guess the format of the image based on the * file type extension of the path. * * If the decoding succeeds, the function creates an image and places * it in the image output reference paramter and TRUE is returned. * Otherwise, if the decoding fails, FALSE is returned. */ Bool decode( const UTF8String& filePath, Image& image ) const; private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Members /// A map from image formats to image transcoders associated with those formats. HashMap< ImageFormat, Pointer<ImageTranscoder> > transcoders; }; //########################################################################################## //*************************** End Rim Image IO Namespace ********************************* RIM_IMAGE_IO_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_IMAGE_CONVERTER_H <file_sep>/* * rimGraphicsGUIValueCurve.h * Rim Graphics GUI * * Created by <NAME> on 7/9/13. * Copyright 2013 __MyCompanyName__. All rights reserved. * */ #ifndef INCLUDE_RIM_GRAPHICS_GUI_VALUE_CURVE_H #define INCLUDE_RIM_GRAPHICS_GUI_VALUE_CURVE_H #include "rimGraphicsGUIUtilitiesConfig.h" //########################################################################################## //******************* Start Rim Graphics GUI Utilities Namespace ************************* RIM_GRAPHICS_GUI_UTILITIES_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class which represents the scaling curve to use when displaying a value. /** * This class allows the user to specify how to display slider values, graphs, etc. * Certain types of data are better visualized with a log scale, for instance. */ class ValueCurve { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Public Enum Declaration /// An enum which specifies the different kinds of curves. typedef enum Enum { /// The values are spaced evenly in a linear fashion. LINEAR = 0, /// The value are spaced logarithmically along the number line from the minimum to maximum value. LOGARITHMIC = 1, /// The values are spaced using the function x^2. SQUARE = 2, /// The values are spaced using the function sqrt(x). SQUARE_ROOT = 3, /// The values are spaced using the function x^3. CUBE = 4, /// The values are spaced using the function x^(1/3). CUBE_ROOT = 5 }; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructors /// Create a new value curve with the default curve - linear. RIM_INLINE ValueCurve() : type( LINEAR ) { } /// Create a new value curve using the specified value curve type enum value. RIM_INLINE ValueCurve( Enum newType ) : type( newType ) { } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Enum Cast Operator /// Convert this value curve type to an enum value. RIM_INLINE operator Enum () const { return type; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Curve Evalutation Method /// Apply this curve to a value with the specified linear parameter from 0 to 1 and output range. /** * This method takes a parameter which ranges from 0 to 1, indicating the linear * range of the value. It applies the transfer function of this curve to that * parameter and returns the result, adjusted to lie within the specified value output * range. The result indicates the actual parameter value that should be displayed * at the original linear position. * * Use this method to convert from a display location to the actual value at the * display location. */ Float evaluate( Float a, const AABB1f& range = AABB1f(0,1) ) const; /// Apply this curve to a value in reverse with the specified value and input range. /** * This method takes a parameter which ranges from its minimum to maximum value * and undoes the value curve, producing a linear parameter value which ranges from * 0 to 1. * * Use this method to convert from actual values to where they should be * displayed. */ Float evaluateInverse( Float value, const AABB1f& range = AABB1f(0,1) ) const; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** String Representation Accessor Methods /// Return a string representation of the value curve type. String toString() const; /// Convert this value curve type into a string representation. RIM_INLINE operator String () const { return this->toString(); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Data Transformation Method /// Transform a 1D value in the given range by the specified value curve. static Float transform( Float value, const AABB1f& range, ValueCurve curve ); /// Transform a 2D value in the given range by the specified value curve. static Vector2f transform( const Vector2f& value, const AABB2f& range, ValueCurve xCurve, ValueCurve yCurve ); /// Transform a 3D value in the given range by the specified value curve. static Vector3f transform( const Vector3f& value, const AABB3f& range, ValueCurve xCurve, ValueCurve yCurve, ValueCurve zCurve ); private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Members /// An enum value indicating the type of value curve this object represents. Enum type; }; //########################################################################################## //******************* End Rim Graphics GUI Utilities Namespace *************************** RIM_GRAPHICS_GUI_UTILITIES_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_GRAPHICS_GUI_VALUE_CURVE_H <file_sep>/* * Quadcopter.cpp * Quadcopter * * Created by <NAME> on 10/23/14. * Co-author: <NAME> * Copyright 2014 __MyCompanyName__. All rights reserved. * */ #include "Quadcopter.h" const float Quadcopter:: MAX_SPEED = 10.0f; const float Quadcopter:: MAX_ACCELERATION = 10.0f; const float Quadcopter:: MAX_TILT_ANGLE = math::degreesToRadians( 15.0f ); const float Quadcopter:: MAX_ROLL_RATE = math::degreesToRadians( 30.0f ); const float Quadcopter:: MAX_ANGLE_ERROR = math::degreesToRadians( 1.0f ); const float Quadcopter:: MAX_THRUST = 20; const float Quadcopter:: MIN_THRUST = 1; const float Quadcopter:: MAX_MOTOR_THRUST = MAX_THRUST / 4; const float Quadcopter:: MAX_ANGULAR_ACCELERATION = 10; const float Quadcopter:: MAX_DELTA_THRUST = 1.0f; const Vector3f Quadcopter:: VEHICLE_DELTA_THRUST = Vector3f(20, 20, 25); const float Quadcopter:: VEHICLE_CLOSE_RANGE = 5; const float Quadcopter:: VEHICLE_CLOSE_RANGE_SCALE_FACTOR = 0.2f; //########################################################################################## //########################################################################################## //############ //############ Constructor //############ //########################################################################################## //########################################################################################## Quadcopter:: Quadcopter() : currentState(), mass( 1 ), inertia( 1, 0, 0, 0, 1, 0, 0, 0, 1 ), planningTimestep( 0.016f / 2 ), frontCamera( Pointer<PerspectiveCamera>::construct() ), downCamera( Pointer<PerspectiveCamera>::construct() ) { } //########################################################################################## //########################################################################################## //############ //############ Graphics Update Method //############ //########################################################################################## //########################################################################################## void Quadcopter:: updateGraphics() { const Vector3f& position = currentState.position; const Matrix3f& rotation = currentState.rotation; if ( graphics.isSet() ) { graphics->setPosition( position ); graphics->setOrientation( rotation ); } if ( frontCamera.isSet() ) { frontCamera->setPosition( position ); frontCamera->setOrientation( rotation ); } if ( downCamera.isSet() ) { downCamera->setPosition( position ); downCamera->setOrientation( rotation * Matrix3f::rotationXDegrees(90) ); } } //############ // Path to the goal //############### vertices Quadcopter::getpath(const TransformState& state, const Vector3f& goalPosition, Pointer<Roadmap> rmap) const { Global_planner g_plan = Global_planner(); return (g_plan.prm(state.position,goalPosition,rmap)); } //########################################################################################## //########################################################################################## //############ //############ Acceleration Computation Method //############ //########################################################################################## //########################################################################################## void Quadcopter:: computeAcceleration( const TransformState& newState, Float timeStep, Vector3f& linearAcceleration, Vector3f& angularAcceleration ) const { if((float)((nextWaypoint - goalpoint).getMagnitude()) != 0) { if ((float)((nextWaypoint-newState.position).getMagnitude()) < (VEHICLE_CLOSE_RANGE/1.5)) { nextid = nextid + 1; if ( nextid < path.size() ) nextWaypoint = path[nextid]; } for ( Index i = nextid; i < path.size(); i++ ) { if ( roadmap->link( newState.position, path[i], 2.0f ) && roadmap->link( path[i], newState.position, 2.0f ) ) { nextWaypoint = path[i]; nextid = i; } } } //**************************************************************************** // Determine the preferred thrust vector based on the next waypoint. Vector3f preferredThrust = computePreferredThrust( newState, nextWaypoint, linearAcceleration ); //**************************************************************************** // Once we have the preferred acceleration, compute the target orientation that // the quadcopter should rotate to acheive that acceleration, then determine // the angular acceleration required. Vector3f preferredAngularAcceleration = computePreferredAngularAcceleration( newState, nextWaypoint, preferredThrust ); // Add the preferred accelerations to the output parameters. linearAcceleration += preferredThrust; angularAcceleration += preferredAngularAcceleration; //**************************************************************************** // Solve for the thrust (scalar value) at each motor given the current state. Array<Float> thrusts( motors.getSize(), 0 ); Vector3f localPreferredForce = mass*newState.rotateVectorToBody( preferredThrust ); Vector3f localPreferredTorque = inertia*newState.rotateVectorToBody( preferredAngularAcceleration ); solveForMotorThrusts( newState, motors, localPreferredForce, localPreferredTorque, thrusts ); //**************************************************************************** // Apply the force and torque due to each motor. Vector3f force, torque; for ( Index m = 0; m < motors.getSize(); m++ ) { const Motor& motor = motors[m]; const Float motorThrust = thrusts[m]; // Transform the center-of mass offset into world space. Vector3f motorPoint = currentState.transformToWorld( motor.comOffset ); Vector3f motorForce = currentState.rotateVectorToWorld( motor.thrustDirection*motorThrust ); applyForce( motorPoint, motorForce, force, torque ); } // Compute the inverse world-space inertia tensor (similarity transform). Matrix3f worldInverseInertia = newState.rotation * inertia.invert() * newState.rotation.transpose(); /// Apply the motor acceleration. //linearAcceleration += mass > math::epsilon<Float>() ? force / mass : Vector3f(); //angularAcceleration += worldInverseInertia*torque; //linearAcceleration = Vector3f(); //angularAcceleration = Vector3f(); } //########################################################################################## //########################################################################################## //############ //############ Preferred Thrust Computation Method //############ //########################################################################################## //########################################################################################## Vector3f Quadcopter:: computePreferredThrust( const TransformState& newState, const Vector3f& goalPosition, const Vector3f& externalAcceleration ) const { // Compute the delta vector for position between the target position and the new state position. Vector3f deltaPosition = goalPosition - newState.position; Float distance = deltaPosition.getMagnitude(); //**************************************************************************** // Determine the preferred linear velocity of the quadcopter. // This is the desired linear velocity that the center of mass of the quadcopter should have. Vector3f preferredVelocity; if ( distance < VEHICLE_CLOSE_RANGE ) preferredVelocity = (deltaPosition/VEHICLE_CLOSE_RANGE)*MAX_SPEED; else preferredVelocity = deltaPosition / planningTimestep; Float preferredSpeed = preferredVelocity.getMagnitude(); // Make sure the preferred velocity is within the limit of the max speed. if ( preferredSpeed > MAX_SPEED ) { preferredVelocity *= (MAX_SPEED / preferredSpeed); preferredSpeed = MAX_SPEED; } //**************************************************************************** // Determine the preferred linear acceleration of the quadcopter. // This is the desired net acceleration produced by the motors, not yet respecting // the physical limits of the motors. // Compute the desired change in velocity. Vector3f deltaVelocity = preferredVelocity - newState.velocity; // Determine the additional thrust necessary to acheive the desired change in velocity // within the planning time step. Vector3f preferredThrust = deltaVelocity / planningTimestep; Float preferredThrustMag = preferredThrust.getMagnitude(); /* if ( preferredThrustMag > MAX_ACCELERATION ) { preferredThrust *= (MAX_ACCELERATION / preferredThrustMag); preferredThrustMag = MAX_ACCELERATION; } */ // Compensate in the preferred thrust for the effects of environmental forces (i.e. gravity, drag). preferredThrust -= externalAcceleration; // Make sure the preferred velocity is within the limits of thrust produced by the motors. preferredThrustMag = preferredThrust.getMagnitude(); if ( preferredThrustMag > MAX_THRUST ) { preferredThrust *= (MAX_THRUST / preferredThrustMag); preferredThrustMag = MAX_THRUST; } else if ( preferredThrustMag < MIN_THRUST ) { preferredThrust *= (MIN_THRUST / preferredThrustMag); preferredThrustMag = MIN_THRUST; } return preferredThrust; } //########################################################################################## //########################################################################################## //############ //############ Preferred Angular Acceleration Computation Method //############ //########################################################################################## //########################################################################################## Vector3f Quadcopter:: computePreferredAngularAcceleration( const TransformState& state, const Vector3f& goalPosition, const Vector3f& preferredThrust ) const { // Compute the delta vector for position between the target position and the new state position. Vector3f deltaPosition = goalPosition - state.position; Float distance = deltaPosition.getMagnitude(); //**************************************************************************** //Vector3f look = -state.rotation.z; Vector3f look = deltaPosition.normalize(); Matrix3f preferredRotation = computePreferredRotation( state, look, preferredThrust ); prefRot = preferredRotation; // Compute the rotational difference between the new rotation and the target rotation. Quaternion<Float> qNew( state.rotation ); Quaternion<Float> qPref( preferredRotation ); Quaternion<Float> deltaQ = qPref*qNew.invert(); //**************************************************************************** Vector3f preferredAngularVelocity; // Make sure there is a substantial difference in the orientations. if ( math::abs(deltaQ.a) < math::cos(MAX_ANGLE_ERROR/2) ) { // There is a significant difference in the current and preferred orientation. // Determine the preferred rotation rate in radians per second around the rotation axis. Float deltaTheta = 2*math::acos( deltaQ.a ) / planningTimestep; // Compute the rotation axis. Vector3f rotationAxis = Vector3f( deltaQ.b, deltaQ.c, deltaQ.d ); if ( rotationAxis.getMagnitude() > math::epsilon<Float>() ) rotationAxis = rotationAxis.normalize(); // Compute the preferred angular velocity. preferredAngularVelocity = deltaTheta * rotationAxis; // Make sure the preferred angular velocity is within the limits. Float preferredAngularVelocityMag = preferredAngularVelocity.getMagnitude(); if ( preferredAngularVelocityMag > MAX_ROLL_RATE ) { preferredAngularVelocity *= (MAX_ROLL_RATE / preferredAngularVelocityMag); preferredAngularVelocityMag = MAX_ROLL_RATE; } // Scale down the angular velocity if we are close to the goal. if ( distance < VEHICLE_CLOSE_RANGE ) preferredAngularVelocity *= (distance / VEHICLE_CLOSE_RANGE); } //**************************************************************************** // Determine the preferred angular acceleration from the preferred velocity. Vector3f deltaAngularVelocity = preferredAngularVelocity - state.angularVelocity; Vector3f preferredAngularAcceleration = deltaAngularVelocity / planningTimestep; // Make sure the preferred angular acceleration is within the limits. Float preferredAngularAccelerationMag = preferredAngularAcceleration.getMagnitude(); if ( preferredAngularAccelerationMag > MAX_ANGULAR_ACCELERATION ) preferredAngularAcceleration *= (MAX_ANGULAR_ACCELERATION / preferredAngularAccelerationMag); //Vector3f localAcceleration = state.rotateVectorToBody( preferredAngularAcceleration ); //localAcceleration.y = 0; //preferredAngularAcceleration = state.rotateVectorToWorld( localAcceleration ); return preferredAngularAcceleration; } //########################################################################################## //########################################################################################## //############ //############ Preferred Rotation Computation Method //############ //########################################################################################## //########################################################################################## Matrix3f Quadcopter:: computePreferredRotation( const TransformState& newState, const Vector3f& look, const Vector3f& preferredThrust ) const { // Determine the up vector based on the preferred thrust vector. // The preferred rotation needs to be close to horizontal, within a tolerance angle. // The up vector should be as close to the preferred thrust vector as allowed. Vector3f up( 0, 1, 0 ); Vector3f thrustDirection = preferredThrust.normalize(); Float angle = math::acos( math::dot( thrustDirection, up ) ); if ( angle > MAX_TILT_ANGLE ) { // Clamp the up vector to be no more than the max tilt value. // Compute the rotation axis and angle relative to the horizontal. Vector3f axis = math::cross( thrustDirection, up ); angle = MAX_TILT_ANGLE; // Compute the quaternion from the axis-angle representation. Float s = math::sin( angle/2 ); Quaternion<Float> q( math::cos( angle/2 ), axis.x*s, axis.y*s, axis.z*s ); Matrix3f horizontal; // Determine the rotation matrix for the horizontal frame. if ( math::abs(math::dot( up, look )) < math::cos( MAX_ANGLE_ERROR ) ) horizontal = rotationFromUpLook( up, look ); else horizontal = rotationFromUpLook( up, -newState.rotation.z ); // Apply the quaternion to the horizontal frame to get the target rotation. return q.toMatrix().transpose()*horizontal; } else { // The preferred thrust vector is suitable for use as the up vector. up = thrustDirection; if ( math::abs(math::dot( up, look )) < math::cos( MAX_ANGLE_ERROR ) ) return rotationFromUpLook( up, look ); else return rotationFromUpLook( up, -newState.rotation.z ); } } //########################################################################################## //########################################################################################## //############ //############ Motor Thrust Computation Method //############ //########################################################################################## //########################################################################################## void Quadcopter:: solveForMotorThrusts( const TransformState& state, const ArrayList<Motor>& motors, const Vector3f& localPreferredForce, const Vector3f& localPreferredTorque, Array<Float>& thrusts ) { Vector3f localForce = localPreferredForce; Vector3f localTorque = localPreferredTorque; localTorque.y = 0; // Pick a decent initial guess. thrusts.setAll( localForce.getMagnitude() / thrusts.getSize() ); optimizeThrusts( motors, thrusts, localForce, localTorque ); } //########################################################################################## //########################################################################################## //############ //############ Thrust Optimization Method //############ //########################################################################################## //########################################################################################## void Quadcopter:: optimizeThrusts( const ArrayList<Motor>& motors, Array<Float>& thrusts, const Vector3f& localForce, const Vector3f& localTorque ) { const Size numTrys = 100; const Size numMotors = motors.getSize(); Array<Float> currentThrusts = thrusts; Float currentCost = getCost( motors, currentThrusts, localForce, localTorque ); for ( Index i = 0; i < numTrys; i++ ) { // Pick a random starting thrust value. Array<Float> tempThrusts = currentThrusts; for ( Index m = 0; m < numMotors; m++ ) { const Motor& motor = motors[m]; tempThrusts[m] = math::random( motor.thrustRange.min, motor.thrustRange.max ); } Float cost = hillClimbThrusts( motors, tempThrusts, localForce, localTorque ); if ( cost < currentCost ) { currentThrusts = tempThrusts; currentCost = cost; } } thrusts = currentThrusts; } //########################################################################################## //########################################################################################## //############ //############ Thrust Optimization Method //############ //########################################################################################## //########################################################################################## Float Quadcopter:: hillClimbThrusts( const ArrayList<Motor>& motors, Array<Float>& thrusts, const Vector3f& localForce, const Vector3f& localTorque ) { const Float stepSize = 0.1f; // Newtons. const Float acceleration = 1.2f; // unitless const Float epsilon = 0.0001f; const Size maxIterations = 50; const Size numCandidates = 5; const Float candidates[numCandidates] = { -acceleration, -1.0f / acceleration, 0, 1.0f / acceleration, acceleration }; const Size numMotors = motors.getSize(); Array<Float> currentThrusts = thrusts; Array<Float> currentStepSize( numMotors, stepSize ); Float currentCost = getCost( motors, currentThrusts, localForce, localTorque ); for ( Index iteration = 0; iteration < maxIterations; iteration++ ) { // Hill climb for each variable. for ( Index m = 0; m < numMotors; m++ ) { Float bestCost = math::max<Float>(); const Float startPoint = currentThrusts[m]; Index bestCandidate = numCandidates / 2; // Try each candidate location to see which has the best cost. for ( Index c = 0; c < numCandidates; c++ ) { currentThrusts[m] = startPoint + candidates[c]*currentStepSize[m]; Float candidateCost = getCost( motors, currentThrusts, localForce, localTorque ); if ( candidateCost < bestCost ) { bestCost = candidateCost; bestCandidate = c; } } if ( bestCost > math::min<Float>() ) { currentThrusts[m] = startPoint + candidates[bestCandidate]*currentStepSize[m]; currentStepSize[m] *= candidates[bestCandidate]; // accelerate. } } constrainThrusts( motors, currentThrusts ); Float newCost = getCost( motors, currentThrusts, localForce, localTorque ); // Check to see if there is convergence. if ( math::abs( newCost - currentCost ) < epsilon ) { thrusts = currentThrusts; return newCost; } currentCost = newCost; } thrusts = currentThrusts; return currentCost; } //########################################################################################## //########################################################################################## //############ //############ Motor Constraint Enforcement Method //############ //########################################################################################## //########################################################################################## void Quadcopter:: constrainThrusts( const ArrayList<Motor>& motors, Array<Float>& thrusts ) { const Size numMotors = motors.getSize(); if ( thrusts.getSize() < motors.getSize() ) thrusts.setSize( motors.getSize() ); for ( Index m = 0; m < numMotors; m++ ) { const Motor& motor = motors[m]; Float thrust = thrusts[m]; thrust = math::clamp( thrust, motor.thrustRange.min, motor.thrustRange.max ); thrusts[m] = thrust; } } //########################################################################################## //########################################################################################## //############ //############ Thrust Cost Method //############ //########################################################################################## //########################################################################################## Float Quadcopter:: getCost( const ArrayList<Motor>& motors, const Array<Float>& thrusts, const Vector3f& localForce, const Vector3f& localTorque ) { // Weight constants for each of the terms in the cost function. const Float deltaWeight = 0; const Float linearWeight = 1.0f; const Float angleWeight = 0.0f; const Size numMotors = motors.getSize(); //**************************************************************************** // Compute the cost due to change in thrust. Float deltaCost = 0; for ( Index m = 0; m < numMotors; m++ ) deltaCost += math::square( thrusts[m] - motors[m].thrust ); //**************************************************************************** // Compute the cost due to not meeting the target force/torque. Vector3f newForce; Vector3f newTorque; for ( Index m = 0; m < numMotors; m++ ) { const Motor& motor = motors[m]; const Float motorThrust = thrusts[m]; Vector3f motorForce = motor.thrustDirection*motorThrust; applyForce( motor.comOffset, motorForce, newForce, newTorque ); } Float linearCost = localForce.getDistanceToSquared( newForce ); Float angleCost = localTorque.getDistanceToSquared( newTorque ); //**************************************************************************** // Accumulate the final weighted costs. Float cost = 0; cost += deltaWeight*deltaCost; cost += linearWeight*linearCost; cost += angleWeight*angleCost; return cost; } <file_sep>/* * rimGraphicsBlendFactor.h * Rim Graphics * * Created by <NAME> on 3/13/13. * Copyright 2013 __MyCompanyName__. All rights reserved. * */ #ifndef INCLUDE_RIM_GRAPHICS_BLEND_FACTOR_H #define INCLUDE_RIM_GRAPHICS_BLEND_FACTOR_H #include "rimGraphicsUtilitiesConfig.h" //########################################################################################## //********************** Start Rim Graphics Utilities Namespace ************************** RIM_GRAPHICS_UTILITIES_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class which specifies the scale factor applied to a source or destination color when blending. /** * A blend factor determines the value of a source or destination operand for * any given BlendFunction. The factor is component-wise multiplied with the * color of a given source or destination fragment and used as an operand for * the blend function. */ class BlendFactor { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Blend Factor Enum Definition /// An enum type which represents the type of blend factor. typedef enum Enum { /// An undefined blend factor. UNDEFINED = 0, /// A blend factor where the color operand is multiplied by 0. ZERO, /// A blend factor where the color operand is multiplied by 1. ONE, /// A blend factor where the color operand is multiplied by the source color's alpha. SOURCE_ALPHA, /// A blend factor where the color operand is multiplied by the inverse source color alpha. /** * The inverse alpha is equal to one minus the source alpha. */ INVERSE_SOURCE_ALPHA, /// A blend factor where the color operand is component-wise multiplied by the source color. SOURCE_COLOR, /// A blend factor where the color operand is component-wise multiplied by the inverse source color. /** * The inverse source color is equal to one minus the source color for each * color component. */ INVERSE_SOURCE_COLOR, /// A blend factor where the color operand is multiplied by the destination color's alpha. DESTINATION_ALPHA, /// A blend factor where the color operand is multiplied by the inverse destination color alpha. /** * The inverse alpha is equal to one minus the destination alpha. */ INVERSE_DESTINATION_ALPHA, /// A blend factor where the color operand is component-wise multiplied by the destination color. DESTINATION_COLOR, /// A blend factor where the color operand is component-wise multiplied by the inverse destination color. /** * The inverse destination color is equal to one minus the destination color for each * color component. */ INVERSE_DESTINATION_COLOR, /// A blend factor where the color operand is multiplied by the constant color's alpha. CONSTANT_ALPHA, /// A blend factor where the color operand is multiplied by the inverse constant color alpha. /** * The inverse alpha is equal to one minus the constant alpha. */ INVERSE_CONSTANT_ALPHA, /// A blend factor where the color operand is component-wise multiplied by the constant color. CONSTANT_COLOR, /// A blend factor where the color operand is component-wise multiplied by the inverse constant color. /** * The inverse constant color is equal to one minus the constant color for each * color component. */ INVERSE_CONSTANT_COLOR }; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructors /// Create a new blend factor with the specified blend factor enum value. RIM_INLINE BlendFactor( Enum newFactor ) : factor( newFactor ) { } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Enum Cast Operator /// Convert this blend factor type to an enum value. RIM_INLINE operator Enum () const { return (Enum)factor; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** String Representation Accessor Methods /// Return a unique string for this blend factor that matches its enum value name. String toEnumString() const; /// Return a blend factor which corresponds to the given enum string. static BlendFactor fromEnumString( const String& enumString ); /// Return a string representation of the blend factor. String toString() const; /// Convert this blend factor into a string representation. RIM_FORCE_INLINE operator String () const { return this->toString(); } private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Members /// An enum value which indicates the blend factor. UByte factor; }; //########################################################################################## //********************** End Rim Graphics Utilities Namespace **************************** RIM_GRAPHICS_UTILITIES_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_GRAPHICS_BLEND_FACTOR_H <file_sep>/* * rimAssetScene.h * Rim Software * * Created by <NAME> on 6/11/14. * Copyright 2014 __MyCompanyName__. All rights reserved. * */ #ifndef INCLUDE_RIM_ASSET_SCENE_H #define INCLUDE_RIM_ASSET_SCENE_H #include "rimAssetsConfig.h" #include "rimAsset.h" #include "rimAssetType.h" //########################################################################################## //**************************** Start Rim Assets Namespace ******************************** RIM_ASSETS_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class which represents a multi-media scene and all of its data. class AssetScene { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructors /// Create a new empty asset scene that has no stored assets. AssetScene(); /// Create a copy of another asset scene, copying all of its stored assets. AssetScene( const AssetScene& other ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Destructor /// Destroy an asset scene, deallocating all stored assets. virtual ~AssetScene(); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Assignment Operator /// Assign the contents of one asset scene to another, copying all stored assets. AssetScene& operator = ( const AssetScene& other ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Asset Accessor Methods /// Return a pointer to the first asset that the asset scene has for the specified type. /** * If the asset scene does not have any assets for the specified template type, * NULL is returned. */ template < typename DataType > Asset<DataType>* getAsset(); /// Return a const pointer to the first asset that the asset scene has for the specified type. /** * If the asset scene does not have any assets for the specified template type, * NULL is returned. */ template < typename DataType > const Asset<DataType>* getAsset() const; /// Return a pointer to the asset that the asset scene has for the specified type and with the given name. /** * If the asset scene does not have any assets for the specified template type and * a matching name string, NULL is returned. */ template < typename DataType > Asset<DataType>* getAsset( const UTF8String& name ); /// Return a const pointer to the asset that the asset scene has for the specified type and with the given name. /** * If the asset scene does not have any assets for the specified template type and * a matching name string, NULL is returned. */ template < typename DataType > const Asset<DataType>* getAsset( const UTF8String& name ) const; /// Return a pointer to a list of assets of the specified template type. /** * If the asset scene does not have any assets for the specified template type, * NULL is returned. */ template < typename DataType > const ArrayList<Asset<DataType> >* getAssets() const; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Asset Adding Methods /// Add the specified unnamed asset to this asset scene. /** * The method returns whether or not adding the asset was successful. */ template < typename DataType > Bool addAsset( const Pointer<DataType>& asset ); /// Add the specified asset to this asset scene, giving it the specified name string. /** * This name string can be used to identify between asset instances of the * same type. The method returns whether or not adding the asset was successful. */ template < typename DataType > Bool addAsset( const Pointer<DataType>& asset, const UTF8String& name ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Asset Removing Methods /// Remove the specified asset from this asset scene if it exists. /** * If the asset scene contains a asset which is equal in type and * value to the specified asset, the asset is removed and * TRUE is returned. Otherwise, FALSE is returned and the asset scene * is unchanged. */ template < typename DataType > Bool removeAsset( const Pointer<DataType>& asset ); /// Remove the asset with the specified name from this asset scene if it exists. /** * If the asset scene contains a asset which is equal in type and * has the specified name, the asset is removed and * TRUE is returned. Otherwise, FALSE is returned and the asset scene * is unchanged. */ template < typename DataType > Bool removeAsset(); /// Remove all assets with the specified asset type from this asset scene. /** * If the asset scene contains any assets that have the specified type, * the assets are removed and TRUE is returned. Otherwise, FALSE is * returned and the asset scene is unchanged. */ template < typename DataType > Bool removeAssets(); /// Remove all assets from this asset scene. void clearAssets(); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Name Accessor Methods /// Return a reference to a string representing the name of this asset scene. RIM_INLINE const UTF8String& getName() const { return name; } /// Return a reference to a string representing the name of this asset scene. RIM_INLINE void setName( const UTF8String& newName ) { name = newName; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Description Accessor Methods /// Return a reference to a string representing the name of this asset scene. RIM_INLINE const UTF8String& getDescription() const { return description; } /// Return a reference to a string representing the name of this asset scene. RIM_INLINE void setDescription( const UTF8String& newDescription ) { description = newDescription; } private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Class Declarations /// The base class for a templated array of assets. class AssetArrayBase; /// A class which holds an array of assets of a given type. template < typename DataType > class AssetArray; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Members /// A map from Type object to asset type arrays of all of the assets in the asset scene. HashMap<AssetType,AssetArrayBase*> assets; /// The name for this asset scene. UTF8String name; /// A text description of this asset scene. UTF8String description; }; //########################################################################################## //########################################################################################## //############ //############ AssetArrayBase Class Defintion //############ //########################################################################################## //########################################################################################## class AssetScene:: AssetArrayBase { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Destructor /// Destroy this base asset array. virtual ~AssetArrayBase() { } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Virtual Copy Method /// Return a copy of this asset array's concrete type. virtual AssetArrayBase* copy() const = 0; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Asset Accessor Methods /// Return a pointer to the array of assets which this array holds. /** * The method attempts to convert the internal asset array to the given * type. If the conversion fails, NULL is returned. */ template < typename DataType > RIM_INLINE ArrayList<Asset<DataType> >* getAssets(); /// Return a const pointer to the array of assets which this array holds. /** * The method attempts to convert the internal asset array to the given * type. If the conversion fails, NULL is returned. */ template < typename DataType > RIM_INLINE const ArrayList<Asset<DataType> >* getAssets() const; }; //########################################################################################## //########################################################################################## //############ //############ AssetArray Class Defintion //############ //########################################################################################## //########################################################################################## template < typename DataType > class AssetScene:: AssetArray : public AssetArrayBase { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructor RIM_INLINE AssetArray( const Pointer<DataType>& asset ) : assets( 1 ) { assets.add( asset ); } RIM_INLINE AssetArray( const Pointer<DataType>& asset, const UTF8String& name ) : assets( 1 ) { assets.add( Asset<DataType>( asset, name ) ); } RIM_INLINE AssetArray( const Asset<DataType>& asset ) : assets( 1 ) { assets.add( asset ); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Virtual Copy Method /// Create and return a copy of this concrete type. virtual AssetArray<DataType>* copy() const { return util::construct<AssetArray<DataType> >( *this ); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Asset Accessor Methods /// Return a pointer to the internal list of assets that this asset array stores. RIM_INLINE ArrayList<Asset<DataType> >* getAssets() { return &assets; } /// Return a const pointer to the internal list of assets that this asset array stores. RIM_INLINE const ArrayList<Asset<DataType> >* getAssets() const { return &assets; } private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Members /// A list of the assets stored by this concrete asset array. ArrayList< Asset<DataType> > assets; }; //########################################################################################## //########################################################################################## //############ //############ Asset Accessor Methods //############ //########################################################################################## //########################################################################################## template < typename DataType > Asset<DataType>* AssetScene:: getAsset() { const AssetType& type = AssetType::of<DataType>(); AssetArrayBase* const * base; if ( assets.find( type.getHashCode(), type, base ) ) { ArrayList<Asset<DataType> >* array = (*base)->getAssets<DataType>(); if ( array != NULL && array->getSize() > 0 ) return &array->getFirst(); } return NULL; } template < typename DataType > const Asset<DataType>* AssetScene:: getAsset() const { const AssetType& type = AssetType::of<DataType>(); AssetArrayBase* const * base; if ( assets.find( type.getHashCode(), type, base ) ) { const ArrayList<Asset<DataType> >* array = (*base)->getAssets<DataType>(); if ( array != NULL && array->getSize() > 0 ) return &array->getFirst(); } return NULL; } template < typename DataType > Asset<DataType>* AssetScene:: getAsset( const UTF8String& name ) { const AssetType& type = AssetType::of<DataType>(); AssetArrayBase* const * base; if ( assets.find( type.getHashCode(), type, base ) ) { ArrayList<Asset<DataType> >* array = (*base)->getAssets<DataType>(); if ( array != NULL ) { const Size arraySize = array->getSize(); for ( Index i = 0; i < arraySize; i++ ) { if ( (*array)[i].getName() == name ) return &(*array)[i]; } } } return NULL; } template < typename DataType > const Asset<DataType>* AssetScene:: getAsset( const UTF8String& name ) const { const AssetType& type = AssetType::of<DataType>(); AssetArrayBase* const * base; if ( assets.find( type.getHashCode(), type, base ) ) { const ArrayList<Asset<DataType> >* array = (*base)->getAssets<DataType>(); if ( array != NULL ) { const Size arraySize = array->getSize(); for ( Index i = 0; i < arraySize; i++ ) { if ( array[i].getName() == name ) return &array[i]; } } } return NULL; } template < typename DataType > const ArrayList<Asset<DataType> >* AssetScene:: getAssets() const { const AssetType& type = AssetType::of<DataType>(); AssetArrayBase* const * base; if ( assets.find( type.getHashCode(), type, base ) ) return (*base)->getAssets<Asset<DataType> >(); return NULL; } //########################################################################################## //########################################################################################## //############ //############ Asset List Accessor Methods //############ //########################################################################################## //########################################################################################## template < typename DataType > ArrayList<Asset<DataType> >* AssetScene::AssetArrayBase:: getAssets() { AssetArray<DataType>* array = dynamic_cast<AssetArray<DataType>*>( this ); if ( array != NULL ) return array->getAssets(); else return NULL; } template < typename DataType > const ArrayList<Asset<DataType> >* AssetScene::AssetArrayBase:: getAssets() const { const AssetArray<DataType>* array = dynamic_cast<const AssetArray<DataType>*>( this ); if ( array != NULL ) return array->getAssets(); else return NULL; } //########################################################################################## //########################################################################################## //############ //############ Asset Add Methods //############ //########################################################################################## //########################################################################################## template < typename DataType > Bool AssetScene:: addAsset( const Pointer<DataType>& asset ) { const AssetType& type = AssetType::of<DataType>(); AssetArrayBase** base; if ( assets.find( type.getHashCode(), type, base ) ) { // Found an array of assets of this type. ArrayList<Asset<DataType> >* array = (*base)->getAssets<DataType>(); // Check to see if the asset type conversion is correct. If so, add the new asset. if ( array != NULL ) array->add( Asset<DataType>( asset ) ); else return false; } else { // This type of asset does not yet exist in this asset scene. // Create a new one and add it to the map of assets. AssetArray<DataType>* newAssetArray = util::construct<AssetArray<DataType> >( asset ); assets.add( type.getHashCode(), type, newAssetArray ); } return true; } template < typename DataType > Bool AssetScene:: addAsset( const Pointer<DataType>& asset, const UTF8String& name ) { const AssetType& type = AssetType::of<DataType>(); AssetArrayBase** base; if ( assets.find( type.getHashCode(), type, base ) ) { // Found an array of assets of this type. ArrayList<Asset<DataType> >* array = (*base)->getAssets<DataType>(); // Check to see if the asset type conversion is correct. If so, add the new asset. if ( array != NULL ) array->add( Asset<DataType>( asset, name ) ); else return false; } else { // This type of asset does not yet exist in this asset scene. // Create a new one and add it to the map of assets. AssetArray<DataType>* newAssetArray = util::construct<AssetArray<DataType> >( asset, name ); assets.add( type.getHashCode(), type, newAssetArray ); } return true; } //########################################################################################## //########################################################################################## //############ //############ Asset Remove Methods //############ //########################################################################################## //########################################################################################## template < typename DataType > Bool AssetScene:: removeAsset( const Pointer<DataType>& asset ) { const AssetType& type = AssetType::of<DataType>(); AssetArrayBase* const * base; if ( assets.find( type.getHashCode(), type, base ) ) { ArrayList<Asset<DataType> >* array = (*base)->getAssets<DataType>(); if ( array != NULL ) return array->remove( asset ); else return false; } else return false; } template < typename DataType > Bool AssetScene:: removeAssets() { const AssetType& type = AssetType::of<DataType>(); AssetArrayBase* const * base; return assets.remove( type.getHashCode(), type ); } //########################################################################################## //**************************** End Rim Assets Namespace ********************************** RIM_ASSETS_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_ASSET_SCENE_H <file_sep>/* * rimGraphics.h * Rim Graphics * * Created by <NAME> on 5/8/08. * Copyright 2008 Rim Software. All rights reserved. * */ #ifndef INCLUDE_RIM_GRAPHICS_H #define INCLUDE_RIM_GRAPHICS_H #include "graphics/rimGraphicsConfig.h" // Image and Texture classes #include "graphics/rimGraphicsUtilities.h" // Geometry data buffer classes #include "graphics/rimGraphicsBuffers.h" // Shader classes #include "graphics/rimGraphicsShaders.h" // Texture classes #include "graphics/rimGraphicsTextures.h" // Camera classes #include "graphics/rimGraphicsCameras.h" // Object class #include "graphics/rimGraphicsObjects.h" // Shape classes #include "graphics/rimGraphicsShapes.h" // Light classes #include "graphics/rimGraphicsLights.h" // Animation classes #include "graphics/rimGraphicsAnimation.h" // Scene classes #include "graphics/rimGraphicsScenes.h" // Device classes #include "graphics/rimGraphicsDevices.h" // Renderer classes #include "graphics/rimGraphicsRenderers.h" // I/O classes #include "graphics/rimGraphicsIO.h" // Asset classes #include "graphics/rimGraphicsAssets.h" //########################################################################################## //************************** Start Rim Graphics Namespace ******************************** RIM_GRAPHICS_NAMESPACE_START //****************************************************************************************** //########################################################################################## using namespace rim::graphics::util; using namespace rim::graphics::shaders; using namespace rim::graphics::textures; using namespace rim::graphics::materials; using namespace rim::graphics::buffers; using namespace rim::graphics::shapes; using namespace rim::graphics::cameras; using namespace rim::graphics::lights; using namespace rim::graphics::objects; using namespace rim::graphics::scenes; using namespace rim::graphics::renderers; using namespace rim::graphics::devices; using namespace rim::graphics::io; using namespace rim::graphics::assets; using namespace rim::graphics::animation; //########################################################################################## //************************** End Rim Graphics Namespace ********************************** RIM_GRAPHICS_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_GRAPHICS_H <file_sep>/* * rimGUIInputConfig.h * Rim GUI * * Created by <NAME> on 10/28/08. * Copyright 2008 __MyCompanyName__. All rights reserved. * */ #ifndef INCLUDE_RIM_GUI_INPUT_CONFIG_H #define INCLUDE_RIM_GUI_INPUT_CONFIG_H #include "../rimGUIConfig.h" //########################################################################################## //########################################################################################## //############ //############ Library Namespace Configuration //############ //########################################################################################## //########################################################################################## #ifndef RIM_GUI_INPUT_NAMESPACE #define RIM_GUI_INPUT_NAMESPACE input #endif #ifndef RIM_GUI_INPUT_NAMESPACE_START #define RIM_GUI_INPUT_NAMESPACE_START RIM_GUI_NAMESPACE_START namespace RIM_GUI_INPUT_NAMESPACE { #endif #ifndef RIM_GUI_INPUT_NAMESPACE_END #define RIM_GUI_INPUT_NAMESPACE_END }; RIM_GUI_NAMESPACE_END #endif RIM_GUI_NAMESPACE_START /// A namespace containing classes which handle user mouse/keyboard input. namespace RIM_GUI_INPUT_NAMESPACE { }; RIM_GUI_NAMESPACE_END //########################################################################################## //************************ Start Rim GUI Input Namespace *************************** RIM_GUI_INPUT_NAMESPACE_START //****************************************************************************************** //########################################################################################## //########################################################################################## //************************ End Rim GUI Input Namespace ***************************** RIM_GUI_INPUT_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_GUI_INPUT_CONFIG_H <file_sep>/* * rimPhysicsCollisionAlgorithmGJK.h * Rim Physics * * Created by <NAME> on 7/1/12. * Copyright 2012 __MyCompanyName__. All rights reserved. * */ #ifndef INCLUDE_RIM_PHYSICS_COLLISION_ALGORITHM_GJK_H #define INCLUDE_RIM_PHYSICS_COLLISION_ALGORITHM_GJK_H #include "rimPhysicsCollisionConfig.h" #include "rimPhysicsCollisionAlgorithmBase.h" //########################################################################################## //********************** Start Rim Physics Collision Namespace *************************** RIM_PHYSICS_COLLISION_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class which detects collisions between two Rigid Objects with cylinder shapes. template < typename ShapeType1, typename ShapeType2, typename ShapeInstanceType1, typename ShapeInstanceType2, Vector3 (*getSupportPoint1)( const Vector3&, const ShapeInstanceType1* ), Vector3 (*getSupportPoint2)( const Vector3&, const ShapeInstanceType2* ) > class CollisionAlgorithmGJK : public CollisionAlgorithmBase<RigidObject,RigidObject,ShapeType1,ShapeType2> { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Collision Detection Method /// Test the specified object pair for collisions and add the results to the result set. /** * If a collision occurred, TRUE is returned and the resulting CollisionPoint(s) * are added to the CollisionManifold for the object pair in the specified * CollisionResultSet. If there was no collision detected, FALSE is returned * and the result set is unmodified. */ virtual Bool testForCollisions( const ObjectCollider<RigidObject>& collider1, const ObjectCollider<RigidObject>& collider2, CollisionResultSet<RigidObject,RigidObject>& resultSet ) { const RigidObject* object1 = collider1.getObject(); const ShapeInstanceType1* shape1 = (const ShapeInstanceType1*)collider1.getShape(); const RigidObject* object2 = collider2.getObject(); const ShapeInstanceType2* shape2 = (const ShapeInstanceType2*)collider2.getShape(); if ( gjkSolver.solve<ShapeInstanceType1,ShapeInstanceType2, ThisType::getSupportPoint>( simplex, shape1, shape2 ) ) { // Use the EPA solver to determine the closest triangle on the shapes' minkowski difference. EPAResult epaResult = epaSolver.solve<ShapeInstanceType1,ShapeInstanceType2, ThisType::getSupportPoint>( simplex, Real(0.0001), shape1, shape2 ); // Compute the point of intersection from the EPA result. IntersectionPoint point = epaResult.getIntersectionPoint(); // Get the collision manifold for these objects. CollisionManifold& manifold = resultSet.addManifold( object1, object2 ); manifold.addPoint( CollisionPoint( object1->getTransform().transformToObjectSpace( point.point1 ), object2->getTransform().transformToObjectSpace( point.point2 ), point.point1, point.point2, point.normal, -point.penetrationDistance, CollisionShapeMaterial( shape1->getMaterial(), shape2->getMaterial() ) ) ); return true; } return false; } private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Type Declaration /// Define this class's type so that we can easily use it in expressions. typedef CollisionAlgorithmGJK<ShapeType1,ShapeType2,ShapeInstanceType1,ShapeInstanceType2, getSupportPoint1,getSupportPoint2> ThisType; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Helper Methods /// Return a minkowski vertex for the support point on each of the two specified shapes in the given direction. RIM_INLINE static MinkowskiVertex3 getSupportPoint( const Vector3& direction, const ShapeInstanceType1* shape1, const ShapeInstanceType2* shape2 ) { Vector3 normalizedDirection = direction.normalize(); return MinkowskiVertex3( getSupportPoint1( normalizedDirection, shape1 ), getSupportPoint2( -normalizedDirection, shape2 ) ); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Members /// A temporary array of minkowski vertices used to hold the GJK simplex result. StaticArray<MinkowskiVertex3,4> simplex; /// An object which uses the GJK algorithm to determine if the shapes intersect. GJKSolver gjkSolver; /// An object which uses the EPA algorithm to refine a GJK result simplex. EPASolver epaSolver; }; //########################################################################################## //********************** End Rim Physics Collision Namespace ***************************** RIM_PHYSICS_COLLISION_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_PHYSICS_COLLISION_ALGORITHM_GJK_H <file_sep>/* * rimGraphicsLightFlags.h * Rim Software * * Created by <NAME> on 2/19/14. * Copyright 2014 __MyCompanyName__. All rights reserved. * */ #ifndef INCLUDE_RIM_GRAPHICS_LIGHT_FLAGS_H #define INCLUDE_RIM_GRAPHICS_LIGHT_FLAGS_H #include "rimGraphicsLightsConfig.h" //########################################################################################## //************************ Start Rim Graphics Lights Namespace *************************** RIM_GRAPHICS_LIGHTS_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class which encapsulates the different boolean flags that a light can have. /** * These flags provide boolean information about a certain light. Flags * are indicated by setting a single bit of a 32-bit unsigned integer to 1. * * Enum values for the different flags are defined as members of the class. Typically, * the user would bitwise-OR the flag enum values together to produce a final set * of set flags. */ class LightFlags { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Light Flags Enum Declaration /// An enum which specifies the different light flags. typedef enum Flag { /// A flag which indicates that shadows are enabled for a light. SHADOWS_ENABLED = 1, /// The flag value when all flags are not set. UNDEFINED = 0 }; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructors /// Create a new light flags object with no flags set. RIM_INLINE LightFlags() : flags( UNDEFINED ) { } /// Create a new light flags object with the specified flag value initially set. RIM_INLINE LightFlags( Flag flag ) : flags( flag ) { } /// Create a new light flags object with the specified initial combined flags value. RIM_INLINE LightFlags( UInt32 newFlags ) : flags( newFlags ) { } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Integer Cast Operator /// Convert this light flags object to an integer value. /** * This operator is provided so that the LightFlags object * can be used as an integer value for bitwise logical operations. */ RIM_INLINE operator UInt32 () const { return flags; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Flag Status Accessor Methods /// Return whether or not the specified flag value is set for this flags object. RIM_INLINE Bool isSet( Flag flag ) const { return (flags & flag) != UNDEFINED; } /// Set whether or not the specified flag value is set for this flags object. RIM_INLINE void set( Flag flag, Bool newIsSet ) { if ( newIsSet ) flags |= flag; else flags &= ~flag; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Flag String Accessor Methods /// Return the flag for the specified literal string representation. static Flag fromEnumString( const String& enumString ); /// Convert the specified flag to its literal string representation. static String toEnumString( Flag flag ); /// Convert the specified flag to human-readable string representation. static String toString( Flag flag ); private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Members /// A value indicating the flags that are set for a light. UInt32 flags; }; //########################################################################################## //************************ End Rim Graphics Lights Namespace ***************************** RIM_GRAPHICS_LIGHTS_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_GRAPHICS_LIGHT_FLAGS_H <file_sep>/* * rimGraphicsGUIButtonBar.h * Rim Graphics GUI * * Created by <NAME> on 2/18/13. * Copyright 2013 Headspace Systems. All rights reserved. * */ <file_sep>/* * rimGraphicsStencilAction.h * Rim Graphics * * Created by <NAME> on 3/13/13. * Copyright 2013 __MyCompanyName__. All rights reserved. * */ #ifndef INCLUDE_RIM_GRAPHICS_STENCIL_ACTION_H #define INCLUDE_RIM_GRAPHICS_STENCIL_ACTION_H #include "rimGraphicsUtilitiesConfig.h" //########################################################################################## //********************** Start Rim Graphics Utilities Namespace ************************** RIM_GRAPHICS_UTILITIES_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class which specifies the operation performed when updating a stencil buffer. class StencilAction { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Stencil Action Enum Definition /// An enum type which represents the type of stencil action. typedef enum Enum { /// An action where the current stencil value is kept in the stencil buffer. KEEP = 0, /// An action where the stencil buffer value is set to 0. ZERO = 1, /// An action where the stencil buffer value is set to a constant stencil value. REPLACE = 2, /// An action where one is added to the stencil buffer value. /** * With this action, if the increment operation overflows the stencil buffer * precision, the new stencil value is clamped at the maximum stencil value. */ INCREMENT = 3, /// An action where one is added to the stencil buffer value, wrapping at the max stencil value. /** * With this action, if the increment operation overflows the stencil * buffer's precision, the new stencil value is set to 0. */ INCREMENT_WRAP = 4, /// An action where one is subtracted from the stencil buffer value. /** * With this action, if the decrement operation makes the value negative, * the new stencil value is clamped at 0. */ DECREMENT = 5, /// An action where one is subtracted from the stencil buffer value, wrapping at 0. /** * With this action, if the decrement operation makes the value negative, * the new stencil value is set to the maximum stencil value. */ DECREMENT_WRAP = 6, /// An action where the stencil buffer value is set to its bitwise inverse. INVERT = 7 }; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructors /// Create a new stencil action with the specified stencil action enum value. RIM_INLINE StencilAction( Enum newAction ) : action( newAction ) { } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Enum Cast Operator /// Convert this stencil action type to an enum value. RIM_INLINE operator Enum () const { return (Enum)action; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** String Representation Accessor Methods /// Return a stencil action enum which corresponds to the given enum string. static StencilAction fromEnumString( const String& enumString ); /// Return a unique string for this stencil action that matches its enum value name. String toEnumString() const; /// Return a string representation of the stencil action. String toString() const; /// Convert this stencil action into a string representation. RIM_FORCE_INLINE operator String () const { return this->toString(); } private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Members /// An enum value which indicates the type of stencil action. UByte action; }; //########################################################################################## //********************** End Rim Graphics Utilities Namespace **************************** RIM_GRAPHICS_UTILITIES_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_GRAPHICS_STENCIL_ACTION_H <file_sep>/* * rimSoundFilterVersion.h * Rim Sound * * Created by <NAME> on 8/15/12. * Copyright 2012 __MyCompanyName__. All rights reserved. * */ #ifndef INCLUDE_RIM_SOUND_FILTER_VERSION_H #define INCLUDE_RIM_SOUND_FILTER_VERSION_H #include "rimSoundFiltersConfig.h" //########################################################################################## //************************ Start Rim Sound Filters Namespace ***************************** RIM_SOUND_FILTERS_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class which represents the version number of a SoundFilter class. class SoundFilterVersion { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructors /// Create a version object representing the default version: 0.0.0 RIM_INLINE SoundFilterVersion() : majorVersion( 0 ), minorVersion( 0 ), revisionVersion( 0 ) { } /// Create a version object representing the specified major/minor/revision version. RIM_INLINE SoundFilterVersion( UInt newMajorVersion, UInt newMinorVersion = 0, UInt newRevisionVersion = 0 ) : majorVersion( newMajorVersion ), minorVersion( newMinorVersion ), revisionVersion( newRevisionVersion ) { } /// Create a version object that attempts to parse the specified version string. /** * The string must be of the form "M.m.r" where 'M' is the major version * number, 'm' is the minor version number, and 'r' is the revision number. * If there is an error in parsing the string, the created version numbers are 0.0.0 */ SoundFilterVersion( const String& versionString ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Major Version Accessor Methods /// Return the major version number for this sound filter version object. RIM_INLINE UInt getMajor() const { return majorVersion; } /// Set the major version number for this sound filter version object. RIM_INLINE void setMajor( UInt newMajorVersion ) { majorVersion = newMajorVersion; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Minor Version Accessor Methods /// Return the minor version number for this sound filter version object. RIM_INLINE UInt getMinor() const { return minorVersion; } /// Set the minor version number for this sound filter version object. RIM_INLINE void setMinor( UInt newMinorVersion ) { minorVersion = newMinorVersion; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Minor Version Accessor Methods /// Return the revision version number for this sound filter version object. RIM_INLINE UInt getRevision() const { return revisionVersion; } /// Set the revision version number for this sound filter version object. RIM_INLINE void setRevision( UInt newRevisionVersion ) { revisionVersion = newRevisionVersion; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Version Comparison Operators /// Return whether or not this filter version number is exactly equal to another version number. RIM_INLINE Bool operator == ( const SoundFilterVersion& other ) const { return majorVersion == other.majorVersion && minorVersion == other.minorVersion && revisionVersion == other.revisionVersion; } /// Return whether or not this filter version number is not equal to another version number. RIM_INLINE Bool operator != ( const SoundFilterVersion& other ) const { return majorVersion != other.majorVersion || minorVersion != other.minorVersion || revisionVersion != other.revisionVersion; } /// Return whether or not this filter version number is earlier than another version number. Bool operator < ( const SoundFilterVersion& other ) const; /// Return whether or not this filter version number is earlier than or equal to another version number. Bool operator <= ( const SoundFilterVersion& other ) const; /// Return whether or not this filter version number is later than another version number. Bool operator > ( const SoundFilterVersion& other ) const; /// Return whether or not this filter version number is later than or equal to another version number. Bool operator >= ( const SoundFilterVersion& other ) const; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** String Conversion Methods /// Convert this filter version to a human-readable string format. /** * The returned string is of the form "M.m.r" where 'M' is the major version * number, 'm' is the minor version number, and 'r' is the revision number. */ String toString() const; /// Convert this filter version to a human-readable string format. /** * The returned string is of the form "M.m.r" where 'M' is the major version * number, 'm' is the minor version number, and 'r' is the revision number. */ RIM_INLINE operator String () const { return this->toString(); } private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Members /// An integer representing the major version number of a sound filter. UInt majorVersion; /// An integer representing the minor version number of a sound filter. UInt minorVersion; /// An integer representing the revision version number of a sound filter. UInt revisionVersion; }; //########################################################################################## //************************ End Rim Sound Filters Namespace ******************************* RIM_SOUND_FILTERS_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_SOUND_FILTER_VERSION_H <file_sep>/* * rimGraphicsPipeline.h * Rim Software * * Created by <NAME> on 6/22/14. * Copyright 2014 __MyCompanyName__. All rights reserved. * */ #ifndef INCLUDE_RIM_GRAPHICS_PIPELINE_H #define INCLUDE_RIM_GRAPHICS_PIPELINE_H #include "rimGraphicsRenderersConfig.h" #include "rimGraphicsRenderer.h" //########################################################################################## //********************** Start Rim Graphics Renderers Namespace ************************** RIM_GRAPHICS_RENDERERS_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class that performs a sequence of rendering operations. class GraphicsPipeline : public Renderer { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructors /// Create a new graphics pipeline with no renderers. GraphicsPipeline(); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Rendering Method /// Render each of the renderers in order for this pipeline. virtual void render(); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Renderer Accessor Methods /// Return the number of renderers that this graphics pipeline renders. RIM_INLINE Size getRendererCount() const { return renderers.getSize(); } /// Return a pointer to the renderer at the specified index in this pipeline. RIM_INLINE const Pointer<Renderer>& getRenderer( Index rendererIndex ) const { return renderers[rendererIndex]; } /// Add a new renderer to this renderer that is rendered after the previously added renderers. /** * The method returns whether or not the renderer was successfully added. * The method fails if the renderer is NULL or is invalid. */ Bool addRenderer( const Pointer<Renderer>& newRenderer ); /// Insert a new renderer to this renderer that is rendered at the specified index. /** * The method returns whether or not the renderer was successfully added. * The method fails if the renderer is NULL or is invalid. */ Bool insertRenderer( Index rendererIndex, const Pointer<Renderer>& newRenderer ); /// Remove the renderer at the specified index in this graphics pipeline. /** * The method returns whether or not the renderer was successfully removed. */ Bool removeRenderer( Index rendererIndex ); /// Remove the specified renderer from this graphics pipeline. /** * The method returns whether or not the renderer was successfully removed. */ Bool removeRenderer( const Renderer* renderer ); /// Remove all renderers from this post processes renderer. void clearRenderers(); public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Members /// A list of the renderers that are rendered in order by this pipeline. ArrayList< Pointer<Renderer> > renderers; }; //########################################################################################## //********************** End Rim Graphics Renderers Namespace **************************** RIM_GRAPHICS_RENDERERS_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_GRAPHICS_PIPELINE_H <file_sep>/* * rimShaderLanguageVersion.h * Rim Software * * Created by <NAME> on 11/25/13. * Copyright 2013 __MyCompanyName__. All rights reserved. * */ #ifndef INCLUDE_RIM_GRAPHICS_SHADER_LANGUAGE_VERSION_H #define INCLUDE_RIM_GRAPHICS_SHADER_LANGUAGE_VERSION_H #include "rimGraphicsShadersConfig.h" //########################################################################################## //*********************** Start Rim Graphics Shaders Namespace *************************** RIM_GRAPHICS_SHADERS_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class which represents the version number of a shader language. /** * A version number is specified by a major version number, minor version * number, and revision number */ class ShaderLanguageVersion { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructors /// Create a version object representing the default version: 0.0.0 RIM_INLINE ShaderLanguageVersion() : majorVersion( 0 ), minorVersion( 0 ), revisionVersion( 0 ) { } /// Create a version object representing the specified major/minor/revision version. RIM_INLINE ShaderLanguageVersion( UInt newMajorVersion, UInt newMinorVersion = 0, UInt newRevisionVersion = 0 ) : majorVersion( newMajorVersion ), minorVersion( newMinorVersion ), revisionVersion( newRevisionVersion ) { } /// Create a version object that attempts to parse the specified version string. /** * The string must be of the form "M.m.r" where 'M' is the major version * number, 'm' is the minor version number, and 'r' is the revision number. * If there is an error in parsing the string, the created version numbers are 0.0.0 */ ShaderLanguageVersion( const String& versionString ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Major Version Accessor Methods /// Return the major version number for this shader language version object. RIM_INLINE UInt getMajor() const { return majorVersion; } /// Set the major version number for this shader language version object. RIM_INLINE void setMajor( UInt newMajorVersion ) { majorVersion = newMajorVersion; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Minor Version Accessor Methods /// Return the minor version number for this shader language version object. RIM_INLINE UInt getMinor() const { return minorVersion; } /// Set the minor version number for this shader language version object. RIM_INLINE void setMinor( UInt newMinorVersion ) { minorVersion = newMinorVersion; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Minor Version Accessor Methods /// Return the revision version number for this shader language version object. RIM_INLINE UInt getRevision() const { return revisionVersion; } /// Set the revision version number for this shader language version object. RIM_INLINE void setRevision( UInt newRevisionVersion ) { revisionVersion = newRevisionVersion; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Version Comparison Operators /// Return whether or not this filter version number is exactly equal to another version number. RIM_INLINE Bool operator == ( const ShaderLanguageVersion& other ) const { return majorVersion == other.majorVersion && minorVersion == other.minorVersion && revisionVersion == other.revisionVersion; } /// Return whether or not this filter version number is not equal to another version number. RIM_INLINE Bool operator != ( const ShaderLanguageVersion& other ) const { return majorVersion != other.majorVersion || minorVersion != other.minorVersion || revisionVersion != other.revisionVersion; } /// Return whether or not this filter version number is earlier than another version number. Bool operator < ( const ShaderLanguageVersion& other ) const; /// Return whether or not this filter version number is earlier than or equal to another version number. Bool operator <= ( const ShaderLanguageVersion& other ) const; /// Return whether or not this filter version number is later than another version number. Bool operator > ( const ShaderLanguageVersion& other ) const; /// Return whether or not this filter version number is later than or equal to another version number. Bool operator >= ( const ShaderLanguageVersion& other ) const; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** String Conversion Methods /// Convert this filter version to a human-readable string format. /** * The returned string is of the form "M.m.r" where 'M' is the major version * number, 'm' is the minor version number, and 'r' is the revision number. */ String toString() const; /// Convert this filter version to a human-readable string format. /** * The returned string is of the form "M.m.r" where 'M' is the major version * number, 'm' is the minor version number, and 'r' is the revision number. */ RIM_INLINE operator String () const { return this->toString(); } private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Members /// An integer representing the major version number of a shader language. UInt8 majorVersion; /// An integer representing the minor version number of a shader language. UInt8 minorVersion; /// An integer representing the revision version number of a shader language. UInt8 revisionVersion; }; //########################################################################################## //*********************** End Rim Graphics Shaders Namespace ***************************** RIM_GRAPHICS_SHADERS_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_GRAPHICS_SHADER_LANGUAGE_VERSION_H <file_sep>/* * rimSoundConvolutionFilter.h * Rim Software * * Created by <NAME> on 4/1/14. * Copyright 2014 __MyCompanyName__. All rights reserved. * */ #ifndef INCLUDE_RIM_SOUND_CONVOLUTION_FILTER_H #define INCLUDE_RIM_SOUND_CONVOLUTION_FILTER_H #include "rimSoundFiltersConfig.h" #include "rimSoundFilter.h" //########################################################################################## //************************ Start Rim Sound Filters Namespace ***************************** RIM_SOUND_FILTERS_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class that convolves a stream of audio with an impulse response with no latency. class ConvolutionFilter : public SoundFilter { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructors /// Create a new convolution filter with no impulse response. ConvolutionFilter(); /// Create a new convolution filter that is an exact copy of another. ConvolutionFilter( const ConvolutionFilter& other ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Destructor /// Destroy this convolution filter, releasing all internal resources. ~ConvolutionFilter(); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Assignment Operator /// Assign the state of another convolution filter to this one. ConvolutionFilter& operator = ( const ConvolutionFilter& other ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Impulse Response Accessor Methods /// Replace the current impulse response with a new one, reseting the audio processing. Bool setImpulseResponse( const SoundBuffer& newImpulseResponse ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Filter Attribute Accessor Methods /// Return a human-readable name for this convolution filter. /** * The method returns the string "Convolution Filter". */ virtual UTF8String getName() const; /// Return the manufacturer name of this convolution filter. /** * The method returns the string "Headspace Sound". */ virtual UTF8String getManufacturer() const; /// Return an object representing the version of this convolution filter. virtual SoundFilterVersion getVersion() const; /// Return an object which describes the category of effect that this filter implements. /** * This method returns the value SoundFilterCategory::PITCH. */ virtual SoundFilterCategory getCategory() const; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Filter Parameter Accessor Methods /// Return the total number of generic accessible parameters this filter has. virtual Size getParameterCount() const; /// Get information about the filter parameter at the specified index. virtual Bool getParameterInfo( Index parameterIndex, FilterParameterInfo& info ) const; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Public Static Property Objects /// A string indicating the human-readable name of this convolution filter. static const UTF8String NAME; /// A string indicating the manufacturer name of this convolution filter. static const UTF8String MANUFACTURER; /// An object indicating the version of this convolution filter. static const SoundFilterVersion VERSION; private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Filter Parameter Value Accessor Methods /// Place the value of the parameter at the specified index in the output parameter. virtual Bool getParameterValue( Index parameterIndex, FilterParameter& value ) const; /// Attempt to set the parameter value at the specified index. virtual Bool setParameterValue( Index parameterIndex, const FilterParameter& value ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Stream Reset Method /// A method which is called whenever the filter's stream of audio is being reset. /** * This method allows the filter to reset all parameter interpolation * and processing to its initial state to avoid coloration from previous * audio or parameter values. */ virtual void resetStream(); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Filter Processing Methods /// Multiply the samples in the input frame by this convolution filter's gain factor and place them in the output frame. virtual SoundFilterResult processFrame( const SoundFilterFrame& inputFrame, SoundFilterFrame& outputFrame, Size numSamples ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Channel Data Class Declaration typedef math::Complex<Float> ComplexSample; typedef Array< ComplexSample > ComplexChannel; typedef math::SIMDFloat SIMDFloat; /// A class that encapsulates a partitioned IR stored in frequency domain. class FrequencyDomainIR; /// A class representing a single partition of an FDL. class FDLPartition; /// A class holding the master state for an FDL. class FDLState; /// A class representing a Frequency-domain Delay Line for a particular FFT window size. class FDL; /// A class representing a deadline when one or more FDLs may have output due. class FDLDeadline; /// A class holding the entire state for one convolution instance. class ConvolutionState; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Helper Methods void updateStateIR( ConvolutionState& convolutionState, const SoundBuffer& newIR ); Size initializeFDLs( Size irLength, Size& paddedIRLength ); void renderConvolution( const SoundBuffer& inputBuffer, SoundBuffer& outputBuffer, Size numSamples ); /// A method that runs on a separate thread, processing the FDL with the specified index on demand. void processFDLThread( Index fdlIndex ); void renderFDL( Index fdlIndex ); void processFFTFrame( Size numDeadlines ); void processDirectConvolution( Size inputSize ); Index getNextDeadlineForFDL( Index fdlIndex ); RIM_FORCE_INLINE static void complexMultiplyAdd( const ComplexSample* input, const ComplexSample* filter, ComplexSample* output, Size number ); RIM_FORCE_INLINE static void complexMultiplySet( const ComplexSample* input, const ComplexSample* filter, ComplexSample* output, Size number ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Static Convolution Paramter Data Members /// The default number of partitions to use for each FDL. static const Size DEFAULT_PARTITIONS_PER_FDL = 4; /// The maximum number of FDLs there can be. static const Size DEFAULT_MAX_FDL_COUNT = 8; /// The default number of samples for the first IR partition that uses direct convolution. static const Size DEFAULT_DIRECT_PARTITION_LENGTH = 32; /// The default number of samples for the first FDL partition. static const Size DEFAULT_MIN_FDL_SIZE = 1024; /// The default maximum number of samples for an FDL partition. static const Size DEFAULT_MAX_FDL_SIZE = 32768; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Members /// An array of convolution rendering states for this convolution filter. Array<ConvolutionState> states; /// An array of the master FDL state objects for this renderer. ArrayList<FDLState*> fdls; /// An array of the deadlines, one for each # of FDLs that can finish in a frame (1, 2, ...). ArrayList<FDLDeadline*> deadlines; /// The maximum number of FDLs that are allowed for this convolution renderer. Size maxFDLCount; /// The minimum number of samples allowed for an FDL partition. Size minFDLSize; /// The maximum number of samples allowed for an FDL partition. Size maxFDLSize; /// The number of partitions to use for each FDL. Size partitionsPerFDL; /// A buffer of samples that contains the first partition of the IR in time-domain for direct convolution. SoundBuffer directPartition; /// The length in samples of the initial direct convolution filter. Size directPartitionLength; /// The sample rate of the last sample buffer processed. /** * This value is used to detect when the sample rate of the audio stream has changed, * and thus reinitialize the filter processing. */ SampleRate lastSampleRate; }; //########################################################################################## //************************ End Rim Sound Filters Namespace ******************************* RIM_SOUND_FILTERS_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_SOUND_CONVOLUTION_FILTER_H <file_sep>/* * rimSoundSampleRateConverter.h * Rim Sound * * Created by <NAME> on 7/22/12. * Copyright 2012 __MyCompanyName__. All rights reserved. * */ #ifndef INCLUDE_RIM_SOUND_SAMPLE_RATE_CONVERTER_H #define INCLUDE_RIM_SOUND_SAMPLE_RATE_CONVERTER_H #include "rimSoundFiltersConfig.h" #include "rimSoundFilter.h" //########################################################################################## //************************ Start Rim Sound Filters Namespace ***************************** RIM_SOUND_FILTERS_NAMESPACE_START //****************************************************************************************** //########################################################################################## class CutoffFilter; //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class which converts samples from an input buffer to a set output sample rate. /** * This class should be used wherever a mismatched sample rate could occur and needs * to be corrected for. For instance: sound file I/O, sound device I/O, mixing. * * Several different methods of sample rate conversion are part of the class * which provide a range of quality-speed tradeoffs. */ class SampleRateConverter : public SoundFilter { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Sample Rate Conversion Type Enum Declaration typedef enum Type { /// The best quality sample rate conversion available. /** * If this conversion type enum value is supplied, the converter chooses * the best available sample rate converter and uses that algorithm. */ BEST = 0, /// The fastest sample rate conversion available. /** * If this conversion type enum value is supplied, the converter chooses * the fastest available sample rate converter and uses that algorithm. */ FASTEST = 1, /// The sample rate converter does a simple interpolation of the input samples. /** * This is the fastest way to do sample rate conversion but it also has the * worst quality. There may be audible artifacts in the output audio if this * conversion type is used. */ INTERPOLATE = 2, /// The sample rate converter does an interpolation of the input samples with antialiasing. /** * This is the second fastest way to do sample rate conversion and has better * quality for downsampling than INTERPOLATE because it applies a steep low pass filter * at the Nyquist frequency of the output sample rate. This filter helps avoid * aliasing artifacts when downsampling and corrects for added noise when upsampling. */ INTERPOLATE_FILTERED = 3 }; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructors /// Create a default sample rate converter with the best conversion type and 44.1 kHz output sample rate. SampleRateConverter(); /// Create a sample rate converter with the specified conversion type and 44.1 kHz output sample rate. SampleRateConverter( Type newConversionType ); /// Create a sample rate converter with the specified conversion type and output sample rate. SampleRateConverter( Type newConversionType, SampleRate newOutputSampleRate ); /// Create an exact copy of the specified sample rate converter. SampleRateConverter( const SampleRateConverter& other ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Destructor /// Destroy this sample rate converter and release all associated resources. ~SampleRateConverter(); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Assignment Operator /// Assign the state of the specified sample rate converter to this one. SampleRateConverter& operator = ( const SampleRateConverter& other ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Destination Sample Rate Accessor Methods /// Return the sampling rate to which all input audio is being converted. RIM_INLINE SampleRate getOutputSampleRate() const { return outputSampleRate; } /// Set the sampling rate to which all input audio should be converted. /** * If the sample rate of 0 is supplied, no sample rate conversion will * be done in the filter's processing method. Otherwise, the input audio * will be resampled to the desired sampling rate. */ RIM_INLINE void setOutputSampleRate( SampleRate newOutputSampleRate ) { lockMutex(); outputSampleRate = math::max( newOutputSampleRate, SampleRate(0) ); unlockMutex(); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Destination Sample Rate Accessor Methods /// Return the type of sample rate conversion that is being performed. /** * Some types of sample rate conversion are faster or have better quality than * others. This value allows the user to specify which conversion algorithm to * use based on the application. */ RIM_INLINE Type getType() const { return conversionType; } /// Set the type of sample rate conversion that is being performed. /** * Some types of sample rate conversion are faster or have better quality than * others. This value allows the user to specify which conversion algorithm to * use based on the application. */ RIM_INLINE void setType( Type newSampleRateConversionType ) { lockMutex(); conversionType = newSampleRateConversionType; unlockMutex(); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Filter Attribute Accessor Methods /// Return a human-readable name for this sample rate converter. /** * The method returns the string "Sample Rate Converter". */ virtual UTF8String getName() const; /// Return the manufacturer name of this sample rate converter. /** * The method returns the string "Headspace Sound". */ virtual UTF8String getManufacturer() const; /// Return an object representing the version of this sample rate converter. virtual SoundFilterVersion getVersion() const; /// Return an object which describes the category of effect that this filter implements. /** * This method returns the value SoundFilterCategory::UTILITY. */ virtual SoundFilterCategory getCategory() const; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Filter Parameter Accessor Methods /// Return the total number of generic accessible parameters this sample rate converter has. virtual Size getParameterCount() const; /// Get information about the sample rate converter parameter at the specified index. virtual Bool getParameterInfo( Index parameterIndex, FilterParameterInfo& info ) const; /// Get any special name associated with the specified value of an indexed parameter. virtual Bool getParameterValueName( Index parameterIndex, const FilterParameter& value, UTF8String& name ) const; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Public Static Property Objects /// A string indicating the human-readable name of this sample rate converter. static const UTF8String NAME; /// A string indicating the manufacturer name of this sample rate converter. static const UTF8String MANUFACTURER; /// An object indicating the version of this sample rate converter. static const SoundFilterVersion VERSION; private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Filter Parameter Value Accessor Methods /// Place the value of the parameter at the specified index in the output parameter. virtual Bool getParameterValue( Index parameterIndex, FilterParameter& value ) const; /// Attempt to set the parameter value at the specified index. virtual Bool setParameterValue( Index parameterIndex, const FilterParameter& value ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Stream Reset Method /// A method which is called whenever the filter's stream of audio is being reset. /** * This method allows the filter to reset all parameter interpolation * and processing to its initial state to avoid coloration from previous * audio or parameter values. */ virtual void resetStream(); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Filter Processing Method /// Convert the specified number of samples from the input frame to the desired sample rate. /** * This method changes the sample rate of the output frame (and may enlarge it if * necessary to hold extra sample information) and returns the total number of * samples written to the output frame. */ virtual SoundFilterResult processFrame( const SoundFilterFrame& inputFrame, SoundFilterFrame& outputFrame, Size numSamples ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Sample Rate Conversion Methods /// Do a simple linear sample rate conversion on the input and place it in the output buffer. Size interpolateBuffers( const SoundBuffer& inputBuffer, SoundBuffer& outputBuffer, Size numInputSamples ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Members /// An enum representing the type of sample rate conversion that should be done. /** * Some types of sample rate conversion are faster or have better quality than * others. This value allows the user to specify which conversion algorithm to * use based on the application. */ Type conversionType; /// The sampling rate to which all input audio will converted. SampleRate outputSampleRate; /// When using an INTERPOLATE sample rate converter, this is the offset between adjacent samples. /** * This value is stored so that process buffers from the same sound source will produce * glitch-free audio at the buffer boundaries. */ Float interpolationSampleOffset; /// An array holding the last input sample from the last buffer process cycle for each channel. Array<Sample32f> lastInputSample; /// A cutoff filter, optionally NULL, which is used to antialias the converted audio. CutoffFilter* lowPass; }; //########################################################################################## //************************ End Rim Sound Filters Namespace ******************************* RIM_SOUND_FILTERS_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_SOUND_SAMPLE_RATE_CONVERTER_H <file_sep>/* * rimResourceFormat.h * Rim Software * * Created by <NAME> on 2/24/14. * Copyright 2014 __MyCompanyName__. All rights reserved. * */ #ifndef INCLUDE_RIM_RESOURCE_FORMAT_H #define INCLUDE_RIM_RESOURCE_FORMAT_H #include "rimResourcesConfig.h" #include "rimResourceType.h" //########################################################################################## //************************** Start Rim Resources Namespace ******************************* RIM_RESOURCES_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// An enum class which specifies a format (format) for a resource. class ResourceFormat { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Resource Type Enum Definition /// An enum type which represents the type of resource format. typedef enum Enum { /// An undefined resource format. UNDEFINED = 0, //******************************************************************************** // Scene formats /// Open-standard .dae scene format for digital access exchange. COLLADA, /// FBX Autodesk scene format. FBX, /// The Virtual Reality Modeling Language scene format. VRML, /// The DirectX .x scene format. X, /// The old 3DS Max .3ds scene format. THREE_DS, /// The Cinema 4D scene format. CINEMA_4D, /// The SketchUp .skp scene format. SKETCH_UP, /// The Asset scene format. ASSET_SCENE, //******************************************************************************** // Graphics Shape formats /// The wavefront .obj shape format. OBJ, /// PLY polygon shape format (Stanford triangle format). PLY, /// The .tri alias triangle shape format. TRI, //******************************************************************************** // Graphics Material formats /// The wavefront .mtl material file format, used with the OBJ shape format. MTL, //******************************************************************************** // Image formats /// The uncompressed .bmp image file format. BMP, /// The lossily-compressed .jpg image file format. JPEG, /// The losslessly-compressed .png image file format. PNG, /// The .tga image file format. TGA, /// The .tiff image file format. TIFF, /// The .gif image file format. GIF, /// The JPEG 2000 image file format. JPEG_2000, /// The DDS image/texture file format. DDS, //******************************************************************************** // Sound formats /// The WAVE sound format. WAVE, /// The Audio Interchange File Format (AIFF) sound format. AIFF, /// The compressed OGG sound format. OGG, /// The compressed MPEG-3 sound format. MP3, /// The MPEG-4 audio-only sound format. M4A, /// The Free Lossless Audio Codec (FLAC) sound format. FLAC, /// The Core Audio Format (CAF) sound format. CAF, //******************************************************************************** // MIDI formats /// The Musical Instrument Digital Interface (MIDI) format. MIDI }; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructors /// Create a new resource format with the UNDEFINED resource format. RIM_INLINE ResourceFormat() : format( UNDEFINED ) { } /// Create a new resource format with the specified resource format enum value. RIM_INLINE ResourceFormat( Enum newFormat ) : format( newFormat ) { } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Enum Cast Operator /// Convert this resource format type to an enum value. RIM_INLINE operator Enum () const { return format; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Resource Type Accessor Method /// Return an object describing the type of resource that this format cannonically corresponds to. ResourceType getResourceType() const; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Format Extension Accessor Method /// Return the standard file extension used for this format. data::UTF8String getExtension() const; /// Return a format which corresponds to the type with the given extension string. static ResourceFormat fromExtension( const data::UTF8String& extension ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** String Representation Accessor Methods /// Return a unique string for this resource format that matches its enum value name. data::String toEnumString() const; /// Return a format which corresponds to the given enum string. static ResourceFormat fromEnumString( const data::String& enumString ); /// Return a string representation of the resource format. data::String toString() const; /// Convert this resource format into a string representation. RIM_FORCE_INLINE operator data::String () const { return this->toString(); } private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Members /// An enum value which indicates the type of resource format. Enum format; }; //########################################################################################## //************************** End Rim Resources Namespace ********************************* RIM_RESOURCES_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_RESOURCE_FORMAT_H <file_sep>/* * rimSoundWaveDecoder.h * Rim Sound * * Created by <NAME> on 7/31/12. * Copyright 2012 __MyCompanyName__. All rights reserved. * */ #ifndef INCLUDE_RIM_SOUND_WAVE_DECODER_H #define INCLUDE_RIM_SOUND_WAVE_DECODER_H #include "rimSoundIOConfig.h" //########################################################################################## //*************************** Start Rim Sound IO Namespace ******************************* RIM_SOUND_IO_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class which handles streaming decoding of the PCM .WAV audio format. /** * This class uses an abstract data stream for input, allowing it to decode * .WAV data from a file, network source, or other source. */ class WaveDecoder : public SoundInputStream { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructors /// Create a new wave decoder which should decode the .WAV file at the specified path string. WaveDecoder( const UTF8String& pathToWaveFile ); /// Create a new wave decoder which should decode the specified .WAV file. WaveDecoder( const File& waveFile ); /// Create a new wave decoder which is decoding from the specified data input stream. /** * The stream must already be open for reading and should point to the first byte of the wave * file information. Otherwise, reading from the WAVE file will fail. */ WaveDecoder( const Pointer<DataInputStream>& waveStream ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Destructor /// Release all resources associated with this WaveDecoder object. ~WaveDecoder(); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** WAVE File Length Accessor Methods /// Get the length in samples of the WAVE file which is being decoded. RIM_INLINE SoundSize getLengthInSamples() const { return lengthInSamples; } /// Get the length in seconds of the WAVE file which is being decoded. RIM_INLINE Double getLengthInSeconds() const { return lengthInSamples*sampleRate; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Current Time Accessor Methods /// Get the index of the sample currently being read from the WAVE file. RIM_INLINE SampleIndex getCurrentSampleIndex() const { return currentSampleIndex; } /// Get the time in seconds within the WAVE file of the current read position of this decoder. RIM_INLINE Double getCurrentTime() const { return Double(currentSampleIndex / sampleRate); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Public Seek Status Accessor Methods /// Return whether or not seeking is allowed in this input stream. virtual Bool canSeek() const; /// Return whether or not this input stream's current position can be moved by the specified signed sample offset. /** * This sample offset is specified as the number of sample frames to move * in the stream - a frame is equal to one sample for each channel in the stream. */ virtual Bool canSeek( Int64 relativeSampleOffset ) const; /// Move the current sample frame position in the stream by the specified signed amount. /** * This method attempts to seek the position in the stream by the specified amount. * The method returns the signed amount that the position in the stream was changed * by. Thus, if seeking is not allowed, 0 is returned. Otherwise, the stream should * seek as far as possible in the specified direction and return the actual change * in position. */ virtual Int64 seek( Int64 relativeSampleOffset ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Stream Size Accessor Method /// Return the number of samples remaining in the sound input stream. /** * The value returned must only be a lower bound on the total number of sample * frames in the stream. For instance, if there are samples remaining, the method * should return at least 1. If there are no samples remaining, the method should * return 0. */ virtual SoundSize getSamplesRemaining() const; /// Return the current position of the stream within itself. /** * The returned value indicates the sample index of the current read * position within the sound stream. For unbounded streams, this indicates * the number of samples that have been read by the stream since it was opened. */ virtual SampleIndex getPosition() const; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Decoder Format Accessor Methods /// Return the number of channels that are in the sound input stream. /** * This is the number of channels that will be read with each read call * to the stream's read method. */ virtual Size getChannelCount() const; /// Return the sample rate of the sound input stream's source audio data. /** * Since some types of streams support variable sampling rates, this value * is not necessarily the sample rate of all audio that is read from the stream. * However, for most streams, this value represents the sample rate of the entire * stream. One should always test the sample rate of the buffers returned by the * stream to see what their sample rates are before doing any operations that assume * a sampling rate. */ virtual SampleRate getSampleRate() const; /// Return the actual sample type used in the stream. /** * This is the format of the stream's source data. For instance, a file * might be encoded with 8-bit, 16-bit or 24-bit samples. This value * indicates that sample type. For formats that don't have a native sample type, * such as those which use frequency domain encoding, this function should * return SampleType::SAMPLE_32F, indicating that the stream's native format * is 32-bit floating point samples. */ virtual SampleType getNativeSampleType() const; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Decoder Status Accessor Method /// Return whether or not this wave decoder is reading a valid WAVE file. Bool isValid() const; private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Copy Operations /// Create a copy of the specified wave decoder. WaveDecoder( const WaveDecoder& other ); /// Assign the current state of another WaveDecoder object to this WaveDecoder object. WaveDecoder& operator = ( const WaveDecoder& other ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Sound Reading Method /// Read the specified number of samples from the input stream into the output buffer. /** * This method attempts to read the specified number of samples from the stream * into the input buffer. It then returns the total number of valid samples which * were read into the output buffer. The samples are converted to the format * stored in the input buffer (Sample32f). The input position in the stream * is advanced by the number of samples that are read. */ virtual Size readSamples( SoundBuffer& inputBuffer, Size numSamples ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Helper Methods /// Read the header of the wave file, starting from the current position. /** * This method should only be called when the data input stream is first initialized * and points to the first byte of the wave header. */ void openWaveFile(); /// Return the number of bytes per sample (stored on disk) for the compression scheme. Size getBytesPerSample() const; static Int16 decodeALaw( UInt8 aLaw ); static Int16 decodeMuLaw( UInt8 muLaw ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Members /// A pointer to the data input stream from which we are decoding .WAV data. Pointer<DataInputStream> stream; /// A mutex object which provides thread synchronization for this wave decoder. /** * This thread protects access to decoding parameters such as the current decoding * position so that they are never accessed while audio is being decoded. */ mutable threads::Mutex decodingMutex; /// The number of channels in the WAVE file. Size numChannels; /// The sample rate of the WAVE file. SampleRate sampleRate; /// The type of sample in which the WAVE file is encoded. /** * For PCM types this value is equal to the actual type of the encoded samples. * For A-law and Mu-law encodings, this value indicates the size of the encoded, * not the decoded samples. */ SampleType sampleType; /// The WAVE file encoding format. Index format; /// The length in samples of the WAVE file. SoundSize lengthInSamples; /// The index within the WAVE file of the current sample being read. SampleIndex currentSampleIndex; /// A boolean flag indicating whether or not this wave decoder is decoding a valid wave file. Bool validFile; }; //########################################################################################## //*************************** End Rim Sound IO Namespace ********************************* RIM_SOUND_IO_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_SOUND_WAVE_DECODER_H <file_sep>/* * rimGraphicsContextFlags.h * Rim Graphics * * Created by <NAME> on 3/1/13. * Copyright 2013 __MyCompanyName__. All rights reserved. * */ #ifndef INCLUDE_RIM_GRAPHICS_CONTEXT_FLAGS_H #define INCLUDE_RIM_GRAPHICS_CONTEXT_FLAGS_H #include "rimGraphicsDevicesConfig.h" //########################################################################################## //*********************** Start Rim Graphics Devices Namespace *************************** RIM_GRAPHICS_DEVICES_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class which encapsulates the different flags that a graphics context can have. /** * These flags provide boolean information about a certain graphics context. Flags * are indicated by setting a single bit of a 32-bit unsigned integer to 1. * * Enum values for the different flags are defined as members of the class. Typically, * the user would bitwise-OR the flag enum values together to produce a final set * of set flags. */ class GraphicsContextFlags { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Graphics Context Flags Enum Declaration /// An enum which specifies the different graphics context flags. typedef enum Flag { /// A flag indicating whether or not the context is using double buffering. DOUBLE_BUFFERED = 1, /// A flag indicating whether or not the context's framebuffer has an alpha channel. ALPHA = 1 << 1, /// A flag indicating that the graphics context is hardware accelerated. ACCELERATED = 1 << 2, /// A flag indicating that multisample anti-aliasing is used by the context. MULTISAMPLE_AA = 1 << 3, /// A flag indicating that supersample anti-aliasing is used by the context. SUPERSAMPLE_AA = 1 << 4, /// The flag value when all flags are not set. UNDEFINED = 0 }; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructors /// Create a new graphics context flags object with no flags set. RIM_INLINE GraphicsContextFlags() : flags( UNDEFINED ) { } /// Create a new graphics context flags object with the specified flag value initially set. RIM_INLINE GraphicsContextFlags( Flag flag ) : flags( flag ) { } /// Create a new graphics context flags object with the specified initial combined flags value. RIM_INLINE GraphicsContextFlags( UInt32 newFlags ) : flags( newFlags ) { } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Integer Cast Operator /// Convert this graphics context flags object to an integer value. /** * This operator is provided so that the GraphicsContextFlags object * can be used as an integer value for bitwise logical operations. */ RIM_INLINE operator UInt32 () const { return flags; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Flag Status Accessor Methods /// Return whether or not the specified flag value is set for this flags object. RIM_INLINE Bool isSet( Flag flag ) const { return (flags & flag) != UNDEFINED; } /// Set whether or not the specified flag value is set for this flags object. RIM_INLINE void set( Flag flag, Bool newIsSet ) { if ( newIsSet ) flags |= flag; else flags &= ~flag; } private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Members /// A value indicating the flags that are set for a graphics context. UInt32 flags; }; //########################################################################################## //*********************** End Rim Graphics Devices Namespace ***************************** RIM_GRAPHICS_DEVICES_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_GRAPHICS_CONTEXT_FLAGS_H <file_sep> #ifndef INCLUDE_RIM_SIMD_SCALAR_FLOAT_4_H #define INCLUDE_RIM_SIMD_SCALAR_FLOAT_4_H #include "rimMathConfig.h" #include "rimVector3D.h" #include "rimSIMDScalar.h" #include "rimSIMDScalarInt32_4.h" //########################################################################################## //***************************** Start Rim Math Namespace ********************************* RIM_MATH_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class representing a 4-component 32-bit floating-point SIMD scalar. /** * This specialization of the SIMDScalar class uses a 128-bit value to encode * 4 32-bit floating-point values. All basic arithmetic operations are supported, * plus a subset of standard scalar operations: abs(), min(), max(), sqrt(). */ template <> class RIM_ALIGN(16) SIMDScalar<Float32,4> { private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Type Declarations /// Define the type for a 4x float scalar structure. #if RIM_USE_SIMD && defined(RIM_SIMD_ALTIVEC) typedef RIM_ALTIVEC_VECTOR float SIMDScalar4; #elif RIM_USE_SIMD && defined(RIM_SIMD_SSE) && RIM_SSE_VERSION_IS_SUPPORTED(1,0) typedef __m128 SIMDScalar4; #endif //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Constructor #if RIM_USE_SIMD && (defined(RIM_SIMD_ALTIVEC) || defined(RIM_SIMD_SSE) && RIM_SSE_VERSION_IS_SUPPORTED(1,0)) /// Create a new 4D scalar with the specified 4D SIMD scalar value. RIM_FORCE_INLINE SIMDScalar( SIMDScalar4 simdScalar ) : v( simdScalar ) { } #endif public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructors /// Create a new 4D SIMD scalar with all elements left uninitialized. RIM_FORCE_INLINE SIMDScalar() { } /// Create a new 4D SIMD scalar with all elements equal to the specified value. RIM_FORCE_INLINE SIMDScalar( Float32 value ) { #if RIM_USE_SIMD && defined(RIM_SIMD_ALTIVEC) v = (SIMDScalar4)(value); #elif RIM_USE_SIMD && defined(RIM_SIMD_SSE) && RIM_SSE_VERSION_IS_SUPPORTED(1,0) v = _mm_set1_ps( value ); #else a = b = c = d = value; #endif } /// Create a new 4D SIMD scalar with the elements equal to the specified 4 values. RIM_FORCE_INLINE SIMDScalar( Float32 newA, Float32 newB, Float32 newC, Float32 newD ) { #if RIM_USE_SIMD && defined(RIM_SIMD_ALTIVEC) v = (SIMDScalar4)( newA, newB, newC, newD ); #elif RIM_USE_SIMD && defined(RIM_SIMD_SSE) && RIM_SSE_VERSION_IS_SUPPORTED(1,0) // The parameters are reversed to keep things consistent with loading from an address. v = _mm_set_ps( newD, newC, newB, newA ); #else a = newA; b = newB; c = newC; d = newD; #endif } /// Create a new 4D SIMD scalar with the first 3 elements equal to the specified vector's components. /** * The last element of the SIMD scalar is initialized to 0. */ RIM_FORCE_INLINE SIMDScalar( const Vector3D<Float32>& vector ) { #if RIM_USE_SIMD && defined(RIM_SIMD_ALTIVEC) v = (SIMDScalar4)( vector.x, vector.y, vector.z, Float32(0) ); #elif RIM_USE_SIMD && defined(RIM_SIMD_SSE) && RIM_SSE_VERSION_IS_SUPPORTED(1,0) // The parameters are reversed to keep things consistent with loading from an address. v = _mm_set_ps( Float32(0), vector.z, vector.y, vector.x ); #else a = vector.x; b = vector.y; c = vector.z; d = 0; #endif } /// Create a new 4D SIMD scalar from the first 4 values stored at specified aligned pointer's location. RIM_FORCE_INLINE SIMDScalar( const Float32* array ) { #if RIM_USE_SIMD && defined(RIM_SIMD_ALTIVEC) a = array[0]; b = array[1]; c = array[2]; d = array[3]; #elif RIM_USE_SIMD && defined(RIM_SIMD_SSE) && RIM_SSE_VERSION_IS_SUPPORTED(1,0) v = _mm_load_ps( array ); #else a = array[0]; b = array[1]; c = array[2]; d = array[3]; #endif } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Copy Constructor /// Create a new SIMD scalar with the same contents as another. /** * This shouldn't have to be overloaded, but for some reason the compiler (GCC) * optimizes SIMD code better with it overloaded. Before, the compiler would * store the result of a SIMD operation on the stack before transfering it to * the destination, resulting in an extra 8+ load/stores per computation. */ RIM_FORCE_INLINE SIMDScalar( const SIMDScalar& other ) { #if RIM_USE_SIMD && defined(RIM_SIMD_ALTIVEC) v = other.v; #elif RIM_USE_SIMD && defined(RIM_SIMD_SSE) && RIM_SSE_VERSION_IS_SUPPORTED(1,0) v = other.v; #else a = other.a; b = other.b; c = other.c; d = other.d; #endif } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Assignment Operator /// Assign the contents of one SIMDScalar object to another. /** * This shouldn't have to be overloaded, but for some reason the compiler (GCC) * optimizes SIMD code better with it overloaded. Before, the compiler would * store the result of a SIMD operation on the stack before transfering it to * the destination, resulting in an extra 8+ load/stores per computation. */ RIM_FORCE_INLINE SIMDScalar& operator = ( const SIMDScalar& other ) { #if RIM_USE_SIMD && defined(RIM_SIMD_ALTIVEC) v = other.v; #elif RIM_USE_SIMD && defined(RIM_SIMD_SSE) && RIM_SSE_VERSION_IS_SUPPORTED(1,0) v = other.v; #else a = other.a; b = other.b; c = other.c; d = other.d; #endif return *this; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Load Methods RIM_FORCE_INLINE static SIMDScalar load( const Float32* array ) { #if RIM_USE_SIMD && defined(RIM_SIMD_ALTIVEC) return SIMDScalar( array[0], array[1], array[2], array[3] ); #elif RIM_USE_SIMD && defined(RIM_SIMD_SSE) && RIM_SSE_VERSION_IS_SUPPORTED(1,0) return SIMDScalar( _mm_load_ps( array ) ); #else return SIMDScalar( array[0], array[1], array[2], array[3] ); #endif } RIM_FORCE_INLINE static SIMDScalar loadUnaligned( const Float32* array ) { #if RIM_USE_SIMD && defined(RIM_SIMD_ALTIVEC) return SIMDScalar( array[0], array[1], array[2], array[3] ); #elif RIM_USE_SIMD && defined(RIM_SIMD_SSE) && RIM_SSE_VERSION_IS_SUPPORTED(1,0) return SIMDScalar( _mm_loadu_ps( array ) ); #else return SIMDScalar( array[0], array[1], array[2], array[3] ); #endif } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Store Methods RIM_FORCE_INLINE void store( Float32* destination ) const { #if RIM_USE_SIMD && defined(RIM_SIMD_ALTIVEC) destination[0] = a; destination[1] = b; destination[2] = c; destination[3] = d; #elif RIM_USE_SIMD && defined(RIM_SIMD_SSE) && RIM_SSE_VERSION_IS_SUPPORTED(1,0) _mm_store_ps( destination, v ); #else destination[0] = a; destination[1] = b; destination[2] = c; destination[3] = d; #endif } RIM_FORCE_INLINE void storeUnaligned( Float32* destination ) const { #if RIM_USE_SIMD && defined(RIM_SIMD_ALTIVEC) destination[0] = a; destination[1] = b; destination[2] = c; destination[3] = d; #elif RIM_USE_SIMD && defined(RIM_SIMD_SSE) && RIM_SSE_VERSION_IS_SUPPORTED(1,0) _mm_storeu_ps( destination, v ); #else destination[0] = a; destination[1] = b; destination[2] = c; destination[3] = d; #endif } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Accessor Methods /// Get a reference to the value stored at the specified component index in this scalar. RIM_FORCE_INLINE Float32& operator [] ( Index i ) { return x[i]; } /// Get the value stored at the specified component index in this scalar. RIM_FORCE_INLINE Float32 operator [] ( Index i ) const { return x[i]; } /// Get a pointer to the first element in this scalar. /** * The remaining values are in the next 3 locations after the * first element. */ RIM_FORCE_INLINE const Float32* toArray() const { return x; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Comparison Operators /// Compare two 4D SIMD scalars component-wise for equality. /** * Return a 4D scalar of integers indicating the result of the comparison. * If each corresponding pair of components is equal, the corresponding result * component is non-zero. Otherwise, that result component is equal to zero. */ RIM_FORCE_INLINE SIMDScalar<Int32,4> operator == ( const SIMDScalar& scalar ) const { #if RIM_USE_SIMD && defined(RIM_SIMD_ALTIVEC) return SIMDScalar<Int32,4>( vec_cmpeq( v, scalar.v ) ); #elif RIM_USE_SIMD && defined(RIM_SIMD_SSE) && RIM_SSE_VERSION_IS_SUPPORTED(1,0) return SIMDScalar<Int32,4>( _mm_cmpeq_ps( v, scalar.v ) ); #else return SIMDScalar<Int32,4>( a == scalar.a, b == scalar.b, c == scalar.c, d == scalar.d ); #endif } /// Compare this scalar to a single floating point value for equality. /** * Return a 4D scalar of integers indicating the result of the comparison. * The float value is expanded to a 4-wide SIMD scalar and compared with this scalar. * If each corresponding pair of components is equal, the corresponding result * component is non-zero. Otherwise, that result component is equal to zero. */ RIM_FORCE_INLINE SIMDScalar<Int32,4> operator == ( const Float32 value ) const { #if RIM_USE_SIMD && defined(RIM_SIMD_ALTIVEC) return SIMDScalar<Int32,4>( vec_cmpeq( v, (SIMDScalar4)(value) ) ); #elif RIM_USE_SIMD && defined(RIM_SIMD_SSE) && RIM_SSE_VERSION_IS_SUPPORTED(1,0) return SIMDScalar<Int32,4>( _mm_cmpeq_ps( v, _mm_set1_ps( value ) ) ); #else return SIMDScalar<Int32,4>( a == value, b == value, c == value, d == value ); #endif } /// Compare two 4D SIMD scalars component-wise for inequality /** * Return a 4D scalar of integers indicating the result of the comparison. * If each corresponding pair of components is not equal, the corresponding result * component is non-zero. Otherwise, that result component is equal to zero. */ RIM_FORCE_INLINE SIMDScalar<Int32,4> operator != ( const SIMDScalar& scalar ) const { #if RIM_USE_SIMD && defined(RIM_SIMD_ALTIVEC) const RIM_ALTIVEC_VECTOR bool temp = vec_cmpeq( v, scalar.v ); return SIMDScalar<Int32,4>( vec_nor( temp, temp ) ); #elif RIM_USE_SIMD && defined(RIM_SIMD_SSE) && RIM_SSE_VERSION_IS_SUPPORTED(1,0) return SIMDScalar<Int32,4>( _mm_cmpneq_ps( v, scalar.v ) ); #else return SIMDScalar<Int32,4>( a != scalar.a, b != scalar.b, c != scalar.c, d != scalar.d ); #endif } /// Compare this scalar to a single floating point value for inequality. /** * Return a 4D scalar of integers indicating the result of the comparison. * The float value is expanded to a 4-wide SIMD scalar and compared with this scalar. * If each corresponding pair of components is not equal, the corresponding result * component is non-zero. Otherwise, that result component is equal to zero. */ RIM_FORCE_INLINE SIMDScalar<Int32,4> operator != ( const Float32 value ) const { #if RIM_USE_SIMD && defined(RIM_SIMD_ALTIVEC) const RIM_ALTIVEC_VECTOR bool temp = vec_cmpeq( v, (SIMDScalar4)(value) ); return SIMDScalar<Int32,4>( vec_nor( temp, temp ) ); #elif RIM_USE_SIMD && defined(RIM_SIMD_SSE) && RIM_SSE_VERSION_IS_SUPPORTED(1,0) return SIMDScalar<Int32,4>( _mm_cmpneq_ps( v, _mm_set1_ps( value ) ) ); #else return SIMDScalar<Int32,4>( a != value, b != value, c != value, d != value ); #endif } /// Perform a component-wise less-than comparison between this an another 4D SIMD scalar. /** * Return a 4D scalar of integers indicating the result of the comparison. * If each corresponding pair of components has this scalar's component less than * the other scalar's component, the corresponding result component is non-zero. * Otherwise, that result component is equal to zero. */ RIM_FORCE_INLINE SIMDScalar<Int32,4> operator < ( const SIMDScalar& scalar ) const { #if RIM_USE_SIMD && defined(RIM_SIMD_ALTIVEC) return SIMDScalar<Int32,4>( vec_cmplt( v, scalar.v ) ); #elif RIM_USE_SIMD && defined(RIM_SIMD_SSE) && RIM_SSE_VERSION_IS_SUPPORTED(1,0) return SIMDScalar<Int32,4>( _mm_cmplt_ps( v, scalar.v ) ); #else return SIMDScalar<Int32,4>( a < scalar.a, b < scalar.b, c < scalar.c, d < scalar.d ); #endif } /// Perform a component-wise less-than comparison between this 4D SIMD scalar and an expanded scalar. /** * Return a 4D scalar of integers indicating the result of the comparison. * The float value is expanded to a 4-wide SIMD scalar and compared with this scalar. * If each corresponding pair of components has this scalar's component less than * the other scalar's component, the corresponding result component is non-zero. * Otherwise, that result component is equal to zero. */ RIM_FORCE_INLINE SIMDScalar<Int32,4> operator < ( const Float32 value ) const { #if RIM_USE_SIMD && defined(RIM_SIMD_ALTIVEC) return SIMDScalar<Int32,4>( vec_cmplt( v, (SIMDScalar4)(value) ) ); #elif RIM_USE_SIMD && defined(RIM_SIMD_SSE) && RIM_SSE_VERSION_IS_SUPPORTED(1,0) return SIMDScalar<Int32,4>( _mm_cmplt_ps( v, _mm_set1_ps( value ) ) ); #else return SIMDScalar<Int32,4>( a < value, b < value, c < value, d < value ); #endif } /// Perform a component-wise greater-than comparison between this an another 4D SIMD scalar. /** * Return a 4D scalar of integers indicating the result of the comparison. * If each corresponding pair of components has this scalar's component greater than * the other scalar's component, the corresponding result component is non-zero. * Otherwise, that result component is equal to zero. */ RIM_FORCE_INLINE SIMDScalar<Int32,4> operator > ( const SIMDScalar& scalar ) const { #if RIM_USE_SIMD && defined(RIM_SIMD_ALTIVEC) return SIMDScalar<Int32,4>( vec_cmpgt( v, scalar.v ) ); #elif RIM_USE_SIMD && defined(RIM_SIMD_SSE) && RIM_SSE_VERSION_IS_SUPPORTED(1,0) return SIMDScalar<Int32,4>( _mm_cmpgt_ps( v, scalar.v ) ); #else return SIMDScalar<Int32,4>( a > scalar.a, b > scalar.b, c > scalar.c, d > scalar.d ); #endif } /// Perform a component-wise greater-than comparison between this 4D SIMD scalar and an expanded scalar. /** * Return a 4D scalar of integers indicating the result of the comparison. * The float value is expanded to a 4-wide SIMD scalar and compared with this scalar. * If each corresponding pair of components has this scalar's component greater than * the other scalar's component, the corresponding result component is non-zero. * Otherwise, that result component is equal to zero. */ RIM_FORCE_INLINE SIMDScalar<Int32,4> operator > ( const Float32 value ) const { #if RIM_USE_SIMD && defined(RIM_SIMD_ALTIVEC) return SIMDScalar<Int32,4>( vec_cmpgt( v, (SIMDScalar4)(value) ) ); #elif RIM_USE_SIMD && defined(RIM_SIMD_SSE) && RIM_SSE_VERSION_IS_SUPPORTED(1,0) return SIMDScalar<Int32,4>( _mm_cmpgt_ps( v, _mm_set1_ps( value ) ) ); #else return SIMDScalar<Int32,4>( a > value, b > value, c > value, d > value ); #endif } /// Perform a component-wise less-than-or-equal-to comparison between this an another 4D SIMD scalar. /** * Return a 4D scalar of integers indicating the result of the comparison. * If each corresponding pair of components has this scalar's component less than * or equal to the other scalar's component, the corresponding result component is non-zero. * Otherwise, that result component is equal to zero. */ RIM_FORCE_INLINE SIMDScalar<Int32,4> operator <= ( const SIMDScalar& scalar ) const { #if RIM_USE_SIMD && defined(RIM_SIMD_ALTIVEC) return SIMDScalar<Int32,4>( vec_cmple( v, scalar.v ) ); #elif RIM_USE_SIMD && defined(RIM_SIMD_SSE) && RIM_SSE_VERSION_IS_SUPPORTED(1,0) return SIMDScalar<Int32,4>( _mm_cmple_ps( v, scalar.v ) ); #else return SIMDScalar<Int32,4>( a <= scalar.a, b <= scalar.b, c <= scalar.c, d <= scalar.d ); #endif } /// Perform a component-wise less-than-or-equal-to comparison between this 4D SIMD scalar and an expanded scalar. /** * Return a 4D scalar of integers indicating the result of the comparison. * The float value is expanded to a 4-wide SIMD scalar and compared with this scalar. * If each corresponding pair of components has this scalar's component less than * or equal to the other scalar's component, the corresponding result component is non-zero. * Otherwise, that result component is equal to zero. */ RIM_FORCE_INLINE SIMDScalar<Int32,4> operator <= ( const Float32 value ) const { #if RIM_USE_SIMD && defined(RIM_SIMD_ALTIVEC) return SIMDScalar<Int32,4>( vec_cmple( v, (SIMDScalar4)(value) ) ); #elif RIM_USE_SIMD && defined(RIM_SIMD_SSE) && RIM_SSE_VERSION_IS_SUPPORTED(1,0) return SIMDScalar<Int32,4>( _mm_cmple_ps( v, _mm_set1_ps( value ) ) ); #else return SIMDScalar<Int32,4>( a <= value, b <= value, c <= value, d <= value ); #endif } /// Perform a component-wise greater-than-or-equal-to comparison between this an another 4D SIMD scalar. /** * Return a 4D scalar of integers indicating the result of the comparison. * If each corresponding pair of components has this scalar's component greater than * or equal to the other scalar's component, the corresponding result component is non-zero. * Otherwise, that result component is equal to zero. */ RIM_FORCE_INLINE SIMDScalar<Int32,4> operator >= ( const SIMDScalar& scalar ) const { #if RIM_USE_SIMD && defined(RIM_SIMD_ALTIVEC) return SIMDScalar<Int32,4>( vec_cmpge( v, scalar.v ) ); #elif RIM_USE_SIMD && defined(RIM_SIMD_SSE) && RIM_SSE_VERSION_IS_SUPPORTED(1,0) return SIMDScalar<Int32,4>( _mm_cmpge_ps( v, scalar.v ) ); #else return SIMDScalar<Int32,4>( a >= scalar.a, b >= scalar.b, c >= scalar.c, d >= scalar.d ); #endif } /// Perform a component-wise greater-than-or-equal-to comparison between this 4D SIMD scalar and an expanded scalar. /** * Return a 4D scalar of integers indicating the result of the comparison. * The float value is expanded to a 4-wide SIMD scalar and compared with this scalar. * If each corresponding pair of components has this scalar's component greater than * or equal to the other scalar's component, the corresponding result component is non-zero. * Otherwise, that result component is equal to zero. */ RIM_FORCE_INLINE SIMDScalar<Int32,4> operator >= ( const Float32 value ) const { #if RIM_USE_SIMD && defined(RIM_SIMD_ALTIVEC) return SIMDScalar<Int32,4>( vec_cmpge( v, (SIMDScalar4)(value) ) ); #elif RIM_USE_SIMD && defined(RIM_SIMD_SSE) && RIM_SSE_VERSION_IS_SUPPORTED(1,0) return SIMDScalar<Int32,4>( _mm_cmpge_ps( v, _mm_set1_ps( value ) ) ); #else return SIMDScalar<Int32,4>( a >= value, b >= value, c >= value, d >= value ); #endif } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Sum Method RIM_FORCE_INLINE Float32 sum() const { #if RIM_USE_SIMD && defined(RIM_SIMD_ALTIVEC) return a + b + c + d; #elif RIM_USE_SIMD && defined(RIM_SIMD_SSE) && RIM_SSE_VERSION_IS_SUPPORTED(3,0) __m128 temp = _mm_hadd_ps( v, v ); return SIMDScalar( _mm_hadd_ps( temp, temp ) ).a; #else return a + b + c + d; #endif } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Negation/Positivation Operators /// Negate a scalar. /** * This method negates every component of this 4D SIMD scalar * and returns the result, leaving this scalar unmodified. * * @return the negation of the original scalar. */ RIM_FORCE_INLINE SIMDScalar operator - () const { #if RIM_USE_SIMD && defined(RIM_SIMD_ALTIVEC) return SIMDScalar( vec_sub( (SIMDScalar4)(Float32(0)), v ) ); #elif RIM_USE_SIMD && defined(RIM_SIMD_SSE) && RIM_SSE_VERSION_IS_SUPPORTED(1,0) return SIMDScalar( _mm_sub_ps( _mm_set1_ps(Float32(0)), v ) ); #else return SIMDScalar( -a, -b, -c, -d ); #endif } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Arithmetic Operators /// Add this scalar to another and return the result. /** * This method adds another scalar to this one, component-wise, * and returns this addition. It does not modify either of the original * scalars. * * @param scalar - The scalar to add to this one. * @return The addition of this scalar and the parameter. */ RIM_FORCE_INLINE SIMDScalar operator + ( const SIMDScalar& scalar ) const { #if RIM_USE_SIMD && defined(RIM_SIMD_ALTIVEC) return SIMDScalar( vec_add( v, scalar.v ) ); #elif RIM_USE_SIMD && defined(RIM_SIMD_SSE) && RIM_SSE_VERSION_IS_SUPPORTED(1,0) return SIMDScalar( _mm_add_ps( v, scalar.v ) ); #else return SIMDScalar( a + scalar.a, b + scalar.b, c + scalar.c, d + scalar.d ); #endif } /// Add a value to every component of this scalar. /** * This method adds the value parameter to every component * of the scalar, and returns a scalar representing this result. * It does not modifiy the original scalar. * * @param value - The value to add to all components of this scalar. * @return The resulting scalar of this addition. */ RIM_FORCE_INLINE SIMDScalar operator + ( const Float32 value ) const { #if RIM_USE_SIMD && defined(RIM_SIMD_ALTIVEC) return SIMDScalar( vec_add( v, (SIMDScalar4)(value) ) ); #elif RIM_USE_SIMD && defined(RIM_SIMD_SSE) && RIM_SSE_VERSION_IS_SUPPORTED(1,0) return SIMDScalar( _mm_add_ps( v, _mm_set1_ps(value) ) ); #else return SIMDScalar( a + value, b + value, c + value, d + value ); #endif } /// Subtract a scalar from this scalar component-wise and return the result. /** * This method subtracts another scalar from this one, component-wise, * and returns this subtraction. It does not modify either of the original * scalars. * * @param scalar - The scalar to subtract from this one. * @return The subtraction of the the parameter from this scalar. */ RIM_FORCE_INLINE SIMDScalar operator - ( const SIMDScalar& scalar ) const { #if RIM_USE_SIMD && defined(RIM_SIMD_ALTIVEC) return SIMDScalar( vec_sub( v, scalar.v ) ); #elif RIM_USE_SIMD && defined(RIM_SIMD_SSE) && RIM_SSE_VERSION_IS_SUPPORTED(1,0) return SIMDScalar( _mm_sub_ps( v, scalar.v ) ); #else return SIMDScalar( a - scalar.a, b - scalar.b, c - scalar.c, d - scalar.d ); #endif } /// Subtract a value from every component of this scalar. /** * This method subtracts the value parameter from every component * of the scalar, and returns a scalar representing this result. * It does not modifiy the original scalar. * * @param value - The value to subtract from all components of this scalar. * @return The resulting scalar of this subtraction. */ RIM_FORCE_INLINE SIMDScalar operator - ( const Float32 value ) const { #if RIM_USE_SIMD && defined(RIM_SIMD_ALTIVEC) return SIMDScalar( vec_sub( v, (SIMDScalar4)(value) ) ); #elif RIM_USE_SIMD && defined(RIM_SIMD_SSE) && RIM_SSE_VERSION_IS_SUPPORTED(1,0) return SIMDScalar( _mm_sub_ps( v, _mm_set1_ps(value) ) ); #else return SIMDScalar( a - value, b - value, c - value, d - value ); #endif } /// Multiply component-wise this scalar and another scalar. /** * This operator multiplies each component of this scalar * by the corresponding component of the other scalar and * returns a scalar representing this result. It does not modify * either original scalar. * * @param scalar - The scalar to multiply this scalar by. * @return The result of the multiplication. */ RIM_FORCE_INLINE SIMDScalar operator * ( const SIMDScalar& scalar ) const { #if RIM_USE_SIMD && defined(RIM_SIMD_ALTIVEC) return SIMDScalar( vec_madd( v, scalar.v, (SIMDScalar4)(float(0)) ) ); #elif RIM_USE_SIMD && defined(RIM_SIMD_SSE) && RIM_SSE_VERSION_IS_SUPPORTED(1,0) return SIMDScalar( _mm_mul_ps( v, scalar.v ) ); #else return SIMDScalar( a*scalar.a, b*scalar.b, c*scalar.c, d*scalar.d ); #endif } /// Multiply every component of this scalar by a value and return the result. /** * This method multiplies the value parameter with every component * of the scalar, and returns a scalar representing this result. * It does not modifiy the original scalar. * * @param value - The value to multiplly with all components of this scalar. * @return The resulting scalar of this multiplication. */ RIM_FORCE_INLINE SIMDScalar operator * ( const Float32 value ) const { #if RIM_USE_SIMD && defined(RIM_SIMD_ALTIVEC) return SIMDScalar( vec_madd( v, (SIMDScalar4)(value), (SIMDScalar4)(Float32(0)) ) ); #elif RIM_USE_SIMD && defined(RIM_SIMD_SSE) && RIM_SSE_VERSION_IS_SUPPORTED(1,0) return SIMDScalar( _mm_mul_ps( v, _mm_set1_ps(value) ) ); #else return SIMDScalar( a*value, b*value, c*value, d*value ); #endif } /// Divide this scalar by another scalar component-wise. /** * This operator divides each component of this scalar * by the corresponding component of the other scalar and * returns a scalar representing this result. It does not modify * either original scalar. * * @param scalar - The scalar to multiply this scalar by. * @return The result of the division. */ RIM_FORCE_INLINE SIMDScalar operator / ( const SIMDScalar& scalar ) const { #if GRIM_USE_SIMD && defined(RIM_SIMD_ALTIVEC) //Get the reciprocal estimate SIMDScalar4 reciprocalEstimate = vec_re( scalar.v ); //One round of Newton-Raphson refinement SIMDScalar4 reciprocal = vec_madd( vec_nmsub( reciprocalEstimate, v, (SIMDScalar4)(1) ), reciprocalEstimate, reciprocalEstimate ); return SIMDScalar( vec_madd( v, reciprocal, ((SIMDScalar4)(0)) ) ); #elif RIM_USE_SIMD && defined(RIM_SIMD_SSE) && RIM_SSE_VERSION_IS_SUPPORTED(1,0) return SIMDScalar( _mm_div_ps( v, scalar.v ) ); #else return SIMDScalar( a/scalar.a, b/scalar.b, c/scalar.c, d/scalar.d ); #endif } /// Divide every component of this scalar by a value and return the result. /** * This method Divides every component of the scalar by the value parameter, * and returns a scalar representing this result. * It does not modifiy the original scalar. * * @param value - The value to divide all components of this scalar by. * @return The resulting scalar of this division. */ RIM_FORCE_INLINE SIMDScalar operator / ( const Float32 value ) const { #if RIM_USE_SIMD && defined(RIM_SIMD_ALTIVEC) return SIMDScalar( vec_madd( v, ((SIMDScalar4)(Float32(1) / value)), ((SIMDScalar4)(0)) ) ); #elif RIM_USE_SIMD && defined(RIM_SIMD_SSE) && RIM_SSE_VERSION_IS_SUPPORTED(1,0) return SIMDScalar( _mm_mul_ps( v, _mm_set1_ps(Float32(1) / value) ) ); #else Float32 inverse = Float32(1) / value; return SIMDScalar( a*inverse, b*inverse, c*inverse, d*inverse ); #endif } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Arithmetic Assignment Operators /// Add a scalar to this scalar, modifying this original scalar. /** * This method adds another scalar to this scalar, component-wise, * and sets this scalar to have the result of this addition. * * @param scalar - The scalar to add to this scalar. * @return A reference to this modified scalar. */ RIM_FORCE_INLINE SIMDScalar& operator += ( const SIMDScalar& scalar ) { #if RIM_USE_SIMD && defined(RIM_SIMD_ALTIVEC) v = vec_add( v, scalar.v ); #elif RIM_USE_SIMD && defined(RIM_SIMD_SSE) && RIM_SSE_VERSION_IS_SUPPORTED(1,0) v = _mm_add_ps( v, scalar.v ); #else a += scalar.a; b += scalar.b; c += scalar.c; d += scalar.d; #endif return *this; } /// Subtract a scalar from this scalar, modifying this original scalar. /** * This method subtracts another scalar from this scalar, component-wise, * and sets this scalar to have the result of this subtraction. * * @param scalar - The scalar to subtract from this scalar. * @return A reference to this modified scalar. */ RIM_FORCE_INLINE SIMDScalar& operator -= ( const SIMDScalar& scalar ) { #if RIM_USE_SIMD && defined(RIM_SIMD_ALTIVEC) v = vec_sub( v, scalar.v ); #elif RIM_USE_SIMD && defined(RIM_SIMD_SSE) && RIM_SSE_VERSION_IS_SUPPORTED(1,0) v = _mm_sub_ps( v, scalar.v ); #else a -= scalar.a; b -= scalar.b; c -= scalar.c; d -= scalar.d; #endif return *this; } /// Multiply component-wise this scalar and another scalar and modify this scalar. /** * This operator multiplies each component of this scalar * by the corresponding component of the other scalar and * modifies this scalar to contain the result. * * @param scalar - The scalar to multiply this scalar by. * @return A reference to this modified scalar. */ RIM_FORCE_INLINE SIMDScalar& operator *= ( const SIMDScalar& scalar ) { #if RIM_USE_SIMD && defined(RIM_SIMD_ALTIVEC) v = vec_madd( v, scalar.v, (SIMDScalar4)(Float32(0)) ); #elif RIM_USE_SIMD && defined(RIM_SIMD_SSE) && RIM_SSE_VERSION_IS_SUPPORTED(1,0) v = _mm_mul_ps( v, scalar.v ); #else a *= scalar.a; b *= scalar.b; c *= scalar.c; d *= scalar.d; #endif return *this; } /// Divide this scalar by another scalar component-wise and modify this scalar. /** * This operator divides each component of this scalar * by the corresponding component of the other scalar and * modifies this scalar to contain the result. * * @param scalar - The scalar to divide this scalar by. * @return A reference to this modified scalar. */ RIM_FORCE_INLINE SIMDScalar& operator /= ( const SIMDScalar& scalar ) { #if RIM_USE_SIMD && defined(RIM_SIMD_ALTIVEC) a /= scalar.a; b /= scalar.b; c /= scalar.c; d /= scalar.d; #elif RIM_USE_SIMD && defined(RIM_SIMD_SSE) && RIM_SSE_VERSION_IS_SUPPORTED(1,0) v = _mm_div_ps( v, scalar.v ); #else a /= scalar.a; b /= scalar.b; c /= scalar.c; d /= scalar.d; #endif return *this; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Required Alignment Accessor Methods /// Return the alignment required for objects of this type. /** * For most SIMD types this value will be 16 bytes. If there is * no alignment required, 0 is returned. */ RIM_FORCE_INLINE static Size getRequiredAlignment() { #if RIM_USE_SIMD && (defined(RIM_SIMD_ALTIVEC) || defined(RIM_SIMD_SSE) && RIM_SSE_VERSION_IS_SUPPORTED(1,0)) return 16; #else return 0; #endif } /// Get the width of this scalar (number of components it has). RIM_FORCE_INLINE static Size getWidth() { return 4; } /// Return whether or not this SIMD type is supported by the current CPU. RIM_FORCE_INLINE static Bool isSupported() { SIMDFlags flags = SIMDFlags::get(); return (flags & SIMDFlags::SSE) != 0 || (flags & SIMDFlags::ALTIVEC) != 0; } private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Members RIM_ALIGN(16) union { #if RIM_USE_SIMD && (defined(RIM_SIMD_ALTIVEC) || defined(RIM_SIMD_SSE) && RIM_SSE_VERSION_IS_SUPPORTED(1,0)) /// The 4D SIMD vector used internally. SIMDScalar4 v; #endif struct { /// The A component of a 4D SIMD scalar. Float32 a; /// The B component of a 4D SIMD scalar. Float32 b; /// The C component of a 4D SIMD scalar. Float32 c; /// The D component of a 4D SIMD scalar. Float32 d; }; /// The components of a 4D SIMD scalar in array format. Float32 x[4]; }; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Friend Declarations template < typename T, Size width > friend class SIMDVector3D; friend RIM_FORCE_INLINE SIMDScalar abs( const SIMDScalar& scalar ); friend RIM_FORCE_INLINE SIMDScalar ceiling( const SIMDScalar& scalar ); friend RIM_FORCE_INLINE SIMDScalar floor( const SIMDScalar& scalar ); friend RIM_FORCE_INLINE SIMDScalar sqrt( const SIMDScalar& scalar ); friend RIM_FORCE_INLINE SIMDScalar min( const SIMDScalar& scalar1, const SIMDScalar& scalar2 ); friend RIM_FORCE_INLINE SIMDScalar max( const SIMDScalar& scalar1, const SIMDScalar& scalar2 ); template < UInt i1, UInt i2, UInt i3, UInt i4 > friend RIM_FORCE_INLINE SIMDScalar<Float32,4> shuffle( const SIMDScalar<Float32,4>& scalar1 ); template < UInt i1, UInt i2, UInt i3, UInt i4 > friend RIM_FORCE_INLINE SIMDScalar<Float32,4> shuffle( const SIMDScalar<Float32,4>& scalar1, const SIMDScalar<Float32,4>& scalar2 ); friend RIM_FORCE_INLINE SIMDScalar<Float32,4> select( const SIMDScalar<Int32,4>& selector, const SIMDScalar<Float32,4>& scalar1, const SIMDScalar<Float32,4>& scalar2 ); friend RIM_FORCE_INLINE SIMDScalar lows( const SIMDScalar& scalar ); friend RIM_FORCE_INLINE SIMDScalar highs( const SIMDScalar& scalar ); friend RIM_FORCE_INLINE SIMDScalar subAdd( const SIMDScalar& scalar1, const SIMDScalar& scalar2 ); }; //########################################################################################## //########################################################################################## //############ //############ Associative SIMD Scalar Operators //############ //########################################################################################## //########################################################################################## /// Add a scalar value to each component of this scalar and return the resulting scalar. RIM_FORCE_INLINE SIMDScalar<Float32,4> operator + ( const Float32 value, const SIMDScalar<Float32,4>& scalar ) { return SIMDScalar<Float32,4>(value) + scalar; } /// Subtract a scalar value from each component of this scalar and return the resulting scalar. RIM_FORCE_INLINE SIMDScalar<Float32,4> operator - ( const Float32 value, const SIMDScalar<Float32,4>& scalar ) { return SIMDScalar<Float32,4>(value) - scalar; } /// Multiply a scalar value by each component of this scalar and return the resulting scalar. RIM_FORCE_INLINE SIMDScalar<Float32,4> operator * ( const Float32 value, const SIMDScalar<Float32,4>& scalar ) { return SIMDScalar<Float32,4>(value) * scalar; } /// Divide each component of this scalar by a scalar value and return the resulting scalar. RIM_FORCE_INLINE SIMDScalar<Float32,4> operator / ( const Float32 value, const SIMDScalar<Float32,4>& scalar ) { return SIMDScalar<Float32,4>(value) / scalar; } //########################################################################################## //########################################################################################## //############ //############ Free Vector Functions //############ //########################################################################################## //########################################################################################## /// Compute the absolute value of each component of the specified SIMD scalar and return the result. RIM_FORCE_INLINE SIMDScalar<Float32,4> abs( const SIMDScalar<Float32,4>& scalar ) { #if RIM_USE_SIMD && defined(RIM_SIMD_ALTIVEC) return SIMDScalar<Float32,4>( vec_abs( scalar.v ) ); #elif RIM_USE_SIMD && defined(RIM_SIMD_SSE) && RIM_SSE_VERSION_IS_SUPPORTED(1,0) RIM_ALIGN(16) const UInt32 absMask[4] = { 0x7FFFFFFF, 0x7FFFFFFF, 0x7FFFFFFF, 0x7FFFFFFF }; return SIMDScalar<Float32,4>( _mm_and_ps( scalar.v, _mm_load_ps( reinterpret_cast<const Float32*>(absMask) ) ) ); #else return SIMDScalar<Float32,4>( math::abs(scalar.a), math::abs(scalar.b), math::abs(scalar.c), math::abs(scalar.d) ); #endif } /// Compute the ceiling of each component of the specified SIMD scalar and return the result. /** * This method is emulated in software on x86 platforms where SSE 4.1 is not available. */ RIM_FORCE_INLINE SIMDScalar<Float32,4> ceiling( const SIMDScalar<Float32,4>& scalar ) { #if RIM_USE_SIMD && defined(RIM_SIMD_ALTIVEC) return SIMDScalar<Float32,4>( vec_ceil( scalar.v ) ); #elif RIM_USE_SIMD && defined(RIM_SIMD_SSE) && RIM_SSE_VERSION_IS_SUPPORTED(4,1) return SIMDScalar<Float32,4>( _mm_ceil_ps( scalar.v ) ); #else return SIMDScalar<Float32,4>( math::ceiling(scalar.a), math::ceiling(scalar.b), math::ceiling(scalar.c), math::ceiling(scalar.d) ); #endif } /// Compute the floor of each component of the specified SIMD scalar and return the result. /** * This method is emulated in software on x86 platforms where SSE 4.1 is not available. */ RIM_FORCE_INLINE SIMDScalar<Float32,4> floor( const SIMDScalar<Float32,4>& scalar ) { #if RIM_USE_SIMD && defined(RIM_SIMD_ALTIVEC) return SIMDScalar<Float32,4>( vec_floor( scalar.v ) ); #elif RIM_USE_SIMD && defined(RIM_SIMD_SSE) && RIM_SSE_VERSION_IS_SUPPORTED(4,1) return SIMDScalar<Float32,4>( _mm_floor_ps( scalar.v ) ); #else return SIMDScalar<Float32,4>( math::floor(scalar.a), math::floor(scalar.b), math::floor(scalar.c), math::floor(scalar.d) ); #endif } /// Compute the square root of each component of the specified SIMD scalar and return the result. RIM_FORCE_INLINE SIMDScalar<Float32,4> sqrt( const SIMDScalar<Float32,4>& scalar ) { #if RIM_USE_SIMD && defined(RIM_SIMD_ALTIVEC) // Get the square root reciprocal estimate RIM_ALTIVEC_VECTOR float zero = (RIM_ALTIVEC_VECTOR float)(0); RIM_ALTIVEC_VECTOR float oneHalf = (RIM_ALTIVEC_VECTOR float)(0.5); RIM_ALTIVEC_VECTOR float one = (RIM_ALTIVEC_VECTOR float)(1.0); RIM_ALTIVEC_VECTOR float estimate = vec_rsqrte( scalar.v ); // One round of Newton-Raphson refinement RIM_ALTIVEC_VECTOR float estimateSquared = vec_madd( estimate, estimate, zero ); RIM_ALTIVEC_VECTOR float halfEstimate = vec_madd( estimate, oneHalf, zero ); RIM_ALTIVEC_VECTOR float reciprocalSquareRoot = vec_madd( vec_nmsub( scalar.v, estimateSquared, one ), halfEstimate, estimate ); return SIMDScalar<Float32,4>( vec_madd( scalar.v, reciprocalSquareRoot, (RIM_ALTIVEC_VECTOR float)(0) ) ); #elif RIM_USE_SIMD && defined(RIM_SIMD_SSE) && RIM_SSE_VERSION_IS_SUPPORTED(1,0) return SIMDScalar<Float32,4>( _mm_sqrt_ps( scalar.v ) ); #else return SIMDScalar<Float32,4>( math::sqrt(scalar.a), math::sqrt(scalar.b), math::sqrt(scalar.c), math::sqrt(scalar.d) ); #endif } /// Compute the minimum of each component of the specified SIMD scalars and return the result. RIM_FORCE_INLINE SIMDScalar<Float32,4> min( const SIMDScalar<Float32,4>& scalar1, const SIMDScalar<Float32,4>& scalar2 ) { #if RIM_USE_SIMD && defined(RIM_SIMD_ALTIVEC) return SIMDScalar<Float32,4>( vec_min( scalar1.v, scalar2.v ) ); #elif RIM_USE_SIMD && defined(RIM_SIMD_SSE) && RIM_SSE_VERSION_IS_SUPPORTED(1,0) return SIMDScalar<Float32,4>( _mm_min_ps( scalar1.v, scalar2.v ) ); #else return SIMDScalar<Float32,4>( math::min(scalar1.a, scalar2.a), math::min(scalar1.b, scalar2.b), math::min(scalar1.c, scalar2.c), math::min(scalar1.d, scalar2.d) ); #endif } /// Compute the maximum of each component of the specified SIMD scalars and return the result. RIM_FORCE_INLINE SIMDScalar<Float32,4> max( const SIMDScalar<Float32,4>& scalar1, const SIMDScalar<Float32,4>& scalar2 ) { #if RIM_USE_SIMD && defined(RIM_SIMD_ALTIVEC) return SIMDScalar<Float32,4>( vec_max( scalar1.v, scalar2.v ) ); #elif RIM_USE_SIMD && defined(RIM_SIMD_SSE) && RIM_SSE_VERSION_IS_SUPPORTED(1,0) return SIMDScalar<Float32,4>( _mm_max_ps( scalar1.v, scalar2.v ) ); #else return SIMDScalar<Float32,4>( math::max(scalar1.a, scalar2.a), math::max(scalar1.b, scalar2.b), math::max(scalar1.c, scalar2.c), math::max(scalar1.d, scalar2.d) ); #endif } /// Pick 4 elements from the specified SIMD scalar and return the result. template < UInt i1, UInt i2, UInt i3, UInt i4 > RIM_FORCE_INLINE SIMDScalar<Float32,4> shuffle( const SIMDScalar<Float32,4>& scalar ) { #if RIM_USE_SIMD && defined(RIM_SIMD_ALTIVEC) return SIMDScalar<Float32,4>( scalar[i1], scalar[i2], scalar[i3], scalar[i4] ); #elif RIM_USE_SIMD && defined(RIM_SIMD_SSE) && RIM_SSE_VERSION_IS_SUPPORTED(1,0) return SIMDScalar<Float32,4>( _mm_shuffle_ps( scalar.v, scalar.v, _MM_SHUFFLE(i4, i3, i2, i1) ) ); #else return SIMDScalar<Float32,4>( scalar[i1], scalar[i2], scalar[i3], scalar[i4] ); #endif } /// Pick two elements from each SIMD scalar and return the result. template < UInt i1, UInt i2, UInt i3, UInt i4 > RIM_FORCE_INLINE SIMDScalar<Float32,4> shuffle( const SIMDScalar<Float32,4>& scalar1, const SIMDScalar<Float32,4>& scalar2 ) { #if RIM_USE_SIMD && defined(RIM_SIMD_ALTIVEC) return SIMDScalar<Float32,4>( scalar1[i1], scalar1[i2], scalar2[i3], scalar2[i4] ); #elif RIM_USE_SIMD && defined(RIM_SIMD_SSE) && RIM_SSE_VERSION_IS_SUPPORTED(1,0) return SIMDScalar<Float32,4>( _mm_shuffle_ps( scalar1.v, scalar2.v, _MM_SHUFFLE(i4, i3, i2, i1) ) ); #else return SIMDScalar<Float32,4>( scalar1[i1], scalar1[i2], scalar2[i3], scalar2[i4] ); #endif } /// Select elements from the first SIMD scalar if the selector is TRUE, otherwise from the second. RIM_FORCE_INLINE SIMDScalar<Float32,4> select( const SIMDScalar<Int32,4>& selector, const SIMDScalar<Float32,4>& scalar1, const SIMDScalar<Float32,4>& scalar2 ) { #if RIM_USE_SIMD && defined(RIM_SIMD_ALTIVEC) return SIMDScalar<Float32,4>( vec_sel( scalar2.v, scalar1.v, selector.v ) ); #elif RIM_USE_SIMD && defined(RIM_SIMD_SSE) && RIM_SSE_VERSION_IS_SUPPORTED(1,0) // (((b^a) & selector) ^ a) return SIMDScalar<Float32,4>( _mm_xor_ps( scalar2.v, _mm_and_ps( selector.vFloat, _mm_xor_ps( scalar1.v, scalar2.v ) ) ) ); #else return SIMDScalar<Float32,4>( selector.a ? scalar1.a : scalar2.a, selector.b ? scalar1.b : scalar2.b, selector.c ? scalar1.c : scalar2.c, selector.d ? scalar1.d : scalar2.d ); #endif } /// Copy the first and third element of the specified SIMD scalar into the second and fourth places. RIM_FORCE_INLINE SIMDScalar<Float32,4> lows( const SIMDScalar<Float32,4>& scalar ) { #if RIM_USE_SIMD && defined(RIM_SIMD_ALTIVEC) return SIMDScalar<Float32,4>( scalar.a, scalar.a, scalar.c, scalar.c ); #elif RIM_USE_SIMD && defined(RIM_SIMD_SSE) && RIM_SSE_VERSION_IS_SUPPORTED(3,0) return SIMDScalar<Float32,4>( _mm_moveldup_ps( scalar.v ) ); #else return SIMDScalar<Float32,4>( scalar.a, scalar.a, scalar.c, scalar.c ); #endif } /// Copy the second and fourth element of the specified SIMD scalar into the first and third places. RIM_FORCE_INLINE SIMDScalar<Float32,4> highs( const SIMDScalar<Float32,4>& scalar ) { #if RIM_USE_SIMD && defined(RIM_SIMD_ALTIVEC) return SIMDScalar<Float32,4>( scalar.b, scalar.b, scalar.d, scalar.d ); #elif RIM_USE_SIMD && defined(RIM_SIMD_SSE) && RIM_SSE_VERSION_IS_SUPPORTED(3,0) return SIMDScalar<Float32,4>( _mm_movehdup_ps( scalar.v ) ); #else return SIMDScalar<Float32,4>( scalar.b, scalar.b, scalar.d, scalar.d ); #endif } /// Subtract the first and third elements and add the second and fourth. RIM_FORCE_INLINE SIMDScalar<Float32,4> subAdd( const SIMDScalar<Float32,4>& scalar1, const SIMDScalar<Float32,4>& scalar2 ) { #if RIM_USE_SIMD && defined(RIM_SIMD_ALTIVEC) return SIMDScalar<Float32,4>( scalar1.a - scalar2.a, scalar1.b + scalar2.b, scalar1.c - scalar2.c, scalar1.d + scalar2.d ); #elif RIM_USE_SIMD && defined(RIM_SIMD_SSE) && RIM_SSE_VERSION_IS_SUPPORTED(3,0) return SIMDScalar<Float32,4>( _mm_addsub_ps( scalar1.v, scalar2.v ) ); #else return SIMDScalar<Float32,4>( scalar1.a - scalar2.a, scalar1.b + scalar2.b, scalar1.c - scalar2.c, scalar1.d + scalar2.d ); #endif } //########################################################################################## //########################################################################################## //############ //############ Typedefs //############ //########################################################################################## //########################################################################################## //########################################################################################## //***************************** End Rim Math Namespace *********************************** RIM_MATH_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_SIMD_SCALAR_FLOAT_4_H <file_sep>/* * rimGraphicsContextCapabilities.h * Rim Software * * Created by <NAME> on 3/8/14. * Copyright 2014 __MyCompanyName__. All rights reserved. * */ #ifndef INCLUDE_RIM_GRAPHICS_CONTEXT_CAPABILITIES_H #define INCLUDE_RIM_GRAPHICS_CONTEXT_CAPABILITIES_H #include "rimGraphicsDevicesConfig.h" //########################################################################################## //*********************** Start Rim Graphics Devices Namespace *************************** RIM_GRAPHICS_DEVICES_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class which encapsulates the different capabilities that a graphics context can have. /** * These capabilities provide boolean information about a certain graphics context. Capabilities * are indicated by setting a single bit of a 64-bit unsigned integer to 1. * * Enum values for the different capabilities are defined as members of the class. Typically, * the user would bitwise-OR the capability enum values together to produce a final set * of set capabilities. */ class GraphicsContextCapabilities { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Graphics Context Capabilities Enum Declaration /// An enum which specifies the different graphics context capabilities. typedef enum Capability { //******************************************************************************** // Texturing Capabilities /// A capability flag indicating that anisotropic texture filtering is supported. ANISOTROPIC_FILTERING = (UInt64(1) << 0), /// A capability flag indicating that non power-of-two sized textures are supported. NON_POWER_OF_2_TEXTURES = (UInt64(1) << 1), /// A capability flag indicating that floating-point textures are supported. FLOAT_TEXTURES = (UInt64(1) << 2), /// A capability flag indicating that texture arrays are supported. TEXTURE_ARRAYS = (UInt64(1) << 3), /// A capability flag indicating that texture rectangles are supported. TEXTURE_RECTANGLES = (UInt64(1) << 4), /// A capability flag indicating that render-to-texture is supported (e.g. framebuffers). RENDER_TO_TEXTURE = (UInt64(1) << 5), /// A capability flag indicating that multiple render targets are supported. MULTIPLE_RENDER_TARGETS = (UInt64(1) << 6), //******************************************************************************** // Buffer Capabilities /// A capability flag indicating that hardware vertex buffer arrays are supported. VERTEX_BUFFER_ARRAYS = (UInt64(1) << 7), /// A capability flag indicating that hardware constant buffers are supported. CONSTANT_BUFFERS = (UInt64(1) << 8), //******************************************************************************** // Shader Capabilities /// A capability flag indicating that vertex shaders are supported. VERTEX_SHADERS = (UInt64(1) << 9), /// A capability flag indicating that fragment shaders are supported. FRAGMENT_SHADERS = (UInt64(1) << 10), /// A capability flag indicating that geometry shaders are supported. GEOMETRY_SHADERS = (UInt64(1) << 11), /// A capability flag indicating that tesselation shaders are supported. TESSELATION_SHADERS = (UInt64(1) << 12), /// A capability flag indicating that compiled program binaries are supported. PROGRAM_BINARIES = (UInt64(1) << 13), //******************************************************************************** // Rendering Capabilities /// A capability flag indicating that vertex transform feedback is supported. TRANSFORM_FEEDBACK = (UInt64(1) << 14), /// A capability flag indicating that instanced rendering is supported. INSTANCED_RENDERING = (UInt64(1) << 15), /// The capability value when all capabilities are not set. UNDEFINED = 0 }; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructors /// Create a new graphics context capabilities object with no capabilities set. RIM_INLINE GraphicsContextCapabilities() : capabilities( UNDEFINED ) { } /// Create a new graphics context capabilities object with the specified capability value initially set. RIM_INLINE GraphicsContextCapabilities( Capability capability ) : capabilities( capability ) { } /// Create a new graphics context capabilities object with the specified initial combined capabilities value. RIM_INLINE GraphicsContextCapabilities( UInt64 newCapabilities ) : capabilities( newCapabilities ) { } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Integer Cast Operator /// Convert this graphics context capabilities object to an integer value. /** * This operator is provided so that the GraphicsContextCapabilities object * can be used as an integer value for bitwise logical operations. */ RIM_INLINE operator UInt64 () const { return capabilities; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Flag Status Accessor Methods /// Return whether or not the specified capability is set for this capabilities object. RIM_INLINE Bool isSet( Capability capability ) const { return (capabilities & capability) != UNDEFINED; } /// Set whether or not the specified capability is set for this capabilities object. RIM_INLINE void set( Capability capability, Bool newIsSet ) { if ( newIsSet ) capabilities |= capability; else capabilities &= ~capability; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Flag OR Methods /// Set the specified capability to TRUE in this capabilities object. RIM_INLINE GraphicsContextCapabilities& operator |= ( Capability capability ) { capabilities |= capability; return *this; } /// Set all of the specified capabilities to TRUE in this capabilities object. RIM_INLINE GraphicsContextCapabilities& operator |= ( const GraphicsContextCapabilities& newCapabilities ) { capabilities |= newCapabilities; return *this; } private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Members /// A value indicating the capabilities that are available for a graphics context. UInt64 capabilities; }; //########################################################################################## //*********************** End Rim Graphics Devices Namespace ***************************** RIM_GRAPHICS_DEVICES_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_GRAPHICS_CONTEXT_CAPABILITIES_H <file_sep>/* * rimGUIInputKeyboard.h * Rim GUI * * Created by <NAME> on 2/1/08. * Copyright 2008 __MyCompanyName__. All rights reserved. * */ #ifndef INCLUDE_RIM_GUI_INPUT_KEYBOARD_H #define INCLUDE_RIM_GUI_INPUT_KEYBOARD_H #include "rimGUIInputConfig.h" #include "rimGUIInputKey.h" #include "rimGUIInputKeyboardEvent.h" //########################################################################################## //************************ Start Rim GUI Input Namespace *************************** RIM_GUI_INPUT_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// This class represnts a keyboard input device. /** * It keeps track of the current state of all of it's keys * (pressed or released). The keyboard object can be manipulated * programmatically or by registering its move() and * changeButtonState() callback methods with an input controller which * dispatches real world events to connected callback methods. * The mouse is created with the predefined mouse buttons as defined * in the MouseButton class but can also be used with user-defined mouse buttons, * extending its flexibility. */ class Keyboard { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructor /// Create a new keyboard, with all buttons in the unpressed state. RIM_INLINE Keyboard() { } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Button Accessors /// Get whether or not the key parameter is pressed on the keyboard. RIM_INLINE Bool keyIsPressed( const Key& key ) const { const Bool* isPressed; if ( keyState.find( key.getHashCode(), key, isPressed ) ) return *isPressed; else return false; } /* /// Get whether or not the key parameter is pressed on the keyboard. RIM_INLINE static Bool keyIsPressed( const Key& key ) { return false; } */ //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Keyboard Event Callback Methods /// Callback method called when a key's state is changed. RIM_INLINE void changeKeyState( const KeyboardEvent& keyPressEvent ) { const Key& key = keyPressEvent.getKey(); keyState.set( key.getHashCode(), key, keyPressEvent.isAPress() ); } private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Members /// A hash map which maps from a key to a bool for the key's state. HashMap<Key,Bool> keyState; }; //########################################################################################## //************************ End Rim GUI Input Namespace ***************************** RIM_GUI_INPUT_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_GUI_INPUT_KEYBOARD_H <file_sep>/* * rimSoundParametricFilter.h * Rim Sound * * Created by <NAME> on 11/28/12. * Copyright 2012 __MyCompanyName__. All rights reserved. * */ #ifndef INCLUDE_RIM_SOUND_PARAMETRIC_FILTER_H #define INCLUDE_RIM_SOUND_PARAMETRIC_FILTER_H #include "rimSoundFiltersConfig.h" #include "rimSoundFilter.h" //########################################################################################## //************************ Start Rim Sound Filters Namespace ***************************** RIM_SOUND_FILTERS_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class that implements a parametric peaking/notching EQ filter. class ParametricFilter : public SoundFilter { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructors /// Create a default parametric filter at 1000Hz with 0dB gain. ParametricFilter(); /// Create a parametric filter with the specified center frequency, q factor, and linear gain. /** * The center frequency and gain are clamped to the range of [0,+infinity]. */ ParametricFilter( Float newCenterFrequency, Float newQ, Gain newGain ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Corner Frequency Accessor Methods /// Return the center frequency of this parametric filter. /** * This is the frequency most affected by the filter. */ RIM_INLINE Float getFrequency() const { return centerFrequency; } /// Set the center frequency of this parametric filter. /** * This is the frequency most affected by the filter. * The new corner frequency is clamped to be in the range [0,+infinity]. */ RIM_INLINE void setFrequency( Float newCenterFrequency ) { lockMutex(); centerFrequency = math::max( newCenterFrequency, Float(0) ); recalculateCoefficients(); unlockMutex(); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Filter Bandwith Accessor Methods /// Return the Q factor of this parametric filter. /** * This value controls the width of the boost or cut that the filter produces. * A smaller Q indicates a wider filter, while a larger Q indicates a narrower filter. */ RIM_INLINE Float getQ() const { return q; } /// Set the Q factor of this parametric filter. /** * This value controls the width of the boost or cut that the filter produces. * A smaller Q indicates a wider filter, while a larger Q indicates a narrower filter. * * The new Q value is clamped to the range [0, +infinity]. */ RIM_INLINE void setQ( Float newQ ) { lockMutex(); q = math::max( newQ, Float(0) ); recalculateCoefficients(); unlockMutex(); } /// Return the octave bandwidth of this parametric filter. /** * This value controls the width of the boost or cut that the filter produces. * A larger bandwidth indicates a wider filter, while a smaller bandwidth * indicates a narrower filter. */ RIM_INLINE Float getBandwidth() const { return math::log2( (2*q*q + 1)/(2*q*q) + math::sqrt( math::square(((2*q*q + 1)/(q*q)))/4 - 1) ); } /// Set the octave bandwidth of this parametric filter. /** * This value controls the width of the boost or cut that the filter produces. * A larger bandwidth indicates a wider filter, while a smaller bandwidth * indicates a narrower filter. */ RIM_INLINE void setBandwidth( Float newBandwidth ) { lockMutex(); Float twoToTheB = math::pow( Float(2), math::max( newBandwidth, Float(0) ) ); q = math::sqrt(twoToTheB) / (twoToTheB - 1); recalculateCoefficients(); unlockMutex(); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Filter Gain Accessor Methods /// Return the linear gain of this parametric filter. RIM_INLINE Gain getGain() const { return gain; } /// Return the gain in decibels of this parametric filter. RIM_INLINE Gain getGainDB() const { return util::linearToDB( gain ); } /// Set the linear gain of this parametric filter. RIM_INLINE void setGain( Gain newGain ) { lockMutex(); gain = math::max( newGain, Float(0) ); recalculateCoefficients(); unlockMutex(); } /// Set the gain in decibels of this parametric filter. RIM_INLINE void setGainDB( Gain newGain ) { lockMutex(); gain = util::dbToLinear( newGain ); recalculateCoefficients(); unlockMutex(); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Filter Attribute Accessor Methods /// Return a human-readable name for this parametric filter. /** * The method returns the string "Parametric Filter". */ virtual UTF8String getName() const; /// Return the manufacturer name of this parametric filter. /** * The method returns the string "Headspace Sound". */ virtual UTF8String getManufacturer() const; /// Return an object representing the version of this parametric filter. virtual SoundFilterVersion getVersion() const; /// Return an object which describes the category of effect that this filter implements. /** * This method returns the value SoundFilterCategory::EQUALIZER. */ virtual SoundFilterCategory getCategory() const; /// Return whether or not this parametric filter can process audio data in-place. /** * This method always returns TRUE, parametric filters can process audio data in-place. */ virtual Bool allowsInPlaceProcessing() const; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Filter Parameter Accessor Methods /// Return the total number of generic accessible parameters this filter has. virtual Size getParameterCount() const; /// Get information about the parameter at the specified index. virtual Bool getParameterInfo( Index parameterIndex, FilterParameterInfo& info ) const; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Public Static Property Objects /// A string indicating the human-readable name of this parametric filter. static const UTF8String NAME; /// A string indicating the manufacturer name of this parametric filter. static const UTF8String MANUFACTURER; /// An object indicating the version of this parametric filter. static const SoundFilterVersion VERSION; private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Filter Channel Class Declaration /// A class which contains a history of the last 2 input and output samples for a 2nd order filter. class ChannelHistory { public: RIM_INLINE ChannelHistory() : inputHistory( Sample32f(0) ), outputHistory( Sample32f(0) ) { } /// An array of the last 2 input samples for a filter with order 2. StaticArray<Sample32f,2> inputHistory; /// An array of the last 2 output samples for a filter with order 2. StaticArray<Sample32f,2> outputHistory; }; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Filter Parameter Value Accessor Methods /// Place the value of the parameter at the specified index in the output parameter. virtual Bool getParameterValue( Index parameterIndex, FilterParameter& value ) const; /// Attempt to set the parameter value at the specified index. virtual Bool setParameterValue( Index parameterIndex, const FilterParameter& value ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Stream Reset Method /// A method which is called whenever the filter's stream of audio is being reset. /** * This method allows the filter to reset all parameter interpolation * and processing to its initial state to avoid coloration from previous * audio or parameter values. */ virtual void resetStream(); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Filter Processing Methods /// Apply this parametric filter to the samples in the input frame and place them in the output frame. virtual SoundFilterResult processFrame( const SoundFilterFrame& inputFrame, SoundFilterFrame& outputFrame, Size numSamples ); /// Apply a second order filter to the specified sample arrays. RIM_FORCE_INLINE static void process2ndOrderFilter( const Sample32f* input, Sample32f* output, Size numSamples, const Float* a, const Float* b, Sample32f* inputHistory, Sample32f* outputHistory ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Filter Coefficient Calculation Methods /// Recalculate the filter coefficients for the current filter frequency, gain, Q, and sample rate. void recalculateCoefficients(); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Members /// The frequency in hertz of the center frequency of the parametric filter. /** * This is the frequency most affected by the filter. */ Float centerFrequency; /// The linear gain of the parametric filter. Gain gain; /// The 'q' factor for the parametric filter. /** * This value controls the width of the boost or cut that the filter produces. * A smaller Q indicates a wider filter, while a larger Q indicates a narrower filter. */ Float q; /// The sample rate of the last sample buffer processed. /** * This value is used to detect when the sample rate of the audio stream has changed, * and thus recalculate filter coefficients. */ SampleRate sampleRate; /// The 'a' (numerator) coefficients of the z-domain transfer function. StaticArray<Float,3> a; /// The 'b' (denominator) coefficients of the z-domain transfer function. StaticArray<Float,2> b; /// An array of input and output history information for each channel of this filter. Array<ChannelHistory> channelHistory; }; //########################################################################################## //************************ End Rim Sound Filters Namespace ******************************* RIM_SOUND_FILTERS_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_SOUND_PARAMETRIC_FILTER_H <file_sep>/* * rimVector4D.h * Rim Math * * Created by <NAME> on 1/22/08. * Copyright 2008 Rim Software. All rights reserved. * */ #ifndef INCLUDE_RIM_VECTOR_4D_H #define INCLUDE_RIM_VECTOR_4D_H #include "rimMathConfig.h" #include "../data/rimBasicString.h" #include "../data/rimBasicStringBuffer.h" #include "rimVector2D.h" #include "rimVector3D.h" //########################################################################################## //***************************** Start Rim Math Namespace ********************************* RIM_MATH_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A templatized math class representing a 4-dimensional vector. template < typename T > class Vector4D { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructors /// Create a new 4D vector with all elements equal to zero. RIM_FORCE_INLINE Vector4D() : x( T(0) ), y( T(0) ), z( T(0) ), w( T(0) ) { } /// Create a new 4D vector with all elements equal to a single value. /** * This constructor creates a uniform 4D vector with all elements * equal to each other and equal to the single constructor parameter * value. * * @param value - The value to set all elements of the vector to. */ RIM_FORCE_INLINE explicit Vector4D( T value ) : x( value ), y( value ), z( value ), w( value ) { } /// Create a new 4D vector from a pointer to a 4 element array. /** * This constructor takes a pointer to an array of 4 values * and sets it's x, y, z, and w coordinates to be the 0th, 1th, * 2th, and 3th indexed values in the array. No error checking is * performed, so make sure to pass in a correct array of values * or expect the worst. * * @param array - An indexed array of 4 values for the vector's coordinates. */ RIM_FORCE_INLINE explicit Vector4D( const T* array ) : x( array[0] ), y( array[1] ), z( array[2] ), w( array[3] ) { } /// Create a new 4D vector by specifying it's x, y, z, and w values. /** * This constructor sets each of the vector's x, y, z, and w coordinate * values to be the 1st, 2nd, 3rd, and 4th parameters of the constructor, * respectively. * * @param newX - The X coordinate of the new vector. * @param newY - The Y coordinate of the new vector. * @param newZ - The Z coordinate of the new vector. * @param newW - The W coordinate of the new vector. */ RIM_FORCE_INLINE Vector4D( T newX, T newY, T newZ, T newW ) : x( newX ), y( newY ), z( newZ ), w( newW ) { } /// Create a new 4D vector from an existing vector (copy it), templatized version. /** * This constructor takes the x, y, z, and w values of the * vector parameter and sets the coordinates of this vector * to be the same. This is a templatized version of the above copy constructor. * * @param vector - The vector to be copied. */ template < typename U > RIM_FORCE_INLINE Vector4D( const Vector4D<U>& vector ) : x( (T)vector.x ), y( (T)vector.y ), z( (T)vector.z ), w( (T)vector.w ) { } /// Create a new 4D vector from a 2D vector and 2 values for the Z and W coordinates. /** * This constructor takes the x and y coordinates of the first parameter, * a 2D vector, and sets the x and y coordinates of this vector to be * the same. It then takes the 2nd and 3rd paramter, scalars, and sets the z and w * coordinates of this vector to be those values. * * @param vector - A 2D vector for the X and Y coordinates of this vector. * @param newZ - The value for the Z coordinate of this vector. * @param newW - The value for the W coordinate of this vector. */ RIM_FORCE_INLINE Vector4D( const Vector2D<T>& vector, T newZ, T newW ) : x( vector.x ), y( vector.y ), z( newZ ), w( newW ) { } /// Create a new 4D vector from a scalar, a 2D vector and another scalar. /** * This constructor takes the first parameter, a scalar, and sets the * X coordinate of this vector to have that value. It then takes the X and Y * coordinates of the second parameter and sets the Y and Z values of this * vector to have those values, respectively. Finally, the 3rd parameter is * used as the W coordinate of this vector. * * @param newX - The value for the X coordinate of this vector. * @param vector - A 2D vector for the Y and Z coordinates of this vector. * @param newW - The value for the W coordinate of this vector. */ RIM_FORCE_INLINE Vector4D( T newX, const Vector2D<T>& vector, T newW ) : x( newX ), y( vector.x ), z( vector.y ), w( newW ) { } /// Create a new 4D vector from two scalars for the X, Y coordinates and a 2D vector. /** * This constructor sets the X and Y coordinates of this vector to have * the same value as the first two parameters of this constructor, respectively. * It then uses the X and Y values of the 3rd parameter, a vector, as the * Z and W values of this vector. * * @param newX - The value for the X coordinate of this vector. * @param newY - The value for the Y coordinate of this vector. * @param vector - A 2D vector for the Z and W coordinates of this vector. */ RIM_FORCE_INLINE Vector4D( T newX, T newY, const Vector2D<T>& vector ) : x( newX ), y( newY ), z( vector.x ), w( vector.y ) { } /// Create a new 4D vector from a 3D vector and a value for the W coordinate. /** * This constructor takes the X, Y, and Z coordinates of the first parameter, * a 2D vector, and sets the X, Y, and Z coordinates of this vector to be * the same. It then takes the 2nd paramter, a value, and sets the W * coordinate of this vector to be that value. * * @param vector - A 3D vector for the X, Y, and Z coordinates of this vector. * @param newZ - The value for the W coordinate of this vector. */ RIM_FORCE_INLINE Vector4D( const Vector3D<T>& vector, T newW ) : x( vector.x ), y( vector.y ), z( vector.z ), w( newW ) { } /// Create a new 4D vector from a value for the X coordinate and a 3D vector. /** * This constructor sets the X coordinate of this vector to be the * same as the value of the first parameter, and then sets the * Y, Z, and W coordinates of this vector to be the X, Y, and Z coordinates of * the 2nd parameter, a 3D vector. * * @param newX - The value for the X coordinate of this vector. * @param vector - A 3D vector for the Y, Z, and W coordinates of this vector. */ RIM_FORCE_INLINE Vector4D( T newX, const Vector3D<T>& vector ) : x( newX ), y( vector.x ), z( vector.y ), w( vector.w ) { } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Magnitude Methods /// Get the magnitude of this vector (the length). /** * This Method finds the magnitude of this vector * using the formula: magnitude = sqrt( x*x + y*y + z*z + w*w ). * It's value is always positive. * * @return the magnitude of the vector. */ RIM_FORCE_INLINE T getMagnitude() const { return math::sqrt( x*x + y*y + z*z + w*w ); } /// Get the square of the magnitude of this vector. /** * This method is provided in addition to the above * getMagnitude() method in order to provide a faster * alternate way of computing a magnitude-like quantity * for the vector. For instance, when computing whether * or not the magnitude of a vector is greater than some value, * one can instead compare the square of the magnitude to the * square of the value (avoiding the square root operation), * with the same result. * * @return the square of the magnitude of this vector. */ RIM_FORCE_INLINE T getMagnitudeSquared() const { return x*x + y*y + z*z + w*w; } /// Return a normalized version of this vector. /** * This method normalizes this vector by dividing * each component by the vector's magnitude and * returning the result. This method does not modify * the original vector. * * @return a normalized version of this vector. */ RIM_FORCE_INLINE Vector4D<T> normalize() const { T inverseMagnitude = T(1)/math::sqrt( x*x + y*y + z*z + w*w ); return Vector4D<T>( x*inverseMagnitude, y*inverseMagnitude, z*inverseMagnitude, w*inverseMagnitude ); } /// Return a normalized version of this vector, placing the vector's magnitude in the output parameter. /** * This method normalizes this vector by dividing * each component by the vector's magnitude and * returning the result. This method does not modify * the original vector. The magnitude of the original vector is * returned in the output parameter. * * @return a normalized version of this vector. */ RIM_FORCE_INLINE Vector4D<T> normalize( T& magnitude ) const { magnitude = math::sqrt( x*x + y*y + z*z + w*w ); T inverseMagnitude = T(1)/magnitude; return Vector4D<T>( x*inverseMagnitude, y*inverseMagnitude, z*inverseMagnitude, w*inverseMagnitude ); } /// Project this vector on another vector and return the projected vector. /** * This method computes the vectoral projection of this vector * onto another, and returns the resulting vector. This result should * be parallel (within the precision of the vectors) to the original * parameter vector. This method does not modify either original vector. * * @param vector - The vector to project this vector on. * @return the vectoral projection onto the parameter vector of this vector. */ RIM_FORCE_INLINE Vector4D<T> projectOn( const Vector4D<T>& vector ) const { Vector4D<T> norm = vector.normalize(); return ( x*norm.x + y*norm.y + z*norm.z + w*norm.w )*norm; } /// Project this vector on a normalized vector and return the projected vector. /** * This method computes the vectoral projection of this vector * onto another, and returns the resulting vector. This result should * be parallel (within the precision of the vectors) to the original * parameter vector. This method does not modify either original vector. * The result of this operation is only correct if the projected-on vector * is of unit length, though it is roughly 3 times faster than doing a standard * projection. * * @param vector - The vector to project this vector on. * @return the vectoral projection onto the parameter vector of this vector. */ RIM_FORCE_INLINE Vector4D<T> projectOnNormalized( const Vector4D<T>& vector ) const { return ( x*vector.x + y*vector.y + z*vector.z + w*vector.w )*vector; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Distance Methods /// Get the distance from this vector to another in 4D space. /** * This method essentially computes the magnitude of * the subtraction of this vector minus the parameter vector. * This treats each vector as a point in 4D space. * * @param vector - the vector to query the distance to. * @return the distance to the parameter vector. */ RIM_FORCE_INLINE T getDistanceTo( const Vector4D<T>& vector ) const { T minusX = vector.x - x; T minusY = vector.y - y; T minusZ = vector.z - z; T minusW = vector.w - w; return math::sqrt( minusX*minusX + minusY*minusY + minusZ*minusZ + minusW*minusW ); } /// Get the square of the distance from this vector to another in 4D space. /** * This method essentially computes the magnitude squared of * the subtraction of this vector minus the parameter vector. * This treats each vector as a point in 4D space. This function * can be used for faster distance comparisions because it avoids * the square root operation of the getDistanceTo() method. * * @param vector - the vector to query the distance to. * @return the distance to the parameter vector. */ RIM_FORCE_INLINE T getDistanceToSquared( const Vector4D<T>& vector ) const { T minusX = vector.x - x; T minusY = vector.y - y; T minusZ = vector.z - z; T minusW = vector.w - w; return minusX*minusX + minusY*minusY + minusZ*minusZ + minusW*minusW; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Element Accessor Methods /// Return a shallow array representation of this vector. /** * This method returns a pointer to the address of the X coordinate * of the vector and does not do any copying of the elements. * Therefore, this method should only be used where one needs * an array representation of a vector without having to * allocate more memory and copy the vector. * * @return A pointer to a shallow array copy of this vector. */ RIM_FORCE_INLINE T* toArray() { return &x; } /// Return a shallow array representation of this vector. /** * This method returns a pointer to the address of the X coordinate * of the vector and does not do any copying of the elements. * Therefore, this method should only be used where one needs * an array representation of a vector without having to * allocate more memory and copy the vector. * * @return A pointer to a shallow array copy of this vector. */ RIM_FORCE_INLINE const T* toArray() const { return &x; } /// Return the X coordinate of this vector. RIM_FORCE_INLINE T getX() const { return x; } /// Return the Y coordinate of this vector. RIM_FORCE_INLINE T getY() const { return y; } /// Return the Z coordinate of this vector. RIM_FORCE_INLINE T getZ() const { return z; } /// Return the W coordinate of this vector. RIM_FORCE_INLINE T getW() const { return w; } /// Return a 2D vector containing the X and Y elements of this 4D vector. RIM_FORCE_INLINE Vector2D<T> getXY() const { return Vector2D<T>( x, y ); } /// Return a 2D vector containing the X and Z elements of this 4D vector. RIM_FORCE_INLINE Vector2D<T> getXZ() const { return Vector2D<T>( x, z ); } /// Return a 2D vector containing the X and W elements of this 4D vector. RIM_FORCE_INLINE Vector2D<T> getXW() const { return Vector2D<T>( x, w ); } /// Return a 2D vector containing the Y and Z elements of this 4D vector. RIM_FORCE_INLINE Vector2D<T> getYZ() const { return Vector2D<T>( y, z ); } /// Return a 2D vector containing the Y and W elements of this 4D vector. RIM_FORCE_INLINE Vector2D<T> getYW() const { return Vector2D<T>( y, w ); } /// Return a 3D vector containing the X, Y and Z elements of this 4D vector. RIM_FORCE_INLINE Vector3D<T> getXYZ() const { return Vector3D<T>( x, y, z ); } /// Return a 3D vector containing the X, Y and W elements of this 4D vector. RIM_FORCE_INLINE Vector3D<T> getXYW() const { return Vector3D<T>( x, y, w ); } /// Return a 3D vector containing the X, Z and W elements of this 4D vector. RIM_FORCE_INLINE Vector3D<T> getXZW() const { return Vector3D<T>( x, z, w ); } /// Return a 3D vector containing the Y, Z and W elements of this 4D vector. RIM_FORCE_INLINE Vector3D<T> getYZW() const { return Vector3D<T>( y, z, w ); } /// Return the minimum component of this vector. RIM_FORCE_INLINE T getMin() const { return math::min( math::min( x, y ), math::min( z, w ) ); } /// Return the maximum component of this vector. RIM_FORCE_INLINE T getMax() const { return math::max( math::max( x, y ), math::max( z, w ) ); } /// Get an indexed coordinate of this vector. /** * This method takes an index with the possible * values 0 through 3 and returns the X, Y, Z, or W * coordinate of this vector, respectively. There is * no error checking performed (for speed), so make * sure that the index is in the valid bounds mentioned * above, or else bad things could happen. * * @param index - An index into the vector with 0 = X, 1 = Y, 2 = Z, 3 = W * @return the value of the vector associated with the given index. */ RIM_FORCE_INLINE T get( Index index ) const { RIM_DEBUG_ASSERT( index < 4 ); return (&x)[index]; } /// Get an indexed coordinate of this vector. /** * This method takes an index with the possible * values 0 through 3 and returns the X, Y, Z, or W * coordinate of this vector, respectively. There is * no error checking performed (for speed), so make * sure that the index is in the valid bounds mentioned * above, or else bad things could happen. * * @param index - An index into the vector with 0 = X, 1 = Y, 2 = Z, 3 = W * @return the value of the vector associated with the given index. */ RIM_FORCE_INLINE T& operator () ( Index index ) { RIM_DEBUG_ASSERT( index < 4 ); return (&x)[index]; } /// Get an indexed coordinate of this vector. /** * This method takes an index with the possible * values 0 through 3 and returns the X, Y, Z, or W * coordinate of this vector, respectively. There is * no error checking performed (for speed), so make * sure that the index is in the valid bounds mentioned * above, or else bad things could happen. * * @param index - An index into the vector with 0 = X, 1 = Y, 2 = Z, 3 = W * @return the value of the vector associated with the given index. */ RIM_FORCE_INLINE const T& operator () ( Index index ) const { RIM_DEBUG_ASSERT( index < 4 ); return (&x)[index]; } /// Get an indexed coordinate of this vector. /** * This method takes an index with the possible * values 0 through 3 and returns the X, Y, Z, or W * coordinate of this vector, respectively. There is * no error checking performed (for speed), so make * sure that the index is in the valid bounds mentioned * above, or else bad things could happen. * * @param index - An index into the vector with 0 = X, 1 = Y, 2 = Z, 3 = W * @return the value of the vector associated with the given index. */ RIM_FORCE_INLINE T& operator [] ( Index index ) { RIM_DEBUG_ASSERT( index < 4 ); return (&x)[index]; } /// Get an indexed coordinate of this vector. /** * This method takes an index with the possible * values 0 through 3 and returns the X, Y, Z, or W * coordinate of this vector, respectively. There is * no error checking performed (for speed), so make * sure that the index is in the valid bounds mentioned * above, or else bad things could happen. * * @param index - An index into the vector with 0 = X, 1 = Y, 2 = Z, 3 = W * @return the value of the vector associated with the given index. */ RIM_FORCE_INLINE const T& operator [] ( Index index ) const { RIM_DEBUG_ASSERT( index < 4 ); return (&x)[index]; } /// Set the X coordinate of the vector to the specified value. RIM_FORCE_INLINE void setX( T newX ) { x = newX; } /// Set the Y coordinate of the vector to the specified value. RIM_FORCE_INLINE void setY( T newY ) { y = newY; } /// Set the Z coordinate of the vector to the specified value. RIM_FORCE_INLINE void setZ( T newZ ) { z = newZ; } /// Set the W coordinate of the vector to the specified value. RIM_FORCE_INLINE void setW( T newW ) { w = newW; } /// Set the X, Y, Z, and W coordinates of the vector to the specified values. /** * This method takes 4 parameter representing the 4 coordinates of this * vector and sets this vector's coordinates to have those values. * * @param newX - The new X coordinate of the vector. * @param newY - The new Y coordinate of the vector. * @param newZ - The new Z coordinate of the vector. * @param newW - The new W coordinate of the vector. */ RIM_FORCE_INLINE void setAll( T newX, T newY, T newZ, T newW ) { x = newX; y = newY; z = newZ; w = newW; } /// Set an indexed coordinate of this vector. /** * This method takes an index with the possible * values 0, 1, 2, or 3, and sets the X, Y, Z, or W * coordinate of this vector to be the new value, respectively. * There is no error checking performed (for speed), so make * sure that the index is in the valid bounds mentioned * above, or else bad things could happen. * * @param index - An index into the vector with 0 = X, 1 = Y, 2 = Z, 3 = W. * @param newValue - The new value of the coordinate with the given index. */ RIM_FORCE_INLINE void set( Index index, T newValue ) { RIM_DEBUG_ASSERT( index < 4 ); (&x)[index] = newValue; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Comparison Operators /// Compare two vectors component-wise for equality RIM_FORCE_INLINE bool operator == ( const Vector4D<T>& v ) const { return x == v.x && y == v.y && z == v.z && w == v.w; } /// Compare two vectors component-wise for inequality RIM_FORCE_INLINE bool operator != ( const Vector4D<T>& v ) const { return x != v.x || y != v.y || z != v.z || w != v.w; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Negation/Positivation Operators /// Negate a vector. /** * This method returns the negation of a vector, making * it point in the opposite direction. It does not modify the * original vector. * * @return the negation of the original vector. */ RIM_FORCE_INLINE Vector4D<T> operator - () const { return Vector4D<T>( -x, -y, -z, -w ); } /// Postive a vector, returning a copy of it. Operator does nothing. /** * This operator doesn't do anything but return the original * value of the vector that it affects. * * @return the same vector as the orignal vector. */ RIM_FORCE_INLINE Vector4D<T> operator + () const { return Vector4D<T>( x, y, z, w ); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Arithmatic Operators /// Add this vector to another and return the result. /** * This method adds another vector to this one, component-wise, * and returns this addition. It does not modify either of the original * vectors. * * @param vector - The vector to add to this one. * @return The addition of this vector and the parameter. */ RIM_FORCE_INLINE Vector4D<T> operator + ( const Vector4D<T>& vector ) const { return Vector4D<T>( x + vector.x, y + vector.y, z + vector.z, w + vector.w ); } /// Add a value to every component of this vector. /** * This method adds the value parameter to every component * of the vector, and returns a vector representing this result. * It does not modifiy the original vector. * * @param value - The value to add to all components of this vector. * @return The resulting vector of this addition. */ RIM_FORCE_INLINE Vector4D<T> operator + ( const T& value ) const { return Vector4D<T>( x + value, y + value, z + value, w + value ); } /// Subtract a vector from this vector component-wise and return the result. /** * This method subtracts another vector from this one, component-wise, * and returns this subtraction. It does not modify either of the original * vectors. * * @param vector - The vector to subtract from this one. * @return The subtraction of the the parameter from this vector. */ RIM_FORCE_INLINE Vector4D<T> operator - ( const Vector4D<T>& vector ) const { return Vector4D<T>( x - vector.x, y - vector.y, z - vector.z, w - vector.w ); } /// Subtract a value from every component of this vector. /** * This method subtracts the value parameter from every component * of the vector, and returns a vector representing this result. * It does not modifiy the original vector. * * @param value - The value to subtract from all components of this vector. * @return The resulting vector of this subtraction. */ RIM_FORCE_INLINE Vector4D<T> operator - ( const T& value ) const { return Vector4D<T>( x - value, y - value, z - value, w - value ); } /// Multiply component-wise this vector and another vector. /** * This operator multiplies each component of this vector * by the corresponding component of the other vector and * returns a vector representing this result. It does not modify * either original vector. * * @param vector - The vector to multiply this vector by. * @return The result of the multiplication. */ RIM_FORCE_INLINE Vector4D<T> operator * ( const Vector4D<T>& vector ) const { return Vector4D<T>( x*vector.x, y*vector.y, z*vector.z, w*vector.w ); } /// Multiply every component of this vector by a value and return the result. /** * This method multiplies the value parameter with every component * of the vector, and returns a vector representing this result. * It does not modifiy the original vector. * * @param value - The value to multiplly with all components of this vector. * @return The resulting vector of this multiplication. */ RIM_FORCE_INLINE Vector4D<T> operator * ( const T& value ) const { return Vector4D<T>( x*value, y*value, z*value, w*value ); } /// Multiply component-wise this vector and another vector. /** * This operator multiplies each component of this vector * by the corresponding component of the other vector and * returns a vector representing this result. It does not modify * either original vector. * * @param vector - The vector to multiply this vector by. * @return The result of the multiplication. */ RIM_FORCE_INLINE Vector4D<T> operator / ( const Vector4D<T>& vector ) const { return Vector4D<T>( x/vector.x, y/vector.y, z/vector.z, w/vector.w ); } /// Divide every component of this vector by a value and return the result. /** * This method Divides every component of the vector by the value parameter, * and returns a vector representing this result. * It does not modifiy the original vector. * * @param value - The value to divide all components of this vector by. * @return The resulting vector of this division. */ RIM_FORCE_INLINE Vector4D<T> operator / ( const T& value ) const { T inverseValue = T(1) / value; return Vector4D<T>( x*inverseValue, y*inverseValue, z*inverseValue, w*inverseValue ); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Arithmatic Assignment Operators with Vectors /// Add a vector to this vector, modifying this original vector. /** * This method adds another vector to this vector, component-wise, * and sets this vector to have the result of this addition. * * @param vector - The vector to add to this vector. * @return A reference to this modified vector. */ RIM_FORCE_INLINE Vector4D<T>& operator += ( const Vector4D<T>& vector ) { x += vector.x; y += vector.y; z += vector.z; w += vector.w; return *this; } /// Subtract a vector from this vector, modifying this original vector. /** * This method subtracts another vector from this vector, component-wise, * and sets this vector to have the result of this subtraction. * * @param vector - The vector to subtract from this vector. * @return A reference to this modified vector. */ RIM_FORCE_INLINE Vector4D<T>& operator -= ( const Vector4D<T>& vector ) { x -= vector.x; y -= vector.y; z -= vector.z; w -= vector.w; return *this; } /// Multiply component-wise this vector and another vector and modify this vector. /** * This operator multiplies each component of this vector * by the corresponding component of the other vector and * modifies this vector to contain the result. * * @param vector - The vector to multiply this vector by. * @return A reference to this modified vector. */ RIM_FORCE_INLINE Vector4D<T>& operator *= ( const Vector4D<T>& vector ) { x *= vector.x; y *= vector.y; z *= vector.z; w *= vector.w; return *this; } /// Divide component-wise this vector by another vector and modify this vector. /** * This operator divides each component of this vector * by the corresponding component of the other vector and * modifies this vector to contain the result. * * @param vector - The vector to divide this vector by. * @return A reference to this modified vector. */ RIM_FORCE_INLINE Vector4D<T>& operator /= ( const Vector4D<T>& vector ) { x /= vector.x; y /= vector.y; z /= vector.z; w /= vector.w; return *this; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Arithmatic Assignment Operators with Values /// Add a value to each component of this vector, modifying it. /** * This operator adds a value to each component of this vector * and modifies this vector to store the result. * * @param value - The value to add to every component of this vector. * @return A reference to this modified vector. */ RIM_FORCE_INLINE Vector4D<T>& operator += ( const T& value ) { x += value; y += value; z += value; w += value; return *this; } /// Subtract a value from each component of this vector, modifying it. /** * This operator subtracts a value from each component of this vector * and modifies this vector to store the result. * * @param value - The value to subtract from every component of this vector. * @return A reference to this modified vector. */ RIM_FORCE_INLINE Vector4D<T>& operator -= ( const T& value ) { x -= value; y -= value; z -= value; w -= value; return *this; } /// Multiply a value with each component of this vector, modifying it. /** * This operator multiplies a value with each component of this vector * and modifies this vector to store the result. * * @param value - The value to multiply with every component of this vector. * @return A reference to this modified vector. */ RIM_FORCE_INLINE Vector4D<T>& operator *= ( const T& value ) { x *= value; y *= value; z *= value; w *= value; return *this; } /// Divide each component of this vector by a value, modifying it. /** * This operator Divides each component of this vector by value * and modifies this vector to store the result. * * @param value - The value to multiply with every component of this vector. * @return A reference to this modified vector. */ RIM_FORCE_INLINE Vector4D<T>& operator /= ( const T& value ) { T inverseValue = T(1) / value; x *= inverseValue; y *= inverseValue; z *= inverseValue; w *= inverseValue; return *this; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** String Conversion Methods /// Convert this 4D vector into a human-readable string representation. RIM_NO_INLINE data::String toString() const { data::StringBuffer buffer; buffer << "< " << x << ", " << y << ", " << z << ", " << w << " >"; return buffer.toString(); } /// Convert this 4D vector into a human-readable string representation. RIM_FORCE_INLINE operator data::String () const { return this->toString(); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Public Data Members union { struct { /// The red component of a 4-component color. T r; /// The green component of a 4-component color. T g; /// The blue component of a 4-component color. T b; /// The alpha component of a 4-component color. T a; }; struct { /// The X coordinate of a 4D vector. T x; /// The Y coordinate of a 4D vector. T y; /// The Z coordinate of a 4D vector. T z; /// The W coordinate of a 4D vector. T w; }; }; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Public Static Data Members /// A constant vector with all elements equal to zero static const Vector4D<T> ZERO; }; template <typename T> const Vector4D<T> Vector4D<T>:: ZERO; //########################################################################################## //########################################################################################## //############ //############ Commutative Arithmatic Operators //############ //########################################################################################## //########################################################################################## /// Add a value to every component of the vector. /** * This operator adds the value parameter to every component * of the vector, and returns a vector representing this result. * It does not modifiy the original vector. * * @param value - The value to add to all components of the vector. * @param vector - The vector to be added to. * @return The resulting vector of this addition. */ template < typename T > RIM_FORCE_INLINE Vector4D<T> operator + ( const T& value, const Vector4D<T>& vector ) { return Vector4D<T>( vector.x + value, vector.y + value, vector.z + value, vector.w + value ); } /// Subtract every component of the vector from the value, returning a vector result. /** * This operator subtracts every component of the 2nd paramter, a vector, * from the 1st paramter, a value, and then returns a vector containing the * resulting vectoral components. This operator does not modify the orignal vector. * * @param value - The value to subtract all components of the vector from. * @param vector - The vector to be subtracted. * @return The resulting vector of this subtraction. */ template < typename T > RIM_FORCE_INLINE Vector4D<T> operator - ( const T& value, const Vector4D<T>& vector ) { return Vector4D<T>( value - vector.x, value - vector.y, value - vector.z, value - vector.w ); } /// Multiply every component of the vector with the value, returning a vector result. /** * This operator multiplies every component of the 2nd paramter, a vector, * from the 1st paramter, a value, and then returns a vector containing the * resulting vectoral components. This operator does not modify the orignal vector. * * @param value - The value to multiply with all components of the vector. * @param vector - The vector to be multiplied with. * @return The resulting vector of this multiplication. */ template < typename T > RIM_FORCE_INLINE Vector4D<T> operator * ( const T& value, const Vector4D<T>& vector ) { return Vector4D<T>( vector.x*value, vector.y*value, vector.z*value, vector.w*value ); } /// Divide a value by every component of the vector, returning a vector result. /** * This operator divides the provided value by every component of * the vector, returning a vector representing the component-wise division. * The operator does not modify the original vector. * * @param value - The value to be divided by all components of the vector. * @param vector - The vector to be divided by. * @return The resulting vector of this division. */ template < typename T > RIM_FORCE_INLINE Vector4D<T> operator / ( const T& value, const Vector4D<T>& vector ) { return Vector4D<T>( value/vector.x, value/vector.y, value/vector.z, value/vector.w ); } //########################################################################################## //########################################################################################## //############ //############ Other Vector Functions //############ //########################################################################################## //########################################################################################## /// Compute and return the dot product of two vectors. /** * This method adds all components of the component-wise multiplication * of the two vectors together and returns the scalar result. It does * not modify either of the original vectors. If the dot product is * zero, then the two vectors are perpendicular. * * @param vector1 - The first vector of the dot product. * @param vector2 - The second vector of the dot product. * @return The dot product of the two vector parameters. */ template < typename T > RIM_FORCE_INLINE T dot( const Vector4D<T>& vector1, const Vector4D<T>& vector2 ) { return vector1.x*vector2.x + vector1.y*vector2.y + vector1.z*vector2.z + vector1.w*vector2.w; } /// Compute the midpoint of two vectors. /** * This method adds the two vector parameters together * component-wise and then multiplies by 1/2, resulting * in a point in 3D space at the midpoint between the two vectors. * The midpoint is essentially the component-wise average of two vectors. * Both original vectors are not modified. * * @param vector1 - The first vector of the midpoint calculation. * @param vector2 - The second vector of the midpoint calculation. * @return The midpoint of the two vector parameters. */ template < typename T > RIM_FORCE_INLINE Vector4D<T> midpoint( const Vector4D<T>& vector1, const Vector4D<T>& vector2 ) { return Vector4D<T>( (vector1.x + vector2.x)*T(0.5), (vector1.y + vector2.y)*T(0.5), (vector1.z + vector2.z)*T(0.5), (vector1.w + vector2.w)*T(0.5) ); } /// Return the absolute value of the specified vector, such that the every component is positive. template < typename T > RIM_FORCE_INLINE Vector4D<T> abs( const Vector4D<T>& vector ) { return Vector4D<T>( math::abs(vector.x), math::abs(vector.y), math::abs(vector.z), math::abs(vector.w) ); } /// Compute the component-wise minimum of two vectors. template < typename T > RIM_FORCE_INLINE Vector4D<T> min( const Vector4D<T>& vector1, const Vector4D<T>& vector2 ) { return Vector4D<T>( math::min( vector1.x, vector2.x ), math::min( vector1.y, vector2.y ), math::min( vector1.z, vector2.z ), math::min( vector1.w, vector2.w ) ); } /// Compute the component-wise maximum of two vectors. template < typename T > RIM_FORCE_INLINE Vector4D<T> max( const Vector4D<T>& vector1, const Vector4D<T>& vector2 ) { return Vector4D<T>( math::max( vector1.x, vector2.x ), math::max( vector1.y, vector2.y ), math::max( vector1.z, vector2.z ), math::max( vector1.w, vector2.w ) ); } /// Return the floor of the specified vector, rounding each component down to the nearest integer. template < typename T > RIM_FORCE_INLINE Vector4D<T> floor( const Vector4D<T>& vector ) { return Vector4D<T>( math::floor(vector.x), math::floor(vector.y), math::floor(vector.z), math::floor(vector.w) ); } /// Return the floor of the specified vector, rounding each component up to the nearest integer. template < typename T > RIM_FORCE_INLINE Vector4D<T> ceiling( const Vector4D<T>& vector ) { return Vector4D<T>( math::ceiling(vector.x), math::ceiling(vector.y), math::ceiling(vector.z), math::ceiling(vector.w) ); } /// Return the component-wise modulus of the specified vector. template < typename T > RIM_FORCE_INLINE Vector4D<T> mod( const Vector4D<T>& vector, const T& modulus ) { return Vector4D<T>( math::mod(vector.x, modulus), math::mod(vector.y, modulus), math::mod(vector.z, modulus), math::mod(vector.w, modulus) ); } /// Return the component-wise modulus of the specified vector. template < typename T > RIM_FORCE_INLINE Vector4D<T> mod( const Vector4D<T>& vector, const Vector4D<T>& modulus ) { return Vector4D<T>( math::mod(vector.x, modulus.x), math::mod(vector.y, modulus.y), math::mod(vector.z, modulus.z), math::mod(vector.w, modulus.w) ); } /// Return whether or not any component of this vector is Not-A-Number. template < typename T > RIM_FORCE_INLINE Bool isNAN( const Vector4D<T>& vector) { return math::isNAN(vector.x) || math::isNAN(vector.y) || math::isNAN(vector.z) || math::isNAN(vector.w); } //########################################################################################## //***************************** End Rim Math Namespace *********************************** RIM_MATH_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_VECTOR_4D_H <file_sep>/* * rimHashCode.h * Rim Framework * * Created by <NAME> on 12/28/08. * Copyright 2008 Rim Software. All rights reserved. * */ #ifndef INCLUDE_RIM_HASH_CODE_H #define INCLUDE_RIM_HASH_CODE_H #include "rimDataConfig.h" //########################################################################################## //******************************* Start Data Namespace ********************************* RIM_DATA_NAMESPACE_START //****************************************************************************************** //########################################################################################## class HashCode { public: template < typename DataType > RIM_INLINE HashCode( const DataType* data, Size number ) { hashCode = computeHashCode( (const UByte*)data, sizeof(DataType)*number ); } RIM_INLINE operator Hash () const { return hashCode; } private: static Hash computeHashCode( const UByte* data, Size length ); Hash hashCode; }; //########################################################################################## //******************************* End Data Namespace *********************************** RIM_DATA_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_HASH_CODE_H <file_sep>/* * rimEntity.h * Rim Entities * * Created by <NAME> on 5/13/12. * Copyright 2012 __MyCompanyName__. All rights reserved. * */ #ifndef INCLUDE_RIM_ENTITY_H #define INCLUDE_RIM_ENTITY_H #include "rimEntitiesConfig.h" #include "rimEntityEvent.h" #include "rimEntityComponent.h" //########################################################################################## //************************** Start Rim Entities Namespace ******************************** RIM_ENTITIES_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class which stores sets of arbitrarily-typed component objects, named and organized by type. /** * This class can be used as the basis for complex component-based objects in * a variety of applications, particularly game development. */ class Entity { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructors /// Create a new empty entity that has no stored components. Entity(); /// Create a copy of another entity, copying all of its stored components. Entity( const Entity& other ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Destructor /// Destroy an entity, deallocating all stored components. virtual ~Entity(); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Assignment Operator /// Assign the contents of one entity to another, copying all stored components. Entity& operator = ( const Entity& other ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Update Methods /// Should this even be here? virtual void update() { } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Component Accessor Methods /// Return a pointer to the first component that the entity has for the specified type. /** * If the entity does not have any components for the specified template type, * NULL is returned. */ template < typename ComponentType > ComponentType* getComponent(); /// Return a const pointer to the first component that the entity has for the specified type. /** * If the entity does not have any components for the specified template type, * NULL is returned. */ template < typename ComponentType > const ComponentType* getComponent() const; /// Return a pointer to the component that the entity has for the specified type and with the given name. /** * If the entity does not have any components for the specified template type and * a matching name string, NULL is returned. */ template < typename ComponentType > ComponentType* getComponent( const String& name ); /// Return a const pointer to the component that the entity has for the specified type and with the given name. /** * If the entity does not have any components for the specified template type and * a matching name string, NULL is returned. */ template < typename ComponentType > const ComponentType* getComponent( const String& name ) const; /// Return a pointer to a list of components of the specified template type. /** * If the entity does not have any components for the specified template type, * NULL is returned. */ template < typename ComponentType > const ArrayList< Component<ComponentType> >* getComponents() const; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Component Adding Methods /// Add the specified unnamed component to this entity. /** * The method returns whether or not adding the component was successful. */ template < typename ComponentType > Bool addComponent( const ComponentType& component ); /// Add the specified component to this entity, giving it the specified name string. /** * This name string can be used to identify between component instances of the * same type. The method returns whether or not adding the component was successful. */ template < typename ComponentType > Bool addComponent( const ComponentType& component, const String& name ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Component Removing Methods /// Remove the specified component from this entity if it exists. /** * If the entity contains a component which is equal in type and * value to the specified component, the component is removed and * TRUE is returned. Otherwise, FALSE is returned and the entity * is unchanged. */ template < typename ComponentType > Bool removeComponent( const ComponentType* component ); /// Remove the component with the specified name from this entity if it exists. /** * If the entity contains a component which is equal in type and * has the specified name, the component is removed and * TRUE is returned. Otherwise, FALSE is returned and the entity * is unchanged. */ template < typename ComponentType > Bool removeComponent( const String& name ); /// Remove all components with the specified component type from this entity. /** * If the entity contains any components that have the specified type, * the components are removed and TRUE is returned. Otherwise, FALSE is * returned and the entity is unchanged. */ template < typename ComponentType > Bool removeComponents(); /// Remove all components from this entity. void clearComponents(); private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Class Declarations /// The base class for a templated array of components. class ComponentArrayBase; /// A class which holds an array of components of a given type. template < typename ComponentType > class ComponentArray; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Helper Methods /// Get a reference to a statically-instantiated Type object. /** * The Type object is instantiated on the first call to the * method using the method's template type. This allows the * caller to efficiently retrieve a Type object for a compile-time * template type multiple times without having to create a new Type * object each time. */ template < typename T > RIM_INLINE static const Type& getType() { static const Type type = Type::of<T>(); return type; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Members /// A map from Type object to component type arrays of all of the components in the entity. HashMap<Type,ComponentArrayBase*> components; }; //########################################################################################## //########################################################################################## //############ //############ ComponentArrayBase Class Defintion //############ //########################################################################################## //########################################################################################## class Entity:: ComponentArrayBase { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Destructor /// Destroy this base component array. virtual ~ComponentArrayBase() { } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Virtual Copy Method /// Return a copy of this component array's concrete type. virtual ComponentArrayBase* copy() const = 0; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Component Accessor Methods /// Return a pointer to the array of components which this array holds. /** * The method attempts to convert the internal component array to the given * type. If the conversion fails, NULL is returned. */ template < typename ComponentType > RIM_INLINE ArrayList<Component<ComponentType> >* getComponents(); /// Return a const pointer to the array of components which this array holds. /** * The method attempts to convert the internal component array to the given * type. If the conversion fails, NULL is returned. */ template < typename ComponentType > RIM_INLINE const ArrayList<Component<ComponentType> >* getComponents() const; }; //########################################################################################## //########################################################################################## //############ //############ ComponentArray Class Defintion //############ //########################################################################################## //########################################################################################## template < typename ComponentType > class Entity:: ComponentArray : public ComponentArrayBase { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructor RIM_INLINE ComponentArray( const ComponentType& component ) : components( 1 ) { components.add( component ); } RIM_INLINE ComponentArray( const ComponentType& component, const String& name ) : components( 1 ) { components.add( Component<ComponentType>( Pointer<ComponentType>::construct( component ), name ) ); } RIM_INLINE ComponentArray( const Component<ComponentType>& component ) : components( 1 ) { components.add( component ); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Virtual Copy Method /// Create and return a copy of this concrete type. virtual ComponentArray<ComponentType>* copy() const { return util::construct<ComponentArray<ComponentType> >( *this ); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Component Accessor Methods /// Return a pointer to the internal list of components that this component array stores. RIM_INLINE ArrayList<Component<ComponentType> >* getComponents() { return &components; } /// Return a const pointer to the internal list of components that this component array stores. RIM_INLINE const ArrayList<Component<ComponentType> >* getComponents() const { return &components; } private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Members /// A list of the components stored by this concrete component array. ArrayList< Component<ComponentType> > components; }; //########################################################################################## //########################################################################################## //############ //############ Component Accessor Methods //############ //########################################################################################## //########################################################################################## template < typename ComponentType > ComponentType* Entity:: getComponent() { const Type& type = Entity::getType<ComponentType>(); ComponentArrayBase* const * base; if ( components.find( type.getHashCode(), type, base ) ) { ArrayList<Component<ComponentType> >* array = (*base)->getComponents<ComponentType>(); if ( array != NULL && array->getSize() > 0 ) return array->getFirst().getValue(); } return NULL; } template < typename ComponentType > const ComponentType* Entity:: getComponent() const { const Type& type = Entity::getType<ComponentType>(); ComponentArrayBase* const * base; if ( components.find( type.getHashCode(), type, base ) ) { const ArrayList<Component<ComponentType> >* array = (*base)->getComponents<ComponentType>(); if ( array != NULL && array->getSize() > 0 ) return array->getFirst().getValue(); } return NULL; } template < typename ComponentType > ComponentType* Entity:: getComponent( const String& name ) { const Type& type = Entity::getType<ComponentType>(); ComponentArrayBase* const * base; if ( components.find( type.getHashCode(), type, base ) ) { ArrayList<Component<ComponentType> >* array = (*base)->getComponents<ComponentType>(); if ( array != NULL ) { const Size arraySize = array->getSize(); for ( Index i = 0; i < arraySize; i++ ) { if ( (*array)[i].getName() == name ) return (*array)[i].getValue(); } } } return NULL; } template < typename ComponentType > const ComponentType* Entity:: getComponent( const String& name ) const { const Type& type = Entity::getType<ComponentType>(); ComponentArrayBase* const * base; if ( components.find( type.getHashCode(), type, base ) ) { const ArrayList<Component<ComponentType> >* array = (*base)->getComponents<ComponentType>(); if ( array != NULL ) { const Size arraySize = array->getSize(); for ( Index i = 0; i < arraySize; i++ ) { if ( array[i].getName() == name ) return array[i].getValue(); } } } return NULL; } template < typename ComponentType > const ArrayList<Component<ComponentType> >* Entity:: getComponents() const { const Type& type = Entity::getType<ComponentType>(); ComponentArrayBase* const * base; if ( components.find( type.getHashCode(), type, base ) ) return (*base)->getComponents<ComponentType>(); return NULL; } //########################################################################################## //########################################################################################## //############ //############ Component List Accessor Methods //############ //########################################################################################## //########################################################################################## template < typename ComponentType > ArrayList<Component<ComponentType> >* Entity::ComponentArrayBase:: getComponents() { ComponentArray<ComponentType>* array = dynamic_cast<ComponentArray<ComponentType>*>( this ); if ( array != NULL ) return array->getComponents(); else return NULL; } template < typename ComponentType > const ArrayList<Component<ComponentType> >* Entity::ComponentArrayBase:: getComponents() const { const ComponentArray<ComponentType>* array = dynamic_cast<const ComponentArray<ComponentType>*>( this ); if ( array != NULL ) return array->getComponents(); else return NULL; } //########################################################################################## //########################################################################################## //############ //############ Component Add Methods //############ //########################################################################################## //########################################################################################## template < typename ComponentType > Bool Entity:: addComponent( const ComponentType& component ) { const Type& type = Entity::getType<ComponentType>(); ComponentArrayBase** base; if ( components.find( type.getHashCode(), type, base ) ) { // Found an array of components of this type. ArrayList<Component<ComponentType> >* array = (*base)->getComponents<ComponentType>(); // Check to see if the component type conversion is correct. If so, add the new component. if ( array != NULL ) array->add( Component<ComponentType>( component ) ); else return false; } else { // This type of component does not yet exist in this entity. // Create a new one and add it to the map of components. ComponentArray<ComponentType>* newComponentArray = util::construct<ComponentArray<ComponentType> >( component ); components.add( type.getHashCode(), type, newComponentArray ); } return true; } template < typename ComponentType > Bool Entity:: addComponent( const ComponentType& component, const String& name ) { const Type& type = Entity::getType<ComponentType>(); ComponentArrayBase** base; if ( components.find( type.getHashCode(), type, base ) ) { // Found an array of components of this type. ArrayList<Component<ComponentType> >* array = (*base)->getComponents<ComponentType>(); // Check to see if the component type conversion is correct. If so, add the new component. if ( array != NULL ) array->add( Component<ComponentType>( Pointer<ComponentType>::construct( component ), name ) ); else return false; } else { // This type of component does not yet exist in this entity. // Create a new one and add it to the map of components. ComponentArray<ComponentType>* newComponentArray = util::construct<ComponentArray<ComponentType> >( component, name ); components.add( type.getHashCode(), type, newComponentArray ); } return true; } //########################################################################################## //########################################################################################## //############ //############ Component Remove Methods //############ //########################################################################################## //########################################################################################## template < typename ComponentType > Bool Entity:: removeComponent( const ComponentType* component ) { const Type& type = Entity::getType<ComponentType>(); ComponentArrayBase* const * base; if ( !components.find( type.getHashCode(), type, base ) ) return false; ArrayList<ComponentType>* array = (*base)->getComponents<ComponentType>(); if ( array == NULL ) return false; const Size numComponents = array->getSize(); for ( Index i = 0; i < numComponents; i++ ) { if ( (*array)->getValue() == component ) { array->removeAtIndexUnordered( i ); return true; } } return false; } template < typename ComponentType > Bool Entity:: removeComponent( const String& componentName ) { const Type& type = Entity::getType<ComponentType>(); ComponentArrayBase* const * base; if ( !components.find( type.getHashCode(), type, base ) ) return false; ArrayList<ComponentType>* array = (*base)->getComponents<ComponentType>(); if ( array == NULL ) return false; const Size numComponents = array->getSize(); for ( Index i = 0; i < numComponents; i++ ) { if ( (*array)->getName() == componentName ) { array->removeAtIndexUnordered( i ); return true; } } return false; } template < typename ComponentType > Bool Entity:: removeComponents() { const Type& type = Entity::getType<ComponentType>(); ComponentArrayBase* const * base; return components.remove( type.getHashCode(), type ); } //########################################################################################## //************************** End Rim Entities Namespace ********************************** RIM_ENTITIES_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_ENTITY_H <file_sep>/* * rimDataBuffer.h * Rim Framework * * Created by <NAME> on 6/21/09. * Copyright 2009 Rim Software. All rights reserved. * */ #ifndef INCLUDE_RIM_DATA_BUFFER_H #define INCLUDE_RIM_DATA_BUFFER_H #include "rimDataConfig.h" #include "rimData.h" #include "rimEndian.h" // Forward-declare the DataInputStream class so that we can mark it as a friend. namespace rim { namespace io { class DataInputStream; }; }; //########################################################################################## //******************************* Start Data Namespace ********************************* RIM_DATA_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A buffer class used to accumulate an opaque array of unsigned bytes. class DataBuffer { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructors /// Create a data buffer with the default capacity, resize factor, and endian-ness. RIM_INLINE DataBuffer() : buffer( NULL ), nextElement( NULL ), bufferEnd( NULL ), capacity( DEFAULT_CAPACITY ), resizeFactor( DEFAULT_RESIZE_FACTOR ) { } /// Create a data buffer the specified capacity, default resize factor and native endian-ness. RIM_INLINE DataBuffer( Size newCapacity ) : buffer( util::allocate<UByte>( math::max( newCapacity, Size(1) ) ) ), capacity( newCapacity ), resizeFactor( DEFAULT_RESIZE_FACTOR ) { nextElement = buffer; bufferEnd = buffer + newCapacity; } /// Create a data buffer the specified capacity and resize factor and native endian-ness. RIM_INLINE DataBuffer( Size newCapacity, Float newResizeFactor ) : buffer( util::allocate<UByte>( math::max( newCapacity, Size(1) ) ) ), capacity( math::max( newCapacity, Size(1) ) ), resizeFactor( math::clamp( newResizeFactor, 1.1f, 10.0f ) ) { nextElement = buffer; bufferEnd = buffer + capacity; } /// Create a data buffer the specified capacity, resize factor and endian-ness. RIM_INLINE DataBuffer( Size newCapacity, Float newResizeFactor, Endianness newEndianness ) : buffer( util::allocate<UByte>( math::max( newCapacity, Size(1) ) ) ), capacity( math::max( newCapacity, Size(1) ) ), resizeFactor( math::clamp( newResizeFactor, 1.1f, 10.0f ) ), endianness( newEndianness ) { nextElement = buffer; bufferEnd = buffer + capacity; } /// Create a copy of the specified data buffer. DataBuffer( const DataBuffer& other ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Destructor /// Destroy the data buffer and all data contained within. ~DataBuffer(); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Assignment Operator /// Assign the contents of another DataBuffer to this buffer, replacing the original contents. DataBuffer& operator = ( const DataBuffer& other ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Unsigned Byte Append Methods /// Append an unsigned byte to this data buffer. DataBuffer& append( UByte byte ); /// Append the specified number of elements from an array of unsigned bytes. DataBuffer& append( const UByte* bytes, Size number ); /// Append an array of unsigned bytes to this data buffer. RIM_INLINE DataBuffer& append( const util::Array<UByte>& array ) { return this->append( array.getPointer(), array.getSize() ); } /// Append all data in the specified data buffer to this data buffer. RIM_INLINE DataBuffer& append( const DataBuffer& dataBuffer ) { return this->append( dataBuffer.getPointer(), dataBuffer.getSize() ); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Primitive Type Append Methods /// Append a signed 8-bit integer to this data buffer. RIM_INLINE DataBuffer& append( Int8 value ) { return this->append( *((UByte*)&value) ); } /// Append a signed 16-bit integer to this data buffer. RIM_INLINE DataBuffer& append( Int16 value ) { value = endianness.convertToNative( value ); Size size = sizeof(value); return this->append( (const UByte*)&value, size ); } /// Append an unsigned 16-bit integer to this data buffer. RIM_INLINE DataBuffer& append( UInt16 value ) { value = endianness.convertToNative( value ); Size size = sizeof(value); return this->append( (const UByte*)&value, size ); } /// Append a signed 32-bit integer to this data buffer. RIM_INLINE DataBuffer& append( Int32 value ) { value = endianness.convertToNative( value ); Size size = sizeof(value); return this->append( (const UByte*)&value, size ); } /// Append an unsigned 32-bit integer to this data buffer. RIM_INLINE DataBuffer& append( UInt32 value ) { value = endianness.convertToNative( value ); Size size = sizeof(value); return this->append( (const UByte*)&value, size ); } /// Append a signed 64-bit integer to this data buffer. RIM_INLINE DataBuffer& append( Int64 value ) { value = endianness.convertToNative( value ); Size size = sizeof(value); return this->append( (const UByte*)&value, size ); } /// Append an unsigned 64-bit integer to this data buffer. RIM_INLINE DataBuffer& append( UInt64 value ) { value = endianness.convertToNative( value ); Size size = sizeof(value); return this->append( (const UByte*)&value, size ); } /// Append a 32-bit floating point number to this data buffer. RIM_INLINE DataBuffer& append( Float32 value ) { Size size = sizeof(value); return this->append( (const UByte*)&value, size ); } /// Append a 64-bit floating point number to this data buffer. RIM_INLINE DataBuffer& append( Float64 value ) { Size size = sizeof(value); return this->append( (const UByte*)&value, size ); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Other Type Append Methods /// Append a certain number of elements from an array of a primitive type. template < typename T > RIM_INLINE DataBuffer& append( const T* source, Size number ) { const T* sourceEnd = source + number; while ( source != sourceEnd ) { this->append( *source ); source++; } return *this; } /// Append all elements from an array of a primitive type to this data buffer. template < typename T > RIM_INLINE DataBuffer& append( const util::Array<T>& array ) { return this->append( array.getPointer(), array.getSize() ); } /// Append a certain number of elements from an array of a primitive type. template < typename T > RIM_INLINE DataBuffer& append( const util::Array<T>& array, Size number ) { return this->append( array.getPointer(), math::min( array.getSize(), number ) ); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Append Operator /// Append to the data buffer. template < typename T > RIM_INLINE DataBuffer& operator << ( const T& value ) { return this->append( value ); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Reserve Method /// Reserve the specified number of bytes at the end of the buffer where data should be written. /** * The number of valid bytes in the buffer is increased by this number. A pointer * to the location where the bytes should be written is returned. If the specified number * of bytes is not written to the pointer returned, the result is undefined. * * @param numBytes - the number of bytes to reserve at the end of the buffer. * @return a pointer to where the bytes should be written. */ RIM_INLINE UByte* reserve( Size numBytes ) { if ( nextElement + numBytes > bufferEnd ) increaseCapacity( nextElement - buffer + numBytes ); UByte* pointer = nextElement; nextElement += numBytes; return pointer; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Clear Method /// Clear all previously added elements from the data buffer. RIM_INLINE void clear() { nextElement = buffer; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Content Accessor Methods /// Convert the contents of this buffer to an array object. RIM_INLINE util::Array<UByte> toArray() const { return util::Array<UByte>( buffer, this->getSize() ); } /// Return a Data object containing the contents of this DataBuffer. /** * This version of the toData() method leaves the DataBuffer unmodified * and copies the data into the Data object. */ RIM_INLINE Data toData() const { return Data( buffer, this->getSize() ); } /// Return a Data object containing the contents of this DataBuffer. /** * This version of the toData() method avoids creating a copy of the * buffer's data by giving the DataBuffer's data pointer directly to the * Data object and leaving the DataBuffer with no allocated internal buffer. */ RIM_INLINE Data toData() { UByte* data = buffer; Size size = this->getSize(); buffer = NULL; nextElement = NULL; bufferEnd = NULL; return Data::shallow( data, size ); } /// Get a pointer to the beginning of the DataBuffer's internal array. RIM_INLINE operator const UByte* () const { return buffer; } /// Get a pointer pointing to the buffer's internal array. RIM_INLINE const UByte* getPointer() const { return buffer; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Size Accessor Methods /// Get the number of bytes of data contained in the buffer. RIM_INLINE Size getSize() const { return nextElement - buffer; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Capacity Accessor Methods /// Get the number of elements the buffer can hold without resizing. RIM_INLINE Size getCapacity() const { return capacity; } /// Set the number of elements the buffer can hold. RIM_INLINE Bool setCapacity( Size newCapacity ) { if ( newCapacity < getSize() ) return false; else resize( newCapacity ); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Resize Factor Accessor Methods /// Get the resize factor for this string buffer. RIM_INLINE Float getResizeFactor() const { return resizeFactor; } /// Set the resize factor for this string buffer, clamped to [1.1, 10.0] RIM_INLINE void setResizeFactor( Float newResizeFactor ) { resizeFactor = math::clamp( newResizeFactor, 1.1f, 10.0f ); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Endian-ness Accessor Methods /// Get the current endianness of the data being written to the buffer. RIM_INLINE Endianness getEndianness() const { return endianness; } /// Set the buffer to serialize data in big endian format. RIM_INLINE void setEndianness( Endianness newEndianness ) { endianness = newEndianness; } private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Methods /// Increase the capacity to the specified amount multiplied by the resize factor. RIM_INLINE void increaseCapacity( Size minimumCapacity ) { resize( math::max( minimumCapacity, Size(Float(capacity)*resizeFactor) ) ); } /// Resize the internal buffer to be the specified length. void resize( Size newCapacity ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Members /// An array of elements which is the buffer. UByte* buffer; /// A pointer to the location in the buffer where the next element should be inserted. UByte* nextElement; /// A pointer to the first element past the end of the buffer. const UByte* bufferEnd; /// The number of elements that the buffer can hold. Size capacity; /// How much the buffer's capacity increases when it needs to. Float resizeFactor; /// Whether or not the buffer is currently encoding data in big or little endian format. Endianness endianness; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Static Data Members /// The default capacity for a buffer if it is not specified. static const Size DEFAULT_CAPACITY = 32; /// The default factor by which the buffer resizes. static const Float DEFAULT_RESIZE_FACTOR; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Friend Class Declarations /// Mark the DataInputStream class as a friend so that it can modify a buffer's internals. friend class rim::io::DataInputStream; }; //########################################################################################## //******************************* End Data Namespace *********************************** RIM_DATA_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_DATA_BUFFER_H <file_sep>/* * rimResourcesConfig.h * Rim Framework * * Created by <NAME> on 12/28/08. * Copyright 2008 Rim Software. All rights reserved. * */ #ifndef INCLUDE_RIM_RESOURCES_CONFIG_H #define INCLUDE_RIM_RESOURCES_CONFIG_H #include "../rimConfig.h" #include "../rimData.h" #include "../rimFileSystem.h" #include "../rimUtilities.h" #include "../rimLanguage.h" //########################################################################################## //########################################################################################## //############ //############ Library Namespace Configuration //############ //########################################################################################## //########################################################################################## /// Define the name of the resource library namespace. #ifndef RIM_RESOURCES_NAMESPACE #define RIM_RESOURCES_NAMESPACE resources #endif #ifndef RIM_RESOURCES_NAMESPACE_START #define RIM_RESOURCES_NAMESPACE_START RIM_NAMESPACE_START namespace RIM_RESOURCES_NAMESPACE { #endif #ifndef RIM_RESOURCES_NAMESPACE_END #define RIM_RESOURCES_NAMESPACE_END }; RIM_NAMESPACE_END #endif RIM_NAMESPACE_START /// A namespace containing classes that handle pooled generic resource management. namespace RIM_RESOURCES_NAMESPACE { }; RIM_NAMESPACE_END //########################################################################################## //************************** Start Rim Resources Namespace ******************************* RIM_RESOURCES_NAMESPACE_START //****************************************************************************************** //########################################################################################## //########################################################################################## //************************** End Rim Resources Namespace ********************************* RIM_RESOURCES_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_RESOURCES_CONFIG_H <file_sep>/* * rimPhysicsCollisionShapePlane.h * Rim Physics * * Created by <NAME> on 7/6/12. * Copyright 2012 __MyCompanyName__. All rights reserved. * */ #ifndef INCLUDE_RIM_PHYSICS_COLLISION_SHAPE_PLANE_H #define INCLUDE_RIM_PHYSICS_COLLISION_SHAPE_PLANE_H #include "rimPhysicsShapesConfig.h" #include "rimPhysicsCollisionShape.h" #include "rimPhysicsCollisionShapeBase.h" #include "rimPhysicsCollisionShapeInstance.h" //########################################################################################## //************************ Start Rim Physics Shapes Namespace **************************** RIM_PHYSICS_SHAPES_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class which represents an infinite plane collision shape. class CollisionShapePlane : public CollisionShapeBase<CollisionShapePlane> { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Public Class Declarations class Instance; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructors /// Create a default plane shape which is the XZ plane with normal pointing along the positive Y direction. RIM_INLINE CollisionShapePlane() : plane( Vector3( 0, 1, 0 ), 0 ) { updateBoundingSphere(); } /// Create a plane shape with the specified plane equation. /** * The plane's normal is normalized and its offset recalculated * to reflect the new normal. */ RIM_INLINE CollisionShapePlane( const Plane3& newPlane ) : plane( newPlane.normal.normalize(), newPlane.offset*newPlane.normal.getMagnitude() ) { updateBoundingSphere(); } /// Create a plane shape with the specified point on the plane and plane normal. /** * The plane's normal is normalized and used to calculate the plane's offset * with the point on the plane. */ RIM_INLINE CollisionShapePlane( const Vector3& normal, const Vector3& pointOnPlane ) : plane( normal.normalize(), pointOnPlane ) { updateBoundingSphere(); } /// Create a plane shape with the specified plane equation and material. /** * The plane's normal is normalized and its offset recalculated * to reflect the new normal. */ RIM_INLINE CollisionShapePlane( const Plane3& newPlane, const CollisionShapeMaterial& newMaterial ) : CollisionShapeBase<CollisionShapePlane>( newMaterial ), plane( newPlane ) { updateBoundingSphere(); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Plane Accessor Methods /// Return the plane equation of this plane shape. RIM_INLINE const Plane3& getPlane() const { return plane; } /// Set the plane equation of this plane shape. /** * The plane's normal is normalized and its offset recalculated * to reflect the new normal. */ RIM_INLINE void setPlane( const Plane3& newPlane ) { Real normalMagnitude = newPlane.normal.getMagnitude(); plane.normal = newPlane.normal / normalMagnitude; plane.offset = newPlane.offset * normalMagnitude; updateBoundingSphere(); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Normal Accessor Methods /// Return the normal of this plane shape in shape space. RIM_INLINE const Vector3& getNormal() const { return plane.normal; } /// Set the normal of this plane shape in shape space. /** * The new normal is automatically normalzed upon input. * This method does not change the plane's offset. */ RIM_INLINE void setNormal( const Vector3& newNormal ) { plane.normal = newNormal.normalize(); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Offset Accessor Methods /// Return the offset of this plane shape in shape space. RIM_INLINE Real getOffset() const { return plane.offset; } /// Set the offset of this plane shape in shape space. RIM_INLINE void setOffset( Real newOffset ) { plane.offset = newOffset; updateBoundingSphere(); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Mass Distribution Accessor Methods /// Return a 3x3 matrix for the inertia tensor of this plane shape relative to its center of mass. /** * The returned inertia tensor for this plane shape will always be a matrix * with infinite inertial values because the plane has no mass. */ virtual Matrix3 getInertiaTensor() const { return Matrix3( math::infinity<Real>(), Real(0), Real(0), Real(0), math::infinity<Real>(), Real(0), Real(0), Real(0), math::infinity<Real>() ); } /// Return a 3D vector representing the center-of-mass of this plane shape in its coordinate frame. /** * Since a plane shape has no mass or center, the returned center of mass is the projection of * the origin onto the plane. */ virtual Vector3 getCenterOfMass() const { return this->getCenter(); } /// Return the volume of this plane shape in length units cubed (m^3). /** * This method always returns 0 because a plane has no volume. */ virtual Real getVolume() const { return Real(0); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Instance Creation Methods /// Create and return an instance of this shape. virtual Pointer<CollisionShapeInstance> getInstance() const; private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Helper Methods /// Return the 'center' of the plane, the projection of the origin onto it. RIM_INLINE Vector3 getCenter() const { return -plane.offset*plane.normal; } /// Update the bounding sphere for this plane shape. RIM_INLINE void updateBoundingSphere() { this->setBoundingSphere( BoundingSphere( this->getCenter(), math::infinity<Real>() ) ); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Members /// The plane equation for this plane shape. Plane3 plane; }; //########################################################################################## //########################################################################################## //############ //############ Plane Shape Instance Class Definition //############ //########################################################################################## //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class which is used to instance a CollisionShapePlane object with an arbitrary rigid transformation. class CollisionShapePlane:: Instance : public CollisionShapeInstance { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Transform Update Method /// Update this plane instance with the specified 3D rigid transformation from shape to world space. /** * This method transforms this instance's plane equation from shape space to world space. */ virtual void setTransform( const Transform3& newTransform ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Attribute Accessor Methods /// Return the plane equation of this plane shape. RIM_INLINE const Plane3& getPlane() const { return plane; } /// Return the normal of this plane shape in shape space. RIM_INLINE const Vector3& getNormal() const { return plane.normal; } /// Return the offset of this plane shape in shape space. RIM_INLINE const Vector3& getOffset() const { return plane.normal; } private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Constructors /// Create a new plane shape instance which uses the specified base plane shape. RIM_INLINE Instance( const CollisionShapePlane* newPlane ) : CollisionShapeInstance( newPlane ) { this->updateBoundingSphere(); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Helper Methods /// Update the bounding sphere for this plane shape. RIM_INLINE void updateBoundingSphere() { this->setBoundingSphere( BoundingSphere( -plane.offset*plane.normal, math::infinity<Real>() ) ); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Members /// The plane equation of this plane shape. Plane3 plane; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Friend Declarations /// Declare the plane collision shape as a friend so that it can construct instances. friend class CollisionShapePlane; }; //########################################################################################## //************************ End Rim Physics Shapes Namespace ****************************** RIM_PHYSICS_SHAPES_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_PHYSICS_COLLISION_SHAPE_PLANE_H <file_sep>/* * rimPhysics.h * Rim Physics * * Created by <NAME> on 5/8/08. * Copyright 2008 Rim Software. All rights reserved. * */ #ifndef INCLUDE_RIM_PHYSICS_H #define INCLUDE_RIM_PHYSICS_H #include "physics/rimPhysicsConfig.h" #include "physics/rimPhysicsUtilities.h" #include "physics/rimPhysicsCollision.h" #include "physics/rimPhysicsForces.h" #include "physics/rimPhysicsObjects.h" #include "physics/rimPhysicsShapes.h" #include "physics/rimPhysicsConstraints.h" #include "physics/rimPhysicsScenes.h" #include "physics/rimPhysicsAssets.h" //########################################################################################## //*************************** Start Rim Physics Namespace ******************************** RIM_PHYSICS_NAMESPACE_START //****************************************************************************************** //########################################################################################## using namespace rim::physics::util; using namespace rim::physics::collision; using namespace rim::physics::forces; using namespace rim::physics::objects; using namespace rim::physics::shapes; using namespace rim::physics::scenes; using namespace rim::physics::constraints; using namespace rim::physics::assets; //########################################################################################## //*************************** End Rim Physics Namespace ********************************** RIM_PHYSICS_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_PHYSICS_H <file_sep>/* * rimGraphicsDepthMode.h * Rim Graphics * * Created by <NAME> on 3/13/13. * Copyright 2013 __MyCompanyName__. All rights reserved. * */ #ifndef INCLUDE_RIM_GRAPHICS_DEPTH_MODE_H #define INCLUDE_RIM_GRAPHICS_DEPTH_MODE_H #include "rimGraphicsUtilitiesConfig.h" #include "rimGraphicsDepthTest.h" //########################################################################################## //********************** Start Rim Graphics Utilities Namespace ************************** RIM_GRAPHICS_UTILITIES_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class which specifies how the depth buffer should be updated. class DepthMode { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructors /// Create a new depth mode with the default depth test parameters. /** * The default depth test is LESS_THAN_OR_EQUAL and the default depth * range is [0,1]. */ RIM_INLINE DepthMode() : test( DepthTest::LESS_THAN ), range( 0, 1 ) { } /// Create a new depth mode with the given depth test and default range of [0,1]. RIM_INLINE DepthMode( DepthTest newTest ) : test( newTest ), range( 0, 1 ) { } /// Create a new depth mode with the given depth test and range. RIM_INLINE DepthMode( DepthTest newTest, const AABB1f& newRange ) : test( newTest ), range( newRange ) { } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Blend Function Accessor Methods /// Return an object which describes the depth test used by this depth mode. RIM_INLINE const DepthTest& getTest() const { return test; } /// Set the depth test used by this depth mode. RIM_INLINE void setTest( const DepthTest& newTest ) { test = newTest; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constant Color Accessor Methods /// Return the output range of depth values which should be written to the depth buffer. /** * The range of this value should lie within the range [0,1]. This specifies * the range which normalized device coordiantes from [-1,1] should be mapped * to before depth values are written to the depth buffer. For instance, a range of * [0,0.5] means that depth values are in that range and only half of the depth * buffer's precision is used. */ RIM_INLINE const AABB1f& getRange() const { return range; } /// Set the output range of depth values which should be written to the depth buffer. /** * The range of this value should lie within the range [0,1]. This specifies * the range which normalized device coordiantes from [-1,1] should be mapped * to before depth values are written to the depth buffer. For instance, a range of * [0,0.5] means that depth values are in that range and only half of the depth * buffer's precision is used. */ RIM_INLINE void setRange( const AABB1f& newDepthRange ) { range = newDepthRange; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Comparison Operators /// Return whether or not this depth mode is equal to another depth mode. RIM_INLINE Bool operator == ( const DepthMode& other ) const { return test == other.test && range == other.range; } /// Return whether or not this depth mode is not equal to another depth mode. RIM_INLINE Bool operator != ( const DepthMode& other ) const { return !(*this == other); } private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Members /// An object which describes the test performed on new fragment when comparing it to the depth buffer. DepthTest test; /// The output range of depth values which should be written to the depth buffer. /** * The range of this value should lie within the range [0,1]. This specifies * the range which normalized device coordiantes from [-1,1] should be mapped * to before depth values are written to the depth buffer. For instance, a range of * [0,0.5] means that depth values are in that range and only half of the depth * buffer's precision is used. */ AABB1f range; }; //########################################################################################## //********************** End Rim Graphics Utilities Namespace **************************** RIM_GRAPHICS_UTILITIES_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_GRAPHICS_DEPTH_MODE_H <file_sep>/* * rimGUITextFieldDelegate.h * Rim GUI * * Created by <NAME> on 9/24/12. * Copyright 2012 __MyCompanyName__. All rights reserved. * */ #ifndef INCLUDE_RIM_GUI_TEXT_FIELD_DELEGATE_H #define INCLUDE_RIM_GUI_TEXT_FIELD_DELEGATE_H #include "rimGUIConfig.h" //########################################################################################## //*************************** Start Rim GUI Namespace ****************************** RIM_GUI_NAMESPACE_START //****************************************************************************************** //########################################################################################## class TextField; //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class which contains function objects that recieve text field events. /** * Any text field-related event that might be processed has an appropriate callback * function object. Each callback function is called by the GUI event thread * whenever such an event is received. If a callback function in the delegate * is not initialized, a text field simply ignores it. * * It must be noted that the callback functions are asynchronous and * not thread-safe. Thus, it is necessary to perform any additional synchronization * externally. */ class TextFieldDelegate { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Text Editing Callback Functions /// A function object which is called whenever the user changes the text in the text field. /** * Every time that the user presses a key or does anything to change the contents * of the text field, this method is called. */ Function<void ( TextField& )> edit; /// A function object which is called whenever the user is finished editing the text in a text field. /** * This method will be called whenever the user presses the return key or * removes focus from the text field, indicating that they are finished editing the field */ Function<void ( TextField& )> finishEdit; }; //########################################################################################## //*************************** End Rim GUI Namespace ******************************** RIM_GUI_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_GUI_TEXT_FIELD_DELEGATE_H <file_sep>/* * rimDataStore.h * Rim Framework * * Created by <NAME> on 6/4/13. * Copyright 2013 __MyCompanyName__. All rights reserved. * */ #ifndef INCLUDE_RIM_DATA_STORE_H #define INCLUDE_RIM_DATA_STORE_H #include "rimDataConfig.h" #include "rimData.h" #include "rimBasicString.h" #include "../util/rimHashMap.h" //########################################################################################## //******************************* Start Data Namespace ********************************* RIM_DATA_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A HashMap-based data structure which associates string keys with values of different types. /** * This class can be used to store arbitrary data in a dictionary format where * data values are stored and accessed using a string key. This can be used to * easily serialize an object's state to an intermediate format (the DataStore), * which can then be easily written to disc in an automated process. */ class DataStore { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructors /// Create a new empty data store. DataStore(); /// Create a copy of the specified data store, copying all of its internal data. DataStore( const DataStore& other ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Destructor /// Destroy the data store object, releasing all internal resources. /** * This destructor invalidates all iterators and pointers to internal * data. */ ~DataStore(); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Assignment Operator /// Assign the contents of another data store object to this one, replacing all previous contents. /** * The contents of the other data store are deep-copied to this data store. * This operator invalidates all iterators and pointers to internal data. */ DataStore& operator = ( const DataStore& other ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Size Accessor Methods /// Return the total number of key-value pairs that are stored in this DataStore. RIM_INLINE Size getSize() const { return entries.getSize(); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Entry Get Methods /// Return a pointer to the value stored in this data store associated with the given key. /** * This method attempts to access the value for the given key and template data * type. If the key does not have an associated value, or if the requested template * return type is not compatible with the stored value, the method returns a * NULL pointer. Otherwise, if the return value is non-NULL, the method succeeds. */ template < typename T > T* get( const String& key ); /// Return a const pointer to the value stored in this data store associated with the given key. /** * This method attempts to access the value for the given key and template data * type. If the key does not have an associated value, or if the requested template * return type is not compatible with the stored value, the method returns a * NULL pointer. Otherwise, if the return value is non-NULL, the method succeeds. */ template < typename T > const T* get( const String& key ) const; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Entry Set Methods /// Store the specified boolean value, associating it with the key string. Bool set( const String& key, Bool value ); /// Store the specified signed 32-bit integer, associating it with the key string. Bool set( const String& key, Int32 value ); /// Store the specified unsigned 32-bit integer, associating it with the key string. Bool set( const String& key, UInt32 value ); /// Store the specified signed 64-bit integer, associating it with the key string. Bool set( const String& key, Int64 value ); /// Store the specified unsigned 64-bit integer, associating it with the key string. Bool set( const String& key, UInt64 value ); /// Store the specified 32-bit floating point value, associating it with the key string. Bool set( const String& key, Float32 value ); /// Store the specified 64-bit floating point value, associating it with the key string. Bool set( const String& key, Float64 value ); /// Store the specified UTF-8 encoded string, associating it with the key string. Bool set( const String& key, const UTF8String& string ); /// Store the specified data object, associating it with the key string. Bool set( const String& key, const Data& data ); /// Store the specified array of bytes, associating it with the key string. /** * The specified number of bytes are copied from of the byte pointer and stored * internally. The method returns whether or not the operation was successful. * The method can fail if the byte pointer is NULL or if the number of bytes to * store is 0. */ Bool set( const String& key, const UByte* bytes, Size numBytes ); /// Store the specified DataStore object, associating it with the key string. /** * This method copies the specified DataStore object and all of its contents * to an internal location. This allows hierarchical structures to be created * using DataStore objects that can contain other DataStore objects. The method * returns whether or not the operation was successful. */ Bool set( const String& key, const DataStore& dataStore ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Entry Remove Methods /// Remove any data stored that is associated with the specified string key. /** * The method returns whether or not any stored entry for that key was removed successfully. */ Bool remove( const String& key ); /// Clear all of the previously stored contents from this data store. void clear(); private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Entry Class Declaration /// A class used to hold a single entry in a DataStore. class Entry; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Helper Methods /// Return a pointer to the entry associated with the specified key string, or NULL if there was none. Entry* getEntry( const String& key ); /// Return a const pointer to the entry associated with the specified key string, or NULL if there was none. const Entry* getEntry( const String& key ) const; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Members /// A hash map which is used to store the entries of this data store. util::HashMap<String,Entry> entries; }; //########################################################################################## //******************************* End Data Namespace *********************************** RIM_DATA_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_DATA_STORE_H <file_sep>/* * rimSoundSaturator.h * Rim Sound * * Created by <NAME> on 12/8/12. * Copyright 2012 __MyCompanyName__. All rights reserved. * */ #ifndef INCLUDE_RIM_SOUND_SATURATOR_H #define INCLUDE_RIM_SOUND_SATURATOR_H #include "rimSoundFiltersConfig.h" #include "rimSoundFilter.h" #include "rimSoundCutoffFilter.h" //########################################################################################## //************************ Start Rim Sound Filters Namespace ***************************** RIM_SOUND_FILTERS_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class that provides a way to saturate audio in a frequency-dependent manner. /** * A Saturator consists of a 2-way crossover which splits the input audio into * low and high-frequency bands. Each band can then be saturated using a soft-clipping * function independently before being added back together to produce the output. * * This effect can be used to fatten up and even out low frequencies with extra harmonics * without adding nasty distortion. It emulates tape saturation on each frequency band * independently, giving the user more control over the final sound. * * The saturator uses an all-pass Linwitz-Riley crossover to split the audio into * frequency bands. The saturator allows the low-frequency band to also be low-pass * filtered using half of the crossover filter, producing cleaner low-frequency * output. Since 2N-order Linkwitz-Riley crossovers are the same as two N-order * Butterworth filters in series, the crossover uses the first low pass filter to * fliter out the high frequencies, then uses the second one after saturation to * filter out unwanted harmonics added by the saturation, producing a (mostly) all-pass * result. */ class Saturator : public SoundFilter { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructors /// Create a new saturator filter with the default input and output gains of 1. Saturator(); /// Create an exact copy of another saturator. Saturator( const Saturator& other ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Destructor /// Destroy this saturator, releasing all associated resources. ~Saturator(); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Assignment Operator /// Assign the state of another saturator to this one. Saturator& operator = ( const Saturator& other ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Input Gain Accessor Methods /// Return the current linear input gain factor of this saturator filter. /** * This is the gain applied to the input signal before being sent to the * clipping function. A higher value will result in more noticeable clipping. */ RIM_INLINE Gain getInputGain() const { return targetInputGain; } /// Return the current input gain factor in decibels of this saturator filter. /** * This is the gain applied to the input signal before being sent to the * clipping function. A higher value will result in more noticeable clipping. */ RIM_INLINE Gain getInputGainDB() const { return util::linearToDB( targetInputGain ); } /// Set the target linear input gain for this saturator filter. /** * This is the gain applied to the input signal before being sent to the * clipping function. A higher value will result in more noticeable clipping. */ RIM_INLINE void setInputGain( Gain newInputGain ) { lockMutex(); targetInputGain = newInputGain; unlockMutex(); } /// Set the target input gain in decibels for this saturator filter. /** * This is the gain applied to the input signal before being sent to the * clipping function. A higher value will result in more noticeable clipping. */ RIM_INLINE void setInputGainDB( Gain newDBInputGain ) { lockMutex(); targetInputGain = util::dbToLinear( newDBInputGain ); unlockMutex(); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Output Gain Accessor Methods /// Return the current linear output gain factor of this saturator filter. /** * This is the gain applied to the signal after being sent to the * clipping function. This value is used to modify the final level * of the clipped signal. */ RIM_INLINE Gain getOutputGain() const { return targetOutputGain; } /// Return the current output gain factor in decibels of this saturator filter. /** * This is the gain applied to the signal after being sent to the * clipping function. This value is used to modify the final level * of the clipped signal. */ RIM_INLINE Gain getOutputGainDB() const { return util::linearToDB( targetOutputGain ); } /// Set the target linear output gain for this saturator filter. /** * This is the gain applied to the signal after being sent to the * clipping function. This value is used to modify the final level * of the clipped signal. */ RIM_INLINE void setOutputGain( Gain newOutputGain ) { lockMutex(); targetInputGain = newOutputGain; unlockMutex(); } /// Set the target output gain in decibels for this saturator filter. /** * This is the gain applied to the signal after being sent to the * clipping function. This value is used to modify the final level * of the clipped signal. */ RIM_INLINE void setOutputGainDB( Gain newDBOutputGain ) { lockMutex(); targetOutputGain = util::dbToLinear( newDBOutputGain ); unlockMutex(); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Crossover Filter Attribute Accessor Methods /// Return whether or not this saturator filter's crossover filter is enabled. RIM_INLINE Bool getCrossoverIsEnabled() const { return crossoverEnabled; } /// Set whether or not this saturator filter's crossover is enabled. RIM_INLINE void setCrossoverIsEnabled( Bool newCrossoverIsEnabled ) { lockMutex(); crossoverEnabled = newCrossoverIsEnabled; unlockMutex(); } /// Return the low pass filter frequency of this saturator filter. RIM_INLINE Float getCrossoverFrequency() const { return crossoverFrequency; } /// Set the crossover frequency of this saturator filter. /** * The default crossover frequency is 1000 Hz. * * The new crossover frequency is clamped to the range [0,infinity]. */ void setCrossoverFrequency( Float newCrossoverFrequency ) { lockMutex(); crossoverFrequency = math::max( newCrossoverFrequency, Float(0) ); unlockMutex(); } /// Return the filter order of this saturator filter's crossover. /** * This value determines the slope of the crossover transition, * with 6 dB/octave for each successive filter order. The default * crossover order is 4. */ RIM_INLINE Size getCrossoverOrder() const { return crossoverOrder; } /// Set the crossover filter order of this saturator filter. /** * This value determines the slope of the crossover transition, * with 6 dB/octave for each successive filter order. The default * crossover order is 4. * * Valid values are the even numbers 2, 4, 6, and 8. Other values * are clamped to the range [2,8] and rounded up to the next highest * even number. */ void setCrossoverOrder( Size newCrossoverOrder ) { lockMutex(); crossoverOrder = math::nextMultiple( math::clamp( newCrossoverOrder, Size(2), Size(8) ), Size(2) ); unlockMutex(); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Low Effect Enabled Accessor Methods /// Return whether or not the low frequency saturation effect is enabled. /** * If not enabled, the saturator just pass-throughs the low frequency audio. */ RIM_INLINE Bool getLowEffectIsEnabled() const { return lowEffectEnabled; } /// Set whether or not the low frequency saturation effect is enabled. /** * If not enabled, the saturator just pass-throughs the low frequency audio. */ RIM_INLINE void setLowEffectIsEnabled( Bool newLowEffectEnabled ) { lockMutex(); lowEffectEnabled = newLowEffectEnabled; unlockMutex(); } /// Return whether or not the low frequency saturation effect is enabled. RIM_INLINE Bool getLowFilterIsEnabled() const { return lowFilterEnabled; } /// Set whether or not the low frequency low pass filter is enabled. RIM_INLINE void setLowFilterIsEnabled( Bool newLowFilterEnabled ) { lockMutex(); lowFilterEnabled = newLowFilterEnabled; unlockMutex(); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Low Drive Accessor Methods /// Return the current linear input gain factor for the low frequencies of the saturator. /** * This is the gain applied to the low-frequency input signal before being sent to the * clipping function. A higher value will result in more noticeable clipping. */ RIM_INLINE Gain getLowDrive() const { return targetLowDrive; } /// Return the current input gain in decibels for the low frequencies of the saturator. /** * This is the gain applied to the low-frequency input signal before being sent to the * clipping function. A higher value will result in more noticeable clipping. */ RIM_INLINE Gain getLowDriveDB() const { return util::linearToDB( targetLowDrive ); } /// Set the current linear input gain factor for the low frequencies of the saturator. /** * This is the gain applied to the low-frequency input signal before being sent to the * clipping function. A higher value will result in more noticeable clipping. */ RIM_INLINE void setLowDrive( Gain newLowDrive ) { lockMutex(); targetLowDrive = newLowDrive; unlockMutex(); } /// Set the current input gain in decibels for the low frequencies of the saturator. /** * This is the gain applied to the low-frequency input signal before being sent to the * clipping function. A higher value will result in more noticeable clipping. */ RIM_INLINE void setLowDriveDB( Gain newDBLowDrive ) { lockMutex(); targetLowDrive = util::dbToLinear( newDBLowDrive ); unlockMutex(); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Low Gain Accessor Methods /// Return the current linear output gain factor for the low frequencies of the saturator. /** * This is the gain applied to the low-frequency signal after being sent to the * clipping function. */ RIM_INLINE Gain getLowGain() const { return targetLowOutputGain; } /// Return the current output gain in decibels for the low frequencies of the saturator. /** * This is the gain applied to the low-frequency signal after being sent to the * clipping function. */ RIM_INLINE Gain getLowGainDB() const { return util::linearToDB( targetLowOutputGain ); } /// Set the current linear output gain factor for the low frequencies of the saturator. /** * This is the gain applied to the low-frequency signal after being sent to the * clipping function. */ RIM_INLINE void setLowGain( Gain newLowGain ) { lockMutex(); targetLowOutputGain = newLowGain; unlockMutex(); } /// Set the current output gain in decibels for the low frequencies of the saturator. /** * This is the gain applied to the low-frequency signal after being sent to the * clipping function. */ RIM_INLINE void setLowGainDB( Gain newDBLowGain ) { lockMutex(); targetLowOutputGain = util::dbToLinear( newDBLowGain ); unlockMutex(); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** High Effect Enabled Accessor Methods /// Return whether or not the high frequency saturation effect is enabled. /** * If not enabled, the saturator just pass-throughs the high frequency audio. */ RIM_INLINE Bool getHighEffectIsEnabled() const { return highEffectEnabled; } /// Set whether or not the high frequency saturation effect is enabled. /** * If not enabled, the saturator just pass-throughs the high frequency audio. */ RIM_INLINE void setHighEffectIsEnabled( Bool newHighEffectEnabled ) { lockMutex(); highEffectEnabled = newHighEffectEnabled; unlockMutex(); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** High Drive Accessor Methods /// Return the current linear input gain factor for the high frequencies of the saturator. /** * This is the gain applied to the high-frequency input signal before being sent to the * clipping function. A higher value will result in more noticeable clipping. */ RIM_INLINE Gain getHighDrive() const { return targetHighDrive; } /// Return the current input gain in decibels for the high frequencies of the saturator. /** * This is the gain applied to the high-frequency input signal before being sent to the * clipping function. A higher value will result in more noticeable clipping. */ RIM_INLINE Gain getHighDriveDB() const { return util::linearToDB( targetHighDrive ); } /// Set the current linear input gain factor for the high frequencies of the saturator. /** * This is the gain applied to the high-frequency input signal before being sent to the * clipping function. A higher value will result in more noticeable clipping. */ RIM_INLINE void setHighDrive( Gain newLowDrive ) { lockMutex(); targetHighDrive = newLowDrive; unlockMutex(); } /// Set the current input gain in decibels for the high frequencies of the saturator. /** * This is the gain applied to the high-frequency input signal before being sent to the * clipping function. A higher value will result in more noticeable clipping. */ RIM_INLINE void setHighDriveDB( Gain newDBHighDrive ) { lockMutex(); targetHighDrive = util::dbToLinear( newDBHighDrive ); unlockMutex(); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** High Gain Accessor Methods /// Return the current linear output gain factor for the high frequencies of the saturator. /** * This is the gain applied to the high-frequency signal after being sent to the * clipping function. */ RIM_INLINE Gain getHighGain() const { return targetHighOutputGain; } /// Return the current output gain in decibels for the high frequencies of the saturator. /** * This is the gain applied to the high-frequency signal after being sent to the * clipping function. */ RIM_INLINE Gain getHighGainDB() const { return util::linearToDB( targetHighOutputGain ); } /// Set the current linear output gain factor for the high frequencies of the saturator. /** * This is the gain applied to the high-frequency signal after being sent to the * clipping function. */ RIM_INLINE void setHighGain( Gain newHighGain ) { lockMutex(); targetHighOutputGain = newHighGain; unlockMutex(); } /// Set the current output gain in decibels for the high frequencies of the saturator. /** * This is the gain applied to the high-frequency signal after being sent to the * clipping function. */ RIM_INLINE void setHighGainDB( Gain newDBHighGain ) { lockMutex(); targetHighOutputGain = util::dbToLinear( newDBHighGain ); unlockMutex(); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Low Pass Filter Attribute Accessor Methods /// Return whether or not this saturation filter's low pass filter is enabled. RIM_INLINE Bool getLowPassIsEnabled() const { return lowPassEnabled; } /// Set whether or not this saturation filter's low pass filter is enabled. RIM_INLINE void setLowPassIsEnabled( Bool newLowPassIsEnabled ) { lockMutex(); lowPassEnabled = newLowPassIsEnabled; unlockMutex(); } /// Return the low pass filter frequency of this saturation filter. RIM_INLINE Float getLowPassFrequency() const { return lowPassFrequency; } /// Set the low pass filter frequency of this saturation filter. /** * The new low pass frequency is clamped to the range [0,infinity]. */ RIM_INLINE void setLowPassFrequency( Float newLowPassFrequency ) { lockMutex(); lowPassFrequency = math::max( newLowPassFrequency, Float(0) ); unlockMutex(); } /// Return the low pass filter order of this saturation filter. RIM_INLINE Size getLowPassOrder() const { return lowPassOrder; } /// Set the low pass filter order of this saturation filter. /** * The new low pass order is clamped to the range [1,100]. */ RIM_INLINE void setLowPassOrder( Size newLowPassOrder ) { lockMutex(); lowPassOrder = math::clamp( newLowPassOrder, Size(1), Size(100) ); unlockMutex(); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Frequency Band Solo Accessor Methods /// Return whether or not the low frequency band is currently being soloed. RIM_INLINE Bool getLowsAreSoloed() const { return lowSolo; } /// Return whether or not the low frequency band is currently being soloed. RIM_INLINE void setLowsAreSoloed( Bool newLowsSoloed ) { lowSolo = newLowsSoloed; } /// Return whether or not the high frequency band is currently being soloed. RIM_INLINE Bool getHighsAreSoloed() const { return highSolo; } /// Return whether or not the high frequency band is currently being soloed. RIM_INLINE void setHighsAreSoloed( Bool newHighsSoloed ) { highSolo = newHighsSoloed; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Filter Attribute Accessor Methods /// Return a human-readable name for this saturator filter. /** * The method returns the string "Saturator". */ virtual UTF8String getName() const; /// Return the manufacturer name of this saturator filter. /** * The method returns the string "Headspace Sound". */ virtual UTF8String getManufacturer() const; /// Return an object representing the version of this saturator filter. virtual SoundFilterVersion getVersion() const; /// Return an object which describes the category of effect that this filter implements. /** * This method returns the value SoundFilterCategory::DISTORTION. */ virtual SoundFilterCategory getCategory() const; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Filter Parameter Accessor Methods /// Return the total number of generic accessible parameters this saturator filter has. virtual Size getParameterCount() const; /// Get information about the saturator filter parameter at the specified index. virtual Bool getParameterInfo( Index parameterIndex, FilterParameterInfo& info ) const; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Public Static Property Objects /// A string indicating the human-readable name of this saturator filter. static const UTF8String NAME; /// A string indicating the manufacturer name of this saturator filter. static const UTF8String MANUFACTURER; /// An object indicating the version of this saturator filter. static const SoundFilterVersion VERSION; private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Filter Parameter Value Accessor Methods /// Place the value of the parameter at the specified index in the output parameter. virtual Bool getParameterValue( Index parameterIndex, FilterParameter& value ) const; /// Attempt to set the parameter value at the specified index. virtual Bool setParameterValue( Index parameterIndex, const FilterParameter& value ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Stream Reset Method /// A method which is called whenever the filter's stream of audio is being reset. /** * This method allows the filter to reset all parameter interpolation * and processing to its initial state to avoid coloration from previous * audio or parameter values. */ virtual void resetStream(); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Filter Processing Methods /// Apply a saturator function to the samples in the input frame and write the output to the output frame. virtual SoundFilterResult processFrame( const SoundFilterFrame& inputFrame, SoundFilterFrame& outputFrame, Size numSamples ); /// Apply an interpolated gain to the specified input sound buffer and place the result in the output buffer. RIM_INLINE static void applyGain( const SoundBuffer& inputBuffer, SoundBuffer& outputBuffer, Size numSamples, Gain startingGain, Gain gainChangePerSample, Gain& finalGain ); /// Saturate the input buffer and place the result in the output buffer using the given parameters. RIM_INLINE static void saturate( const SoundBuffer& inputBuffer, SoundBuffer& outputBuffer, Size numSamples, Gain drive, Gain driveChangePerSample, Gain& finalDrive, Gain startingGain, Gain gainChangePerSample, Gain& finalGain ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Members /// A Butterworth low-pass filter which splits the low frequencies from the source audio before saturation. CutoffFilter preLowPass; /// A Butterworth low-pass filter which filters the output of the low frequency saturation. CutoffFilter postLowPass; /// The single Linkwitz-Riley high-pass filter which splits the high frequencies from the source audio. CutoffFilter highPass; /// A Butterworth low-pass filter which filters the output of the plugin. CutoffFilter* finalLowPass; /// The current linear input gain factor applied to all input audio before being clipped. Gain inputGain; /// The target linear input gain factor, used to smooth changes in the input gain. Gain targetInputGain; /// The current linear output gain factor applied to all output audio after being clipped. Gain outputGain; /// The target linear output gain factor, used to smooth changes in the output gain. Gain targetOutputGain; /// The current linear low-frequency gain factor applied before saturation. Gain lowDrive; /// The target linear low-frequency gain factor, used to smooth changes in the low drive. Gain targetLowDrive; /// The current linear low-frequency gain factor applied after saturation. Gain lowOutputGain; /// The target linear low-frequency gain factor, used to smooth changes in the low-frequency gain. Gain targetLowOutputGain; /// The current linear high-frequency gain factor applied before saturation. Gain highDrive; /// The target linear high-frequency gain factor, used to smooth changes in the high drive. Gain targetHighDrive; /// The current linear high-frequency gain factor applied after saturation. Gain highOutputGain; /// The target linear high-frequency gain factor, used to smooth changes in the high-frequency gain. Gain targetHighOutputGain; /// The split frequency of the crossover filter for the saturator. Float crossoverFrequency; /// The order of the saturator's crossover filter that determines its slope. Size crossoverOrder; /// The frequency at which the low pass filter for the saturator is at -3dB. Float lowPassFrequency; /// The order of the saturator's low pass filter that determines its slope. Size lowPassOrder; /// A boolean value indicating whether or not this saturator's low-pass filter is enabled. Bool lowPassEnabled; /// A boolean value indicating whether or not this saturator's low-frequency clipping effect is active. Bool lowEffectEnabled; /// A boolean value indicating whether or not the low frequencies are low pass filtered after saturation. Bool lowFilterEnabled; /// A boolean value indicating whether or not the low frequency band should be solo-d. Bool lowSolo; /// A boolean value indicating whether or not this saturator's high-frequency clipping effect is active. Bool highEffectEnabled; /// A boolean value indicating whether or not the low frequency band should be solo-d. Bool highSolo; /// A boolean value indicating whether or not this saturator's crossover is enabled. Bool crossoverEnabled; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Static Data Members /// The minimum allowed hardness for a distortion filter, 0. static const Float MIN_HARDNESS; /// The maximum allowed hardness for a distortion filter, a value close to 1. static const Float MAX_HARDNESS; }; //########################################################################################## //************************ End Rim Sound Filters Namespace ******************************* RIM_SOUND_FILTERS_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_SOUND_SATURATOR_H <file_sep>/* * rimGraphicsShaderPassAssetTranscoder.h * Rim Software * * Created by <NAME> on 6/14/14. * Copyright 2014 __MyCompanyName__. All rights reserved. * */ #ifndef INCLUDE_RIM_GRAPHICS_SHADER_PASS_ASSET_TRANSCODER_H #define INCLUDE_RIM_GRAPHICS_SHADER_PASS_ASSET_TRANSCODER_H #include "rimGraphicsAssetsConfig.h" #include "rimGraphicsShaderPassSourceAssetTranscoder.h" //########################################################################################## //*********************** Start Rim Graphics Assets Namespace **************************** RIM_GRAPHICS_ASSETS_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class which encodes and decodes graphics shader passes to the asset format. class GraphicsShaderPassAssetTranscoder : public AssetTypeTranscoder<GenericShaderPass> { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Destructor //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Text Encoding/Decoding Methods /// Decode an object from the specified string stream, returning a pointer to the final object. virtual Pointer<GenericShaderPass> decodeText( const AssetType& assetType, const AssetObject& assetObject, ResourceManager* resourceManager = NULL ); /// Encode an object of this asset type into a text-based format. virtual Bool encodeText( UTF8StringBuffer& buffer, ResourceManager* resourceManager, const GenericShaderPass& shaderPass ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Public Static Data Members /// An object indicating the asset type for a graphics shader pass. static const AssetType SHADER_PASS_ASSET_TYPE; private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Type Declarations /// An enum describing the fields that a graphics shader pass can have. typedef enum Field { /// An undefined field. UNDEFINED = 0, /// "name" The name of this shader pass. NAME, /// "usage" The semantic usage for the shader pass. USAGE, /// "sources" A list of the sources for this shader pass. SOURCES }; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Helper Methods /// Return an enum value indicating the field indicated by the given field name. static Field getFieldType( const AssetObject::String& name ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Members /// A temporary asset object used when parsing shader pass child objects. AssetObject tempObject; /// An object that encodes and decodes ShaderPassSource objects for this transcoder. GraphicsShaderPassSourceAssetTranscoder sourceTranscoder; }; //########################################################################################## //*********************** End Rim Graphics Assets Namespace ****************************** RIM_GRAPHICS_ASSETS_NAMESPACE_END //****************************************************************************************** //########################################################################################## //########################################################################################## //**************************** Start Rim Assets Namespace ******************************** RIM_ASSETS_NAMESPACE_START //****************************************************************************************** //########################################################################################## template <> RIM_INLINE const AssetType& AssetType::of<rim::graphics::shaders::GenericShaderPass>() { return rim::graphics::assets::GraphicsShaderPassAssetTranscoder::SHADER_PASS_ASSET_TYPE; } //########################################################################################## //**************************** End Rim Assets Namespace ********************************** RIM_ASSETS_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_GRAPHICS_SHADER_PASS_ASSET_TRANSCODER_H <file_sep>/* * rimPhysicsCollisionAlgorithmFunction.h * Rim Physics * * Created by <NAME> on 7/6/12. * Copyright 2012 __MyCompanyName__. All rights reserved. * */ #ifndef INCLUDE_RIM_PHYSICS_COLLISION_ALGORITHM_FUNCTION_H #define INCLUDE_RIM_PHYSICS_COLLISION_ALGORITHM_FUNCTION_H #include "rimPhysicsCollisionConfig.h" #include "rimPhysicsCollisionAlgorithmBase.h" //########################################################################################## //********************** Start Rim Physics Collision Namespace *************************** RIM_PHYSICS_COLLISION_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class which detects collisions between two Rigid Objects using a function-based test. template < typename ShapeType1, typename ShapeType2, typename ShapeInstanceType1, typename ShapeInstanceType2, Bool (*getIntersectionPoint)( const ShapeInstanceType1*, const ShapeInstanceType2*, IntersectionPoint& points ) > class CollisionAlgorithmFunction : public CollisionAlgorithmBase<RigidObject,RigidObject,ShapeType1,ShapeType2> { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Collision Detection Method /// Test the specified object pair for collisions and add the results to the result set. /** * If a collision occurred, TRUE is returned and the resulting CollisionPoint(s) * are added to the CollisionManifold for the object pair in the specified * CollisionResultSet. If there was no collision detected, FALSE is returned * and the result set is unmodified. */ virtual Bool testForCollisions( const ObjectCollider<RigidObject>& collider1, const ObjectCollider<RigidObject>& collider2, CollisionResultSet<RigidObject,RigidObject>& resultSet ) { const RigidObject* object1 = collider1.getObject(); const ShapeInstanceType1* shape1 = (const ShapeInstanceType1*)collider1.getShape(); const RigidObject* object2 = collider2.getObject(); const ShapeInstanceType2* shape2 = (const ShapeInstanceType2*)collider2.getShape(); if ( getIntersectionPoint( shape1, shape2, point ) ) { // Get the collision manifold for these objects. CollisionManifold& manifold = resultSet.addManifold( object1, object2 ); manifold.addPoint( CollisionPoint( object1->getTransform().transformToObjectSpace( point.point1 ), object2->getTransform().transformToObjectSpace( point.point2 ), point.point1, point.point2, point.normal, -point.penetrationDistance, CollisionShapeMaterial( shape1->getMaterial(), shape2->getMaterial() ) ) ); return true; } return false; } private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Members /// A point used to hold temporary contact points between shapes. IntersectionPoint point; }; //########################################################################################## //********************** End Rim Physics Collision Namespace ***************************** RIM_PHYSICS_COLLISION_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_PHYSICS_COLLISION_ALGORITHM_FUNCTION_H <file_sep>/* * rimGraphicsOpenGLDevice.h * Rim Graphics * * Created by <NAME> on 3/1/13. * Copyright 2013 __MyCompanyName__. All rights reserved. * */ #ifndef INCLUDE_RIM_GRAPHICS_OPENGL_DEVICE_H #define INCLUDE_RIM_GRAPHICS_OPENGL_DEVICE_H #include "rimGraphicsOpenGLConfig.h" //########################################################################################## //******************** Start Rim Graphics Devices OpenGL Namespace *********************** RIM_GRAPHICS_DEVICES_OPENGL_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class which represents an interface to an OpenGL device driver. /** * This class allows the user to create OpenGL contexts for an OpenGL device * which can then be used for rendering. */ class OpenGLDevice : public GraphicsDevice { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Context Creation Method /// Create a new context for this graphics device with the specified framebuffer pixel format and flags. virtual Pointer<GraphicsContext> createContext( const Pointer<RenderView>& targetView, const RenderedPixelFormat& pixelFormat, const GraphicsContextFlags& flags ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Device Capabilities Accessor Methods /// Return whether or not the specified pixel format and flags are supported by this device. virtual Bool checkFormat( RenderedPixelFormat& pixelFormat, GraphicsContextFlags& flags, Bool strict = false ) const; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Type Accessor Method /// Return an object which indicates the type of this graphics device. virtual GraphicsDeviceType getType() const; private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Helper Methods }; //########################################################################################## //******************** End Rim Graphics Devices OpenGL Namespace ************************* RIM_GRAPHICS_DEVICES_OPENGL_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_GRAPHICS_OPENGL_DEVICE_H <file_sep>/* * rimPrintStream.h * Rim IO * * Created by <NAME> on 3/18/08. * Copyright 2008 __MyCompanyName__. All rights reserved. * */ #ifndef INCLUDE_RIM_PRINT_STREAM_H #define INCLUDE_RIM_PRINT_STREAM_H #include "rimIOConfig.h" #include "rimStringOutputStream.h" //########################################################################################## //****************************** Start Rim IO Namespace ********************************** RIM_IO_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class that allows the user to print messages/data to standard output. /** * It is essentially a wrapper for C standard output (to the console) * that implements the OutputStream interface, allowing it to be used in * applications that are not standard out specific. For instance, * a class such as Log outputs messages to a OutputStream. If one * wanted to print out messages to standard output, they would have * the log use a PrintStream (the default), or possibly a FileWriter. * both classes implement OutputStream's pure virtual methods and allow * Log to dump to a file or to standard output. */ class PrintStream : public StringOutputStream { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructor /// Create a print stream to standard ouput. RIM_INLINE PrintStream() { } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Flush Method /// Flush the print stream, sending all internally buffered output to standard output. /** * This method causes all currently pending output data to be sent to * C standard output. This method ensures that this is done and that all internal * data buffers are emptied if they have any contents. */ virtual void flush(); protected: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Protected String Write Methods /// Write the specified number of characters from the character buffer and return the number written. virtual Size writeChars( const Char* characters, Size number ); /// Write the specified number of UTF-8 characters from the character buffer and return the number written. virtual Size writeUTF8Chars( const UTF8Char* characters, Size number ); /// Write the specified number of UTF-16 characters from the character buffer and return the number written. virtual Size writeUTF16Chars( const UTF16Char* characters, Size number ); /// Write the specified number of UTF-32 characters from the character buffer and return the number written. virtual Size writeUTF32Chars( const UTF32Char* characters, Size number ); }; //########################################################################################## //****************************** End Rim IO Namespace ************************************ RIM_IO_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_PRINT_STREAM_H <file_sep>/* * rimSIMDScalarInt64_2.h * Rim Software * * Created by <NAME> on 9/21/14. * Copyright 2014 __MyCompanyName__. All rights reserved. * */ #ifndef INCLUDE_RIM_SIMD_SCALAR_INT_64_2_H #define INCLUDE_RIM_SIMD_SCALAR_INT_64_2_H #include "rimMathConfig.h" #include "rimSIMDScalar.h" //########################################################################################## //***************************** Start Rim Math Namespace ********************************* RIM_MATH_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class representing a 4-component 32-bit floating-point SIMD scalar. /** * This specialization of the SIMDScalar class uses a 128-bit value to encode * 4 32-bit floating-point values. All basic arithmetic operations are supported, * plus a subset of standard scalar operations: abs(), min(), max(), sqrt(). */ template <> class RIM_ALIGN(16) SIMDScalar<Int64,2> { private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Type Declarations /// Define the type for a 2x double scalar structure. #if RIM_USE_SIMD && defined(RIM_SIMD_SSE) && RIM_SSE_VERSION_IS_SUPPORTED(2,0) typedef __m128d SIMDDouble; typedef __m128i SIMDInt64; #endif //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Constructor #if RIM_USE_SIMD && (defined(RIM_SIMD_SSE) && RIM_SSE_VERSION_IS_SUPPORTED(2,0)) /// Create a new 2D scalar with the specified 2D SIMD scalar value. RIM_FORCE_INLINE SIMDScalar( SIMDInt64 simdScalar ) : v( simdScalar ) { } /// Create a new 2D scalar with the specified 2D SIMD scalar value. RIM_FORCE_INLINE SIMDScalar( SIMDDouble simdScalar ) : vDouble( simdScalar ) { } #endif public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructors /// Create a new 2D SIMD scalar with all elements left uninitialized. RIM_FORCE_INLINE SIMDScalar() { } /// Create a new 2D SIMD scalar with all elements equal to the specified value. RIM_FORCE_INLINE SIMDScalar( Int64 value ) { #if RIM_USE_SIMD && defined(RIM_SIMD_SSE) && RIM_SSE_VERSION_IS_SUPPORTED(2,0) #if defined(RIM_PLATFORM_64_BIT) v = _mm_set1_epi64x( value ); #else a = b = value; #endif #else a = b = value; #endif } /// Create a new 2D SIMD scalar with the elements equal to the specified 2 values. RIM_FORCE_INLINE SIMDScalar( Int64 newA, Int64 newB ) { #if RIM_USE_SIMD && defined(RIM_SIMD_SSE) && RIM_SSE_VERSION_IS_SUPPORTED(2,0) // The parameters are reversed to keep things consistent with loading from an address. #if defined(RIM_PLATFORM_64_BIT) v = _mm_set_epi64x( newB, newA ); #else a = newA; b = newB; #endif #else a = newA; b = newB; #endif } /// Create a new 2D SIMD scalar from the first 4 values stored at specified pointer's location. RIM_FORCE_INLINE SIMDScalar( const Int64* array ) { #if RIM_USE_SIMD && defined(RIM_SIMD_SSE) && RIM_SSE_VERSION_IS_SUPPORTED(2,0) v = _mm_load_si128( (const SIMDInt64*)array ); #else a = array[0]; b = array[1]; #endif } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Copy Constructor /// Create a new SIMD scalar with the same contents as another. /** * This shouldn't have to be overloaded, but for some reason the compiler (GCC) * optimizes SIMD code better with it overloaded. Before, the compiler would * store the result of a SIMD operation on the stack before transfering it to * the destination, resulting in an extra 8+ load/stores per computation. */ RIM_FORCE_INLINE SIMDScalar( const SIMDScalar& other ) { #if RIM_USE_SIMD && defined(RIM_SIMD_SSE) && RIM_SSE_VERSION_IS_SUPPORTED(2,0) v = other.v; #else a = other.a; b = other.b; #endif } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Assignment Operator /// Assign the contents of one SIMDScalar object to another. /** * This shouldn't have to be overloaded, but for some reason the compiler (GCC) * optimizes SIMD code better with it overloaded. Before, the compiler would * store the result of a SIMD operation on the stack before transfering it to * the destination, resulting in an extra 8+ load/stores per computation. */ RIM_FORCE_INLINE SIMDScalar& operator = ( const SIMDScalar& other ) { #if RIM_USE_SIMD && defined(RIM_SIMD_SSE) && RIM_SSE_VERSION_IS_SUPPORTED(2,0) v = other.v; #else a = other.a; b = other.b; #endif return *this; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Load Methods RIM_FORCE_INLINE static SIMDScalar load( const Int64* array ) { #if RIM_USE_SIMD && defined(RIM_SIMD_SSE) && RIM_SSE_VERSION_IS_SUPPORTED(2,0) return SIMDScalar( _mm_load_pd( (const Float64*)array ) ); #else return SIMDScalar( array[0], array[1], array[2], array[3] ); #endif } RIM_FORCE_INLINE static SIMDScalar loadUnaligned( const Int64* array ) { #if RIM_USE_SIMD && defined(RIM_SIMD_SSE) && RIM_SSE_VERSION_IS_SUPPORTED(2,0) return SIMDScalar( _mm_loadu_pd( (const Float64*)array ) ); #else return SIMDScalar( array[0], array[1] ); #endif } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Store Methods RIM_FORCE_INLINE void store( Int64* destination ) const { #if RIM_USE_SIMD && defined(RIM_SIMD_SSE) && RIM_SSE_VERSION_IS_SUPPORTED(2,0) _mm_store_pd( (Float64*)destination, vDouble ); #else destination[0] = a; destination[1] = b; #endif } RIM_FORCE_INLINE void storeUnaligned( Int64* destination ) const { #if RIM_USE_SIMD && defined(RIM_SIMD_SSE) && RIM_SSE_VERSION_IS_SUPPORTED(2,0) _mm_storeu_pd( (Float64*)destination, vDouble ); #else destination[0] = a; destination[1] = b; #endif } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Accessor Methods /// Get a reference to the value stored at the specified component index in this scalar. RIM_FORCE_INLINE Int64& operator [] ( Index i ) { return x[i]; } /// Get the value stored at the specified component index in this scalar. RIM_FORCE_INLINE Int64 operator [] ( Index i ) const { return x[i]; } /// Get a pointer to the first element in this scalar. /** * The remaining values are in the next 3 locations after the * first element. */ RIM_FORCE_INLINE const Int64* toArray() const { return x; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Logical Operators /// Return the bitwise NOT of this 4D SIMD vector. RIM_FORCE_INLINE SIMDScalar operator ~ () const { #if RIM_USE_SIMD && defined(RIM_SIMD_SSE) && RIM_SSE_VERSION_IS_SUPPORTED(2,0) return SIMDScalar( _mm_xor_si128( v, _mm_set1_epi32( 0xFFFFFFFF ) ) ); #else return SIMDScalar( ~a, ~b ); #endif } /// Compute the bitwise AND of this 4D SIMD vector with another and return the result. RIM_FORCE_INLINE SIMDScalar operator & ( const SIMDScalar& vector ) const { #if RIM_USE_SIMD && defined(RIM_SIMD_SSE) && RIM_SSE_VERSION_IS_SUPPORTED(2,0) return SIMDScalar( _mm_and_si128( v, vector.v ) ); #else return SIMDScalar( a & vector.a, b & vector.b ); #endif } /// Compute the bitwise OR of this 4D SIMD vector with another and return the result. RIM_FORCE_INLINE SIMDScalar operator | ( const SIMDScalar& vector ) const { #if RIM_USE_SIMD && defined(RIM_SIMD_SSE) && RIM_SSE_VERSION_IS_SUPPORTED(2,0) return SIMDScalar( _mm_or_si128( v, vector.v ) ); #else return SIMDScalar( a | vector.a, b | vector.b ); #endif } /// Compute the bitwise XOR of this 4D SIMD vector with another and return the result. RIM_FORCE_INLINE SIMDScalar operator ^ ( const SIMDScalar& vector ) const { #if RIM_USE_SIMD && defined(RIM_SIMD_SSE) && RIM_SSE_VERSION_IS_SUPPORTED(2,0) return SIMDScalar( _mm_xor_si128( v, vector.v ) ); #else return SIMDScalar( a ^ vector.a, b ^ vector.b ); #endif } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Logical Assignment Operators /// Compute the logical AND of this 4D SIMD vector with another and assign it to this vector. RIM_FORCE_INLINE SIMDScalar& operator &= ( const SIMDScalar& vector ) { #if RIM_USE_SIMD && defined(RIM_SIMD_SSE) && RIM_SSE_VERSION_IS_SUPPORTED(2,0) v = _mm_and_si128( v, vector.v ); #else a &= vector.a; b &= vector.b; #endif return *this; } /// Compute the logical OR of this 4D SIMD vector with another and assign it to this vector. RIM_FORCE_INLINE SIMDScalar& operator |= ( const SIMDScalar& vector ) { #if RIM_USE_SIMD && defined(RIM_SIMD_SSE) && RIM_SSE_VERSION_IS_SUPPORTED(2,0) v = _mm_or_si128( v, vector.v ); #else a |= vector.a; b |= vector.b; #endif return *this; } /// Compute the bitwise XOR of this 4D SIMD vector with another and assign it to this vector. RIM_FORCE_INLINE SIMDScalar& operator ^= ( const SIMDScalar& vector ) { #if RIM_USE_SIMD && defined(RIM_SIMD_SSE) && RIM_SSE_VERSION_IS_SUPPORTED(2,0) v = _mm_xor_si128( v, vector.v ); #else a ^= vector.a; b ^= vector.b; #endif return *this; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Comparison Operators /// Compare two 2D SIMD scalars component-wise for equality. /** * Return a 2D scalar of integers indicating the result of the comparison. * If each corresponding pair of components is equal, the corresponding result * component is non-zero. Otherwise, that result component is equal to zero. */ RIM_FORCE_INLINE SIMDScalar operator == ( const SIMDScalar& scalar ) const { #if RIM_USE_SIMD && defined(RIM_SIMD_SSE) && RIM_SSE_VERSION_IS_SUPPORTED(2,0) return SIMDScalar( _mm_cmpeq_pd( vDouble, scalar.vDouble ) ); #else return SIMDScalar( a == scalar.a, b == scalar.b ); #endif } /// Compare this scalar to a single floating point value for equality. /** * Return a 2D scalar of integers indicating the result of the comparison. * The float value is expanded to a 4-wide SIMD scalar and compared with this scalar. * If each corresponding pair of components is equal, the corresponding result * component is non-zero. Otherwise, that result component is equal to zero. */ RIM_FORCE_INLINE SIMDScalar operator == ( const Int64 value ) const { #if RIM_USE_SIMD && defined(RIM_SIMD_SSE) && RIM_SSE_VERSION_IS_SUPPORTED(2,0) return SIMDScalar( _mm_cmpeq_pd( vDouble, _mm_set1_pd( *(const Float64*)&value ) ) ); #else return SIMDScalar( a == value, b == value ); #endif } /// Compare two 2D SIMD scalars component-wise for inequality /** * Return a 2D scalar of integers indicating the result of the comparison. * If each corresponding pair of components is not equal, the corresponding result * component is non-zero. Otherwise, that result component is equal to zero. */ RIM_FORCE_INLINE SIMDScalar operator != ( const SIMDScalar& scalar ) const { #if RIM_USE_SIMD && defined(RIM_SIMD_SSE) && RIM_SSE_VERSION_IS_SUPPORTED(2,0) return SIMDScalar( _mm_cmpneq_pd( vDouble, scalar.vDouble ) ); #else return SIMDScalar( a != scalar.a, b != scalar.b ); #endif } /// Compare this scalar to a single floating point value for inequality. /** * Return a 2D scalar of integers indicating the result of the comparison. * The float value is expanded to a 4-wide SIMD scalar and compared with this scalar. * If each corresponding pair of components is not equal, the corresponding result * component is non-zero. Otherwise, that result component is equal to zero. */ RIM_FORCE_INLINE SIMDScalar operator != ( const Int64 value ) const { #if RIM_USE_SIMD && defined(RIM_SIMD_SSE) && RIM_SSE_VERSION_IS_SUPPORTED(2,0) return SIMDScalar( _mm_cmpneq_pd( vDouble, _mm_set1_pd( *(const Float64*)&value ) ) ); #else return SIMDScalar( a != value, b != value ); #endif } /// Perform a component-wise less-than comparison between this and another 2D SIMD scalar. /** * Return a 2D scalar of integers indicating the result of the comparison. * If each corresponding pair of components has this scalar's component less than * the other scalar's component, the corresponding result component is non-zero. * Otherwise, that result component is equal to zero. */ RIM_FORCE_INLINE SIMDScalar operator < ( const SIMDScalar& scalar ) const {/* #if RIM_USE_SIMD && defined(RIM_SIMD_SSE) && RIM_SSE_VERSION_IS_SUPPORTED(2,0) return SIMDScalar( _mm_cmplt_epi64( v, scalar.v ) ); #else*/ return SIMDScalar( a < scalar.a, b < scalar.b ); //#endif } /// Perform a component-wise less-than comparison between this 2D SIMD scalar and an expanded scalar. /** * Return a 2D scalar of integers indicating the result of the comparison. * The float value is expanded to a 4-wide SIMD scalar and compared with this scalar. * If each corresponding pair of components has this scalar's component less than * the other scalar's component, the corresponding result component is non-zero. * Otherwise, that result component is equal to zero. */ RIM_FORCE_INLINE SIMDScalar operator < ( const Int64 value ) const {/* #if RIM_USE_SIMD && defined(RIM_SIMD_SSE) && RIM_SSE_VERSION_IS_SUPPORTED(2,0) return SIMDScalar( _mm_cmplt_epi64( v, _mm_set1_epi64( __m64(value) ) ) ); #else*/ return SIMDScalar( a < value, b < value ); //#endif } /// Perform a component-wise greater-than comparison between this an another 2D SIMD scalar. /** * Return a 2D scalar of integers indicating the result of the comparison. * If each corresponding pair of components has this scalar's component greater than * the other scalar's component, the corresponding result component is non-zero. * Otherwise, that result component is equal to zero. */ RIM_FORCE_INLINE SIMDScalar operator > ( const SIMDScalar& scalar ) const {/* #if RIM_USE_SIMD && defined(RIM_SIMD_SSE) && RIM_SSE_VERSION_IS_SUPPORTED(2,0) return SIMDScalar( _mm_cmpgt_epi64( v, scalar.v ) ); #else*/ return SIMDScalar( a > scalar.a, b > scalar.b ); //#endif } /// Perform a component-wise greater-than comparison between this 2D SIMD scalar and an expanded scalar. /** * Return a 2D scalar of integers indicating the result of the comparison. * The float value is expanded to a 4-wide SIMD scalar and compared with this scalar. * If each corresponding pair of components has this scalar's component greater than * the other scalar's component, the corresponding result component is non-zero. * Otherwise, that result component is equal to zero. */ RIM_FORCE_INLINE SIMDScalar operator > ( const Int64 value ) const {/* #if RIM_USE_SIMD && defined(RIM_SIMD_SSE) && RIM_SSE_VERSION_IS_SUPPORTED(2,0) return SIMDScalar( _mm_cmpgt_epi64( v, _mm_set1_epi64( __m64(value) ) ) ); #else*/ return SIMDScalar( a > value, b > value ); //#endif } /// Perform a component-wise less-than-or-equal-to comparison between this an another 2D SIMD scalar. /** * Return a 2D scalar of integers indicating the result of the comparison. * If each corresponding pair of components has this scalar's component less than * or equal to the other scalar's component, the corresponding result component is non-zero. * Otherwise, that result component is equal to zero. */ RIM_FORCE_INLINE SIMDScalar operator <= ( const SIMDScalar& scalar ) const {/* #if RIM_USE_SIMD && defined(RIM_SIMD_SSE) && RIM_SSE_VERSION_IS_SUPPORTED(2,0) return SIMDScalar( _mm_or_pd( _mm_cmplt_epi64( v, scalar.v ), _mm_cmpeq_pd( vDouble, scalar.vDouble ) ) ); #else*/ return SIMDScalar( a <= scalar.a, b <= scalar.b ); //#endif } /// Perform a component-wise less-than-or-equal-to comparison between this 2D SIMD scalar and an expanded scalar. /** * Return a 2D scalar of integers indicating the result of the comparison. * The float value is expanded to a 4-wide SIMD scalar and compared with this scalar. * If each corresponding pair of components has this scalar's component less than * or equal to the other scalar's component, the corresponding result component is non-zero. * Otherwise, that result component is equal to zero. */ RIM_FORCE_INLINE SIMDScalar operator <= ( const Int64 value ) const {/* #if RIM_USE_SIMD && defined(RIM_SIMD_SSE) && RIM_SSE_VERSION_IS_SUPPORTED(2,0) return SIMDScalar( _mm_or_pd( _mm_cmplt_epi64( v, _mm_set1_epi64( __m64(value) ) ), _mm_cmpeq_pd( vDouble, _mm_set1_epi64( __m64(value) ) ) ); #else*/ return SIMDScalar( a <= value, b <= value ); //#endif } /// Perform a component-wise greater-than-or-equal-to comparison between this an another 2D SIMD scalar. /** * Return a 2D scalar of integers indicating the result of the comparison. * If each corresponding pair of components has this scalar's component greater than * or equal to the other scalar's component, the corresponding result component is non-zero. * Otherwise, that result component is equal to zero. */ RIM_FORCE_INLINE SIMDScalar operator >= ( const SIMDScalar& scalar ) const {/* #if RIM_USE_SIMD && defined(RIM_SIMD_SSE) && RIM_SSE_VERSION_IS_SUPPORTED(2,0) return SIMDScalar( _mm_or_pd( _mm_cmpgt_epi64( v, scalar.v ), _mm_cmpeq_pd( vDouble, scalar.vDouble ) ) ); #else*/ return SIMDScalar( a <= scalar.a, b <= scalar.b ); //#endif } /// Perform a component-wise greater-than-or-equal-to comparison between this 2D SIMD scalar and an expanded scalar. /** * Return a 2D scalar of integers indicating the result of the comparison. * The float value is expanded to a 4-wide SIMD scalar and compared with this scalar. * If each corresponding pair of components has this scalar's component greater than * or equal to the other scalar's component, the corresponding result component is non-zero. * Otherwise, that result component is equal to zero. */ RIM_FORCE_INLINE SIMDScalar operator >= ( const Int64 value ) const {/* #if RIM_USE_SIMD && defined(RIM_SIMD_SSE) && RIM_SSE_VERSION_IS_SUPPORTED(2,0) return SIMDScalar( _mm_or_pd( _mm_cmpgt_epi64( v, _mm_set1_epi64( __m64(value) ) ), _mm_cmpeq_pd( vDouble, _mm_set1_epi64( __m64(value) ) ) ); #else*/ return SIMDScalar( a >= value, b >= value ); //#endif } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Shifting Operators /// Shift each component of the SIMD scalar to the left by the specified amount of bits. /** * This method shifts the contents of each component to the left by the specified * amount of bits and inserts zeros. * * @param bitShift - the number of bits to shift this SIMD scalar by. * @return the shifted SIMD scalar. */ RIM_FORCE_INLINE SIMDScalar operator << ( Int32 bitShift ) const { #if RIM_USE_SIMD && defined(RIM_SIMD_SSE) && RIM_SSE_VERSION_IS_SUPPORTED(2,0) return SIMDScalar( _mm_slli_epi64( v, bitShift ) ); #else return SIMDScalar( a << bitShift, b << bitShift, c << bitShift, d << bitShift ); #endif } /// Shift each component of the SIMD scalar to the right by the specified amount of bits. /** * This method shifts the contents of each component to the right by the specified * amount of bits and sign extends the original values.. * * @param bitShift - the number of bits to shift this SIMD scalar by. * @return the shifted SIMD scalar. */ RIM_FORCE_INLINE SIMDScalar operator >> ( Int32 bitShift ) const { #if RIM_USE_SIMD && defined(RIM_SIMD_SSE) && RIM_SSE_VERSION_IS_SUPPORTED(2,0) return SIMDScalar( _mm_sub_epi64( _mm_setzero_si128(), _mm_srli_epi64( v, bitShift ) ) ); #else return SIMDScalar( a >> bitShift, b >> bitShift, c >> bitShift, d >> bitShift ); #endif } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Negation/Positivation Operators /// Negate a scalar. /** * This method negates every component of this 2D SIMD scalar * and returns the result, leaving this scalar unmodified. * * @return the negation of the original scalar. */ RIM_FORCE_INLINE SIMDScalar operator - () const { #if RIM_USE_SIMD && defined(RIM_SIMD_SSE) && RIM_SSE_VERSION_IS_SUPPORTED(2,0) return SIMDScalar( _mm_sub_epi64( _mm_setzero_si128(), v ) ); #else return SIMDScalar( -a, -b ); #endif } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Arithmetic Operators /// Add this scalar to another and return the result. /** * This method adds another scalar to this one, component-wise, * and returns this addition. It does not modify either of the original * scalars. * * @param scalar - The scalar to add to this one. * @return The addition of this scalar and the parameter. */ RIM_FORCE_INLINE SIMDScalar operator + ( const SIMDScalar& scalar ) const { #if RIM_USE_SIMD && defined(RIM_SIMD_SSE) && RIM_SSE_VERSION_IS_SUPPORTED(2,0) return SIMDScalar( _mm_add_epi64( v, scalar.v ) ); #else return SIMDScalar( a + scalar.a, b + scalar.b ); #endif } /// Add a value to every component of this scalar. /** * This method adds the value parameter to every component * of the scalar, and returns a scalar representing this result. * It does not modifiy the original scalar. * * @param value - The value to add to all components of this scalar. * @return The resulting scalar of this addition. */ RIM_FORCE_INLINE SIMDScalar operator + ( const Int64 value ) const { #if RIM_USE_SIMD && defined(RIM_SIMD_SSE) && RIM_SSE_VERSION_IS_SUPPORTED(2,0) #if defined(RIM_PLATFORM_64_BIT) return SIMDScalar( _mm_add_epi64( v, _mm_set1_epi64x( value ) ) ); #else return SIMDScalar( a + value, b + value ); #endif #else return SIMDScalar( a + value, b + value ); #endif } /// Subtract a scalar from this scalar component-wise and return the result. /** * This method subtracts another scalar from this one, component-wise, * and returns this subtraction. It does not modify either of the original * scalars. * * @param scalar - The scalar to subtract from this one. * @return The subtraction of the the parameter from this scalar. */ RIM_FORCE_INLINE SIMDScalar operator - ( const SIMDScalar& scalar ) const { #if RIM_USE_SIMD && defined(RIM_SIMD_SSE) && RIM_SSE_VERSION_IS_SUPPORTED(2,0) return SIMDScalar( _mm_sub_epi64( v, scalar.v ) ); #else return SIMDScalar( a - scalar.a, b - scalar.b ); #endif } /// Subtract a value from every component of this scalar. /** * This method subtracts the value parameter from every component * of the scalar, and returns a scalar representing this result. * It does not modifiy the original scalar. * * @param value - The value to subtract from all components of this scalar. * @return The resulting scalar of this subtraction. */ RIM_FORCE_INLINE SIMDScalar operator - ( const Int64 value ) const { #if RIM_USE_SIMD && defined(RIM_SIMD_SSE) && RIM_SSE_VERSION_IS_SUPPORTED(2,0) #if defined(RIM_PLATFORM_64_BIT) return SIMDScalar( _mm_sub_epi64( v, _mm_set1_epi64x( value ) ) ); #else return SIMDScalar( a - value, b - value ); #endif #else return SIMDScalar( a - value, b - value ); #endif } /// Multiply component-wise this scalar and another scalar. /** * This operator multiplies each component of this scalar * by the corresponding component of the other scalar and * returns a scalar representing this result. It does not modify * either original scalar. * * @param scalar - The scalar to multiply this scalar by. * @return The result of the multiplication. */ RIM_FORCE_INLINE SIMDScalar operator * ( const SIMDScalar& scalar ) const { return SIMDScalar( a*scalar.a, b*scalar.b ); } /// Multiply every component of this scalar by a value and return the result. /** * This method multiplies the value parameter with every component * of the scalar, and returns a scalar representing this result. * It does not modifiy the original scalar. * * @param value - The value to multiplly with all components of this scalar. * @return The resulting scalar of this multiplication. */ RIM_FORCE_INLINE SIMDScalar operator * ( const Int64 value ) const { return SIMDScalar( a*value, b*value ); } /// Divide this scalar by another scalar component-wise. /** * This operator divides each component of this scalar * by the corresponding component of the other scalar and * returns a scalar representing this result. It does not modify * either original scalar. * * @param scalar - The scalar to multiply this scalar by. * @return The result of the division. */ RIM_FORCE_INLINE SIMDScalar operator / ( const SIMDScalar& scalar ) const { return SIMDScalar( a/scalar.a, b/scalar.b ); } /// Divide every component of this scalar by a value and return the result. /** * This method Divides every component of the scalar by the value parameter, * and returns a scalar representing this result. * It does not modifiy the original scalar. * * @param value - The value to divide all components of this scalar by. * @return The resulting scalar of this division. */ RIM_FORCE_INLINE SIMDScalar operator / ( const Int64 value ) const { return SIMDScalar( a/value, b/value ); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Arithmetic Assignment Operators /// Add a scalar to this scalar, modifying this original scalar. /** * This method adds another scalar to this scalar, component-wise, * and sets this scalar to have the result of this addition. * * @param scalar - The scalar to add to this scalar. * @return A reference to this modified scalar. */ RIM_FORCE_INLINE SIMDScalar& operator += ( const SIMDScalar& scalar ) { #if RIM_USE_SIMD && defined(RIM_SIMD_SSE) && RIM_SSE_VERSION_IS_SUPPORTED(2,0) v = _mm_add_epi64( v, scalar.v ); #else a += scalar.a; b += scalar.b; #endif return *this; } /// Subtract a scalar from this scalar, modifying this original scalar. /** * This method subtracts another scalar from this scalar, component-wise, * and sets this scalar to have the result of this subtraction. * * @param scalar - The scalar to subtract from this scalar. * @return A reference to this modified scalar. */ RIM_FORCE_INLINE SIMDScalar& operator -= ( const SIMDScalar& scalar ) { #if RIM_USE_SIMD && defined(RIM_SIMD_SSE) && RIM_SSE_VERSION_IS_SUPPORTED(2,0) v = _mm_sub_epi64( v, scalar.v ); #else a -= scalar.a; b -= scalar.b; #endif return *this; } /// Multiply component-wise this scalar and another scalar and modify this scalar. /** * This operator multiplies each component of this scalar * by the corresponding component of the other scalar and * modifies this scalar to contain the result. * * @param scalar - The scalar to multiply this scalar by. * @return A reference to this modified scalar. */ RIM_FORCE_INLINE SIMDScalar& operator *= ( const SIMDScalar& scalar ) { a *= scalar.a; b *= scalar.b; return *this; } /// Divide this scalar by another scalar component-wise and modify this scalar. /** * This operator divides each component of this scalar * by the corresponding component of the other scalar and * modifies this scalar to contain the result. * * @param scalar - The scalar to divide this scalar by. * @return A reference to this modified scalar. */ RIM_FORCE_INLINE SIMDScalar& operator /= ( const SIMDScalar& scalar ) { a /= scalar.a; b /= scalar.b; return *this; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Required Alignment Accessor Methods /// Return the alignment required for objects of this type. /** * For most SIMD types this value will be 16 bytes. If there is * no alignment required, 0 is returned. */ RIM_FORCE_INLINE static Size getRequiredAlignment() { #if RIM_USE_SIMD && defined(RIM_SIMD_SSE) && RIM_SSE_VERSION_IS_SUPPORTED(1,0) return 16; #else return 0; #endif } /// Get the width of this scalar (number of components it has). RIM_FORCE_INLINE static Size getWidth() { return 2; } /// Return whether or not this SIMD type is supported by the current CPU. RIM_FORCE_INLINE static Bool isSupported() { SIMDFlags flags = SIMDFlags::get(); return (flags & SIMDFlags::SSE_2) != 0; } private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Members RIM_ALIGN(16) union { #if RIM_USE_SIMD && defined(RIM_SIMD_SSE) && RIM_SSE_VERSION_IS_SUPPORTED(1,0) /// The 2D SIMD vector used internally. SIMDInt64 v; SIMDDouble vDouble; #endif struct { /// The A component of a 2D SIMD scalar. Int64 a; /// The B component of a 2D SIMD scalar. Int64 b; }; /// The components of a 2D SIMD scalar in array format. Int64 x[2]; }; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Friend Declarations template < typename T, Size width > friend class SIMDVector3D; /// Declare the floating point version of this class as a friend. friend class SIMDScalar<Float64,2>; friend RIM_FORCE_INLINE SIMDScalar abs( const SIMDScalar& scalar ); friend RIM_FORCE_INLINE SIMDScalar min( const SIMDScalar& scalar1, const SIMDScalar& scalar2 ); friend RIM_FORCE_INLINE SIMDScalar max( const SIMDScalar& scalar1, const SIMDScalar& scalar2 ); template < UInt i1, UInt i2 > friend RIM_FORCE_INLINE SIMDScalar shuffle( const SIMDScalar& scalar1 ); template < UInt i1, UInt i2 > friend RIM_FORCE_INLINE SIMDScalar shuffle( const SIMDScalar& scalar1, const SIMDScalar& scalar2 ); friend RIM_FORCE_INLINE SIMDScalar select( const SIMDScalar& selector, const SIMDScalar& scalar1, const SIMDScalar& scalar2 ); friend RIM_FORCE_INLINE SIMDScalar<Float64,2> select( const SIMDScalar& selector, const SIMDScalar<Float64,2>& scalar1, const SIMDScalar<Float64,2>& scalar2 ); }; //########################################################################################## //########################################################################################## //############ //############ Associative SIMD Scalar Operators //############ //########################################################################################## //########################################################################################## /// Add a scalar value to each component of this scalar and return the resulting scalar. RIM_FORCE_INLINE SIMDScalar<Int64,2> operator + ( const Int64 value, const SIMDScalar<Int64,2>& scalar ) { return SIMDScalar<Int64,2>(value) + scalar; } /// Subtract a scalar value from each component of this scalar and return the resulting scalar. RIM_FORCE_INLINE SIMDScalar<Int64,2> operator - ( const Int64 value, const SIMDScalar<Int64,2>& scalar ) { return SIMDScalar<Int64,2>(value) - scalar; } /// Multiply a scalar value by each component of this scalar and return the resulting scalar. RIM_FORCE_INLINE SIMDScalar<Int64,2> operator * ( const Int64 value, const SIMDScalar<Int64,2>& scalar ) { return SIMDScalar<Int64,2>(value) * scalar; } /// Divide each component of this scalar by a scalar value and return the resulting scalar. RIM_FORCE_INLINE SIMDScalar<Int64,2> operator / ( const Int64 value, const SIMDScalar<Int64,2>& scalar ) { return SIMDScalar<Int64,2>(value) / scalar; } //########################################################################################## //########################################################################################## //############ //############ Free Vector Functions //############ //########################################################################################## //########################################################################################## /// Compute the absolute value of each component of the specified SIMD scalar and return the result. RIM_FORCE_INLINE SIMDScalar<Int64,2> abs( const SIMDScalar<Int64,2>& scalar ) { return SIMDScalar<Int64,2>( math::abs(scalar.a), math::abs(scalar.b) ); } /// Compute the minimum of each component of the specified SIMD scalars and return the result. RIM_FORCE_INLINE SIMDScalar<Int64,2> min( const SIMDScalar<Int64,2>& scalar1, const SIMDScalar<Int64,2>& scalar2 ) { return SIMDScalar<Int64,2>( math::min(scalar1.a, scalar2.a), math::min(scalar1.b, scalar2.b) ); } /// Compute the maximum of each component of the specified SIMD scalars and return the result. RIM_FORCE_INLINE SIMDScalar<Int64,2> max( const SIMDScalar<Int64,2>& scalar1, const SIMDScalar<Int64,2>& scalar2 ) { return SIMDScalar<Int64,2>( math::max(scalar1.a, scalar2.a), math::max(scalar1.b, scalar2.b) ); } /// Pick 2 elements from the specified SIMD scalar and return the result. template < UInt i1, UInt i2 > RIM_FORCE_INLINE SIMDScalar<Int64,2> shuffle( const SIMDScalar<Int64,2>& scalar ) { #if RIM_USE_SIMD && defined(RIM_SIMD_SSE) && RIM_SSE_VERSION_IS_SUPPORTED(2,0) return SIMDScalar<Int64,2>( _mm_shuffle_pd( scalar.v, scalar.v, _MM_SHUFFLE2(i2, i1) ) ); #else return SIMDScalar<Int64,2>( scalar[i1], scalar[i2] ); #endif } /// Pick one element from each SIMD scalar and return the result. template < UInt i1, UInt i2 > RIM_FORCE_INLINE SIMDScalar<Int64,2> shuffle( const SIMDScalar<Int64,2>& scalar1, const SIMDScalar<Int64,2>& scalar2 ) { #if RIM_USE_SIMD && defined(RIM_SIMD_SSE) && RIM_SSE_VERSION_IS_SUPPORTED(1,0) return SIMDScalar<Int64,2>( _mm_shuffle_pd( scalar1.v, scalar2.v, _MM_SHUFFLE2(i2, i1) ) ); #else return SIMDScalar<Int64,2>( scalar1[i1], scalar1[i2] ); #endif } /// Select elements from the first SIMD scalar if the selector is TRUE, otherwise from the second. RIM_FORCE_INLINE SIMDScalar<Int64,2> select( const SIMDScalar<Int64,2>& selector, const SIMDScalar<Int64,2>& scalar1, const SIMDScalar<Int64,2>& scalar2 ) { #if RIM_USE_SIMD && defined(RIM_SIMD_SSE) && RIM_SSE_VERSION_IS_SUPPORTED(1,0) // (((b^a) & selector) ^ a) return SIMDScalar<Int64,2>( _mm_xor_pd( scalar2.vDouble, _mm_and_pd( selector.vDouble, _mm_xor_pd( scalar1.vDouble, scalar2.vDouble ) ) ) ); #else return SIMDScalar<Int64,2>( selector.a ? scalar1.a : scalar2.a, selector.b ? scalar1.b : scalar2.b ); #endif } //########################################################################################## //***************************** End Rim Math Namespace *********************************** RIM_MATH_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_SIMD_SCALAR_INT_64_2_H <file_sep>/* * rimGUIRenderView.h * Rim GUI * * Created by <NAME> on 3/1/13. * Copyright 2013 __MyCompanyName__. All rights reserved. * */ #ifndef INCLUDE_RIM_GUI_RENDER_VIEW_H #define INCLUDE_RIM_GUI_RENDER_VIEW_H #include "rimGUIConfig.h" #include "rimGUIView.h" #include "rimGUISystem.h" #include "rimGUIRenderViewDelegate.h" //########################################################################################## //*************************** Start Rim GUI Namespace ****************************** RIM_GUI_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class which allows the user to render to a rectangular region. class RenderView : public View { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructors /// Create a new render view with the specified size. RenderView( const Size2D& size ); /// Create a new render view with the specified position and size relative to its parent view. RenderView( const Size2D& size, const Vector2i& position ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Destructor /// Destroy an render view, releasing all resources associated with it. ~RenderView(); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Size Accessor Methods /// Return a 2D vector indicating the size on the screen of this render view in pixels. /** * The actual size of the rendering framebuffer may be different than this value, * due to differences in the pixel density of displays. Call getFramebufferSize() * to get the actual size in rendered pixels of this view. */ virtual Size2D getSize() const; /// Set the size on the screen of this render view in pixels. /** * The method returns whether or not the size change operation was * successful. */ virtual Bool setSize( const Size2D& size ); /// Return a 2D vector indicating the size on the screen of this render view in framebuffer pixels. /** * The nominal size of the render view may be different than this value, * due to differences in the pixel density of displays. */ Size2D getFramebufferSize() const; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Position Accessor Methods /// Return the 2D position of this render view in pixels, relative to the bottom left corner of the view. /** * The coordinate position is defined relative to its enclosing coordinate frame * where the origin will be the bottom left corner of the enclosing view or window. */ virtual Vector2i getPosition() const; /// Set the 2D position of this render view in pixels, relative to the bottom left corner of the view. /** * The coordinate position is defined relative to its enclosing coordinate frame * where the origin will be the bottom left corner of the enclosing view or window. * * If the position change operation is successful, TRUE is returned and the view is * moved. Otherwise, FALSE is returned and the view is not moved. */ virtual Bool setPosition( const Vector2i& position ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Pixel Density Accessor Methods /// Return the number of actual rendered pixels (in one dimension) per point. /** * The default value is 1, indicating one rendered pixel for each framebuffer point. * Higher values (i.e. 2) can be used to indicate high-resolution (i.e. retina) displays * that need greater actual pixel density per logical pixel. */ Float getPixelDensity() const; /// Set the maximum pixel density that this render view can use. /** * If possible, the render view will use the specified pixel density * to determine the actual resolution of the render view. The * render view uses a valid pixel density that is as close to this * value as possible. The default is 1. * * This method should be called before this render view is bound to a rendering * context. */ Bool setMaxPixelDensity( Float newMaxDensity ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Fullscreen Status Accessor Methods /// Return whether or not this render view is in fullscreen mode. Bool getIsFullscreen() const; /// Set whether or not this render view is in fullscreen mode. /** * The method returns whether or not the fullscreen mode change was successful. * Setting an render view to fullscreen can fail if the view is already part * of a window or is a child of another view. * * This method uses the current resolution of the main display for the view * and uses the main display as the fullscreen display. * * Calling this method may potentially resize the render view if the display has * a different size than the view. */ Bool setIsFullscreen( Bool newIsFullscreen ); /// Set whether or not this render view is in fullscreen mode. /** * The method returns whether or not the fullscreen mode change was successful. * Setting an render view to fullscreen can fail if the view is already part * of a window or is a child of another view. * * This method uses the current resolution of the specified display for the view * and uses that display as the fullscreen display. * * Calling this method may potentially resize the render view if the display has * a different size than the view. */ Bool setIsFullscreen( Bool newIsFullscreen, const system::Display& display ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Delegate Accessor Methods /// Return a const reference to the object which responds to events for this RenderView. const RenderViewDelegate& getDelegate() const; /// Set the object to which RenderView events should be delegated. void setDelegate( const RenderViewDelegate& newDelegate ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Parent Window Accessor Methods /// Return the window which is a parent of this render view. /** * If NULL is returned, it indicates that the view is not part of a window. */ virtual Window* getParentWindow() const; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Platform-Specific Pointer Accessor Method /// Return a pointer to platform-specific data for this render view. /** * On Mac OS X, this method returns a pointer to a subclass of NSView * which represents the render view. * * On Windows, this method returns an HWND indicating the 'window' which * represents the render view. */ virtual void* getInternalPointer() const; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Static Shared Construction Methods /// Create a shared-pointer render view object, calling the constructor with the same arguments. RIM_INLINE static Pointer<RenderView> construct( const Size2D& newSize ) { return Pointer<RenderView>( util::construct<RenderView>( newSize ) ); } /// Create a shared-pointer render view object, calling the constructor with the same arguments. RIM_INLINE static Pointer<RenderView> construct( const Size2D& newSize, const Vector2i& newPosition ) { return Pointer<RenderView>( util::construct<RenderView>( newSize, newPosition ) ); } private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Class Declaration /// A class which wraps platform-specific state for an render view. class Wrapper; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Parent Accessor Methods /// Set the window which is going to be a parent of this render view. /** * Setting this value to NULL should indicate that the view is no longer * part of a window. */ virtual void setParentWindow( Window* parentWindow ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Members /// A pointer to an object which wraps platform-specific state for an render view. Wrapper* wrapper; }; //########################################################################################## //*************************** End Rim GUI Namespace ******************************** RIM_GUI_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_GUI_RENDER_VIEW_H <file_sep>/* * rimGraphicsDirectionalLight.h * Rim Graphics * * Created by <NAME> on 5/16/12. * Copyright 2012 __MyCompanyName__. All rights reserved. * */ #ifndef INCLUDE_RIM_GRAPHICS_DIRECTIONAL_LIGHT_H #define INCLUDE_RIM_GRAPHICS_DIRECTIONAL_LIGHT_H #include "rimGraphicsLightsConfig.h" #include "rimGraphicsLight.h" //########################################################################################## //************************ Start Rim Graphics Lights Namespace *************************** RIM_GRAPHICS_LIGHTS_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class which represents a simple directional light source. /** * A directional light source has all of the standard light attributes (color, intensity), * and also has a direction in which it is pointing. A directional light affects the * entire scene and can be used to approximate a very distant point light source * such as the sun. */ class DirectionalLight : public Light { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructors /// Create a default directional light source with the default direction (1,0,0). DirectionalLight(); /// Create a directional light source with the specified direction. DirectionalLight( const Vector3& newDirection ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Direction Accessor Methods /// Get the direction where this directional light is pointing. RIM_INLINE const Vector3& getDirection() const { return direction; } /// Set the direction where this directional light should point. RIM_INLINE void setDirection( const Vector3& newDirection ) { direction = newDirection; } private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Members /// The direction that this directional light is pointing in. Vector3 direction; }; //########################################################################################## //************************ End Rim Graphics Lights Namespace ***************************** RIM_GRAPHICS_LIGHTS_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_GRAPHICS_POINT_LIGHT_H <file_sep>/* * rimScalarMath.h * Rim Framework * * Created by <NAME> on 12/28/08. * Copyright 2008 Rim Software. All rights reserved. * */ #ifndef INCLUDE_RIM_SCALAR_MATH_H #define INCLUDE_RIM_SCALAR_MATH_H #include "rimMathConfig.h" //########################################################################################## //***************************** Start Rim Math Namespace ********************************* RIM_MATH_NAMESPACE_START //****************************************************************************************** //########################################################################################## //########################################################################################## //########################################################################################## //############ //############ Mathematical and Numeric Constants //############ //########################################################################################## //########################################################################################## template < typename T > RIM_FORCE_INLINE T pi() { static const double PI = 3.14159265358979323846; return T(PI); } template < typename T > RIM_FORCE_INLINE T e() { static const double E = 2.71828182845904523536; return T(E); } //########################################################################################## //########################################################################################## //############ //############ Numeric Limit Accessor Methods //############ //########################################################################################## //########################################################################################## /// Return the Not-A-Number representation for the templated type, or zero if it has none. template < typename T > RIM_FORCE_INLINE T nan() { if ( std::numeric_limits<T>::has_quiet_NaN ) return std::numeric_limits<T>::quiet_NaN(); else return T(0); } /// Return the Infinity representation for the templated type, or the maximum value if it has none. template < typename T > RIM_FORCE_INLINE T infinity() { if ( std::numeric_limits<T>::has_infinity ) return std::numeric_limits<T>::infinity(); else return std::numeric_limits<T>::max(); } /// Return the Negative Infinity representation for the templated type, or the minimum value if it has none. template < typename T > RIM_FORCE_INLINE T negativeInfinity() { if ( std::numeric_limits<T>::has_infinity ) return -std::numeric_limits<T>::infinity(); else return std::numeric_limits<T>::min(); } /// Return the Negative Infinity representation for the templated type, or the minimum value if it has none. template <> RIM_FORCE_INLINE unsigned char negativeInfinity<unsigned char>() { return std::numeric_limits<unsigned char>::min(); } /// Return the Negative Infinity representation for the templated type, or the minimum value if it has none. template <> RIM_FORCE_INLINE unsigned short negativeInfinity<unsigned short>() { return std::numeric_limits<unsigned short>::min(); } /// Return the Negative Infinity representation for the templated type, or the minimum value if it has none. template <> RIM_FORCE_INLINE unsigned int negativeInfinity<unsigned int>() { return std::numeric_limits<unsigned int>::min(); } /// Return the Negative Infinity representation for the templated type, or the minimum value if it has none. template <> RIM_FORCE_INLINE unsigned long negativeInfinity<unsigned long>() { return std::numeric_limits<unsigned long>::min(); } /// Return the Negative Infinity representation for the templated type, or the minimum value if it has none. template <> RIM_FORCE_INLINE unsigned long long negativeInfinity<unsigned long long>() { return std::numeric_limits<unsigned long long>::min(); } /// Return the maximum allowable finite value for the template parameter type. template < typename T > RIM_FORCE_INLINE T max() { return std::numeric_limits<T>::max(); } /// Return the minimum allowable finite value for the template parameter type. template < typename T > RIM_FORCE_INLINE T min() { return std::numeric_limits<T>::min(); } /// Return the minimum allowable finite value for the template parameter type. template <> RIM_FORCE_INLINE float min<float>() { return -std::numeric_limits<float>::max(); } /// Return the minimum allowable finite value for the template parameter type. template <> RIM_FORCE_INLINE double min<double>() { return -std::numeric_limits<double>::max(); } /// Return the smallest deviation from the value 1 that the templated type can represent. template < typename T > RIM_FORCE_INLINE T epsilon() { return T(1); } /// Return the smallest deviation from the value 1 that a float can represent. template <> RIM_FORCE_INLINE float epsilon() { return std::numeric_limits<float>::epsilon(); } /// Return the smallest deviation from the value 1 that a double can represent. template <> RIM_FORCE_INLINE double epsilon() { return std::numeric_limits<double>::epsilon(); } //########################################################################################## //########################################################################################## //############ //############ Numeric Limit Comparison Methods //############ //########################################################################################## //########################################################################################## /// Get whether a number is equal to the representation of Infinity for its type. template < typename T > RIM_FORCE_INLINE bool isInfinity( T number ) { if ( std::numeric_limits<T>::has_infinity ) return number == std::numeric_limits<T>::infinity(); else return number == std::numeric_limits<T>::max(); } /// Get whether a number is equal to the representation of Negative Infinity for its type. template < typename T > RIM_FORCE_INLINE bool isNegativeInfinity( T number ) { if ( std::numeric_limits<T>::has_infinity ) return number == -std::numeric_limits<T>::infinity(); else return number == std::numeric_limits<T>::min(); } template <> RIM_FORCE_INLINE bool isNegativeInfinity( unsigned char number ) { return false; } template <> RIM_FORCE_INLINE bool isNegativeInfinity( unsigned short number ) { return false; } template <> RIM_FORCE_INLINE bool isNegativeInfinity( unsigned int number ) { return false; } template <> RIM_FORCE_INLINE bool isNegativeInfinity( unsigned long number ) { return false; } template <> RIM_FORCE_INLINE bool isNegativeInfinity( unsigned long long number ) { return false; } /// Get whether a number is equal to Negative or Positive Infinity for its type. template < typename T > RIM_FORCE_INLINE bool isInfinite( T number ) { return math::isInfinity( number ) || math::isNegativeInfinity( number ); } /// Get whether a number is finite. template < typename T > RIM_FORCE_INLINE bool isFinite( T number ) { return !isInfinite( number ); } /// Get whether or not the specified number is Not-A-Number. template < typename T > RIM_FORCE_INLINE bool isNAN( T number ) { return number != number; } //########################################################################################## //########################################################################################## //############ //############ Value Kind Methods //############ //########################################################################################## //########################################################################################## template < typename T > RIM_FORCE_INLINE bool isInteger() { return false; } template <> RIM_FORCE_INLINE bool isInteger<char>() { return true; } template <> RIM_FORCE_INLINE bool isInteger<unsigned char>() { return true; } template <> RIM_FORCE_INLINE bool isInteger<short>() { return true; } template <> RIM_FORCE_INLINE bool isInteger<unsigned short>() { return true; } template <> RIM_FORCE_INLINE bool isInteger<int>() { return true; } template <> RIM_FORCE_INLINE bool isInteger<unsigned int>() { return true; } template <> RIM_FORCE_INLINE bool isInteger<long>() { return true; } template <> RIM_FORCE_INLINE bool isInteger<unsigned long>() { return true; } template <> RIM_FORCE_INLINE bool isInteger<long long>() { return true; } template <> RIM_FORCE_INLINE bool isInteger<unsigned long long>() { return true; } template < typename T > RIM_FORCE_INLINE bool isInteger( T number ) { return isInteger<T>(); } template < typename T > RIM_FORCE_INLINE bool isFloatingPoint() { return false; } template <> RIM_FORCE_INLINE bool isFloatingPoint<float>() { return true; } template <> RIM_FORCE_INLINE bool isFloatingPoint<double>() { return true; } template < typename T > RIM_FORCE_INLINE bool isFloatingPoint( T number ) { return isFloatingPoint<T>(); } //########################################################################################## //########################################################################################## //############ //############ Absolute Value Methods //############ //########################################################################################## //########################################################################################## /// Return the absolute value of the specified number, such that the result is positive. template < typename T > RIM_FORCE_INLINE T abs( T number ) { return number < T(0) ? -number : number; } template <> RIM_FORCE_INLINE float abs( float number ) { return std::abs( number ); } template <> RIM_FORCE_INLINE double abs( double number ) { return std::abs( number ); } template <> RIM_FORCE_INLINE unsigned char abs( unsigned char value ) { return value; } template <> RIM_FORCE_INLINE unsigned short abs( unsigned short value ) { return value; } template <> RIM_FORCE_INLINE unsigned int abs( unsigned int value ) { return value; } template <> RIM_FORCE_INLINE unsigned long abs( unsigned long value ) { return value; } template <> RIM_FORCE_INLINE unsigned long long abs( unsigned long long value ) { return value; } //########################################################################################## //########################################################################################## //############ //############ Sign Determination Methods //############ //########################################################################################## //########################################################################################## /// Return -1 if the number is less than zero, 0 if it is zero, and 1 otherwise. template < typename T > RIM_FORCE_INLINE T sign( T number ) { return (T)((T(0) < number) - (number < T(0))); } template <> RIM_FORCE_INLINE unsigned char sign( unsigned char value ) { return 1; } template <> RIM_FORCE_INLINE unsigned short sign( unsigned short value ) { return 1; } template <> RIM_FORCE_INLINE unsigned int sign( unsigned int value ) { return 1; } template <> RIM_FORCE_INLINE unsigned long sign( unsigned long value ) { return 1; } template <> RIM_FORCE_INLINE unsigned long long sign( unsigned long long value ) { return 1; } //########################################################################################## //########################################################################################## //############ //############ Equality Determination Methods //############ //########################################################################################## //########################################################################################## template < typename T > RIM_FORCE_INLINE bool equals( T value1, T value2 ) { return value1 == value2; } template <> RIM_FORCE_INLINE bool equals( float value1, float value2 ) { return math::abs(value1 - value2) < math::epsilon<float>(); } template <> RIM_FORCE_INLINE bool equals( double value1, double value2 ) { return math::abs(value1 - value2) < math::epsilon<double>(); } template < typename T > RIM_FORCE_INLINE bool fuzzyEquals( T value1, T value2, T epsilon ) { return math::abs(value1 - value2) < epsilon; } template < typename T > RIM_FORCE_INLINE bool isZero( T value, T epsilon ) { return math::abs(value) < epsilon; } template < typename T > RIM_FORCE_INLINE bool isZero( T value ) { return value == T(0); } template <> RIM_FORCE_INLINE bool isZero( float value ) { return math::abs(value - 0.0f) < math::epsilon<float>(); } template <> RIM_FORCE_INLINE bool isZero( double value ) { return math::abs(value - 0.0) < math::epsilon<double>(); } //########################################################################################## //########################################################################################## //############ //############ Average Methods //############ //########################################################################################## //########################################################################################## template < typename T > RIM_FORCE_INLINE T average( T value1, T value2 ) { return (value1 + value2) / T(2); } template <> RIM_FORCE_INLINE float average( float value1, float value2 ) { return (value1 + value2) * 0.5f; } template <> RIM_FORCE_INLINE double average( double value1, double value2 ) { return (value1 + value2) * 0.5; } //########################################################################################## //########################################################################################## //############ //############ Number Max/Min/Clamp Methods //############ //########################################################################################## //########################################################################################## /// Return the larger of two numbers. template < typename T > RIM_FORCE_INLINE T max( T value1, T value2 ) { return value1 > value2 ? value1 : value2; } /// Return the smaller of two numbers. template < typename T > RIM_FORCE_INLINE T min( T value1, T value2 ) { return value1 < value2 ? value1 : value2; } /// Return the result when the a number is constrainted to the interval [minimum, maximum]. template < typename T > RIM_FORCE_INLINE T clamp( T number, T minimum, T maximum ) { return math::min( math::max( number, minimum ), maximum ); } //########################################################################################## //########################################################################################## //############ //############ Number Floor, Ceiling, and Round Methods //############ //########################################################################################## //########################################################################################## /// Return the largest whole number smaller than the number parameter, as the same type. template < typename T > RIM_FORCE_INLINE T floor( T number ) { return number; } template <> RIM_FORCE_INLINE float floor( float number ) { return std::floor( number ); } template <> RIM_FORCE_INLINE double floor( double number ) { return std::floor( number ); } template < typename T > RIM_FORCE_INLINE T ceiling( T number ) { return number; } template <> RIM_FORCE_INLINE float ceiling( float number ) { return std::ceil( number ); } template <> RIM_FORCE_INLINE double ceiling( double number ) { return std::ceil( number ); } template < typename T > RIM_FORCE_INLINE T round( T value ) { return value; } template <> RIM_FORCE_INLINE float round( float value ) { return math::floor( value + 0.5f ); } template <> RIM_FORCE_INLINE double round( double value ) { return math::floor( value + 0.5 ); } //########################################################################################## //########################################################################################## //############ //############ Square Root Methods //############ //########################################################################################## //########################################################################################## namespace detail { template < typename T > RIM_INLINE T recursiveSquareRoot( T n, T x1 ) { T x2 = (x1 + n/x1) / T(2); if ( x1 - x2 < T(1) ) return x2; else return recursiveSquareRoot( n, x2 ); } }; template < typename T > RIM_FORCE_INLINE T sqrti( T value ) { if ( value < T(0) ) return math::nan<T>(); else return detail::recursiveSquareRoot( value, value ); } template < typename T > RIM_FORCE_INLINE T sqrt( T value ) { return (T)std::sqrt( (double)value ); } template <> RIM_FORCE_INLINE float sqrt( float value ) { return std::sqrt( value ); } template <> RIM_FORCE_INLINE double sqrt( double value ) { return std::sqrt( value ); } //########################################################################################## //########################################################################################## //############ //############ Power Methods //############ //########################################################################################## //########################################################################################## /// Get the previous multiple of a base that is less than or equal to a specified number. template < typename T > RIM_FORCE_INLINE T previousMultiple( T number, T base ) { return math::floor( number / base )*base; } /// Get the next multiple of a base that is greater than or equal to a specified number. template < typename T > RIM_FORCE_INLINE T nextMultiple( T number, T base ) { T temp = math::floor( number / base )*base; return temp == number ? temp : temp + base; } /// Get the multiple of a base that the closest to a specified number. template < typename T > RIM_FORCE_INLINE T nearestMultiple( T number, T base ) { return math::round( number / base )*base; } /// Return the first power of two larger than the specified number. template < typename T > RIM_FORCE_INLINE T nextPowerOfTwo( T x ) { T powerOfTwo = T(1); while ( powerOfTwo < x ) powerOfTwo *= T(2); return powerOfTwo; } /// Return the first power of two larger than the specified number. template <> RIM_FORCE_INLINE char nextPowerOfTwo( char x ) { x |= x >> 1; // handle 2 bit numbers x |= x >> 2; // handle 4 bit numbers x |= x >> 4; // handle 8 bit numbers return x + 1; } /// Return the first power of two larger than the specified number. template <> RIM_FORCE_INLINE unsigned char nextPowerOfTwo( unsigned char x ) { x |= x >> 1; // handle 2 bit numbers x |= x >> 2; // handle 4 bit numbers x |= x >> 4; // handle 8 bit numbers return x + 1; } /// Return the first power of two larger than the specified number. template <> RIM_FORCE_INLINE short nextPowerOfTwo( short x ) { x |= x >> 1; // handle 2 bit numbers x |= x >> 2; // handle 4 bit numbers x |= x >> 4; // handle 8 bit numbers x |= x >> 8; // handle 16 bit numbers return x + 1; } /// Return the first power of two larger than the specified number. template <> RIM_FORCE_INLINE unsigned short nextPowerOfTwo( unsigned short x ) { x |= x >> 1; // handle 2 bit numbers x |= x >> 2; // handle 4 bit numbers x |= x >> 4; // handle 8 bit numbers x |= x >> 8; // handle 16 bit numbers return x + 1; } /// Return the first power of two larger than the specified number. template <> RIM_FORCE_INLINE int nextPowerOfTwo( int x ) { x |= x >> 1; // handle 2 bit numbers x |= x >> 2; // handle 4 bit numbers x |= x >> 4; // handle 8 bit numbers x |= x >> 8; // handle 16 bit numbers x |= x >> 16; // handle 32 bit numbers return x + 1; } /// Return the first power of two larger than the specified number. template <> RIM_FORCE_INLINE unsigned int nextPowerOfTwo( unsigned int x ) { x |= x >> 1; // handle 2 bit numbers x |= x >> 2; // handle 4 bit numbers x |= x >> 4; // handle 8 bit numbers x |= x >> 8; // handle 16 bit numbers x |= x >> 16; // handle 32 bit numbers return x + 1; } /// Return the first power of two larger than the specified number. template <> RIM_FORCE_INLINE long nextPowerOfTwo( long x ) { x |= x >> 1; // handle 2 bit numbers x |= x >> 2; // handle 4 bit numbers x |= x >> 4; // handle 8 bit numbers x |= x >> 8; // handle 16 bit numbers x |= x >> 16; // handle 32 bit numbers return x + 1; } /// Return the first power of two larger than the specified number. template <> RIM_FORCE_INLINE unsigned long nextPowerOfTwo( unsigned long x ) { x |= x >> 1; // handle 2 bit numbers x |= x >> 2; // handle 4 bit numbers x |= x >> 4; // handle 8 bit numbers x |= x >> 8; // handle 16 bit numbers x |= x >> 16; // handle 32 bit numbers return x + 1; } /// Return the first power of two larger than the specified number. template <> RIM_FORCE_INLINE long long nextPowerOfTwo( long long x ) { x |= x >> 1; // handle 2 bit numbers x |= x >> 2; // handle 4 bit numbers x |= x >> 4; // handle 8 bit numbers x |= x >> 8; // handle 16 bit numbers x |= x >> 16; // handle 32 bit numbers x |= x >> 32; // handle 64 bit numbers return x + 1; } /// Return the first power of two larger than the specified number. template <> RIM_FORCE_INLINE unsigned long long nextPowerOfTwo( unsigned long long x ) { x |= x >> 1; // handle 2 bit numbers x |= x >> 2; // handle 4 bit numbers x |= x >> 4; // handle 8 bit numbers x |= x >> 8; // handle 16 bit numbers x |= x >> 16; // handle 32 bit numbers x |= x >> 32; // handle 64 bit numbers return x + 1; } /// Return whether or not the specified number is a power of 2. template < typename T > RIM_FORCE_INLINE Bool isPowerOfTwo( T number ) { return (number > 0) && ((number & (number - 1)) == 0); } namespace detail { template < typename T > RIM_FORCE_INLINE bool multWillOverflow( T a, T b ) { if ( a > 0 ) { if ( b > 0 ) return b > math::max<T>() / a; else if ( b < 0 ) return b < math::min<T>() / a; } else if ( a < 0 ) { if ( b > 0 ) return a < math::min<T>() / b; else if ( b < 0 ) return b < math::max<T>() / a; } return false; } template < typename T > RIM_FORCE_INLINE bool unsignedMultWillOverflow( T a, T b ) { return b > math::max<T>() / a; } template < typename IntegerType > RIM_FORCE_INLINE IntegerType integerPower( IntegerType base, IntegerType power ) { if ( power < 0 ) return 0; IntegerType result = 1; for ( IntegerType i = 0; i < power; i++ ) { // was there overflow for this numeric type? if ( multWillOverflow( result, base ) ) { if ( base > 0 ) return math::infinity<IntegerType>(); else if ( power % 2 == 0 ) return math::infinity<IntegerType>(); else return math::negativeInfinity<IntegerType>(); } result *= base; } return result; } template < typename IntegerType > RIM_FORCE_INLINE IntegerType unsignedIntegerPower( IntegerType base, IntegerType power ) { IntegerType result = 1; for ( IntegerType i = 0; i < power; i++ ) { // was there overflow for this numeric type? if ( unsignedMultWillOverflow( result, base ) ) return math::infinity<IntegerType>(); result *= base; } return result; } } template < typename T, typename U > RIM_FORCE_INLINE T pow( T base, U power ) { return std::pow( base, power ); } template <> RIM_FORCE_INLINE char pow( char base, char power ) { return detail::integerPower( base, power ); } template <> RIM_FORCE_INLINE unsigned char pow( unsigned char base, unsigned char power ) { return detail::unsignedIntegerPower( base, power ); } template <> RIM_FORCE_INLINE short pow( short base, short power ) { return detail::integerPower( base, power ); } template <> RIM_FORCE_INLINE unsigned short pow( unsigned short base, unsigned short power ) { return detail::unsignedIntegerPower( base, power ); } template <> RIM_FORCE_INLINE int pow( int base, int power ) { return detail::integerPower( base, power ); } template <> RIM_FORCE_INLINE unsigned int pow( unsigned int base, unsigned int power ) { return detail::unsignedIntegerPower( base, power ); } template <> RIM_FORCE_INLINE long pow( long base, long power ) { return detail::integerPower( base, power ); } template <> RIM_FORCE_INLINE unsigned long pow( unsigned long base, unsigned long power ) { return detail::unsignedIntegerPower( base, power ); } template <> RIM_FORCE_INLINE long long pow( long long base, long long power ) { return detail::integerPower( base, power ); } template <> RIM_FORCE_INLINE unsigned long long pow( unsigned long long base, unsigned long long power ) { return detail::unsignedIntegerPower( base, power ); } using std::exp; template < typename T > RIM_FORCE_INLINE T square( T value ) { return value*value; } //########################################################################################## //########################################################################################## //############ //############ Logarithm Methods //############ //########################################################################################## //########################################################################################## template < typename T > RIM_FORCE_INLINE T ln( T value ) { return std::log( value ); } template < typename T > RIM_FORCE_INLINE T log10( T value ) { return std::log10( value ); } namespace detail { template < typename T, T base > RIM_FORCE_INLINE T intLog( T value ) { if ( value <= T(0) ) { return math::negativeInfinity<T>(); } T power = 1; T i = 0; while ( power <= value ) { power *= base; i++; } return i - 1; } } template <> RIM_FORCE_INLINE short log10( short value ) { return detail::intLog<short,10>( value ); } template <> RIM_FORCE_INLINE unsigned short log10( unsigned short value ) { return detail::intLog<unsigned short,10>( value ); } template <> RIM_FORCE_INLINE int log10( int value ) { return detail::intLog<int,10>( value ); } template <> RIM_FORCE_INLINE unsigned int log10( unsigned int value ) { return detail::intLog<unsigned int,10>( value ); } template <> RIM_FORCE_INLINE long log10( long value ) { return detail::intLog<long,10>( value ); } template <> RIM_FORCE_INLINE unsigned long log10( unsigned long value ) { return detail::intLog<unsigned long,10>( value ); } template <> RIM_FORCE_INLINE long long log10( long long value ) { return detail::intLog<long long,10>( value ); } template <> RIM_FORCE_INLINE unsigned long long log10( unsigned long long value ) { return detail::intLog<unsigned long long,10>( value ); } template < typename T > RIM_FORCE_INLINE T log( T value, T base ) { double valueLog = math::log10( (double)value ); double baseLog = math::log10( (double)base ); if ( valueLog == 0.0 || baseLog == 0.0 ) return T(0); else return T(valueLog / baseLog); } template <> RIM_FORCE_INLINE float log( float value, float base ) { if ( base == 1.0f ) return 0.0f; float valueLog = math::log10( value ); float baseLog = math::log10( base ); return valueLog / baseLog; } template < typename T > RIM_FORCE_INLINE T log2( T value ) { return math::log( value, T(2) ); } template <> RIM_FORCE_INLINE float log2( float value ) { float valueLog = math::ln( value ); float baseLog = math::ln(2.0f); return valueLog / baseLog; } template <> RIM_FORCE_INLINE double log2( double value ) { double valueLog = math::ln( value ); double baseLog = math::ln(2.0); return valueLog / baseLog; } //########################################################################################## //########################################################################################## //############ //############ Modulus Methods //############ //########################################################################################## //########################################################################################## /// Compute the remainder when the specified value is divided by the given divisor. template < typename T > RIM_INLINE T mod( T value, T divisor ) { return value % divisor; } /// Compute the remainder when the specified value is divided by the given divisor. template <> RIM_INLINE float mod( float value, float divisor ) { return std::fmod( value, divisor ); } /// Compute the remainder when the specified value is divided by the given divisor. template <> RIM_INLINE double mod( double value, double divisor ) { return std::fmod( value, divisor ); } //########################################################################################## //########################################################################################## //############ //############ Radian<->Degree Conversion Methods //############ //########################################################################################## //########################################################################################## RIM_FORCE_INLINE float radiansToDegrees( float number ) { return number * float(57.295779513082325); } RIM_FORCE_INLINE double radiansToDegrees( double number ) { return number * double(57.295779513082325); } RIM_FORCE_INLINE float degreesToRadians( float number ) { return number * float(0.017453292519943); } RIM_FORCE_INLINE double degreesToRadians( double number ) { return number * double(0.017453292519943); } //########################################################################################## //########################################################################################## //############ //############ Trigonometric Function Methods //############ //########################################################################################## //########################################################################################## using std::sin; using std::cos; using std::tan; using std::asin; using std::acos; using std::atan; using std::asin; using std::acos; using std::atan; using std::atan2; using std::sinh; using std::cosh; using std::tanh; //########################################################################################## //########################################################################################## //############ //############ Other Trigonometric Functions //############ //########################################################################################## //########################################################################################## /// Compute and return the secant of the specified value. template < typename T > RIM_INLINE T sec( T value ) { return T(1) / math::cos(value); } /// Compute and return the cosecant of the specified value. template < typename T > RIM_INLINE T csc( T value ) { return T(1) / math::sin(value); } /// Compute and return the cotangent of the specified value. template < typename T > RIM_INLINE T cot( T value ) { return T(1) / math::tan(value); } /// Compute and return the secant of the specified value. template < typename T > RIM_INLINE T sech( T value ) { return T(1) / math::cosh(value); } /// Compute and return the cosecant of the specified value. template < typename T > RIM_INLINE T csch( T value ) { return T(1) / math::sinh(value); } /// Compute and return the cotangent of the specified value. template < typename T > RIM_INLINE T coth( T value ) { return T(1) / math::tanh(value); } //########################################################################################## //########################################################################################## //############ //############ Inverse Hyperbolic Trig Functions //############ //########################################################################################## //########################################################################################## /// Compute and return the inverse hyperbolic sine of the specified value. template < typename T > RIM_INLINE T asinh( T value ) { if ( value >= T(0) ) return math::ln(value + math::sqrt(value*value + T(1))); else return -math::ln(-value + math::sqrt(value*value + T(1))); } /// Compute and return the inverse hyperbolic cosine of the specified value. template < typename T > RIM_INLINE T acosh( T value ) { if ( value > T(1) ) return math::ln(value + math::sqrt(value - T(1))*math::sqrt(value + T(1))); else return math::nan<T>(); } /// Compute and return the inverse hyperbolic tangent of the specified value. template < typename T > RIM_INLINE T atanh( T value ) { if ( value >= T(0) ) { if ( value >= T(1) ) return math::nan<T>(); return T(0.5)*(math::ln(T(1) + value) - math::ln(T(1) - value)); } else { if ( value <= T(-1) ) return math::nan<T>(); return -T(0.5)*(math::ln(T(1) - value) - math::ln(T(1) + value)); } } /// Compute and return the inverse hyperbolic secant of the specified value. template < typename T > RIM_INLINE T asech( T value ) { if ( value > T(0) && value <= T(1) ) return math::ln( math::sqrt(T(-1) + T(1)/value)*math::sqrt(T(1) + T(1)/value) + T(1)/value ); else return math::nan<T>(); } /// Compute and return the inverse hyperbolic cosecant of the specified value. template < typename T > RIM_INLINE T acsch( T value ) { if ( value > T(0) ) return math::ln( math::sqrt(T(1) + T(1)/(value*value)) + T(1)/value ); else if ( value < T(0) ) return math::ln( math::sqrt(T(1) + T(1)/(value*value)) + T(1)/value ); else return math::nan<T>(); } /// Compute and return the inverse hyperbolic cotangent of the specified value. template < typename T > RIM_INLINE T acoth( T value ) { if ( value > T(1) ) return T(0.5)*(math::ln(T(1) + T(1)/value) - math::ln(T(1) - T(1)/value)); else if ( value < T(-1) ) return -T(0.5)*(math::ln(T(1) - T(1)/value) - math::ln(T(1) + T(1)/value)); else return math::nan<T>(); } //########################################################################################## //***************************** End Rim Math Namespace *********************************** RIM_MATH_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_SCALAR_MATH_H <file_sep>/* * rimSoundFilter.h * Rim Sound * * Created by <NAME> on 6/7/08. * Copyright 2008 Rim Software. All rights reserved. * */ #ifndef INCLUDE_RIM_SOUND_FILTER_H #define INCLUDE_RIM_SOUND_FILTER_H #include "rimSoundFiltersConfig.h" #include "rimSoundFilterVersion.h" #include "rimSoundFilterParameterInfo.h" #include "rimSoundFilterParameter.h" #include "rimSoundFilterFrame.h" #include "rimSoundFilterResult.h" #include "rimSoundFilterState.h" #include "rimSoundFilterPreset.h" #include "rimSoundFilterCategory.h" //########################################################################################## //************************ Start Rim Sound Filters Namespace ***************************** RIM_SOUND_FILTERS_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class which represents a lightweight audio processing unit. /** * A SoundFilter object takes a buffer of N input channels and performs some DSP computation * on those samples and places some number of samples in an output buffer of M channels. * * Typically, implementors of this class's interface should perform a single DSP computation * such as applying an EQ filter or delay filter, but they are also allowed to perform * sample rate conversion, pitch shit, and other time-related functions. * * The number of input and output channels do not have to match. Each filter is responsible * for determining the format of its output(s) given the input buffer format(s). This includes * the channel count, number of samples, and sample rate. * * For filters that have no inputs that could inform the output format (such as a tone generator * or sound player), the filter should use the format of the output buffer(s) as a hint * for determining the output format. The filter is of course able to ignore this hint * and change the buffer format(s) to something else. * * The SoundFilter object is expected to tolerate input buffers of any sample * rate. */ class SoundFilter { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Destructor /// Destroy this sound filter object. virtual ~SoundFilter(); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Filter Read Methods /// Fill the specified output buffer with the requested number of samples, based on internal filter state. /** * Calling this method with only an output buffer causes this filter to behave * as a sound output (with no input). The default implementation doesn't write any * samples to the output buffer and returns 0, indicating no samples were written. * However, classes may inherit from this class to provide specific * functionality (such as an oscillator or sound file decoder). * * The output buffer is enlarged to the specified number of samples if it is smaller * than that number of samples. The method returns the number of valid samples * written to the output buffer. */ SoundFilterResult read( SoundBuffer& outputBuffer, Size numSamples ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Filter Write Methods /// Process the specified input buffer samples and do something with them. /** * The specified number of samples to process is clamped to be no larger than the size of the * input buffer. Calling this method with only an input buffer causes this filter to behave * as a sound input (with no output). The default implementation doesn't do anything with * the input samples but classes may inherit from this class to provide specific * functionality (such as a signal analyzer or sound file encoder). */ SoundFilterResult write( const SoundBuffer& inputBuffer, Size numSamples ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Filter Processing Methods /// Apply this filter to the specified input buffer data, placing the result in the output buffer. /** * The specified number of samples to process is clamped to be no larger than the size of the * input buffer. * * Call this method when using a sound filter that has 1 input and 1 output. * * This method returns an object indicating the result of the filter processing step. * This result contains the number of valid samples that were placed in the output buffer. */ SoundFilterResult process( const SoundBuffer& inputBuffer, SoundBuffer& outputBuffer, Size numSamples ); /// Apply this filter to the specified input buffer data, placing the result in the output frame. /** * The specified number of samples to process is clamped to be no larger than the size of the * input buffer. * * Call this method when using a sound filter that has 1 input and more than one output. * * This method returns an object indicating the result of the filter processing step. * This result contains the number of valid samples that were placed in the output frame. */ SoundFilterResult process( const SoundBuffer& inputBuffer, SoundFilterFrame& outputFrame, Size numSamples ); /// Apply this filter to the specified input frame data, placing the result in the output frame. /** * The specified number of samples to process is clamped to be no larger than the size of the * smallest buffer in the input frame. * * Call this method when using a sound filter that has multiple inputs or multiple outputs. * * This method returns an object indicating the result of the filter processing step. * This result contains the number of valid samples that were placed in the output frame. */ SoundFilterResult process( const SoundFilterFrame& inputFrame, SoundFilterFrame& outputFrame, Size numSamples ); /// Apply this filter to the specified input frame data, placing the result in the output buffer. /** * The specified number of samples to process is clamped to be no larger than the size of the * input frame. * * Call this method when using a sound filter that has more than one input and only one output. * * This method returns an object indicating the result of the filter processing step. * This result contains the number of valid samples that were placed in the output buffer. */ SoundFilterResult process( const SoundFilterFrame& inputBuffer, SoundBuffer& outputBuffer, Size numSamples ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Filter Reset Method /// Signal to the filter that the audio stream is restarting. /** * This method allows the filter to reset all parameter interpolation * and processing to its initial state to avoid coloration from previous * audio or parameter values. */ void reset(); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Frame Index Accessor Method /// Return the index of the next frame to be processed (or the current one if currently processing). RIM_INLINE UInt64 getFrameIndex() const { return frameIndex; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Input and Output Accessor Methods /// Return the current number of audio inputs that this filter has. RIM_INLINE Size getInputCount() const { return (Size)numInputs; } /// Return a human-readable name of the filter audio input at the specified index. /** * The default implementation for this method returns a string * consisting of 'Input N' where N is the input index when the number * of inputs is more than 1. If the number of inputs is 1, 'Main Input' is returned. * If the index is invalid, the empty string is returned. * * Subclasses may override this method to return a more descriptive * name (such as 'Sidechain'). */ virtual UTF8String getInputName( Index inputIndex ) const; /// Return the current number of audio outputs that this filter has. RIM_INLINE Size getOutputCount() const { return (Size)numOutputs; } /// Return a human-readable name of the filter audio output at the specified index. /** * The default implementation for this method returns a string * consisting of 'Output N' where N is the output index when the number * of outputs is more than 1. If the number of outputs is 1, 'Main Output' is returned. * If the index is invalid, the empty string is returned. * * Subclasses may override this method to return a more descriptive * name. */ virtual UTF8String getOutputName( Index outputIndex ) const; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** MIDI Input and Output Accessor Methods /// Return the current number of MIDI inputs that this filter has. RIM_INLINE Size getMIDIInputCount() const { return numMIDIInputs; } /// Return a human-readable name of the filter MIDI input at the specified index. /** * The default implementation for this method returns a string * consisting of 'MIDI Input N' where N is the input index when the number * of MIDI inputs is more than 1. If the number of inputs is 1, 'Main MIDI Input' is returned. * If the index is invalid, the empty string is returned. * * Subclasses may override this method to return a more descriptive * name. */ virtual UTF8String getMIDIInputName( Index inputIndex ) const; /// Return the current number of MIDI outputs that this filter has. RIM_INLINE Size getMIDIOutputCount() const { return numMIDIOutputs; } /// Return a human-readable name of the filter MIDI output at the specified index. /** * The default implementation for this method returns a string * consisting of 'MIDI Output N' where N is the output index when the number * of MIDI outputs is more than 1. If the number of outputs is 1, 'Main MIDI Output' is returned. * If the index is invalid, the empty string is returned. * * Subclasses may override this method to return a more descriptive * name. */ virtual UTF8String getMIDIOutputName( Index outputIndex ) const; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Filter Attribute Accessor Methods /// Return a human-readable name for this filter. /** * The default implementation uses typeinfo to determine the * actual subclass type of the filter and returns a string representing * that type. This string usually is not formatted properly so the * filter subclass should override this method to return a proper name. */ virtual UTF8String getName() const; /// Return a human-readable name for this filter's manufacturer. /** * The default implementation returns the empty string. */ virtual UTF8String getManufacturer() const; /// Return an object representing the version of this sound filter. /** * The default version returned is '0.0.0'. Subclasses should override * this method to return a more meaningful version number. */ virtual SoundFilterVersion getVersion() const; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Filter Latency Accessor Method /// Return a Time value indicating the latency of this sound filter in seconds. /** * The default implementation returns a latency of 0. Filter subclasses should * override this implementation if they have a non-zero latency. */ virtual Time getLatency() const; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Filter Parameter Accessor Methods /// Return the total number of generic accessible parameters this filter has. /** * The default implementation for this method returns that the filter has 0 * parameters. SoundFilter subclasses should override this method to provide * generic access to their parameters. */ virtual Size getParameterCount() const; /// Query the index of the parameter with the specified name. /** * If a parameter with the name exists in the SoundFilter, TRUE is returned * and the index of that parameter is placed in the output parameter index parameter. * Otherwise, FALSE is returned and no parameter index is set. * * The default implementation calls getParameterInfo() for all each declared parameter * and checks to see if its name is equal to the specified name. This is rather inefficient * but is provided so that SoundFilter subclasses don't have to implement this method if they * don't want to. */ virtual Bool getParameterIndex( const UTF8String& parameterName, Index& parameterIndex ) const; /// Get information about the filter parameter at the specified index. /** * If a parameter with the specified index exists in this filter, the * method should return TRUE and place information about the parameter * in the output parameter information object. Otherwise, the method * should return FALSE and return no parameter information. * * SoundFilter subclasses should override this method to provide information * about their generic parameters. */ virtual Bool getParameterInfo( Index parameterIndex, FilterParameterInfo& info ) const; /// Get any special name associated with the specified value of an indexed parameter. /** * If a parameter with the specified index exists in this filter and there is * a special name associated with the given value, TRUE is returned and the * output string is set to reflect the name of the special value. * Otherwise, the method fails and returns FALSE, indicating that there is no * special name for that parameter value. */ virtual Bool getParameterValueName( Index parameterIndex, const FilterParameter& value, UTF8String& name ) const; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Filter Parameter Value Read Methods /// Place the value of the parameter at the specified index in the output parameter. /** * This method accesses the value for a parameter. If if the parameter index * is out-of-bounds, FALSE is returned. Otherwise, TRUE is returned and the * value is placed in the output parameter. */ Bool getParameter( Index parameterIndex, FilterParameter& value ) const; /// Place the value of the parameter at the specified index in the output parameter. /** * This method accesses the value for a boolean parameter. If this type * is not allowed for the given parameter index (or no suitable conversion is * possible), or if the parameter index is out-of-bounds, FALSE is returned. * Otherwise, TRUE is returned and the value is placed in the output parameter. */ Bool getParameter( Index parameterIndex, Bool& value ) const; /// Place the value of the parameter at the specified index in the output parameter. /** * This method accesses the value for an integer or enumeration parameter. If this type * is not allowed for the given parameter index (or no suitable conversion is * possible), or if the parameter index is out-of-bounds, FALSE is returned. * Otherwise, TRUE is returned and the value is placed in the output parameter. */ Bool getParameter( Index parameterIndex, Int64& value ) const; /// Place the value of the parameter at the specified index in the output parameter. /** * This method accesses the value for a floating-point parameter. If this type * is not allowed for the given parameter index (or no suitable conversion is * possible), or if the parameter index is out-of-bounds, FALSE is returned. * Otherwise, TRUE is returned and the value is placed in the output parameter. */ Bool getParameter( Index parameterIndex, Float32& value ) const; /// Place the value of the parameter at the specified index in the output parameter. /** * This method accesses the value for a double floating-point parameter. If this type * is not allowed for the given parameter index (or no suitable conversion is * possible), or if the parameter index is out-of-bounds, FALSE is returned. * Otherwise, TRUE is returned and the value is placed in the output parameter. */ Bool getParameter( Index parameterIndex, Float64& value ) const; /// Place the value of the parameter with the specified name in the output parameter. /** * This method accesses the value for a template type parameter. If this type * is not allowed for the given parameter name (or no suitable conversion is * possible), or if the parameter name does not represent a valid parameter, FALSE is returned. * Otherwise, TRUE is returned and the value is placed in the output parameter. */ template < typename ParameterType > RIM_INLINE Bool getParameter( const UTF8String& name, ParameterType& value ) const { Index index; return this->getParameterIndex( name, index ) && this->getParameter( index, value ); } /// Place the value of the parameter with the specified name in the output parameter. /** * This method accesses the value for a template type parameter. If this type * is not allowed for the given parameter name (or no suitable conversion is * possible), or if the parameter name does not represent a valid parameter, FALSE is returned. * Otherwise, TRUE is returned and the value is placed in the output parameter. */ template < typename ParameterType > RIM_INLINE Bool getParameter( const char* name, ParameterType& value ) const { Index index; return this->getParameterIndex( UTF8String(name), index ) && this->getParameter( index, value ); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Filter Parameter Value Write Methods /// Attempt to set the parameter value at the specified index. /** * This method accesses the value for a generic parameter. If if the parameter index * is out-of-bounds or if the type of the given value can't be converted * to the parameter's type, FALSE is returned. Otherwise, TRUE is returned and the * parameter's value is set to the specified value. */ Bool setParameter( Index parameterIndex, const FilterParameter& value ); /// Attempt to set the parameter value at the specified index. /** * This method accesses the value for a boolean parameter. If if the parameter index * is out-of-bounds or if the type of the given value can't be converted * to the parameter's type, FALSE is returned. Otherwise, TRUE is returned and the * parameter's value is set to the specified value. */ Bool setParameter( Index parameterIndex, Bool value ); /// Attempt to set the parameter value at the specified index. /** * This method accesses the value for an integer or enumeration parameter. If if the parameter index * is out-of-bounds or if the type of the given value can't be converted * to the parameter's type, FALSE is returned. Otherwise, TRUE is returned and the * parameter's value is set to the specified value. */ Bool setParameter( Index parameterIndex, Int64 value ); /// Attempt to set the parameter value at the specified index. /** * This method accesses the value for a float parameter. If if the parameter index * is out-of-bounds or if the type of the given value can't be converted * to the parameter's type, FALSE is returned. Otherwise, TRUE is returned and the * parameter's value is set to the specified value. */ Bool setParameter( Index parameterIndex, Float32 value ); /// Attempt to set the parameter value at the specified index. /** * This method accesses the value for a double parameter. If if the parameter index * is out-of-bounds or if the type of the given value can't be converted * to the parameter's type, FALSE is returned. Otherwise, TRUE is returned and the * parameter's value is set to the specified value. */ Bool setParameter( Index parameterIndex, Float64 value ); /// Attempt to set the parameter value with the specified name. /** * This method accesses the value for an boolean parameter. If this type * is not allowed for the given parameter name (or no suitable conversion is * possible), or if the parameter name does not represent a valid parameter, FALSE is returned. * Otherwise, TRUE is returned and the new parameter value is set. */ template < typename ParameterType > RIM_INLINE Bool setParameter( const UTF8String& name, ParameterType value ) { Index index; return this->getParameterIndex( name, index ) && this->setParameter( index, value ); } /// Attempt to set the parameter value with the specified name. /** * This method accesses the value for an boolean parameter. If this type * is not allowed for the given parameter name (or no suitable conversion is * possible), or if the parameter name does not represent a valid parameter, FALSE is returned. * Otherwise, TRUE is returned and the new parameter value is set. */ template < typename ParameterType > RIM_INLINE Bool setParameter( const char* name, ParameterType value ) { Index index; return this->getParameterIndex( UTF8String(name), index ) && this->setParameter( index, value ); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Filter State Accessor Methods /// Get the current state of this sound filter, storing it in the specified state object. /** * This method stores the complete current state of the sound filter in the specified * state object. The method returns whether or not the operation was successful. This * method is useful for easily serializing the state of a filter. Use the setState() * method to restore a save filter state. * * The base implementation iterates over the filter's public parameters and stores them * all in the state object, using the parameter indices as keys (converted to string). * * Override this method in a subclass to store private data or to store more efficiently. * In general, if one overrides this method, one should also override setState() in * order to make sure that filter data is stored in an expected manner. * * The implementor should make sure to clear the state object before adding data * to it because it may have been used previously. */ virtual Bool getState( SoundFilterState& state ) const; /// Set the current state of this sound filter, completely replacing the filter's current configuration. /** * This method takes information stored in the specified state object and uses * it to update all of the filter's parameters with new values. This method * is useful for deserializing the stored state of a filter. * * The base implementation iterates over the information stored in the state * and tries to set the filter's public parameters to the values given in the state * object, using the parameter indices as keys (converted to string). * * Override this method in a subclass to restore private data from the state * object. In general, if one overrides this method, one should also override getState() in * order to make sure that filter data is stored in an expected manner. */ virtual Bool setState( const SoundFilterState& state ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Filter Preset Accessor Methods /// Return the number of standard configuration presets that this sound filter has. /** * A preset is a collection of information which encapsulates the entire state * of a filter. Filters can have any number of standard presets which the user * can choose from to save time when configuring filters. The preset with index * 0 is always considered the default preset. * * The base implementation returns that there are 0 presets. Override this method * along with the other preset accessor methods to provide a set of standard presets. */ virtual Size getPresetCount() const; /// Get the standard preset for this sound filter with the specified index. /** * This method stores the standard preset with the specified index in the * output preset parameter. If the method succeeds, TRUE is returned. Otherwise, * if the method fails, FALSE is returned and the preset parameter is unmodified. * * The base implementation always returns FALSE because are no presets * by default. */ virtual Bool getPreset( Index presetIndex, SoundFilterPreset& preset ) const; /// Set the active preset for this sound filter to one with the specified index. /** * This method replaces the current state of the filter with the state stored * in the specified preset index. The method returns whether or not the operation * succeeded. It can fail if an invalid preset index is supplied. * * It is not necessary to override this method, it is a convenience method which * calls getPreset() to get the state for a preset, then calls setState() to * update the filter with the preset. */ virtual Bool setPreset( Index presetIndex ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Filter Type Accessor Method /// Return an object which describes the category of effect that this filter implements. /** * The base implementation returns SoundFilterCategory::OTHER. Override the method * to return more meaningful information. This is used to categorize filters * in a host application, or to provide useful metadata to users. */ virtual SoundFilterCategory getCategory() const; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Filter Synchronization Accessor Methods /// Return whether or not this sound filter performs thread synchronization. /** * If the return value is TRUE, every time that a sound filter parameter * is changed or a frame is rendered, a mutex is locked which prevents unsafe * thread access to internal state. Otherwise, if the return value is FALSE, * the synchronization is disabled. Disabling synchronization can improve * performance in situations where the user is sure that there will be no unsafe * thread access. * * Sound filters are synchronized by default. */ RIM_INLINE Bool getIsSynchronized() const { return isSynchronized; } /// Set whether or not this sound filter performs thread synchronization. /** * If the new value is TRUE, every time that a sound filter parameter * is changed or a frame is rendered, a mutex is locked which prevents unsafe * thread access to internal state. Otherwise, if the new value is FALSE, * the synchronization is disabled. Disabling synchronization can improve * performance in situations where the user is sure that there will be no unsafe * thread access. * * Sound filters are synchronized by default. */ RIM_INLINE void setIsSynchronized( Bool newIsSynchronized ) { isSynchronized = newIsSynchronized; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Filter In-Place Query Method /// Return whether or not this sound filter can process audio data in-place. /** * If TRUE, this means that the filter can use the same SoundBuffer for input * and output without any processing errors. This reduces memory requirements * for the user of the filter and increases the filter's flexibility. If FALSE, * the filter requires different input and output sound buffers. * * The default implementation returns FALSE, indicating that in-place processing * is not supported. */ virtual Bool allowsInPlaceProcessing() const; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Filter Input/Output Limit Accessor Methods /// Return the maximum number of audio inputs that a SoundFilter can support. RIM_INLINE static Size getMaximumNumberOfInputs() { return Size(math::max<UInt16>()); } /// Return the maximum number of audio outputs that a SoundFilter can support. RIM_INLINE static Size getMaximumNumberOfOutputs() { return Size(math::max<UInt16>()); } /// Return the maximum number of MIDI inputs that a SoundFilter can support. RIM_INLINE static Size getMaximumNumberOfMIDIInputs() { return Size(math::max<UInt16>()); } /// Return the maximum number of MIDI outputs that a SoundFilter can support. RIM_INLINE static Size getMaximumNumberOfMIDIOutputs() { return Size(math::max<UInt16>()); } protected: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Protected Constructor /// Create a new sound filter with 1 audio input and output, and no MIDI inputs or outputs. SoundFilter(); /// Create a new sound filter with the specified number of audio inputs and outputs. SoundFilter( Size numInputs, Size numOutputs ); /// Create a new sound filter with the specified number of audio inputs and outputs. SoundFilter( Size numInputs, Size numOutputs, Size numMIDIInputs, Size numMIDIOutputs ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Filter Parameter Value Accessor Methods /// Place the value of the parameter at the specified index in the output parameter. /** * This method accesses the value for a parameter. If if the parameter index * is out-of-bounds, FALSE is returned. Otherwise, TRUE is returned and the * value is placed in the output parameter. */ virtual Bool getParameterValue( Index parameterIndex, FilterParameter& value ) const; /// Attempt to set the parameter value at the specified index. /** * This method accesses the value for a parameter. If if the parameter index * is out-of-bounds or if the type of the given value can't be converted * to the parameter's type, FALSE is returned. Otherwise, TRUE is returned and the * parameter's value is set to the specified value. */ virtual Bool setParameterValue( Index parameterIndex, const FilterParameter& value ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Protected Stream Reset Method /// A method which is called whenever the filter's stream of audio is being reset. /** * This method can be overridden by a subclass to perform any initialization * or preprocessing necessary when restarting the filter's audio stream. * This can include reseting all parameter interpolation and processing to * its initial state to avoid coloration from previous audio or parameter values. * * The base implementation does nothing. This method is automatically synchronized * with the filter processing method, allowing it to be called from another thread * without consequences. As such, calling lockMutex() within this method will cause a deadlock. */ virtual void resetStream(); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Protected Filter Processing Method /// Process the given input frame and write the resulting audio to the given output frame. /** * If the number of input frame buffers is 0, it means that the filter should * behave as an output only. Likewise, if the number of output frame buffers is 0, * the filter should only read and process data from the input frame and not write * data to the output frame. The implementator of this method should detect these * cases and handle them without error. * * This method should return the number of samples successfully written to the output frame. * A value less than the number of input samples indicates an error occurred. * * The default implementation doesn't write anything to the output buffer and just * returns 0. Override it to provide more specific functionality. * * This method is automatically synchronized using lockMutex(), which keeps parameter * value changes from happening while a frame is being rendered. In order for this * to work properly, the filter subclass should call lockMutex() and unlockMutex() around * every method that modifies state used when processing frames. Calling lockMutex() within * this method will cause a deadlock. */ virtual SoundFilterResult processFrame( const SoundFilterFrame& inputFrame, SoundFilterFrame& outputFrame, Size numSamples ) = 0; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Protected Input and Output Number Accessor Methods /// Set the number of inputs that this filter should have. /** * Most filters will have only 1 input and 1 output, though some * filters may have have no input or no output. Some filters (like a sidechain * compressor or crossover) may have multiple inputs or outputs. * * This method is not thread synchronized, so subclasses must * provide their own means of synchronization when calling this method. * * The requested number of inputs is clamped to be no larger than * the maximum number of inputs, returned by SoundFilter::getMaximumNumberOfInputs(). */ RIM_INLINE void setInputCount( Size newNumInputs ) { numInputs = (UInt16)math::min( newNumInputs, SoundFilter::getMaximumNumberOfInputs() ); } /// Set the number of outputs that this filter should have. /** * Most filters will have only 1 input and 1 output, though some * filters may have have no input or no output. Some filters (like a sidechain * compressor or crossover) may have multiple inputs or outputs. * * This method is not thread synchronized, so subclasses must * provide their own means of synchronization when calling this method. * * The requested number of outputs is clamped to be no larger than * the maximum number of outputs, returned by SoundFilter::getMaximumNumberOfOutputs(). */ RIM_INLINE void setOutputCount( Size newNumOutputs ) { numOutputs = (UInt16)math::min( newNumOutputs, SoundFilter::getMaximumNumberOfOutputs() ); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Protected MIDI Input and Output Number Accessor Methods /// Set the number of MIDI inputs that this filter should have. /** * This method can be used by subclasses to change the number of recognized * MIDI inputs for the filter. The default number of inputs is 0. * * This method is not thread synchronized, so subclasses must * provide their own means of synchronization when calling this method. * * The requested number of inputs is clamped to be no larger than * the maximum number of inputs, returned by SoundFilter::getMaximumNumberOfMIDIInputs(). */ RIM_INLINE void setMIDIInputCount( Size newNumMIDIInputs ) { numMIDIInputs = (UInt16)math::min( newNumMIDIInputs, SoundFilter::getMaximumNumberOfMIDIInputs() );; } /// Set the number of MIDI outputs that this filter should have. /** * This method can be used by subclasses to change the number of recognized * MIDI outputs for the filter. The default number of outputs is 0. * * This method is not thread synchronized, so subclasses must * provide their own means of synchronization when calling this method. * * The requested number of outputs is clamped to be no larger than * the maximum number of outputs, returned by SoundFilter::getMaximumNumberOfMIDIOutputs(). */ RIM_INLINE void setMIDIOutputCount( Size newNumMIDIOutputs ) { numMIDIOutputs = (UInt16)math::min( newNumMIDIOutputs, SoundFilter::getMaximumNumberOfMIDIOutputs() ); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Protected Sound Stream State Accessor Methods /// Return whether or not the filter's next frame to be processed is also its first frame. /** * This method can be queried by subclasses to determine if the filter should reset * any parameter interpolation or buffers. */ RIM_INLINE Bool isFirstFrame() const { return frameIndex == 0; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Protected Parameter Mutex Accessor Methods /// Acquire a mutex which handles subclass rendering parameter synchronization. /** * This method should be called before a rendering parameter is modified * in a SoundFilter subclass. This operation may potentially block the * calling thread if the mutex is already acquired by another thread until * the mutex is released with a corresponding call to unlockMutex(). * * Every call to this method should be paired with a call to unlockMutex(). * Failure to observe this requirement will result in application deadlock. * * If the filter is not synchronized, via setIsSynchronized(), the method has * no effect. This improves performance in situations where the user knows * that there will not be any unsafe thread access to the filter. */ RIM_INLINE void lockMutex() const { if ( isSynchronized ) parameterMutex.lock(); } /// Release a mutex which handles subclass rendering parameter synchronization. /** * This method should be called after a rendering parameter is modified * in a SoundFilter subclass. It releases the parameter change mutex and * may potentially awaken threads that are waiting on the mutex. * * If the filter is not synchronized, via setIsSynchronized(), the method has * no effect. This improves performance in situations where the user knows * that there will not be any unsafe thread access to the filter. */ RIM_INLINE void unlockMutex() const { if ( isSynchronized ) parameterMutex.unlock(); } private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Members /// The current number of audio inputs that this sound filter has. UInt16 numInputs; /// The current number of audio outputs that this sound filter has. UInt16 numOutputs; /// The current number of MIDI inputs that this sound filter has. UInt16 numMIDIInputs; /// The current number of MIDI outputs that this sound filter has. UInt16 numMIDIOutputs; /// The index of the next frame to be processed by this filter, or the current frame if the filter is currently processing. UInt64 frameIndex; /// A mutex object which can provide thread synchronization for SoundFilter subclasses. /** * This mutex is automatically locked whenever a filter is processing and released * when it done processing. A SoundFilter subclass can acquire this mutex indirectly * through the lockMutex() */ mutable threads::Mutex parameterMutex; /// A boolean value indicating whether or not this sound filter performs thread synchronization. Bool isSynchronized; }; //########################################################################################## //************************ End Rim Sound Filters Namespace ******************************* RIM_SOUND_FILTERS_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_SOUND_FILTER_H <file_sep>/* * rimLog.h * Rim Framework * * Created by <NAME> on 8/23/11. * Copyright 2011 __MyCompanyName__. All rights reserved. * */ #ifndef INCLUDE_RIM_LOG_H #define INCLUDE_RIM_LOG_H #include "rimIOConfig.h" #include "rimStringOutputStream.h" #include "rimPrintStream.h" #include "../exceptions/rimException.h" #include "../lang/rimPointer.h" #include "../util/rimArray.h" #include "../util/rimStaticArray.h" //########################################################################################## //****************************** Start Rim IO Namespace ********************************** RIM_IO_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class that allows the user to print messages to an abstract string output stream. class Log { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructor /// Create a Log which prints its output to standard output. Log(); /// Create a Log which sends its output to the specified StringOutputStream. Log( const lang::Pointer<StringOutputStream>& newStream ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Stream Accessor Methods /// Return a pointer to the StringOutputStream which this log is outputing to. RIM_INLINE const lang::Pointer<StringOutputStream>& getStream() const { return stream; } /// Set the StringOutputStream which this log should output to. RIM_INLINE void setStream( const lang::Pointer<StringOutputStream>& newStream ) { stream = newStream; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Single Character Buffer Output Operators RIM_INLINE Log& operator < ( Char character ) { if ( stream.isSet() ) stream->writeASCII( character ); return *this; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Null-Terminated Character Buffer Output Operators RIM_INLINE Log& operator < ( const Char* characters ) { if ( stream.isSet() ) stream->writeASCII( characters ); return *this; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** String Output Operators RIM_INLINE Log& operator < ( const data::String& string ) { if ( stream.isSet() ) stream->writeASCII( string ); return *this; } RIM_INLINE Log& operator < ( const data::UTF8String& string ) { if ( stream.isSet() ) stream->writeUTF8( string ); return *this; } RIM_INLINE Log& operator < ( const data::UTF16String& string ) { if ( stream.isSet() ) stream->writeUTF8( data::UTF8String(string) ); return *this; } RIM_INLINE Log& operator < ( const data::UTF32String& string ) { if ( stream.isSet() ) stream->writeUTF8( data::UTF8String(string) ); return *this; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Primitive Type Output Operators /// Write the specified boolean value to this output log. RIM_INLINE Log& operator < ( Bool value ) { if ( stream.isSet() ) stream->writeASCII( data::String(value) ); return *this; } /// Write the specified short integer value to this output log. RIM_INLINE Log& operator < ( Short value ) { if ( stream.isSet() ) stream->writeASCII( data::String(value) ); return *this; } /// Write the specified unsigned short integer value to this output log. RIM_INLINE Log& operator < ( UShort value ) { if ( stream.isSet() ) stream->writeASCII( data::String(value) ); return *this; } /// Write the specified integer value to this output log. RIM_INLINE Log& operator < ( Int value ) { if ( stream.isSet() ) stream->writeASCII( data::String(value) ); return *this; } /// Write the specified unsigned integer value to this output log. RIM_INLINE Log& operator < ( UInt value ) { if ( stream.isSet() ) stream->writeASCII( data::String(value) ); return *this; } /// Write the specified long integer value to this output log. RIM_INLINE Log& operator < ( Long value ) { if ( stream.isSet() ) stream->writeASCII( data::String(value) ); return *this; } /// Write the specified unsigned long integer value to this output log. RIM_INLINE Log& operator < ( ULong value ) { if ( stream.isSet() ) stream->writeASCII( data::String(value) ); return *this; } /// Write the specified long long integer value to this output log. RIM_INLINE Log& operator < ( LongLong value ) { if ( stream.isSet() ) stream->writeASCII( data::String(value) ); return *this; } /// Write the specified unsigned long long integer value to this output log. RIM_INLINE Log& operator < ( ULongLong value ) { if ( stream.isSet() ) stream->writeASCII( data::String(value) ); return *this; } /// Write the specified floating point value to this output log. RIM_INLINE Log& operator < ( Float value ) { if ( stream.isSet() ) stream->writeASCII( data::String(value) ); return *this; } /// Write the specified double floating point value to this output log. RIM_INLINE Log& operator < ( Double value ) { if ( stream.isSet() ) stream->writeASCII( data::String(value) ); return *this; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Pointer Type Output Operators /// Write the specified pointer to this output log. /** * The basic implementation for this method writes either 'NULL' * if the pointer is NULL, or converts the pointer to a hexadecimal * integer representation and writes that. */ template < typename T > RIM_INLINE Log& operator < ( T* pointer ) { if ( stream.isNull() ) return *this; if ( pointer == NULL ) stream->writeASCII( "NULL" ); else stream->writeASCII( data::String( PointerInt(pointer), 16 ) ); return *this; } /// Write the specified pointer to this output log. /** * The basic implementation for this method writes either 'NULL' * if the pointer is NULL, or converts the pointer to a hexadecimal * integer representation and writes that. */ template < typename T > RIM_INLINE Log& operator < ( const typename lang::Pointer<T>& pointer ) { if ( stream.isNull() ) return *this; if ( pointer.isNull() ) stream->writeASCII( "NULL" ); else stream->writeASCII( data::String( PointerInt(pointer.getPointer()), 16 ) ); return *this; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Array Type Output Operators /// Write the specified array to this output log. /** * The basic implementation for this method writes either '[NULL]' * if the array is NULL, or writes an array representation of every element * in the array. */ template < typename T > RIM_NO_INLINE Log& operator < ( const typename util::Array<T>& array ) { if ( stream.isNull() ) return *this; if ( array.isNull() ) stream->writeASCII( "[NULL]" ); else { stream->writeASCII( "[ " ); Index lastIndex = array.getSize() - 1; for ( Index i = 0; i < array.getSize(); i++ ) { *this < array[i]; if ( i != lastIndex ) stream->writeASCII( ", " ); } stream->writeASCII( " ]" ); } return *this; } /// Write the specified static array to this output log. /** * The basic implementation for this method writes either '[NULL]' * if the array is NULL, or writes an array representation of every element * in the array. */ template < typename T, Size size > RIM_NO_INLINE Log& operator < ( const typename util::StaticArray<T,size>& array ) { if ( stream.isNull() ) return *this; stream->writeASCII( "[ " ); Index lastIndex = size - 1; for ( Index i = 0; i < size; i++ ) { *this < array[i]; if ( i != lastIndex ) stream->writeASCII( ", " ); } stream->writeASCII( " ]" ); return *this; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Exception Output Operators /// Write the specified exeception object to this output log. /** * This method prints the exception in the form 'exception_type: exception_message'. */ Log& operator < ( const exceptions::Exception& exception ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Other Type Output Operators /// Convert the specified templated object to a string and write it to the output log. /** * This method uses the specified object's string cast operator to convert it * to a string. */ template < typename T > RIM_INLINE Log& operator < ( const T& object ) { if ( stream.isSet() ) stream->writeASCII( object.operator data::String() ); return *this; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** New Line Output Operator /// Write a new line character and then log the specified object, using one of the standard '<' operators. template < typename T > RIM_INLINE Log& operator << ( const T& object ) { *this < '\n' < object; return *this; } private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Members /// A pointer to the StringOutputStream object which is being logged to. lang::Pointer<StringOutputStream> stream; }; /// The standard output log object, connected to standard output. extern Log Console; //########################################################################################## //****************************** End Rim IO Namespace ************************************ RIM_IO_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_LOG_H <file_sep>/* * rimGraphicsMaterials.h * Rim Graphics * * Created by <NAME> on 11/28/11. * Copyright 2011 __MyCompanyName__. All rights reserved. * */ #ifndef INCLUDE_RIM_GRAPHICS_MATERIALS_H #define INCLUDE_RIM_GRAPHICS_MATERIALS_H #include "materials/rimGraphicsMaterialsConfig.h" #include "materials/rimGraphicsMaterialTechniqueUsage.h" #include "materials/rimGraphicsMaterialTechnique.h" #include "materials/rimGraphicsMaterial.h" #include "materials/rimGraphicsGenericMaterialTechnique.h" #include "materials/rimGraphicsGenericMaterial.h" #endif // INCLUDE_RIM_GRAPHICS_MATERIALS_H <file_sep>/* * rimFFT.h * Rim Framework * * Created by <NAME> on 4/4/13. * Copyright 2013 __MyCompanyName__. All rights reserved. * */ #ifndef INCLUDE_RIM_FFT_H #define INCLUDE_RIM_FFT_H #include "rimMathConfig.h" #include "rimComplex.h" //########################################################################################## //***************************** Start Rim Math Namespace ********************************* RIM_MATH_NAMESPACE_START //****************************************************************************************** //########################################################################################## //########################################################################################## //########################################################################################## //############ //############ 1D Fourier Transform Methods //############ //########################################################################################## //########################################################################################## /// Compute the forward Fourier transform in-place on the specified array of complex numbers. /** * The results of the transform are stored in the input data array. * * The method returns whether or not the FFT was successfully performed on the input data. * The method may fail if the data pointer is NULL or if the requested FFT size is not * a power of two. */ template < typename T > Bool fft( Complex<T>* data, Size size ); /// Compute the inverse Fourier transform in-place on the specified array of complex numbers. /** * The results of the transform are stored in the input data array. * * The method returns whether or not the iFFT was successfully performed on the input data. * The method may fail if the data pointer is NULL or if the requested FFT size is not * a power of two. */ template < typename T > Bool ifft( Complex<T>* data, Size size ); /// Shift the zero-frequency components of the specified array to the center of the array. /** * This can be useful when visualizing the output of an FFT. * * The method return whether or not the operation was successful. It may fail if the * data pointer is NULL or if the size is not divisible by 2. */ template < typename T > Bool fftShift( Complex<T>* data, Size size ); //########################################################################################## //########################################################################################## //############ //############ 2D Fourier Transform Methods //############ //########################################################################################## //########################################################################################## /// Compute the forward 2D Fourier transform in-place on the specified array of complex numbers. /** * The input data should be stored in a row-major format, with each row representing a * contiguous block of complex numbers. The results of the transform are stored in the input data array. * * The method returns whether or not the FFT was successfully performed on the input data. * The method may fail if the data pointer is NULL or if the requested FFT width or height is not * a power of two. */ template < typename T > Bool fft2D( Complex<T>* data, Size width, Size height ); /// Compute the inverse 2D Fourier transform in-place on the specified array of complex numbers. /** * The input data should be stored in a row-major format, with each row representing a * contiguous block of complex numbers. The results of the transform are stored in the input data array. * * The method returns whether or not the FFT was successfully performed on the input data. * The method may fail if the data pointer is NULL or if the requested FFT width or height is not * a power of two. */ template < typename T > Bool ifft2D( Complex<T>* data, Size width, Size height ); /// Shift the zero-frequency components of the specified 2D matrix to the center of the matrix. /** * This can be useful when visualizing the output of an FFT. * * The method return whether or not the operation was successful. It may fail if the * data pointer is NULL or if the width or height are not divisible by 2. */ template < typename T > Bool fftShift2D( Complex<T>* data, Size width, Size height ); //########################################################################################## //***************************** End Rim Math Namespace *********************************** RIM_MATH_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_FFT_H <file_sep>/* * rimIOConfig.h * Rim IO * * Created by <NAME> on 12/28/08. * Copyright 2008 Rim Software. All rights reserved. * */ #ifndef INCLUDE_RIM_IO_CONFIG_H #define INCLUDE_RIM_IO_CONFIG_H #include "../rimConfig.h" #include "../rimFileSystem.h" #include "../rimData.h" #include "../exceptions/rimIOException.h" //########################################################################################## //########################################################################################## //############ //############ Library Namespace Configuration //############ //########################################################################################## //########################################################################################## /// Define the name of the IO library namespace. #ifndef RIM_IO_NAMESPACE #define RIM_IO_NAMESPACE io #endif #ifndef RIM_IO_NAMESPACE_START #define RIM_IO_NAMESPACE_START RIM_NAMESPACE_START namespace RIM_IO_NAMESPACE { #endif #ifndef RIM_IO_NAMESPACE_END #define RIM_IO_NAMESPACE_END }; RIM_NAMESPACE_END #endif RIM_NAMESPACE_START /// A namespace containing classes which provide advanced ways to do streaming data input and output. namespace RIM_IO_NAMESPACE { }; RIM_NAMESPACE_END //########################################################################################## //****************************** Start Rim IO Namespace ********************************** RIM_IO_NAMESPACE_START //****************************************************************************************** //########################################################################################## using rim::exceptions::IOException; //########################################################################################## //****************************** End Rim IO Namespace ************************************ RIM_IO_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_IO_CONFIG_H <file_sep>/* * rimSoundMIDIEncoder.h * Rim Sound * * Created by <NAME> on 5/31/13. * Copyright 2013 __MyCompanyName__. All rights reserved. * */ #ifndef INCLUDE_RIM_SOUND_MIDI_ENCODER_H #define INCLUDE_RIM_SOUND_MIDI_ENCODER_H #include "rimSoundIOConfig.h" //########################################################################################## //*************************** Start Rim Sound IO Namespace ******************************* RIM_SOUND_IO_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class which encodes MIDI file data from a stream of MIDI events. class MIDIEncoder : public MIDIOutputStream { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Stream Writing Methods /// Flush the MIDI output stream, sending all internally buffered events to the destination. /** * This method causes all currently pending output MIDI data to be sent to it's * final destination. This method blocks the current thread until it ensures that * this is done and that all internal data buffers are emptied if they have any contents. */ virtual void flush(); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Public Seek Status Accessor Methods /// Return whether or not seeking is allowed in this input stream. virtual Bool canSeek() const; /// Return whether or not this input stream's current position can be moved by the specified signed event offset. /** * This event offset is specified as the signed number of MIDI events to move * in the stream. */ virtual Bool canSeek( Int64 relativeEventOffset ) const; /// Move the current event position in the stream by the specified signed amount of events. /** * This method attempts to seek the position in the stream by the specified amount of MIDI events. * The method returns the signed amount that the position in the stream was changed * by. Thus, if seeking is not allowed, 0 is returned. Otherwise, the stream should * seek as far as possible in the specified direction and return the actual change * in position. */ virtual Int64 seek( Int64 relativeEventOffset ); protected: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Protected Stream Methods /// Write the specified number of MIDI events from the buffer to the output stream. /** * This method attempts to write the specified number of MIDI events to the stream * from the buffer. It then returns the total number of valid events which * were written to the stream. The current write position in the stream * is advanced by the number of events that are written. */ virtual Size writeEvents( const MIDIBuffer& buffer, Size numEvents ); protected: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Members }; //########################################################################################## //*************************** End Rim Sound IO Namespace ********************************* RIM_SOUND_IO_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_SOUND_MIDI_ENCODER_H <file_sep>/* * rimTimeOfDay.h * Rim Framework * * Created by <NAME> on 4/28/12. * Copyright 2012 __MyCompanyName__. All rights reserved. * */ #ifndef INCLUDE_RIM_TIME_OF_DAY_H #define INCLUDE_RIM_TIME_OF_DAY_H #include "rimTimeConfig.h" //########################################################################################## //******************************* Start Time Namespace ********************************* RIM_TIME_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class which represents a particular moment within a 24-hour day to nanosecond resolution. class TimeOfDay { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructors /// Create a TimeOfDay object that represents the first moment after midnight of a day. TimeOfDay() : hours( 0 ), minutes( 0 ), seconds( 0 ), nanoseconds( 0 ) { } /// Create a TimeOfDay object that represents the specified moment after midnight of a day. /** * This time is specified by the hour after midnight [0,23], minute after the start * of the hour [0,59], second after the start of the minute [0,59], and the * nanoseconds after the start of the second [0,999999999]. If any of these values * are outside of the valid range, they are wrapped around and carried into the * next time measurement unit. * * For instance, specifying a time of 0 hours, 59 minutes, * 59 seconds, and 1.5e9 nanoseconds will result in an actual time of day of * 1 hour, 0 minutes, 0 seconds, and 0.5e9 nanoseconds. */ TimeOfDay( UInt newHours, UInt newMinutes, UInt newSeconds, UInt32 newNanoseconds = 0 ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Hour Accessor Methods /// Get the hour after midnight of this TimeOfDay. RIM_INLINE UInt getHour() const { return (UInt)hours; } /// Set the hour after midnight of this TimeOfDay. /** * If the specified hour value is outside of the range * [0,23], the value is wrapped around to the next day * so that it lies within the valid range. */ RIM_INLINE void setHour( UInt newHours ) { hours = UByte(newHours % 24); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Minute Accessor Methods /// Get the minute after the start of the hour of this TimeOfDay. RIM_INLINE UInt getMinute() const { return (UInt)minutes; } /// Set the minute after the start of the hour of this TimeOfDay. /** * If the specified minute value is outside of the range * [0,59], the value is wrapped around to the next hour (or further) * and the hour of this TimeOfDay is increased by the required * number of hours. */ void setMinute( UInt newMinutes ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Seconds Accessor Methods /// Get the seconds after the start of the minute of this TimeOfDay. RIM_INLINE UInt getSecond() const { return (UInt)seconds; } /// Set the second after the start of the minute of this TimeOfDay. /** * If the specified second value is outside of the range * [0,59], the value is wrapped around to the next minute (or further) * and the minute of this TimeOfDay is increased by the required * number of minutes. If necessary, the hour of this TimeOfDay may * also be altered if the wrap-around is sever enough. */ void setSecond( UInt newSeconds ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Fractional Seconds Accessor Methods /// Get the seconds after the start of the minute of this TimeOfDay. RIM_INLINE UInt32 getNanoseconds() const { return nanoseconds; } /// Set the second after the start of the minute of this TimeOfDay. /** * If the specified second value is outside of the range * [0,59], the value is wrapped around to the next minute (or further) * and the minute of this TimeOfDay is increased by the required * number of minutes. If necessary, the hour of this TimeOfDay may * also be altered if the wrap-around is sever enough. */ void setNanoseconds( UInt32 newNanoseconds ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** String Conversion Methods /// Convert the TimeOfDay object to a String representation. data::String toString() const; /// Convert the TimeOfDay object to a String representation. RIM_FORCE_INLINE operator data::String() const { return this->toString(); } private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Members /// The number of hours since midnight. UInt8 hours; /// The number of minutes since the start of the hour. UInt8 minutes; /// The number of seconds since the start of the minute. UInt8 seconds; /// Padding to 4-byte boundary. UInt8 padding; /// The number of nanoseconds that have passed since the start of the second. UInt32 nanoseconds; }; //########################################################################################## //******************************* End Time Namespace *********************************** RIM_TIME_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_TIME_OF_DAY_H <file_sep>/* * rimGraphicsGUIGlyphLayout.h * Rim Software * * Created by <NAME> on 11/11/14. * Copyright 2014 __MyCompanyName__. All rights reserved. * */ #ifndef INCLUDE_RIM_GRAPHICS_GUI_GLYPH_LAYOUT_H #define INCLUDE_RIM_GRAPHICS_GUI_GLYPH_LAYOUT_H #include "rimGraphicsGUIFontsConfig.h" #include "rimGraphicsGUIFontStyle.h" //########################################################################################## //********************* Start Rim Graphics GUI Fonts Namespace *************************** RIM_GRAPHICS_GUI_FONTS_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class which stores the bounding boxes of glyphs that have the same font style. class GlyphLayout { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructor /// Create a default glyph layout with no glyphs and an invalid font style. GlyphLayout(); /// Create a glyph layout with the specified font style. GlyphLayout( const FontStyle& newStyle ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Destructor /// Destroy this glyph layout, releasing all internal resources. ~GlyphLayout(); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Glyph Accessor Methods /// Return the number of glyphs in this layout. RIM_INLINE Size getGlyphCount() const { return glyphs.getSize(); } /// Return the UTF-32 character code for the glyph at the specified index in this layout. RIM_INLINE UTF32Char getGlyphCharacter( Index glyphIndex ) const { return glyphs[glyphIndex].character; } /// Return the bounding box for the glyph at the specified index in this layout. RIM_INLINE const AABB2f& getGlyphBounds( Index glyphIndex ) const { return glyphs[glyphIndex].bounds; } /// Add a new glyph to this glyph layout with the specified character code and bounding box. void addGlyph( UTF32Char newCharacter, const AABB2f& newBounds ); /// Remove all glyphs from this layout. void clearGlyphs(); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Font Style Accessor Methods /// Return an object which stores the font style parameters for this glyph layout. RIM_INLINE const FontStyle& getStyle() const { return style; } /// Set an object which stores the font style parameters for this glyph layout. /** * After changing the style, the glyph layout must be regenerated if the font or font * size changed in order to remain valid. */ RIM_INLINE void setStyle( const FontStyle& newStyle ) { style = newStyle; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Bounding Box Accessor Methods /// Return A 2D axis-aligned bounding box which completely encloses all glyphs in this layout. RIM_INLINE const AABB2f& getBounds() const { return bounds; } /// Set a 2D axis-aligned bounding box which completely encloses all glyphs in this layout. RIM_INLINE void setBounds( const AABB2f& newBounds ) { bounds = newBounds; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Glyph Picking Method /// Determine the index of the glyph that contains the specified point. /** * The method finds the first glyph whose bounds contain the point, * puts the index of that glyph in the output parameter and returns TRUE. * If there is no glyph containing that point, FALSE is returned. */ Bool pickGlyph( const Vector2f& point, Index glyphIndex ) const; private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Members /// A class that stores the bounding box and character code for a glyph. class Glyph { public: /// Create a new glyph with the specified character and bounding box. RIM_INLINE Glyph( UTF32Char newCharacter, const AABB2f& newBounds ) : bounds( newBounds ), character( newCharacter ) { } /// A 2D axis-aligned bounding box for this glyph. AABB2f bounds; /// The character code associated with this glyph, or 0 if there is no character code. UTF32Char character; }; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Members /// An object which stores the font style parameters for this glyph layout. FontStyle style; /// A 2D axis-aligned bounding box which completely encloses all glyphs in this layout. AABB2f bounds; /// A list of the glyphs that are contained in this glyph layout. ArrayList<Glyph> glyphs; }; //########################################################################################## //********************* End Rim Graphics GUI Fonts Namespace ***************************** RIM_GRAPHICS_GUI_FONTS_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_GRAPHICS_GUI_GLYPH_LAYOUT_H <file_sep>/* * rimGraphicsConfig.h * Rim Graphics * * Created by <NAME> on 6/7/08. * Copyright 2008 Rim Software. All rights reserved. * */ #ifndef INCLUDE_RIM_GRAPHICS_CONFIG_H #define INCLUDE_RIM_GRAPHICS_CONFIG_H #include "rim/rimFramework.h" #include "rim/rimImages.h" #include "rim/rimBVH.h" #include "rim/rimGUI.h" //########################################################################################## //########################################################################################## //############ //############ Library Namespace Configuration //############ //########################################################################################## //########################################################################################## #ifndef RIM_GRAPHICS_NAMESPACE_START #define RIM_GRAPHICS_NAMESPACE_START RIM_NAMESPACE_START namespace graphics { #endif #ifndef RIM_GRAPHICS_NAMESPACE_END #define RIM_GRAPHICS_NAMESPACE_END }; RIM_NAMESPACE_END #endif //########################################################################################## //************************** Start Rim Graphics Namespace ******************************** RIM_GRAPHICS_NAMESPACE_START //****************************************************************************************** //########################################################################################## typedef float Real; using rim::math::AABB2i; using namespace rim::math; typedef rim::math::Vector2D<Bool> Vector2b; typedef rim::math::Vector3D<Bool> Vector3b; typedef rim::math::Vector4D<Bool> Vector4b; typedef rim::math::Vector2D<Real> Vector2; typedef rim::math::Matrix2D<Real> Matrix2; typedef rim::math::AABB2D<Real> AABB2; typedef rim::math::Transform2D<Real> Transform2; typedef rim::math::Vector3D<Real> Vector3; typedef rim::math::Matrix3D<Real> Matrix3; typedef rim::math::AABB3D<Real> AABB3; typedef rim::math::Transform3D<Real> Transform3; typedef rim::math::Vector4D<Real> Vector4; typedef rim::math::Matrix4D<Real> Matrix4; typedef rim::math::Plane3D<Real> Plane3; typedef rim::bvh::BoundingSphere<Real> BoundingSphere; using rim::images::Color3f; using rim::images::Color4f; using rim::images::Color3d; using rim::images::Color4d; using rim::images::Image; using rim::images::PixelFormat; //########################################################################################## //************************** End Rim Graphics Namespace ********************************** RIM_GRAPHICS_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_GRAPHICS_CONFIG_H <file_sep>/* * rimThreadPriority.h * Rim Software * * Created by <NAME> on 7/29/14. * Copyright 2014 __MyCompanyName__. All rights reserved. * */ #ifndef INCLUDE_RIM_THREAD_PRIORITY_H #define INCLUDE_RIM_THREAD_PRIORITY_H #include "rimThreadsConfig.h" #include "../rimData.h" //########################################################################################## //*************************** Start Rim Threads Namespace ******************************** RIM_THREADS_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// An enum class which specifies the different execution priorities that a thread can have. class ThreadPriority { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Thread Priority Enum Definition /// An enum type which represents the types of thread scheduling priority. typedef enum Enum { /// The default thread priority. DEFAULT, /// A thread priority for processes that don't need to be run often. LOW, /// A thread priority for processes with priority between low and high. MEDIUM, /// A thread priority for processes that need to be run often. HIGH, /// A thread priority used for time-critical processing with strict real-time requirements. TIME_CRITICAL }; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructors /// Create a new thread priority with the DEFAULT thread priority. RIM_INLINE ThreadPriority() : type( DEFAULT ) { } /// Create a new thread priority with the specified thread priority enum value. RIM_INLINE ThreadPriority( Enum newType ) : type( newType ) { } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Enum Cast Operator /// Convert this thread priority type to an enum value. RIM_INLINE operator Enum () const { return type; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** String Representation Accessor Methods /// Return a string representation of the thread priority. data::String toString() const; /// Convert this thread priority into a string representation. RIM_FORCE_INLINE operator data::String () const { return this->toString(); } private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Members /// An enum value which indicates the type of thread priority. Enum type; }; //########################################################################################## //*************************** End Rim Threads Namespace ********************************** RIM_THREADS_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_THREAD_PRIORITY_H <file_sep>/* * rimGraphicsObjectAssetTranscoder.h * Rim Software * * Created by <NAME> on 6/14/14. * Copyright 2014 __MyCompanyName__. All rights reserved. * */ #ifndef INCLUDE_RIM_GRAPHICS_OBJECT_ASSET_TRANSCODER_H #define INCLUDE_RIM_GRAPHICS_OBJECT_ASSET_TRANSCODER_H #include "rimGraphicsAssetsConfig.h" #include "rimGraphicsShapeAssetTranscoder.h" //########################################################################################## //*********************** Start Rim Graphics Assets Namespace **************************** RIM_GRAPHICS_ASSETS_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class which encodes and decodes graphics objects to the asset format. class GraphicsObjectAssetTranscoder : public AssetTypeTranscoder<GraphicsObject> { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Destructor //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Text Encoding/Decoding Methods /// Decode an object from the specified string stream, returning a pointer to the final object. virtual Pointer<GraphicsObject> decodeText( const AssetType& assetType, const AssetObject& assetObject, ResourceManager* resourceManager = NULL ); /// Encode an object of this asset type into a text-based format. virtual Bool encodeText( UTF8StringBuffer& buffer, ResourceManager* resourceManager, const GraphicsObject& object ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Public Static Data Members /// An object indicating the asset type for a graphics object. static const AssetType OBJECT_ASSET_TYPE; private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Type Declarations /// An enum describing the fields that a graphics object can have. typedef enum Field { /// An undefined field. UNDEFINED = 0, /// "name" The name of this graphics object. NAME, /// "flags" Boolean configuration flags for the object. FLAGS, /// "position" The 3D position of the object in world space. POSITION, /// "orientation" The 3D orientation of the object in world space. ORIENTATION, /// "scale" The scale of the object in world space. SCALE, /// "shapes" A list of the graphics shapes in this object. SHAPES, /// "children" A list of the graphics object children of this object. CHILDREN }; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Helper Methods /// Return an enum value indicating the field indicated by the given field name. static Field getFieldType( const AssetObject::String& name ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Members /// An object which encodes and decodes shapes. GraphicsShapeAssetTranscoder shapeTranscoder; /// A temporary asset object used when parsing object child objects. AssetObject tempObject; }; //########################################################################################## //*********************** End Rim Graphics Assets Namespace ****************************** RIM_GRAPHICS_ASSETS_NAMESPACE_END //****************************************************************************************** //########################################################################################## //########################################################################################## //**************************** Start Rim Assets Namespace ******************************** RIM_ASSETS_NAMESPACE_START //****************************************************************************************** //########################################################################################## template <> RIM_INLINE const AssetType& AssetType::of<rim::graphics::objects::GraphicsObject>() { return rim::graphics::assets::GraphicsObjectAssetTranscoder::OBJECT_ASSET_TYPE; } //########################################################################################## //**************************** End Rim Assets Namespace ********************************** RIM_ASSETS_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_GRAPHICS_OBJECT_ASSET_TRANSCODER_H <file_sep>/* * rimSoundConfig.h * Rim Sound * * Created by <NAME> on 6/7/08. * Copyright 2008 Rim Software. All rights reserved. * */ #ifndef INCLUDE_RIM_SOUND_CONFIG_H #define INCLUDE_RIM_SOUND_CONFIG_H #include "rim/rimFramework.h" //########################################################################################## //########################################################################################## //############ //############ Library Configuration //############ //########################################################################################## //########################################################################################## /// Define whether or not the sound library should use SIMD operations to accelerate sound processing. /** * Setting the value to a non-zero value indicates that SIMD processing should be used. */ #define RIM_SOUND_USE_SIMD 1 //########################################################################################## //########################################################################################## //############ //############ Library Namespace Configuration //############ //########################################################################################## //########################################################################################## #ifndef RIM_SOUND_NAMESPACE #define RIM_SOUND_NAMESPACE sound #endif #ifndef RIM_SOUND_NAMESPACE_START #define RIM_SOUND_NAMESPACE_START RIM_NAMESPACE_START namespace RIM_SOUND_NAMESPACE { #endif #ifndef RIM_SOUND_NAMESPACE_END #define RIM_SOUND_NAMESPACE_END }; RIM_NAMESPACE_END #endif RIM_NAMESPACE_START /// The enclosing namespace for the sound library. namespace RIM_SOUND_NAMESPACE { }; RIM_NAMESPACE_END //########################################################################################## //**************************** Start Rim Sound Namespace ********************************* RIM_SOUND_NAMESPACE_START //****************************************************************************************** //########################################################################################## /// Define the type used to indicate the index of a sample within a sound. typedef UInt64 SampleIndex; /// Define the type used to indicate the size in samples of a sound. typedef UInt64 SoundSize; using rim::math::AABB1f; using rim::math::Vector2f; using rim::math::Vector3f; //########################################################################################## //**************************** End Rim Sound Namespace *********************************** RIM_SOUND_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_SOUND_CONFIG_H <file_sep>/* * rimGUIElementMenuItem.h * Rim GUI * * Created by <NAME> on 6/3/09. * Copyright 2009 Rim Software. All rights reserved. * */ #ifndef INCLUDE_RIM_GUI_MENU_ITEM_H #define INCLUDE_RIM_GUI_MENU_ITEM_H #include "rimGUIConfig.h" #include "rimGUIInput.h" #include "rimGUIElement.h" #include "rimGUIMenuItemDelegate.h" //########################################################################################## //*************************** Start Rim GUI Namespace ****************************** RIM_GUI_NAMESPACE_START //****************************************************************************************** //########################################################################################## class Menu; //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class which represents a single item of a drop-down GUI menu. class MenuItem : public GUIElement { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Menu Item Type Enum Declaration /// An enum type which specifies special kinds of menu items. typedef enum Type { /// A menu item type that represents a normal menu item. NORMAL = 0, /// A menu item type that represents an item that has a submenu. MENU, /// A menu item type that represents a menu separator. /** * A menu item separator is a type of item that is usually drawn as a * horizontal line which is used to break up groups of menu items * in long menus. */ SEPARATOR }; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructors /// Create a new menu item with the specified specialized type. /** * This constructor allows one to create menu items that represent * special kinds of items - separators, etc - that aren't able to be * represented easily another way. */ MenuItem( Type newType = NORMAL ); /// Create a new normal menu item with the specified name string and no keyboard shortcut. /** * This menu item is enabled by default. */ MenuItem( const UTF8String& name ); /// Create a new normal menu item with the specified name string and keyboard shortcut. /** * This constructor allows one to specify if the menu item should be enabled or not. * The default behavior if the parameter is ommitted is for the item to be enabled. */ MenuItem( const UTF8String& name, const input::KeyboardShortcut& shortcut, Bool isEnabled = true ); /// Create a new submenu menu item which uses the specified menu as a submenu. /** * If the specified menu is NULL or if it already has a parent item or menu bar, * the menu is not used and the submenu is unitialized. */ MenuItem( const Pointer<Menu>& menu ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Destructor /// Destroy a menu item and release all internal state. /** * The destructor for a menu item should not be called until it is not being * used as part of any active GUI. */ ~MenuItem(); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Submenu Accessor Methods /// Return whether or not this menu item has a child menu associated with it. /** * This method always returns FALSE is this menu item is a separator or a * normal menu item. */ Bool hasMenu() const; /// Return a pointer to the child menu associated with this menu item. /** * If there is no such menu, or if this menu item's type doesn't allow it * to have a child menu, a NULL pointer is returned. */ Pointer<Menu> getMenu() const; /// Set the child menu which should be associated with this menu item. /** * If the specified menu pointer is NULL, this has the effect of clearing * any existing child menu from this menu item. The method returns whether * or not the menu set operation was successful - it can fail if this menu * item is a separator or normal menu item, since they can't have child menus. */ Bool setMenu( const Pointer<Menu>& newSubmenu ); /// Remove any child menu that was associated with this menu item. void removeMenu(); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Keyboard Shortcut Accessor Methods /// Return an object which describes the keyboard shortcut to use for this menu item. const input::KeyboardShortcut& getKeyboardShortcut() const; /// Set an object which describes the keyboard shortcut to use for this menu item. /** * The method returns whether or not the keyboard shortcut was accepted as being * valid. A shortcut can fail validation if it uses a modifier key combination that * is not valid or if the menu item has a type that does not support a keyboard * shortcut. */ Bool setKeyboardShortcut( const input::KeyboardShortcut& shortcut ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Name Accessor Methods /// Return a string representing the name of this menu item. /** * If this item is a separator menu item, this method always returns * an empty string. */ UTF8String getName() const; /// Set a string which specifies a new name for this menu item. /** * If this item is a type of menu item that can't have a name (such as a separator), * or if the name change operation is not successful, FALSE is returned. * Otherwise, the name of the menu item is changed and TRUE is returned. */ Bool setName( const UTF8String& newName ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Delegate Accessor Methods /// Return a reference to the delegate object associated with this menu item. const MenuItemDelegate& getDelegate() const; /// Set the delegate object to which this menu item sends events. void setDelegate( const MenuItemDelegate& delegate ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** State Accessor Methods /// Return whether or not this menu item is currently able to be selected by the user. Bool getIsEnabled() const; /// Set whether or not this menu item should be able to be selected by the user. /** * The method returns whether or not the state of the menu item was able to * be changed. */ Bool setIsEnabled( Bool newIsEnabled ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Type Accessor Methods /// Return an enum value indicating the type of this menu item. /** * The type of a menu item is determined at construction and cannot be changed. */ Type getType() const; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Parent Menu Accessor Methods /// Return a pointer to the menu that this menu item belongs to. /** * This method returns a NULL pointer if the menu item doesn't have a parent * menu. Use the hasParentMenu() function to detect if the menu item * has a parent menu. */ Menu* getParentMenu() const; /// Return whether or not this menu item is part of a menu. Bool hasParentMenu() const; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Platform-Specific Element Pointer Accessor Method /// Get a pointer to this menu item's platform-specific internal representation. /** * On Mac OS X, this method returns a pointer to a subclass of NSMenuItem which * represents the menu item. * * On Windows, this method returns */ virtual void* getInternalPointer() const; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Static Shared Construction Methods /// Create a shared-pointer menu item object, calling the constructor with the same arguments. RIM_INLINE static Pointer<MenuItem> construct( Type type ) { return Pointer<MenuItem>( util::construct<MenuItem>( type ) ); } /// Create a shared-pointer menu item object, calling the constructor with the same arguments. RIM_INLINE static Pointer<MenuItem> construct( const UTF8String& name ) { return Pointer<MenuItem>( util::construct<MenuItem>( name ) ); } /// Create a shared-pointer menu item object, calling the constructor with the same arguments. RIM_INLINE static Pointer<MenuItem> construct( const UTF8String& name, const input::KeyboardShortcut& shortcut, Bool enabled = true ) { return Pointer<MenuItem>( util::construct<MenuItem>( name, shortcut, enabled ) ); } private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Wrapper Class Declaration /// A class which wraps platform-specific state for a menu item. class Wrapper; /// Allow the Menu class to set itself as the parent of this menu item privately. friend class Menu; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Helper Methods /// Set a pointer to this menu item's parent menu. void setParentMenu( Menu* menu ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Members /// A pointer to an object which wraps platform-specific state for this menu item. Wrapper* wrapper; }; //########################################################################################## //*************************** End Rim GUI Namespace ******************************** RIM_GUI_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_GUI_MENU_ITEM_H <file_sep>/* * rimSoundTremolo.h * Rim Sound * * Created by <NAME> on 8/23/12. * Copyright 2012 __MyCompanyName__. All rights reserved. * */ #ifndef INCLUDE_RIM_SOUND_TREMOLO_H #define INCLUDE_RIM_SOUND_TREMOLO_H #include "rimSoundFiltersConfig.h" #include "rimSoundFilter.h" //########################################################################################## //************************ Start Rim Sound Filters Namespace ***************************** RIM_SOUND_FILTERS_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class that periodically varies the amplitude of an input signal. /** * A Tremolo filter takes the input sound and modulates the amplitude of that * sound with a repeating wave function. This class supports several tremolo wave * types: sinusoidal, square, saw, and triangle. */ class Tremolo : public SoundFilter { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Tone Type Enum /// An enum type which describes the various types of wave shapes that a Tremolo can use. typedef enum WaveType { /// A pure sinusoidal oscillation of the input sound's amplitude. SINE = 0, /// A softened square-wave oscillation of the input sound's amplitude. SQUARE = 1, /// A softened saw-wave oscillation of the input sound's amplitude. SAW = 2, /// A triangle-wave oscillation of the input sound's amplitude. TRIANGLE = 3, }; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructors /// Create a default sine-based tremolo filter with a depth of 6dB and frequency of 1Hz. Tremolo(); /// Create a tremolo with the specified modulation wave type, output gain, and frequency. Tremolo( WaveType newType, Float newFrequency, Gain newDepth ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Wave Type Accessor Methods /// Return the type of modulation wave that this tremolo is using. /** * The wave type can be one of several types of audio test tones * (sine waves, square waves, saw waves, triangle waves). */ RIM_INLINE WaveType getType() const { return type; } /// Set the type of modulation wave that this tremolo is using. /** * The wave type can be one of several types of audio test tones * (sine wave, square wave, saw wave, triangle wave). The tremolo * filter switches wave types at the beginning of the next wave period * so that it avoids discontinuities between the waves. */ RIM_INLINE void setType( WaveType newType ) { lockMutex(); type = newType; unlockMutex(); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Tremolo Frequency Accessor Methods /// Return the frequency of this tremolo's modulation wave in hertz. RIM_INLINE Float getFrequency() const { return targetFrequency; } /// Set the frequency of this tremolo's modulation wave in hertz. RIM_INLINE void setFrequency( Float newFrequency ) { lockMutex(); targetFrequency = math::max( newFrequency, Float(0) ); unlockMutex(); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Tremolo Depth Accessor Methods /// Return the maximum attenuation of the tremolo modulation in decibels. /** * This is the amount that the input signal is attenuated by whenever the modulation * wave is at its lowest point. At the wave's peaks, the gain reduction is 0dB. */ RIM_INLINE Float getDepth() const { return -util::linearToDB( targetDepth ); } /// Set the maximum attenuation of the tremolo modulation in decibels. /** * This is the amount that the input signal is attenuated by whenever the modulation * wave is at its lowest point. At the wave's peaks, the gain reduction is 0dB. * * The new depth value is clamped to the range of [0,+infinity]. */ RIM_INLINE void setDepth( Float newDepth ) { lockMutex(); targetDepth = util::dbToLinear( -math::abs(newDepth) ); unlockMutex(); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Tremolo Frequency Accessor Methods /// Return the smoothing amount for the tremolo's modulation wave. /** * This parameter is used to smooth abrupt amplitude transitions that are * present for square and saw modulation waves. It has the range [0,1], where * 0 indicates no smoothing and 1 indicates full smoothing. The smoothing value * can be interpreted as the time (expressed as a fraction of a full modulation period) * that it takes for the gain reduction stage to react to a change in the modulation wave. */ RIM_INLINE Float getSmoothing() const { return smoothing; } /// Set the smoothing amount for the tremolo's modulation wave. /** * This parameter is used to smooth abrupt amplitude transitions that are * present for square and saw modulation waves. It has the range [0,1], where * 0 indicates no smoothing and 1 indicates full smoothing. The smoothing value * can be interpreted as the time (expressed as a fraction of a full modulation period) * that it takes for the gain reduction stage to react to a change in the modulation wave. * * The new smoothing amount is clamped to the valid range of [0,1]. */ RIM_INLINE void setSmoothing( Float newSmoothing ) { lockMutex(); smoothing = math::clamp( newSmoothing, Float(0), Float(1) ); unlockMutex(); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Tremolo Frequency Accessor Methods /// Return the modulation phase offset of the channel with the specified index. /** * This value, specified in degrees, indicates how much the phase of the channel * should be shifted by. This parameter allows the creation of stereo (or higher) * modulation effects. For example, if the phase of the left channel is 0 and the phase * of the right channel is 180, the channels' modulation will be completely out-of-phase. */ RIM_INLINE Float getChannelPhase( Index channelIndex ) const { if ( channelIndex < channelPhase.getSize() ) return math::radiansToDegrees( channelPhase[channelIndex] ); else return math::radiansToDegrees( globalChannelPhase ); } /// Set the modulation phase offset of the channel with the specified index. /** * This value, specified in degrees, indicates how much the phase of the channel * should be shifted by. This parameter allows the creation of stereo (or higher) * modulation effects. For example, if the phase of the left channel is 0 and the phase * of the right channel is 180, the channels' modulation will be completely out-of-phase. * * The input phase value is clamped so that the new phase value lies between -180 and 180 degrees. */ void setChannelPhase( Index channelIndex, Float newPhase ); /// Set the modulation phase offset for all channels. /** * Doing this brings all channels into phase with each other (regardless of what phase that is). * * The input phase value is clamped so that the new phase value lies between -180 and 180 degrees. */ void setChannelPhase( Float newPhase ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Filter Attribute Accessor Methods /// Return a human-readable name for this tremolo. /** * The method returns the string "Tremolo". */ virtual UTF8String getName() const; /// Return the manufacturer name of this tremolo. /** * The method returns the string "Headspace Sound". */ virtual UTF8String getManufacturer() const; /// Return an object representing the version of this tremolo. virtual SoundFilterVersion getVersion() const; /// Return an object which describes the category of effect that this filter implements. /** * This method returns the value SoundFilterCategory::MODULATION. */ virtual SoundFilterCategory getCategory() const; /// Return whether or not this tremolo can process audio data in-place. /** * This method always returns TRUE, tremolos can process audio data in-place. */ virtual Bool allowsInPlaceProcessing() const; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Filter Parameter Accessor Methods /// Return the total number of generic accessible parameters this tremolo has. virtual Size getParameterCount() const; /// Get information about the tremolo parameter at the specified index. virtual Bool getParameterInfo( Index parameterIndex, FilterParameterInfo& info ) const; /// Get any special name associated with the specified value of an indexed parameter. virtual Bool getParameterValueName( Index parameterIndex, const FilterParameter& value, UTF8String& name ) const; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Public Static Property Objects /// A string indicating the human-readable name of this tremolo. static const UTF8String NAME; /// A string indicating the manufacturer name of this tremolo. static const UTF8String MANUFACTURER; /// An object indicating the version of this tremolo. static const SoundFilterVersion VERSION; private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Filter Parameter Value Accessor Methods /// Place the value of the parameter at the specified index in the output parameter. virtual Bool getParameterValue( Index parameterIndex, FilterParameter& value ) const; /// Attempt to set the parameter value at the specified index. virtual Bool setParameterValue( Index parameterIndex, const FilterParameter& value ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Stream Reset Method /// A method which is called whenever the filter's stream of audio is being reset. /** * This method allows the filter to reset all parameter interpolation * and processing to its initial state to avoid coloration from previous * audio or parameter values. */ virtual void resetStream(); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Filter Processing Methods /// Fill the output frame with the amplitude modulated input sound. virtual SoundFilterResult processFrame( const SoundFilterFrame& inputFrame, SoundFilterFrame& outputFrame, Size numSamples ); /// Modulate the given input buffer by the template wave function. template < Sample32f (*waveFunction)( Float ) > RIM_INLINE void modulate( const SoundBuffer& inputBuffer, SoundBuffer& outputBuffer, Size numSamples, Float frequencyChangePerSample, Gain depthChangePerSample, Gain envelopeChange ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Wave Generation Methods /// Compute the value of a cosine wave, given the specified phase value in radians. /** * The output of this function is biased so that the sine wave has minima * and maxima at y=0 and y=1. */ RIM_FORCE_INLINE static Sample32f cosine( Float phase ) { return Float(0.5)*(math::cos( phase + math::pi<Float>() ) + Float(1)); } /// Compute the value of a square wave, given the specified phase value in radians. /** * The output of this function is biased so that the square wave has minima * and maxima at y=0 and y=1. */ RIM_FORCE_INLINE static Sample32f square( Float phase ) { return math::mod( phase, Float(2)*math::pi<Float>() ) <= math::pi<Float>() ? Sample32f(0) : Sample32f(1); } /// Compute the value of a saw wave, given the specified phase value in radians. /** * The output of this function is biased so that the saw wave has minima * and maxima at y=0 and y=1. */ RIM_FORCE_INLINE static Sample32f saw( Float phase ) { Float phaseOverTwoPi = -phase / (Float(2)*math::pi<Float>()); return phaseOverTwoPi - math::floor(phaseOverTwoPi); } /// Compute the value of a triangle wave, given the specified phase value in radians. /** * The output of this function is biased so that the triangle wave has minima * and maxima at y=0 and y=1. */ RIM_FORCE_INLINE static Sample32f triangle( Float phase ) { Float phaseOverTwoPi = phase / (Float(2)*math::pi<Float>()); Float saw = (phaseOverTwoPi - math::floor(phaseOverTwoPi + Float(0.5))); return Float(2)*math::abs(saw); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Members /// An enum value indicating the type of modulation wave to use for this tremolo. WaveType type; /// The frequency of the tremolo's modulation wave in hertz. Float frequency; /// The target frequency of the tremolo's modulation wave in hertz. /** * This value allows the tremolo to do smooth transitions between * different modulation frequencies. */ Float targetFrequency; /// The linear gain factor applied to the input when the modulation wave is at its lowest point. /** * The output signal is at unity (0dB) gain with respect to the input signal whenever the * modulation wave is at its peak. When the modulation wave is at its lowest * point, the signal is affected totally by this linear gain factor. */ Gain depth; /// The target depth for this tremolo. /** * This value allows the tremolo to do smooth transitions between * different depths. */ Gain targetDepth; /// The fractional amount of one modulation period that it takes for an impulse to exponentially decay. /** * This value range from 0 to 1 and is used to smooth the abrubt amplitude * changes caused by square and saw waves. */ Float smoothing; /// The current envelope of the modulation wave for each channel. Array<Gain> envelope; /// The modulation phase offset of each channel (in radians). /** * This allows different channels to be in different phases, * creating a stereo (or higher) tremolo effect. */ Array<Float> channelPhase; /// The channel phase offset to use for all channels for which the phase has not been set. Float globalChannelPhase; /// The current phase of the tremolo's modulation wave (in radians). Float phase; }; //########################################################################################## //************************ End Rim Sound Filters Namespace ******************************* RIM_SOUND_FILTERS_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_SOUND_TREMOLO_H <file_sep>/* * rimGraphicsShaderParameterUsage.h * Rim Software * * Created by <NAME> on 1/30/14. * Copyright 2014 __MyCompanyName__. All rights reserved. * */ #ifndef INCLUDE_RIM_GRAPHICS_SHADER_PARAMETER_USAGE_H #define INCLUDE_RIM_GRAPHICS_SHADER_PARAMETER_USAGE_H #include "rimGraphicsShadersConfig.h" //########################################################################################## //*********************** Start Rim Graphics Shaders Namespace *************************** RIM_GRAPHICS_SHADERS_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class which specifies the semantic usage for a shader parameter. class ShaderParameterUsage { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Shader Parameter Usage Enum Definition /// An enum type which represents the semantic usage for a shader parameter. typedef enum Enum { /// An undefined shader parameter usage. UNDEFINED = 0, /// An integer parameter indicating the full major/minor version of the shader language. LANGUAGE_VERSION, //****************************************************************** VERTEX_COLORS_ENABLED, //****************************************************************** // Lighting shader parameter usages LIGHTING_ENABLED, DIRECTIONAL_LIGHTS_ENABLED, POINT_LIGHTS_ENABLED, SPOT_LIGHTS_ENABLED, DIRECTIONAL_LIGHT_COUNT, POINT_LIGHT_COUNT, SPOT_LIGHT_COUNT, SPECULAR_ENABLED, DIFFUSE_ENABLED, AMBIENT_ENABLED, SHADOWS_ENABLED, DIRECTIONAL_LIGHT_SHADOWS_ENABLED, DIRECTIONAL_LIGHT_CSM_ENABLED, DIRECTIONAL_LIGHT_SHADOW_CASCADE_COUNT, POINT_LIGHT_SHADOWS_ENABLED, SPOT_LIGHT_SHADOWS_ENABLED, SHADOW_FILTERING_ENABLED, //****************************************************************** // Texturing shader parameter usages TEXTURES_ENABLED, BUMP_MAPPING_ENABLED }; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructors /// Create a new shader parameter usage with the specified usage enum value. RIM_INLINE ShaderParameterUsage( Enum newUsage ) : usage( newUsage ) { } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Enum Cast Operator /// Convert this shader parameter usage to an enum value. RIM_INLINE operator Enum () const { return usage; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** String Representation Accessor Methods /// Return a string representation of the shader parameter usage. String toString() const; /// Convert this shader parameter usage into a string representation. RIM_INLINE operator String () const { return this->toString(); } private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Members /// An enum value for the shader parameter usage. Enum usage; }; //########################################################################################## //*********************** End Rim Graphics Shaders Namespace ***************************** RIM_GRAPHICS_SHADERS_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_GRAPHICS_SHADER_PARAMETER_USAGE_H <file_sep>/* * rimGraphicsTextureFormat.h * Rim Graphics * * Created by <NAME> on 11/22/10. * Copyright 2010 Rim Software. All rights reserved. * */ #ifndef INCLUDE_RIM_GRAPHICS_TEXTURE_FORMAT_H #define INCLUDE_RIM_GRAPHICS_TEXTURE_FORMAT_H #include "rimGraphicsTexturesConfig.h" //########################################################################################## //********************** Start Rim Graphics Textures Namespace *************************** RIM_GRAPHICS_TEXTURES_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class which represents the internal format for a texture. /** * This is the GPU-side semantic representation of the texture's * type and usage. */ class TextureFormat { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructor typedef enum Enum { //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Depth Texture Formats /// A depth texture in the GPU's native depth format. DEPTH, //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Standard Texture Formats /// An 8-bits-per-pixel alpha-channel texture. ALPHA, /// An 8-bits-per-pixel grayscale (lightmap) texture. GRAYSCALE, /// An 8-bit grayscale (lightmap) texture with an 8-bit alpha channel. GRAYSCALE_ALPHA, /// An 8-bits-per-pixel intensity texture. /** * This is like a lightmap but it affects the alpha channel as well. */ INTENSITY, /// An 8-bits-per-channel RGB texture. RGB, /// An 8-bits-per-channel RGB texture with an alpha channel. RGBA, //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Floating Point Texture Formats /// A 16-bit floating-point alpha-channel texture. ALPHA_16F, /// A 16-bit floating-point grayscale (lightmap) texture. GRAYSCALE_16F, /// A 16-bit floating-point (lightmap) texture with a 16-bit floating-point alpha channel. GRAYSCALE_ALPHA_16F, /// A 16-bit floating-point intensity texture. /** * This is like a lightmap but it affects the alpha channel as well. */ INTENSITY_16F, /// A 16-bits-per-channel floating-point RGB texture. RGB_16F, /// A 16-bits-per-channel floating-point RGB texture with an alpha channel. RGBA_16F, /// A 32-bit floating-point alpha-channel texture. ALPHA_32F, /// A 32-bit floating-point grayscale (lightmap) texture. GRAYSCALE_32F, /// A 32-bit floating-point (lightmap) texture with a 16-bit floating-point alpha channel. GRAYSCALE_ALPHA_32F, /// A 32-bit floating-point intensity texture. /** * This is like a lightmap but it affects the alpha channel as well. */ INTENSITY_32F, /// A 32-bits-per-channel floating-point RGB texture. RGB_32F, /// A 32-bits-per-channel floating-point RGB texture with an alpha channel. RGBA_32F, //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Compressed Texture Formats /// An 8-bits-per-pixel compressed alpha-channel texture. COMPRESSED_ALPHA, /// An 8-bits-per-pixel compressed grayscale (lightmap) texture. COMPRESSED_GRAYSCALE, /// An 8-bit compressed grayscale (lightmap) texture with an 8-bit alpha channel. COMPRESSED_GRAYSCALE_ALPHA, /// An 8-bits-per-pixel compressed intensity texture. /** * This is like a lightmap but it affects the alpha channel as well. */ COMPRESSED_INTENSITY, /// An 8-bits-per-channel compressed RGB texture. COMPRESSED_RGB, /// An 8-bits-per-channel compressed RGB texture with an alpha channel. COMPRESSED_RGBA, //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Undefined Texture Format /// An undefined texture format. UNDEFINED }; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructor /// Create an undefined texture format. RIM_INLINE TextureFormat() : format( UNDEFINED ) { } /// Create a texture format object from an enum specifying the type of format. RIM_INLINE TextureFormat( Enum newFormat ) : format( newFormat ) { } /// Create a texture format which can represent an image with the specified pixel type. TextureFormat( const PixelFormat& newPixelFormat ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Channel Number Accessor Method /// Get the number of color channels that this texture format has. Size getChannelCount() const; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Compression Type Accessor Method /// Get whether or not this texture format is compressed. Bool isCompressed() const; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Precision Type Accessor Method /// Get whether or not this texture format uses floating point pixel data. Bool isFloatingPoint() const; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Transparency Type Accessor Method /// Return whether or not this texture format can be transparent. Bool isTransparent() const; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Pixel Type Accessor Method /// Return an object which represents a pixel type compatible with this texture format. /** * The returned pixel type should have enough precision and the correct * number of channels to be able to store an image with this texture format. * * If there is no compatible pixel type, the PixelFormat::UNDEFINED value is returned. */ PixelFormat getPixelFormat() const; /// Return whether or not the specified pixel type is compatible with this texture format. Bool supportsPixelFormat( const PixelFormat& pixelType ) const { return this->getChannelCount() == pixelType.getChannelCount(); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Enum Cast Operator /// Convert this texture format to an enum value. RIM_INLINE operator Enum () const { return format; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** String Representation Accessor Methods /// Return a string representation of the texture format. String toString() const; /// Convert this texture format into a string representation. RIM_INLINE operator String () const { return this->toString(); } private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Members /// An enum which represents the type of texture format. Enum format; }; //########################################################################################## //********************** End Rim Graphics Textures Namespace ***************************** RIM_GRAPHICS_TEXTURES_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_GRAPHICS_TEXTURE_FORMAT_H <file_sep>/* * rimGraphicsTextureWrapType.h * Rim Graphics * * Created by <NAME> on 12/22/10. * Copyright 2010 Rim Software. All rights reserved. * */ #ifndef INCLUDE_RIM_GRAPHICS_TEXTURE_WRAP_TYPE_H #define INCLUDE_RIM_GRAPHICS_TEXTURE_WRAP_TYPE_H #include "rimGraphicsTexturesConfig.h" //########################################################################################## //********************** Start Rim Graphics Textures Namespace *************************** RIM_GRAPHICS_TEXTURES_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class which specifies how a texture should repeat for texture coordinates outside the range (0,1). /** * Textures can repeat, be clamped, or repeat in a mirrored fashion. Different * wrap types are suitable for tiling textures or for textures that should not * tile. */ class TextureWrapType { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Public Enum Declaration /// An enum type which represents the different texture wrap types. typedef enum Enum { /// The texture uses the outer pixel edge for all texels outside the range (0,1). CLAMP, /// The texture repeats normally. Coordinates outside (0,1) are mod-ed to be in that range. REPEAT, /// The texture repeats in a mirrored fashion, producing seamless tiling for all images. MIRRORED_REPEAT, /// An undefined texture wrap type. UNDEFINED }; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructors /// Create a new texture wrap type with the specified wrap type enum value. RIM_INLINE TextureWrapType( Enum newType ) : type( newType ) { } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Enum Cast Operator /// Convert this texture wrap type to an enum value. RIM_INLINE operator Enum () const { return type; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** String Representation Accessor Methods /// Return a unique string for this texture wrap type that matches its enum value name. String toEnumString() const; /// Return a texture wrap type which corresponds to the given enum string. static TextureWrapType fromEnumString( const String& enumString ); /// Return a string representation of the texture wrap type. String toString() const; /// Convert this texture wrap type into a string representation. RIM_INLINE operator String () const { return this->toString(); } private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Members /// An enum for the texture wrap type. Enum type; }; //########################################################################################## //********************** End Rim Graphics Textures Namespace ***************************** RIM_GRAPHICS_TEXTURES_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_GRAPHICS_TEXTURE_WRAP_TYPE_H <file_sep>/* * rimSoundDistortion.h * Rim Sound * * Created by <NAME> on 12/2/12. * Copyright 2012 __MyCompanyName__. All rights reserved. * */ #ifndef INCLUDE_RIM_SOUND_DISTORTION_H #define INCLUDE_RIM_SOUND_DISTORTION_H #include "rimSoundFiltersConfig.h" #include "rimSoundFilter.h" #include "rimSoundCutoffFilter.h" //########################################################################################## //************************ Start Rim Sound Filters Namespace ***************************** RIM_SOUND_FILTERS_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class that provides different kinds of audio distortion using wave-shaping. /** * The class uses a series of special non-linear functions to produce variable-hardness * distortion. The distortion produced can range from a basic soft clipping to very non-linear * hard clipping. */ class Distortion : public SoundFilter { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Distortion Type Enum Declaration /// Define the different kinds of distortion effects that this filter can produce. typedef enum Type { /// A kind of distortion where a smooth soft-clipping function is used. SOFT = 0, /// A kind of distortion where soft clipping is performed to the negative waveform and hard on the positive. HARD = 1, /// A kind of distortion which uses a soft-clipping function which is non-linear in the low amplitudes. /** * This causes a constant distortion, even at low input levels. */ BREAKUP_1 = 2, /// A kind of distortion which uses a non-linear function which shorts out the signal after a certain input level. /** * This causes a distortion where after the clipping threshold is reached, the output * level begins to decrease, causing unusual distortion. */ BREAKUP_2 = 3 }; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructors /// Create a new distortion filter with the default input and output gains of 1 and hardness of 0. Distortion(); /// Create a new distortion filter with the default input and output gains of 1 and hardness of 0. Distortion( Type newType ); /// Create an exact copy of another distortion filter. Distortion( const Distortion& other ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Destructor /// Destroy this distortion filter and clean up any resources. ~Distortion(); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Assignment Operator /// Assign the state of another distortion filter to this one. Distortion& operator = ( const Distortion& other ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Distortion Type Accessor Methods /// Return the type of distortion that this distortion filter is using. RIM_INLINE Type getType() const { return type; } /// Return the type of distortion that this distortion filter is using. RIM_INLINE void setType( Type newType ) { lockMutex(); type = newType; unlockMutex(); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Input Gain Accessor Methods /// Return the current linear input gain factor of this distortion filter. /** * This is the gain applied to the input signal before being sent to the * clipping function. A higher value will result in more noticeable clipping. */ RIM_INLINE Gain getInputGain() const { return targetInputGain; } /// Return the current input gain factor in decibels of this distortion filter. /** * This is the gain applied to the input signal before being sent to the * clipping function. A higher value will result in more noticeable clipping. */ RIM_INLINE Gain getInputGainDB() const { return util::linearToDB( targetInputGain ); } /// Set the target linear input gain for this distortion filter. /** * This is the gain applied to the input signal before being sent to the * clipping function. A higher value will result in more noticeable clipping. */ RIM_INLINE void setInputGain( Gain newInputGain ) { lockMutex(); targetInputGain = newInputGain; unlockMutex(); } /// Set the target input gain in decibels for this distortion filter. /** * This is the gain applied to the input signal before being sent to the * clipping function. A higher value will result in more noticeable clipping. */ RIM_INLINE void setInputGainDB( Gain newDBInputGain ) { lockMutex(); targetInputGain = util::dbToLinear( newDBInputGain ); unlockMutex(); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Output Gain Accessor Methods /// Return the current linear output gain factor of this distortion filter. /** * This is the gain applied to the signal after being sent to the * clipping function. This value is used to modify the final level * of the clipped signal. */ RIM_INLINE Gain getOutputGain() const { return targetOutputGain; } /// Return the current output gain factor in decibels of this distortion filter. /** * This is the gain applied to the signal after being sent to the * clipping function. This value is used to modify the final level * of the clipped signal. */ RIM_INLINE Gain getOutputGainDB() const { return util::linearToDB( targetOutputGain ); } /// Set the target linear output gain for this distortion filter. /** * This is the gain applied to the signal after being sent to the * clipping function. This value is used to modify the final level * of the clipped signal. */ RIM_INLINE void setOutputGain( Gain newOutputGain ) { lockMutex(); targetOutputGain = newOutputGain; unlockMutex(); } /// Set the target output gain in decibels for this distortion filter. /** * This is the gain applied to the signal after being sent to the * clipping function. This value is used to modify the final level * of the clipped signal. */ RIM_INLINE void setOutputGainDB( Gain newDBOutputGain ) { lockMutex(); targetOutputGain = util::dbToLinear( newDBOutputGain ); unlockMutex(); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Mix Accessor Methods /// Return the ratio of input signal to distorted signal sent to the output of the distortion effect. /** * Valid mix values are in the range [0,1]. * A mix value of 1 indicates that only the output of the distortion should be * heard at the output, while a value of 0 indicates that only the input of the * distortion should be heard at the output. A value of 0.5 indicates that both * should be mixed together equally at -6dB. */ RIM_INLINE Gain getMix() const { return targetMix; } /// Set the ratio of input signal to distorted signal sent to the output of the distortion effect. /** * Valid mix values are in the range [0,1]. * A mix value of 1 indicates that only the output of the distortion should be * heard at the output, while a value of 0 indicates that only the input of the * distortion should be heard at the output. A value of 0.5 indicates that both * should be mixed together equally at -6dB. * * The new mix value is clamped to the valid range of [0,1]. */ RIM_INLINE void setMix( Gain newMix ) { lockMutex(); targetMix = math::clamp( newMix, Gain(0), Gain(1) ); unlockMutex(); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Threshold Accessor Methods /// Return the linear full-scale value which indicates the maximum distorted output signal level. RIM_INLINE Gain getThreshold() const { return targetThreshold; } /// Return the logarithmic full-scale value which indicates the maximum distorted output signal level. RIM_INLINE Gain getThresholdDB() const { return util::linearToDB( targetThreshold ); } /// Set the linear full-scale value which indicates the maximum distorted output signal level. /** * The value is clamped to the valid range of [0,infinity] before being stored. */ RIM_INLINE void setThreshold( Gain newThreshold ) { lockMutex(); targetThreshold = math::max( newThreshold, Gain(0) ); unlockMutex(); } /// Set the logarithmic full-scale value which indicates the maximum distorted output signal level. RIM_INLINE void setThresholdDB( Gain newThresholdDB ) { lockMutex(); targetThreshold = util::dbToLinear( newThresholdDB ); unlockMutex(); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Clipping Hardness Accessor Methods /// Return the current hardness of this distortion filter's clipping function. /** * The hardness of a distortion filter is a value between 0 and 1 indicating the linear full-scale * threshold at which the saturation rolloff begins. Thus, a hardness of 0 will produce * the smoothest transfer curve, while a hardness of 1 will approximate hard clipping. */ RIM_INLINE Float getHardness() const { return Float(1) - Float(1) / targetHardness; } /// Set the hardness of this distortion filter's clipping function. /** * The hardness of a distortion filter is a value between 0 and 1 indicating the linear full-scale * threshold at which the saturation rolloff begins. Thus, a hardness of 0 will produce * the smoothest transfer curve, while a hardness of 1 will approximate hard clipping. * * The input hardness value is clamped between 0 and 1. */ RIM_INLINE void setHardness( Float newThreshold ) { lockMutex(); targetHardness = Float(1)/(Float(1) - math::clamp( newThreshold, MIN_HARDNESS, MAX_HARDNESS )); unlockMutex(); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Low Pass Filter Attribute Accessor Methods /// Return whether or not this distortion filter's low pass filter is enabled. RIM_INLINE Bool getLowPassIsEnabled() const { return lowPassEnabled; } /// Set whether or not this distortion filter's low pass filter is enabled. RIM_INLINE void setLowPassIsEnabled( Bool newLowPassIsEnabled ) { lockMutex(); lowPassEnabled = newLowPassIsEnabled; unlockMutex(); } /// Return the low pass filter frequency of this distortion filter. RIM_INLINE Float getLowPassFrequency() const { return lowPassFrequency; } /// Set the low pass filter frequency of this distortion filter. /** * The new low pass frequency is clamped to the range [0,infinity]. */ RIM_INLINE void setLowPassFrequency( Float newLowPassFrequency ) { lockMutex(); lowPassFrequency = math::max( newLowPassFrequency, Float(0) ); unlockMutex(); } /// Return the low pass filter order of this distortion filter. RIM_INLINE Size getLowPassOrder() const { return lowPassOrder; } /// Set the low pass filter order of this distortion filter. /** * The new low pass order is clamped to the range [1,100]. */ RIM_INLINE void setLowPassOrder( Size newLowPassOrder ) { lockMutex(); lowPassOrder = math::clamp( newLowPassOrder, Size(1), Size(100) ); unlockMutex(); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Filter Attribute Accessor Methods /// Return a human-readable name for this distortion filter. /** * The method returns the string "Distortion". */ virtual UTF8String getName() const; /// Return the manufacturer name of this distortion filter. /** * The method returns the string "Headspace Sound". */ virtual UTF8String getManufacturer() const; /// Return an object representing the version of this distortion filter. virtual SoundFilterVersion getVersion() const; /// Return an object which describes the category of effect that this filter implements. /** * This method returns the value SoundFilterCategory::DISTORTION. */ virtual SoundFilterCategory getCategory() const; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Filter Parameter Accessor Methods /// Return the total number of generic accessible parameters this distortion filter has. virtual Size getParameterCount() const; /// Get information about the distortion filter parameter at the specified index. virtual Bool getParameterInfo( Index parameterIndex, FilterParameterInfo& info ) const; /// Get any special name associated with the specified value of an indexed parameter. virtual Bool getParameterValueName( Index parameterIndex, const FilterParameter& value, UTF8String& name ) const; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Public Static Property Objects /// A string indicating the human-readable name of this distortion filter. static const UTF8String NAME; /// A string indicating the manufacturer name of this distortion filter. static const UTF8String MANUFACTURER; /// An object indicating the version of this distortion filter. static const SoundFilterVersion VERSION; private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Filter Parameter Value Accessor Methods /// Place the value of the parameter at the specified index in the output parameter. virtual Bool getParameterValue( Index parameterIndex, FilterParameter& value ) const; /// Attempt to set the parameter value at the specified index. virtual Bool setParameterValue( Index parameterIndex, const FilterParameter& value ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Stream Reset Method /// A method which is called whenever the filter's stream of audio is being reset. /** * This method allows the filter to reset all parameter interpolation * and processing to its initial state to avoid coloration from previous * audio or parameter values. */ virtual void resetStream(); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Filter Processing Methods /// Apply a distortion function to the samples in the input frame and write the output to the output frame. virtual SoundFilterResult processFrame( const SoundFilterFrame& inputFrame, SoundFilterFrame& outputFrame, Size numSamples ); /// Apply the templated clipping function to the specified input buffer and put the result in the output buffer. template < Float (*clippingFunction)( Float /*input*/, Float /*threshold*/, Float /*inverseThreshold*/, Float /*hardness*/, Float /*inverseHardness*/, Float /*hardnessThreshold*/, Float /*hardnessOffset*/ ) > void processDistortion( const SoundBuffer& inputBuffer, SoundBuffer& outputBuffer, Size numSamples ); /// Apply the templated clipping function to the specified input buffer and put the result in the output buffer. template < Float (*clippingFunction)( Float /*input*/, Float /*threshold*/, Float /*inverseThreshold*/, Float /*hardness*/, Float /*inverseHardness*/, Float /*hardnessThreshold*/, Float /*hardnessOffset*/ ) > void processDistortion( const SoundBuffer& inputBuffer, SoundBuffer& outputBuffer, Size numSamples, Gain inputGainChangePerSample, Float thresholdChangePerSample, Float hardnessChangePerSample ); RIM_FORCE_INLINE static Float softClip( Float input, Float threshold, Float inverseThreshold, Float hardness, Float inverseHardness, Float hardnessThreshold, Float hardnessOffset ) { if ( input > threshold*hardnessThreshold ) return threshold*((inverseHardness*math::tanh(inverseThreshold*hardness*input - hardnessOffset)) + hardnessThreshold); else if ( input < -threshold*hardnessThreshold ) return threshold*((inverseHardness*math::tanh(inverseThreshold*hardness*input + hardnessOffset)) - hardnessThreshold); else return input; } RIM_FORCE_INLINE static Float hardClip( Float input, Float threshold, Float inverseThreshold, Float hardness, Float inverseHardness, Float hardnessThreshold, Float hardnessOffset ) { if ( input > threshold ) return threshold; else if ( input < -threshold*hardnessThreshold ) return threshold*((inverseHardness*math::tanh(inverseThreshold*hardness*input + hardnessOffset)) - hardnessThreshold); else return input; } RIM_FORCE_INLINE static Float breakup1( Float input, Float threshold, Float inverseThreshold, Float hardness, Float inverseHardness, Float hardnessThreshold, Float hardnessOffset ) { Float scaledInput = inverseThreshold*input; if ( scaledInput < 0 ) return -threshold*scaledInput*scaledInput / math::pow( Float(1) + math::pow( -scaledInput, Float(2)*hardness ), inverseHardness ); else return threshold*scaledInput*scaledInput / math::pow( Float(1) + math::pow( scaledInput, Float(2)*hardness ), inverseHardness ); } /// Apply a clipping algorithm that has a RIM_FORCE_INLINE static Float breakup2( Float input, Float threshold, Float inverseThreshold, Float hardness, Float inverseHardness, Float hardnessThreshold, Float hardnessOffset ) { Float scaledInput = inverseThreshold*input; return threshold*scaledInput / math::pow( Float(1) + math::pow( math::abs(scaledInput), hardness*Float(2.5f) ), Float(1)/Float(2.5f) ); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Members /// The type of distortion effect that this distortion filter uses. Type type; /// The current linear input gain factor applied to all input audio before being clipped. Gain inputGain; /// The target linear input gain factor, used to smooth changes in the input gain. Gain targetInputGain; /// The current linear output gain factor applied to all input audio after being clipped. Gain outputGain; /// The target linear output gain factor, used to smooth changes in the output gain. Gain targetOutputGain; /// The current ratio of distorted to unaffected signal that is sent to the output. Float mix; /// The target mix, used to smooth changes in the mix parameter. Float targetMix; /// The current threshold which indicates the maximum distorted output level. Float threshold; /// The target threshold, used to smooth changes in the threshold parameter. Float targetThreshold; /// A value which affects how hard the clipping function is. /** * This value ranges from 1 (indicating soft clipping), to infinity (very harsh clipping). */ Float hardness; /// The target hardness for this distortion filter, used to smooth changes in the clipping hardness. Float targetHardness; /// A low-pass filter used to smooth the output of the distortion. CutoffFilter* lowPass; /// The frequency at which the low pass filter for the distortion is at -3dB. Float lowPassFrequency; /// The order of the distortion's low pass filter that determines its slope. Size lowPassOrder; /// A boolean value indicating whether or not this distortion's low-pass filter is enabled. Bool lowPassEnabled; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Static Data Members /// The minimum allowed hardness for a distortion filter, 0. static const Float MIN_HARDNESS; /// The maximum allowed hardness for a distortion filter, a value close to 1. static const Float MAX_HARDNESS; }; //########################################################################################## //************************ End Rim Sound Filters Namespace ******************************* RIM_SOUND_FILTERS_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_SOUND_DISTORTION_H <file_sep>/* * rimSoundOggEncoder.h * Rim Sound * * Created by <NAME> on 8/4/12. * Copyright 2012 __MyCompanyName__. All rights reserved. * */ #ifndef INCLUDE_RIM_SOUND_OGG_ENCODER_H #define INCLUDE_RIM_SOUND_OGG_ENCODER_H #include "rimSoundIOConfig.h" //########################################################################################## //*************************** Start Rim Sound IO Namespace ******************************* RIM_SOUND_IO_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class which handles streaming encoding of the compressed .ogg audio format. /** * This class uses an abstract data stream for output, allowing it to encode * .ogg data to a file, network destination, or other destination. */ class OggEncoder : public SoundOutputStream { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructors /// Create a .ogg file encoder with the given number of channels, bitrate, and sample rate. /** * An encoder created by this constructor will write an .ogg file with the specified * number of channels and bit rate. The constructor also allows the user to specify * whether or not variable-bitrate encoding is used, the default is yes. * The encoder uses the specified sample rate for all incoming audio, automatically * sample rate converting any audio that doesn't match the output sample rate. */ OggEncoder( const UTF8String& newFilePath, Size numChannels, SampleRate newSampleRate, Float kbitRate = Float(192), Bool isVBR = true ); /// Create a .ogg file encoder with the given number of channels, bitrate, and sample rate. /** * An encoder created by this constructor will write an .ogg file with the specified * number of channels and bit rate. The constructor also allows the user to specify * whether or not variable-bitrate encoding is used, the default is yes. * The encoder uses the specified sample rate for all incoming audio, automatically * sample rate converting any audio that doesn't match the output sample rate. */ OggEncoder( const File& newFile, Size numChannels, SampleRate newSampleRate, Float kbitRate = Float(192), Bool isVBR = true ); /// Create a .ogg stream encoder with the given number of channels, bitrate, and sample rate. /** * An encoder created by this constructor will write an .ogg file stream with the specified * number of channels and bit rate. The constructor also allows the user to specify * whether or not variable-bitrate encoding is used, the default is yes. * The encoder uses the specified sample rate for all incoming audio, automatically * sample rate converting any audio that doesn't match the output sample rate. */ OggEncoder( const Pointer<DataOutputStream>& outputStream, Size numChannels, SampleRate newSampleRate, Float kbitRate = Float(192), Bool isVBR = true ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Destructor /// Destroy this .ogg encoder and release all associated resources. virtual ~OggEncoder(); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Stream Flush Accessor Methods /// Flush all pending sound data to be encoded to the encoder's data output stream. virtual void flush(); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Seeking Methods /// Return whether or not seeking is allowed by this .ogg file encoder. virtual Bool canSeek() const; /// Return if this .ogg encoder's current position can be moved by the specified signed sample offset. /** * This sample offset is specified as the number of sample frames to move * in the stream - a frame is equal to one sample for each channel in the stream. */ virtual Bool canSeek( Int64 relativeSampleOffset ) const; /// Move the current sample frame position of the encoder by the specified signed amount. /** * This method attempts to seek the position of the encoder by the specified amount. * The method returns the signed amount that the position in the stream was changed * by. Thus, if seeking is not allowed, 0 is returned. Otherwise, the stream should * seek as far as possible in the specified direction and return the actual change * in position. */ virtual Int64 seek( Int64 relativeSampleOffset ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Ogg File Length Accessor Methods /// Return the total number of samples that have been encoded by this .ogg encoder. RIM_INLINE SoundSize getLengthInSamples() const { return lengthInSamples; } /// Return the total length of sound in seconds that has been encoded by this .ogg encoder. RIM_INLINE Double getLengthInSeconds() const { return lengthInSamples / sampleRate; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Output Format Accessor Methods /// Return the number of channels that are being written by the .ogg encoder. /** * This is the number of channels that should be provided to the write() method. * If less than this number of channels is provided, silence is written for the * other channels. Superfluous channels are ignored. * * This value is set in a constructor of the encoder and once set, is read-only. */ virtual Size getChannelCount() const; /// Return the sample rate at which this .ogg encoder is encoding. /** * This is the sample rate to which all incoming sound data is converted to * before being written to the output stream. The output sample rate can be * set in the encoder's constructor. After contruction, the sample rate is * read-only and cannot be changed. If not set during construction, the encoder * can automatically auto-detect the sample rate of the first buffer of output audio * and use that sample rate thenceforth. In that case, this method will return * a sample rate of 0 until the incoming sample rate is detected. */ virtual SampleRate getSampleRate() const; /// Return the type of sample data that is being written by this .ogg encoder. /** * Since Ogg encodes data in frequency domain, this method always returns the * type of SAMPLE_32F. */ virtual SampleType getNativeSampleType() const; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Encoder Status Accessor Method /// Return whether or not this .ogg encoder is writing a valid Ogg file. /** * This method can return FALSE, indicating the encoder cannot be used, * and should be checked by the user to see if the chosen Ogg * format is supported by the encoder. The encoder can also be invalid if the * destination file or stream cannot be opened or is not valid. */ virtual Bool isValid() const { return valid; } private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Class Declaration /// A class which wraps any internal ogg encoding state. class OggEncoderWrapper; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Copy Operations /// Create a copy of the specified .ogg encoder. OggEncoder( const OggEncoder& other ); /// Assign the current state of another OggEncoder object to this OggEncoder object. OggEncoder& operator = ( const OggEncoder& other ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Sound Writing Method /// Write the specified number of samples from the output buffer to the data output stream. /** * This method attempts to encode the specified number of samples to the stream * from the output buffer. It then returns the total number of valid samples which * were written to the .ogg file. The current write position in the stream * is advanced by the number of samples that are written. */ virtual Size writeSamples( const SoundBuffer& outputBuffer, Size numSamples ); /// Write the header of the .ogg file, starting at the current position in the data output stream. /** * The method returns whether or not there was an error that occurred. * If an error occurs there must be a problem with the output stream format. */ Bool writeHeader(); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Members /// A pointer to a class containing all ogg decoder internal data. OggEncoderWrapper* wrapper; /// A pointer to the data output stream to which we are encoding .ogg data. Pointer<DataOutputStream> stream; /// A mutex object which provides thread synchronization for this .ogg encoder. /** * This thread protects access to encoding parameters such as the current encoding * position so that they are never accessed while audio is being encoded. */ mutable threads::Mutex encodingMutex; /// An object which handles conversion to the output sample rate if the input is mismatched. SampleRateConverter sampleRateConverter; /// A buffer which holds the resulting data after sample rate conversion. SoundBuffer sampleRateConversionBuffer; /// The number of channels that are being written by the .ogg encoder. Size numChannels; /// The sample rate of the .ogg file which is being encoded. SampleRate sampleRate; /// The bitrate of the encoded .ogg file in kbit/s. Float kbitRate; /// A boolean value indicating whether or not the encoded .ogg file uses variable-bitrate encoding. Bool isVBR; /// The total length of the encoded .ogg file in samples. SoundSize lengthInSamples; /// The current position within the .ogg file where the encoder is encoding. SampleIndex currentSampleIndex; /// A boolean value indicating whether or not the encoder is currently writing a valid .ogg file. Bool valid; /// A boolean value indicating whether or not the encoder has written the .ogg file's header. Bool writtenHeader; }; //########################################################################################## //*************************** End Rim Sound IO Namespace ********************************* RIM_SOUND_IO_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_SOUND_OGG_ENCODER_H <file_sep>/* * rimGUIOpenDialog.h * Rim Software * * Created by <NAME> on 6/29/14. * Copyright 2014 __MyCompanyName__. All rights reserved. * */ #ifndef INCLUDE_RIM_GUI_OPEN_DIALOG_H #define INCLUDE_RIM_GUI_OPEN_DIALOG_H #include "rimGUIConfig.h" #include "rimGUIElement.h" #include "rimGUIOpenDialogDelegate.h" //########################################################################################## //*************************** Start Rim GUI Namespace ****************************** RIM_GUI_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class which represents a user dialog for saving files. class OpenDialog : public GUIElement { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructors /// Create an open dialog with the default starting path, the root directory of the system drive. OpenDialog(); /// Create an open dialog with the specified starting path. OpenDialog( const UTF8String& startingPath ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Destructor /// Destroy an open dialog, closing it if is visible and releasing all resources used. ~OpenDialog(); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Delegate (Event Handler) Accessor Methods /// Block the calling thread until the user selects a file to open. /** * The selected file path is sent to the delegate for the dialog. * The method returns whether or not the file was successfully * opened by the delegate. * * If the method returns TRUE, the path of the file can be accessed * by calling getPath(). */ Bool run(); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Path Accessor Methods /// Return the current user-selected open file path. Path getPath() const; /// Return a path representing the current directory of the open dialog. /** * This path is the parent of the file that the user has * selected to be opend. */ Path getSearchPath() const; /// Set the path for the current directory of the open dialog. /** * The method returns whether or not the path was able to be set. */ Bool setSearchPath( const Path& newPath ); /// Set the path for the current directory of the open dialog. /** * The method returns whether or not the path was able to be set. */ RIM_INLINE Bool setSearchPath( const UTF8String& newPath ) { return this->setSearchPath( Path( newPath ) ); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** File Type Accessor Methods /// Return the number of allowed file types for this open dialog. /** * If there are no types specified, any file type is allowed. */ Size getTypeCount() const; /// Return the file type string for the type at the specified index in this dialog. const UTF8String& getType( Index typeIndex ) const; /// Add a new file type string to this open dialog. /** * The method returns whether or not the new type was able to be added. */ Bool addType( const UTF8String& newType ); /// Remove the specified file type string from this open dialog. /** * The method returns whether or not the new type was able to be removed. */ Bool removeType( const UTF8String& type ); /// Remove all file types from this open dialog. /** * After this operation, any file type is allowed. */ Bool clearTypes(); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Title Accessor Methods /// Return the title string for this open dialog. /** * On most platforms, this string will be placed at the top of the window in * a title bar. */ UTF8String getTitle() const; /// Set the title string for this open dialog. /** * The method returns whether or not the title change operation was successful. */ Bool setTitle( const UTF8String& newTitle ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Hidden File Accessor Methods /// Return whether or not this open dialog can see hidden files. Bool getHiddenFiles() const; /// Set whether or not this open dialog can see hidden files. Bool setHiddenFiles( Bool newHiddenFiles ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Delegate (Event Handler) Accessor Methods /// Get a reference to the delegate object associated with this open dialog. const OpenDialogDelegate& getDelegate() const; /// Set the delegate object to which this open dialog sends events. void setDelegate( const OpenDialogDelegate& delegate ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Platform-Specific Pointer Accessor Method /// Get a pointer to this open dialog's platform-specific internal representation. /** * On Mac OS X, this method returns a pointer to a subclass of NSOpenPanel * which represents the open dialog. * * On Windows, this method returns an HWND indicating a handle to the open dialog window. */ virtual void* getInternalPointer() const; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Static Shared Construction Methods /// Create a shared-pointer open dialog object, calling the constructor with the same arguments. RIM_INLINE static Pointer<OpenDialog> construct() { return Pointer<OpenDialog>( util::construct<OpenDialog>() ); } /// Create a shared-pointer open dialog object, calling the constructor with the same arguments. RIM_INLINE static Pointer<OpenDialog> construct( const UTF8String& startingPath ) { return Pointer<OpenDialog>( util::construct<OpenDialog>( startingPath ) ); } private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Open Dialog Wrapper Class Declaration /// A class which encapsulates internal platform-specific state. class Wrapper; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Members /// A pointer to internal implementation-specific data. Wrapper* wrapper; }; //########################################################################################## //*************************** End Rim GUI Namespace ******************************** RIM_GUI_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_GUI_OPEN_DIALOG_H <file_sep>/* * rimGraphicsGUIMenu.h * Rim Graphics GUI * * Created by <NAME> on 2/18/13. * Copyright 2013 Headspace Systems. All rights reserved. * */ #ifndef INCLUDE_RIM_GRAPHICS_GUI_MENU_H #define INCLUDE_RIM_GRAPHICS_GUI_MENU_H #include "rimGraphicsGUIBase.h" #include "rimGraphicsGUIObject.h" #include "rimGraphicsGUIMenuDelegate.h" #include "rimGraphicsGUIMenuItem.h" //########################################################################################## //************************ Start Rim Graphics GUI Namespace ****************************** RIM_GRAPHICS_GUI_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class which contains a list of MenuItem objects that the user can select. /** * Typically, a menu will be used to present a list of actions to the user * which the user can then select. This class can be used as popup-style menu * or as part of a MenuBar (such as at the top of a window). */ class Menu : public GUIObject { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructors /// Create a new default menu with no items. Menu(); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Name Accessor Methods /// Return a string representing the title of this menu. /** * This is the displayed name of the menu when it is part of a MenuBar * or is a submenu of a MenuItem. */ RIM_INLINE const UTF8String& getTitle() const { return title; } /// Set a string representing the title of this menu. /** * This is the displayed name of the menu when it is part of a MenuBar * or is a submenu of a MenuItem. */ RIM_INLINE void setTitle( const UTF8String& newTitle ) { title = newTitle; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Item Accessor Methods /// Return the total number of items that are part of this menu. RIM_INLINE Size getItemCount() const { return items.getSize(); } /// Return a pointer to the item at the specified index in this menu. RIM_INLINE const Pointer<MenuItem>& getItem( Index itemIndex ) const { return items[itemIndex].item; } /// Add the specified item to this menu. /** * If the specified item pointer is NULL, the method fails and FALSE * is returned. Otherwise, the item is appended to the end of the menu * and TRUE is returned. */ Bool addItem( const Pointer<MenuItem>& newItem ); /// Insert the specified item at the given index in this menu. /** * If the specified item pointer is NULL, the method fails and FALSE * is returned. Otherwise, the item is inserted at the given index in the menu * and TRUE is returned. */ Bool insertItem( Index itemIndex, const Pointer<MenuItem>& newItem ); /// Replace the specified item at the given index in this menu. /** * If the specified item pointer is NULL, the method fails and FALSE * is returned. Otherwise, the item is inserted at the given index in the menu * and TRUE is returned. */ Bool setItem( Index itemIndex, const Pointer<MenuItem>& newItem ); /// Remove the specified item from this menu. /** * If the given item is part of this menu, the method removes it * and returns TRUE. Otherwise, if the specified item is not found, * the method doesn't modify the menu and FALSE is returned. */ Bool removeItem( const MenuItem* oldItem ); /// Remove the item at the specified index from this menu. /** * If the specified index is invalid, FALSE is returned and the Menu * is unaltered. Otherwise, the item at that index is removed and * TRUE is returned. */ Bool removeItemAtIndex( Index itemIndex ); /// Remove all items from this menu. void clearItems(); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Selected Item Index Accesor Methods /// Return the index of the currently highlighted item in this menu. /** * If there is no currently highlighted item, -1 is returned. */ RIM_INLINE Int getHighlightedItemIndex() const { return highlightedItemIndex; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Item Padding Accessor Methods /// Return the padding amount between each menu item in this menu. RIM_INLINE Float getItemPadding() const { return itemPadding; } /// Set the padding amount between each menu item in this menu. RIM_INLINE void setItemPadding( Float newPadding ) { itemPadding = newPadding; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Item Bounding Box Accessor Methods /// Return the maximum width of any item's image within this menu. RIM_INLINE Float getMaxItemImageWidth() const { return maxItemImageWidth; } /// Return the maximum width of any item's text within this menu. RIM_INLINE Float getMaxItemTextWidth() const { return maxItemTextWidth; } /// Return the maximum width of any item's keyboard shortcut within this menu. RIM_INLINE Float getMaxItemShortcutWidth() const { return maxItemShortcutWidth; } /// Return the bounding box of the menu item with the specified index. RIM_INLINE const AABB2f& getItemBounds( Index itemIndex ) const { return items[itemIndex].bounds; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Border Accessor Methods /// Return a mutable object which describes the border for this menu's popup area. RIM_INLINE Border& getBorder() { return border; } /// Return an object which describes the border for this menu's popup area. RIM_INLINE const Border& getBorder() const { return border; } /// Set an object which describes the border for this menu's popup area. RIM_INLINE void setBorder( const Border& newBorder ) { border = newBorder; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Color Accessor Methods /// Return the background color for this menu's main area. RIM_INLINE const Color4f& getBackgroundColor() const { return backgroundColor; } /// Set the background color for this menu's main area. RIM_INLINE void setBackgroundColor( const Color4f& newBackgroundColor ) { backgroundColor = newBackgroundColor; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Border Color Accessor Methods /// Return the border color used when rendering a menu. RIM_INLINE const Color4f& getBorderColor() const { return borderColor; } /// Set the border color used when rendering a menu. RIM_INLINE void setBorderColor( const Color4f& newBorderColor ) { borderColor = newBorderColor; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Separator Color Accessor Methods /// Return the color used when rendering a menu item separator. RIM_INLINE const Color4f& getSeparatorColor() const { return separatorColor; } /// Set the color used when rendering a menu item separator. RIM_INLINE void setSeparatorColor( const Color4f& newSeparatorColor ) { separatorColor = newSeparatorColor; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Separator Color Accessor Methods /// Return the color overlayed when a menu item is highlighted. RIM_INLINE const Color4f& getHighlightColor() const { return highlightColor; } /// Set the color overlayed when a menu item is highlighted. RIM_INLINE void setHighlightColor( const Color4f& newHighlightColor ) { highlightColor = newHighlightColor; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Text Style Accessor Methods /// Return a reference to the font style which is used to render the text for a menu. RIM_INLINE const FontStyle& getTextStyle() const { return textStyle; } /// Set the font style which is used to render the text for a menu. RIM_INLINE void setTextStyle( const FontStyle& newTextStyle ) { textStyle = newTextStyle; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Drawing Method /// Draw this menu using the specified GUI renderer to the given parent coordinate system bounds. /** * The method returns whether or not the menu was successfully drawn. */ virtual Bool drawSelf( GUIRenderer& renderer, const AABB3f& parentBounds ) const; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Input Handling Methods /// Handle the specified keyboard event for the entire menu. virtual void keyEvent( const KeyboardEvent& event ); /// Handle the specified mouse motion event for the entire menu. virtual void mouseMotionEvent( const MouseMotionEvent& event ); /// Handle the specified mouse button event for the entire menu. virtual void mouseButtonEvent( const MouseButtonEvent& event ); /// Handle the specified mouse wheel event for the entire menu. virtual void mouseWheelEvent( const MouseWheelEvent& event ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Delegate Accessor Methods /// Return a reference to the delegate which responds to events for this menu. RIM_INLINE MenuDelegate& getDelegate() { return delegate; } /// Return a reference to the delegate which responds to events for this menu. RIM_INLINE const MenuDelegate& getDelegate() const { return delegate; } /// Return a reference to the delegate which responds to events for this menu. RIM_INLINE void setDelegate( const MenuDelegate& newDelegate ) { delegate = newDelegate; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Static Construction Methods /// Construct a smart-pointer-wrapped instance of this class using the constructor with the given arguments. RIM_INLINE static Pointer<Menu> construct() { return Pointer<Menu>::construct(); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Public Static Data Members /// The default padding to use between menu items of a menu. static const Float DEFAULT_ITEM_PADDING; /// The default border that is used for a menu. static const Border DEFAULT_BORDER; /// The default background color that is used for a menu's area. static const Color4f DEFAULT_BACKGROUND_COLOR; /// The default border color that is used for a menu. static const Color4f DEFAULT_BORDER_COLOR; /// The default separator color that is used for a menu. static const Color4f DEFAULT_SEPARATOR_COLOR; /// The default highlight color that is used for a menu. static const Color4f DEFAULT_HIGHLIGHT_COLOR; private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Class Declaration /// A class which contains information about a single menu item that is part of a menu. class ItemInfo { public: /// Create a new item information object associated with the specified item. RIM_INLINE ItemInfo( const Pointer<MenuItem>& newItem ) : item( newItem ) { } /// A pointer to the item associated with this item information object. Pointer<MenuItem> item; /// The bounding box of the item within the menu's coordinate system. AABB2f bounds; }; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Members /// A string representing the title of this menu. /** * This is the displayed name of the menu when it is part of a MenuBar * or is a submenu of a MenuItem. */ UTF8String title; /// A list of all of the items that are part of this menu. ArrayList<ItemInfo> items; /// The padding space between menu items. Float itemPadding; /// An object which describes the border for this menu's popup area. Border border; /// The background color for the menu's area. Color4f backgroundColor; /// The border color for the menu's background area. Color4f borderColor; /// The color to use when rendering menu separators. Color4f separatorColor; /// The color which is used to highlight selected menu items. Color4f highlightColor; /// An object which determines the style of the text for this menu's items. FontStyle textStyle; /// An object which contains function pointers that respond to menu events. MenuDelegate delegate; /// The index of the currently highlighted item, or -1 if no item is highlighted. Int highlightedItemIndex; /// A value which caches the maximum image width of this menu's items. mutable Float maxItemImageWidth; /// A value which caches the maximum text width of this menu's items. mutable Float maxItemTextWidth; /// A value which caches the maximum keyboard shortcut width of this menu's items. mutable Float maxItemShortcutWidth; /// A boolean value indicating whether or not the user has clicked the menu with the mouse. Bool mousePressed; }; //########################################################################################## //************************ End Rim Graphics GUI Namespace ******************************** RIM_GRAPHICS_GUI_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_GRAPHICS_GUI_MENU_H <file_sep>/* * rimGUIWindow.h * Rim GUI * * Created by <NAME> on 5/24/08. * Copyright 2008 __MyCompanyName__. All rights reserved. * */ #ifndef INCLUDE_RIM_GUI_WINDOW_H #define INCLUDE_RIM_GUI_WINDOW_H #include "rimGUIConfig.h" #include "rimGUIElement.h" #include "rimGUIWindowElement.h" #include "rimGUIMenuBar.h" #include "rimGUIWindowDelegate.h" //########################################################################################## //*************************** Start Rim GUI Namespace ****************************** RIM_GUI_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class which represents a generic operating system GUI window. /** * A window is a rectangular region of the screen that floats over the GUI desktop. * It is generally the top-level object that contains the interface for an application. */ class Window : public GUIElement { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructors /// Create a centered window with the specified width and height. Window( const UTF8String& title, const Size2D& size ); /// Create a window with the specified width, height, position. Window( const UTF8String& title, const Size2D& size, const Vector2i& position ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Destructor /// Destroy a window, closing it if is visible and releasing all resources used. ~Window(); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Content View Accessor Methods /// Return the number of window element children that this window has. Size getChildCount() const; /// Return a shared pointer to the child window element at the specified index in this window. /** * If the specified index is out of bounds or an error occurs, a NULL pointer * is returned. */ Pointer<WindowElement> getChild( Index childIndex ) const; /// Add a child window element to this window. /** * The method returns whether or not the add operation was successful. * The method can fail if the specified window element pointer is NULL * or if the window element already has a parent window. */ Bool addChild( const Pointer<WindowElement>& element ); /// Remove the child window element from this window that matches the specified element. /** * The method returns whether or not the specified window element was found * to be a part of this window and then successfully removed. */ Bool removeChild( const WindowElement* element ); /// Remove all child window elements from this window. void removeChildren(); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Menu Accessor Methods /// Get a non-const shared pointer to the window's menu. Pointer<MenuBar> getMenu() const; /// Set the menu of the window. Bool setMenu( const Pointer<MenuBar>& newMenu ); /// Return whether or not this window has a menu associated with it. Bool hasMenu() const; /// Release any references to the window's menu. void removeMenu(); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Positioning Methods /// Get the position of the window relative to the top left corner of the screen (in pixels). Vector2i getPosition() const; /// Set the position of the window relative to the top left corner of the screen (in pixels). Bool setPosition( const Vector2i& newPosition ); /// Set the position of the window relative to the top left corner of the screen (in pixels). Bool setPosition( Int xPosition, Int yPosition ); /// Center the window within the screen where it currently resides. Bool center(); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Content Sizing Methods /// Get the width of the window's content area in pixels. RIM_INLINE Size getContentWidth() const { return this->getContentSize().x; } /// Get the height of the window's content area in pixels. RIM_INLINE Size getContentHeight() const { return this->getContentSize().y; } /// Return a 2D vector indicating the horizontal and vertical size of the window's content area in pixels. Size2D getContentSize() const; /// Set the width of the window's content view, changing the window's size and resizing the content view. RIM_INLINE Bool setContentWidth( Size newWidth ) { return this->setContentSize( newWidth, this->getContentHeight() ); } /// Set the height of the window's content view, changing the window's size and resizing the content view. RIM_INLINE Bool setContentHeight( Size newHeight ) { return this->setContentSize( this->getContentWidth(), newHeight ); } /// Set the size of the window's content view, changing the window's size and resizing the content view. RIM_INLINE Bool setContentSize( Size newWidth, Size newHeight ) { return this->setContentSize( Size2D( newWidth, newHeight ) ); } /// Set the size of the window's content view, changing the window's size and resizing the content view. Bool setContentSize( const Size2D& newSize ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Window Sizing Methods /// Return the size of the entire window frame, including any title or menu bars or borders. Size2D getFrameSize() const; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Title Accessor Methods /// Return the title string for this window. /** * On most platforms, this string will be placed at the top of the window in * a title bar. */ UTF8String getTitle() const; /// Set the title string for this window. /** * The method returns whether or not the title change operation was successful. */ Bool setTitle( const UTF8String& newTitle ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Window Minimization Methods /// Return a boolean value indicating whether or not a window is currently minimized. Bool getIsMinimized() const; /// Set a boolean value determining whether or not a window should be minimized. Bool setIsMinimized( Bool newIsMinimized ); /// Minimize the window, moving it from the main screen to somewhere inconspicuous (OS-dependent). /** * The method returns whether or not the minimization operation was successful. */ Bool minimize(); /// Restore the window, moving it from it's minimized location to it's previous location on the screen. /** * The method returns whether or not the un-minimization operation was successful. */ Bool unminimize(); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Window Ordering Methods /// Move the window to the front of the window order (in it's level) within an application. Bool moveToFront(); /// Move the window to the back of the window order, beneath all windows but the desktop. Bool moveToBack(); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Visibility Status Accessor Methods /// Return whether or not the window is currently visible. Bool getIsVisible() const; /// Set whether or not the window should be visible. Bool setIsVisible( Bool newIsVisible ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Window Status Accessor Methods /// Get whether or not the window is fullscreen (takes entire screen area, including any OS menu bars). Bool getIsFullscreen() const; /// Set whether or not the window is fullscreen (takes entire screen area, including any OS menu bars). Bool setIsFullscreen( Bool newIsFullscreen ); /// Get whether or not the window is floating (always in front of normal windows). Bool getIsFloating() const; /// Get whether or not the window is floating (always in front of normal windows). Bool setIsFloating( Bool newIsFloating ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Window Capability Accessor Methods /// Get whether or not the window is able to be resized by the GUI user. /** * If a window is not able to be resized, it is still possible to resize the * window programatically. The only resizing operations that are prevented * are those that are caused by the user interacting with the GUI. */ Bool getIsResizable() const; /// Set whether or not the window is able to be resized by the GUI user. /** * If a window is not able to be resized, it is still possible to resize the * window programatically. The only resizing operations that are prevented * are those that are caused by the user interacting with the GUI. */ void setIsResizable( Bool newIsResizable ); /// Get whether or not the window is able to be moved by the GUI user. /** * If a window is not able to be moved, it is still possible to move the * window programatically. The only moving operations that are prevented * are those that are caused by the user interacting with the GUI. */ Bool getIsMovable() const; /// Set whether or not the window is able to be resized by the GUI user. /** * If a window is not able to be moved, it is still possible to move the * window programatically. The only moving operations that are prevented * are those that are caused by the user interacting with the GUI. */ void setIsMovable( Bool newIsMovable ); /// Get whether or not the window is able to be closed by the GUI user. /** * If a window is not able to be closed, it is still possible to close the * window programatically. The only closing operations that are prevented * are those that are caused by the user interacting with the GUI. */ Bool getIsClosable() const; /// Set whether or not the window is able to be closed by the GUI user. /** * If a window is not able to be closed, it is still possible to close the * window programatically. The only closing operations that are prevented * are those that are caused by the user interacting with the GUI. */ void setIsClosable( Bool newIsClosable ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Delegate (Event Handler) Accessor Methods /// Get a reference to the delegate object associated with this window. const WindowDelegate& getDelegate() const; /// Set the delegate object to which this window sends events. void setDelegate( const WindowDelegate& delegate ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Platform-Specific Pointer Accessor Method /// Get a pointer to this window's platform-specific internal representation. /** * On Mac OS X, this method returns a pointer to a subclass of NSWindow * which represents the window. * * On Windows, this method returns an HWND indicating a handle to the window which * represents the window. */ virtual void* getInternalPointer() const; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Static Shared Construction Methods /// Create a shared-pointer window object, calling the constructor with the same arguments. RIM_INLINE static Pointer<Window> construct( const UTF8String& newText, const Size2D& newSize ) { return Pointer<Window>( util::construct<Window>( newText, newSize ) ); } /// Create a shared-pointer window object, calling the constructor with the same arguments. RIM_INLINE static Pointer<Window> construct( const UTF8String& newText, const Size2D& newSize, const Vector2i& newPosition ) { return Pointer<Window>( util::construct<Window>( newText, newSize, newPosition ) ); } private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Window Wrapper Class Declaration /// A class which encapsulates internal platform-specific state. class Wrapper; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Members /// A pointer to internal implementation-specific data. Wrapper* wrapper; }; //########################################################################################## //*************************** End Rim GUI Namespace ******************************** RIM_GUI_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_GUI_WINDOW_H <file_sep>/* * rimGraphicsGUIRectangle.h * Rim Graphics GUI * * Created by <NAME> on 2/8/13. * Copyright 2013 Headspace Systems. All rights reserved. * */ #ifndef INCLUDE_RIM_GRAPHICS_GUI_RECTANGLE_H #define INCLUDE_RIM_GRAPHICS_GUI_RECTANGLE_H #include "rimGraphicsGUIUtilitiesConfig.h" #include "rimGraphicsGUIOrigin.h" //########################################################################################## //******************* Start Rim Graphics GUI Utilities Namespace ************************* RIM_GRAPHICS_GUI_UTILITIES_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class which represents a rectangle positioned relative to a parent bounding box origin. class Rectangle { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructors /// Create a new rectangle which is position at the bottom left origin with 0 width and height. RIM_INLINE Rectangle() : size(), transform(), origin() { } /// Create a new rectangle which has the specified size, position, and origin. RIM_INLINE Rectangle( const Vector2f& newSize, const Vector2f& newPosition = Vector2f(), const Origin& newPositionOrigin = Origin() ) : size( newSize, Float(0) ), transform( Vector3f( newPosition, Float(0) ) ), origin( newPositionOrigin ) { } /// Create a new rectangle which has the specified size, position, and origin. RIM_INLINE Rectangle( const Vector3f& newSize, const Vector3f& newPosition = Vector3f(), const Origin& newPositionOrigin = Origin() ) : size( newSize ), transform( newPosition ), origin( newPositionOrigin ) { } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Point Transformation Methods /// Transform a 2D point in the parent coordinate system into this rectangles's coordinate system. Vector2f transformToLocal( const Vector2f& point, const AABB2f& parentBounds ) const; /// Transform a 3D point in the parent coordinate system into this rectangles's coordinate system. Vector3f transformToLocal( const Vector3f& point, const AABB3f& parentBounds ) const; /// Transform a 2D point in this rectangle's local coordinate system into its parent's coordinate system. Vector2f transformFromLocal( const Vector2f& point, const AABB2f& parentBounds ) const; /// Transform a 3D point in this rectangle's local coordinate system into its parent's coordinate system. Vector3f transformFromLocal( const Vector3f& point, const AABB3f& parentBounds ) const; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Vector Transformation Methods /// Transform a 2D vector in the parent coordinate system into this rectangles's coordinate system. Vector2f transformVectorToLocal( const Vector2f& vector ) const; /// Transform a 3D vector in the parent coordinate system into this rectangles's coordinate system. Vector3f transformVectorToLocal( const Vector3f& vector ) const; /// Transform a 2D vector in this rectangle's local coordinate system into its parent's coordinate system. Vector2f transformVectorFromLocal( const Vector2f& vector ) const; /// Transform a 3D vector in this rectangle's local coordinate system into its parent's coordinate system. Vector3f transformVectorFromLocal( const Vector3f& vector ) const; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Size in Parent Frame Accessor Methods /// Return the 3D size of this rectangle's bounding box in its parent coordinate frame. /** * The method computes the projected size of this rectangle along its parent's coordinate * axes. */ RIM_INLINE Vector3f getSizeInParent() const { return math::abs( transform.orientation*(transform.scale*size) ); } /// Return the 2D bounding box of this rectangle in the coordinate frame of the specified parent bounding box. RIM_INLINE AABB2f getBoundsInParent( const AABB2f& parentBounds ) const { // Get the size of this rectangle in its parent coordinate frame. const Vector2f sizeInParent = this->getSizeInParent().getXY(); // Compute the location of the origin for this rectangles's position within the parent bounding box. Vector2f originOffset = parentBounds.min + origin.getOffset( parentBounds.getSize(), sizeInParent ); return AABB2f( originOffset, originOffset + sizeInParent ); } /// Return the 3D bounding box of this rectangle in the coordinate frame of the specified parent bounding box. RIM_INLINE AABB3f getBoundsInParent( const AABB3f& parentBounds ) const { // Get the size of this rectangle in its parent coordinate frame. const Vector3f sizeInParent = this->getSizeInParent(); // Compute the location of the origin for this rectangles's position within the parent bounding box. Vector3f originOffset = parentBounds.min + origin.getOffset( parentBounds.getSize(), sizeInParent ); return AABB3f( originOffset, originOffset + sizeInParent ); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Contains Point Methods /// Return whether or not the specified local point is contained within this rectangle. RIM_INLINE Bool containsLocalPoint( const Vector2f& point ) const { return point.x >= Float(0) && point.x <= size.x && point.y >= Float(0) && point.y <= size.y; } /// Return whether or not the specified local point is contained within this rectangle. RIM_INLINE Bool containsLocalPoint( const Vector3f& point ) const { return point.x >= Float(0) && point.x <= size.x && point.y >= Float(0) && point.y <= size.y && point.z >= Float(0) && point.z <= size.z; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Transformation Matrix Accessor Methods /// Return the rectangle-to-parent homogeneous transformation matrix. Matrix4f getTransformMatrix( const AABB3f& parentBounds ) const; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Public Data Members /// A 3D vector indicating the width, height, and depth of this rectangle before scaling. Vector3f size; /// A 3D transformation from rectangle-space to the rectangle's parent coordinate frame. Transform3f transform; /// An object representing the alignment of the coordinate origin for this rectangle. /** * This includes the position of the parent coordinate system's origin, but also * the location of the reference point on the rectangle. For instance, the default * coordinate system (bottom left) places the origin for the parent system at the * bottom left of the parent's bounds, and calculates all translation relative to * the bottom left corner of this rectangle's bounding box. */ Origin origin; }; //########################################################################################## //******************* End Rim Graphics GUI Utilities Namespace *************************** RIM_GRAPHICS_GUI_UTILITIES_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_GRAPHICS_GUI_RECTANGLE_H <file_sep>/* * rimGraphicsVertexBuffer.h * Rim Graphics * * Created by <NAME> on 3/10/13. * Copyright 2013 __MyCompanyName__. All rights reserved. * */ #ifndef INCLUDE_RIM_GRAPHICS_VERTEX_BUFFER_H #define INCLUDE_RIM_GRAPHICS_VERTEX_BUFFER_H #include "rimGraphicsBuffersConfig.h" #include "rimGraphicsHardwareBuffer.h" //########################################################################################## //*********************** Start Rim Graphics Buffers Namespace *************************** RIM_GRAPHICS_BUFFERS_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A type of HardwareBuffer which is used for specifying vertex attributes. class VertexBuffer : public HardwareBuffer { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructors /// Create an empty vertex buffer for the specified context. RIM_INLINE VertexBuffer( const devices::GraphicsContext* context ) : HardwareBuffer( context, HardwareBufferType::VERTEX_BUFFER ) { } }; //########################################################################################## //*********************** End Rim Graphics Buffers Namespace ***************************** RIM_GRAPHICS_BUFFERS_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_GRAPHICS_VERTEX_BUFFER_H <file_sep>/* * rimData.h * Rim Framework * * Created by <NAME> on 12/28/08. * Copyright 2008 Rim Software. All rights reserved. * */ #ifndef INCLUDE_RIM_DATA_MODULE_H #define INCLUDE_RIM_DATA_MODULE_H #include "data/rimDataConfig.h" #include "data/rimBuffer.h" #include "data/rimData.h" #include "data/rimDataBuffer.h" #include "data/rimBasicString.h" #include "data/rimBasicStringBuffer.h" #include "data/rimBasicStringIterator.h" #include "data/rimHashCode.h" #include "data/rimDataStore.h" #ifdef RIM_DATA_NAMESPACE_START #undef RIM_DATA_NAMESPACE_START #endif #ifdef RIM_DATA_NAMESPACE_END #undef RIM_DATA_NAMESPACE_END #endif #endif // INCLUDE_RIM_DATA_MODULE_H <file_sep>/* * rimGUIApplicationDelegate.h * Rim GUI * * Created by <NAME> on 6/7/09. * Copyright 2009 Rim Software. All rights reserved. * */ #ifndef INCLUDE_RIM_GUI_APPLICATION_DELEGATE_H #define INCLUDE_RIM_GUI_APPLICATION_DELEGATE_H #include "rimGUIConfig.h" #include "rimGUIInput.h" //########################################################################################## //*************************** Start Rim GUI Namespace ****************************** RIM_GUI_NAMESPACE_START //****************************************************************************************** //########################################################################################## class Application; //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class which contains function objects that recieve application events. /** * Any application-related event that might be processed has an appropriate callback * function object. Each callback function is called by the GUI event thread * whenever such an event is received. If a callback function in the delegate * is not initialized, an application simply ignores it. * * It must be noted that the callback functions are asynchronous and * not thread-safe. Thus, it is necessary to perform any additional synchronization * externally. */ class ApplicationDelegate { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Application Event Callback Functions /// A function object which is called whenever an attached application is lauched. /** * This callback serves as the main entry point for the application's non-GUI code. * It is called on its own thread and thus the function need not return until the * application should close. When this function returns , the 'shouldStop' delegate method * will be called to determine if the application's GUI event thread should terminate. * If the delegate signals that it should, then the application will stop. * If this method is never set, the application ignores it and continues to * run the GUI event thread until it is told to stop. */ Function<void ( Application& )> start; /// A function object which is called whenever a file should be opened by an application. /** * For instance, this method is invoked whenever a file is dragged onto an application's * icon, telling it to open the specified file. The method is given a string which * represents the path to the file to be opened. The method should return TRUE if * the file was opened successfully or FALSE if it was not. */ Function<Bool ( Application&, const File& )> openFile; /// A function object which is called whenever multiple files should be opened by an application. /** * For instance, this method is invoked whenever several files are dragged * onto an application's icon, telling it to open the specified files. The method * is given an array list of strings which represent paths to the files to be opened. * The method should return TRUE if at least one of the files was opened successfully, * or FALSE otherwise. */ Function<Bool ( Application&, const ArrayList<File>& )> openFiles; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** User Input Callback Functions /// A function object called whenever an attached application receives a keyboard event. Function<void ( Application&, const input::KeyboardEvent& )> keyEvent; /// A function object called whenever an attached application receives a mouse-motion event. Function<void ( Application&, const input::MouseMotionEvent& )> mouseMotionEvent; /// A function object called whenever an attached application receives a mouse-button event. Function<void ( Application&, const input::MouseButtonEvent& )> mouseButtonEvent; /// A function object called whenever an attached application receives a mouse-wheel event. Function<void ( Application&, const input::MouseWheelEvent& )> mouseWheelEvent; }; //########################################################################################## //*************************** End Rim GUI Namespace ******************************** RIM_GUI_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_GUI_APPLICATION_DELEGATE_H <file_sep>/* * rimGraphicsRenderMode.h * Rim Graphics * * Created by <NAME> on 3/14/13. * Copyright 2013 __MyCompanyName__. All rights reserved. * */ #ifndef INCLUDE_RIM_GRAPHICS_RENDER_MODE_H #define INCLUDE_RIM_GRAPHICS_RENDER_MODE_H #include "rimGraphicsUtilitiesConfig.h" #include "rimGraphicsRenderFlags.h" #include "rimGraphicsRasterMode.h" #include "rimGraphicsBlendMode.h" #include "rimGraphicsDepthMode.h" #include "rimGraphicsStencilMode.h" #include "rimGraphicsAlphaTest.h" //########################################################################################## //********************** Start Rim Graphics Utilities Namespace ************************** RIM_GRAPHICS_UTILITIES_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class which specifies the configuration of the fixed-function rendering pipeline. class RenderMode { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructors /// Create a new render mode with the default rendering parameters. /** * By default, color writing, depth writing, and the depth test are * enabled by the render flags. */ RIM_INLINE RenderMode() : flags( DEFAULT_RENDER_FLAGS ), rasterMode( RasterMode::TRIANGLES ), blendMode(), depthMode(), stencilMode(), alphaTest( AlphaTest::ALWAYS ), lineWidth( 1.0f ), pointSize( 1.0f ) { } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Render Flags Accessor Methods /// Return a reference to an object which contains boolean parameters of the render mode. RIM_INLINE RenderFlags& getFlags() { return flags; } /// Return an object which contains boolean parameters of the render mode. RIM_INLINE const RenderFlags& getFlags() const { return flags; } /// Set an object which contains boolean parameters of the render mode. RIM_INLINE void setFlags( const RenderFlags& newFlags ) { flags = newFlags; } /// Return whether or not the specified boolan render flag is set for this render mode. RIM_INLINE Bool flagIsSet( RenderFlags::Flag flag ) const { return flags.isSet( flag ); } /// Set whether or not the specified boolan render flag is set for this render mode. RIM_INLINE void setFlag( RenderFlags::Flag flag, Bool newIsSet = true ) { flags.set( flag, newIsSet ); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Raster Mode Accessor Methods /// Return a reference to an object representing the raster mode for this render mode. RIM_INLINE RasterMode& getRasterMode() { return rasterMode; } /// Return a reference to an object representing the raster mode for this render mode. RIM_INLINE const RasterMode& getRasterMode() const { return rasterMode; } /// Set an object representing the raster mode for this render mode. RIM_INLINE void setRasterMode( const RasterMode& newRasterMode ) { rasterMode = newRasterMode; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Blend Mode Accessor Methods /// Return a reference to an object representing the blend mode for this render mode. RIM_INLINE BlendMode& getBlendMode() { return blendMode; } /// Return a reference to an object representing the blend mode for this render mode. RIM_INLINE const BlendMode& getBlendMode() const { return blendMode; } /// Set an object representing the blend mode for this render mode. RIM_INLINE void setBlendMode( const BlendMode& newBlendMode ) { blendMode = newBlendMode; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Depth Mode Accessor Methods /// Return a reference to an object representing the depth mode for this render mode. RIM_INLINE DepthMode& getDepthMode() { return depthMode; } /// Return a reference to an object representing the depth mode for this render mode. RIM_INLINE const DepthMode& getDepthMode() const { return depthMode; } /// Set an object representing the depth mode for this render mode. RIM_INLINE void setDepthMode( const DepthMode& newDepthMode ) { depthMode = newDepthMode; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Stencil Mode Accessor Methods /// Return a reference to an object representing the stencil mode for this render mode. RIM_INLINE StencilMode& getStencilMode() { return stencilMode; } /// Return a reference to an object representing the stencil mode for this render mode. RIM_INLINE const StencilMode& getStencilMode() const { return stencilMode; } /// Set an object representing the stencil mode for this render mode. RIM_INLINE void setStencilMode( const StencilMode& newStencilMode ) { stencilMode = newStencilMode; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Alpha Test Accessor Methods /// Return a reference to an object representing the alpha test for this render mode. RIM_INLINE AlphaTest& getAlphaTest() { return alphaTest; } /// Return a reference to an object representing the alpha test for this render mode. RIM_INLINE const AlphaTest& getAlphaTest() const { return alphaTest; } /// Set an object representing the alpha test for this render mode. RIM_INLINE void setAlphaTest( const AlphaTest& newAlphaTest ) { alphaTest = newAlphaTest; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Line Width Accessor Methods /// Return the width in pixels to use when rendering lines. RIM_INLINE Float getLineWidth() const { return lineWidth; } /// Set the width in pixels to use when rendering lines. RIM_INLINE void setLineWidth( Float newLineWidth ) { lineWidth = newLineWidth; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Point Size Accessor Methods /// Return the size in pixels to use when rendering points. RIM_INLINE Float getPointSize() const { return pointSize; } /// Set the size in pixels to use when rendering points. RIM_INLINE void setPointSize( Float newPointSize ) { pointSize = newPointSize; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Comparison Operators /// Return whether or not this render mode is equal to another render mode. RIM_INLINE Bool operator == ( const RenderMode& other ) const { return flags == other.flags && blendMode == other.blendMode && depthMode == other.depthMode && stencilMode == other.stencilMode && lineWidth == other.lineWidth && pointSize == other.pointSize; } /// Return whether or not this render mode is not equal to another render mode. RIM_INLINE Bool operator != ( const RenderMode& other ) const { return !(*this == other); } private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Static Data Members /// The default set flags to use for a render mode. static const UInt DEFAULT_RENDER_FLAGS = RenderFlags::COLOR_WRITE | RenderFlags::DEPTH_WRITE | RenderFlags::DEPTH_TEST | RenderFlags::GAMMA_CORRECTION; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Members /// A value which contains boolean parameters for the render mode. RenderFlags flags; /// An object which determines how primitive geometry is rasterized. RasterMode rasterMode; /// An object which contains the configuration of the blending pipeline. BlendMode blendMode; /// An object which contains the configuration of the depth test pipeline. DepthMode depthMode; /// An object which contains the configuration of the stencil test pipeline. StencilMode stencilMode; /// An object which contains the configuration of the alpha test pipeline. AlphaTest alphaTest; /// The width in pixels to use when rendering lines. Float lineWidth; /// The size in pixels of the points that are rendered. Float pointSize; }; //########################################################################################## //********************** End Rim Graphics Utilities Namespace **************************** RIM_GRAPHICS_UTILITIES_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_GRAPHICS_RENDER_MODE_H <file_sep>/* * rimGraphicsOpenGLIndexBuffer.h * Rim Graphics * * Created by <NAME> on 3/10/13. * Copyright 2013 __MyCompanyName__. All rights reserved. * */ #ifndef INCLUDE_RIM_GRAPHICS_OPENGL_INDEX_BUFFER_H #define INCLUDE_RIM_GRAPHICS_OPENGL_INDEX_BUFFER_H #include "rimGraphicsOpenGLConfig.h" //########################################################################################## //******************** Start Rim Graphics Devices OpenGL Namespace *********************** RIM_GRAPHICS_DEVICES_OPENGL_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class which represents a buffer of indices stored in GPU memory. class OpenGLIndexBuffer : public IndexBuffer { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Destructors /// Destroy this index buffer and all state associated with it. ~OpenGLIndexBuffer(); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Buffer Capacity Accessor Methods /// Set the number of bytes that this buffer is able to hold. virtual Bool setCapacityInBytes( Size newCapacityInBytes ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Attribute Accessor Methods /// Read the specified number of attributes from the index buffer into the specified output pointer. virtual Bool getAttributes( void* attributes, Size& numAttributes ) const; /// Replace the contents of this index buffer with the specified attributes. virtual Bool setAttributes( const void* attributes, const AttributeType& attributeType, Size numAttributes, HardwareBufferUsage newUsage = HardwareBufferUsage::STATIC ); /// Update a region of this hardware attribute buffer with the specified attributes. virtual Bool updateAttributes( const void* attributes, const AttributeType& attributeType, Size numAttributes, Index startIndex = 0 ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Buffer Reallocation Method /// Reallocate this buffer's data store using its current capacity. virtual Bool reallocate(); /// Reallocate this buffer's data store using its current capacity, changing its usage type. virtual Bool reallocate( HardwareBufferUsage newUsage ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Buffer Mapping Methods /// Map this buffer's data store to the main memory address space and return a pointer to it. virtual void* mapBuffer( HardwareBufferAccessType accessType, Index startIndex ); /// Unmap this buffer's data store to the main memory address space. virtual void unmapBuffer() const; /// Return whether or not this attribute buffer is currently mapped to main memory. virtual Bool isMapped() const; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Buffer Usage Accessor Method /// Get the current expected usage pattern for this hardware attribute buffer. virtual HardwareBufferUsage getUsage() const; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Integral Identifier Accessor Method /// Get a unique integral identifier for this index buffer. RIM_INLINE OpenGLID getID() const { return bufferID; } private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Friend Class Declaration /// Declare the OpenGLContext class as a friend so that it can create instances of this class. friend class OpenGLContext; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Constructors /// Create an empty index buffer with the given usage type. OpenGLIndexBuffer( const GraphicsContext* context, const HardwareBufferUsage& usageType ); /// Create an empty index buffer with the given usage type, attribute type, and capacity. OpenGLIndexBuffer( const GraphicsContext* context, const AttributeType& attributeType, Size capacity, const HardwareBufferUsage& usageType ); /// Create an empty index buffer with the type, attributes, and usage type. OpenGLIndexBuffer( const GraphicsContext* context, const void* attributes, const AttributeType& attributeType, Size capacity, const HardwareBufferUsage& usageType ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Helper Methods /// Convert the specified buffer usage to an OpenGL VBO usage enum. RIM_INLINE static Bool getGLUsage( HardwareBufferUsage usage, OpenGLEnum& glUsage ); /// Convert the specified access type to an OpenGL access type enum value. RIM_INLINE static Bool getGLAccessType( const HardwareBufferAccessType& accessType, OpenGLEnum& glAccessType ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Members /// The ID used by OpenGL to uniquely identify this index buffer. OpenGLID bufferID; /// An object which indicates the expected usage pattern for this buffer. HardwareBufferUsage usage; /// A boolean value which indicates whether or not this buffer's data is currently mapped to main memory. /** * If this value is TRUE, it means that the buffer's data is being iterated over * and potentially read/updated and so cannot be used to draw anything. */ mutable Bool mapped; }; //########################################################################################## //******************** End Rim Graphics Devices OpenGL Namespace ************************* RIM_GRAPHICS_DEVICES_OPENGL_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_GRAPHICS_OPENGL_INDEX_BUFFER_H <file_sep>/* * rimGUIInput.h * Rim GUI * * Created by <NAME> on 5/28/08. * Copyright 2008 __MyCompanyName__. All rights reserved. * */ #ifndef INCLUDE_RIM_GUI_INPUT_H #define INCLUDE_RIM_GUI_INPUT_H #include "input/rimGUIInputConfig.h" #include "input/rimGUIInputKeyboard.h" #include "input/rimGUIInputKey.h" #include "input/rimGUIInputKeyCodeConverter.h" #include "input/rimGUIInputKeyboardEvent.h" #include "input/rimGUIInputMouse.h" #include "input/rimGUIInputMouseButton.h" #include "input/rimGUIInputMouseButtonEvent.h" #include "input/rimGUIInputMouseMotionEvent.h" #include "input/rimGUIInputMouseWheelEvent.h" #include "input/rimGUIInputKeyboardShortcut.h" #endif // INCLUDE_RIM_GUI_INPUT_H <file_sep>/* * rimGraphicsMaterialsConfig.h * Rim Graphics * * Created by <NAME> on 11/28/11. * Copyright 2011 __MyCompanyName__. All rights reserved. * */ #ifndef INCLUDE_RIM_GRAPHICS_MATERIALS_CONFIG_H #define INCLUDE_RIM_GRAPHICS_MATERIALS_CONFIG_H #include "../rimGraphicsConfig.h" #include "../rimGraphicsShaders.h" //########################################################################################## //########################################################################################## //############ //############ Library Namespace Configuration //############ //########################################################################################## //########################################################################################## #ifndef RIM_GRAPHICS_MATERIALS_NAMESPACE_START #define RIM_GRAPHICS_MATERIALS_NAMESPACE_START RIM_GRAPHICS_NAMESPACE_START namespace materials { #endif #ifndef RIM_GRAPHICS_MATERIALS_NAMESPACE_END #define RIM_GRAPHICS_MATERIALS_NAMESPACE_END }; RIM_GRAPHICS_NAMESPACE_END #endif //########################################################################################## //********************** Start Rim Graphics Materials Namespace ************************** RIM_GRAPHICS_MATERIALS_NAMESPACE_START //****************************************************************************************** //########################################################################################## using rim::graphics::shaders::ShaderPass; using rim::graphics::shaders::GenericShaderPass; //########################################################################################## //********************** End Rim Graphics Materials Namespace **************************** RIM_GRAPHICS_MATERIALS_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_GRAPHICS_MATERIALS_CONFIG_H <file_sep>/* * rimSIMDArray.h * Rim Framework * * Created by <NAME> on 1/19/13. * Copyright 2013 __MyCompanyName__. All rights reserved. * */ #ifndef INCLUDE_RIM_SIMD_ARRAY_H #define INCLUDE_RIM_SIMD_ARRAY_H #include "rimMathConfig.h" #include "rimScalarMath.h" //########################################################################################## //***************************** Start Rim Math Namespace ********************************* RIM_MATH_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// The prototype for the SIMDArray class for wide SIMD operations. /** * This class emulates aribitrary-width SIMD registers using an array of SIMD * values which are all processed in a vector fashion similar to normal SIMD values. * * This template prototype is a scalar implementation of basic SIMD functionality. * Supported operations include all basic arithmetic operations * (+, -, *, /, +=, -=, *=, /=) and functions that operate on SIMDArray instances * to find the per-component result for abs(), min(), max(), and sqrt() operations. * * This implementation is provided as a fallback for when SIMD instructions are not * available and for completeness. On any given platform, specializations for this * class/functions should be implemented which use real SIMD operations. */ template < typename T, Size width > class SIMDArray { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructors /// Create a scalar with it's elements equal to zero RIM_FORCE_INLINE SIMDArray() { for ( Index i = 0; i < width; i++ ) x[i] = T(0); } /// Create a scalar with it's elements equal to zero RIM_FORCE_INLINE SIMDArray( T value ) { for ( Index i = 0; i < width; i++ ) x[i] = value; } /// Create a scalar with elements from the specified array. /** * The array must be of length greater than or equal to the * width of the scalar. */ RIM_FORCE_INLINE SIMDArray( const T* array ) { for ( Index i = 0; i < width; i++ ) x[i] = array[i]; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Accessor Methods /// Return an array representation of this scalar. RIM_FORCE_INLINE const T* toArray() const { return x; } /// Get the element at the specified index in the scalar. RIM_FORCE_INLINE T& get( Index i ) { return x[i]; } /// Get the element at the specified index in the scalar. RIM_FORCE_INLINE const T& get( Index i ) const { return x[i]; } /// Get the element at the specified index in the scalar. RIM_FORCE_INLINE T& operator () ( Index i ) { return x[i]; } /// Get the element at the specified index in the scalar. RIM_FORCE_INLINE const T& operator () ( Index i ) const { return x[i]; } /// Get the element at the specified index in the scalar. RIM_FORCE_INLINE T& operator [] ( Index i ) { return x[i]; } /// Get the element at the specified index in the scalar. RIM_FORCE_INLINE const T& operator [] ( Index i ) const { return x[i]; } /// Set the element at the specified index in the scalar. RIM_FORCE_INLINE void set( Index i, T newX ) { x[i] = newX; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Sum Method /// Return the horizontal sum of all components of this SIMD scalar. RIM_FORCE_INLINE T sum() const { T total = T(0); for ( Index i = 0; i < width; i++ ) total += x[i]; return total; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Negation/Positivation Operators /// Negate every component of this scalar and return the result. RIM_FORCE_INLINE SIMDArray operator - () const { SIMDArray result; for ( Index i = 0; i < width; i++ ) result.x[i] = -x[i]; return result; } /// 'Positivate' every component of this scalar, effectively returning a copy. RIM_FORCE_INLINE SIMDArray operator + () const { return *this; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Arithmetic Operators /// Add a scalar to this scalar and return the resulting scalar. RIM_FORCE_INLINE SIMDArray operator + ( const SIMDArray& scalar ) const { SIMDArray result; for ( Index i = 0; i < width; i++ ) result.x[i] = x[i] + scalar.x[i]; return result; } /// Add a scalar value to each component of this scalar and return the resulting scalar. RIM_FORCE_INLINE SIMDArray operator + ( const T& value ) const { SIMDArray result; for ( Index i = 0; i < width; i++ ) result.x[i] = x[i] + value; return result; } /// Subtract a scalar from this scalar and return the resulting scalar. RIM_FORCE_INLINE SIMDArray operator - ( const SIMDArray& scalar ) const { SIMDArray result; for ( Index i = 0; i < width; i++ ) result.x[i] = x[i] - scalar.x[i]; return result; } /// Subtract a scalar value from each component of this scalar and return the resulting scalar. RIM_FORCE_INLINE SIMDArray operator - ( const T& value ) const { SIMDArray result; for ( Index i = 0; i < width; i++ ) result.x[i] = x[i] - value; return result; } /// Return the result of a component-wise scalar multiplication with this scalar. RIM_FORCE_INLINE SIMDArray operator * ( const SIMDArray& scalar ) const { SIMDArray result; for ( Index i = 0; i < width; i++ ) result.x[i] = x[i]*scalar.x[i]; return result; } /// Multiply a scalar value by each component of this scalar and return the resulting scalar. RIM_FORCE_INLINE SIMDArray operator * ( const T& value ) const { SIMDArray result; for ( Index i = 0; i < width; i++ ) result.x[i] = x[i]*value; return result; } /// Divide each component of this scalar by a scalar value and return the resulting scalar. RIM_FORCE_INLINE SIMDArray operator / ( const T& value ) const { SIMDArray result; for ( Index i = 0; i < width; i++ ) result.x[i] = x[i] / value; return result; } /// Divide each component of this scalar by a scalar component and return the resulting scalar. RIM_FORCE_INLINE SIMDArray operator / ( const SIMDArray& scalar ) const { SIMDArray result; for ( Index i = 0; i < width; i++ ) result.x[i] = x[i] / scalar.x[i]; return result; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Arithmetic Assignment Operators RIM_FORCE_INLINE SIMDArray& operator += ( const SIMDArray& v2 ) { for ( Index i = 0; i < width; i++ ) x[i] += v2.x[i]; return *this; } RIM_FORCE_INLINE SIMDArray& operator += ( const T& value ) { for ( Index i = 0; i < width; i++ ) x[i] += value; return *this; } RIM_FORCE_INLINE SIMDArray& operator -= ( const SIMDArray& v2 ) { for ( Index i = 0; i < width; i++ ) x[i] -= v2.x[i]; return *this; } RIM_FORCE_INLINE SIMDArray& operator -= ( const T& value ) { for ( Index i = 0; i < width; i++ ) x[i] -= value; return *this; } RIM_FORCE_INLINE SIMDArray& operator *= ( const SIMDArray& scalar ) { for ( Index i = 0; i < width; i++ ) x[i] *= scalar.x[i]; return *this; } RIM_FORCE_INLINE SIMDArray& operator *= ( const T& value ) { for ( Index i = 0; i < width; i++ ) x[i] *= value; return *this; } RIM_FORCE_INLINE SIMDArray& operator /= ( const SIMDArray& scalar ) { for ( Index i = 0; i < width; i++ ) x[i] /= scalar.x[i]; return *this; } RIM_FORCE_INLINE SIMDArray& operator /= ( const T& value ) { for ( Index i = 0; i < width; i++ ) x[i] /= value; return *this; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Required Alignment Accessor Methods /// Return the alignment required in bytes for objects of this type. /** * For most SIMD types this value will be 16 bytes. If there is * no alignment required, 0 is returned. */ RIM_FORCE_INLINE static Size getRequiredAlignment() { return 0; } /// Get the width of this scalar (number of components it has). RIM_FORCE_INLINE static Size getWidth() { return width; } private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Members /// The components of this SIMD scalar. T x[width]; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Friend Function Declarations template < typename U, Size dim > friend SIMDArray<U,dim> operator + ( const U& value, const SIMDArray<T,dim>& scalar ); template < typename U, Size dim > friend SIMDArray<U,dim> operator - ( const U& value, const SIMDArray<T,dim>& scalar ); template < typename U, Size dim > friend SIMDArray<U,dim> operator * ( const U& value, const SIMDArray<T,dim>& scalar ); template < typename U, Size dim > friend SIMDArray<U,dim> operator / ( const U& value, const SIMDArray<T,dim>& scalar ); }; //########################################################################################## //########################################################################################## //############ //############ Associative SIMD Scalar Operators //############ //########################################################################################## //########################################################################################## /// Add a scalar value to each component of this scalar and return the resulting scalar. template < typename T, Size width > RIM_FORCE_INLINE SIMDArray<T,width> operator + ( const T& value, const SIMDArray<T,width>& scalar ) { SIMDArray<T,width> result; for ( Index i = 0; i < width; i++ ) result.x[i] = value + scalar.x[i]; return result; } /// Subtract a scalar value from each component of this scalar and return the resulting scalar. template < typename T, Size width > RIM_FORCE_INLINE SIMDArray<T,width> operator - ( const T& value, const SIMDArray<T,width>& scalar ) { SIMDArray<T,width> result; for ( Index i = 0; i < width; i++ ) result.x[i] = value - scalar.x[i]; return result; } /// Multiply a scalar value by each component of this scalar and return the resulting scalar. template < typename T, Size width > RIM_FORCE_INLINE SIMDArray<T,width> operator * ( const T& value, const SIMDArray<T,width>& scalar ) { SIMDArray<T,width> result; for ( Index i = 0; i < width; i++ ) result.x[i] = value*scalar.x[i]; return result; } /// Divide each component of this scalar by a scalar value and return the resulting scalar. template < typename T, Size width > RIM_FORCE_INLINE SIMDArray<T,width> operator / ( const T& value, const SIMDArray<T,width>& scalar ) { SIMDArray<T,width> result; for ( Index i = 0; i < width; i++ ) result.x[i] = value / scalar.x[i]; return result; } //########################################################################################## //########################################################################################## //############ //############ Free Vector Functions //############ //########################################################################################## //########################################################################################## /// Compute the absolute value of each component of the specified SIMD scalar and return the result. template < typename T, Size width > RIM_FORCE_INLINE SIMDArray<T,width> abs( const SIMDArray<T,width>& scalar ) { SIMDArray<T,width> result; for ( Index i = 0; i < width; i++ ) result.x[i] = math::abs(scalar.x[i]); return result; } /// Compute the square root of each component of the specified SIMD scalar and return the result. template < typename T, Size width > RIM_FORCE_INLINE SIMDArray<T,width> sqrt( const SIMDArray<T,width>& scalar ) { SIMDArray<T,width> result; for ( Index i = 0; i < width; i++ ) result.x[i] = math::sqrt(scalar.x[i]); return result; } /// Compute the minimum of each component of the specified SIMD scalars and return the result. template < typename T, Size width > RIM_FORCE_INLINE SIMDArray<T,width> min( const SIMDArray<T,width>& scalar1, const SIMDArray<T,width>& scalar2 ) { SIMDArray<T,width> result; for ( Index i = 0; i < width; i++ ) result.x[i] = math::min( scalar1.x[i], scalar2.x[i] ); return result; } /// Compute the maximum of each component of the specified SIMD scalars and return the result. template < typename T, Size width > RIM_FORCE_INLINE SIMDArray<T,width> max( const SIMDArray<T,width>& scalar1, const SIMDArray<T,width>& scalar2 ) { SIMDArray<T,width> result; for ( Index i = 0; i < width; i++ ) result.x[i] = math::max( scalar1.x[i], scalar2.x[i] ); return result; } //########################################################################################## //***************************** End Rim Math Namespace *********************************** RIM_MATH_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_SIMD_ARRAY_H <file_sep>/* * rimPhysicsCollisionAlgorithmSphereVsMesh.h * Rim Physics * * Created by <NAME> on 7/12/12. * Copyright 2012 __MyCompanyName__. All rights reserved. * */ #ifndef INCLUDE_RIM_PHYSICS_COLLISION_ALGORITHM_SPHERE_VS_MESH_H #define INCLUDE_RIM_PHYSICS_COLLISION_ALGORITHM_SPHERE_VS_MESH_H #include "rimPhysicsCollisionConfig.h" //########################################################################################## //********************** Start Rim Physics Collision Namespace *************************** RIM_PHYSICS_COLLISION_NAMESPACE_START //****************************************************************************************** //########################################################################################## //########################################################################################## //********************** End Rim Physics Collision Namespace ***************************** RIM_PHYSICS_COLLISION_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_PHYSICS_COLLISION_ALGORITHM_SPHERE_VS_MESH_H <file_sep>/* * rimFilterGraph.h * Rim Sound * * Created by <NAME> on 6/7/08. * Copyright 2008 Rim Software. All rights reserved. * */ #ifndef INCLUDE_RIM_SOUND_FILTER_GRAPH_H #define INCLUDE_RIM_SOUND_FILTER_GRAPH_H #include "rimSoundFiltersConfig.h" #include "rimSoundFilter.h" //########################################################################################## //************************ Start Rim Sound Filters Namespace ***************************** RIM_SOUND_FILTERS_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class which represents an acyclic graph of sound processing filters. /** * This class is provided to make complex graphs of audio processing filters * easy to construct and maintain. A filter graph consists of any number of * inputs and outputs (determined by the connections made) which are exposed to * the user, plus internal SoundFilter objects which perform audio processing * on the input and output sound of the filter graph. A filter graph initially has * no connections and thus won't produce or process any audio. The user must make * connections from filters to the graph's external inputs and outputs and amongst * the filters in order for a filter graph to function properly. * * The FilterGraph class is provided as a convenience in doing complex audio * processing. It handles all temporary buffer allocation and management and enables * efficient communication between filters in the processing graph. While using * a filter graph is efficient, it will not be as fast as a hand-coded processing * graph which is specifically optimized for the task at hand. * * It must be noted that the filter graph class does not own or know anything about * the lifetime of the SoundFilter objects which it is connecting. The filter object * pointers which are connected are expected to be valid until they are either removed * from the graph or the graph is destroyed. */ class FilterGraph : public SoundFilter { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructors /// Create a new graph of sound filters with no connections. /** * As is, this graph will not be able to process any sound. * The user must connect filters within the graph, forming a chain * to the output in order for it to function properly. */ FilterGraph(); /// Create a copy of the specified sound filter graph, duplicating all of its connections. FilterGraph( const FilterGraph& other ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Destructor /// Destroy this sound filter graph, releasing all internal state. ~FilterGraph(); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Assignment Operator /// Assign a copy of the specified sound filter graph to this graph, duplicating all of its connections. FilterGraph& operator = ( const FilterGraph& other ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Filter Graph Node Accessor Methods /// Return the total number of nodes in the filter graph. /** * This number includes the main input/output node, so this * value is usually equal to the number of filters in the graph plus one * unless the main input/output node is not yet connected, in which * case it is equal to the number of filters. */ RIM_INLINE Size getNodeCount() const { return nodes.getSize(); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Filter Graph Connection Accessor Methods /// Connect as many outputs of the first filter to the inputs of the second filter as possible. /** * A 1-to-1 connection is made between the outputs of the first filter and * the inputs of the second filter. * * The method returns whether or not the connection was successfully made. * The connection can fail if the output filter doesn't have an output * or if the input filter doesn't have an input. * * Specifying NULL for the first filter connects the graph's global filter input * to the second filter's input. Likewise, a NULL second filter pointer connects * the first filter to the main graph output. Specifying NULL for both pointers * connects the graph's inputs to its outputs directly. */ Bool connect( SoundFilter* output, SoundFilter* input ); /// Connect the specified output of the first filter to the specified input of the second filter. /** * The method returns whether or not the connection was successfully made. * The connection can fail if the output filter doesn't have an output * or if the input filter doesn't have an input. * * Specifying NULL for the first filter connects the graph's global filter input * to the second filter's input. Likewise, a NULL second filter pointer connects * the first filter to the main graph output. Specifying NULL for both pointers * connects the graph's input to its output directly. */ Bool connect( SoundFilter* output, Index outputIndex, SoundFilter* input, Index inputIndex ); /// Disconnect the first output of the first filter from the first input of the second filter. Bool disconnect( const SoundFilter* output, const SoundFilter* input ); /// Disconnect the specified output of the first filter from the specified input of the second filter. /** * The method returns whether or not the connection was successfully disconnected. * The disconnection can fail if the output filter doesn't have an output, * if the input filter doesn't have an input, or if there was no such connection * before the method was called. * * Specifying NULL for the first filter disconnects the graph's global input * from the second filter's input. Likewise, a NULL second filter pointer disconnects * the first filter from the main graph output. Specifying NULL for both pointers * disconnects the graph's input from its output. */ Bool disconnect( const SoundFilter* output, Index outputIndex, const SoundFilter* input, Index inputIndex ); /// Return whether or not the specified output filter is directly connected to the input of another filter. /** * The method returns TRUE if any output of the first filter is directly connected * to the input of the second filter. */ Bool isConnected( const SoundFilter* output, const SoundFilter* input ) const; /// Return whether or not the specified output of one filter is directly connected to an input of another filter. Bool isConnected( const SoundFilter* output, Index outputIndex, const SoundFilter* input, Index inputIndex ) const; /// Clear all connections (and nodes/filters) from this filter graph. void clear(); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Filter Attribute Accessor Methods /// Return a human-readable name for this sound filter graph. /** * The method returns the string "Sound Filter Graph". */ virtual UTF8String getName() const; /// Return the manufacturer name of this sound filter graph. /** * The method returns the string "Headspace Sound". */ virtual UTF8String getManufacturer() const; /// Return an object representing the version of this sound filter graph. virtual SoundFilterVersion getVersion() const; /// Return an object which describes the category of effect that this filter implements. /** * This method returns the value SoundFilterCategory::ROUTING. */ virtual SoundFilterCategory getCategory() const; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Public Static Property Objects /// A string indicating the human-readable name of this sound filter graph. static const UTF8String NAME; /// A string indicating the manufacturer name of this sound filter graph. static const UTF8String MANUFACTURER; /// An object indicating the version of this sound filter graph. static const SoundFilterVersion VERSION; private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Class Declaration /// A class which represents a one-way connection to a filter's input. class NodeInputConnection; /// A class which represents a one-way connection to a filter's output. class NodeOutputConnection; /// A class which represents a single node in a graph of filters. class Node; /// A class which holds information about a reference-counted shared sound buffer. class BufferInfo; /// A class which holds information about a reference-counted shared filter frame. class FilterFrameInfo; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Stream Reset Method /// A method which is called whenever the filter's stream of audio is being reset. /** * This method allows the filter to reset all parameter interpolation * and processing to its initial state to avoid coloration from previous * audio or parameter values. */ virtual void resetStream(); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Filter Processing Methods /// Take the input sample data and perform filter graph processing on it, placing the result in the output frame. virtual SoundFilterResult processFrame( const SoundFilterFrame& inputFrame, SoundFilterFrame& outputFrame, Size numSamples ); /// Process the specified main I/O node (NULL node) and place the result in the specified output frame. SoundFilterResult processMainNode( Node* node, SoundFilterFrame* outputFrame, Size numSamples ); /// Process the specified node and place the result in the specified output frame. SoundFilterResult processNode( Node* node, SoundFilterFrame* outputFrame, Size numSamples ); /// Build an output frame for the specified node/number of samples and compute the output, storing it in the node. RIM_INLINE void computeNodeOutput( Node* node, Size numSamples ); /// Get another temporary frame from the pool and return a pointer to the frame. RIM_INLINE SoundFilterFrame* getTempFrame( Size numBuffers ); /// Release the specified temporary filter frame back to the pool. RIM_INLINE void releaseTempFrame( SoundFilterFrame* frame ); /// Get another temporary buffer from the global pool, save the handle, and return a pointer to the buffer. RIM_INLINE SoundBuffer* getTempBuffer(); /// Release the specified temporary sound buffer back to the pool. RIM_INLINE void releaseTempBuffer( const SoundBuffer* buffer ); /// Return whether or not the specified node has at most one output that uses the same output index. RIM_INLINE static Bool outputIsUnique( Node* node, Index outputConnectionIndex ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Members /// A map from filter pointers to filter nodes representing this filter graph. HashMap<const SoundFilter*,Node> nodes; /// A list of the current set of shared temporary sound buffers in use by this filter graph. ArrayList<BufferInfo> tempBuffers; /// A persistent (to avoid buffer array reallocations) list of filter frames for intermediate sound data. ArrayList<FilterFrameInfo*> tempFrames; /// The total number of temporary buffers that are currently in use. Size numBuffersInUse; /// The total number of temporary frames that are currently in use. Size numFramesInUse; }; //########################################################################################## //************************ End Rim Sound Filters Namespace ******************************* RIM_SOUND_FILTERS_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_SOUND_FILTER_GRAPH_H <file_sep>/* * rimObjectInterface.h * Rim Software * * Created by <NAME> on 10/28/14. * Copyright 2014 __MyCompanyName__. All rights reserved. * */ #ifndef INCLUDE_RIM_BVH_OBJECT_INTERFACE_H #define INCLUDE_RIM_BVH_OBJECT_INTERFACE_H #include "rimBVHConfig.h" #include "rimBoundingSphere.h" //########################################################################################## //***************************** Start Rim BVH Namespace ********************************** RIM_BVH_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// An interface to an opaque collection of generic geometric objects. /** * This class allows a scene BVH to have access to the objects in the scene * on demand each time the scene BVH is rebuilt. */ class ObjectInterface { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Destructor /// Destroy this object interface. virtual ~ObjectInterface() { } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Attribute Accessor Methods /// Return the number of objects contained in this object interface. virtual Size getSize() const = 0; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Bounding Volume Accessor Methods /// Return an axis-aligned bounding box for the object with the specified index. virtual AABB3f getAABB( Index objectIndex ) const = 0; /// Return a bounding sphere for the object with the specified index. virtual BoundingSphere<Float> getBoundingSphere( Index objectIndex ) const = 0; /// Return a pointer to the object BVH at the specified index. virtual Pointer<BVH> getBVH( Index objectIndex ) const = 0; /// Return the object transformation at the specified index. virtual Transform3f getTransform( Index objectIndex ) const = 0; }; //########################################################################################## //***************************** End Rim BVH Namespace ************************************ RIM_BVH_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_BVH_OBJECT_INTERFACE_H <file_sep>/* * rimGraphicsBase.h * Rim Graphics * * Created by <NAME> on 5/16/12. * Copyright 2012 __MyCompanyName__. All rights reserved. * */ #ifndef INCLUDE_RIM_GRAPHICS_BASE_H #define INCLUDE_RIM_GRAPHICS_BASE_H #include "rimGraphicsConfig.h" #include "rimGraphicsUtilities.h" #include "rimGraphicsShaders.h" #include "rimGraphicsTextures.h" #include "rimGraphicsMaterials.h" #include "rimGraphicsBuffers.h" #include "rimGraphicsCameras.h" //########################################################################################## //************************** Start Rim Graphics Namespace ******************************** RIM_GRAPHICS_NAMESPACE_START //****************************************************************************************** //########################################################################################## using namespace rim::graphics::util; using namespace rim::graphics::shaders; using namespace rim::graphics::textures; using namespace rim::graphics::materials; using namespace rim::graphics::buffers; using namespace rim::graphics::cameras; //########################################################################################## //************************** End Rim Graphics Namespace ********************************** RIM_GRAPHICS_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_GRAPHICS_BASE_H <file_sep>/* * rimPhysicsCollisionShapeBase.h * Rim Physics * * Created by <NAME> on 11/28/09. * Copyright 2009 Rim Software. All rights reserved. * */ #ifndef INCLUDE_RIM_PHYSICS_COLLISION_SHAPE_BASE_H #define INCLUDE_RIM_PHYSICS_COLLISION_SHAPE_BASE_H #include "rimPhysicsShapesConfig.h" #include "rimPhysicsCollisionShape.h" //########################################################################################## //************************ Start Rim Physics Shapes Namespace **************************** RIM_PHYSICS_SHAPES_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class from which all collision shape subclasses should derive that simplifies shape typing. /** * This class simplifies CollisionShape subclassing by automatically providing * CollisionShapeType information to the CollisionShape based on the * SubType template parameter. */ template < typename SubType > class CollisionShapeBase : public CollisionShape { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructors /// Create a base collision shape. RIM_FORCE_INLINE CollisionShapeBase() : CollisionShape( &type ) { } /// Create a base collision shape with the specified material. RIM_FORCE_INLINE CollisionShapeBase( const CollisionShapeMaterial& newMaterial ) : CollisionShape( &type, newMaterial ) { } private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Members /// A CollisionShapeType object representing the type of this base collision shape. /** * The type object is created directly from the SubType template parameter. */ static const CollisionShapeType type; }; template < typename SubType > const CollisionShapeType CollisionShapeBase<SubType>:: type = CollisionShapeType::of<SubType>(); //########################################################################################## //************************ End Rim Physics Shapes Namespace ****************************** RIM_PHYSICS_SHAPES_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_PHYSICS_COLLISION_SHAPE_BASE_H <file_sep>/* * rimVectorND.h * Rim Math * * Created by <NAME> on 10/16/07. * Copyright 2007 Rim Software. All rights reserved. * */ #ifndef INCLUDE_RIM_VECTOR_ND_H #define INCLUDE_RIM_VECTOR_ND_H #include "rimMathConfig.h" #include "../data/rimBasicString.h" #include "../data/rimBasicStringBuffer.h" //########################################################################################## //***************************** Start Rim Math Namespace ********************************* RIM_MATH_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class which represents a vector of a fixed arbitrary number of components. template < typename T, Size dimension > class VectorND { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructors /// Create a vector with all of its elements equal to zero RIM_FORCE_INLINE VectorND() { for ( Index i = 0; i < dimension; i++ ) x[i] = T(0); } /// Create a vector with elements from the specified array. /** * The array must be of length greater than or equal to the * dimension of the vector. */ RIM_FORCE_INLINE VectorND( const T* array ) { for ( Index i = 0; i < dimension; i++ ) x[i] = array[i]; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** VectorND Operations /// Get the magnitude of the vector. RIM_FORCE_INLINE T getMagnitude() const { return math::sqrt( getMagnitudeSquared() ); } /// Get the squared magnitude of the vector. RIM_FORCE_INLINE T getMagnitudeSquared() const { T sum = T(0); for ( unsigned int i = 0; i < dimension; i++ ) sum += x[i]*x[i]; return sum; } /// Return a a normalized version of this vector. RIM_FORCE_INLINE VectorND normalize() const { T mag = getMagnitude(); if ( mag == T(0) ) return VectorND::ZERO; T invMag = T(1)/mag; VectorND result; for ( Index i = 0; i < dimension; i++ ) result.x[i] = x[i]*invMag; return result; } /// Project this vector onto another vector RIM_FORCE_INLINE VectorND projectOn( const VectorND& v ) const { // compute this dot v: T result = T(0); for ( Index i = 0; i < dimension; i++ ) result += x[i]*v.x[i]; return result * v.normalize(); } /// Get the distance between the this vector and another. RIM_FORCE_INLINE T getDistanceTo( const VectorND& v ) const { return math::sqrt( distanceToSquared(v) ); } /// Get the squared distance between the this vector and another. RIM_FORCE_INLINE T getDistanceToSquared( const VectorND& v ) const { return ((*this) - v).getMagnitudeSquared(); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Accessor Methods /// Return an array representation of this vector. RIM_FORCE_INLINE const T* toArray() const { return x; } /// Return a reference to the element at the specified index in the vector. RIM_FORCE_INLINE T& get( Index i ) { RIM_DEBUG_ASSERT( i < dimension ); return x[i]; } /// Return a const reference to the element at the specified index in the vector. RIM_FORCE_INLINE const T& get( Index i ) const { RIM_DEBUG_ASSERT( i < dimension ); return x[i]; } /// Return a reference to the element at the specified index in the vector. RIM_FORCE_INLINE T& operator () ( Index i ) { RIM_DEBUG_ASSERT( i < dimension ); return x[i]; } /// Return const a reference to the element at the specified index in the vector. RIM_FORCE_INLINE const T& operator () ( Index i ) const { RIM_DEBUG_ASSERT( i < dimension ); return x[i]; } /// Return a reference to the element at the specified index in the vector. RIM_FORCE_INLINE T& operator [] ( Index i ) { RIM_DEBUG_ASSERT( i < dimension ); return x[i]; } /// Return a const reference to the element at the specified index in the vector. RIM_FORCE_INLINE const T& operator [] ( Index i ) const { RIM_DEBUG_ASSERT( i < dimension ); return x[i]; } /// Return the dimension of this vector (number of components it has). RIM_FORCE_INLINE Size getSize() const { return dimension; } /// Return the dimension of this vector (number of components it has). RIM_FORCE_INLINE Size getDimension() const { return dimension; } /// Set the element at the specified index in the vector. RIM_FORCE_INLINE void set( Index i, T newX ) { RIM_DEBUG_ASSERT( i < dimension ); x[i] = newX; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Negation/Positivation Operators /// Negate every component of this vector and return the result. RIM_FORCE_INLINE VectorND operator - () const { VectorND result; for ( Index i = 0; i < dimension; i++ ) result.x[i] = -x[i]; return result; } /// 'Positivate' every component of this vector, effectively returning a copy. RIM_FORCE_INLINE VectorND operator + () const { return *this; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Arithmetic Operators /// Add a vector to this vector and return the resulting vector. RIM_FORCE_INLINE VectorND operator + ( const VectorND& vector ) const { VectorND result; for ( Index i = 0; i < dimension; i++ ) result.x[i] = x[i] + vector.x[i]; return result; } /// Add a scalar value to each component of this vector and return the resulting vector. RIM_FORCE_INLINE VectorND operator + ( T value ) const { VectorND result; for ( Index i = 0; i < dimension; i++ ) result.x[i] = x[i] + value; return result; } /// Subtract a vector from this vector and return the resulting vector. RIM_FORCE_INLINE VectorND operator - ( const VectorND& vector ) const { VectorND result; for ( Index i = 0; i < dimension; i++ ) result.x[i] = x[i] - vector.x[i]; return result; } /// Subtract a scalar value from each component of this vector and return the resulting vector. RIM_FORCE_INLINE VectorND operator - ( T value ) const { VectorND result; for ( Index i = 0; i < dimension; i++ ) result.x[i] = x[i] - value; return result; } /// Return the result of a component-wise vector multiplication with this vector. RIM_FORCE_INLINE VectorND operator * ( const VectorND& vector ) const { VectorND result; for ( Index i = 0; i < dimension; i++ ) result.x[i] = x[i]*vector.x[i]; return result; } /// Multiply a scalar value by each component of this vector and return the resulting vector. RIM_FORCE_INLINE VectorND operator * ( T value ) const { VectorND result; for ( Index i = 0; i < dimension; i++ ) result.x[i] = x[i]*value; return result; } /// Divide each component of this vector by a scalar value and return the resulting vector. RIM_FORCE_INLINE VectorND operator / ( T value ) const { VectorND result; for ( Index i = 0; i < dimension; i++ ) result.x[i] = x[i]/value; return result; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Arithmetic Assignment Operators RIM_FORCE_INLINE VectorND& operator += ( const VectorND& v2 ) { for ( Index i = 0; i < dimension; i++ ) x[i] += v2.x[i]; return *this; } RIM_FORCE_INLINE VectorND& operator -= ( const VectorND& v2 ) { for ( Index i = 0; i < dimension; i++ ) x[i] -= v2.x[i]; return *this; } RIM_FORCE_INLINE VectorND& operator += ( const T value ) { for ( Index i = 0; i < dimension; i++ ) x[i] += value; return *this; } RIM_FORCE_INLINE VectorND& operator -= ( const T value ) { for ( Index i = 0; i < dimension; i++ ) x[i] -= value; return *this; } RIM_FORCE_INLINE VectorND& operator *= ( const T value ) { for ( Index i = 0; i < dimension; i++ ) x[i] *= value; return *this; } RIM_FORCE_INLINE VectorND& operator /= ( const T value ) { for ( Index i = 0; i < dimension; i++ ) x[i] /= value; return *this; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** String Conversion Methods /// Convert this vector into a human-readable string representation. RIM_NO_INLINE data::String toString() const { data::StringBuffer buffer; buffer << "< "; for ( Index i = 0; i < dimension; i++ ) { if ( i != dimension - 1 ) buffer << x[i] << ", "; else buffer << x[i]; } buffer << " >"; return buffer.toString(); } /// Convert this vector into a human-readable string representation. RIM_FORCE_INLINE operator data::String () const { return this->toString(); } private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Members /// The components of this vector. T x[dimension]; public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Public Static Data Members /// A constant vector with every component equal to zero. static const VectorND ZERO; }; template < typename T, Size dimension > const VectorND<T,dimension> VectorND<T,dimension>:: ZERO; //########################################################################################## //########################################################################################## //############ //############ Reverse Arithmetic Operators //############ //########################################################################################## //########################################################################################## /// Multiply every component of a vector by a scalar value and return the resulting vector. template < typename T, Size dimension > RIM_FORCE_INLINE VectorND<T,dimension> operator * ( const T& c, const VectorND<T,dimension>& vector ) { VectorND<T,dimension> result; for ( Index i = 0; i < dimension; i++ ) result.set( i, vector.get(i) * c ); return result; } /// Multiply every component of a vector by a scalar value and return the resulting vector. template < typename T, Size dimension > RIM_FORCE_INLINE VectorND<T,dimension> operator + ( const T& c, const VectorND<T,dimension>& vector ) { VectorND<T,dimension> result; for ( Index i = 0; i < dimension; i++ ) result.set( i, vector.get(i) + c ); return result; } //########################################################################################## //########################################################################################## //############ //############ Standalone Functions //############ //########################################################################################## //########################################################################################## /// Return the dot product of two vectors. template < typename T, Size dimension > RIM_FORCE_INLINE T dot( const VectorND<T,dimension>& v1, const VectorND<T,dimension>& v2 ) { T result(0); for ( Index i = 0; i < dimension; i++ ) result += v1[i]*v2[i]; return result; } /// Return the cross product of two 3-dimensional vectors. template <typename T> RIM_FORCE_INLINE VectorND<T,3> cross( const VectorND<T,3>& v1, const VectorND<T,3>& v2 ) { VectorND<T,3> result; result[0] = v1[1]*v2[2] - v1[2]*v2[1]; result[1] = v1[2]*v2[0] - v1[0]*v2[2]; result[2] = v1[0]*v2[1] - v1[1]*v2[0]; return result; } /// Return the midpoint of two vectors. template < typename T, Size dimension > RIM_FORCE_INLINE VectorND<T,dimension> midpoint( const VectorND<T,dimension>& v1, const VectorND<T,dimension>& v2 ) { VectorND<T,dimension> result; for ( Index i = 0; i < dimension; i++ ) result[i] = (v1[i] + v2[i])*T(0.5); return result; } //########################################################################################## //***************************** End Rim Math Namespace *********************************** RIM_MATH_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_VECTOR_ND_H <file_sep>/* * rimGraphicsGUITextureImage.h * Rim Graphics GUI * * Created by <NAME> on 3/21/13. * Copyright 2013 Headspace Systems. All rights reserved. * */ #ifndef INCLUDE_RIM_GRAPHICS_GUI_TEXTURE_IMAGE_H #define INCLUDE_RIM_GRAPHICS_GUI_TEXTURE_IMAGE_H #include "rimGraphicsGUIUtilitiesConfig.h" #include "rimGraphicsGUIImage.h" //########################################################################################## //******************* Start Rim Graphics GUI Utilities Namespace ************************* RIM_GRAPHICS_GUI_UTILITIES_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class which represents a rectangular region of a texture and its associated display size. /** * A texture image provides a way to specify a region within a texture where * a 2D image is located, as well as the final size with which it should be * displayed. Since a Texture is defined to be stored on the graphics hardware, * rendering a TextureImage is faster than a normal Image stored in CPU memory. */ class TextureImage : GUIImage { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructors /// Create a new texture image which has no source texture and 0 size. TextureImage(); /// Create a new texture image which uses the specified source texture. /** * The display size for the image is set to be the same size as the * image and the UV texture coordinate bounds are set to use the entire * area of the texture. If the specified texture is NULL, the new texture image * has 0 size and is not valid. */ TextureImage( const Resource<Texture>& newTexture ); /// Create a new texture image which uses the specified source texture and has the given UV bounds. /** * The display size for the image is calculated based on the number of texels * encompassed by the given UV coordinate bounds. * If the specified texture is NULL, the new texture image * has 0 size and is not valid. */ TextureImage( const Resource<Texture>& newTexture, const AABB2f& newUVBounds ); /// Create a new image which uses the specified source texture and has the given UV bounds and display size. /** * If the specified texture is NULL, the new texture image is not valid. */ TextureImage( const Resource<Texture>& newTexture, const AABB2f& newUVBounds, const Vector2f& newSize ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Texture Accessor Methods /// Return a pointer to the texture which this texture image uses as its image source. RIM_INLINE const Resource<Texture>& getTexture() const { return texture; } /// Set a pointer to the texture which this texture image uses as its image source. /** * If the specified texture is NULL, the new texture image is not valid. */ RIM_INLINE void setTexture( const Resource<Texture>& newTexture ) { texture = newTexture; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** UV Bounding Box Accessor Methods /// Return a 2D bounding box within the texture's UV coordinates (0 to 1) where the image is located. RIM_INLINE const AABB2f& getUVBounds() const { return uvBounds; } /// Set the 2D bounding box within the texture's UV coordinates (0 to 1) where the image is located. RIM_INLINE void setUVBounds( const AABB2f& newUVBounds ) { uvBounds = newUVBounds; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Image Validity Accessor Methods /// Return whether or not this texture image is valid and can be used for rendering. virtual Bool isValid() const { return !texture.isNull(); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Image Drawing Method /// Draw this image using the specified renderer to the given bounding box on the screen. virtual Bool drawSelf( GUIRenderer& renderer, const AABB2f& pixelBounds, const Color4f& color = Color4f::WHITE ) const; private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Public Data Members /// A pointer to the texture which contains the data for this texture image. Resource<Texture> texture; /// A 2D bounding box within the texture's UV coordinates (0 to 1) where the image is located. AABB2f uvBounds; }; //########################################################################################## //******************* End Rim Graphics GUI Utilities Namespace *************************** RIM_GRAPHICS_GUI_UTILITIES_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_GRAPHICS_GUI_TEXTURE_IMAGE_H <file_sep>/* * rimSoundDelay.h * Rim Sound * * Created by <NAME> on 7/27/12. * Copyright 2012 __MyCompanyName__. All rights reserved. * */ #ifndef INCLUDE_RIM_SOUND_DELAY_H #define INCLUDE_RIM_SOUND_DELAY_H #include "rimSoundFiltersConfig.h" #include "rimSoundFilter.h" #include "rimSoundCutoffFilter.h" //########################################################################################## //************************ Start Rim Sound Filters Namespace ***************************** RIM_SOUND_FILTERS_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class that mixes input sound with a delayed version of itself. /** * This class represents a generic delay-style effect. It can be switched between * comb filtering and all-pass delay. */ class Delay : public SoundFilter { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Delay Type Enum Declaration /// An enum type which describes the various types of delay effects that a Delay can produce. typedef enum DelayType { /// The delay filter behaves as a comb filter (the same as a standard delay effect). COMB = 0, /// The delay filter behaves as an all-pass filter. ALL_PASS = 1 }; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructors /// Create a comb delay filter with 500ms delay time, 0 delay feedback, 0dB delay gain, and 0dB dry gain. Delay(); /// Create a delay filter with the specified type and delay parameters. /** * This constructor creates a filter with the specified delay time, delay * feedback gain, delay output gain, and input-to-output gain. */ Delay( DelayType newType, Float newDelayTime, Gain newFeedbackGain, Gain newDelayGain, Gain newDryGain ); /// Create an exact copy of the specified delay filter. Delay( const Delay& other ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Destructor /// Destroy this delay filter, releasing all internal resources. ~Delay(); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Assignment Operator /// Assign the state of another delay filter to this one. Delay& operator = ( const Delay& other ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Delay Effect Type Accessor Methods /// Return the kind of delay effect that this delay filter is producing. RIM_INLINE DelayType getType() const { return type; } /// Set the kind of delay effect that this delay filter is producing. RIM_INLINE void setType( DelayType newType ) { lockMutex(); type = newType; unlockMutex(); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Delay Time Accessor Methods /// Return the delay time for this delay filter in seconds. RIM_INLINE Float getDelayTime() const { return targetDelayTime; } /// Set the delay time for this delay filter in seconds. RIM_INLINE void setDelayTime( Float newDelayTime ) { lockMutex(); targetDelayTime = math::max( newDelayTime, Float(0) ); unlockMutex(); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Decay Time Accessor Methods /// Return the time it takes for the output of this delay filter to decay to -60dB. /** * This method computes the decay time of the delay filter using the current values * for the feedback gain and delay time of the delay filter. */ RIM_INLINE Float getDecayTime() const { return targetDelayTime*math::log( Float(0.001), targetFeedbackGain ); } /// Set the time it takes for the output of this delay filter to decay to -60dB. /** * This method uses the current delay filter delay time to compute the feedback * gain necessary to produce the desired decay time. */ RIM_INLINE void setDecayTime( Float newDecayTime ) { lockMutex(); Float desiredGain = math::pow( Float(0.001), targetDelayTime / math::max( newDecayTime, math::epsilon<Float>() ) ); targetFeedbackGain = math::clamp( desiredGain, Float(-0.999), Float(0.999) ); unlockMutex(); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Feedback Gain Accessor Methods /// Return the feedback gain of this delay filter. /** * This value represents how much of each output delay sample is sent * back to the delay buffer during each pass over the delay buffer. * This value should be between -0.99999 and 0.99999 in order to ensure * filter stability. */ RIM_INLINE Gain getFeedbackGain() const { return targetFeedbackGain; } /// Return the feedback gain of this delay filter in decibels. /** * This value represents the gain applied to the output delay sample which is sent * back to the delay buffer during each pass over the delay buffer. * This value should be between -infinity and -0.00001 in order to ensure * filter stability. */ RIM_INLINE Gain getFeedbackGainDB() const { return util::linearToDB( targetFeedbackGain ); } /// Set the feedback gain of this delay filter. /** * This value represents how much of each output delay sample is sent * back to the delay buffer during each pass over the delay buffer. * This value is clamped to be between -0.99999 and 0.99999 in order to ensure * filter stability. */ RIM_INLINE void setFeedbackGain( Gain newFeedbackGain ) { lockMutex(); targetFeedbackGain = math::clamp( newFeedbackGain, Gain(-0.9999), Gain(0.9999) ); unlockMutex(); } /// Set the feedback gain of this delay filter in decibels. /** * This value represents the gain applied to the output delay sample which is sent * back to the delay buffer during each pass over the delay buffer. * This value should be between -infinity and -0.00001 in order to ensure * filter stability. */ RIM_INLINE void setFeedbackGainDB( Gain newFeedbackGain ) { this->setFeedbackGain( util::dbToLinear( newFeedbackGain ) ); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Delay Gain Accessor Methods /// Return the linear delay gain of this delay filter. /** * This value represents the gain applied to the delayed * signal before it is mixed with input signal. */ RIM_INLINE Gain getDelayGain() const { return targetDelayGain; } /// Return the delay gain of this delay filter in decibels. /** * This value represents the gain applied to the delayed * signal before it is mixed with input signal. */ RIM_INLINE Gain getDelayGainDB() const { return util::linearToDB( targetDelayGain ); } /// Set the linear delay gain of this delay filter. /** * This value represents the gain applied to the delayed * signal before it is mixed with input signal. */ RIM_INLINE void setDelayGain( Gain newDelayGain ) { lockMutex(); targetDelayGain = newDelayGain; unlockMutex(); } /// Set the delay gain of this delay filter in decibels. /** * This value represents the gain applied to the delayed * signal before it is mixed with input signal. */ RIM_INLINE void setDelayGainDB( Gain newDelayGain ) { lockMutex(); targetDelayGain = util::dbToLinear( newDelayGain ); unlockMutex(); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Input Gain Accessor Methods /// Return the linear dry gain of this delay filter. /** * This value represents the gain applied to the input * signal before it is mixed with delayed signal. */ RIM_INLINE Gain getDryGain() const { return targetDryGain; } /// Return the dry gain of this delay filter in decibels. /** * This value represents the gain applied to the input * signal before it is mixed with delayed signal. */ RIM_INLINE Gain getDryGainDB() const { return util::linearToDB( targetDryGain ); } /// Set the linear dry gain of this delay filter. /** * This value represents the gain applied to the input * signal before it is mixed with delayed signal. */ RIM_INLINE void setDryGain( Gain newDryGain ) { lockMutex(); targetDryGain = newDryGain; unlockMutex(); } /// Set the dry gain of this delay filter in decibels. /** * This value represents the gain applied to the input * signal before it is mixed with delayed signal. */ RIM_INLINE void setDryGainDB( Gain newDryGain ) { lockMutex(); targetDryGain = util::dbToLinear( newDryGain ); unlockMutex(); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Delay Frozen Accessor Methods /// Return whether or not the delay buffer's contents for this delay filter are frozen. /** * If TRUE, this means that writes to the delay buffer disabled, so it will repeat the * same delay buffer over and over. */ RIM_INLINE Bool getDelayIsFrozen() const { return delayFrozen; } /// Set whether or not the delay buffer's contents for this delay filter are frozen. /** * If TRUE, this means that writes to the delay buffer disabled, so it will repeat the * same delay buffer over and over. */ RIM_INLINE void setDelayIsFrozen( Bool newDelayIsFrozen ) { lockMutex(); delayFrozen = newDelayIsFrozen; unlockMutex(); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** High Pass Filter Attribute Accessor Methods /// Return whether or not this delay filter's high pass filter is enabled. RIM_INLINE Bool getHighPassIsEnabled() const { return highPassEnabled; } /// Set whether or not this delay filter's high pass filter is enabled. RIM_INLINE void setHighPassIsEnabled( Bool newHighPassIsEnabled ) { lockMutex(); highPassEnabled = newHighPassIsEnabled; unlockMutex(); } /// Return the high pass filter frequency of this delay filter. RIM_INLINE Float getHighPassFrequency() const { return highPassFrequency; } /// Set the high pass filter frequency of this delay filter. /** * The new high pass frequency is clamped to the range [0,infinity]. */ RIM_INLINE void setHighPassFrequency( Float newHighPassFrequency ) { lockMutex(); highPassFrequency = math::max( newHighPassFrequency, Float(0) ); unlockMutex(); } /// Return the high pass filter order of this delay filter. RIM_INLINE Size getHighPassOrder() const { return highPassOrder; } /// Set the high pass filter order of this delay filter. /** * The new high pass order is clamped to the range [1,100]. */ RIM_INLINE void setHighPassOrder( Size newHighPassOrder ) { lockMutex(); highPassOrder = math::clamp( newHighPassOrder, Size(1), Size(100) ); unlockMutex(); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Low Pass Filter Attribute Accessor Methods /// Return whether or not this delay filter's low pass filter is enabled. RIM_INLINE Bool getLowPassIsEnabled() const { return lowPassEnabled; } /// Set whether or not this delay filter's low pass filter is enabled. RIM_INLINE void setLowPassIsEnabled( Bool newLowPassIsEnabled ) { lockMutex(); lowPassEnabled = newLowPassIsEnabled; unlockMutex(); } /// Return the low pass filter frequency of this delay filter. RIM_INLINE Float getLowPassFrequency() const { return lowPassFrequency; } /// Set the low pass filter frequency of this delay filter. /** * The new low pass frequency is clamped to the range [0,infinity]. */ RIM_INLINE void setLowPassFrequency( Float newLowPassFrequency ) { lockMutex(); lowPassFrequency = math::max( newLowPassFrequency, Float(0) ); unlockMutex(); } /// Return the low pass filter order of this delay filter. RIM_INLINE Size getLowPassOrder() const { return lowPassOrder; } /// Set the low pass filter order of this delay filter. /** * The new low pass order is clamped to the range [1,100]. */ RIM_INLINE void setLowPassOrder( Size newLowPassOrder ) { lockMutex(); lowPassOrder = math::clamp( newLowPassOrder, Size(1), Size(100) ); unlockMutex(); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Filter Attribute Accessor Methods /// Return a human-readable name for this delay filter. /** * The method returns the string "Delay". */ virtual UTF8String getName() const; /// Return the manufacturer name of this delay filter. /** * The method returns the string "Headspace Sound". */ virtual UTF8String getManufacturer() const; /// Return an object representing the version of this delay filter. virtual SoundFilterVersion getVersion() const; /// Return an object which describes the category of effect that this filter implements. /** * This method returns the value SoundFilterCategory::DELAY. */ virtual SoundFilterCategory getCategory() const; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Filter Parameter Accessor Methods /// Return the total number of generic accessible parameters this delay filter has. virtual Size getParameterCount() const; /// Get information about the delay filter parameter at the specified index. virtual Bool getParameterInfo( Index parameterIndex, FilterParameterInfo& info ) const; /// Get any special name associated with the specified value of an indexed parameter. virtual Bool getParameterValueName( Index parameterIndex, const FilterParameter& value, UTF8String& name ) const; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Public Static Property Objects /// A string indicating the human-readable name of this delay filter. static const UTF8String NAME; /// A string indicating the manufacturer name of this delay filter. static const UTF8String MANUFACTURER; /// An object indicating the version of this delay filter. static const SoundFilterVersion VERSION; private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Filter Parameter Value Accessor Methods /// Place the value of the parameter at the specified index in the output parameter. virtual Bool getParameterValue( Index parameterIndex, FilterParameter& value ) const; /// Attempt to set the parameter value at the specified index. virtual Bool setParameterValue( Index parameterIndex, const FilterParameter& value ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Stream Reset Method /// A method which is called whenever the filter's stream of audio is being reset. /** * This method allows the filter to reset all parameter interpolation * and processing to its initial state to avoid coloration from previous * audio or parameter values. */ virtual void resetStream(); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Filter Processing Methods /// Apply this delay filter to the specified input frame samples and place them in the output frame. virtual SoundFilterResult processFrame( const SoundFilterFrame& inputFrame, SoundFilterFrame& outputFrame, Size numSamples ); /// Apply an all-pass delay filter to the given buffers when some parameter has changed. template < DelayType delayType, Bool frozen > RIM_FORCE_INLINE static void processDelayChanges( const SoundBuffer& inputBuffer, SoundBuffer& outputBuffer, Size numSamples, SoundBuffer& delayBuffer, Size delayBufferSize, Index currentDelayWriteIndex, Gain& feedbackGain, Gain feedbackGainChangePerSample, Gain& delayGain, Gain delayGainChangePerSample ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Members /// A buffer which holds the delayed input samples which are used to create delay filtering. SoundBuffer delayBuffer; /// An enum representing the type of delay effect that this delay filter produces. DelayType type; /// The total number of samples in the delay buffer that are valid delay samples. /** * This value is stored separately from the delay buffer so that the buffer can * have a size that is greater than or equal to the actual number of delay samples. */ Size delayBufferSize; /// The current write position within the delay buffer in samples. Index currentDelayWriteIndex; /// The time in seconds of the delay of this delay filter. Float delayTime; /// The target delay time for this delay filter. /** * This is the desired delay time which was set by the user. * Since instant parameter changes can be audible, this value allows the filter * to slowly approach the target delay time if it changes. */ Float targetDelayTime; /// The feedback gain of the delay filter - how much of each output delay sample is sent back to the delay buffer. Gain feedbackGain; /// The target feedback gain for this delay filter. /** * This is the desired value for the feedback gain which was set by the user. * Since instant parameter changes can be audible, this value allows the filter * to slowly approach the target feedback gain if it changes. */ Gain targetFeedbackGain; /// The gain applied to the delayed signal before it is mixed with input signal. Gain delayGain; /// The target delay gain for this delay filter. /** * This is the desired value for the delay gain which was set by the user. * Since instant parameter changes can be audible, this value allows the filter * to slowly approach the target delay gain if it changes. */ Gain targetDelayGain; /// The gain applied to the input signal before it is mixed with the delayed signal. Gain dryGain; /// The target dry gain for this delay filter. /** * This is the desired value for the dry gain which was set by the user. * Since instant parameter changes can be audible, this value allows the filter * to slowly approach the target dry gain if it changes. */ Gain targetDryGain; /// A high-pass filter used to filter the wet signal of the delay. CutoffFilter* highPass; /// The frequency at which the high pass filter for the delay is at -3dB. Float highPassFrequency; /// The order of the delay's high pass filter that determines its slope. Size highPassOrder; /// A low-pass filter used to filter the wet signal of the delay. CutoffFilter* lowPass; /// The frequency at which the low pass filter for the delay is at -3dB. Float lowPassFrequency; /// The order of the delay's low pass filter that determines its slope. Size lowPassOrder; /// A boolean value indicating whether or not this delay's low-pass filter is enabled. Bool lowPassEnabled; /// A boolean value indicating whether or not this delay's high-pass filter is enabled. Bool highPassEnabled; /// A boolean value indicating whether or not this delay's buffer is frozen. Bool delayFrozen; }; //########################################################################################## //************************ End Rim Sound Filters Namespace ******************************* RIM_SOUND_FILTERS_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_SOUND_DELAY_H <file_sep>/* * rimGraphicsVertexVariable.h * Rim Graphics * * Created by <NAME> on 9/12/10. * Copyright 2010 Rim Software. All rights reserved. * */ #ifndef INCLUDE_RIM_GRAPHICS_VERTEX_VARIABLE_H #define INCLUDE_RIM_GRAPHICS_VERTEX_VARIABLE_H #include "rimGraphicsShadersConfig.h" //########################################################################################## //*********************** Start Rim Graphics Shaders Namespace *************************** RIM_GRAPHICS_SHADERS_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class which provides a desciption of a per-vertex shader input variable. /** * A VertexVariable object contains a description of a per-vertex input * variable from a shader's source code. These are variables that are * specified for each vertex. The description consists of the variable's * name, the type of the variable, and an integral location for the * variable within the shader. */ class VertexVariable { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructor /// Create a vertex variable with the specified name, type, and identifier. RIM_INLINE VertexVariable( const String& newName, const AttributeType& newType, ShaderVariableLocation newLocation, Size newArraySize = Size(1) ) : name( newName ), type( newType ), location( newLocation ), arraySize( (UByte)newArraySize ) { } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Attribute Accessor Methods /// Return the name of the vertex variable in the shader source code. RIM_INLINE const String& getName() const { return name; } /// Return the type of the vertex variable. RIM_INLINE const AttributeType& getType() const { return type; } /// Return the implementation-defined location for the vertex variable within the shader. RIM_INLINE ShaderVariableLocation getLocation() const { return location; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Array Accessor Methods /// Return the number of elements that are in the array starting at this variable. /** * For shader variables that are declared as arrays, this function will return the * size of the static variable array. For shader variables that are not arrays, this * function returns 1. */ RIM_INLINE Size getArraySize() const { return arraySize; } /// Return whether or not this shader variable denotes the start of its array. RIM_INLINE Bool isArray() const { return arraySize > 1; } private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Members /// The name of the vertex variable in a shader's source code. String name; /// The type of the vertex variable. AttributeType type; /// The size of the array starting at this constant variable. /** * This valid is equal to 1 for variables that are not arrays and will be * the size of the array for array variables. */ UByte arraySize; /// The implementation-defined location for the vertex variable within the shader. ShaderVariableLocation location; }; //########################################################################################## //*********************** End Rim Graphics Shaders Namespace ***************************** RIM_GRAPHICS_SHADERS_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_GRAPHICS_VERTEX_ATTRIBUTE_VARIABLE_H <file_sep>/* * rimPhysicsCollisionManifold.h * Rim Physics * * Created by <NAME> on 5/8/08. * Copyright 2008 Rim Software. All rights reserved. * */ #ifndef INCLUDE_RIM_PHYSICS_COLLISION_MANIFOLD_H #define INCLUDE_RIM_PHYSICS_COLLISION_MANIFOLD_H #include "rimPhysicsCollisionConfig.h" #include "rimPhysicsCollisionPoint.h" //########################################################################################## //********************** Start Rim Physics Collision Namespace *************************** RIM_PHYSICS_COLLISION_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class which contains a collection of collision points. /** * These collision points represent the contact surface between to objects. */ class CollisionManifold { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructors /// Create a default empty collision manifold. RIM_INLINE CollisionManifold() { } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Collision Point Accessor Methods /// Add the specified CollisionPoint to this manifold. RIM_INLINE void addPoint( const CollisionPoint& newPoint ) { // Add the new point and immediately return when the manifold is empty. if ( points.getSize() == Real(0) ) { points.add( Point( newPoint, timestamp ) ); return; } else addPointToNonEmptyManifold( newPoint ); } /// Return a const reference to the collision point at the specified index. /** * If the point index is greater than or equal to the number of points * in the manifold, the result of this method is undefined. */ RIM_FORCE_INLINE const CollisionPoint& getPoint( Index pointIndex ) const { return points[pointIndex].point; } /// Remove the collision point at the specified index in the collision manifold. /** * If the point index is less than the number of points in this manifold, * the point at that index is removed and TRUE is returned. Otherwie, FALSE * is returned and the manifold is unchanged. */ RIM_FORCE_INLINE Bool removePoint( Index pointIndex ) { return points.removeAtIndex( pointIndex ); } /// Return the number of collision points that are contained in this collision manifold. RIM_FORCE_INLINE Size getPointCount() const { return points.getSize(); } /// Remove all collision points from this collision manifold. RIM_INLINE void clearPoints() { points.clear(); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Manifold Update Method /// Update the local-to-world transformations for the two colliding objects. /** * This method recomputes the world space positions and separation distance * for every collision point in this manifold from the object-space positions. * If there are any collision points that are no longer physically valid based * on the current object configuration (if their separation distance becomes * positive), they are removed from the manifold. */ void updateTransforms( const Transform3& t1, const Transform3& t2 ); private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Class Declaration /// A class which holds information about a collision point, plus its current timestamp. class Point { public: /// Create a new collision manifold point with the specified collision point and timetamp. RIM_INLINE Point( const CollisionPoint& newPoint, Index newTimestamp ) : point( newPoint ), timestamp( newTimestamp ) { } CollisionPoint point; /// The current timestamp Index timestamp; }; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Helper Methods /// Add a new collision point to this manifold, looking to see if there are any existing duplicate points. void addPointToNonEmptyManifold( const CollisionPoint& newPoint ); /// Remove the point from this collision manifold that is least important. /** * This method is called when a collision manifold has the maximum number of * points and needs to add a new point. */ void removeWorstPoint(); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Members /// Define the maximum number of collision points that a collision manifold can contain. static const Size MAX_NUM_COLLISION_POINTS = 4; /// A fixed-size array list of collision points in this collision manifold. StaticArrayList<Point,MAX_NUM_COLLISION_POINTS> points; /// The current timestamp within this collision manifold. /** * This is the frame index indicating how many times that the manifold * has been updated */ Index timestamp; }; //########################################################################################## //********************** End Rim Physics Collision Namespace ***************************** RIM_PHYSICS_COLLISION_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_PHYSICS_COLLISION_MANIFOLD_H <file_sep>/* * rimResourceManager.h * Rim Software * * Created by <NAME> on 2/26/14. * Copyright 2014 __MyCompanyName__. All rights reserved. * */ #ifndef INCLUDE_RIM_RESOURCE_MANAGER_H #define INCLUDE_RIM_RESOURCE_MANAGER_H #include "rimResourcesConfig.h" #include "rimResource.h" #include "rimResourceID.h" #include "rimResourceTranscoder.h" #include "rimResourcePool.h" //########################################################################################## //************************** Start Rim Resources Namespace ******************************* RIM_RESOURCES_NAMESPACE_START //****************************************************************************************** //########################################################################################## class ResourceManager { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructors /// Create a new empty resource manager with no formats it can manage. ResourceManager(); /// Create a new resource manager which is a copy of the other resource manager. ResourceManager( const ResourceManager& other ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Destructor /// Destroy this resource manager and release all associated resources. virtual ~ResourceManager(); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Assignment Operator /// Assign the state of another resource manager to this one. ResourceManager& operator = ( const ResourceManager& other ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Resource Accessor Methods /// Return a resource object for the specified resource identifier. template < typename DataType > RIM_INLINE Resource<DataType> getResource( const ResourceID& identifier ) { ResourceFormat format = identifier.getFormat(); // Infer the format type for undefined formats. if ( format == ResourceFormat::UNDEFINED ) format = inferFormat( identifier ); // See if there is a valid loader for this format. FormatManagerBase** formatManagerBase; if ( formats.find( format, format, formatManagerBase ) ) { FormatManager<DataType>* formatManager = *(FormatManager<DataType>**)formatManagerBase; return formatManager->getResource( ResourceID( identifier.getType(), format, identifier.getFilePath(), identifier.getName() ), this ); } else return Resource<DataType>( identifier ); } /// Get a resource for the resource identifier. template < typename DataType > RIM_INLINE Bool getResource( Resource<DataType>& resource ) { ResourceID* identifier = resource.getID(); if ( identifier == NULL ) return false; ResourceFormat format = identifier->getFormat(); // Infer the format type for undefined formats. if ( format == ResourceFormat::UNDEFINED ) format = inferFormat( *identifier ); identifier->setFormat( format ); // See if there is a valid loader for this format. FormatManagerBase** formatManagerBase; if ( formats.find( format, format, formatManagerBase ) ) { FormatManager<DataType>* formatManager = *(FormatManager<DataType>**)formatManagerBase; return formatManager->getResource( resource, this ); } else return false; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Format Accessor Methods /// Return the number of resource formats that this manager can manage. RIM_INLINE Size getFormatCount() const { return formats.getSize(); } /// Add a new resource format to this manager. /** * The method fails if the format transcoder is NULL or if its format is not valid. * The new transcoder replaces any previously existing transcoder for its format. */ template < typename DataType > RIM_NO_INLINE Bool addFormat( const lang::Pointer<ResourceTranscoder<DataType> >& transcoder, Bool cacheEnabled = true ) { // Make sure the new transcoder is not NULL. if ( transcoder.isNull() ) return false; // Get the format for the new transcoder. ResourceFormat format = transcoder->getResourceFormat(); if ( format == ResourceFormat::UNDEFINED ) return false; // Check to see if there was already a manager for this format. FormatManagerBase** existingManager; if ( formats.find( format, format, existingManager ) ) { // Replace the existing transcoder for the format. FormatManager<DataType>* formatManager = *(FormatManager<DataType>**)existingManager; formatManager->transcoder = transcoder; formatManager->cacheEnabled = cacheEnabled; return true; } // Create a manager for the new format. FormatManager<DataType>* formatManager = util::construct<FormatManager<DataType> >( transcoder, cacheEnabled ); // Insert it in the format map. formats.add( format, format, formatManager ); return true; } /// Remove the specified format from this resource manager. /** * The method returns whether or not the specified format was found and removed. */ Bool removeFormat( const ResourceFormat& format ); /// Remove all formats from this resource manager. void clearFormats(); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Cache Accessor Methods /// Return whether or not the resource cache is enabled for the specified resource format. Bool getCacheIsEnabled( const ResourceFormat& format ) const; /// Set whether or not the resource cache should be enabled for the specified resource format. /** * The method returns whether or not the cache status for the specified format was able * to be changed. */ Bool setCacheIsEnabled( const ResourceFormat& format, Bool newCacheEnabled ); /// Set whether or not the resource cache should be enabled for all resource formats. void setCacheIsEnabled( Bool newCacheEnabled ); /// Clear the resource cache for only the specified resource format. /** * The method returns whether or not the cache for the specified format was able * to be cleared. */ Bool clearCache( const ResourceFormat& format ); /// Clear the resource cache for all resource formats. void clearCache(); private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Class Declarations /// A class that stores a resource transcoder and pool for a specific ResourceFormat. class FormatManagerBase { public: RIM_INLINE FormatManagerBase( Bool newCacheEnabled ) : cacheEnabled( newCacheEnabled ) { } virtual ~FormatManagerBase() { } virtual FormatManagerBase* clone() const = 0; virtual void clearCache() = 0; /// A boolean value indicating whether or not this format's resource pool is enabled. Bool cacheEnabled; }; /// A class that stores a resource transcoder and pool for a specific ResourceFormat. template < typename DataType > class FormatManager : public FormatManagerBase { public: RIM_INLINE FormatManager( const lang::Pointer<ResourceTranscoder<DataType> >& newTranscoder, Bool newCacheEnabled ) : FormatManagerBase( newCacheEnabled ), transcoder( newTranscoder ) { } virtual FormatManager<DataType>* clone() const { return util::construct<FormatManager<DataType> >( *this ); } virtual Bool getResource( Resource<DataType>& resource, ResourceManager* manager ) { const ResourceID* identifier = resource.getID(); if ( identifier == NULL ) return false; // Check the cache to see if there is anything already loaded in the cache. if ( cacheEnabled ) { Resource<DataType>* pooledResource = cache.getResource( *identifier ); if ( pooledResource != NULL ) { resource = *pooledResource; return true; } } // Try loading the resource using the transcoder. if ( transcoder.isNull() ) return false; lang::Pointer<DataType> resourceData = transcoder->decode( *identifier, manager ); // If the loading failed, return a NULL resource. if ( !resourceData ) return false; resource.setData( resourceData ); // Insert the new resource in the cache if necessary. if ( cacheEnabled ) cache.addResource( *identifier, resource ); return true; } virtual Resource<DataType> getResource( const ResourceID& identifier, ResourceManager* manager ) { // Check the cache to see if there is anything already loaded in the cache. if ( cacheEnabled ) { Resource<DataType>* pooledResource = cache.getResource( identifier ); if ( pooledResource != NULL ) return *pooledResource; } // Try loading the resource using the transcoder. if ( transcoder.isNull() ) return Resource<DataType>( identifier ); lang::Pointer<DataType> resourceData = transcoder->decode( identifier, manager ); // If the loading failed, return a NULL resource. if ( !resourceData ) return Resource<DataType>( identifier ); Resource<DataType> resource( resourceData, identifier ); // Insert the new resource in the cache if necessary. if ( cacheEnabled ) cache.addResource( identifier, resource ); return resource; } virtual void clearCache() { cache.clearResources(); } /// A pointer to the resource transcoder that is used for this format. lang::Pointer<ResourceTranscoder<DataType> > transcoder; /// A pool of previously loaded resources for this format. ResourcePool<DataType> cache; }; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Helper Methods /// Infer the format for the specified resource ID from its attributes. static ResourceFormat inferFormat( const ResourceID& identifier ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Members /// A map from resource formats to managers for those formats. util::HashMap<ResourceFormat,FormatManagerBase*> formats; }; //########################################################################################## //************************** End Rim Resources Namespace ********************************* RIM_RESOURCES_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_RESOURCE_MANAGER_H <file_sep>/* * rimGraphicsGenericVertexBinding.h * Rim Graphics * * Created by <NAME> on 9/26/13. * Copyright 2013 __MyCompanyName__. All rights reserved. * */ #ifndef INCLUDE_RIM_GRAPHICS_GENERIC_VERTEX_BINDING_H #define INCLUDE_RIM_GRAPHICS_GENERIC_VERTEX_BINDING_H #include "rimGraphicsShadersConfig.h" //########################################################################################## //*********************** Start Rim Graphics Shaders Namespace *************************** RIM_GRAPHICS_SHADERS_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// An object that encapsulates information about the binding of a vertex buffer to a name and usage. class GenericVertexBinding { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructors /// Create a new generic vertex binding object with no name, UNDEFINED usage, and no value. RIM_INLINE GenericVertexBinding() : name(), usage( VertexUsage::UNDEFINED ), buffer(), isInput( true ) { } /// Create a new generic vertex binding object with the specified name, usage, and value. RIM_INLINE GenericVertexBinding( const String& newName, const VertexUsage& newUsage ) : name( newName ), usage( newUsage ), buffer(), isInput( true ) { } /// Create a new generic vertex binding object with the specified name, usage, and value. RIM_INLINE GenericVertexBinding( const String& newName, const Pointer<GenericBuffer>& newBuffer, const VertexUsage& newUsage, Bool newIsInput = true ) : name( newName ), usage( newUsage ), buffer( newBuffer ), isInput( newIsInput ) { } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Binding Name Accessor Methods /// Return a string representing the name of the vertex binding. RIM_INLINE const String& getName() const { return name; } /// Set a string representing the name of the vertex binding. RIM_INLINE void setName( const String& newName ) { name = newName; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Binding Usage Accessor Methods /// Return an enum value indicating the semantic usage of this vertex binding. RIM_INLINE const VertexUsage& getUsage() const { return usage; } /// Set an enum value indicating the semantic usage of this vertex binding. RIM_INLINE void setUsage( const VertexUsage& newUsage ) { usage = newUsage; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Vertex Binding Buffer Accessor Methods /// Return a pointer to the vertex buffer which is bound to this binding. RIM_INLINE const Pointer<GenericBuffer>& getBuffer() const { return buffer; } /// Set a pointer to the vertex buffer which is bound to this binding. RIM_INLINE void setBuffer( const Pointer<GenericBuffer>& newBuffer ) { buffer = newBuffer; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Input Status Accessor Methods /// Return whether or not this vertex binding is a dynamic input to a shader pass. /** * If so, the renderer can provide dynamic scene information for this binding * (such as nearby lights, textures, etc) that aren't explicitly part of this * binding. By default, all bindings are inputs. */ RIM_INLINE Bool getIsInput() const { return isInput; } /// Set whether or not this vertex binding is a dynamic input to a shader pass. /** * If so, the renderer can provide dynamic scene information for this binding * (such as nearby lights, textures, etc) that aren't explicitly part of this * binding. */ RIM_INLINE void setIsInput( Bool newInput ) { isInput = newInput; } private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Members /// A string representing the name of the vertex binding. String name; /// An enum representing the semantic usage for this vertex attribute binding. VertexUsage usage; /// A pointer to the vertex buffer which is bound to this binding. Pointer<GenericBuffer> buffer; /// A boolean value indicating whether or not this binding represents a dynamic input. Bool isInput; }; //########################################################################################## //*********************** End Rim Graphics Shaders Namespace ***************************** RIM_GRAPHICS_SHADERS_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_GRAPHICS_GENERIC_VERTEX_BINDING_H <file_sep>/* * rimBuffer.h * Rim Framework * * Created by <NAME> on 5/22/08. * Copyright 2008 Rim Software. All rights reserved. * */ #ifndef INCLUDE_RIM_BUFFER_H #define INCLUDE_RIM_BUFFER_H #include "rimDataConfig.h" #include "../util/rimArray.h" //########################################################################################## //******************************* Start Data Namespace ********************************* RIM_DATA_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// An array-based buffer class /** * This class allows the user to accumulate elements in a resizing buffer, * then use the buffer's array as a contiguous block of memory at some later point. */ template < typename T > class Buffer { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructors /// Create an empty buffer with the default initial capacity. RIM_INLINE Buffer() : buffer( util::allocate<T>( DEFAULT_CAPACITY ) ), capacity( DEFAULT_CAPACITY ), resizeFactor( DEFAULT_RESIZE_FACTOR ) { nextElement = buffer; bufferEnd = buffer + capacity; } /// Create an empty buffer with the specified initial capacity. RIM_INLINE Buffer( Size initialCapacity ) : buffer( util::allocate<T>( initialCapacity ) ), capacity( initialCapacity ), resizeFactor( DEFAULT_RESIZE_FACTOR ) { nextElement = buffer; bufferEnd = buffer + capacity; } /// Create an empty buffer with the specified initial capacity and resize factor. RIM_INLINE Buffer( Size initialCapacity, Float newResizeFactor ) : buffer( util::allocate<T>( initialCapacity ) ), capacity( initialCapacity ), resizeFactor( math::clamp( resizeFactor, 1.1f, 10.0f ) ) { nextElement = buffer; bufferEnd = buffer + capacity; } /// Create an identical copy of the specified buffer. RIM_INLINE Buffer( const Buffer& other ) : buffer( util::allocate<T>( other.capacity ) ), capacity( other.capacity ), resizeFactor( other.resizeFactor ) { Size otherSize = other.getSize(); Buffer::copyObjects( buffer, other.buffer, otherSize ); nextElement = buffer + otherSize; bufferEnd = buffer + capacity; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Destructor /// Destroy a buffer, deallocating all resources used. RIM_INLINE ~Buffer() { util::destructArray( buffer, getSize() ); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Assignment Operator /// Assign the contents of one array list to another, performing a deep copy. RIM_NO_INLINE Buffer& operator = ( const Buffer& other ) { if ( this != &other ) { // Call the destructors of all objects that are already in the buffer. util::destructArray( buffer, getSize() ); capacity = other.capacity; resizeFactor = other.resizeFactor; Size otherSize = other.getSize(); // Reallocate the buffer array. buffer = util::allocate<T>( other.capacity ); // Copy objects from the other buffer to this one. Buffer::copyObjects( buffer, other.buffer, otherSize ); nextElement = buffer + otherSize; bufferEnd = buffer + capacity; } return *this; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Append Methods /// Append an element to the end of this buffer. RIM_INLINE Buffer& append( const T& element ) { if ( nextElement == bufferEnd ) increaseCapacity( nextElement - buffer + 1 ); new ( nextElement ) T( element ); nextElement++; return *this; } /// Append the specified number of elements from the given array. RIM_INLINE Buffer& append( const T* source, Size numElements ) { if ( nextElement + numElements > bufferEnd ) increaseCapacity( nextElement - buffer + numElements ); Buffer::copyObjects( nextElement, source, numElements ); nextElement += numElements; return *this; } /// Append all elements from the specified array to the end of the buffer. RIM_INLINE Buffer& append( const util::Array<T>& array ) { return append( array.getPointer(), array.getSize() ); } /// Append a certain number of elements from the specified array to the end of the buffer. RIM_INLINE Buffer& append( const util::Array<T>& array, Size number ) { return append( array.getPointer(), math::min( number, array.getSize() ) ); } /// Append all data from the specified buffer. RIM_INLINE Buffer& append( const Buffer& aBuffer ) { return append( aBuffer.buffer, aBuffer.getSize() ); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Append Operators /// Append an element to the end of this buffer. RIM_INLINE Buffer& operator << ( const T& element ) { return append( element ); } /// Append all elements from the specified array to the end of the buffer. RIM_INLINE Buffer& operator << ( const util::Array<T>& array ) { return append( array ); } /// Append all data from the specified buffer. RIM_INLINE Buffer& operator << ( const Buffer& aBuffer ) { return append( aBuffer ); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Clear Method /// Clear the contents of the buffer, keeping its capacity intact. RIM_INLINE void clear() { Buffer::callDestructors( buffer, getSize() ); nextElement = buffer; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Content Accessor Methods /// Convert the contents of this buffer to an array object. RIM_INLINE util::Array<T> toArray() const { return util::Array<T>( (const T*)buffer, getSize() ); } /// Convert the contents of this buffer to an array object. RIM_INLINE operator util::Array<T> () { return util::Array<T>( (const T*)buffer, getSize() ); } /// Get a pointer pointing to the buffer's internal array. RIM_INLINE const T* getPointer() const { return buffer; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Size Accessor Methods /// Get the number of elements in the buffer. RIM_INLINE Size getSize() const { return nextElement - buffer; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Capacity Accessor Methods /// Get the number of elements the buffer can hold without resizing. RIM_INLINE Size getCapacity() const { return capacity; } /// Set the number of elements the buffer can hold. RIM_INLINE Bool setCapacity( Size newCapacity ) { if ( newCapacity < getSize() ) return false; else resize( newCapacity ); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Resize Factor Accessor Methods /// Get the resize factor for this buffer. RIM_INLINE Float getResizeFactor() const { return resizeFactor; } /// Set the resize factor for this buffer, clamped to [1.1, 10.0] RIM_INLINE void setResizeFactor( Float newResizeFactor ) { resizeFactor = math::clamp( newResizeFactor, 1.1f, 10.0f ); } private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Methods /// Call the constructors of the specified number of elements of the given array. static void callDestructors( T* array, Size number ) { const T* const arrayEnd = array + number; while ( array != arrayEnd ) { array->~T(); array++; } } /// Copy the specified number of objects from the source to the destination location. static void copyObjects( T* destination, const T* source, Size number ) { const T* const sourceEnd = source + number; while ( source != sourceEnd ) { new (destination) T(*source); destination++; source++; } } /// Move the specified number of objects from the source to the destination location. static void moveObjects( T* destination, const T* source, Size number ) { const T* const sourceEnd = source + number; while ( source != sourceEnd ) { // copy the object from the source to destination new (destination) T(*source); // call the destructors on the source source->~T(); destination++; source++; } } /// Increase the capacity to the specified amount multiplied by the resize factor. RIM_INLINE void increaseCapacity( Size minimumCapacity ) { resize( math::max( minimumCapacity, Size(Float(capacity)*resizeFactor) ) ); } /// Resize the internal buffer to be the specified length. RIM_NO_INLINE void resize( Size newCapacity ) { Size numElements = getSize(); // Update the capacity and allocate a new array. capacity = newCapacity; T* oldBuffer = buffer; buffer = util::allocate<T>( capacity ); // copy the elements from the old array to the new array. Buffer::moveObjects( buffer, oldBuffer, numElements ); // Update pointers needed for quick adding to the buffer. nextElement = buffer + numElements; bufferEnd = buffer + capacity; // deallocate the old array. util::destructArray( oldBuffer, numElements ); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Members /// An array of elements which is the buffer. T* buffer; /// A pointer to the location in the buffer where the next element should be inserted. T* nextElement; /// A pointer to the first element past the end of the buffer. const T* bufferEnd; /// The number of elements that the buffer can hold. Size capacity; /// How much the buffer's capacity increases when it needs to. Float resizeFactor; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Static Data Members /// The default capacity for a buffer if it is not specified. static const Size DEFAULT_CAPACITY = 32; /// The default factor by which the buffer resizes. static const Float DEFAULT_RESIZE_FACTOR; }; template < typename T > const Float Buffer<T>:: DEFAULT_RESIZE_FACTOR = 2.0f; //########################################################################################## //******************************* End Data Namespace *********************************** RIM_DATA_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_BUFFER_H <file_sep>/* * rimSIMDFlags.h * Rim Software * * Created by <NAME> on 9/25/14. * Copyright 2014 __MyCompanyName__. All rights reserved. * */ #ifndef INCLUDE_RIM_SIMD_FLAGS_H #define INCLUDE_RIM_SIMD_FLAGS_H #include "rimSIMDConfig.h" //########################################################################################## //***************************** Start Rim Math Namespace ********************************* RIM_MATH_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class that contains flags that specify the type of SIMD operations supported. /** * These flags allow the user to determine at runtime the capabilities of the CPU, * and to then choose one code path or another based on the result. */ class SIMDFlags { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** SIMD Flags Enum Declaration /// An enum which specifies the different SIMD flags. typedef enum Flag { /// A flag indicating that SSE is supported by the CPU. SSE = (1 << 0), /// A flag indicating that SSE2 is supported by the CPU. SSE_2 = (1 << 1), /// A flag indicating that SSE3 is supported by the CPU. SSE_3 = (1 << 2), /// A flag indicating that SSSE3 is supported by the CPU. SSSE_3 = (1 << 3), /// A flag indicating that SSE 4.1 is supported by the CPU. SSE_4_1 = (1 << 4), /// A flag indicating that SSE 4.2 is supported by the CPU. SSE_4_2 = (1 << 5), /// A flag indicating that SSE 4.1 and SSE 4.2 is supported by the CPU. SSE_4 = SSE_4_1 | SSE_4_2, /// A flag indicating that AVX is supported by the CPU. AVX = (1 << 6), /// A flag indicating that AVX2 is supported by the CPU. AVX_2 = (1 << 7), /// A flag indicating that AVX-512F is supported by the CPU. AVX_512F = (1 << 8), /// A flag indicating that AVX-512PF is supported by the CPU. AVX_512PF = (1 << 9), /// A flag indicating that AVX-512ER is supported by the CPU. AVX_512ER = (1 << 10), /// A flag indicating that AVX-512CD is supported by the CPU. AVX_512CD = (1 << 11), /// A flag indicating that the ARM NEON SIMD is supported by the CPU. NEON = (1 << 30), /// A flag indicating that Altivec is supported by the CPU. ALTIVEC = (1 << 31), /// The flag value when no flags are set. UNDEFINED = 0 }; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructors /// Create a new SIMD flags object with no flags set. RIM_INLINE SIMDFlags() : flags( UNDEFINED ) { } /// Create a new SIMD flags object with the specified flag value initially set. RIM_INLINE SIMDFlags( Flag flag ) : flags( flag ) { } /// Create a new SIMD flags object with the specified initial combined flags value. RIM_INLINE SIMDFlags( UInt32 newFlags ) : flags( newFlags ) { } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Integer Cast Operator /// Convert this flags object to an integer value. /** * This operator is provided so that the object * can be used as an integer value for bitwise logical operations. */ RIM_INLINE operator UInt32 () const { return flags; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Flag Is Set Accessor Methods /// Return whether or not the specified flag value is set for this flags object. RIM_INLINE Bool isSet( Flag flag ) const { return (flags & flag) != UNDEFINED; } /// Set whether or not the specified flag value is set for this flags object. RIM_INLINE void set( Flag flag, Bool newIsSet ) { if ( newIsSet ) flags |= flag; else flags &= ~flag; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Current CPU Flags Accessor /// Return an object containing the SIMD flags for the current CPU. static SIMDFlags get(); private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Members /// A value indicating the flags that are set. UInt32 flags; }; //########################################################################################## //***************************** End Rim Math Namespace *********************************** RIM_MATH_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_SIMD_FLAGS_H <file_sep>/* * rimGraphicsGUIScreenDelegate.h * Rim Graphics GUI * * Created by <NAME> on 2/15/13. * Copyright 2013 Headspace Systems. All rights reserved. * */ #ifndef INCLUDE_RIM_GRAPHICS_GUI_SCREEN_DELEGATE_H #define INCLUDE_RIM_GRAPHICS_GUI_SCREEN_DELEGATE_H #include "rimGraphicsGUIConfig.h" //########################################################################################## //************************ Start Rim Graphics GUI Namespace ****************************** RIM_GRAPHICS_GUI_NAMESPACE_START //****************************************************************************************** //########################################################################################## class Screen; //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class which contains function objects that recieve Screen events. /** * Any screen-related event that might be processed has an appropriate callback * function object. Each callback function is called by the screen * whenever such an event is received. If a callback function in the delegate * is not initialized, the screen simply ignores it. */ class ScreenDelegate { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Screen Delegate Callback Functions /// A function object which is called whenever a screen's internal state is updated. /** * A screen calls this method when its update() method is called, allowing * the user to perform any logic updates for the specified time interval which * are needed for the screen. */ Function<void ( Screen& screen, Float dt )> update; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** User Input Callback Functions /// A function object called whenever an attached screen receives a keyboard event. Function<void ( Screen& screen, const KeyboardEvent& keyEvent )> keyEvent; /// A function object called whenever an attached screen receives a mouse-motion event. Function<void ( Screen& screen, const MouseMotionEvent& mouseMotionEvent )> mouseMotionEvent; /// A function object called whenever an attached screen receives a mouse-button event. Function<void ( Screen& screen, const MouseButtonEvent& mouseButtonEvent )> mouseButtonEvent; /// A function object called whenever an attached screen receives a mouse-wheel event. Function<void ( Screen& screen, const MouseWheelEvent& mouseWheelEvent )> mouseWheelEvent; }; //########################################################################################## //************************ End Rim Graphics GUI Namespace ******************************** RIM_GRAPHICS_GUI_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_GRAPHICS_GUI_SCREEN_DELEGATE_H <file_sep>/* * rimGraphicsGUIBorderType.h * Rim Graphics GUI * * Created by <NAME> on 2/10/13. * Copyright 2013 Headspace Systems. All rights reserved. * */ #ifndef INCLUDE_RIM_GRAPHICS_GUI_BORDER_TYPE_H #define INCLUDE_RIM_GRAPHICS_GUI_BORDER_TYPE_H #include "rimGraphicsGUIUtilitiesConfig.h" //########################################################################################## //******************* Start Rim Graphics GUI Utilities Namespace ************************* RIM_GRAPHICS_GUI_UTILITIES_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class which represents the type of visual appearance of a rectangular border. class BorderType { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Public Enum Declaration /// An enum which specifies the different kinds of borders. typedef enum Enum { /// A border type where the border is a solid line. SOLID, /// A border type where the border is a dotted line. DOTTED, /// A border type where the border uses a color fade on all sides. /** * The content area's background color is smoothly faded to the border * color. */ FADE, /// A border type where border has a raised appearance. /** * This is usually accomplished by using two-sided border lighting to * give the impression of a raised border. */ RAISED, /// A border type where border has a sunken appearance. /** * This is usually accomplished by using two-sided lighting to * give the impression of a sunken border. */ SUNKEN, /// A border type which indicates that there should be no border. NONE }; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructors /// Create a new border type using the specified border type enum value. RIM_INLINE BorderType( Enum newType ) : type( newType ) { } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Enum Cast Operator /// Convert this border type to an enum value. RIM_INLINE operator Enum () const { return type; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** String Representation Accessor Methods /// Return a string representation of the border type. String toString() const; /// Convert this border type into a string representation. RIM_INLINE operator String () const { return this->toString(); } private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Members /// An enum value indicating the type of border this object represents. Enum type; }; //########################################################################################## //******************* End Rim Graphics GUI Utilities Namespace *************************** RIM_GRAPHICS_GUI_UTILITIES_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_GRAPHICS_GUI_BORDER_TYPE_H <file_sep>/* * rimPhysicsAssetsConfig.h * Rim Software * * Created by <NAME> on 6/22/14. * Copyright 2014 __MyCompanyName__. All rights reserved. * */ #ifndef INCLUDE_RIM_PHYSICS_ASSETS_CONFIG_H #define INCLUDE_RIM_PHYSICS_ASSETS_CONFIG_H #include "../rimPhysicsConfig.h" #include "../rimPhysicsUtilities.h" #include "../rimPhysicsShapes.h" #include "../rimPhysicsObjects.h" #include "../rimPhysicsForces.h" #include "../rimPhysicsConstraints.h" #include "../rimPhysicsScenes.h" //########################################################################################## //########################################################################################## //############ //############ Library Namespace Configuration //############ //########################################################################################## //########################################################################################## #ifndef RIM_PHYSICS_ASSETS_NAMESPACE_START #define RIM_PHYSICS_ASSETS_NAMESPACE_START RIM_PHYSICS_NAMESPACE_START namespace assets { #endif #ifndef RIM_PHYSICS_ASSETS_NAMESPACE_END #define RIM_PHYSICS_ASSETS_NAMESPACE_END }; RIM_PHYSICS_NAMESPACE_END #endif //########################################################################################## //************************ Start Rim Physics Assets Namespace **************************** RIM_PHYSICS_ASSETS_NAMESPACE_START //****************************************************************************************** //########################################################################################## //########################################################################################## //************************ End Rim Physics Assets Namespace ****************************** RIM_PHYSICS_ASSETS_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_PHYSICS_ASSETS_CONFIG_H <file_sep>/* * rimSoundReverbFilter.h * Rim Sound * * Created by <NAME> on 4/18/13. * Copyright 2013 __MyCompanyName__. All rights reserved. * */ #ifndef INCLUDE_RIM_SOUND_REVERB_FILTER_H #define INCLUDE_RIM_SOUND_REVERB_FILTER_H #include "rimSoundFiltersConfig.h" #include "rimSoundFilter.h" #include "rimSoundCutoffFilter.h" //########################################################################################## //************************ Start Rim Sound Filters Namespace ***************************** RIM_SOUND_FILTERS_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class that provides a basic reverberation effect. /** * The class uses a simple schroeder-type reverberator with frequency * band filtering. */ class ReverbFilter : public SoundFilter { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructors /// Create a new reverb filter with the default parameters. ReverbFilter(); /// Create a new reverb filter with the default parameters and the specified decay time in seconds. ReverbFilter( Float newDecayTime ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Wet Gain Accessor Methods /// Return the current linear wet gain factor of this reverb filter. /** * This value represents the gain applied to the reverb * signal before it is mixed with input signal. */ RIM_INLINE Gain getWetGain() const { return targetWetGain; } /// Return the current wet gain factor in decibels of this reverb filter. /** * This value represents the gain applied to the reverb * signal before it is mixed with input signal. */ RIM_INLINE Gain getWetGainDB() const { return util::linearToDB( targetWetGain ); } /// Set the target linear wet gain for this reverb filter. /** * This value represents the gain applied to the reverb * signal before it is mixed with input signal. */ RIM_INLINE void setWetGain( Gain newWetGain ) { lockMutex(); targetWetGain = newWetGain; unlockMutex(); } /// Set the target wet gain in decibels for this reverb filter. /** * This value represents the gain applied to the reverb * signal before it is mixed with input signal. */ RIM_INLINE void setWetGainDB( Gain newDBWetGain ) { lockMutex(); targetWetGain = util::dbToLinear( newDBWetGain ); unlockMutex(); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Dry Gain Accessor Methods /// Return the current linear dry gain factor of this reverb filter. /** * This value represents the gain applied to the input * signal before it is mixed with affected signal. */ RIM_INLINE Gain getDryGain() const { return targetDryGain; } /// Return the current dry gain factor in decibels of this reverb filter. /** * This value represents the gain applied to the input * signal before it is mixed with affected signal. */ RIM_INLINE Gain getDryGainDB() const { return util::linearToDB( targetDryGain ); } /// Set the target linear dry gain for this reverb filter. /** * This value represents the gain applied to the input * signal before it is mixed with affected signal. */ RIM_INLINE void setDryGain( Gain newDryGain ) { lockMutex(); targetDryGain = newDryGain; unlockMutex(); } /// Set the target dry gain in decibels for this reverb filter. /** * This value represents the gain applied to the input * signal before it is mixed with affected signal. */ RIM_INLINE void setDryGainDB( Gain newDBDryGain ) { lockMutex(); targetDryGain = util::dbToLinear( newDBDryGain ); unlockMutex(); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Reverb Time Accessor Methods /// Return the decay time for this reverb filter. /** * This is the time that it takes for an impulse's reverb tail * to drop to -60 decibels below its original level, the RT60. */ RIM_INLINE Float getDecayTime() const { return decayTime; } /// Set the decay time for this reverb filter. /** * This is the time that it takes for an impulse's reverb tail * to drop to -60 decibels below its original level, the RT60. * * The new reverb time is clamped to the range [0,100]. */ RIM_INLINE void setDecayTime( Float newDecayTime ) { lockMutex(); decayTime = math::clamp( newDecayTime, Float(0), Float(100) ); unlockMutex(); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Reverb Density Accessor Methods /// Return the reverb density for this reverb filter. /** * This is a value between 0 and 1 indicating how dense the * reverb reflections are. A value of 1 indicates that the * reflections are as dense as possible. */ RIM_INLINE Float getDensity() const { return density; } /// Set the reverb density for this reverb filter. /** * This is a value between 0 and 1 indicating how dense the * reverb reflections are. A value of 1 indicates that the * reflections are as dense as possible. * * The new reverb density is clamped to the range [0,1]. */ RIM_INLINE void setDensity( Float newDensity ) { lockMutex(); density = math::clamp( newDensity, Float(0), Float(1) ); unlockMutex(); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** High Pass Filter Attribute Accessor Methods /// Return whether or not this reverb filter's high pass filter is enabled. RIM_INLINE Bool getHighPassIsEnabled() const { return highPassEnabled; } /// Set whether or not this reverb filter's high pass filter is enabled. RIM_INLINE void setHighPassIsEnabled( Bool newHighPassIsEnabled ) { lockMutex(); highPassEnabled = newHighPassIsEnabled; unlockMutex(); } /// Return the high pass filter frequency of this reverb filter. RIM_INLINE Float getHighPassFrequency() const { return highPassFrequency; } /// Set the high pass filter frequency of this reverb filter. /** * The new high pass frequency is clamped to the range [0,infinity]. */ RIM_INLINE void setHighPassFrequency( Float newHighPassFrequency ) { lockMutex(); highPassFrequency = math::max( newHighPassFrequency, Float(0) ); unlockMutex(); } /// Return the high pass filter order of this reverb filter. RIM_INLINE Size getHighPassOrder() const { return highPassOrder; } /// Set the high pass filter order of this reverb filter. /** * The new high pass order is clamped to the range [1,100]. */ RIM_INLINE void setHighPassOrder( Size newHighPassOrder ) { lockMutex(); highPassOrder = math::clamp( newHighPassOrder, Size(1), Size(100) ); unlockMutex(); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Low Pass Filter Attribute Accessor Methods /// Return whether or not this reverb filter's low pass filter is enabled. RIM_INLINE Bool getLowPassIsEnabled() const { return lowPassEnabled; } /// Set whether or not this reverb filter's low pass filter is enabled. RIM_INLINE void setLowPassIsEnabled( Bool newLowPassIsEnabled ) { lockMutex(); lowPassEnabled = newLowPassIsEnabled; unlockMutex(); } /// Return the low pass filter frequency of this reverb filter. RIM_INLINE Float getLowPassFrequency() const { return lowPassFrequency; } /// Set the low pass filter frequency of this reverb filter. /** * The new low pass frequency is clamped to the range [0,infinity]. */ RIM_INLINE void setLowPassFrequency( Float newLowPassFrequency ) { lockMutex(); lowPassFrequency = math::max( newLowPassFrequency, Float(0) ); unlockMutex(); } /// Return the low pass filter order of this reverb filter. RIM_INLINE Size getLowPassOrder() const { return lowPassOrder; } /// Set the low pass filter order of this reverb filter. /** * The new low pass order is clamped to the range [1,100]. */ RIM_INLINE void setLowPassOrder( Size newLowPassOrder ) { lockMutex(); lowPassOrder = math::clamp( newLowPassOrder, Size(1), Size(100) ); unlockMutex(); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Filter Attribute Accessor Methods /// Return a human-readable name for this reverb filter. /** * The method returns the string "Reverb Filter". */ virtual UTF8String getName() const; /// Return the manufacturer name of this reverb filter. /** * The method returns the string "Headspace Sound". */ virtual UTF8String getManufacturer() const; /// Return an object representing the version of this reverb filter. virtual SoundFilterVersion getVersion() const; /// Return an object which describes the category of effect that this filter implements. /** * This method returns the value SoundFilterCategory::REVERB. */ virtual SoundFilterCategory getCategory() const; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Filter Parameter Accessor Methods /// Return the total number of generic accessible parameters this reverb filter has. virtual Size getParameterCount() const; /// Get information about the reverb filter parameter at the specified index. virtual Bool getParameterInfo( Index parameterIndex, FilterParameterInfo& info ) const; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Public Static Property Objects /// A string indicating the human-readable name of this reverb filter. static const UTF8String NAME; /// A string indicating the manufacturer name of this reverb filter. static const UTF8String MANUFACTURER; /// An object indicating the version of this reverb filter. static const SoundFilterVersion VERSION; private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Filter Parameter Value Accessor Methods /// Place the value of the parameter at the specified index in the output parameter. virtual Bool getParameterValue( Index parameterIndex, FilterParameter& value ) const; /// Attempt to set the parameter value at the specified index. virtual Bool setParameterValue( Index parameterIndex, const FilterParameter& value ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Stream Reset Method /// A method which is called whenever the filter's stream of audio is being reset. /** * This method allows the filter to reset all parameter interpolation * and processing to its initial state to avoid coloration from previous * audio or parameter values. */ virtual void resetStream(); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Filter Processing Methods /// Apply a reverb function to the samples in the input frame and write the output to the output frame. virtual SoundFilterResult processFrame( const SoundFilterFrame& inputFrame, SoundFilterFrame& outputFrame, Size numSamples ); /// Process a comb filter where no parameter interpolation occurs, mixing to the output instead of replacing. void processCombFilterNoChanges( const Sample32f* input, Sample32f* output, Size numSamples, Sample32f* const delayBufferStart, Sample32f* const delayBufferEnd, Sample32f* delay, Gain feedbackGain ); /// Process a comb filter where no parameter interpolation occurrs. void processAllPassFilterNoChanges( const Sample32f* input, Sample32f* output, Size numSamples, Sample32f* const delayBufferStart, Sample32f* const delayBufferEnd, Sample32f* delay, Gain feedbackGain ); /// Compute and return the feedback gain necessary to produce the specified reverb time with the given delay time. RIM_INLINE Float getFeedbackGainForRT60( Float delayTime, Float rt60 ) { return math::pow( Float(0.001), delayTime / rt60 ); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Class Declaration /// A class that encapsulates all information related to a single reverb filter channel. class DelayFilterChannel { public: inline DelayFilterChannel() : currentDelayWriteIndex( 0 ), delayTime( 0 ), feedbackGain( 0 ), decayTime( 0 ) { } /// An array of samples which represents the delay filter buffer for this channel. Array<Sample32f> delayBuffer; /// The current write position in samples within the delay buffer. Index currentDelayWriteIndex; /// The delay time for this delay filter channel. Float delayTime; /// The feedbaack gain for this delay filter channel. Float feedbackGain; /// The RT60 for this delay filter channel, stored here so that we can know when to update the feedback gain. Float decayTime; }; /// A class which encapsulates information about a single all-pass or comb filter. class DelayFilter { public: RIM_INLINE DelayFilter() { } /// An array of the channels that are part of this delay filter. Array<DelayFilterChannel> channels; }; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Members /// An array of comb filters which are applied in parallel and mixed together. Array<DelayFilter> combFilters; /// An array of all pass filters which are applied in series to the output of the comb filters. Array<DelayFilter> allPassFilters; /// The current output gain for the wet affected signal for this reverb filter. Gain wetGain; /// The target wet gain factor, used to smooth changes in the wet gain. Gain targetWetGain; /// The current output gain for the dry unaffected signal for this reverb filter. Gain dryGain; /// The target dry gain factor, used to smooth changes in the dry gain. Gain targetDryGain; /// The decay time for this reverb filter. /** * This is the time that it takes for an impulse's reverb tail * to drop to -60 decibels below its original level, the RT60. */ Float decayTime; /// A value between 0 and 1 indicating how dense the reverb reflections are. Float density; /// The frequency at which the high pass filter for the reverb is at -3dB. Float highPassFrequency; /// The order of the reverb's high pass filter that determines its slope. Size highPassOrder; /// A high-pass filter used to smooth the output of the reverb. CutoffFilter* highPass; /// The frequency at which the low pass filter for the reverb is at -3dB. Float lowPassFrequency; /// The order of the reverb's low pass filter that determines its slope. Size lowPassOrder; /// A low-pass filter used to smooth the output of the reverb. CutoffFilter* lowPass; /// A boolean value indicating whether or not this reverb's low-pass filter is enabled. Bool lowPassEnabled; /// A boolean value indicating whether or not this reverb's high-pass filter is enabled. Bool highPassEnabled; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Static Data Members /// The maximum allowed number of series all pass filters for this reverb filter. static const Size MAX_NUMBER_OF_ALL_PASS_FILTERS = 5; /// The maximum allowed number of parallel comb filters for this reverb filter. static const Size MAX_NUMBER_OF_COMB_FILTERS = 10; }; //########################################################################################## //************************ End Rim Sound Filters Namespace ******************************* RIM_SOUND_FILTERS_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_SOUND_REVERB_FILTER_H <file_sep>/* * rimPhysicsCollisionResultSet.h * Rim Physics * * Created by <NAME> on 11/28/09. * Copyright 2009 Rim Software. All rights reserved. * */ #ifndef INCLUDE_RIM_PHYSICS_COLLISION_RESULT_SET_H #define INCLUDE_RIM_PHYSICS_COLLISION_RESULT_SET_H #include "rimPhysicsCollisionConfig.h" #include "rimPhysicsCollisionManifold.h" //########################################################################################## //********************** Start Rim Physics Collision Namespace *************************** RIM_PHYSICS_COLLISION_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class which contains a map from object pairs to collision manifolds. /** * This class is used to keep track of all current collisions among a * set of objects. Each pair of objects can have a single collision manifold * which can contain one or more collision points. */ template < typename ObjectType1, typename ObjectType2 > class CollisionResultSet { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Collision Manifold Accessor Methods /// Retrieve the collision manifold between the two specified objects if it exists. /** * If this result set contains a manifold between the two specified objects, * TRUE is returned and a pointer to the objects' collision manifold is returned * in the output parameter. Otherwise, FALSE is returned and no manifold * is retrieved. */ RIM_INLINE Bool getManifold( const ObjectType1* object1, const ObjectType2* object2, const CollisionManifold*& manifold ) const { ObjectPair<ObjectType1,ObjectType2> objectPair( object1, object2 ); return results.find( objectPair.getHashCode(), objectPair, manifold ); } /// Retrieve the collision manifold between the two specified objects if it exists. /** * If this result set contains a manifold between the two specified objects, * TRUE is returned and a pointer to the objects' collision manifold is returned * in the output parameter. Otherwise, FALSE is returned and no manifold * is retrieved. */ RIM_INLINE Bool getManifold( const ObjectType1* object1, const ObjectType2* object2, CollisionManifold*& manifold ) { ObjectPair<ObjectType1,ObjectType2> objectPair( object1, object2 ); return results.find( objectPair.getHashCode(), objectPair, manifold ); } /// Return the total number of collision manifolds (colliding object pairs) in this result set. RIM_INLINE Size getManifoldCount() const { return results.getSize(); } /// Return whether or not this collision result set contains a manifold for specified object pair. RIM_INLINE Bool hasManifold( const ObjectType1* object1, const ObjectType2* object2 ) const { ObjectPair<ObjectType1,ObjectType2> objectPair( object1, object2 ); return results.contains( objectPair.getHashCode(), objectPair ); } /// Add a new collision manifold to this result set between the specified object pair. /** * If this result set already contains a manifold for the specified pair of objects, * a reference to that existing (potentially non-empty) manifold is returned. * If there was no previous manifold, a new manifold is added for the object * pair and a reference to it is returned. */ RIM_INLINE CollisionManifold& addManifold( const ObjectType1* object1, const ObjectType2* object2 ) { ObjectPair<ObjectType1,ObjectType2> objectPair( object1, object2 ); CollisionManifold* manifold; if ( results.find( objectPair.getHashCode(), objectPair, manifold ) ) return *manifold; else return *results.add( objectPair.getHashCode(), objectPair, CollisionManifold() ); } /// Retrieve any manifold associated with the specified object pair from this result set. /** * If there was a manifold for that object pair in the result set, TRUE is * returned and the manifold is removed. Otherwise FALSE is returned and the * result set is unchanged. */ RIM_INLINE Bool removeManifold( const ObjectType1* object1, const ObjectType2* object2 ) { ObjectPair<ObjectType1,ObjectType2> objectPair( object1, object2 ); return results.remove( objectPair.getHashCode(), objectPair ); } /// Remove all collision manifolds from this collision result set. RIM_NO_INLINE void clearManifolds() { results.clear(); } /// Remove all collision points from all manifolds in this collision result set. /** * This method removes all collision points from each manifold in the * result set but does not remove the manifolds themselves. This can be a more * efficient operation than removing all manifolds themselves and can therefore * be useful when performing collision detection from frame-to-frame: objects * that stay colliding across multiple frames will keep the same manifold object, * even if the manifold is recomputed each frame. */ RIM_NO_INLINE void clearManifoldPoints() { typename HashMap<ObjectPair<ObjectType1,ObjectType2>,CollisionManifold>::Iterator i = results.getIterator(); for ( ; i; i++ ) i->clearPoints(); } /// Remove all manifolds from this collision result set that have no collision points. RIM_NO_INLINE void removeEmptyManifolds() { typename HashMap<ObjectPair<ObjectType1,ObjectType2>,CollisionManifold>::Iterator i = results.getIterator(); while ( i ) { if ( i->getPointCount() == Size(0) ) { i.remove(); continue; } i++; } } /// Return a const interator for this collision result set. RIM_INLINE typename HashMap<ObjectPair<ObjectType1,ObjectType2>,CollisionManifold>::Iterator getIterator() { return results.getIterator(); } /// Return an interator for this collision result set. RIM_INLINE typename HashMap<ObjectPair<ObjectType1,ObjectType2>,CollisionManifold>::ConstIterator getIterator() const { return results.getIterator(); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Manifold Object Transform Update Method /// Update the world-space collision points for all manifolds in this result set. RIM_INLINE void updateTransforms() { // Default implementation doesn't do anything. } private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Members /// A map from object pairs to collision manifolds for all collision results. HashMap<ObjectPair<ObjectType1,ObjectType2>,CollisionManifold> results; }; //########################################################################################## //########################################################################################## //############ //############ Rigid Object Accessor Methods //############ //########################################################################################## //########################################################################################## template <> RIM_INLINE void CollisionResultSet<RigidObject,RigidObject>:: updateTransforms() { HashMap<ObjectPair<RigidObject,RigidObject>,CollisionManifold>::Iterator i = results.getIterator(); for ( ; i; i++ ) { const RigidObject* object1 = i.getKey().getObject1(); const RigidObject* object2 = i.getKey().getObject2(); i->updateTransforms( object1->getTransform(), object2->getTransform() ); } } //########################################################################################## //********************** End Rim Physics Collision Namespace ***************************** RIM_PHYSICS_COLLISION_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_PHYSICS_COLLISION_RESULT_SET_H <file_sep>/* * rimSoundMixer.h * Rim Sound * * Created by <NAME> on 12/11/12. * Copyright 2012 __MyCompanyName__. All rights reserved. * */ #ifndef INCLUDE_RIM_SOUND_MIXER_H #define INCLUDE_RIM_SOUND_MIXER_H #include "rimSoundFiltersConfig.h" #include "rimSoundFilter.h" //########################################################################################## //************************ Start Rim Sound Filters Namespace ***************************** RIM_SOUND_FILTERS_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class that mixes multiple sources of audio to a single output. class Mixer : public SoundFilter { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructors /// Create a new mixer with the default number of inputs, 100. RIM_INLINE Mixer() : SoundFilter( 100, 1 ) { } /// Create a new mixer which has the specified number of inputs. RIM_INLINE Mixer( Size numInputs ) : SoundFilter( numInputs, 1 ) { } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Input Count Accessor Methods /// Set the total number of inputs that this mixer can have. RIM_INLINE void setInputCount( Size newNumInputs ) { SoundFilter::setInputCount( newNumInputs ); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Filter Attribute Accessor Methods /// Return a human-readable name for this mixer. /** * The method returns the string "Mixer". */ virtual UTF8String getName() const; /// Return the manufacturer name of this mixer. /** * The method returns the string "Headspace Sound". */ virtual UTF8String getManufacturer() const; /// Return an object representing the version of this mixer. virtual SoundFilterVersion getVersion() const; /// Return an object which describes the category of effect that this filter implements. /** * This method returns the value SoundFilterCategory::ROUTING. */ virtual SoundFilterCategory getCategory() const; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Filter Parameter Accessor Methods /// Return the total number of generic accessible parameters this filter has. virtual Size getParameterCount() const; /// Get information about the parameter at the specified index. virtual Bool getParameterInfo( Index parameterIndex, FilterParameterInfo& info ) const; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Public Static Property Objects /// A string indicating the human-readable name of this mixer. static const UTF8String NAME; /// A string indicating the manufacturer name of this mixer. static const UTF8String MANUFACTURER; /// An object indicating the version of this mixer. static const SoundFilterVersion VERSION; private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Filter Parameter Value Accessor Methods /// Place the value of the parameter at the specified index in the output parameter. virtual Bool getParameterValue( Index parameterIndex, FilterParameter& value ) const; /// Attempt to set the parameter value at the specified index. virtual Bool setParameterValue( Index parameterIndex, const FilterParameter& value ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Filter Processing Method /// Mix the sound in the input buffers to the first output buffer. virtual SoundFilterResult processFrame( const SoundFilterFrame& inputFrame, SoundFilterFrame& outputFrame, Size numSamples ); }; //########################################################################################## //************************ End Rim Sound Filters Namespace ******************************* RIM_SOUND_FILTERS_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_SOUND_MIXER_H <file_sep>/* * rimResourceID.h * Rim Software * * Created by <NAME> on 11/27/09. * Copyright 2009 Rim Software. All rights reserved. * */ #ifndef INCLUDE_RIM_RESOURCE_ID_H #define INCLUDE_RIM_RESOURCE_ID_H #include "rimResourcesConfig.h" #include "rimResourceType.h" #include "rimResourceFormat.h" //########################################################################################## //************************** Start Rim Resources Namespace ******************************* RIM_RESOURCES_NAMESPACE_START //****************************************************************************************** //########################################################################################## /// The integer type to use for file-local resource ID numbers. typedef Int64 ResourceLocalID; //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class which represents a unique identifier for a resource. /** * A resource is specified by a path to a file, an enum determining how that file * should be interpreted (its type), the type of resource that this ID corresponds to, * and an optional name which is used to identify the resource within the file. */ class ResourceID { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructor /// Create a new resource ID which doesn't point to a valid resource. RIM_INLINE ResourceID() : localID( -1 ) { } /// Create a new resource ID with the specified resource file path. RIM_INLINE ResourceID( const data::UTF8String& newFilePath ) : filePath( newFilePath ), localID( -1 ) { } /// Create a new resource ID with the specified attributes. RIM_INLINE ResourceID( const ResourceType& newType, const data::UTF8String& newFilePath ) : type( newType ), filePath( newFilePath ), localID( -1 ) { } /// Create a new resource ID with the specified attributes. RIM_INLINE ResourceID( const ResourceType& newType, const ResourceFormat& newFormat, const data::UTF8String& newFilePath ) : type( newType ), format( newFormat ), filePath( newFilePath ), localID( -1 ) { } /// Create a new resource ID with the specified attributes. RIM_INLINE ResourceID( const ResourceType& newType, const ResourceFormat& newFormat, const data::UTF8String& newFilePath, const data::UTF8String& newName, ResourceLocalID newLocalID = ResourceLocalID(-1) ) : type( newType ), format( newFormat ), filePath( newFilePath ), name( newName ), localID( newLocalID ) { } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Resource Type Accessor Methods /// Return an object describing the type of resource this ID refers to. RIM_INLINE const ResourceType& getType() const { return type; } /// Set an object describing the type of resource this ID refers to. RIM_INLINE void setType( const ResourceType& newType ) { type = newType; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Resource File Type Accessor Methods /// Return an object describing the format of file this ID refers to. RIM_INLINE const ResourceFormat& getFormat() const { return format; } /// Set an object describing the format of file this ID refers to. RIM_INLINE void setFormat( const ResourceFormat& newFormat ) { format = newFormat; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** File Path String Accessor Methods /// Return a reference to the UTF-8 encoded string representing a path to this resource. RIM_INLINE const data::UTF8String& getFilePath() const { return filePath; } /// Set a UTF-8 encoded string representing a path to this resource. RIM_INLINE void setFilePath( const data::UTF8String& newFilePath ) { filePath = newFilePath; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Resource Name Accessor Methods /// Return a UTF-8 encoded string representing the name of the resource for this ID. RIM_INLINE const data::UTF8String& getName() const { return name; } /// Set a UTF-8 encoded string representing the name of the resource for this ID. RIM_INLINE void setName( const data::UTF8String& newName ) { name = newName; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Resource Local ID Accessor Methods /// Return an integer ID for this resource local to the file that can be used to uniquely identify it. /** * If the local ID is unused, it should have a value of -1. */ RIM_INLINE ResourceLocalID getLocalID() const { return localID; } /// Set an integer ID for this resource local to the file that can be used to uniquely identify it. /** * If the local ID is unused, it should have a value of -1. */ RIM_INLINE void setLocalID( ResourceLocalID newLocalID ) { localID = newLocalID; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Comparison Operators /// Return whether or not this resource ID is equal to another. RIM_INLINE Bool operator == ( const ResourceID& other ) const { Bool result = type == other.type && format == other.format && filePath == other.filePath && name == other.name; // Check the local ID if it is valid. if ( result && localID != INVALID_LOCAL_ID && localID == other.localID ) return true; return result; } /// Return whether or not this resource ID is not equal to another. RIM_INLINE Bool operator != ( const ResourceID& other ) const { return !(*this == other); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Hash Code Accessor Method /// Return an integral hash code for this resource ID. RIM_INLINE Hash getHashCode() const { return Hash(type)*Hash(format)*filePath.getHashCode() ^ name.getHashCode(); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Public Static Data Members /// The invalid local ID that indicates the local ID is unused. static const ResourceLocalID INVALID_LOCAL_ID = -1; private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Members /// An object describing the type of this resource. ResourceType type; /// An object describing the format of this resource's file, how it should be interpreted. ResourceFormat format; /// A string representing a path to the resource. data::UTF8String filePath; /// The optional name of the resource within the file. data::UTF8String name; /// An integer ID for this resource local to the file that can be used to uniquely identify it. /** * If the local ID is unused, it should have a value of -1. */ ResourceLocalID localID; }; //########################################################################################## //************************** End Rim Resources Namespace ********************************* RIM_RESOURCES_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_RESOURCE_ID_H <file_sep>/* * rimGraphicsLightAttenuation.h * Rim Graphics * * Created by <NAME> on 5/16/12. * Copyright 2012 __MyCompanyName__. All rights reserved. * */ #ifndef INCLUDE_RIM_GRAPHICS_LIGHT_ATTENUATION_H #define INCLUDE_RIM_GRAPHICS_LIGHT_ATTENUATION_H #include "rimGraphicsLightsConfig.h" //########################################################################################## //************************ Start Rim Graphics Lights Namespace *************************** RIM_GRAPHICS_LIGHTS_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// An object which describes how the intensity of a light decreases with the distance away from the light. class LightAttenuation { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructors /// Create a default light attenuation object. /** * This object is created to have a constant attenuation factor of 1, * a linear attenuation factor of 0, and a quadratic attenuation factor of 0. */ RIM_INLINE LightAttenuation() : constantAttenuation( 1 ), linearAttenuation( 0 ), quadraticAttenuation( 0 ) { } /// Create a light attenuation object with the specified constant, linear, and quadratic attenuation factors. RIM_INLINE LightAttenuation( Real newConstantAttenuation, Real newLinearAttenuation, Real newQuadraticAttenuation ) : constantAttenuation( newConstantAttenuation ), linearAttenuation( newLinearAttenuation ), quadraticAttenuation( newQuadraticAttenuation ) { } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constant Attenuation Accessor Methods /// Get the constant attenuation factor for this light attenuation object. RIM_FORCE_INLINE Real getConstant() const { return constantAttenuation; } /// Set the constant attenuation factor for this light attenuation object. RIM_INLINE void setConstant( Real newConstantAttenuation ) { constantAttenuation = math::max( newConstantAttenuation, Real(0) ); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Linear Attenuation Accessor Methods /// Get the linear attenuation factor for this light attenuation object. RIM_FORCE_INLINE Real getLinear() const { return linearAttenuation; } /// Set the linear attenuation factor for this light attenuation object. RIM_INLINE void setLinear( Real newLinearAttenuation ) { linearAttenuation = math::max( newLinearAttenuation, Real(0) ); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Quadratic Attenuation Accessor Methods /// Get the quadratic attenuation factor for this light attenuation object. RIM_FORCE_INLINE Real getQuadratic() const { return quadraticAttenuation; } /// Set the quadratic attenuation factor for this light attenuation object. RIM_INLINE void setQuadratic( Real newQuadraticAttenuation ) { quadraticAttenuation = math::max( newQuadraticAttenuation, Real(0) ); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Distance Attenuation Calculation Methods /// Calculate and return the attenuation amount at the specified distance. RIM_INLINE Real getAttenuation( Real distance ) const { return Real(1) / (constantAttenuation + distance*linearAttenuation + distance*distance*quadraticAttenuation); } private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Light Attenuation Data Members /// The amount that constant attenuation is applied to the light's brightness. /** * This value will generally range between 0 and 1 (and cannot be negative). It * indicates the 'c' coefficient of the R^1 term in the denominator of the attenuation * equation: attenuation = 1/(c + a*R^1 + q*R^2). */ Real constantAttenuation; /// The amount that linear attenuation is applied to the light's brightness. /** * This value will generally range between 0 and 1 (and cannot be negative). It * indicates the 'a' coefficient of the R^1 term in the denominator of the attenuation * equation: attenuation = 1/(c + a*R^1 + q*R^2). */ Real linearAttenuation; /// The amount that quadratic attenuation is applied to the light's brightness. /** * This value will generally range between 0 and 1 (and cannot be negative). It * indicates the 'q' coefficient of the R^2 term in the denominator of the attenuation * equation: attenuation = 1/(c + a*R^1 + q*R^2). */ Real quadraticAttenuation; }; //########################################################################################## //************************ End Rim Graphics Lights Namespace ***************************** RIM_GRAPHICS_LIGHTS_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_GRAPHICS_LIGHT_ATTENUATION_H <file_sep>/* * rimDay.h * Rim Time * * Created by <NAME> on 11/2/08. * Copyright 2008 __MyCompanyName__. All rights reserved. * */ #ifndef INCLUDE_RIM_DAY_H #define INCLUDE_RIM_DAY_H #include "rimTimeConfig.h" //########################################################################################## //******************************* Start Time Namespace ********************************* RIM_TIME_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class which represents a single day within a week, month, and year of the modern calendar. class Day { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructors /// Create a Day object with the specified day of the week, month, and year indicies, starting at 1. RIM_INLINE Day( Index newDayOfTheWeek, Index newDayOfTheMonth, Index newDayOfTheYear ) : dayOfTheWeek( newDayOfTheWeek ), dayOfTheMonth( newDayOfTheMonth ), dayOfTheYear( newDayOfTheYear ) { } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Day of the Week Accessor Methods /// Get the day of the week index of this Day, starting at 1. RIM_INLINE Index getDayOfTheWeek() const { return dayOfTheWeek; } /// Set the day of the week index of this Day, starting at 1. RIM_INLINE void setDayOfTheWeek( Index newDayOfTheWeek ) { dayOfTheWeek = newDayOfTheWeek; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Day of the Month Accessor Methods /// Get the day of the month index of this Day, starting at 1. RIM_INLINE Index getDayOfTheMonth() const { return dayOfTheMonth; } /// Set the day of the month index of this Day, starting at 1. RIM_INLINE void setDayOfTheMonth( Index newDayOfTheMonth ) { dayOfTheMonth = newDayOfTheMonth; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Day of the Year Accessor Methods /// Get the day of the year index of this Day, starting at 1. RIM_INLINE Index getDayOfTheYear() const { return dayOfTheYear; } /// Set the day of the year index of this Day, starting at 1. RIM_INLINE void setDayOfTheYear( Index newDayOfTheYear ) { dayOfTheYear = newDayOfTheYear; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Name Accessor Methods /// Get the standard name for the day with this day of the week index. /** * If the day does not have a standard name, the empty string is returned. */ data::String getName() const; private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Static Methods /// Initialize the standard day of the week names. static void initializeStandardNames(); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Members /// The index of the day of the week, starting at 1. Index dayOfTheWeek; /// The index of the day of the month, starting at 1. Index dayOfTheMonth; /// The index of the day of the year, starting at 1. Index dayOfTheYear; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Static Data Members /// Standard names for days of the week with standard indices. static util::HashMap<Index,data::String> names; /// Whether or not the standard day names have been initialized. static Bool hasInitializedStandardNames; }; //########################################################################################## //******************************* End Time Namespace *********************************** RIM_TIME_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_DAY_H <file_sep>/* * rimGraphicsGUIBorder.h * Rim Graphics GUI * * Created by <NAME> on 2/10/13. * Copyright 2013 Headspace Systems. All rights reserved. * */ #ifndef INCLUDE_RIM_GRAPHICS_GUI_BORDER_H #define INCLUDE_RIM_GRAPHICS_GUI_BORDER_H #include "rimGraphicsGUIUtilitiesConfig.h" #include "rimGraphicsGUIMargin.h" #include "rimGraphicsGUIBorderType.h" //########################################################################################## //******************* Start Rim Graphics GUI Utilities Namespace ************************* RIM_GRAPHICS_GUI_UTILITIES_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class which describes information about the border for a rectangular region. class Border { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructors /// Create a new border with the specified type and width. /** * The border's frame is set to be the border's width on all sides and the * border's radius is set to be 0. */ RIM_INLINE Border( const BorderType& newType, Float newWidth ) : type( newType ), frame( newWidth ), width( newWidth ), radius( 0 ) { } /// Create a new border with the specified type, width, and radius. /** * The border's frame is set to be the border's width on all sides. */ RIM_INLINE Border( const BorderType& newType, Float newWidth, Float newRadius ) : type( newType ), frame( newWidth ), width( newWidth ), radius( newRadius ) { } /// Create a new border with the specified type, width, radius, and frame. RIM_INLINE Border( const BorderType& newType, Float newWidth, Float newRadius, const Margin& newFrame ) : type( newType ), frame( newFrame ), width( newWidth ), radius( newRadius ) { } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Type Accessor Methods /// Return an object representing the type of this border. RIM_INLINE const BorderType& getType() const { return type; } /// Set the type of this border. RIM_INLINE void setType( const BorderType& newType ) { type = newType; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Frame Accessor Methods /// Return an object representing the frame of the border on all four sides. /** * This object indirectly describes the (potentially non-circular) radii of * curvature for each of the border's 4 corners by describing the frame inset * at each side of the border. */ RIM_INLINE const Margin& getFrame() const { return frame; } /// Set an object representing the frame of the border on all four sides. /** * This object indirectly describes the (potentially non-circular) radii of * curvature for each of the border's 4 corners by describing the frame inset * at each side of the border. */ RIM_INLINE void setFrame( const Margin& newFrame ) { frame = newFrame; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Border Width Accessor Methods /// Return the thickness of this border. RIM_INLINE Float getWidth() const { return width; } /// Set the thickness of this border. RIM_INLINE void setWidth( Float newWidth ) { width = newWidth; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Radius Accessor Methods /// Return the radius of this border's rounded corners. /** * A radius of 0 will result in right-angled corners. */ RIM_INLINE Float getRadius() const { return radius; } /// Return the radius of this border's rounded corners. /** * A radius of 0 will result in right-angled corners. */ RIM_INLINE void setRadius( Float newRadius ) { radius = newRadius; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Content Bounding Box Accessor Methods /// Return the bounding box for the inner content area of the border's given rectangular region. /** * This rectangle is calculated based on the width of this border's frame and * its border type. It is guaranteed to be the largest rectangle that can be * placed within this border if it has the specified outside dimensions. */ RIM_INLINE AABB2f getContentBounds( const AABB2f& borderBounds ) const { return this->getContentFrame().getInnerBounds( borderBounds ); } /// Return the frame for the inner content area of the border's given rectangular region. /** * This is the margin around the edge of the bordered area which indicates * the inset for a content area. This basically returns the maximum width * of the border for all 4 sides. */ RIM_INLINE Margin getContentFrame() const { // Compute the axially-aligned offset for the border based on the radius and border width. Float borderOffset = math::min( width, radius ); return Margin( math::max( borderOffset, frame.left ), math::max( borderOffset, frame.right ), math::max( borderOffset, frame.bottom ), math::max( borderOffset, frame.top ) ); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Border Scaling Methods /// Scale this border by the specified 2D scaling amount and return the resulting scaled border. Border scale( const Vector2f& scale ) const; private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Members /// The type of this border, indicating its visual appearance. BorderType type; /// An object representing the width of the border on all four sides. Margin frame; /// The thickness of this border. Float width; /// The radius of this border's rounded corners. Float radius; }; //########################################################################################## //******************* End Rim Graphics GUI Utilities Namespace *************************** RIM_GRAPHICS_GUI_UTILITIES_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_GRAPHICS_GUI_BORDER_H <file_sep>/* * rimSoundFilterPreset.h * Rim Sound * * Created by <NAME> on 6/4/13. * Copyright 2013 __MyCompanyName__. All rights reserved. * */ #ifndef INCLUDE_RIM_SOUND_FILTER_PRESET_H #define INCLUDE_RIM_SOUND_FILTER_PRESET_H #include "rimSoundFiltersConfig.h" #include "rimSoundFilterState.h" //########################################################################################## //************************ Start Rim Sound Filters Namespace ***************************** RIM_SOUND_FILTERS_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class which represents a preset configuration for a SoundFilter. /** * A sound filter preset contains a SoundFilterState object which stores the * preset configuration, as well as a human-readable name associated with the preset. */ class SoundFilterPreset { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructors /// Create a new sound filter preset with no name or data stored. RIM_INLINE SoundFilterPreset() : state(), name() { } /// Create a new sound filter preset with the specified name and no data stored. RIM_INLINE SoundFilterPreset( const UTF8String& newName ) : state(), name( newName ) { } /// Create a new sound filter preset with the specified name and filter state structure. RIM_INLINE SoundFilterPreset( const UTF8String& newName, const SoundFilterState& newState ) : state( newState ), name( newName ) { } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** State Accessor Methods /// Return a reference to the SoundFilterState object that contains the information for this preset. RIM_INLINE SoundFilterState& getState() { return state; } /// Return a reference to the SoundFilterState object that contains the information for this preset. RIM_INLINE const SoundFilterState& getState() const { return state; } /// Set the SoundFilterState object that contains the information for this preset. RIM_INLINE void setState( const SoundFilterState& newState ) { state = newState; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Name Accessor Methods /// Return the human-readable name of this filter preset. RIM_INLINE const UTF8String& getName() const { return name; } /// Set the human-readable name of this filter preset. RIM_INLINE void setName( const UTF8String& newName ) { name = newName; } private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Members /// An object which stores the filter state associated with this preset. SoundFilterState state; /// The name associated with this preset. UTF8String name; }; //########################################################################################## //************************ End Rim Sound Filters Namespace ******************************* RIM_SOUND_FILTERS_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_SOUND_FILTER_PRESET_H <file_sep>/* * rimGraphicsFramebufferAttachment.h * Rim Graphics * * Created by <NAME> on 10/8/12. * Copyright 2012 __MyCompanyName__. All rights reserved. * */ #ifndef INCLUDE_RIM_GRAPHICS_FRAMEBUFFER_ATTACHMENT_H #define INCLUDE_RIM_GRAPHICS_FRAMEBUFFER_ATTACHMENT_H #include "rimGraphicsTexturesConfig.h" #include "rimGraphicsTextureFormat.h" //########################################################################################## //********************** Start Rim Graphics Textures Namespace *************************** RIM_GRAPHICS_TEXTURES_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class which specifies how a texture should be attached to a Framebuffer. /** * Since a framebuffer has multiple kinds of bitplanes that can be rendered to, * it is necessary to specify how each texture that is attached to the framebuffer * is used. The 3 basic types of attachment points are color, depth, and stencil * attachments. */ class FramebufferAttachment { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Public Enum Declaration /// An enum which specifies the different types of framebuffer attachment points. typedef enum Type { /// An attachment point that is for a color texture. /** * There can be multiple color attachment points (implementation defined maximum). */ COLOR, /// An attachment point that is for a depth texture. /** * There can be only 1 depth attachment point which has index 0. */ DEPTH, /// An attachment point that is for a stencil texture. /** * There can be only 1 stencil attachment point which has index 0. */ STENCIL, /// An undefined attachment point type. UNDEFINED }; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructors /// Create a new framebuffer attachment type with the specified type enum value and index 0. RIM_INLINE FramebufferAttachment( Type newType ) : type( newType ), index( 0 ) { } /// Create a new framebuffer attachment type with the specified type enum value and index. /** * If the specified attachment type is not COLOR, the specified index value is automatically * set to 0 because multiple depth or stencil attachments are not supported. */ RIM_INLINE FramebufferAttachment( Type newType, Index newIndex ) : type( newType ), index( newType == COLOR ? newIndex : 0 ) { } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Attachment Type Accessor Methods /// Return the type of attachment point that this object refers to. RIM_INLINE Type getType() const { return type; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Attachment Index Accessor Methods /// Return the index of the attachment point. /** * This value allows the user to specify multiple color attachments. * Multiple depth or stencil attachments are not supported, index 0 is * the only allowed value. */ RIM_INLINE Index getIndex() const { return index; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Comparison Operators /// Return whether or not this framebuffer attachment point is equal to another. RIM_INLINE Bool operator == ( const FramebufferAttachment& other ) const { return type == other.type && index == other.index; } /// Return whether or not this framebuffer attachment point is not equal to another. RIM_INLINE Bool operator != ( const FramebufferAttachment& other ) const { return type != other.type || index != other.index; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Comparison Operators /// Return whether or not this framebuffer attachment point supports the specified texture format. Bool supportsFormat( TextureFormat format ) const; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** String Representation Accessor Methods /// Return a string representation of the framebuffer attachement type. String toString() const; /// Convert this framebuffer attachement type into a string representation. RIM_INLINE operator String () const { return this->toString(); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Hash Code Accessor Methods /// Return a hash code generated for this framebuffer attachment point. RIM_INLINE Hash getHashCode() const { return Hash(type)*Hash(0x8DA6B343) ^ Hash(index)*Hash(0xD8163841); } private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Members /// An enum value which represents the texture face type. Type type; /// A value indicating the index of the framebuffer attachment point. /** * This value allows the user to specify multiple color attachments. * Multiple depth or stencil attachments are not supported, index 0 is * the only allowed value. */ Index index; }; //########################################################################################## //********************** End Rim Graphics Textures Namespace ***************************** RIM_GRAPHICS_TEXTURES_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_GRAPHICS_FRAMEBUFFER_ATTACHMENT_H <file_sep>/* * rimFileReader.h * Rim IO * * Created by <NAME> on 3/21/08. * Copyright 2008 __MyCompanyName__. All rights reserved. * */ #ifndef INCLUDE_RIM_FILE_READER_H #define INCLUDE_RIM_FILE_READER_H #include "rimIOConfig.h" #include "../rimFileSystem.h" #include "rimDataInputStream.h" #include "rimStringInputStream.h" //########################################################################################## //****************************** Start Rim IO Namespace ********************************** RIM_IO_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class that allows the user to easily read from a file. /** * This purpose of this class is to read from a file in an * object oriented and flexible manner. It allows the user * to read individual bytes (characters), a sequence of characters, * and raw data. One can open and close the file reader, and * manipulate it's position in the file by seeking an absolute * position or moving relatively. It wraps C's standard file in/out. */ class FileReader : public DataInputStream, public StringInputStream { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructors /// Create a FileReader object which should read from the file at the specified path string. FileReader( const Char* filePath ); /// Create a FileReader object which should read from the file at the specified path string. FileReader( const fs::UTF8String& filePath ); /// Create a FileReader object which should read from the file at the specified path. FileReader( const fs::Path& filePath ); /// Create a FileReader object which should read from the specified file. FileReader( const fs::File& file ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Destructor /// Destroy a file reader and free all of it's resources (close the file). RIM_INLINE ~FileReader() { if ( isOpen() ) close(); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** File Reader Open/Close Methods /// Open the file reader, allocating whatever resources needed to do so. /** * This method opens a stream for reading from a file, and * allocates the necessary resources to do so. If the file is already * open, then this method does nothing. If an error occurs during * opening the file reader, such that the file is unable to be opened, then * a IOException is thrown. If the file path specified in the constructor * points to a file that does not exist, then a FileNotFoundException is thrown. */ Bool open(); /// Return whether or not the file reader's file is open. /** * This method gets a boolean value from the file reader indicating * whether or not the file is currently open. If the file is open, * then TRUE is returned, and if it is closed, FALSE is returned. * * @return whether or not the file reader is open */ RIM_INLINE Bool isOpen() const { return stream != NULL; } /// Close the file writer, freeing all resources used during reading. /** * This method closes the file reader, and ensures that all resources * that it used to perform output are freed (such as files, etc.). * If the file reader is currently open, then this method guarantees that * the reader is closed. If the file is unable to be closed, an IOException is * thrown. If the file reader is already closed when the method is called, * then nothing is done. This method is automatically called by the class's * destructor when a file reader is destroyed. */ void close(); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Seek/Move Methods /// Return whether or not this file reader can seek within the file. /** * This method returns TRUE if the file reader is opened and points to * a valid file. Otherwise FALSE is returned. */ virtual Bool canSeek() const; /// Return whether or not this reader can seek by the specified amount in bytes. /** * Since some streams may not support rewinding, this method can be used * to determine if a given seek operation can succeed. The method can also * be used to determine if the end of a stream has been reached, a seek past * the end of a file will fail. */ virtual Bool canSeek( Int64 relativeOffset ) const; /// Move the current position in the file by the specified relative signed offset in bytes. /** * The method attempts to seek in the file by the specified amount and * returns the signed amount that the position in the file was changed by * in bytes. A negative offset indicates that the position should be moved in * reverse and a positive offset indicates that the position should be moved * forwards. The file must be open for the seek operation to succeed. */ virtual Int64 seek( Int64 relativeOffset ); /// Seek to an absolute position in the file. /** * This method attempts to seek to the specified absolute * position in the file, and then returns the resulting * position in the file of the file reader after the method call. * Positions within a file are specified with 0 representing * the beginning of the file, and each positive increment * of 1 representing a position 1 more byte * further in the file. If the file is not open when the method * is called, no seek operation is performed and the current position in * the file is returned. * * @param newFilePosition - The desired position in the file to seek to. * @return the resulting position in the file after the method call. */ LargeIndex seekAbsolute( LargeIndex newFilePosition ); /// Rewind the file pointer to the beginning of the file. /** * This method moves the position in the file of the file reader * to the beginning of the file. The method returns whether or not * the seek operation was successful. The seek operation can fail * if seeking is not allowed or the file is not open. */ Bool seekStart(); /// Seek to the end of the file. /** * This method sets the current position in the file of the file * reader to be the end of the file. The method returns whether or not * the seek operation was successful. The seek operation can fail * if seeking is not allowed or the file is not open. */ Bool seekEnd(); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Position Accessor Methods /// Get the absolute position in the file of the file reader. /** * This method queries and returns the current position in * the file of the file reader. Positions within a file * are specified with 0 representing the beginning of the file, * and each positive increment of 1 representing a position 1 more byte * further in the file. If the file is not open when the method * is called, then a IOException is thrown. * * @return the current position in the file of the file reader. */ virtual LargeIndex getPosition() const; /// Get whether or not the file writer is at the end of the file. /** * This method queries whether or not the file writer is at the * end of the file. If it is, then TRUE is returned, otherwise * FALSE is returned. If the file is not open when the method is * called, then a IOException is thrown. * * @return whether or not the file reader is at the end of the file. */ Bool isAtEndOfFile() const; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** File Attribute Accessor Methods /// Get the file object that this file reader is reading from. /** * This method returns a constant reference to a file object representing * the file that this file reader is associated with. * * @return the file this file reader is associated with. */ RIM_INLINE const fs::File& getFile() const { return file; } /// Get the path to the file that this file reader is reading. /** * This method returns a constant reference to a string representing * the path to the file that this file reader is associated with. * * @return the path to the file this file reader is associated with. */ RIM_INLINE const fs::Path& getFilePath() const { return file.getPath(); } /// Get the size of the file in bytes. /** * This method queries and returns the size of the file * in bytes. The file does not have to be open to do this, but * it does have to exist. If the file does not exist, then * a IOException is thrown. * * @return the total size of the file in bytes. */ RIM_INLINE LargeSize getFileSize() const { return file.getSize(); } /// Get whether or not the file associated with this reader exists. /** * This method checks whether or not the file pointed to by the * path queried by getFilePath() exists. It then returns TRUE * if the file exists or returns FALSE if the file does not exist. * * @return whether or not the file associated with this file reader exists. */ RIM_INLINE Bool fileExists() const { return file.exists(); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Remaining Data Size Accessor Methods /// Return the number of bytes remaining in the file. /** * The value returned must only be a lower bound on the number of bytes * remaining in the stream. If there are bytes remaining, it must return * at least 1. */ virtual LargeSize getBytesRemaining() const; /// Return the number of characters remaining in the stream. /** * The value returned must only be a lower bound on the number of characters * remaining in the stream. If there are characters remaining, it must return * at least 1. */ virtual LargeSize getCharactersRemaining() const; protected: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Protected Read Methods (Declared in StringInputStream/DataInputStream) virtual Size readChars( Char* buffer, Size numChars ); /// Read the specified number of UTF-8 characters from the stream and place them in the specified output buffer. /** * If the number of unicode code points exceeds the capacity of the buffer, as many characters * are read as possible. The number of code points read is returned. */ virtual Size readUTF8Chars( UTF8Char* buffer, Size numChars, Size capacity ); /// Read the specified number of UTF-16 characters from the stream and place them in the specified output buffer. /** * If the number of unicode code points exceeds the capacity of the buffer, as many characters * are read as possible. The number of code points read is returned. */ virtual Size readUTF16Chars( UTF16Char* buffer, Size numChars, Size capacity ); /// Read the specified number of UTF-32 characters from the stream and place them in the specified output buffer. /** * If the number of unicode code points exceeds the capacity of the buffer, as many characters * are read as possible. The number of code points read is returned. */ virtual Size readUTF32Chars( UTF32Char* buffer, Size numChars ); virtual Size readData( UByte* buffer, Size numBytes ); private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Members /// A file object representing the file we are reading from. fs::File file; /// The C standard file stream for the file the reader is reading from. std::FILE* stream; }; //########################################################################################## //****************************** End Rim IO Namespace ************************************ RIM_IO_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_FILE_READER_H <file_sep>/* * rimSoundCutoffFilter.h * Rim Sound * * Created by <NAME> on 7/23/12. * Copyright 2012 __MyCompanyName__. All rights reserved. * */ #ifndef INCLUDE_RIM_SOUND_CUTOFF_FILTER_H #define INCLUDE_RIM_SOUND_CUTOFF_FILTER_H #include "rimSoundFiltersConfig.h" #include "rimSoundFilter.h" //########################################################################################## //************************ Start Rim Sound Filters Namespace ***************************** RIM_SOUND_FILTERS_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class that implements high-pass and low-pass EQ filters of various types and filter orders. class CutoffFilter : public SoundFilter { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Cutoff Filter Type Enum Declaration /// An enum type that denotes a certain class of cutoff filter. typedef enum Type { /// A type of cutoff filter that uses a Bufferworth design. /** * A Butterworth filter is a type of filter that is designed to be as flat as * possible in the passband with no ripple in the stopband. The filter is -3dB at the corner * frequency. */ BUTTERWORTH = 0, /// A type of cutoff filter that uses a Linkwitz-Riley design. /** * A Linkwitz-Riley filter is a type of filter that is designed to be allpass when * summed with a corresponding opposite filter at the crossover frequency. * The filter is -6dB at the corner frequency. * * Linkwitz-Riley filters only support orders 2, 4, 6, and 8 because of their special properties. * Attempting to use an invalid order will result in the next highest valid order being * used. */ LINKWITZ_RILEY = 1, /// A type of cutoff filter that uses a Bessel design. /** * A Bessel filter is a type of filter that is designed to have a maximally * linear phase response. The filter is -3dB at the corner frequency. */ //BESSEL, /// A type of cutoff filter that uses a Chebyshev type I design. /** * A Chebyshev type I filter is a filter that has a steeper rolloff but at the expense * of ripple in the passband. */ CHEBYSHEV_I = 2, /// A type of cutoff filter that uses a Chebyshev type II design. /** * A Chebyshev type II filter is a filter that has a steeper rolloff but at the expense * of ripple in the stopband. */ //CHEBYSHEV_II }; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Filter Direction Enum Declaration /// An enum type that specifies if a filter is high-pass or low-pass. typedef enum Direction { /// A type of filter that filters out all frequencies below the cutoff frequency. HIGH_PASS = 0, /// A type of filter that filters out all frequencies above the cutoff frequency. LOW_PASS = 1 }; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructors /// Create a default 1st order butterworth cutoff filter with corner frequency at 0 Hz. /** * Since 0 Hz is not a valid corner frequency, this filter does not do anything to * the input audio. */ CutoffFilter(); /// Create a cutoff filter with the specified type, direction, order, and corner frequency. /** * The filter order is clamped between 1 and the maximum allowed filter order, * and the corner frequency is clamped to the range of [0,+infinity]. */ CutoffFilter( Type newFilterType, Direction newFilterDirection, Size newFilterOrder, Float newCornerFrequency ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Filter Type Accessor Methods /// Return the type of filter that is being used. /** * Since different types of filters have different characteristics in frequency * and phase response, this value allows the user to pick the filter type best * suited for their needs. */ RIM_INLINE Type getType() const { return filterType; } /// Set the type of filter that is being used. /** * Since different types of filters have different characteristics in frequency * and phase response, this value allows the user to pick the filter type best * suited for their needs. */ RIM_INLINE void setType( Type newFilterType ) { lockMutex(); filterType = newFilterType; recalculateCoefficients(); unlockMutex(); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Filter Direction Accessor Methods /// Return the direction of the filter that is being used. /** * This value determines whether the filter behaves as a high-pass * or low-pass filter. */ RIM_INLINE Direction getDirection() const { return filterDirection; } /// Set the type of filter that is being used. /** * This value determines whether the filter behaves as a high-pass * or low-pass filter. */ RIM_INLINE void setDirection( Direction newFilterDirection ) { lockMutex(); filterDirection = newFilterDirection; recalculateCoefficients(); unlockMutex(); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Filter Order Accessor Methods /// Return the order of this cutoff filter. RIM_INLINE Size getOrder() const { return filterOrder; } /// Set the order of this cutoff filter. /** * If the specified order is not supported by this filter, the closest * order to the desired order is used. * * The new filter order is clamped betwee 1 and the maximum allowed filter order. */ RIM_INLINE void setOrder( Size newFilterOrder ) { lockMutex(); filterOrder = math::clamp( newFilterOrder, Size(1), MAXIMUM_FILTER_ORDER ); recalculateCoefficients(); unlockMutex(); } /// Return the maximum filter order allowed. /** * All created filters will have an order less than or equal to this value * and it is impossible to set the order of a filter to be greater than this * value. */ RIM_INLINE Size getMaximumOrder() const { return MAXIMUM_FILTER_ORDER; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Corner Frequency Accessor Methods /// Return the corner frequency of this cutoff filter. /** * This is the frequency at which the frequency begins to be cut off by the * filter. This is usually the point at which the filter is -3dB down, but * can be -6dB or other for some filter types. */ RIM_INLINE Float getFrequency() const { return cornerFrequency; } /// Set the corner frequency of this cutoff filter. /** * This is the frequency at which the frequency begins to be cut off by the * filter. This is usually the point at which the filter is -3dB down, but * can be -6dB or other for some filter types. * * The new corner frequency is clamped to be in the range [0,+infinity]. */ RIM_INLINE void setFrequency( Float newCornerFrequency ) { lockMutex(); cornerFrequency = math::max( newCornerFrequency, Float(0) ); recalculateCoefficients(); unlockMutex(); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Filter Ripple Accessor Methods /// Return the ripple of this cutoff filter in dB. /** * This parameter is only used by the Chebyshev type I and type II filters. * It determines the amount of ripple in the passband (for type I) or in * the stopband (for type II). A smaller ripple results in a slower * rolloff in the frequency response for any given filter order. * * The ripple amount is initially equal to 1 dB and must be greater than 0. */ RIM_INLINE Float getRipple() const { return ripple; } /// Set the ripple of this cutoff filter in dB. /** * This parameter is only used by the Chebyshev type I and type II filters. * It determines the amount of ripple in the passband (for type I) or in * the stopband (for type II). A smaller ripple results in a slower * rolloff in the frequency response for any given filter order. * * The ripple amount is initially equal to 1 dB and is clamped to be greater than 0. */ RIM_INLINE void setRipple( Float newRipple ) { lockMutex(); ripple = math::max( newRipple, Float(0) ); if ( filterType == CHEBYSHEV_I ) recalculateCoefficients(); unlockMutex(); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Filter Attribute Accessor Methods /// Return a human-readable name for this cutoff filter. /** * The method returns the string "Cutoff Filter". */ virtual UTF8String getName() const; /// Return the manufacturer name of this cutoff filter. /** * The method returns the string "Headspace Sound". */ virtual UTF8String getManufacturer() const; /// Return an object representing the version of this cutoff filter. virtual SoundFilterVersion getVersion() const; /// Return an object which describes the category of effect that this filter implements. /** * This method returns the value SoundFilterCategory::EQUALIZER. */ virtual SoundFilterCategory getCategory() const; /// Return whether or not this cutoff filter can process audio data in-place. /** * This method always returns TRUE, cutoff filters can process audio data in-place. */ virtual Bool allowsInPlaceProcessing() const; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Filter Parameter Accessor Methods /// Return the total number of generic accessible parameters this filter has. virtual Size getParameterCount() const; /// Get information about the parameter at the specified index. virtual Bool getParameterInfo( Index parameterIndex, FilterParameterInfo& info ) const; /// Get any special name associated with the specified value of an indexed parameter. virtual Bool getParameterValueName( Index parameterIndex, const FilterParameter& value, UTF8String& name ) const; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Public Static Property Objects /// A string indicating the human-readable name of this cutoff filter. static const UTF8String NAME; /// A string indicating the manufacturer name of this cutoff filter. static const UTF8String MANUFACTURER; /// An object indicating the version of this cutoff filter. static const SoundFilterVersion VERSION; private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Maximum Filter Order Declaration /// Define the maximum allowed filter order for this cutoff filter class. static const Size MAXIMUM_FILTER_ORDER = 100; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Filter Channel Class Declaration /// A class which contains a history of the last 2 input and output samples for a second order filter. class ChannelHistory { public: RIM_INLINE ChannelHistory() { this->reset(); } RIM_INLINE void reset() { inputHistory[1] = inputHistory[0] = Float(0); outputHistory[1] = outputHistory[0] = Float(0); } /// An array of the last 2 input samples for a filter with order 2. Float inputHistory[2]; /// An array of the last 2 output samples for a filter with order 2. Float outputHistory[2]; }; /// A class which contains coefficients for a 2nd order IIR filter and channel history information. class SecondOrderFilter { public: RIM_INLINE SecondOrderFilter() { } /// The 'a' (numerator) coefficients of the z-domain transfer function. Float a[3]; /// The 'b' (denominator) coefficients of the z-domain transfer function. Float b[2]; /// An array of input and output history information for each channel of this filter. Array<ChannelHistory> channelHistory; }; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Filter Parameter Value Accessor Methods /// Place the value of the parameter at the specified index in the output parameter. virtual Bool getParameterValue( Index parameterIndex, FilterParameter& value ) const; /// Attempt to set the parameter value at the specified index. virtual Bool setParameterValue( Index parameterIndex, const FilterParameter& value ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Stream Reset Method /// A method which is called whenever the filter's stream of audio is being reset. /** * This method allows the filter to reset all parameter interpolation * and processing to its initial state to avoid coloration from previous * audio or parameter values. */ virtual void resetStream(); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Filter Processing Methods /// Apply this cutoff filter to the samples in the input frame and place them in the output frame. virtual SoundFilterResult processFrame( const SoundFilterFrame& inputFrame, SoundFilterFrame& outputFrame, Size numSamples ); /// Apply the current filter to the specified buffers of data using a generic method static void processFilterCascade( const SoundBuffer& inputBuffer, SoundBuffer& outputBuffer, Size numSamples, Size filterOrder, SecondOrderFilter* filterSections ); /// Apply the current linkwitz filter to the specified buffers of data using two butterworth filters in series. void processLinkwitzRiley( const SoundBuffer& inputBuffer, SoundBuffer& outputBuffer, Size numSamples ); /// Apply a first order filter to the specified sample arrays. RIM_FORCE_INLINE static void process1stOrderFilter( const Sample32f* input, Sample32f* output, Size numSamples, const Float a[2], const Float b[1], Float inputHistory[1], Float outputHistory[1] ); /// Apply a second order filter to the specified sample arrays. RIM_FORCE_INLINE static void process2ndOrderFilter( const Sample32f* input, Sample32f* output, Size numSamples, const Float a[3], const Float b[2], Float inputHistory[2], Float outputHistory[2] ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Filter Coefficient Calculation Methods /// Recalculate the filter coefficients for the current filter type, order, and sample rate. void recalculateCoefficients(); /// Get the coefficients for a Butterworth cutoff filter with the specified parameters. /** * This method computes the coefficients for a Butterworth cutoff filter with the * specified filter direction, order, corner frequency (-3dB point), and sample rate. * * The filter sections output array must not be NULL and must have space to hold * ceiling(n/2) filters for a filter of order n. */ static void getButterworthCoefficients( Direction direction, Size order, Float cornerFrequency, SampleRate sampleRate, SecondOrderFilter* filterSections ); /// Get the coefficients for a Chebyshev cutoff filter with the specified parameters. /** * This method computes the coefficients for a Chebyshev cutoff filter with the * specified filter direction, order, corner frequency (-3dB point), and sample rate. * * The filter sections output array must not be NULL and must have space to hold * ceiling(n/2) filters for a filter of order n. */ static void getChebyshev1Coefficients( Direction direction, Size order, Float cornerFrequency, Float ripple, SampleRate sampleRate, SecondOrderFilter* filterSections ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Members /// An enum representing the type of cutoff filter that is being applied. /** * Since different types of filters have different characteristics in frequency * and phase response, this value allows the user to pick the filter type best * suited for their needs. */ Type filterType; /// An enum representing the direction of this cutoff filter. /** * This value specifies whether the filter is a high-pass or low-pass filter. */ Direction filterDirection; /// The order of the cutoff filter, from 1 up to MAXIMUM_FILTER_ORDER. /** * Thie value affects the slope of the filter below the cutoff filter. * A filter of order 1 means that the slope of the filter asymptotically reaches * 6dB per octave. Each additional order of filer increases the slope of the filter * by an additional 6dB per octave. Since some filter types (such as Linkwitz-Riley) * do not support certain filter orders (odd numbered, for instance), those filters * will use the next highest supported filter order as a fallback in those cases. */ Size filterOrder; /// The frequency in hertz of the corner frequency of the cutoff filter. /** * This is the frequency at which the frequency begins to be cut off by the * filter. This is usually the point at which the filter is -3dB down, but * can be -6dB or other for some filter types. */ Float cornerFrequency; /// The ripple (in dB) of the filter if it is a Chebyshev filter. Float ripple; /// The sample rate of the last sample buffer processed. /** * This value is used to detect when the sample rate of the audio stream has changed, * and thus recalculate filter coefficients. */ SampleRate sampleRate; /// An array of cascaded 2nd order filter sections for this cutoff filter. Array<SecondOrderFilter> filterSections; }; //########################################################################################## //************************ End Rim Sound Filters Namespace ******************************* RIM_SOUND_FILTERS_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_SOUND_CUTOFF_FILTER_H <file_sep>/* * rimTime.h * Rim Framework * * Created by <NAME> on 8/16/11. * Copyright 2011 __MyCompanyName__. All rights reserved. * */ #ifndef INCLUDE_RIM_TIME_H #define INCLUDE_RIM_TIME_H #include "rimTimeConfig.h" //########################################################################################## //******************************* Start Time Namespace ********************************* RIM_TIME_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class which represents a high-resolution interval of time. /** * The time interval is represented internally in high precision nanosecond * resolution. The time interval representation is signed and so can be negative. */ class Time { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructors /// Create a Time object that represents a time interval of 0 seconds. RIM_INLINE Time() : nanoseconds( 0 ) { } /// Create a Time object that represents the specified interval of time in nanoseconds. /** * This overload is provided to allow initialization with 0, which might cause ambiguities. */ RIM_INLINE Time( int newNanoseconds ) : nanoseconds( newNanoseconds ) { } /// Create a Time object that represents the specified interval of time in nanoseconds. RIM_INLINE Time( Int64 newNanoseconds ) : nanoseconds( newNanoseconds ) { } /// Create a Time object that represents the specified interval of time in seconds. /** * The time is specified by a single floating-point value that gives * the number of seconds in the time interval. */ RIM_INLINE Time( Double newSeconds ) { Double seconds = math::floor( newSeconds ); Double secondsFraction = newSeconds - seconds; nanoseconds = Int64(seconds)*Int64(1000000000) + Int64(secondsFraction*Double(1.0e9)); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Seconds Accessor Methods /// Return the number of seconds that this Time object represents. RIM_INLINE Double getSeconds() const { return Double(nanoseconds) / Double(1.0e9); } /// Return the number of nanoseconds that this Time object represents. RIM_INLINE Int64 getNanoseconds() const { return nanoseconds; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Time Cast Operators /// Convert this Time object into a floating point representation. /** * Doing this may reduce the accuracy of the time interval due to the * inaccuracies of floating-point formats. */ /*RIM_INLINE operator Float () const { return Float(nanoseconds) / Float(1.0e9); }*/ /// Convert this Time object into a double floating point representation. /** * Doing this may reduce the accuracy of the time interval due to the * inaccuracies of floating-point formats. */ RIM_INLINE operator Double () const { return this->getSeconds(); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Time Comparison Operators /// Return whether or not this Time object represents the same time as another. RIM_INLINE Bool operator == ( const Time& other ) const { return nanoseconds == other.nanoseconds; } /// Return whether or not this Time object represents a different time than another. RIM_INLINE Bool operator != ( const Time& other ) const { return nanoseconds != other.nanoseconds; } /// Return whether or not this Time object represents an earlier time than another. RIM_INLINE Bool operator < ( const Time& other ) const { return nanoseconds < other.nanoseconds; } /// Return whether or not this Time object represents a later time than another. RIM_INLINE Bool operator > ( const Time& other ) const { return nanoseconds > other.nanoseconds; } /// Return whether or not this Time object represents an earlier or equal time than another. RIM_INLINE Bool operator <= ( const Time& other ) const { return nanoseconds < other.nanoseconds; } /// Return whether or not this Time object represents a later or equal time than another. RIM_INLINE Bool operator >= ( const Time& other ) const { return nanoseconds > other.nanoseconds; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Time Arithmetic Operators /// Return the time interval represented by the sum of this time interval and another. RIM_INLINE Time operator + ( const Time& other ) const { return Time( nanoseconds + other.nanoseconds ); } /// Add the specified time interval to this time interval, modifying it. RIM_INLINE Time& operator += ( const Time& other ) { nanoseconds += other.nanoseconds; return *this; } /// Return the time interval represented by the difference between this time interval and another. RIM_INLINE Time operator - ( const Time& other ) const { return Time( nanoseconds - other.nanoseconds ); } /// Subtract the specified time interval from this time interval, modifying it. RIM_INLINE Time& operator -= ( const Time& other ) { nanoseconds -= other.nanoseconds; return *this; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** String Conversion Methods /// Return a string representation of this time object. RIM_INLINE data::String toString() const { return data::String( this->getSeconds() ); } /// Convert this time object to a string representation. RIM_INLINE operator data::String () const { return this->toString(); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Current Time Accessor Method /// Create a time object that represents the current system time. /** * The time is represented as the time that has passed since the Epoch, * 1970-01-01 00:00:00 +0000 (UTC). */ RIM_INLINE static Time getCurrent() { Int64 nanoseconds = 0; getCurrentTime( nanoseconds ); return Time( nanoseconds ); } private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Helper Method /// Get the current system time as the number of nanoseconds since the Epoch, 1970-01-01 00:00:00 +0000 (UTC). /** * The method returns whether or not the current time was successfully queried. */ static Bool getCurrentTime( Int64& nanoseconds ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Members /// The number of nanoseconds that this time interval represents. Int64 nanoseconds; }; //########################################################################################## //******************************* End Time Namespace *********************************** RIM_TIME_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_TIME_H <file_sep>/* * rimEntitySystem.h * Rim Software * * Created by <NAME> on 6/17/14. * Copyright 2014 __MyCompanyName__. All rights reserved. * */ #ifndef INCLUDE_RIM_ENTITY_SYSTEM_H #define INCLUDE_RIM_ENTITY_SYSTEM_H #include "rimEntitiesConfig.h" #include "rimEntityEvent.h" #include "rimEntity.h" //########################################################################################## //************************** Start Rim Entities Namespace ******************************** RIM_ENTITIES_NAMESPACE_START //****************************************************************************************** //########################################################################################## class EntityEngine; //******************************************************************************** //******************************************************************************** //******************************************************************************** /// An interface for classes that operate on entities and their components. class EntitySystem { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructors /// Create a new empty entity system. EntitySystem(); /// Create a copy of the specified entity system. EntitySystem( const EntitySystem& other ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Destructor /// Destroy this entity system, releasing all internal resources. virtual ~EntitySystem(); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Assignment Operator /// Assign the state of another entity system to this one. virtual EntitySystem& operator = ( const EntitySystem& other ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** System Update Methods /// Update the state of all entities in this system for the specified time interval. virtual void update( const Time& dt, EntityEngine* engine = NULL ) = 0; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Entity Accessor Methods /// Return the number of entities that are part of this entity system. virtual Size getEntityCount() const; /// Return whether or not this system contains the specified entity. virtual Bool containsEntity( const Pointer<Entity>& entity ) const; /// Return whether or not this system contains the entity with the specified name. virtual Bool containsEntity( const String& entityName ) const; /// Add an entity to this entity system. /** * The method returns whether or not the entity was successfully added. */ virtual Bool addEntity( const Pointer<Entity>& newEntity ); /// Add an entity to this entity system with the given name. /** * The method returns whether or not the entity was successfully added. */ virtual Bool addEntity( const Pointer<Entity>& newEntity, const String& newName ); /// Remove the specified entity from this system. /** * The method returns whether or not the entity was successfully removed. */ virtual Bool removeEntity( const Pointer<Entity>& entity ); /// Remove the entity with the specified name from this system. /** * The method returns whether or not the entity was successfully removed. */ virtual Bool removeEntity( const String& entityName ); /// Remove all entities from this system. virtual void clearEntities(); /// Return whether or not this entity system is able to use the specified entity. /** * The method returns TRUE if the entity has any of the system's supported * component types. */ Bool supportsEntity( const Entity& entity ) const; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Component Type Accessor Methods /// Return the number of component types that this entity system operates on. RIM_INLINE Size getComponentTypeCount() const { return componentTypes.getSize(); } /// Return whether or not this entity system supports the templated component type. template < typename ComponentType > RIM_INLINE Bool supportsComponentType() const { ComponentTypeInfo<ComponentType> typeInfo; for ( Index i = 0; i < componentTypes.getSize(); i++ ) { if ( componentTypes[i]->equals( typeInfo ) ) { util::destruct( componentTypes[i] ); componentTypes.removeAtIndexUnordered( i ); return true; } } return false; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Event Type Accessor Methods /// Return the number of event types that this system responds to. RIM_INLINE Size getEventTypeCount() const { return eventTypes.getSize(); } /// Return a reference to the event type for this sytem at the specified index. RIM_INLINE const EventType& getEventType( Index typeIndex ) const { return eventTypes[typeIndex]; } protected: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Protected Class Declarations /// An object which encapsulates a component and entity pair. template < typename ComponentType > class EntityComponent { public: /// Create a new entity-component pair for the specified entity and component. RIM_INLINE EntityComponent( const Pointer<Entity>& newEntity, const Pointer<ComponentType>& newComponent ) : entity( newEntity ), component( newComponent ) { } /// A pointer to the entity for this entity-component pair. Pointer<Entity> entity; /// A pointer to the component data for this entity-component pair. Pointer<ComponentType> component; }; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Protected Component Type Accessor Methods /// Add the templated type to the list of supported component types for this entity system. /** * The method returns whether or not the type was successfully added. */ template < typename ComponentType > RIM_INLINE Bool addComponentType() { // Make sure the type does not already exist. ComponentTypeInfo<ComponentType> typeInfo; for ( Index i = 0; i < componentTypes.getSize(); i++ ) { if ( componentTypes[i]->equals( typeInfo ) ) return false; } componentTypes.add( util::construct< ComponentTypeInfoList<ComponentType> >() ); return true; } /// Remove the templated type from the list of supported component types for this entity system. /** * The method returns whether or not the type was successfully removed. */ template < typename ComponentType > RIM_INLINE Bool removeComponentType() { ComponentTypeInfo<ComponentType> typeInfo; for ( Index i = 0; i < componentTypes.getSize(); i++ ) { if ( componentTypes[i]->equals( typeInfo ) ) { util::destruct( componentTypes[i] ); componentTypes.removeAtIndexUnordered( i ); return true; } } return false; } /// Remove all supported component types from this entity system. void clearComponentTypes(); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Protected Component Accessor Methods /// Return a pointer to the list of components for each entity in this system. template < typename ComponentType > RIM_INLINE const ArrayList< EntityComponent<ComponentType> >* getComponentList() const { // Find the component list with this type. ComponentTypeInfo<ComponentType> typeInfo; for ( Index i = 0; i < componentTypes.getSize(); i++ ) { if ( componentTypes[i]->equals( typeInfo ) ) return &((ComponentTypeInfoList<ComponentType>*)componentTypes[i])->components; } return NULL; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Protected Event Type Accessor Methods /// Add a new event type to the list of event types that this system can handle. RIM_INLINE void addEventType( const EventType& newType ) { eventTypes.add( newType ); } private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Class Declarations /// The base class for objects that store the component types that an entity system supports. class ComponentTypeInfoBase { public: virtual ~ComponentTypeInfoBase() { } /// Construct and return a pointer to a copy of this type info object. virtual ComponentTypeInfoBase* copy() const = 0; /// Return whether or not this type info is equal to another. virtual Bool equals( const ComponentTypeInfoBase& other ) = 0; /// Return whether or not an entity has a component of this type. virtual Bool supportsEntity( const Entity& entity ) const = 0; /// Add the components of this entity with this component type to the list of components. virtual Bool addEntity( const Pointer<Entity>& entity ) { return false; } /// Remove the entity at the specified index, setting its component pointers to NULL in-place. virtual Bool removeEntity( const Pointer<Entity>& entity ) { return false; } /// Remove all entities from this component type. virtual void clearEntities() { } }; /// A template class that stores the runtime type of a supported system component type. template < typename ComponentType > class ComponentTypeInfo : public ComponentTypeInfoBase { public: /// Construct and return a pointer to a copy of this type info object. virtual ComponentTypeInfoBase* copy() const { return util::construct< ComponentTypeInfo<ComponentType> >( *this ); } /// Return whether or not this type info is equal to another. virtual Bool equals( const ComponentTypeInfoBase& other ) { return dynamic_cast<const ComponentTypeInfo<ComponentType>*>( &other ) != NULL; } /// Return whether or not an entity has a component of this type. virtual Bool supportsEntity( const Entity& entity ) const { return entity.getComponent<ComponentType>() != NULL; } }; /// A template class that stores the runtime type of a supported system component type. template < typename ComponentType > class ComponentTypeInfoList : public ComponentTypeInfo<ComponentType> { public: /// Construct and return a pointer to a copy of this type info object. virtual ComponentTypeInfoBase* copy() const { return util::construct< ComponentTypeInfoList<ComponentType> >( *this ); } /// Add the components of this entity with this component type to the list of components. virtual Bool addEntity( const Pointer<Entity>& entity ) { // Get the entity components for this type. const ArrayList< Component<ComponentType> >* entityComponents = entity->getComponents<ComponentType>(); // If the entity does not have any components of this type, return failure. if ( entityComponents == NULL ) return false; /// Add all of the entities components of this type to the list of components for that entity. for ( Index i = 0; i < entityComponents->getSize(); i++ ) components.add( EntityComponent<ComponentType>( entity, (*entityComponents)[i].getValue() ) ); return true; } /// Remove the entity at the specified index, setting its component pointers to NULL in-place. virtual Bool removeEntity( const Pointer<Entity>& entity ) { const Size numComponents = components.getSize(); for ( Index i = 0; i < numComponents; ) { if ( components[i].entity == entity ) { components.removeAtIndexUnordered(i); continue; } i++; } return true; } /// Remove all entities from this component type. virtual void clearEntities() { components.clear(); } /// A map from entity pointers to components of this type. ArrayList< EntityComponent<ComponentType> > components; }; /// A class that encapsulates information about an entity that is part of this system. class EntityInfo; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Helper Methods /// Create and return a pointer to a new entity info object for the specified entity. const Pointer<EntityInfo>& newEntityInfo( const Pointer<Entity>& entity ); /// Create and return a pointer to a new entity info object for the specified named entity. const Pointer<EntityInfo>& newEntityInfo( const Pointer<Entity>& entity, const String& entityName ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Members /// A list of the component types supported by this system. ArrayList<ComponentTypeInfoBase*> componentTypes; /// A list of information for all of the entities in this system. ArrayList< Pointer<EntityInfo> > entities; /// A list of entity indices that were previously used but no longer. ArrayList<Index> unusedEntityIndices; /// A map from entity names to information about the entities. HashMap< String, Pointer<EntityInfo> > entityNameMap; /// A map from entities to information about the entities. HashMap< Pointer<Entity>, Pointer<EntityInfo> > entityMap; /// A list of the event types that this system reponds to. ArrayList<EventType> eventTypes; }; //########################################################################################## //************************** End Rim Entities Namespace ********************************** RIM_ENTITIES_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_ENTITY_SYSTEM_H <file_sep>/* * rimGraphicsShaderProgramAssetTranscoder.h * Rim Software * * Created by <NAME> on 6/29/14. * Copyright 2014 __MyCompanyName__. All rights reserved. * */ #ifndef INCLUDE_RIM_GRAPHICS_SHADER_PROGRAM_ASSET_TRANSCODER_H #define INCLUDE_RIM_GRAPHICS_SHADER_PROGRAM_ASSET_TRANSCODER_H #include "rimGraphicsAssetsConfig.h" #include "rimGraphicsShaderProgramAssetTranscoder.h" //########################################################################################## //*********************** Start Rim Graphics Assets Namespace **************************** RIM_GRAPHICS_ASSETS_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class which encodes and decodes graphics shader program code to the asset format. class GraphicsShaderProgramAssetTranscoder : public AssetTypeTranscoder<GenericShaderProgram> { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Destructor //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Text Encoding/Decoding Methods /// Decode an object from the specified string stream, returning a pointer to the final object. virtual Pointer<GenericShaderProgram> decodeText( const AssetType& assetType, const AssetObject& assetObject, ResourceManager* resourceManager = NULL ); /// Encode an object of this asset type into a text-based format. virtual Bool encodeText( UTF8StringBuffer& buffer, ResourceManager* resourceManager, const GenericShaderProgram& shaderProgram ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Public Static Data Members /// An object indicating the asset type for a graphics shader program. static const AssetType SHADER_PROGRAM_ASSET_TYPE; private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Type Declarations /// An enum describing the fields that a graphics shader program can have. typedef enum Field { /// An undefined field. UNDEFINED = 0, /// "language" The shading language of this shader program. LANGUAGE, /// "shaders" A list of the shader sources in this shader program. SHADERS, /// "configuration" A shader configuration for this program. CONFIGURATION }; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Helper Methods /// Return an enum value indicating the field indicated by the given field name. static Field getFieldType( const AssetObject::String& name ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Memberss /// A temporary asset object used when parsing shader program child objects. AssetObject tempObject; }; //########################################################################################## //*********************** End Rim Graphics Assets Namespace ****************************** RIM_GRAPHICS_ASSETS_NAMESPACE_END //****************************************************************************************** //########################################################################################## //########################################################################################## //**************************** Start Rim Assets Namespace ******************************** RIM_ASSETS_NAMESPACE_START //****************************************************************************************** //########################################################################################## template <> RIM_INLINE const AssetType& AssetType::of<rim::graphics::shaders::GenericShaderProgram>() { return rim::graphics::assets::GraphicsShaderProgramAssetTranscoder::SHADER_PROGRAM_ASSET_TYPE; } //########################################################################################## //**************************** End Rim Assets Namespace ********************************** RIM_ASSETS_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_GRAPHICS_SHADER_PROGRAM_ASSET_TRANSCODER_H <file_sep>/* * rimGraphicsConstantUsage.h * Rim Graphics * * Created by <NAME> on 1/13/11. * Copyright 2011 Rim Software. All rights reserved. * */ #ifndef INCLUDE_RIM_GRAPHICS_CONSTANT_USAGE_H #define INCLUDE_RIM_GRAPHICS_CONSTANT_USAGE_H #include "rimGraphicsShadersConfig.h" //########################################################################################## //*********************** Start Rim Graphics Shaders Namespace *************************** RIM_GRAPHICS_SHADERS_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class which specifies how a constant is semantically used for rendering. /** * Each instance allows the user to specify an enum value indicating the * type of usage and also an integral index for that usage. This allows the user * to specify multiple light-position usages, for instance. */ class ConstantUsage { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** ConstantUsage Usage Enum Definition typedef enum Enum { /// An undefined constant usage. UNDEFINED, //****************************************************************** // Material attributes. /// The 3 or 4 component diffuse color of a material surface. DIFFUSE_COLOR, /// The 3 or 4 component specular color of a material surface. SPECULAR_COLOR, /// The 3 or 4 component ambient color of a material surface. AMBIENT_COLOR, /// A scalar value between 0 and 1 that indicates how bright the material's specular highlight should be. REFLECTIVITY, /// The scalar floating-point phong exponent for a material. PHONG_EXPONENT, /// The index of refraction of a material. INDEX_OF_REFRACTION, //****************************************************************** // Matrix attributes. /// The 4x4 transformation matrix from object space to world space. MODEL_MATRIX, /// The 4x4 transformation matrix from object space to world space. INVERSE_MODEL_MATRIX, /// The 4x4 transformation matrix from view to world space. VIEW_MATRIX, /// The 4x4 transformation matrix from world to view space. INVERSE_VIEW_MATRIX, /// The 4x4 transformation matrix from object to world to view space. MODEL_VIEW_MATRIX, /// The 4x4 projection matrix for the current view. PROJECTION_MATRIX, /// The modelview matrix multiplied by the projection matrix (P*Mv). MODEL_VIEW_PROJECTION_MATRIX, /// The upper-left 3x3 section of the inverse of the transpose of the model matrix. MODEL_NORMAL_MATRIX, /// The upper-left 3x3 section of the inverse of the transpose of the model view matrix. MODEL_VIEW_NORMAL_MATRIX, /// The 4x4 transformation matrix from bone to model-space. BONE_MATRIX, //****************************************************************** // Lighting attributes for directional lights /// The 3d vector specifying the direction to a directional light in world space. DIRECTIONAL_LIGHT_DIRECTION, /// The 3d vector specifying the direction to a directional light in view space. DIRECTIONAL_LIGHT_VIEW_SPACE_DIRECTION, /// The 3d vector specifying the direction of maximum highlights for a directional light in view space. DIRECTIONAL_LIGHT_VIEW_SPACE_HALF_VECTOR, /// The 3 or 4 component diffuse color of a directional light source. DIRECTIONAL_LIGHT_DIFFUSE_COLOR, /// The 3 or 4 component specular color of a directional light source. DIRECTIONAL_LIGHT_SPECULAR_COLOR, /// The 3 or 4 component ambient color of a directional light source. DIRECTIONAL_LIGHT_AMBIENT_COLOR, /// The 4x4 matrix transforming view-space positions into shadow map texture coordinate space for a directional light. DIRECTIONAL_LIGHT_SHADOW_TEXTURE_MATRIX, /// The 4x4 matrix transforming view-space positions into texture coordinates for a directional light shadow map cascade. DIRECTIONAL_LIGHT_CSM_MATRIX_0, DIRECTIONAL_LIGHT_CSM_MATRIX_1 = DIRECTIONAL_LIGHT_CSM_MATRIX_0 + 1, DIRECTIONAL_LIGHT_CSM_MATRIX_2 = DIRECTIONAL_LIGHT_CSM_MATRIX_0 + 2, DIRECTIONAL_LIGHT_CSM_MATRIX_3 = DIRECTIONAL_LIGHT_CSM_MATRIX_0 + 3, DIRECTIONAL_LIGHT_CSM_MATRIX_4 = DIRECTIONAL_LIGHT_CSM_MATRIX_0 + 4, DIRECTIONAL_LIGHT_CSM_MATRIX_5 = DIRECTIONAL_LIGHT_CSM_MATRIX_0 + 5, DIRECTIONAL_LIGHT_CSM_MATRIX_6 = DIRECTIONAL_LIGHT_CSM_MATRIX_0 + 6, DIRECTIONAL_LIGHT_CSM_MATRIX_7 = DIRECTIONAL_LIGHT_CSM_MATRIX_0 + 7, /// A 2d vector specifying the horizontal and vertical resolution for a directional light shadow map. DIRECTIONAL_LIGHT_SHADOW_MAP_SIZE, //****************************************************************** // Lighting attributes for point lights /// The 3d or 4d vector specifying the position of a point light in world space. POINT_LIGHT_POSITION, /// The 3d or 4d vector specifying the position of a point light in view space. POINT_LIGHT_VIEW_SPACE_POSITION, /// The 3 or 4 component diffuse color of a point light source. POINT_LIGHT_DIFFUSE_COLOR, /// The 3 or 4 component specular color of a point light source. POINT_LIGHT_SPECULAR_COLOR, /// The 3 or 4 component ambient color of a point light source. POINT_LIGHT_AMBIENT_COLOR, /// The scalar constant attenuation of a spot light source. POINT_LIGHT_CONSTANT_ATTENUATION, /// The scalar linear attenuation of a spot light source. POINT_LIGHT_LINEAR_ATTENUATION, /// The scalar quadratic attenuation of a spot light source. POINT_LIGHT_QUADRATIC_ATTENUATION, /// The 4x4 projection matrix for each of the faces of a point light cube shadow map. POINT_LIGHT_SHADOW_CUBE_PROJECTION_MATRIX, //****************************************************************** // Lighting attributes for spot lights /// The 3d or 4d vector specifying the position of a spot light in world space. SPOT_LIGHT_POSITION, /// The 3d or 4d vector specifying the position of a spot light in view space. SPOT_LIGHT_VIEW_SPACE_POSITION, /// The 3d vector specifying the direction of a spot light in world space. SPOT_LIGHT_DIRECTION, /// The 3d vector specifying the direction of a light in view space. SPOT_LIGHT_VIEW_SPACE_DIRECTION, /// The scalar spot cutoff angle in radians of a spot light. SPOT_LIGHT_CUTOFF, /// The cosine of the scalar spot cutoff angle of a spot light. SPOT_LIGHT_COSINE_CUTOFF, /// The the scalar spot falloff angle of a spot light. SPOT_LIGHT_FALLOFF, /// The cosine of the scalar spot falloff angle of a spot light. SPOT_LIGHT_COSINE_FALLOFF, /// The scalar falloff of the spot light from the light's direction. SPOT_LIGHT_EXPONENT, /// The 3 or 4 component diffuse color of a spot light source. SPOT_LIGHT_DIFFUSE_COLOR, /// The 3 or 4 component specular color of a spot light source. SPOT_LIGHT_SPECULAR_COLOR, /// The 3 or 4 component ambient color of a spot light source. SPOT_LIGHT_AMBIENT_COLOR, /// The scalar constant attenuation of a spot light source. SPOT_LIGHT_CONSTANT_ATTENUATION, /// The scalar linear attenuation of a spot light source. SPOT_LIGHT_LINEAR_ATTENUATION, /// The scalar quadratic attenuation of a spot light source. SPOT_LIGHT_QUADRATIC_ATTENUATION, /// The 4x4 matrix transforming view-space positions into shadow map texture coordinate space for a spot light SPOT_LIGHT_SHADOW_TEXTURE_MATRIX, /// A 2d vector specifying the horizontal and vertical resolution for a spot light shadow map. SPOT_LIGHT_SHADOW_MAP_SIZE, //****************************************************************** // Shadow Attributes /// A factor by which the depth should be scaled when rendering a shadow map. SHADOW_DEPTH_BIAS, //****************************************************************** // GUI Attributes /// The 3 or 4 component background color for a GUI object. GUI_BACKGROUND_COLOR, /// The 3 or 4 component border color for a GUI object. GUI_BORDER_COLOR, /// The scalar radius of the border bevels for a GUI object. GUI_BORDER_RADIUS, /// The scalar width of the border line for a GUI object. GUI_BORDER_WIDTH, /// The 3 or 4 component color that is used to shade (multiply) images displayed in a GUI. GUI_IMAGE_COLOR, /// The 3 or 4 component color to use for rendering text in a GUI. GUI_TEXT_COLOR, /// The size of a rendered pixel in the local coordinate space of a GUI object. GUI_PIXEL_SIZE, //****************************************************************** // Sound Attributes /// The fraction of sound that hits a surface that is reflected, per frequency. SOUND_REFLECTIVITY, /// The fraction of reflected sound that hits a surface that is scattered, per frequency. SOUND_SCATTERING, /// The fraction of sound that is not reflected that is transmitted through the material, per frequency. SOUND_TRANSMISSION }; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructors /// Create a new constant usage with the specified constant usage enum value. RIM_INLINE ConstantUsage( Enum newUsage ) : usage( newUsage ), index( 0 ) { } /// Create a new constant usage with the specified usage enum value and index. RIM_INLINE ConstantUsage( Enum newUsage, Index newIndex ) : usage( newUsage ), index( (UInt16)newIndex ) { } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Enum Cast Operator /// Convert this constant usage to an enum value. RIM_INLINE operator Enum () const { return (Enum)usage; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Equality Comparison Operators /// Return whether or not this constant usage is the same as another. RIM_INLINE Bool operator == ( const ConstantUsage& other ) const { return *((UInt32*)this) == *((UInt32*)&other); } /// Return whether or not this constant usage is the same as another. /** * This operator does not compare any usage index, just the usage type. */ RIM_INLINE Bool operator == ( ConstantUsage::Enum other ) const { return usage == other; } /// Return whether or not this constant usage is different than another. RIM_INLINE Bool operator != ( const ConstantUsage& other ) const { return *((UInt32*)this) != *((UInt32*)&other); } /// Return whether or not this constant usage is different than another. /** * This operator does not compare any usage index, just the usage type. */ RIM_INLINE Bool operator != ( ConstantUsage::Enum other ) const { return usage != other; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Shader Attribute Type Accessor Method /// Return whether or not the specified attribute type is a valid type for this usage. Bool isValidType( const AttributeType& type ) const; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Index Accessor Methods /// Return an index for the constant usage. /** * This value allows the user to keep track of multiple distinct * usages separately (i.e. for multiple lights) that have the * same usage type. */ RIM_FORCE_INLINE Index getIndex() const { return index; } /// Return an index for the constant usage. /** * This value allows the user to keep track of multiple distinct * usages separately (i.e. for multiple lights) that have the * same usage type. */ RIM_FORCE_INLINE void setIndex( Index newIndex ) { index = (UInt16)newIndex; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** String Representation Accessor Methods /// Return a unique string for this constant usage that matches its enum value name. String toEnumString() const; /// Return a constant usage which corresponds to the given enum string. static ConstantUsage fromEnumString( const String& enumString ); /// Return a string representation of the constant usage. String toString() const; /// Convert this constant usage into a string representation. RIM_FORCE_INLINE operator String () const { return this->toString(); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Hash Code Accessor Method /// Return a hash code for this constant usage. RIM_FORCE_INLINE Hash getHashCode() const { return Hash(usage)*14111677 + Hash(index); } private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Members /// An enum for the constant usage. UInt16 usage; /// The index of the usage specified by the enum value. /** * This value allows the user to keep track of multiple distinct * usages separately (i.e. for multiple lights) that have the * same usage type. */ UInt16 index; }; //########################################################################################## //*********************** End Rim Graphics Shaders Namespace ***************************** RIM_GRAPHICS_SHADERS_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_GRAPHICS_CONSTANT_USAGE_H <file_sep>/* * rimDataInputStream.h * Rim IO * * Created by <NAME> on 10/29/08. * Copyright 2008 __MyCompanyName__. All rights reserved. * */ #ifndef INCLUDE_RIM_DATA_INPUT_STREAM_H #define INCLUDE_RIM_DATA_INPUT_STREAM_H #include "rimIOConfig.h" //########################################################################################## //****************************** Start Rim IO Namespace ********************************** RIM_IO_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class/interface which represents an abstract read-only stream of data. class DataInputStream { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructor /// Create a DataInputStream with the native endianness. RIM_INLINE DataInputStream() { } /// Create a DataInputStream with the specified endianness. RIM_INLINE DataInputStream( data::Endianness newEndianness ) : endianness( newEndianness ) { } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Destructor /// Destroy an input stream and free all of it's resources (close it). virtual ~DataInputStream() { } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Primitive Type Read Methods /// Read a single signed 8-bit integer into the output parameter. /** * If the reading operation succeeds, the 8-bit integer is placed in * the output reference paramter, the stream is advanced by 1 byte, * and TRUE is returned. Otherwise, FALSE is returned, no data is * written to the output parameter, and the position of the stream is * undefined. */ RIM_INLINE Bool read( Int8& value ) { return this->readData( (UByte*)&value, sizeof(Int8) ) == sizeof(Int8); } RIM_INLINE Size read( Int8* buffer, Size number ) { if ( buffer == NULL ) return 0; return this->readData( (UByte*)buffer, number ); } /// Read a single unsigned 8-bit integer into the output parameter. /** * If the reading operation succeeds, the 8-bit integer is placed in * the output reference paramter, the stream is advanced by 1 byte, * and TRUE is returned. Otherwise, FALSE is returned, no data is * written to the output parameter, and the position of the stream is * undefined. */ RIM_INLINE Bool read( UInt8& value ) { return this->readData( (UByte*)&value, sizeof(UInt8) ) == sizeof(UInt8); } /// Read a single signed 16-bit integer into the output parameter. /** * If the reading operation succeeds, the 64-bit integer is placed in * the output reference paramter, the stream is advanced by 2 bytes, * and TRUE is returned. Otherwise, FALSE is returned, no data is * written to the output parameter, and the position of the stream is * undefined. * * The method converts the value into the native platform endianness, * based on the current endianness of the stream. */ RIM_INLINE Bool read( Int16& value ) { Bool success = this->readData( (UByte*)&value, sizeof(Int16) ) == sizeof(Int16); value = endianness.convertToNative( value ); return success; } RIM_INLINE Size read( Int16* buffer, Size number ) { if ( buffer == NULL ) return 0; return this->readPrimitives( buffer, number ); } /// Read a single unsigned 16-bit integer into the output parameter. /** * If the reading operation succeeds, the 16-bit integer is placed in * the output reference paramter, the stream is advanced by 2 bytes, * and TRUE is returned. Otherwise, FALSE is returned, no data is * written to the output parameter, and the position of the stream is * undefined. * * The method converts the value into the native platform endianness, * based on the current endianness of the stream. */ RIM_INLINE Bool read( UInt16& value ) { Bool success = this->readData( (UByte*)&value, sizeof(UInt16) ) == sizeof(UInt16); value = endianness.convertToNative( value ); return success; } RIM_INLINE Size read( UInt16* buffer, Size number ) { if ( buffer == NULL ) return 0; return this->readPrimitives( buffer, number ); } /// Read a single signed 32-bit integer into the output parameter. /** * If the reading operation succeeds, the 32-bit integer is placed in * the output reference paramter, the stream is advanced by 4 bytes, * and TRUE is returned. Otherwise, FALSE is returned, no data is * written to the output parameter, and the position of the stream is * undefined. * * The method converts the value into the native platform endianness, * based on the current endianness of the stream. */ RIM_INLINE Bool read( Int32& value ) { Bool success = this->readData( (UByte*)&value, sizeof(Int32) ) == sizeof(Int32); value = endianness.convertToNative( value ); return success; } RIM_INLINE Size read( Int32* buffer, Size number ) { if ( buffer == NULL ) return 0; return this->readPrimitives( buffer, number ); } /// Read a single unsigned 32-bit integer into the output parameter. /** * If the reading operation succeeds, the 32-bit integer is placed in * the output reference paramter, the stream is advanced by 4 bytes, * and TRUE is returned. Otherwise, FALSE is returned, no data is * written to the output parameter, and the position of the stream is * undefined. * * The method converts the value into the native platform endianness, * based on the current endianness of the stream. */ RIM_INLINE Bool read( UInt32& value ) { Bool success = this->readData( (UByte*)&value, sizeof(UInt32) ) == sizeof(UInt32); value = endianness.convertToNative( value ); return success; } RIM_INLINE Size read( UInt32* buffer, Size number ) { if ( buffer == NULL ) return 0; return this->readPrimitives( buffer, number ); } /// Read a single signed 64-bit integer into the output parameter. /** * If the reading operation succeeds, the 64-bit integer is placed in * the output reference paramter, the stream is advanced by 8 bytes, * and TRUE is returned. Otherwise, FALSE is returned, no data is * written to the output parameter, and the position of the stream is * undefined. * * The method converts the value into the native platform endianness, * based on the current endianness of the stream. */ RIM_INLINE Bool read( Int64& value ) { Bool success = this->readData( (UByte*)&value, sizeof(Int64) ) == sizeof(Int64); value = endianness.convertToNative( value ); return success; } RIM_INLINE Size read( Int64* buffer, Size number ) { if ( buffer == NULL ) return 0; return this->readPrimitives( buffer, number ); } /// Read a single unsigned 64-bit integer into the output parameter. /** * If the reading operation succeeds, the 64-bit integer is placed in * the output reference paramter, the stream is advanced by 8 bytes, * and TRUE is returned. Otherwise, FALSE is returned, no data is * written to the output parameter, and the position of the stream is * undefined. * * The method converts the value into the native platform endianness, * based on the current endianness of the stream. */ RIM_INLINE Bool read( UInt64& value ) { Bool success = this->readData( (UByte*)&value, sizeof(UInt64) ) == sizeof(UInt64); value = endianness.convertToNative( value ); return success; } RIM_INLINE Size read( UInt64* buffer, Size number ) { if ( buffer == NULL ) return 0; return this->readPrimitives( buffer, number ); } /// Read a single 32-bit floating-point value into the output parameter. /** * If the reading operation succeeds, the 32-bit float is placed in * the output reference paramter, the stream is advanced by 4 bytes, * and TRUE is returned. Otherwise, FALSE is returned, no data is * written to the output parameter, and the position of the stream is * undefined. * * The method converts the value into the native platform endianness, * based on the current endianness of the stream. */ RIM_INLINE Bool read( Float& value ) { Bool success = this->readData( (UByte*)&value, sizeof(Float) ) == sizeof(Float); value = endianness.convertToNative( value ); return success; } RIM_INLINE Size read( Float* buffer, Size number ) { if ( buffer == NULL ) return 0; return this->readPrimitives( buffer, number ); } /// Read a single 64-bit floating-point value into the output parameter. /** * If the reading operation succeeds, the 64-bit float is placed in * the output reference paramter, the stream is advanced by 8 bytes, * and TRUE is returned. Otherwise, FALSE is returned, no data is * written to the output parameter, and the position of the stream is * undefined. * * The method converts the value into the native platform endianness, * based on the current endianness of the stream. */ RIM_INLINE Bool read( Double& value ) { Bool success = this->readData( (UByte*)&value, sizeof(Double) ) == sizeof(Double); value = endianness.convertToNative( value ); return success; } RIM_INLINE Size read( Double* buffer, Size number ) { if ( buffer == NULL ) return 0; return this->readPrimitives( buffer, number ); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Data Read Methods /// Read the specified number of bytes from the stream and place them in the buffer given by a pointer. /** * The buffer must be large enough to hold the specified number of bytes. The number * of bytes read can be less than the desired number if an error is encountered or the * end of the stream is reached. * * If the method succeeds, the return value will equal the parameter numBytes and * the stream will be advanced by that many bytes. Otherwise, the return value will * be less than the parameter numBytes, indicating the amount that the stream position * changed. * * @param buffer - a pointer to a buffer where the read data should be placed. * @param numBytes - the number of bytes of data to read from the stream. * @return the number of bytes that were actually read and placed in the buffer. */ RIM_INLINE Size read( UByte* buffer, Size numBytes ) { if ( buffer == NULL ) return 0; return readData( buffer, numBytes ); } /// Read the specified number of bytes from the stream and place them in the specified data buffer. Size read( data::DataBuffer& buffer, Size numBytes ); /// Read as many bytes from the stream as possible and return them in a Data object. data::Data readAllData(); /// Read as many bytes from the stream as possible and place them in the specified data buffer. /** * The method returns the total number of bytes written to the buffer. */ Size readAllData( data::DataBuffer& buffer ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Seeking Methods /// Return whether or not this type of stream allows seeking. /** * Some types of IO (like files) allow seeking, but others, especially those * over networks don't allow streaming. This method allows the user to detect * that situation. */ virtual Bool canSeek() const = 0; /// Return whether or not this stream can seek by the specified amount in bytes. /** * Since some streams may not support rewinding, this method can be used * to determine if a given seek operation can succeed. The method can also * be used to determine if the end of a stream has been reached, a seek past * the end of a file will fail. */ virtual Bool canSeek( Int64 relativeOffset ) const = 0; /// Move the current position in the stream by the specified relative signed offset in bytes. /** * The method attempts to seek in the stream by the specified amount and * returns the signed amount that the position in the stream was changed by * in bytes. A negative offset indicates that the position should be moved in * reverse and a positive offset indicates that the position should be moved * forwards. */ virtual Int64 seek( Int64 relativeOffset ) = 0; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Remaining Data Size Accessor Methods /// Return whether or not there are bytes remaining in the stream. RIM_INLINE Bool hasBytesRemaining() const { return this->getBytesRemaining() > 0; } /// Return the number of bytes remaining in the stream. /** * The value returned must only be a lower bound on the number of bytes * remaining in the stream. If there are bytes remaining, it must return * at least 1. */ virtual LargeSize getBytesRemaining() const = 0; /// Return the current byte index within the stream relative to the beginning. virtual LargeIndex getPosition() const = 0; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Endian-ness Accessor Methods /// Get the current endianness of the data being read from the buffer. RIM_INLINE data::Endianness getEndianness() const { return endianness; } /// Set the buffer to read data in big endian format. RIM_INLINE void setEndianness( data::Endianness newEndianness ) { endianness = newEndianness; } protected: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Protected Data Read Method /// Read the specified number of bytes from the stream and place them in the specified output buffer. virtual Size readData( UByte* buffer, Size number ) = 0; private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Helper Method /// Read the specified number of elements of a primitive type, converting endianness. template < typename T > RIM_NO_INLINE Size readPrimitives( T* buffer, Size number ) { Size numRead = this->readData( (UByte*)buffer, sizeof(T)*number ) / sizeof(T); const T* const bufferEnd = buffer + numRead; for ( ; buffer != bufferEnd; buffer++ ) *buffer = endianness.convertToNative( *buffer ); return numRead; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Members /// The endianness in which the data being read from the stream is assumed to be in. /** * Upon reading primitive types from the stream, they are converted to the platform's * native endianness before being returned to the user. */ data::Endianness endianness; }; //########################################################################################## //****************************** End Rim IO Namespace ************************************ RIM_IO_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_DATA_INPUT_STREAM_H <file_sep>/* * rimGUISystem.h * Rim GUI * * Created by <NAME> on 5/28/08. * Copyright 2008 __MyCompanyName__. All rights reserved. * */ #ifndef INCLUDE_RIM_GUI_SYSTEM_H #define INCLUDE_RIM_GUI_SYSTEM_H #include "system/rimGUISystemConfig.h" #include "system/rimGUIDisplayID.h" #include "system/rimGUIDisplayMode.h" #include "system/rimGUIDisplay.h" #ifdef RIM_GUI_SYSTEM_NAMESPACE_START #undef RIM_GUI_SYSTEM_NAMESPACE_START #endif #ifdef RIM_GUI_SYSTEM_NAMESPACE_END #undef RIM_GUI_SYSTEM_NAMESPACE_END #endif #endif // INCLUDE_RIM_GUI_SYSTEM_H <file_sep>/* * rimGraphicsCameraAssetTranscoder.h * Rim Software * * Created by <NAME> on 6/14/14. * Copyright 2014 __MyCompanyName__. All rights reserved. * */ #ifndef INCLUDE_RIM_GRAPHICS_CAMERA_ASSET_TRANSCODER_H #define INCLUDE_RIM_GRAPHICS_CAMERA_ASSET_TRANSCODER_H #include "rimGraphicsAssetsConfig.h" //########################################################################################## //*********************** Start Rim Graphics Assets Namespace **************************** RIM_GRAPHICS_ASSETS_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class which encodes and decodes graphics cameras to the asset format. class GraphicsCameraAssetTranscoder : public AssetTypeTranscoder<Camera> { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Destructor //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Text Encoding/Decoding Methods /// Decode an object from the specified string stream, returning a pointer to the final object. virtual Pointer<Camera> decodeText( const AssetType& assetType, const AssetObject& assetObject, ResourceManager* resourceManager = NULL ); /// Encode an object of this asset type into a text-based format. virtual Bool encodeText( UTF8StringBuffer& buffer, ResourceManager* resourceManager, const Camera& data ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Public Static Data Members /// An object indicating the asset type for an orthographic camera. static const AssetType ORTHOGRAPHIC_CAMERA_ASSET_TYPE; /// An object indicating the asset type for an perspective camera. static const AssetType PERSPECTIVE_CAMERA_ASSET_TYPE; private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Type Declarations /// An enum describing the fields that a graphics camera can have. typedef enum Field { /// An undefined field. UNDEFINED = 0, //******************************************************************** // Common Camera Fields /// "name" The name of this graphics camera. NAME, /// "position" The 3D position of the camera in world space. POSITION, /// "orientation" The 3D orientation of the camera in world space. ORIENTATION, /// "scale" The scale of the camera in world space. SCALE, /// "near" The near plane distance for the camera. NEAR, /// "far" The far plane distance for the camera. FAR, /// "viewport" The rectangle on the screen where the camera's view is. VIEWPORT, //******************************************************************** // Orthographic Camera Fields /// "viewBounds" The 2D camera-space bounding box of the camera's viewport. VIEW_BOUNDS, //******************************************************************** // Perspective Camera Fields /// "aspectRatio" The aspect ratio of the camera's perspective projection. ASPECT_RATIO, /// "hFOV" The horizontal field of view in degrees of the camera's perspective projection. H_FOV }; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Helper Methods /// Decode the given asset object as if it was an orthographic camera. Pointer<OrthographicCamera> decodeTextOrthographic( const AssetObject& assetObject, ResourceManager* resourceManager ); /// Decode the given asset object as if it was a perspective camera. Pointer<PerspectiveCamera> decodeTextPerspective( const AssetObject& assetObject, ResourceManager* resourceManager ); /// Decode the common camera field, returning if the field is a common field. Bool decodeCommonField( Field field, const AssetObject::String& fieldValue, Camera& camera ); /// Return an enum value indicating the field indicated by the given field name. static Field getFieldType( const AssetObject::String& name ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Members /// A temporary asset object used when parsing camera child objects. AssetObject tempObject; }; //########################################################################################## //*********************** End Rim Graphics Assets Namespace ****************************** RIM_GRAPHICS_ASSETS_NAMESPACE_END //****************************************************************************************** //########################################################################################## //########################################################################################## //**************************** Start Rim Assets Namespace ******************************** RIM_ASSETS_NAMESPACE_START //****************************************************************************************** //########################################################################################## template <> RIM_INLINE const AssetType& AssetType::of<rim::graphics::OrthographicCamera>() { return rim::graphics::assets::GraphicsCameraAssetTranscoder::ORTHOGRAPHIC_CAMERA_ASSET_TYPE; } template <> RIM_INLINE const AssetType& AssetType::of<graphics::PerspectiveCamera>() { return rim::graphics::assets::GraphicsCameraAssetTranscoder::PERSPECTIVE_CAMERA_ASSET_TYPE; } //########################################################################################## //**************************** End Rim Assets Namespace ********************************** RIM_ASSETS_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_GRAPHICS_CAMERA_ASSET_TRANSCODER_H <file_sep>/* * rimGUIOpenDialogDelegate.h * Rim Software * * Created by <NAME> on 6/29/14. * Copyright 2014 __MyCompanyName__. All rights reserved. * */ #ifndef INCLUDE_RIM_GUI_OPEN_DIALOG_DELEGATE_H #define INCLUDE_RIM_GUI_OPEN_DIALOG_DELEGATE_H #include "rimGUIConfig.h" //########################################################################################## //*************************** Start Rim GUI Namespace ****************************** RIM_GUI_NAMESPACE_START //****************************************************************************************** //########################################################################################## class OpenDialog; //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class which contains function objects that recieve window events. /** * Any window-related event that might be processed has an appropriate callback * function object. Each callback function is called by the GUI event thread * whenever such an event is received. If a callback function in the delegate * is not initialized, a window simply ignores it. * * It must be noted that the callback functions are asynchronous and * not thread-safe. Thus, it is necessary to perform any additional synchronization * externally. */ class OpenDialogDelegate { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Visibility Callback Functions /// A function object which is called when the user picks a path to open a file. /** * The function should return whether or not the file was able to be opend. */ Function<Bool ( OpenDialog&, const UTF8String& )> open; }; //########################################################################################## //*************************** End Rim GUI Namespace ******************************** RIM_GUI_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_GUI_OPEN_DIALOG_DELEGATE_H <file_sep>/* * rimGraphicsGUIImage.h * Rim Graphics GUI * * Created by <NAME> on 3/31/13. * Copyright 2013 __MyCompanyName__. All rights reserved. * */ #ifndef INCLUDE_RIM_GRAPHICS_GUI_IMAGE_H #define INCLUDE_RIM_GRAPHICS_GUI_IMAGE_H #include "rimGraphicsGUIUtilitiesConfig.h" //########################################################################################## //******************* Start Rim Graphics GUI Utilities Namespace ************************* RIM_GRAPHICS_GUI_UTILITIES_NAMESPACE_START //****************************************************************************************** //########################################################################################## class Direction; //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class which represents a rectangular region containing an image drawn by an arbitrary process. /** * This abstraction allows GUIs to use pixel-based or vector-based images * in a uniform manner. */ class GUIImage { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructor /// Create a new GUI image with a width and height of 0. RIM_INLINE GUIImage() : size() { } /// Create a new GUI image with the specified displayed size in pixels. RIM_INLINE GUIImage( const Vector2f& newSize ) : size( newSize ) { } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Destructor /// Destroy this GUI image, releasing all internal state. virtual ~GUIImage() { } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Size Accessor Methods /// Return a 2D vector representing the displayed size of this image in pixels. /** * This is the final size that the image is scaled to (neglecting any * global scaling) when it is displayed. This size also determines the aspect * ratio of the image. */ RIM_INLINE const Vector2f& getSize() const { return size; } /// Set a 2D vector representing the displayed size of this image in pixels. /** * This is the final size that the image is scaled to (neglecting any * global scaling) when it is displayed. This size also determines the aspect * ratio of the image. */ RIM_INLINE void setSize( const Vector2f& newSize ) { size = newSize; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Image Validity Accessor Methods /// Return whether or not this image is valid and can be used for rendering. virtual Bool isValid() const = 0; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Image Drawing Method /// Draw this image using the specified renderer to the given bounding box on the screen. /** * The image's appearance should be tinted (multiplied) by the specified color value. */ virtual Bool drawSelf( GUIRenderer& renderer, const AABB2f& pixelBounds, const Color4f& color = Color4f::WHITE ) const = 0; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Standard Image Construction Methods /// Return a pointer to an image object that represents a small triangular arrow pointing in the given direction. static Pointer<GUIImage> getTriangleArrow( const Vector2f& newSize, const Direction& direction, const Color4f& color = Color4f::BLACK ); private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Class Declarations /// A class which draws a triangular arrow image. class TriangleArrowImage; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Public Data Members /// A 2D vector indicating the scaled width and height of this image. Vector2f size; }; //########################################################################################## //******************* End Rim Graphics GUI Utilities Namespace *************************** RIM_GRAPHICS_GUI_UTILITIES_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_GRAPHICS_GUI_IMAGE_H <file_sep>/* * rimGraphicsTextureFace.h * Rim Graphics * * Created by <NAME> on 1/2/11. * Copyright 2011 Rim Software. All rights reserved. * */ #ifndef INCLUDE_RIM_GRAPHICS_TEXTURE_FACE_H #define INCLUDE_RIM_GRAPHICS_TEXTURE_FACE_H #include "rimGraphicsTexturesConfig.h" //########################################################################################## //********************** Start Rim Graphics Textures Namespace *************************** RIM_GRAPHICS_TEXTURES_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class which represents a particular face of a texture. /** * While most common textures have only a single face (FRONT), * cube map textures may have six faces for the six axial directions * of a cube. This class allows the user to specify a particular face * of that cube map. */ class TextureFace { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Public Enum Declaration /// An enum which specifies the different allowed texture faces. typedef enum Enum { /// The face of the cube map in the positive X direction (front face). POSITIVE_X = 0, /// The front face of a texture (face in the positive X direction). FRONT = 0, /// The face of the cube map in the negative X direction. NEGATIVE_X = 1, /// The face of the cube map in the positive Y direction. POSITIVE_Y = 2, /// The face of the cube map in the negative Y direction. NEGATIVE_Y = 3, /// The face of the cube map in the positive Z direction. POSITIVE_Z = 4, /// The face of the cube map in the negative Z direction. NEGATIVE_Z = 5, /// An undefined face of a texture. UNDEFINED }; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructors /// Create a new texture face type with the specified face type enum value. RIM_INLINE TextureFace( Enum newType ) : type( newType ) { } /// Create a new texture face type with the specified face index. RIM_INLINE TextureFace( Index faceIndex ) : type( faceIndex < TextureFace::getMaxFaceCount() ? (Enum)faceIndex : UNDEFINED ) { } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Max Number Of Faces Accessor Method /// Return the maximum number of faces that a texture can have. RIM_INLINE static Size getMaxFaceCount() { return 6; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Direction Accessor Method /// Return a 3D vector indicating the cannonical direction for this texture face. Vector3 getDirection() const; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Enum Cast Operator /// Convert this texture wrap type to an enum value. RIM_INLINE operator Enum () const { return type; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** String Representation Accessor Methods /// Return a unique string for this texture face that matches its enum value name. String toEnumString() const; /// Return a texture face which corresponds to the given enum string. static TextureFace fromEnumString( const String& enumString ); /// Return a string representation of the texture face type. String toString() const; /// Convert this texture face type into a string representation. RIM_INLINE operator String () const { return this->toString(); } private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Members /// An enum value which represents the texture face type. Enum type; }; //########################################################################################## //********************** End Rim Graphics Textures Namespace ***************************** RIM_GRAPHICS_TEXTURES_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_GRAPHICS_TEXTURE_FACE_H <file_sep>/* * rimPhysicsCollisionDetector.h * Rim Physics * * Created by <NAME> on 11/28/09. * Copyright 2009 Rim Software. All rights reserved. * */ #ifndef INCLUDE_RIM_PHYSICS_COLLISION_DETECTOR_H #define INCLUDE_RIM_PHYSICS_COLLISION_DETECTOR_H #include "rimPhysicsCollisionConfig.h" #include "rimPhysicsCollisionAlgorithmDispatcher.h" #include "rimPhysicsCollisionResultSet.h" //########################################################################################## //********************** Start Rim Physics Collision Namespace *************************** RIM_PHYSICS_COLLISION_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class which describes the interface for an object that detects colisions between different object types. class CollisionDetector { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Destructor /// Destroy this collision detector object. virtual ~CollisionDetector() { } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Collision Detection Methods /// Detect rigid-vs-rigid collisions that occurr over a timestep and add them to the result set. virtual void testForCollisions( Real dt, CollisionResultSet<RigidObject,RigidObject>& resultSet ) = 0; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Rigid Object Accessor Methods /// Add the specified rigid object to this CollisionDetector. /** * If the specified rigid object pointer is NULL, the * collision detector is unchanged. */ virtual void addRigidObject( const RigidObject* rigidObject ) = 0; /// Remove the specified rigid object from this CollisionDetector. /** * If this detector contains the specified rigid object, the * object is removed from the collision detector and TRUE is returned. * Otherwise, if the rigid object is not found, FALSE is returned * and the collision detector is unchanged. */ virtual Bool removeRigidObject( const RigidObject* rigidObject ) = 0; /// Remove all rigid objects from this CollisionDetector. virtual void removeRigidObjects() = 0; /// Return whether or not the specified rigid object is contained in this CollisionDetector. /** * If this CollisionDetector contains the specified rigid object, TRUE is returned. * Otherwise, if the rigid object is not found, FALSE is returned. */ virtual Bool containsRigidObject( const RigidObject* rigidObject ) const = 0; /// Return the number of rigid objects that are contained in this CollisionDetector. virtual Size getRigidObjectCount() const = 0; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Dispatcher Accessor Methods /// Return a reference to the collision algorithm dispatcher for the specified template object types. template < typename ObjectType1, typename ObjectType2 > RIM_INLINE CollisionAlgorithmDispatcher<ObjectType1,ObjectType2>& getDispatcher() { } /// Return a const reference to the collision algorithm dispatcher for the specified template object types. template < typename ObjectType1, typename ObjectType2 > RIM_INLINE const CollisionAlgorithmDispatcher<ObjectType1,ObjectType2>& getDispatcher() const { } /// Replace the dispatcher in this collision detector for the specified template object types. /** * This method completely replaces the dispatcher used in this collision * detector with a copy of the specified dispatcher object. */ template < typename ObjectType1, typename ObjectType2 > RIM_INLINE void setDispatcher( const CollisionAlgorithmDispatcher<ObjectType1,ObjectType2>& newDispatcher ) { } protected: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Protected Collider Dispatch Functions /// Test the specified pair of objects for collisions and add any collisions to the result set. /** * This method may be specialized to support different object types and * combinations. It should not do any additional bounding volume intersection tests * other than the test to determine if the objects' shapes intersect. * Typically, one would test the objects' bounding spheres for intersection * before calling this method. */ template < typename ObjectType1, typename ObjectType2 > RIM_INLINE void testPair( const ObjectType1* object1, const ObjectType2* object2, CollisionResultSet<ObjectType1,ObjectType2>& resultSet ) { } private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Members /// The collision algorithm dispatcher that dispatches collidind pairs of rigid objects. CollisionAlgorithmDispatcher<RigidObject,RigidObject> rigidVsRigidDispatcher; }; //########################################################################################## //########################################################################################## //############ //############ Algorithm Dispatcher Template Specializations //############ //########################################################################################## //########################################################################################## template <> RIM_INLINE CollisionAlgorithmDispatcher<RigidObject,RigidObject>& CollisionDetector:: getDispatcher<RigidObject,RigidObject>() { return rigidVsRigidDispatcher; } template <> RIM_INLINE const CollisionAlgorithmDispatcher<RigidObject,RigidObject>& CollisionDetector:: getDispatcher<RigidObject,RigidObject>() const { return rigidVsRigidDispatcher; } template <> RIM_INLINE void CollisionDetector:: setDispatcher( const CollisionAlgorithmDispatcher<RigidObject,RigidObject>& newDispatcher ) { rigidVsRigidDispatcher = newDispatcher; } //########################################################################################## //########################################################################################## //############ //############ Collision Pair Dispatch Template Specializations //############ //########################################################################################## //########################################################################################## template <> RIM_INLINE void CollisionDetector:: testPair( const RigidObject* object1, const RigidObject* object2, CollisionResultSet<RigidObject,RigidObject>& resultSet ) { const Size numShapes1 = object1->getShapeCount(); const Size numShapes2 = object2->getShapeCount(); for ( Index i = 0; i < numShapes1; i++ ) { ObjectCollider<RigidObject> collider1( object1, object1->getShapeInstance(i) ); for ( Index j = 0; j < numShapes2; j++ ) { ObjectCollider<RigidObject> collider2( object2, object2->getShapeInstance(j) ); rigidVsRigidDispatcher.testForCollisions( collider1, collider2, resultSet ); } } } //########################################################################################## //********************** End Rim Physics Collision Namespace ***************************** RIM_PHYSICS_COLLISION_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_PHYSICS_COLLISION_DETECTOR_H <file_sep>/* * rimSoundFormat.h * Rim Software * * Created by <NAME> on 6/8/14. * Copyright 2014 __MyCompanyName__. All rights reserved. * */ #ifndef INCLUDE_RIM_SOUND_FORMAT_H #define INCLUDE_RIM_SOUND_FORMAT_H #include "rimSoundIOConfig.h" //########################################################################################## //*************************** Start Rim Sound IO Namespace ******************************* RIM_SOUND_IO_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// An enum class representing the different kinds of sound encoding formats. class SoundFormat { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Image Format Enum Declaration /// An enum type representing the different kinds of sound encoding formats. typedef enum Enum { /// An undefined sound format. UNDEFINED = ResourceFormat::UNDEFINED, /// The WAVE sound format. WAVE = ResourceFormat::WAVE, /// The Audio Interchange File Format (AIFF) sound format. AIFF = ResourceFormat::AIFF, /// The compressed OGG sound format. OGG = ResourceFormat::OGG, /// The compressed MPEG-3 sound format. MP3 = ResourceFormat::MP3, /// The MPEG-4 audio-only sound format. M4A = ResourceFormat::M4A, /// The Free Lossless Audio Codec (FLAC) sound format. FLAC = ResourceFormat::FLAC, /// The Core Audio Format (CAF) sound format. CAF = ResourceFormat::CAF }; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructors /// Create an sound format object with an UNDEFINED sound format. RIM_INLINE SoundFormat() : format( UNDEFINED ) { } /// Create a sound format object from the specified sound format Enum. RIM_INLINE SoundFormat( SoundFormat::Enum newFormat ) : format( newFormat ) { } /// Create a sound format object from the specified resource format. SoundFormat( const ResourceFormat& newFormat ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Enum Cast Operator /// Convert this sound format to an enum value. RIM_INLINE operator Enum () const { return format; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Sound Format Extension Accessor Method /// Return the standard file extension used for this sound format. UTF8String getExtension() const; /// Return a sound format which corresponds to the format with the given extension string. static SoundFormat getFormatForExtension( const UTF8String& extension ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Sound Format String Conversion Methods /// Return a string representation of the sound format. String toString() const; /// Convert this sound format into a string representation. RIM_INLINE operator String () const { return this->toString(); } private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Members /// An enum value specifying the sound format. Enum format; }; //########################################################################################## //*************************** End Rim Sound IO Namespace ********************************* RIM_SOUND_IO_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_SOUND_FORMAT_H <file_sep>/* * rimEntitiesConfig.h * Rim Engine * * Created by <NAME> on 5/13/12. * Copyright 2012 __MyCompanyName__. All rights reserved. * */ #ifndef INCLUDE_RIM_ENTITIES_CONFIG_H #define INCLUDE_RIM_ENTITIES_CONFIG_H #include "rim/rimFramework.h" //########################################################################################## //########################################################################################## //############ //############ Library Namespace Configuration //############ //########################################################################################## //########################################################################################## #ifndef RIM_ENTITIES_NAMESPACE_START #define RIM_ENTITIES_NAMESPACE_START RIM_NAMESPACE_START namespace entities { #endif #ifndef RIM_ENTITIES_NAMESPACE_END #define RIM_ENTITIES_NAMESPACE_END }; RIM_NAMESPACE_END #endif //########################################################################################## //************************** Start Rim Entities Namespace ******************************** RIM_ENTITIES_NAMESPACE_START //****************************************************************************************** //########################################################################################## //########################################################################################## //************************** End Rim Entities Namespace ********************************** RIM_ENTITIES_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_ENTITIES_CONFIG_H <file_sep>/* * rimConvolution.h * Rim Software * * Created by <NAME> on 4/1/14. * Copyright 2014 __MyCompanyName__. All rights reserved. * */ #ifndef INCLUDE_RIM_CONVOLUTION_H #define INCLUDE_RIM_CONVOLUTION_H #include "rimMathConfig.h" #include "rimComplex.h" //########################################################################################## //***************************** Start Rim Math Namespace ********************************* RIM_MATH_NAMESPACE_START //****************************************************************************************** //########################################################################################## //########################################################################################## //########################################################################################## //############ //############ 1D Convolution Methods //############ //########################################################################################## //########################################################################################## /// Convolve the specified input signal with the given filter kernel. /** * The results of the transform are stored in the output data array which must * have space for (inputSize + fiterSize - 1) elements. * * This is a direct convolution algorithm and should realistically only be * used for offline computation or for short filter lengths. * * The method returns whether or not the convolution was successfully performed. * The method may fail if any pointer is NULL or if the filter size is 0. */ template < typename T > Bool convolve( const T* input, Size inputSize, const T* filter, Size filterSize, T* output ); //########################################################################################## //***************************** End Rim Math Namespace *********************************** RIM_MATH_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_CONVOLUTION_H <file_sep>/* * rimGraphicsGUIGraphicsFontDrawer.h * Rim Graphics GUI * * Created by <NAME> on 1/16/13. * Copyright 2013 Headspace Systems. All rights reserved. * */ #ifndef INCLUDE_RIM_GRAPHICS_GUI_GRAPHICS_FONT_DRAWER_H #define INCLUDE_RIM_GRAPHICS_GUI_GRAPHICS_FONT_DRAWER_H #include "rimGraphicsGUIFontsConfig.h" #include "rimGraphicsGUIFont.h" #include "rimGraphicsGUIFontDrawer.h" //########################################################################################## //********************* Start Rim Graphics GUI Fonts Namespace *************************** RIM_GRAPHICS_GUI_FONTS_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class which represents the interface for classes that draw strings for Font objects using OpenGL. class GraphicsFontDrawer : public FontDrawer { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructors /// Create a graphics font drawer which has no valid rendering context. /** * This font drawer will not be able to draw anything until a valid context * is supplied via setContext(). */ GraphicsFontDrawer(); /// Create a graphics font drawer which uses the specified graphics context to draw with. GraphicsFontDrawer( const Pointer<GraphicsContext>& newContext ); /// Create a copy of the state of another OpenGL font drawer. GraphicsFontDrawer( const GraphicsFontDrawer& other ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Destructor /// Destroy an OpenGL font drawer and release all of its internal state. ~GraphicsFontDrawer(); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Assignment Operator /// Assign the state of another font drawer to this one. GraphicsFontDrawer& operator = ( const GraphicsFontDrawer& other ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** String Drawing Methods /// Draw the specified unicode string using the provided font style. /** * The position and font size are assumed to be in viewport pixel coordinates. * For instance, the lower left corner of the current viewport has position (0,0) * and for a viewport with width 1024 and height 768, the upper right corner * has position (1023,767). * * The position is an in/out parameter which indicates the final pen position * of the font renderer after rendering the string. The method returns whether * or not the string was able to be drawn successfully. */ virtual Bool drawString( const UTF8String& string, const FontStyle& style, Vector2f& position ); /// Draw the specified number of characters from a string iterator using the provided font style. /** * The position and font size are assumed to be in viewport pixel coordinates. * For instance, the lower left corner of the current viewport has position (0,0) * and for a viewport with width 1024 and height 768, the upper right corner * has position (1023,767). * * The position is an in/out parameter which indicates the final pen position * of the font renderer after rendering the string. The method returns whether * or not the characters were able to be drawn successfully. */ virtual Bool drawCharacters( UTF8StringIterator& string, Size numCharacters, const FontStyle& style, Vector2f& position ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** String Size Accessor Method /// Retrieve a bounding box for the specified string using the given font style. /** * This method computes a bounding box for the string where the starting * pen position is the origin (0,0). If the method succeeds, the string's * bounding box is placed in the output reference parameter and TRUE is returned. * If the method fails, FALSE is returned and no bounding box is computed. */ virtual Bool getStringBounds( const UTF8String& string, const FontStyle& style, AABB2f& bounds ); /// Retrieve a bounding box for the specified string iterator's next line using the given font style. /** * This method computes the bounding box of every character from the specified * string iterator until either a new line character is encountered or the * size of the string's bounding box exceeds the specified maximum size. * * Thie method can be used to perform text wrapping. Use the final position * of the iterator to know how many characters to draw. */ virtual Bool getLineBounds( UTF8StringIterator& string, const FontStyle& style, const Vector2f& maxSize, AABB2f& bounds ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** String Caching Method /// Cache all of the glyphs in the specified string with the given font style. /** * This method allows the user to cache whatever rendering state is necessary * to draw the glyphs contained in the given string with the specified font * style. Since loading glyphs from a font file can be slow, this allows an * application to pre-cache commonly needed glyphs to avoid rendering stalls * when the drawer loads new glyphs at runtime. * * The method returns whether or not the string's characters were successfully * cached. The default implementation does nothing and returns FALSE. */ virtual Bool cacheString( const UTF8String& string, const FontStyle& style ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Context Accessor Methods /// Return a pointer to the graphics context which this font drawer is using to draw. RIM_INLINE const Pointer<GraphicsContext>& getContext() const { return context; } /// Set a pointer to the graphics context which this font drawer is using to draw. /** * This causes the renderer to use the specified context to do all of its rendering. * The renderer reinitializes all internal state using the new context. If the * new context is NULL or not valid, the renderer will not be able to render anything. */ void setContext( const Pointer<GraphicsContext>& newContext ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Text Appearance Attribute Accessor Methods /// Return the number of space characters that each tab '\t' character will be translated into. RIM_INLINE Float getTabWidth() const { return tabWidth; } /// Set the number of space characters that each tab '\t' character will be translated into. RIM_INLINE void setTabWidth( Float newTabWidth ) { tabWidth = newTabWidth; } private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Class Declarations /// A class which contains information for rendering a particular size of a font glyph. class GlyphSize; /// A class which contains information about a particular texture atlas. class TextureAtlas; /// A class which contains glyphs for characters for a particular font. class FontAtlas; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Helper Methods /// Retrieve detailed information about the specified font style. /** * If the method fails, FALSE is returned. */ Bool getFontInfo( const FontStyle& style, const Font*& font, FontAtlas*& fontAtlas, FontMetrics& fontMetrics ); /// Return a pointer to a glyph size object for the specified font sizes and character. /** * If there is no cached glyph for that size/font, a new one is created. * If the method fails, NULL is returned. */ GlyphSize* getGlyphSize( Float nominalFontSize, Float maxFontSize, UTF32Char character, const Font& font, FontAtlas& fontAtlas ); /// Create a new glyph size for the specified minimum font size and character. /** * If the method fails, NULL is returned. */ GlyphSize* createNewGlyphSize( Float minimumFontSize, UTF32Char character, const Font& font, ArrayList<TextureAtlas>& atlases, ArrayList<GlyphSize>& glyphs ); /// Create and initialize this drawer's vertex buffers and shaders to their default state. void initializeGraphicsState(); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Members /// A pointer to graphics context which is used by this font drawer to draw. Pointer<GraphicsContext> context; ImmediateRenderer imm; /// A map from internal font IDs to sets of glyphs for those fonts. HashMap<UTF8String,FontAtlas> fonts; /// A pointer to the default font to use when rendering strings of characters. Pointer<fonts::Font> defaultFont; /// An object representing the default shader pass to use for fonts rendererd without a user-defined shader. Pointer<ShaderPass> defaultShaderPass; /// A pointer to a buffer for which is used by this font drawer to accumulate glyph vertex positions. Pointer<VertexBuffer> positionBuffer; /// A pointer to a buffer for which is used by this font drawer to accumulate glyph vertex texture coordinates. Pointer<VertexBuffer> uvBuffer; /// The number of space characters that each tab '\t' character will be translated into. Float tabWidth; /// The index of the model view matrix constant binding for the font drawer's shader pass. Index modelViewBindingIndex; /// The index of the color constant binding for the renderer's shader passes. Index colorBindingIndex; /// The index of the glyph texture binding for the font drawer's shader pass. Index glyphBindingIndex; }; //########################################################################################## //********************* End Rim Graphics GUI Fonts Namespace ***************************** RIM_GRAPHICS_GUI_FONTS_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_GRAPHICS_GUI_GRAPHICS_FONT_DRAWER_H <file_sep>/* * rimGUIMenuDelegate.h * Rim GUI * * Created by <NAME> on 6/3/09. * Copyright 2009 Rim Software. All rights reserved. * */ #ifndef INCLUDE_RIM_GUI_MENU_DELEGATE_H #define INCLUDE_RIM_GUI_MENU_DELEGATE_H #include "rimGUIConfig.h" //########################################################################################## //*************************** Start Rim GUI Namespace ****************************** RIM_GUI_NAMESPACE_START //****************************************************************************************** //########################################################################################## class Menu; class MenuItem; //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class which contains function objects that recieve menu events. /** * Any menu-related event that might be processed has an appropriate callback * function object. Each callback function is called by the GUI event thread * whenever such an event is received. If a callback function in the delegate * is not initialized, a menu simply ignores it. * * It must be noted that the callback functions are asynchronous and * not thread-safe. Thus, it is necessary to perform any additional synchronization * externally. */ class MenuDelegate { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Open/Close Callback Functions /// A function object which is called whenever an attached menu is opened by the user. Function<void ( Menu& )> open; /// A function object which is called whenever an attached menu is closed by the user. Function<void ( Menu& )> close; /// A function object which is called whenever an item in an attached menu is highlighted. Function<void ( Menu&, MenuItem& )> itemHighlight; }; //########################################################################################## //*************************** End Rim GUI Namespace ******************************** RIM_GUI_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_GUI_MENU_DELEGATE_H <file_sep>/* * rimSoundAIFFTranscoder.h * Rim Software * * Created by <NAME> on 6/8/14. * Copyright 2014 __MyCompanyName__. All rights reserved. * */ #ifndef INCLUDE_RIM_SOUND_AIFF_TRANSCODER_H #define INCLUDE_RIM_SOUND_AIFF_TRANSCODER_H #include "rimSoundIOConfig.h" #include "rimSoundTranscoder.h" //########################################################################################## //*************************** Start Rim Sound IO Namespace ******************************* RIM_SOUND_IO_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class which provides the interface for objects that encode and decode sound data. class AIFFTranscoder : public SoundTranscoder { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Format Accessor Methods /// Return an object which represents the resource format that this transcoder can read and write. virtual ResourceFormat getResourceFormat() const; /// Return an object which represents the format that this transcoder can encode and decode. virtual SoundFormat getFormat() const; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Encoding Methods /// Return whether or not this transcoder is able to encode the specified resource. virtual Bool canEncode( const SoundResource& resource ) const; /// Save the specified sound resource at the specified ID location. /** * The method returns whether or not the resource was successfully written. */ virtual Bool encode( const ResourceID& identifier, const SoundResource& sound ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Decoding Methods /// Return whether or not the specified identifier refers to a valid resource for this transcoder. /** * If the identifier represents a valid resource, TRUE is returned. Otherwise, * if the resource is not valid, FALSE is returned. */ virtual Bool canDecode( const ResourceID& identifier ) const; /// Load the sound pointed to by the specified identifier. /** * The caller can supply a pointer to a resource manager which can be used * to manage the creation of child resources. * * If the method fails, the return value will be NULL. */ virtual Pointer<SoundResource> decode( const ResourceID& identifier, ResourceManager* manager = NULL ); }; //########################################################################################## //*************************** End Rim Sound IO Namespace ********************************* RIM_SOUND_IO_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_SOUND_AIFF_TRANSCODER_H <file_sep>/* * rimGraphicsAnimationTarget.h * Rim Software * * Created by <NAME> on 6/24/14. * Copyright 2014 __MyCompanyName__. All rights reserved. * */ #ifndef INCLUDE_RIM_GRAPHICS_ANIMATION_TARGET_H #define INCLUDE_RIM_GRAPHICS_ANIMATION_TARGET_H #include "rimGraphicsAnimationConfig.h" //########################################################################################## //********************** Start Rim Graphics Animation Namespace ************************** RIM_GRAPHICS_ANIMATION_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class that serves as an interface for targets of interpolated animation data. class AnimationTarget { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Destructor /// Destroy this animation target. virtual ~AnimationTarget() { } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Target Methods /// Return whether or not this target is the same as another. virtual Bool operator == ( const AnimationTarget& other ) const = 0; /// Return whether or not the specified attribute type is compatible with this animation target. virtual Bool isValidType( const AttributeType& type ) const = 0; // Set the target to have the given value. virtual Bool setValue( const AttributeValue& value ) = 0; }; //########################################################################################## //********************** End Rim Graphics Animation Namespace **************************** RIM_GRAPHICS_ANIMATION_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_GRAPHICS_ANIMATION_TARGET_H <file_sep>/* * rimXMLDocument.h * Rim XML * * Created by <NAME> on 4/28/12. * Copyright 2012 __MyCompanyName__. All rights reserved. * */ #ifndef INCLUDE_RIM_XML_DOCUMENT_H #define INCLUDE_RIM_XML_DOCUMENT_H #include "rimXMLConfig.h" #include "rimXMLNode.h" //########################################################################################## //****************************** Start Rim XML Namespace ********************************* RIM_XML_NAMESPACE_START //****************************************************************************************** //########################################################################################## class XMLDocument { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructors /// Create a new XML document which uses the specified node as its root node. XMLDocument( const Pointer<XMLNode>& newRoot ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Root Node Accessor Methods /// Return a pointer to the root node for this document. RIM_INLINE const Pointer<XMLNode>& getRoot() const { return root; } /// Set the root node for this XML document. /** * This method completely replaces the current contents of the document with * the XML node hierarchy specified by the given root node. */ RIM_INLINE void setRoot( const Pointer<XMLNode>& newRoot ) { root = newRoot; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** String Conversion Method /// Convert this XML document to a valid XML document string. UTF8String toString() const; private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Helper Methods //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Members /// A pointer to the root node of the XML document. Pointer<XMLNode> root; }; //########################################################################################## //****************************** End Rim XML Namespace *********************************** RIM_XML_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_XML_DOCUMENT_H <file_sep>/* * rimGraphicsShaderLanguage.h * Rim Graphics * * Created by <NAME> on 3/9/13. * Copyright 2013 __MyCompanyName__. All rights reserved. * */ #ifndef INCLUDE_RIM_GRAPHICS_SHADER_LANGUAGE_H #define INCLUDE_RIM_GRAPHICS_SHADER_LANGUAGE_H #include "rimGraphicsShadersConfig.h" #include "rimGraphicsShaderLanguageVersion.h" //########################################################################################## //*********************** Start Rim Graphics Shaders Namespace *************************** RIM_GRAPHICS_SHADERS_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class which specifies a particular type and version of a shading language. /** * The type specified here is used to determine how a shader's source * code is compiled. */ class ShaderLanguage { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Vertex Attribute Buffer Usage Enum Definition /// An enum type which represents the type for a shading language. /** * Some of these shading language types may be unimplemented for * the current platform. */ typedef enum Type { /// The OpenGL Shading Language. GLSL, /// The High-Level Shading Language for DirectX. HLSL, /// The NVIDIA Cg shading language. CG, /// ARB assembly language. ARB_ASSEMBLY, /// The PlayStation Shading Language. PSSL, /// The RenderMan offline shading language. RENDERMAN, /// The Houdini VEX offline shading language. VEX, /// The Gelato offline shading language. GELATO, /// The default shading language for a particular implementation. /** * The version number is ignored for this shader language type. */ DEFAULT, /// An undefined shading language. UNDEFINED }; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructors /// Create a new shader language type with the specified type enum value. RIM_INLINE ShaderLanguage( Type newType ) : type( newType ) { } /// Create a new shader language type with the specified type enum value. RIM_INLINE ShaderLanguage( Type newType, const ShaderLanguageVersion& newVersion ) : type( newType ), version( newVersion ) { } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Enum Cast Operator /// Convert this shader language to an enum value. RIM_INLINE operator Type () const { return type; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Type Accessor Methods /// Return an enum indicating the type of this shader language. RIM_INLINE Type getType() const { return type; } /// Set an enum indicating the type of this shader language. RIM_INLINE void setType( Type newType ) { type = newType; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Version Accessor Methods /// Return a reference to an object representing the version of this shader langauge. RIM_INLINE const ShaderLanguageVersion& getVersion() const { return version; } /// Set an object representing the version of this shader langauge. RIM_INLINE void setVersion( const ShaderLanguageVersion& newVersion ) { version = newVersion; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** String Representation Accessor Methods /// Return a shader language type which corresponds to the given type enum string. static ShaderLanguage::Type fromEnumString( const String& enumString ); /// Return a unique string for this shader language's type that matches its type enum value name. String toEnumString() const; /// Return a human-readable string representation of the shader language. String toString() const; /// Convert this shader language into a string representation. RIM_INLINE operator String () const { return this->toString(); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Static Predefined Shader Language Types /// The GLSL version 1.10 predefined shader language object. static const ShaderLanguage GLSL_110; /// The GLSL version 1.20 predefined shader language object. static const ShaderLanguage GLSL_120; /// The GLSL version 1.30 predefined shader language object. static const ShaderLanguage GLSL_130; /// The GLSL version 1.40 predefined shader language object. static const ShaderLanguage GLSL_140; /// The GLSL version 1.50 predefined shader language object. static const ShaderLanguage GLSL_150; /// The GLSL version 3.30 predefined shader language object. static const ShaderLanguage GLSL_330; /// The GLSL version 4.00 predefined shader language object. static const ShaderLanguage GLSL_400; /// The GLSL version 4.10 predefined shader language object. static const ShaderLanguage GLSL_410; /// The GLSL version 4.20 predefined shader language object. static const ShaderLanguage GLSL_420; /// The GLSL version 4.30 predefined shader language object. static const ShaderLanguage GLSL_430; /// The GLSL version 4.40 predefined shader language object. static const ShaderLanguage GLSL_440; private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Members /// An enum for the shader language. Type type; /// An object which represents the version number for this shader language. ShaderLanguageVersion version; }; //########################################################################################## //*********************** End Rim Graphics Shaders Namespace ***************************** RIM_GRAPHICS_SHADERS_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_GRAPHICS_SHADER_LANGUAGE_H <file_sep>/* * rimPhysicsCollisionDetectorSimple.h * Rim Physics * * Created by <NAME> on 11/28/09. * Copyright 2009 Rim Software. All rights reserved. * */ #ifndef INCLUDE_RIM_PHYSICS_COLLISION_DETECTOR_SIMPLE_H #define INCLUDE_RIM_PHYSICS_COLLISION_DETECTOR_SIMPLE_H #include "rimPhysicsCollisionConfig.h" #include "rimPhysicsCollisionDetector.h" //########################################################################################## //********************** Start Rim Physics Collision Namespace *************************** RIM_PHYSICS_COLLISION_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// An implementation of the CollisionDetector interface that uses simple O(n^2) collision detection. class CollisionDetectorSimple : public CollisionDetector { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructor /// Create a simple collision detector which contains no objects. CollisionDetectorSimple(); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Collision Detection Methods /// Detect rigid-vs-rigid collisions that occurr over a timestep and add them to the result set. /** * This implementation of this method uses a simple O(n^2) algorithm * to determine which objects are colliding. It examines all possible object-object * pairs and tests all pairs whose bounding spheres intersect. */ virtual void testForCollisions( Real dt, CollisionResultSet<RigidObject,RigidObject>& resultSet ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Rigid Object Accessor Methods /// Add the specified rigid object to this simple collision detector. /** * If the specified rigid object pointer is NULL, the * collision detector is unchanged. */ virtual void addRigidObject( const RigidObject* rigidObject ); /// Remove the specified rigid object from this simple collision detector. /** * If this detector contains the specified rigid object, the * object is removed from the collision detector and TRUE is returned. * Otherwise, if the rigid object is not found, FALSE is returned * and the collision detector is unchanged. */ virtual Bool removeRigidObject( const RigidObject* rigidObject ); /// Remove all rigid objects from this simple collision detector. virtual void removeRigidObjects(); /// Return whether or not the specified rigid object is contained in this simple collision detector. /** * If this simple collision detector contains the specified rigid object, TRUE is returned. * Otherwise, if the rigid object is not found, FALSE is returned. */ virtual Bool containsRigidObject( const RigidObject* rigidObject ) const; /// Return the number of rigid objects that are contained in this simple collision detector. virtual Size getRigidObjectCount() const; private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Members /// A list of pointers to rigid objects that are being tested for collisions. ArrayList<const RigidObject*> rigidObjects; }; //########################################################################################## //********************** End Rim Physics Collision Namespace ***************************** RIM_PHYSICS_COLLISION_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_PHYSICS_COLLISION_DETECTOR_SIMPLE_H <file_sep>/* * rimPoissonDistribution.h * Rim Math * * Created by <NAME> on 5/8/08. * Copyright 2008 Rim Software. All rights reserved. * */ #ifndef INCLUDE_RIM_POISSON_DISTRIBUTION_H #define INCLUDE_RIM_POISSON_DISTRIBUTION_H #include "rimMathConfig.h" #include "rimRandomVariable.h" //########################################################################################## //***************************** Start Rim Math Namespace ********************************* RIM_MATH_NAMESPACE_START //****************************************************************************************** //########################################################################################## /// A class which represents a Poisson distribution. template < typename T > class PoissonDistribution { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructors /// Create a poisson distribution with parameter lambda equal to 1. RIM_INLINE PoissonDistribution() : lambda( 1.0 ), lambdaExp( math::exp(-1.0) ), randomVariable() { } /// Create a poisson distribution with parameter lambda equal to 1. /** * The created Poisson distribution will produce samples using the * specified random variable. */ RIM_INLINE PoissonDistribution( const RandomVariable<double>& newRandomVariable ) : lambda( 1.0 ), lambdaExp( math::exp(-1.0) ), randomVariable( newRandomVariable ) { } /// Create a poisson distribution with the specified parameter lambda. RIM_INLINE PoissonDistribution( double newLambda ) : lambda( newLambda ), lambdaExp( math::exp(-newLambda) ), randomVariable() { } /// Create a poisson distribution with the specified parameter lambda. /** * The created Poisson distribution will produce samples using the * specified random variable. */ RIM_INLINE PoissonDistribution( double newLambda, const RandomVariable<double>& newRandomVariable ) : lambda( newLambda ), lambdaExp( math::exp(-newLambda) ), randomVariable( newRandomVariable ) { } /// Create a poisson distribution which approximates a binomial distribution. /** * When the parameter n is large and p is small, the Poisson distribution * created will approximate the behavior of a binomial distribution with the * parameters n and p. This can approximate the number of successes in a * series of n independent yes/no experiments where the probability of a * success is p. */ RIM_INLINE PoissonDistribution( double n, double p ) : lambda( n*p ), lambdaExp( math::exp(-n*p) ), randomVariable() { } /// Create a poisson distribution which approximates a binomial distribution. /** * When the parameter n is large and p is small, the Poisson distribution * created will approximate the behavior of a binomial distribution with the * parameters n and p. This can approximate the number of successes in a * series of n independent yes/no experiments where the probability of a * success is p. The created Poisson distribution will produce samples * using the specified random variable. */ RIM_INLINE PoissonDistribution( double n, double p, const RandomVariable<double>& newRandomVariable ) : lambda( n*p ), lambdaExp( math::exp(-n*p) ), randomVariable( newRandomVariable ) { } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Distribution Sample Generation Method /// Generate a sample from the Poisson distribution. RIM_INLINE T sample() { T k = 0; double p = 1.0; do { k++; p *= randomVariable.sample( 0.0, 1.0 ); } while ( p >= lambdaExp ); return T(k - 1); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Lambda Parameter Accessor Methods /// Get the lambda parameter of this Poisson distribution. RIM_INLINE double getLambda() const { return lambda; } /// Set the lambda parameter of this Poisson distribution. RIM_INLINE void setLambda( double newLambda ) { lambda = newLambda; lambdaExp = math::exp(-lambda); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Random Variable Accessor Methods /// Get the random variable used to generate samples for this distribution. RIM_INLINE RandomVariable<double>& getRandomVariable() { return randomVariable; } /// Get the random variable used to generate samples for this distribution. RIM_INLINE const RandomVariable<double>& getRandomVariable() const { return randomVariable; } /// Set the random variable used to generate samples for this distribution. RIM_INLINE void getRandomVariable( const RandomVariable<double>& newRandomVariable ) { randomVariable = newRandomVariable; } private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Members /// The lambda parameter of the Poisson distribution. double lambda; /// e to the power of the lambda parameter of the Poisson distribution. double lambdaExp; /// The random variable that the Poisson distribution uses to generate samples. RandomVariable<double> randomVariable; }; //########################################################################################## //***************************** End Rim Math Namespace *********************************** RIM_MATH_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_POISSON_DISTRIBUTION_H <file_sep>/* * rimGraphicsTechniqueAssetTranscoder.h * Rim Software * * Created by <NAME> on 6/14/14. * Copyright 2014 __MyCompanyName__. All rights reserved. * */ #ifndef INCLUDE_RIM_GRAPHICS_TECHNIQUE_ASSET_TRANSCODER_H #define INCLUDE_RIM_GRAPHICS_TECHNIQUE_ASSET_TRANSCODER_H #include "rimGraphicsAssetsConfig.h" #include "rimGraphicsShaderPassAssetTranscoder.h" //########################################################################################## //*********************** Start Rim Graphics Assets Namespace **************************** RIM_GRAPHICS_ASSETS_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class which encodes and decodes graphics techniques to the asset format. class GraphicsTechniqueAssetTranscoder : public AssetTypeTranscoder<GenericMaterialTechnique> { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Destructor //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Text Encoding/Decoding Methods /// Decode an object from the specified string stream, returning a pointer to the final object. virtual Pointer<GenericMaterialTechnique> decodeText( const AssetType& assetType, const AssetObject& assetObject, ResourceManager* resourceManager = NULL ); /// Encode an object of this asset type into a text-based format. virtual Bool encodeText( UTF8StringBuffer& buffer, ResourceManager* resourceManager, const GenericMaterialTechnique& technique ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Public Static Data Members /// An object indicating the asset type for a graphics technique. static const AssetType TECHNIQUE_ASSET_TYPE; private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Type Declarations /// An enum describing the fields that a graphics technique can have. typedef enum Field { /// An undefined field. UNDEFINED = 0, /// "name" The name of this graphics material technique. NAME, /// "usage" An enum indicating the usage of this material technique. USAGE, /// "passes" A list of the shader passes in this technique. PASSES }; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Helper Methods /// Return an enum value indicating the field indicated by the given field name. static Field getFieldType( const AssetObject::String& name ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Members /// An object that helps transcode shader passes that are part of a technique. GraphicsShaderPassAssetTranscoder shaderPassTranscoder; /// A temporary asset object used when parsing technique child objects. AssetObject tempObject; }; //########################################################################################## //*********************** End Rim Graphics Assets Namespace ****************************** RIM_GRAPHICS_ASSETS_NAMESPACE_END //****************************************************************************************** //########################################################################################## //########################################################################################## //**************************** Start Rim Assets Namespace ******************************** RIM_ASSETS_NAMESPACE_START //****************************************************************************************** //########################################################################################## template <> RIM_INLINE const AssetType& AssetType::of<graphics::GenericMaterialTechnique>() { return rim::graphics::assets::GraphicsTechniqueAssetTranscoder::TECHNIQUE_ASSET_TYPE; } //########################################################################################## //**************************** End Rim Assets Namespace ********************************** RIM_ASSETS_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_GRAPHICS_TECHNIQUE_ASSET_TRANSCODER_H <file_sep>/* * rimPhysicsCollisionAlgorithmSphereVsSphere.h * Rim Physics * * Created by <NAME> on 11/28/09. * Copyright 2009 Rim Software. All rights reserved. * */ #ifndef INCLUDE_RIM_PHYSICS_COLLISION_ALGORITHM_SPHERE_VS_SPHERE_H #define INCLUDE_RIM_PHYSICS_COLLISION_ALGORITHM_SPHERE_VS_SPHERE_H #include "rimPhysicsCollisionConfig.h" #include "rimPhysicsCollisionAlgorithmBase.h" //########################################################################################## //********************** Start Rim Physics Collision Namespace *************************** RIM_PHYSICS_COLLISION_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class which detects collisions between two Rigid Objects with spherical shapes. class CollisionAlgorithmSphereVsSphere : public CollisionAlgorithmBase<RigidObject,RigidObject,CollisionShapeSphere,CollisionShapeSphere> { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Collision Detection Method /// Test the specified object pair for collisions and add the results to the result set. /** * If a collision occurred, TRUE is returned and the resulting CollisionPoint(s) * are added to the CollisionManifold for the object pair in the specified * CollisionResultSet. If there was no collision detected, FALSE is returned * and the result set is unmodified. */ virtual Bool testForCollisions( const ObjectCollider<RigidObject>& collider1, const ObjectCollider<RigidObject>& collider2, CollisionResultSet<RigidObject,RigidObject>& resultSet ) { const RigidObject* object1 = collider1.getObject(); const CollisionShapeSphere::Instance* sphere1 = (const CollisionShapeSphere::Instance*)collider1.getShape(); const RigidObject* object2 = collider2.getObject(); const CollisionShapeSphere::Instance* sphere2 = (const CollisionShapeSphere::Instance*)collider2.getShape(); Vector3 positionVector = sphere2->getPosition() - sphere1->getPosition(); Real distanceSquared = positionVector.getMagnitudeSquared(); Real radii = sphere1->getRadius() + sphere2->getRadius(); if ( distanceSquared >= radii*radii ) return false; CollisionManifold& manifold = resultSet.addManifold( object1, object2 ); // Compute the distance between the spheres' centers. Real distance = math::sqrt(distanceSquared); // Compute the negative penetration distance. Real penetrationDistance = distance - radii; // Compute the normal vector from object 1 to object 2. Vector3 normal = positionVector / distance; // Compute the world space collision points for each object. Vector3 worldPoint1 = sphere1->getPosition() + normal*(sphere1->getRadius() + penetrationDistance); Vector3 worldPoint2 = sphere2->getPosition() - normal*(sphere2->getRadius() + penetrationDistance); // Create a collision point and add it to these objects' manifold. manifold.addPoint( CollisionPoint( object1->getTransform().transformToObjectSpace( worldPoint1 ), object2->getTransform().transformToObjectSpace( worldPoint2 ), worldPoint1, worldPoint2, normal, penetrationDistance, CollisionShapeMaterial( sphere1->getMaterial(), sphere2->getMaterial() ) ) ); return true; } }; //########################################################################################## //********************** End Rim Physics Collision Namespace ***************************** RIM_PHYSICS_COLLISION_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_PHYSICS_COLLISION_ALGORITHM_SPHERE_VS_SPHERE_H <file_sep>/* * rimGraphicsGUIContentViewDelegate.h * Rim Graphics GUI * * Created by <NAME> on 2/15/13. * Copyright 2013 Headspace Systems. All rights reserved. * */ #ifndef INCLUDE_RIM_GRAPHICS_GUI_CONTENT_VIEW_DELEGATE_H #define INCLUDE_RIM_GRAPHICS_GUI_CONTENT_VIEW_DELEGATE_H #include "rimGraphicsGUIConfig.h" //########################################################################################## //************************ Start Rim Graphics GUI Namespace ****************************** RIM_GRAPHICS_GUI_NAMESPACE_START //****************************************************************************************** //########################################################################################## class ContentView; //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class which contains function objects that recieve ContentView events. /** * Any content-view-related event that might be processed has an appropriate callback * function object. Each callback function is called by the content view * whenever such an event is received. If a callback function in the delegate * is not initialized, a content view simply ignores it. */ class ContentViewDelegate { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Content View Delegate Callback Functions /// A function object which is called whenever a content view's internal state is updated. /** * A content view calls this method when its update() method is called, allowing * the user to perform any logic updates for the specified time interval which * are needed for the content view. */ Function<void ( ContentView& contentView, Float dt )> update; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** User Input Callback Functions /// A function object called whenever an attached content view receives a keyboard event. Function<void ( ContentView& contentView, const KeyboardEvent& keyEvent )> keyEvent; /// A function object called whenever an attached content view receives a mouse-motion event. Function<void ( ContentView& contentView, const MouseMotionEvent& mouseMotionEvent )> mouseMotionEvent; /// A function object called whenever an attached content view receives a mouse-button event. Function<void ( ContentView& contentView, const MouseButtonEvent& mouseButtonEvent )> mouseButtonEvent; /// A function object called whenever an attached content view receives a mouse-wheel event. Function<void ( ContentView& contentView, const MouseWheelEvent& mouseWheelEvent )> mouseWheelEvent; }; //########################################################################################## //************************ End Rim Graphics GUI Namespace ******************************** RIM_GRAPHICS_GUI_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_GRAPHICS_GUI_CONTENT_VIEW_DELEGATE_H <file_sep>/* * rimSoundFilterSeries.h * Rim Sound * * Created by <NAME> on 12/9/12. * Copyright 2012 __MyCompanyName__. All rights reserved. * */ #ifndef INCLUDE_RIM_SOUND_FILTER_SERIES_H #define INCLUDE_RIM_SOUND_FILTER_SERIES_H #include "rimSoundFiltersConfig.h" #include "rimSoundFilter.h" //########################################################################################## //************************ Start Rim Sound Filters Namespace ***************************** RIM_SOUND_FILTERS_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class which wraps a set of series-connected sound filters. /** * This class is a convenience class which allows the user to quickly connect * a series of sound filters. This class is analogous to a 'channel strip' in * most digital audio workstations. * * Note that this class does not own any of the filters that it connects. It merely * provides an easy way to process them in series. One should store the filter * objects at some other location and pass pointers to this class. The behavior * is undefined if any filter is destroyed while a filter series still has a reference * to it. * * For filters that have multiple inputs or outputs, the filter series uses a 1 to 1 * matching for filter inputs/outputs. For instance, if a 2 output filter is followed by * a 4-input filter, the two outputs of the first filter are sent to the first * two inputs of the second filter. Any non-overlapping inputs or outputs are simply ignored. * Use FilterGraph instead if you need complex routing capabilities. */ class FilterSeries : public SoundFilter { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructors /// Create a default sound filter series with no connected sound filters. FilterSeries(); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Filter Accessor Methods /// Return the total number of sound filters that are a part of this filter series. RIM_INLINE Size getFilterCount() const { return filters.getSize(); } /// Return a pointer to the sound filter at the specified index within this filter series. /** * If the specified filter index is not valid, NULL is returned. */ SoundFilter* getFilter( Index filterIndex ); /// Replace the filter in this filter series at the specified index. /** * If the specified filter index is invalid or the new filter pointer is NULL, * FALSE is returned and the filter series is unchanged. Otherwise, the new * filter replaces the old one and TRUE is returned. */ Bool setFilter( Index filterIndex, SoundFilter* newFilter ); /// Add a new filter to the end of this sound filter series. /** * If the new filter pointer is NULL, the method fails and returns * FALSE. Otherwise, the method adds the new filter to the end of the * filter series and returns TRUE. */ Bool addFilter( SoundFilter* newFilter ); /// Insert the specified filter at the given index in this filter series. /** * If the new filter pointer is NULL, the method fails and returns FALSE. * Otherwise, the filter is inserted in the filter series at the specified * index and TRUE is returned. */ Bool insertFilter( Index filterIndex, SoundFilter* newFilter ); /// Remove the filter at the specified index from this filter series. /** * If the specified index is invalid, the method doesn't modify the * filter series and returns FALSE. Otherwise, the filter at that index * is removed and TRUE is returned. * * Removing a filter at any given index causes the index of all filters * with larger indices to be shifted back an index. */ Bool removeFilter( Index filterIndex ); /// Remove all filters from this sound filter series. void clearFilters(); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Input and Output Accessor Methods /// Return a human-readable name of the sound filter series input at the specified index. /** * This method returns the name of the input at the specified index in the first * filter in the series. */ virtual UTF8String getInputName( Index inputIndex ) const; /// Return a human-readable name of the sound filter series output at the specified index. /** * This method returns the name of the output at the specified index in the last * filter in the series. */ virtual UTF8String getOutputName( Index outputIndex ) const; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Filter Attribute Accessor Methods /// Return a human-readable name for this sound filter series. /** * The method returns the string "Sound Filter Series". */ virtual UTF8String getName() const; /// Return the manufacturer name of this sound filter series. /** * The method returns the string "Headspace Sound". */ virtual UTF8String getManufacturer() const; /// Return an object representing the version of this sound filter series. virtual SoundFilterVersion getVersion() const; /// Return an object which describes the category of effect that this filter implements. /** * This method returns the value SoundFilterCategory::ROUTING. */ virtual SoundFilterCategory getCategory() const; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Public Static Property Objects /// A string indicating the human-readable name of this sound filter series. static const UTF8String NAME; /// A string indicating the manufacturer name of this sound filter series. static const UTF8String MANUFACTURER; /// An object indicating the version of this sound filter series. static const SoundFilterVersion VERSION; private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Stream Reset Method /// A method which is called whenever the filter's stream of audio is being reset. /** * This method allows the filter to reset all parameter interpolation * and processing to its initial state to avoid coloration from previous * audio or parameter values. */ virtual void resetStream(); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Filter Processing Method /// Process each filter in the series, passing audio data from one filter to the next. virtual SoundFilterResult processFrame( const SoundFilterFrame& inputFrame, SoundFilterFrame& outputFrame, Size numSamples ); /// Get another temporary buffer from the global pool, save the handle, and return a pointer to the buffer. RIM_INLINE SoundBuffer* getTempBuffer( Size numChannels, Size numSamples, SampleRate sampleRate ) { tempBuffers.add( SharedBufferPool::getGlobalBuffer( numChannels, numSamples, sampleRate ) ); return &tempBuffers.getLast().getBuffer(); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Members /// A list of the filters that make up this series connection of filters. ArrayList<SoundFilter*> filters; /// A list of the current set of shared temporary sound buffers in use by this filter series. ArrayList<SharedSoundBuffer> tempBuffers; /// A persistent (to avoid buffer array reallocations) filter frame for intermediate sound data. SoundFilterFrame tempFrame1; /// A second persistent (to avoid buffer array reallocations) filter frame for intermediate sound data. SoundFilterFrame tempFrame2; }; //########################################################################################## //************************ End Rim Sound Filters Namespace ******************************* RIM_SOUND_FILTERS_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_SOUND_FILTER_SERIES_H <file_sep>/* * rimFileSystemConfig.h * Rim IO * * Created by <NAME> on 12/28/08. * Copyright 2008 Rim Software. All rights reserved. * */ #ifndef INCLUDE_RIM_FILE_SYSTEM_CONFIG_H #define INCLUDE_RIM_FILE_SYSTEM_CONFIG_H #include "../rimConfig.h" #include "../rimUtilities.h" #include "../rimData.h" #include "../rimExceptions.h" //########################################################################################## //########################################################################################## //############ //############ Library Namespace Configuration //############ //########################################################################################## //########################################################################################## /// Define the name of the file system library namespace. #ifndef RIM_FILE_SYSTEM_NAMESPACE #define RIM_FILE_SYSTEM_NAMESPACE fs #endif #ifndef RIM_FILE_SYSTEM_NAMESPACE_START #define RIM_FILE_SYSTEM_NAMESPACE_START RIM_NAMESPACE_START namespace RIM_FILE_SYSTEM_NAMESPACE { #endif #ifndef RIM_FILE_SYSTEM_NAMESPACE_END #define RIM_FILE_SYSTEM_NAMESPACE_END }; RIM_NAMESPACE_END #endif RIM_NAMESPACE_START /// A namespace containing classes which provide ways to access and manipulate file systems. namespace RIM_FILE_SYSTEM_NAMESPACE { }; RIM_NAMESPACE_END //########################################################################################## //************************* Start Rim File System Namespace ****************************** RIM_FILE_SYSTEM_NAMESPACE_START //****************************************************************************************** //########################################################################################## using rim::data::String; using rim::data::UTF8String; using rim::util::ArrayList; using rim::exceptions::IOException; //########################################################################################## //************************* End Rim File System Namespace ******************************** RIM_FILE_SYSTEM_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_FILE_SYSTEM_CONFIG_H <file_sep>/* * rimGraphicsOpenGL.h * Rim Graphics * * Created by <NAME> on 3/1/13. * Copyright 2013 __MyCompanyName__. All rights reserved. * */ #ifndef INCLUDE_RIM_GRAPHICS_OPENGL_H #define INCLUDE_RIM_GRAPHICS_OPENGL_H #include "opengl/rimGraphicsOpenGLConfig.h" #include "opengl/rimGraphicsOpenGLDevice.h" #endif // INCLUDE_RIM_GRAPHICS_OPENGL_H <file_sep>/* * rimPhysicsCollisionPoint.h * Rim Physics * * Created by <NAME> on 11/28/09. * Copyright 2009 Rim Software. All rights reserved. * */ #ifndef INCLUDE_RIM_PHYSICS_COLLISION_POINT_H #define INCLUDE_RIM_PHYSICS_COLLISION_POINT_H #include "rimPhysicsCollisionConfig.h" //########################################################################################## //********************** Start Rim Physics Collision Namespace *************************** RIM_PHYSICS_COLLISION_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class which holds information about a single point of collision between two objects. /** * This information consists of the point of collision on each object, * the collision normal, and the distance between the objects' surfaces. */ class CollisionPoint { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructors /// Create a collision point object from the specified collision data. RIM_INLINE CollisionPoint( const Vector3& newObjectSpacePoint1, const Vector3& newObjectSpacePoint2, const Vector3& newWorldSpacePoint1, const Vector3& newWorldSpacePoint2, const Vector3& newNormal, Real newSeparationDistance, const CollisionShapeMaterial& newMaterial ) : objectSpacePoint1( newObjectSpacePoint1 ), objectSpacePoint2( newObjectSpacePoint2 ), worldSpacePoint1( newWorldSpacePoint1 ), worldSpacePoint2( newWorldSpacePoint2 ), normal( newNormal ), separationDistance( newSeparationDistance ), material( newMaterial ) { } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Collision Point Position Accessor Methods /// Return a const reference to the position of the collision point on object 1 in its local coordinate frame. RIM_FORCE_INLINE const Vector3& getObjectSpacePoint1() const { return objectSpacePoint1; } /// Return a const reference to the position of the collision point on object 2 in its local coordinate frame. RIM_FORCE_INLINE const Vector3& getObjectSpacePoint2() const { return objectSpacePoint2; } /// Return a const reference to the position of the collision point on object 1 in world coordinates. RIM_FORCE_INLINE const Vector3& getWorldSpacePoint1() const { return worldSpacePoint1; } /// Set the position of the collision point on object 1 in world coordinates. RIM_FORCE_INLINE void setWorldSpacePoint1( const Vector3& newWorldSpacePoint1 ) { worldSpacePoint1 = newWorldSpacePoint1; } /// Return a const reference to the position of the collision point on object 2 in world coordinates. RIM_FORCE_INLINE const Vector3& getWorldSpacePoint2() const { return worldSpacePoint2; } /// Set the position of the collision point on object 2 in world coordinates. RIM_FORCE_INLINE void setWorldSpacePoint2( const Vector3& newWorldSpacePoint2 ) { worldSpacePoint2 = newWorldSpacePoint2; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Normal Accessor Methods /// Return a const reference to the world-space collision normal for this collision point. /** * This vector always points in the direction from object 1 to object 2. */ RIM_FORCE_INLINE const Vector3& getNormal() const { return normal; } /// Return the distance between the two colliding objects in world space. /** * This value will always be negative for colliding objects. */ RIM_FORCE_INLINE Real getSeparationDistance() const { return separationDistance; } /// Set the distance between the two colliding objects in world space. /** * This value should always be negative for colliding objects. */ RIM_FORCE_INLINE void setSeparationDistance( Real newSeparationDistance ) { separationDistance = newSeparationDistance; } /// Return a const reference to the combined material for the two objects at this collision point. /** * This material should be generated to represent how the two colliding objects * should interact at this collision point. */ RIM_FORCE_INLINE const CollisionShapeMaterial& getMaterial() const { return material; } private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Members /// The position of the collision point on object 1 in its local coordinate frame. Vector3 objectSpacePoint1; /// The position of the collision point on object 2 in its local coordinate frame. Vector3 objectSpacePoint2; /// The position of the collision point on object 1 in world coordinates. Vector3 worldSpacePoint1; /// The position of the collision point on object 2 in world coordinates. Vector3 worldSpacePoint2; /// A 3D vector in world space indicating the collision normal. /** * This vector always points from object 1 to object 2. */ Vector3 normal; /// The distance between the two colliding objects (always negative for colliding objects). Real separationDistance; /// The material object which defines the combind materials of the objects at this point. CollisionShapeMaterial material; }; //########################################################################################## //********************** End Rim Physics Collision Namespace ***************************** RIM_PHYSICS_COLLISION_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_PHYSICS_COLLISION_POINT_H <file_sep>/* * rimPrimes.h * Rim Software * * Created by <NAME> on 4/4/14. * Copyright 2014 __MyCompanyName__. All rights reserved. * */ #ifndef INCLUDE_RIM_PRIMES_H #define INCLUDE_RIM_PRIMES_H #include "rimMathConfig.h" //########################################################################################## //***************************** Start Rim Math Namespace ********************************* RIM_MATH_NAMESPACE_START //****************************************************************************************** //########################################################################################## /// Return a prime number larger than the specified value, but smaller than the next power of two. template < typename T > T nextPowerOf2Prime( T value ); //########################################################################################## //***************************** End Rim Math Namespace *********************************** RIM_MATH_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_PRIMES_H <file_sep>/* * rimEndian.h * Rim Framework * * Created by <NAME> on 6/18/09. * Copyright 2009 Rim Software. All rights reserved. * */ #ifndef INCLUDE_RIM_ENDIAN_H #define INCLUDE_RIM_ENDIAN_H #include "rimDataConfig.h" #include "rimBasicString.h" //########################################################################################## //******************************* Start Data Namespace ********************************* RIM_DATA_NAMESPACE_START //****************************************************************************************** //########################################################################################## namespace endian { Int16 swap( Int16 value ); UInt16 swap( UInt16 value ); Int32 swap( Int32 value ); UInt32 swap( UInt32 value ); Int64 swap( Int64 value ); UInt64 swap( UInt64 value ); RIM_INLINE Float32 swap( Float32 value ) { UInt32 result = swap( *((UInt32*)&value) ); return *((Float32*)&result); } RIM_INLINE Float64 swap( Float64 value ) { UInt64 result = swap( *((UInt64*)&value) ); return *((Float64*)&result); } #ifdef RIM_LITTLE_ENDIAN RIM_INLINE Int16 fromBigEndian( Int16 value ) { return swap(value); } RIM_INLINE UInt16 fromBigEndian( UInt16 value ) { return swap(value); } RIM_INLINE Int32 fromBigEndian( Int32 value ) { return swap(value); } RIM_INLINE UInt32 fromBigEndian( UInt32 value ) { return swap(value); } RIM_INLINE Int64 fromBigEndian( Int64 value ) { return swap(value); } RIM_INLINE UInt64 fromBigEndian( UInt64 value ) { return swap(value); } RIM_INLINE Float32 fromBigEndian( Float32 value ) { return swap(value); } RIM_INLINE Float64 fromBigEndian( Float64 value ) { return swap(value); } RIM_INLINE Int16 fromLittleEndian( Int16 value ) { return value; } RIM_INLINE UInt16 fromLittleEndian( UInt16 value ) { return value; } RIM_INLINE Int32 fromLittleEndian( Int32 value ) { return value; } RIM_INLINE UInt32 fromLittleEndian( UInt32 value ) { return value; } RIM_INLINE Int64 fromLittleEndian( Int64 value ) { return value; } RIM_INLINE UInt64 fromLittleEndian( UInt64 value ) { return value; } RIM_INLINE Float32 fromLittleEndian( Float32 value ) { return value; } RIM_INLINE Float64 fromLittleEndian( Float64 value ) { return value; } RIM_INLINE Int16 toBigEndian( Int16 value ) { return swap(value); } RIM_INLINE UInt16 toBigEndian( UInt16 value ) { return swap(value); } RIM_INLINE Int32 toBigEndian( Int32 value ) { return swap(value); } RIM_INLINE UInt32 toBigEndian( UInt32 value ) { return swap(value); } RIM_INLINE Int64 toBigEndian( Int64 value ) { return swap(value); } RIM_INLINE UInt64 toBigEndian( UInt64 value ) { return swap(value); } RIM_INLINE Float32 toBigEndian( Float32 value ) { return swap(value); } RIM_INLINE Float64 toBigEndian( Float64 value ) { return swap(value); } RIM_INLINE Int16 toLittleEndian( Int16 value ) { return value; } RIM_INLINE UInt16 toLittleEndian( UInt16 value ) { return value; } RIM_INLINE Int32 toLittleEndian( Int32 value ) { return value; } RIM_INLINE UInt32 toLittleEndian( UInt32 value ) { return value; } RIM_INLINE Int64 toLittleEndian( Int64 value ) { return value; } RIM_INLINE UInt64 toLittleEndian( UInt64 value ) { return value; } RIM_INLINE Float32 toLittleEndian( Float32 value ) { return value; } RIM_INLINE Float64 toLittleEndian( Float64 value ) { return value; } RIM_INLINE Bool isBigEndian() { return false; } RIM_INLINE Bool isLittleEndian() { return true; } #else #ifdef RIM_BIG_ENDIAN RIM_INLINE Int16 fromBigEndian( Int16 value ) { return value; } RIM_INLINE UInt16 fromBigEndian( UInt16 value ) { return value; } RIM_INLINE Int32 fromBigEndian( Int32 value ) { return value; } RIM_INLINE UInt32 fromBigEndian( UInt32 value ) { return value; } RIM_INLINE Int64 fromBigEndian( Int64 value ) { return value; } RIM_INLINE UInt64 fromBigEndian( UInt64 value ) { return value; } RIM_INLINE Float32 fromBigEndian( Float32 value ) { return value; } RIM_INLINE Float64 fromBigEndian( Float64 value ) { return value; } RIM_INLINE Int16 fromLittleEndian( Int16 value ) { return swap(value); } RIM_INLINE UInt16 fromLittleEndian( UInt16 value ) { return swap(value); } RIM_INLINE Int32 fromLittleEndian( Int32 value ) { return swap(value); } RIM_INLINE UInt32 fromLittleEndian( UInt32 value ) { return swap(value); } RIM_INLINE Int64 fromLittleEndian( Int64 value ) { return swap(value); } RIM_INLINE UInt64 fromLittleEndian( UInt64 value ) { return swap(value); } RIM_INLINE Float32 fromLittleEndian( Float32 value ) { return swap(value); } RIM_INLINE Float64 fromLittleEndian( Float64 value ) { return swap(value); } RIM_INLINE Int16 toBigEndian( Int16 value ) { return value; } RIM_INLINE UInt16 toBigEndian( UInt16 value ) { return value; } RIM_INLINE Int32 toBigEndian( Int32 value ) { return value; } RIM_INLINE UInt32 toBigEndian( UInt32 value ) { return value; } RIM_INLINE Int64 toBigEndian( Int64 value ) { return value; } RIM_INLINE UInt64 toBigEndian( UInt64 value ) { return value; } RIM_INLINE Float32 toBigEndian( Float32 value ) { return value; } RIM_INLINE Float64 toBigEndian( Float64 value ) { return value; } RIM_INLINE Int16 toLittleEndian( Int16 value ) { return swap(value); } RIM_INLINE UInt16 toLittleEndian( UInt16 value ) { return swap(value); } RIM_INLINE Int32 toLittleEndian( Int32 value ) { return swap(value); } RIM_INLINE UInt32 toLittleEndian( UInt32 value ) { return swap(value); } RIM_INLINE Int64 toLittleEndian( Int64 value ) { return swap(value); } RIM_INLINE UInt64 toLittleEndian( UInt64 value ) { return swap(value); } RIM_INLINE Float32 toLittleEndian( Float32 value ) { return swap(value); } RIM_INLINE Float64 toLittleEndian( Float64 value ) { return swap(value); } RIM_INLINE Bool isBigEndian() { return true; } RIM_INLINE Bool isLittleEndian() { return false; } #endif #endif }; class Endianness { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Endianness Type Enum Definition typedef enum Enum { BIG, LITTLE }; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructors /// Create a endianness type that represents the standard endianness for the current platform. RIM_INLINE Endianness() { #if defined(RIM_BIG_ENDIAN) type = BIG; #elif defined(RIM_LITTLE_ENDIAN) type = LITTLE; #endif } /// Create a endianness type with the specified endianness type enum value. RIM_INLINE Endianness( Enum newType ) : type( newType ) { } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Enum Cast Operator /// Convert this endianness type to an enum value. RIM_INLINE operator Enum () const { return type; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Endianness Conversion Methods /// Convert the specified value, assumed to be in this endianness, to native endianness. template < typename T > RIM_INLINE T convertToNative( T value ) const { if ( type == BIG ) return endian::fromBigEndian( value ); else return endian::fromLittleEndian( value ); } /// Convert the specified value, assumed to be in native endianness, to this endianness. template < typename T > RIM_INLINE T convertFromNative( T value ) const { if ( type == BIG ) return endian::toBigEndian( value ); else return endian::toLittleEndian( value ); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Is Native Accessor Method /// Return whether or not this Endianness is the native endianness of the current platform. RIM_INLINE Bool isNative() const { #if defined(RIM_BIG_ENDIAN) if ( type == BIG ) return true; #elif defined(RIM_LITTLE_ENDIAN) if ( type == LITTLE ) return true; #endif return false; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** String Representation Accessor Methods /// Return a string representation of the endianness type. RIM_INLINE String toString() const { switch ( type ) { case BIG: return String("Big Endian"); case LITTLE: return String("Little Endian"); default: return String("Undefined"); } } /// Convert this endianness type into a string representation. RIM_INLINE operator String () const { return this->toString(); } private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Members /// An enum for the endianness type. Enum type; }; //########################################################################################## //******************************* End Data Namespace *********************************** RIM_DATA_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_ENDIAN_H <file_sep>/* * rimGUIInputMouseWheelEvent.h * Rim GUI * * Created by <NAME> on 1/30/08. * Copyright 2008 __MyCompanyName__. All rights reserved. * */ #ifndef INCLUDE_RIM_GUI_INPUT_MOUSE_WHEEL_EVENT_H #define INCLUDE_RIM_GUI_INPUT_MOUSE_WHEEL_EVENT_H #include "rimGUIInputConfig.h" //########################################################################################## //************************ Start Rim GUI Input Namespace *************************** RIM_GUI_INPUT_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// An event class representing the motion of a mouse's scroll wheel input device. /** * It contains the relative motion in internal units of the the mouse's * scroll wheel since the last mouse wheel event. Both horizontal and vertical * scrolling is handled by the event. */ class MouseWheelEvent { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructor /// Create a new mouse wheel event with the mouse scroll wheel's relative motion. RIM_INLINE MouseWheelEvent( const Vector2f& newRelativeMotion ) : relativeMotion( newRelativeMotion ) { } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Event Data Accessors /// Get the relative motion of the mouse wheel on both axes. RIM_INLINE const Vector2f& getRelativeMotion() const { return relativeMotion; } /// Set the relative motion of the mouse wheel on both axes. RIM_INLINE void setRelativeMotion( const Vector2f& newRelativeMotion ) { relativeMotion = newRelativeMotion; } private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Members /// The relative motion of the mouse wheel since the last time it was moved. Vector2f relativeMotion; }; //########################################################################################## //************************ End Rim GUI Input Namespace ***************************** RIM_GUI_INPUT_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_GUI_INPUT_MOUSE_WHEEL_EVENT_H <file_sep>/* * rimPhysicsScenesConfig.h * Rim Physics * * Created by <NAME> on 6/1/12. * Copyright 2012 __MyCompanyName__. All rights reserved. * */ #ifndef INCLUDE_RIM_PHYSICS_SCENES_CONFIG_H #define INCLUDE_RIM_PHYSICS_SCENES_CONFIG_H #include "../rimPhysicsConfig.h" #include "../rimPhysicsObjects.h" #include "../rimPhysicsShapes.h" #include "../rimPhysicsCollision.h" #include "../rimPhysicsForces.h" #include "../rimPhysicsConstraints.h" //########################################################################################## //########################################################################################## //############ //############ Library Namespace Configuration //############ //########################################################################################## //########################################################################################## #ifndef RIM_PHYSICS_SCENES_NAMESPACE_START #define RIM_PHYSICS_SCENES_NAMESPACE_START RIM_PHYSICS_NAMESPACE_START namespace scenes { #endif #ifndef RIM_PHYSICS_SCENES_NAMESPACE_END #define RIM_PHYSICS_SCENES_NAMESPACE_END }; RIM_PHYSICS_NAMESPACE_END #endif //########################################################################################## //*********************** Start Rim Physics Scenes Namespace ***************************** RIM_PHYSICS_SCENES_NAMESPACE_START //****************************************************************************************** //########################################################################################## using namespace rim::physics::shapes; using namespace rim::physics::objects; using namespace rim::physics::collision; using namespace rim::physics::forces; using namespace rim::physics::constraints; //########################################################################################## //*********************** End Rim Physics Scenes Namespace ******************************* RIM_PHYSICS_SCENES_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_PHYSICS_SCENES_CONFIG_H <file_sep>/* * rimGUIInputKeyboardShortcut.h * Rim GUI * * Created by <NAME> on 6/7/09. * Copyright 2009 Rim Software. All rights reserved. * */ #ifndef INCLUDE_RIM_GUI_INPUT_KEYBOARD_SHORTCUT_H #define INCLUDE_RIM_GUI_INPUT_KEYBOARD_SHORTCUT_H #include "rimGUIInputConfig.h" //########################################################################################## //************************ Start Rim GUI Input Namespace *************************** RIM_GUI_INPUT_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class which represents a keyboard shortcut, usually for a menu item. /** * This class describes the keys that the user must press together in order to * execute a keyboard shortcut. Typically, keyboard shortcuts will be associated with * specific menu items, allowing the user to quickly perform basic operations such as * copy and paste without having to use the mouse. */ class KeyboardShortcut { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Public Key Modifier Type Enum /// An enum of keyboard shortcut modifier flags. /** * These flags are combined into a bitfield which represents the different * modifiers that affect a given key character. */ typedef enum Modifier { /// The default modifier key to use on Mac OS X that represents the command/apple key. COMMAND = 1, /// A modifier key to use on windows that represents the windows key. /** * This key modifier shouldn't be used because the default behavior in windows * is for this key to open the start menu. */ WINDOWS = 1, /// The generic name for the GUI-specific modifier key (either the command or windows key). GUI_KEY = 1, /// The modifier key code that represents the control key. CONTROL = 2, /// The modifier key code that represents the shift key. SHIFT = 4, /// The modifier key code that represents the option key on Mac OS X (same as ALT). OPTION = 8, /// The modifier key code that represents the alt key on Windows (same as OPTION). ALT = 8 }; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructors /// Create a default keyboard shortcut which doesn't correspond to any keyboard key. RIM_INLINE KeyboardShortcut() : character( '\0' ) { } /// Create a keyboard shortcut for the specified character and the system default modifier(s). RIM_INLINE KeyboardShortcut( Char newCharacter ) : character( newCharacter ) { #if defined(RIM_PLATFORM_APPLE) modifiers = COMMAND; #elif defined(RIM_PLATFORM_WINDOWS) modifiers = CONTROL; #else modifiers = CONTROL; #endif } /// Create a keyboard shortcut using the specified character and modifier. RIM_INLINE KeyboardShortcut( Char newCharacter, Modifier modifier ) : modifiers( modifier ), character( newCharacter ) { } /// Create a keyboard shortcut using the specified character and 2 modifiers. RIM_INLINE KeyboardShortcut( Char newCharacter, Modifier modifier1, Modifier modifier2 ) : modifiers( modifier1 | modifier2 ), character( newCharacter ) { } /// Create a keyboard shortcut using the specified character and 3 modifiers. RIM_INLINE KeyboardShortcut( Char newCharacter, Modifier modifier1, Modifier modifier2, Modifier modifier3 ) : modifiers( modifier1 | modifier2 | modifier3 ), character( newCharacter ) { } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Character Accessor Methods /// Return the character which this keyboard shortcut applies to. RIM_INLINE Char getCharacter() const { return character; } /// Set the character which this keyboard shortcut applies to. RIM_INLINE void setCharacter( Char newCharacter ) { character = newCharacter; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Modifier Accessor Methods /// Return a bitfield representing the different modifier keys associated with this keyboard shortcut. RIM_INLINE UInt32 getModifiers() const { return modifiers; } /// Return whether or not this keyboard shortcut has any modifier keys set. RIM_INLINE Bool hasModifiers() const { return modifiers != UInt32(0); } /// Return whether or not this keyboard shortcut has the specified modifier key set. RIM_INLINE Bool hasModifier( Modifier newModifier ) const { return (modifiers & newModifier) != UInt32(0); } /// Ensure that the specified key modifier is set for this keyboard shortcut. RIM_INLINE void setModifier( Modifier newModifier ) { modifiers |= newModifier; } /// Ensure that the specified key modifier is not set for this keyboard shortcut. RIM_INLINE void removeModifier( Modifier oldModifier ) { modifiers = modifiers & (~oldModifier); } /// Clear all set modifiers and reinitialize the keyboard shortcut to use only the specified modifier. /** * Since a keyboard shortcut must always have an associated modifier key, an * initial modifier is required when clearing the other modifiers. */ RIM_INLINE void clearModifiers( Modifier initialModifier ) { modifiers = initialModifier; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Keyboard Shortcut Comparison Operators /// Return whether or not this keyboard shortcut is exactly equal to another. RIM_INLINE Bool operator == ( const KeyboardShortcut& other ) const { return character == other.character && modifiers == other.modifiers; } /// Return whether or not this keyboard shortcut is not equal to another. RIM_INLINE Bool operator != ( const KeyboardShortcut& other ) const { return character != other.character || modifiers != other.modifiers; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Validity Accessor Methods /// Return whether or not this keyboard shortcut is valid and properly formed. RIM_INLINE Bool isValid() const { return character != '\0'; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** String Conversion Methods /// Convert this keyboard shortcut to a human-readable string representation. /** * The representation returned may differ, depending on the system platform. */ UTF8String toString() const; private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Members /// A bitfield representing all of the modifiers that are active for this keyboard shortcut. UInt32 modifiers; /// A character indicating the desired key that this shortcut applies to. Char character; }; //########################################################################################## //************************ End Rim GUI Input Namespace ***************************** RIM_GUI_INPUT_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_GUI_INPUT_KEYBOARD_SHORTCUT_H <file_sep>/* * rimPhysicsUtilitiesConfig.h * Rim Physics * * Created by <NAME> on 6/6/12. * Copyright 2012 __MyCompanyName__. All rights reserved. * */ #ifndef INCLUDE_RIM_PHYSICS_UTILITIES_CONFIG_H #define INCLUDE_RIM_PHYSICS_UTILITIES_CONFIG_H #include "../rimPhysicsConfig.h" //########################################################################################## //########################################################################################## //############ //############ Library Namespace Configuration //############ //########################################################################################## //########################################################################################## #ifndef RIM_PHYSICS_UTILITIES_NAMESPACE_START #define RIM_PHYSICS_UTILITIES_NAMESPACE_START RIM_PHYSICS_NAMESPACE_START namespace util { #endif #ifndef RIM_PHYSICS_UTILITES_NAMESPACE_END #define RIM_PHYSICS_UTILITES_NAMESPACE_END }; RIM_PHYSICS_NAMESPACE_END #endif //########################################################################################## //********************** Start Rim Physics Utilities Namespace *************************** RIM_PHYSICS_UTILITIES_NAMESPACE_START //****************************************************************************************** //########################################################################################## //########################################################################################## //********************** End Rim Physics Utilities Namespace ***************************** RIM_PHYSICS_UTILITES_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_PHYSICS_UTILITIES_CONFIG_H <file_sep>/* * rimGraphicsMaterial.h * Rim Graphics * * Created by <NAME> on 8/10/09. * Copyright 2009 Rim Software. All rights reserved. * */ #ifndef INCLUDE_RIM_GRAPHICS_MATERIAL_H #define INCLUDE_RIM_GRAPHICS_MATERIAL_H #include "rimGraphicsMaterialsConfig.h" #include "rimGraphicsMaterialTechnique.h" #include "rimGraphicsMaterialTechniqueUsage.h" //########################################################################################## //********************** Start Rim Graphics Materials Namespace ************************** RIM_GRAPHICS_MATERIALS_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class which contains a set of techniques for drawing the visual appearance of an object. /** * Each technique represents a particular way of drawing an object. A material is * a set of techniques, where each technique is associated with a usage type. * The usage allows the renderer to pick the correct technique to render * an object. */ class Material { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructors /// Create an empty default material with no material techniques. Material(); /// Create a material which uses the specified technique. Material( const Pointer<MaterialTechnique>& newTechnique ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Destructor /// Destroy this material, releasing all resources. virtual ~Material(); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Technique Accessor Methods /// Return the total number of material techniques that are part of this material. RIM_INLINE Size getTechniqueCount() const { return techniques.getSize(); } /// Return a pointer to the material technique at the specified index in this material. RIM_INLINE const Pointer<MaterialTechnique>& getTechnique( Index index ) const { RIM_DEBUG_ASSERT_MESSAGE( index < techniques.getSize(), "Cannot access invalid technique index in material" ); return techniques[index]; } /// Return a pointer to the technique with the specified usage in this material. /** * If this material does not contain a technique with that usage, * a NULL pointer is returned. */ Pointer<MaterialTechnique> getTechniqueWithUsage( const MaterialTechniqueUsage& usage ) const; /// Return a pointer to the technique with the specified usage in this material. /** * If this material does not contain a technique with that usage, * a NULL pointer is returned. */ Bool hasTechniqueWithUsage( const MaterialTechniqueUsage& usage ) const; /// Add a new material technique to this material with the specified usage. /** * If the technique pointer is NULL, the method fails and FALSE is returned. * Otherwise, the technique is added and TRUE is returned. */ Bool addTechnique( const Pointer<MaterialTechnique>& newTechnique ); /// Remove the technique with the specified index from this material. /** * This causes all techniques stored after the given index to be moved one * index back in this internal list of techniques. The method returns * whether or not the remove operation was successful. */ Bool removeTechnique( Index index ); /// Remove the technique with the specified usage from this material. /** * The method returns whether or not the remove operation was successful. */ Bool removeTechniqueWithUsage( const MaterialTechniqueUsage& name ); /// Remove all material techniques from this material. void clearTechniques(); private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Members /// A list of the different material techniques that make up this material. ShortArrayList<Pointer<MaterialTechnique>,1> techniques; }; //########################################################################################## //********************** End Rim Graphics Materials Namespace **************************** RIM_GRAPHICS_MATERIALS_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_GRAPHICS_MATERIAL_H <file_sep>/* * rimGUIInputMouseMotionEvent.h * Rim GUI * * Created by <NAME> on 1/30/08. * Copyright 2008 __MyCompanyName__. All rights reserved. * */ #ifndef INCLUDE_RIM_GUI_INPUT_MOUSE_MOTION_EVENT_H #define INCLUDE_RIM_GUI_INPUT_MOUSE_MOTION_EVENT_H #include "rimGUIInputConfig.h" //########################################################################################## //************************ Start Rim GUI Input Namespace *************************** RIM_GUI_INPUT_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// An event class representing the motion of a mouse input device. /** * It contains the position in pixels of the the mouse at the time * of the event, as well as the relative motion in pixels since the last * mouse motion event. */ class MouseMotionEvent { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructor /// Create a new mouse motion event with the mouse's position and relative motion. RIM_INLINE MouseMotionEvent( const Vector2f& newPosition, const Vector2f& newRelativeMotion ) : position( newPosition ), relativeMotion( newRelativeMotion ) { } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Mouse Position Accessor Methods /// Get the current position of the mouse in screen coordinates RIM_INLINE const Vector2f& getPosition() const { return position; } /// Set the current position of the mouse in screen coordinates RIM_INLINE void setPosition( const Vector2f& newPosition ) { position = newPosition; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Mouse Motion Accessor Methods /// Return the relative motion in pixels of the mouse. RIM_INLINE const Vector2f& getRelativeMotion() const { return relativeMotion; } /// Set the relative motion in pixels of the mouse. RIM_INLINE void setRelativeMotion( const Vector2f& newRelativeMotion ) { relativeMotion = newRelativeMotion; } private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Members /// The current position of the mouse in screen coordinates. Vector2f position; /// The relative motion of the mouse since the last time it was moved. Vector2f relativeMotion; }; //########################################################################################## //************************ End Rim GUI Input Namespace ***************************** RIM_GUI_INPUT_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_GUI_INPUT_MOUSE_MOTION_EVENT_H <file_sep>/* * rimDirectory.h * Rim IO * * Created by <NAME> on 5/22/08. * Copyright 2008 __MyCompanyName__. All rights reserved. * */ #ifndef INCLUDE_RIM_DIRECTORY_H #define INCLUDE_RIM_DIRECTORY_H #include "rimFileSystemConfig.h" #include "rimFileSystemNode.h" //########################################################################################## //************************* Start Rim File System Namespace ****************************** RIM_FILE_SYSTEM_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class which represents a directory within the global file system. /** * A directory is a collection of file system nodes (files or directories) that is * also a file system node. The directory class allows the user to query a directory's * size, name, path, and children, as well as create and destory directories. */ class Directory : public FileSystemNode { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructors /// Create a directory object representing the root directory. Directory(); /// Create a directory object for the specified path string. Directory( const UTF8String& newPathString ); /// Create a directory object for the specified path. Directory( const Path& newPath ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** File Attribute Accessor Methods /// Return whether or not the file system node is a file. RIM_INLINE virtual Bool isAFile() const { return false; } /// Return whether or not the file system node is a directory. RIM_INLINE virtual Bool isADirectory() const { return true; } /// Return whether or not this directory exists. virtual Bool exists() const; /// Get the total size of the directory. /** * This is the total size of all child file system nodes. */ virtual LargeSize getSize() const; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Directory Modification Methods /// Set the name of the directory, the last component of its path. virtual Bool setName( const UTF8String& newName ); /// Create this directory if it doesn't exist. /** * If the directory already exists, no operation is performed * and TRUE is returned. If the creation operation was not successful, * FALSE is returned. Otherwise, TRUE is returned and the node is created. */ virtual Bool create(); /// Remove this directory and all children. virtual Bool remove(); /// Erase this directory or create it if it doesn't exist. /** * If there was an error during creation, FALSE is returned. * Otherwise, TRUE is returned and the file is erased. */ Bool erase(); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Child Accessor Methods /// Get the number of child file system nodes this Directory has. RIM_INLINE Size getChildCount() const { if ( !hasCachedChildren ) const_cast<Directory*>(this)->cacheChildren(); return children.getSize(); } /// Get the name of the directory's child at the specified index. RIM_INLINE const UTF8String& getChildName( Index index ) const { if ( !hasCachedChildren ) const_cast<Directory*>(this)->cacheChildren(); RIM_DEBUG_ASSERT_MESSAGE( index < children.getSize(), "Cannot access directory child at invalid index." ); return children[index].name; } /// Get the path to the directory child at the specified index. RIM_INLINE Path getChildPath( Index index ) const { if ( !hasCachedChildren ) const_cast<Directory*>(this)->cacheChildren(); RIM_DEBUG_ASSERT_MESSAGE( index < children.getSize(), "Cannot access directory child at invalid index." ); return Path( this->getPath(), children[index].name ); } /// Return whether or not the directory's child at the specified index is a file. RIM_INLINE Bool childIsAFile( Index index ) const { if ( !hasCachedChildren ) const_cast<Directory*>(this)->cacheChildren(); RIM_DEBUG_ASSERT_MESSAGE( index < children.getSize(), "Cannot access directory child at invalid index." ); return children[index].isAFile; } /// Return whether or not the directory's child at the specified index is a directory. RIM_INLINE Bool childIsADirectory( Index index ) const { if ( !hasCachedChildren ) const_cast<Directory*>(this)->cacheChildren(); RIM_DEBUG_ASSERT_MESSAGE( index < children.getSize(), "Cannot access directory child at invalid index." ); return !children[index].isAFile; } /// Return whether or not the directory has a child with the specified name. Bool hasChild( const UTF8String& name ) const; /// Refresh the directory's cache of child file system nodes. RIM_INLINE void refreshChildren() { hasCachedChildren = false; children.clear(); cacheChildren(); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Current Working Directory Accessor Methods /// Get the absolute path of the current working directory. static Path getCurrent(); /// Set the path of the current working directory. /** * If the attempt to set the current working directory to the specified * path fails, FALSE is returned and the current working directory is not * changed. Otherwise, if the attempt succeeds, TRUE is returned and the * current working directory is set to the specified path. */ static Bool setCurrent( const Path& path ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Important Directory Accessor Methods /// Return the path to the directory which contains this application's executable. static Path getExecutable(); /// Return the path to the system's applications directory. /** * On Mac OS X, this is the /Applications/ directory. On Windows * this is the C:\Program Files\ directory. */ static Path getApplications(); /// Return the path to the system user's home folder. static Path getUser(); /// Return the path to the system user's documents directory. static Path getDocuments(); /// Return the path to the system user's desktop directory. static Path getDesktop(); /// Return the path to the system user's preferences directory. static Path getPreferences(); private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Child Info /// A class which contains information about a child file system node of this directory. class ChildInfo { public: RIM_INLINE ChildInfo( const UTF8String& newName, Bool newIsAFile ) : name( newName ), isAFile( newIsAFile ) { } UTF8String name; Bool isAFile; }; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Helper Methods /// Cache the children of this directory if they haven't been cached yet. void cacheChildren(); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Members /// A list of the names of the child file system nodes of this directory. ArrayList<ChildInfo> children; /// Whether or not the children of this directory have been Bool hasCachedChildren; }; //########################################################################################## //************************* End Rim File System Namespace ******************************** RIM_FILE_SYSTEM_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_DIRECTORY_H <file_sep>/* * rimGraphicsGUIDivider.h * Rim Graphics GUI * * Created by <NAME> on 2/7/13. * Copyright 2013 Headspace Systems. All rights reserved. * */ #ifndef INCLUDE_RIM_GRAPHICS_GUI_DIVIDER_H #define INCLUDE_RIM_GRAPHICS_GUI_DIVIDER_H #include "rimGraphicsGUIBase.h" #include "rimGraphicsGUIObject.h" //########################################################################################## //************************ Start Rim Graphics GUI Namespace ****************************** RIM_GRAPHICS_GUI_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class which represents a rectangular region that divides a view. /** * The divider is a horizontal or vertical line aligned within the divider's * area. */ class Divider : public GUIObject { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructors /// Create a new sizeless divider positioned at the origin of its coordinate system. Divider(); /// Create a new divider which occupies the specified rectangle. Divider( const Rectangle& newRectangle, const Orientation& newOrientation = Orientation::HORIZONTAL ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Orientation Accessor Methods /// Return an object which describes how this divider's dividing line is rotated. RIM_INLINE const Orientation& getOrientation() const { return orientation; } /// Set an object which describes how this divider's dividing line is rotated. RIM_INLINE void setOrientation( const Orientation& newOrientation ) { orientation = newOrientation; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Alignment Accessor Methods /// Return an object which describes how this divider's dividing line is aligned within its area. RIM_INLINE const Origin& getAlignment() const { return alignment; } /// Set an object which describes how this divider's dividing line is aligned within its area. RIM_INLINE void setAlignment( const Origin& newAlignment ) { alignment = newAlignment; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Border Accessor Methods /// Return a mutable object which describes this divider's border. RIM_INLINE Border& getBorder() { return border; } /// Return an object which describes this divider's border. RIM_INLINE const Border& getBorder() const { return border; } /// Set an object which describes this divider's border. RIM_INLINE void setBorder( const Border& newBorder ) { border = newBorder; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Divider Line Width Accessor Methods /// Return the width of this divider's dividing line. RIM_INLINE Float getDividerWidth() const { return dividerWidth; } /// Set the width of this divider's dividing line. RIM_INLINE void setDividerWidth( Float newDividerWidth ) { dividerWidth = math::max( newDividerWidth, Float(0) ); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Content Bounding Box Accessor Methods /// Return the 3D bounding box for the divider's dividing line in its local coordinate frame. RIM_INLINE AABB3f getLocalDividerBounds() const { return AABB3f( this->getLocalDividerBoundsXY(), AABB1f( Float(0), this->getSize().z ) ); } /// Return the 2D bounding box for the divider's dividing line in its local coordinate frame. AABB2f getLocalDividerBoundsXY() const; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Background Color Accessor Methods /// Return the background color for this divider's dividing line. RIM_INLINE const Color4f& getBackgroundColor() const { return backgroundColor; } /// Set the background color for this divider's dividing line. RIM_INLINE void setBackgroundColor( const Color4f& newBackgroundColor ) { backgroundColor = newBackgroundColor; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Border Color Accessor Methods /// Return the border color used when rendering a divider's dividing line. RIM_INLINE const Color4f& getBorderColor() const { return borderColor; } /// Set the border color used when rendering a divider's dividing line. RIM_INLINE void setBorderColor( const Color4f& newBorderColor ) { borderColor = newBorderColor; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Drawing Method /// Draw this object using the specified GUI renderer to the given parent coordinate system bounds. /** * The method returns whether or not the object was successfully drawn. * * The default implementation draws nothing and returns TRUE. */ virtual Bool drawSelf( GUIRenderer& renderer, const AABB3f& parentBounds ) const; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Static Construction Methods /// Construct a smart-pointer-wrapped instance of this class using the constructor with the given arguments. RIM_INLINE static Pointer<Divider> construct() { return Pointer<Divider>::construct(); } /// Construct a smart-pointer-wrapped instance of this class using the constructor with the given arguments. RIM_INLINE static Pointer<Divider> construct( const Rectangle& newRectangle ) { return Pointer<Divider>::construct( newRectangle ); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Public Static Data Members /// The default border that is used for a divider. static const Border DEFAULT_BORDER; /// The default line width that is used for a divider. static const Float DEFAULT_DIVIDER_WIDTH; /// The default color used for the main part of the divider's area. static const Color4f DEFAULT_BACKGROUND_COLOR; /// The default color used for the border of the divider's area. static const Color4f DEFAULT_BORDER_COLOR; private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Members /// An object which describes how this divider is rotated within its area. Orientation orientation; /// An object which describes how this divider is aligned within its area. Origin alignment; /// An object which describes the appearance of this divider's border. Border border; /// The width of the dividing line in vertical screen coordinates. Float dividerWidth; /// The color used for the main part of the divider's area. Color4f backgroundColor; /// The color used for the border of the divider's area. Color4f borderColor; }; //########################################################################################## //************************ End Rim Graphics GUI Namespace ******************************** RIM_GRAPHICS_GUI_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_GRAPHICS_GUI_DIVIDER_H <file_sep>/* * rimPhysicsConstraintsConfig.h * Rim Physics * * Created by <NAME> on 6/7/08. * Copyright 2008 Rim Software. All rights reserved. * */ #ifndef INCLUDE_RIM_PHYSICS_CONSTRAINTS_CONFIG_H #define INCLUDE_RIM_PHYSICS_CONSTRAINTS_CONFIG_H #include "../rimPhysicsConfig.h" #include "../rimPhysicsObjects.h" #include "../rimPhysicsShapes.h" #include "../rimPhysicsCollision.h" //########################################################################################## //########################################################################################## //############ //############ Library Namespace Configuration //############ //########################################################################################## //########################################################################################## #ifndef RIM_PHYSICS_CONSTRAINTS_NAMESPACE_START #define RIM_PHYSICS_CONSTRAINTS_NAMESPACE_START RIM_PHYSICS_NAMESPACE_START namespace constraints { #endif #ifndef RIM_PHYSICS_CONSTRAINTS_NAMESPACE_END #define RIM_PHYSICS_CONSTRAINTS_NAMESPACE_END }; RIM_PHYSICS_NAMESPACE_END #endif //########################################################################################## //********************* Start Rim Physics Constraints Namespace ************************** RIM_PHYSICS_CONSTRAINTS_NAMESPACE_START //****************************************************************************************** //########################################################################################## using rim::physics::objects::RigidObject; using rim::physics::objects::ObjectPair; using rim::physics::collision::CollisionResultSet; using rim::physics::collision::CollisionManifold; using rim::physics::collision::CollisionPoint; using rim::physics::shapes::CollisionShapeMaterial; //########################################################################################## //********************* End Rim Physics Constraints Namespace **************************** RIM_PHYSICS_CONSTRAINTS_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_PHYSICS_CONSTRAINTS_CONFIG_H <file_sep>/* * rimGraphicsShaderSourceAssetTranscoder.h * Rim Software * * Created by <NAME> on 6/29/14. * Copyright 2014 __MyCompanyName__. All rights reserved. * */ #ifndef INCLUDE_RIM_GRAPHICS_SHADER_PASS_SOURCE_ASSET_TRANSCODER_H #define INCLUDE_RIM_GRAPHICS_SHADER_PASS_SOURCE_ASSET_TRANSCODER_H #include "rimGraphicsAssetsConfig.h" #include "rimGraphicsShaderProgramAssetTranscoder.h" //########################################################################################## //*********************** Start Rim Graphics Assets Namespace **************************** RIM_GRAPHICS_ASSETS_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class which encodes and decodes graphics shader source code to the asset format. class GraphicsShaderSourceAssetTranscoder : public AssetTypeTranscoder<ShaderSource> { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Destructor //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Text Encoding/Decoding Methods /// Decode an object from the specified string stream, returning a pointer to the final object. virtual Pointer<ShaderSource> decodeText( const AssetType& assetType, const AssetObject& assetObject, ResourceManager* resourceManager = NULL ); /// Encode an object of this asset type into a text-based format. virtual Bool encodeText( UTF8StringBuffer& buffer, ResourceManager* resourceManager, const ShaderSource& shaderSource ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Public Static Data Members /// An object indicating the asset type for a graphics shader source. static const AssetType SHADER_SOURCE_ASSET_TYPE; private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Type Declarations /// An enum describing the fields that a graphics shader source can have. typedef enum Field { /// An undefined field. UNDEFINED = 0, /// "type" The type of shader that this shader source represents. TYPE, /// "source" A string containing the source code for this shader source. SOURCE }; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Helper Methods /// Return an enum value indicating the field indicated by the given field name. static Field getFieldType( const AssetObject::String& name ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Memberss /// A temporary asset object used when parsing shader source child objects. AssetObject tempObject; }; //########################################################################################## //*********************** End Rim Graphics Assets Namespace ****************************** RIM_GRAPHICS_ASSETS_NAMESPACE_END //****************************************************************************************** //########################################################################################## //########################################################################################## //**************************** Start Rim Assets Namespace ******************************** RIM_ASSETS_NAMESPACE_START //****************************************************************************************** //########################################################################################## template <> RIM_INLINE const AssetType& AssetType::of<rim::graphics::shaders::ShaderSource>() { return rim::graphics::assets::GraphicsShaderSourceAssetTranscoder::SHADER_SOURCE_ASSET_TYPE; } //########################################################################################## //**************************** End Rim Assets Namespace ********************************** RIM_ASSETS_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_GRAPHICS_SHADER_PASS_SOURCE_ASSET_TRANSCODER_H <file_sep>/* * rimPixelFormat.h * Rim Graphics * * Created by <NAME> on 11/30/09. * Copyright 2009 Rim Software. All rights reserved. * */ #ifndef INCLUDE_RIM_PIXEL_TYPE_H #define INCLUDE_RIM_PIXEL_TYPE_H #include "rimImagesConfig.h" //########################################################################################## //**************************** Start Rim Images Namespace ******************************** RIM_IMAGES_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class representing the type of a pixel: its underlying component type and number of channels. class PixelFormat { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Pixel Type Enum Declaration typedef enum Enum { /// An undefined pixel type. UNDEFINED, //****************************************************************** // RGB Pixel Types. /// An RGB pixel type with 8 bits per component. R8_G8_B8, /// An RGB pixel type with 16 bits per component. R16_G16_B16, /// An RGB pixel type with 16 floating-point bits per component. R16F_G16F_B16F, /// An RGB pixel type with 32 floating-point bits per component. R32F_G32F_B32F, /// An RGB pixel type with 8 bits per component. RGB = R8_G8_B8, /// An RGB pixel type with 8 bits per component. RGB8 = R8_G8_B8, /// An RGB pixel type with 16 bits per component. RGB16 = R16_G16_B16, /// An RGB pixel type with 16 floating-point bits per component. RGB16F = R16F_G16F_B16F, /// An RGB pixel type with 32 floating-point bits per component. RGB32F = R32F_G32F_B32F, //****************************************************************** // RGBA Pixel Types. /// An RGBA pixel type with 8 bits per component. R8_G8_B8_A8, /// An RGBA pixel type with 16 bits per component. R16_G16_B16_A16, /// An RGBA pixel type with 16 floating-point bits per component. R16F_G16F_B16F_A16F, /// An RGBA pixel type with 32 floating-point bits per component. R32F_G32F_B32F_A32F, /// An RGBA pixel type with 8 bits per component. RGBA = R8_G8_B8_A8, /// An RGBA pixel type with 8 bits per component. RGBA8 = R8_G8_B8_A8, /// An RGBA pixel type with 16 bits per component. RGBA16 = R16_G16_B16_A16, /// An RGBA pixel type with 16 floating-point bits per component. RGBA16F = R16F_G16F_B16F_A16F, /// An RGBA pixel type with 32 floating-point bits per component. RGBA32F = R32F_G32F_B32F_A32F, //****************************************************************** // Grayscale Pixel Types. /// A single-channel pixel with 8 bits per component. GRAY8, /// A single-channel pixel with 8 bits per component. GRAY = GRAY8, /// A single-channel pixel with 16 bits per component. GRAY16, /// A single-channel pixel with 16 floating-point bits per component. GRAY16F, /// A single-channel pixel with 32 floating-point bits per component. GRAY32F, //****************************************************************** // Grayscale + Alpha Pixel Types. /// A dual-channel pixel with 8 bits per component. GRAY8_ALPHA8, /// A dual-channel pixel with 16 bits per component. GRAY16_ALPHA16, /// A dual-channel pixel with 16 floating-point bits per component. GRAY16F_ALPHA16F, /// A dual-channel pixel with 32 floating-point bits per component. GRAY32F_ALPHA32F }; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructors /// Create a pixel type object with an UNDEFINED pixel type. RIM_INLINE PixelFormat() : type( UNDEFINED ) { } /// Create a pixel type object from the specified pixel type Enum. RIM_INLINE PixelFormat( PixelFormat::Enum newType ) : type( newType ) { } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Enum Cast Operator /// Convert this light type to an enum value. RIM_INLINE operator Enum () const { return type; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Per-Pixel Size Accessor Methods /// Get the number of bits required for each pixel of this pixel type. RIM_INLINE Size getSizeInBits() const { return this->getSizeInBytes() << 3; } /// Get the number of bytes required for each pixel of this pixel type. Size getSizeInBytes() const; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Channel Property Accessor Methods /// Return the primitive type used for each channel of this pixel type. /** * Channel indices start at 0 and go up to N-1 for N channels. If the * specified channel index is outside of the valid range, the primitive * UNDEFINED will be returned. */ PrimitiveType getChannelType( Index channelIndex ) const; /// Get the size in bits for each channel of this pixel type. /** * Channel indices start at 0 and go up to N-1 for N channels. If the * specified channel index is outside of the valid range, size of 0 * will be returned. */ RIM_INLINE Size getChannelSizeInBits( Index channelIndex ) const { return this->getChannelType( channelIndex ).getSizeInBits(); } /// Get the size in bytes for each channel of this pixel type. /** * Channel indices start at 0 and go up to N-1 for N channels. If the * specified channel index is outside of the valid range, size of 0 * will be returned. */ RIM_INLINE Size getChannelSizeInBytes( Index channelIndex ) const { return this->getChannelType( channelIndex ).getSizeInBytes(); } /// Return the number of channels that this pixel type has. Size getChannelCount() const; /// Return whether or not this pixel type has an alpha (transparency) channel. Bool hasAlpha() const; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Pixel Type String Conversion Methods /// Return a string representation of the pixel type. String toString() const; /// Convert this pixel type into a string representation. RIM_INLINE operator String () const { return this->toString(); } private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Members /// An enum value specifying the pixel type. Enum type; }; //########################################################################################## //**************************** End Rim Images Namespace ********************************** RIM_IMAGES_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_PIXEL_TYPE_H <file_sep>/* * rimPhysicsRigidObject.h * Rim Physics * * Created by <NAME> on 11/28/09. * Copyright 2009 Rim Software. All rights reserved. * */ #ifndef INCLUDE_RIM_PHYSICS_RIGID_OBJECT_H #define INCLUDE_RIM_PHYSICS_RIGID_OBJECT_H #include "rimPhysicsObjectsConfig.h" //########################################################################################## //*********************** Start Rim Physics Objects Namespace **************************** RIM_PHYSICS_OBJECTS_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class which represents a physically-based rigid object in 3D space. class RigidObject { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructors /// Create a default rigid object centered at the origin with no shape. RigidObject(); /// Create a rigid object with the specified shape centered at the origin. RigidObject( const CollisionShape* newShape ); /// Create a copy of this rigid object, duplicating all state. RigidObject( const RigidObject& other ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Destructor /// Destroy this rigid object and all state it contains. virtual ~RigidObject(); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Assignment Operator /// Assign the state of one rigid object to this rigid object. RigidObject& operator = ( const RigidObject& other ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Shape Accessor Methods /// Add a collision shape to this object. /** * This method creates an instance of the specified shape and stores the * instance, rather than the original shape. This can avoid duplication * of collision data, as only one object must have the transformed collision data. * Thus, it is up to the user to allocate and store CollisionShape objects. * NULL shapes are not allowed. Attempting to add a NULL shape will have no effect. * * Setting the object's shape also causes it to use the inertia tensor, mass, and local * center of mass from the shape if the tensor and/or mass have not already been * specifically set. */ void addShape( const CollisionShape* newShape ); /// Remove the specified shape from this rigid object. /** * If the specified shape is used by this rigid object, it is removed * from the object and TRUE is returned. Otherwise, the object * is unchanged and FALSE is returned. */ Bool removeShape( const CollisionShape* shape ); /// Remove all shapes from this rigid object. void removeShapes(); /// Return a const pointer to the shape of this rigid object at the specified index. RIM_INLINE const CollisionShape* getShape( Index shapeIndex ) const { if ( shapeIndex < shapeInstances.getSize() ) return shapeInstances[shapeIndex]->getShape(); else return NULL; } /// Return a pointer to this object's shape, instanced into world space. /** * If necessary, this method updates the current state of this object's * collision shape instance in order to reflect the object's current * transformation. If the object has no shape, a NULL pointer is returned. */ RIM_INLINE const CollisionShapeInstance* getShapeInstance( Index shapeIndex ) const { if ( shapeIndex < shapeInstances.getSize() ) { if ( shapesNeedNewTransform ) updateShapeTransforms(); return shapeInstances[shapeIndex]; } else return NULL; } /// Return the number of shapes that this rigid object has. RIM_INLINE Size getShapeCount() const { return shapeInstances.getSize(); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Bounding Sphere Accessor Methods /// Return a const reference to the bounding sphere for this object in world space RIM_INLINE const BoundingSphere& getBoundingSphere() const { if ( shapesNeedNewTransform ) updateShapeTransforms(); return boundingSphere; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Position Accessor Methods /// Return the position of this rigid object in world space. RIM_INLINE const Vector3& getPosition() const { return transform.position; } /// Set the position of this rigid object in world space. RIM_INLINE void setPosition( const Vector3& newPosition ) { centerOfMass = newPosition + (centerOfMass - transform.position); transform.position = newPosition; shapesNeedNewTransform = true; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Orientation Accessor Methods /// Return a reference to this object's 3x3 orthonormal rotation matrix. /** * This is the orthonormal matrix which defines the rotational transformation * from object to world space. */ RIM_INLINE const Matrix3& getOrientation() const { return transform.orientation; } /// Set this object's 3x3 orthonormal rotation matrix. /** * This is the orthonormal matrix which defines the rotational transformation * from object to world space. The incoming orientation marix is automatically * orthonormalized using Grahm-Schmidt orthonormalization. This method * keeps the object's position stationary in world space and rotates * everything else (center of mass, inertia tensor). */ void setOrientation( const Matrix3& newOrientation ); /// Set this object's 3x3 orthonormal rotation matrix relative to the object's center of mass. /** * This is the orthonormal matrix which defines the rotational transformation * from object to world space. The incoming orientation marix is automatically * orthonormalized using Grahm-Schmidt orthonormalization. This method * keeps the object's center of mass stationary in world space and rotates * everything else. */ void setCenterOfMassOrientation( const Matrix3& newCOMOrientation ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Transform Accessor Methods /// Return a const reference to this object's transformation. /** * This indicates the rigid transformation for this object, * allowing translation, rotation, and uniform scaling. */ RIM_FORCE_INLINE const Transform3& getTransform() const { return transform; } /// Set this object's transformation. /** * This indicates the rigid transformation for this object, * allowing translation, rotation, and uniform scaling. */ void setTransform( const Transform3& newTransform ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Scale Accessor Methods /// Return the multiplicative scale of this object. /** * A value of 1 means that no scaling occurrs. A value greater than * 1 will increase the size of the object, while a value less than 1 * will decrease the size of the object. */ RIM_FORCE_INLINE const Vector3& getScale() const { return transform.scale; } /// Set the multiplicative scale of this object. /** * A value of 1 means that no scaling occurrs. A value greater than * 1 will increase the size of the object, while a value less than 1 * will decrease the size of the object. The input scaling factor * is clamped to the range of [0,+infinity]. Setting the scale * keeps the object's position fixed in world space, potentially * moving its word-space center of mass. The object's world-space * inertia tensor is also recalculated to take the object's new scale * into account. */ void setScale( Real newScale ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Center of Mass Accessor Methods /// Return the position of this object's center of mass in world space. RIM_FORCE_INLINE const Vector3& getCenterOfMass() const { return centerOfMass; } /// Set the position of this object's center of mass in world space. /** * A call to this method moves the object (changing its position) * without changing its orientation so that it's object-space center * of mass is coincident with the specified world-space center of mass position. */ RIM_INLINE void setCenterOfMass( const Vector3& newCenterOfMass ) { // Update the world-space position of this object based on the new center of mass position. transform.position = newCenterOfMass + transform.position - centerOfMass; centerOfMass = newCenterOfMass; shapesNeedNewTransform = true; } /// Return the position of this object's center of mass in object space. RIM_INLINE Vector3 getLocalCenterOfMass() const { return transform.transformToObjectSpace( centerOfMass ); } /// Set the position of this object's center of mass in local object space. /** * This method does not move the object, but instead changes where the * center of mass of the object is located, relative to the origin in * object space. */ RIM_INLINE void setLocalCenterOfMass( const Vector3& newLocalCenterOfMass ) { centerOfMass = transform.transformToWorldSpace( newLocalCenterOfMass ); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Velocity Accessor Methods /// Return the linear velocity of this rigid object in world units per second. RIM_INLINE const Vector3& getVelocity() const { return velocity; } /// Set the linear velocity of this rigid object in world units per second. RIM_INLINE void setVelocity( const Vector3& newVelocity ) { velocity = newVelocity; } /// Get a temporary bias for this object's velocity used to correct constraint error. /** * This velocity vector is zeroed out every frame so that it doesn't affect * the object's kinetic energy, unlike normal linear velocity. */ RIM_INLINE const Vector3& getBiasVelocity() const { return biasVelocity; } /// Set a temporary bias for this object's velocity used to correct constraint error. /** * This velocity vector is zeroed out every frame so that it doesn't affect * the object's kinetic energy, unlike normal linear velocity. */ RIM_INLINE void setBiasVelocity( const Vector3& newBiasVelocity ) { biasVelocity = newBiasVelocity; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Radial Velocity Accessor Methods /// Return the linear velocity of this rigid object at the specified point relative to its center of mass. RIM_INLINE Vector3 getVelocityAtPoint( const Vector3& point ) const { if ( isStatic ) return Vector3::ZERO; return velocity + math::cross( angularVelocity, point ); } /// Return the bias linear velocity of this rigid object at the specified point relative to its center of mass. RIM_INLINE Vector3 getBiasVelocityAtPoint( const Vector3& point ) const { if ( isStatic ) return Vector3::ZERO; return biasVelocity + math::cross( biasAngularVelocity, point ); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Angular Velocity Accessor Methods /// Return the angular velocity of this rigid object in radians per second. RIM_INLINE const Vector3& getAngularVelocity() const { return angularVelocity; } /// Set the angular velocity of this rigid object in radians per second. RIM_INLINE void setAngularVelocity( const Vector3& newAngularVelocity ) { angularVelocity = newAngularVelocity; } /// Get a temporary bias for this object's angular velocity used to correct constraint error. /** * This angular velocity vector is zeroed out every frame so that it doesn't affect * the object's kinetic energy, unlike normal angular velocity. */ RIM_INLINE const Vector3& getBiasAngularVelocity() const { return biasAngularVelocity; } /// Set a temporary bias for this object's angular velocity used to correct constraint error. /** * This angular velocity vector is zeroed out every frame so that it doesn't affect * the object's kinetic energy, unlike normal angular velocity. */ RIM_INLINE void setBiasAngularVelocity( const Vector3& newBiasAngularVelocity ) { biasAngularVelocity = newBiasAngularVelocity; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Impulse Application Methods /// Apply the specified impulse vector at a point relative to the object's center of mass. RIM_INLINE void applyImpulse( const Vector3& impulse, const Vector3& point ) { velocity += inverseMass*impulse; angularVelocity += inverseWorldSpaceInertiaTensor * math::cross( point, impulse ); } /// Apply the specified bias impulse vector at a point relative to the object's center of mass. RIM_INLINE void applyBiasImpulse( const Vector3& biasImpulse, const Vector3& point ) { biasVelocity += inverseMass*biasImpulse; biasAngularVelocity += inverseWorldSpaceInertiaTensor * math::cross( point, biasImpulse ); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Force Accessor Methods /// Return the netforce vector acting on this object. RIM_INLINE const Vector3& getForce() const { return force; } /// Set the net force vector for this object. RIM_INLINE void setForce( const Vector3& newForce ) { force = newForce; } /// Apply the specified force vector to this object's center of mass. /** * This method adds the specified force vector to this object's * net force vector. */ RIM_INLINE void applyForce( const Vector3& forceVector ) { force += forceVector; } /// Apply the specified force vector at a point relative to the object's center of mass. /** * This method will produce a change in the object's torque vector * if the force and point to center of mass vectors are not in the * same direction. */ RIM_INLINE void applyForce( const Vector3& forceVector, const Vector3& point ) { force += forceVector; torque += math::cross( point, forceVector ); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Torque Accessor Methods /// Return the net torque vector acting on this object. RIM_INLINE const Vector3& getTorque() const { return torque; } /// Set the net torque vector for this object. RIM_INLINE void setTorque( const Vector3& newTorque ) { torque = newTorque; } /// Apply the specified torque vector to this object's center of mass. /** * This method adds the specified torque vector to this object's * net torque vector. */ RIM_INLINE void applyTorque( const Vector3& torqueVector ) { torque += torqueVector; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Mass Accessor Methods /// Return the world-space mass of this rigid object in mass units (kg). RIM_FORCE_INLINE Real getMass() const { return mass; } /// Set the world-space mass of this rigid object in mass units (kg). /** * This method sets the mass of the object in world space. This world-space * mass is then used to calculate an object-space mass for the object by * dividing by the scaling factor to the third power. Subsequent changes * to the object's scaling factor will cause the world-space mass to update * to reflect the stored object-space mass, preserving object density. * * The mass of the object is clamped to the range [0,+infinity]. */ RIM_INLINE void setMass( Real newMass ) { inheritsShapeMassQuantities = false; if ( newMass <= Real(0) ) inverseMass = mass = objectSpaceMass = Real(0); else { objectSpaceMass = newMass/(transform.scale.x*transform.scale.y*transform.scale.z); mass = newMass; inverseMass = Real(1)/mass; } } /// Return the inverse world-space mass of this rigid object in mass units (kg). /** * If the object's mass is 0, the inverse mass will also be 0, * otherwise it is the reciprocal of the object's mass. */ RIM_FORCE_INLINE Real getInverseMass() const { return inverseMass; } /// Set the object-space mass of this rigid object in mass units (kg). RIM_FORCE_INLINE Real getLocalMass() const { return objectSpaceMass; } /// Set the object-space mass of this rigid object in mass units (kg). /** * This method sets the mass of the object in object space, before * any transformation-based scaling occurrs. The world-space mass * for this object will then be equal to the object-space mass times * the scaling factor to the third power. * * The local mass of the object is clamped to the range [0,+infinity]. */ RIM_INLINE void setLocalMass( Real newMass ) { inheritsShapeMassQuantities = false; if ( newMass <= Real(0) ) inverseMass = mass = objectSpaceMass = Real(0); else { objectSpaceMass = newMass; mass = objectSpaceMass*transform.scale.x*transform.scale.y*transform.scale.z; inverseMass = Real(1)/mass; } } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Inertia Tensor Accessor Methods /// Return the inverse inertia tensor for this object in world space. RIM_INLINE const Matrix3& getInverseWorldSpaceInertiaTensor() const { if ( isStatic ) return Matrix3::ZERO; return inverseWorldSpaceInertiaTensor; } /// Return the inverse inertia tensor for this object in object space. RIM_INLINE const Matrix3& getInverseObjectSpaceInertiaTensor() const { return inverseObjectSpaceInertiaTensor; } /// Set the inertia tensor for this object in object space. RIM_NO_INLINE void setInertiaTensor( const Matrix3& newInertiaTensor ) { if ( math::abs( newInertiaTensor.getDeterminant() ) < math::epsilon<Real>() ) inverseObjectSpaceInertiaTensor = Matrix3::ZERO; else inverseObjectSpaceInertiaTensor = newInertiaTensor.invert(); inheritsShapeMassQuantities = false; updateWorldSpaceInertiaTensor(); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Object Is Static Accessor Methods /// Return whether or not this object should be considered to be a static object. RIM_INLINE Bool getIsStatic() const { return isStatic; } /// Set whether or not this object should be considered to be a static object. RIM_INLINE void setIsStatic( Bool newIsStatic ) { isStatic = newIsStatic; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Object Hash Code Accessor Methods /// Return an integral hash code for this rigid object. /** * This hash code should be unique to every rigid object. It is * generated at object construction from the address of the 'this' * pointer for the object. */ RIM_FORCE_INLINE Hash getHashCode() const { return hashCode; } private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Helper Methods /// Compute a new world-space inertia tensor from the current orientation and object-space inertia tensor. RIM_INLINE void updateWorldSpaceInertiaTensor() { // Scale inertial quantities by the scale factor to the fifth power. // This is because a moment of inertia is related to scale by the fifth power, // 3x from mass, and 2x from the inertia calculation. Real inertialScaleFactor = transform.scale.x*transform.scale.y*transform.scale.z* transform.scale.x*transform.scale.y; inverseWorldSpaceInertiaTensor = transform.orientation * inverseObjectSpaceInertiaTensor / inertialScaleFactor * transform.orientation.transpose(); } /// Compute a new world-space inertia tensor from the current orientation and object-space inertia tensor. RIM_INLINE void updateWorldSpaceMassQuantities() { // Scale mass quantities by the scale factor to the third power. // This is because when the scale goes up by 2x, the volume and therefore mass go up by 8x. Real massScaleFactor = transform.scale.x*transform.scale.y*transform.scale.z; // Scale inertial quantities by the scale factor to the fifth power. // This is because a moment of inertia is related to scale by the fifth power, // 3x from mass, and 2x from the inertia calculation. Real inertialScaleFactor = transform.scale.x*transform.scale.y*massScaleFactor; inverseWorldSpaceInertiaTensor = transform.orientation * inverseObjectSpaceInertiaTensor / inertialScaleFactor * transform.orientation.transpose(); if ( objectSpaceMass != Real(0) ) { mass = objectSpaceMass*massScaleFactor; inverseMass = Real(1)/mass; } } /// Update the transformations for all shape instances in this object so that they reflect the object's transformation. void updateShapeTransforms() const; /// Update the inertia tensor and mass for this object from its shapes' masses and inertia tensors. void updateShapeMassQuantities(); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Transform/Dyanmics Data Members /// The transformation from object space to world space for this rigid object. Transform3 transform; /// The center of mass of this object in 3D world space. Vector3 centerOfMass; /// The linear velocity of this object in length units per second. Vector3 velocity; /// A temporary bias for this object's velocity used to correct constraint error. Vector3 biasVelocity; /// The angular velocity of this object in world space. Vector3 angularVelocity; /// A temporary bias for this object's angular velocity used to correct constraint error. Vector3 biasAngularVelocity; /// The net force vector of this object in world space. Vector3 force; /// The net torque vector of this object in world space. Vector3 torque; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Mass Data Members /// The mass of this object in mass units (kg) after world-space scaling. Real mass; /// The inverse mass of this object in inverse mass units (1/kg) after world-space scaling. Real inverseMass; /// The mass of this object in object space (before scaling). Real objectSpaceMass; /// The inverse inertia tensor of this object in world space. Matrix3 inverseWorldSpaceInertiaTensor; /// The inverse inertia tensor of this object in object space. Matrix3 inverseObjectSpaceInertiaTensor; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Shape Data Members /// A pointer to the collision shape instances that specify this object's 3D shape(s). ShortArrayList<Pointer<CollisionShapeInstance>,2> shapeInstances; /// A bounding sphere which contains this entire object in 3D world space. mutable BoundingSphere boundingSphere; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Other Private Data Members /// A hash code for this rigid object, generated internally from the object's address in memory. Hash hashCode; /// Whether or not this object should be considered to be static (not physically based). Bool isStatic; /// Whether or not the rigid object's transformation has been changed. /** * This value is set to TRUE whenever this object's transformation is * changed, indicating that the object's shape instances needs to update * their transformations with the new object transformation. */ mutable Bool shapesNeedNewTransform; /// A boolean indicating whether or not this object should automatically use mass quantities derived from its shape(s). /** * By default, this value is TRUE until the setInertiaTensor() or setMass() method is called * by the user. This indicates that the user is overriding the default behavior * for handling shape inertial quantities. */ Bool inheritsShapeMassQuantities; }; //########################################################################################## //*********************** End Rim Physics Objects Namespace ****************************** RIM_PHYSICS_OBJECTS_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_PHYSICS_RIGID_OBJECT_H <file_sep>/* * rimFileWriter.h * Rim IO * * Created by <NAME> on 3/21/08. * Copyright 2008 __MyCompanyName__. All rights reserved. * */ #ifndef INCLUDE_RIM_FILE_WRITER_H #define INCLUDE_RIM_FILE_WRITER_H #include "rimIOConfig.h" #include "../rimFileSystem.h" #include "rimDataOutputStream.h" #include "rimStringOutputStream.h" //########################################################################################## //****************************** Start Rim IO Namespace ********************************** RIM_IO_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class that allows the user to easily write to a file. /** * This purpose of this class is to write to a file in an * object oriented and flexible manner. It allows the user * to write individual bytes (characters), a sequence of characters, * and raw data. One can open and close the file writer, and * manipulate it's position in the file by seeking an absolute * position or moving relatively. This class can also create a file * if it does not initially exist when the file writer is instantiated. * It wraps C's standard file in/out. */ class FileWriter : public DataOutputStream, public StringOutputStream { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructors /// Create a FileWriter object which should write to the file at the specified path string. FileWriter( const Char* filePath ); /// Create a FileWriter object which should write to the file at the specified path string. FileWriter( const fs::UTF8String& filePath ); /// Create a FileWriter object which should write to the file at the specified path. FileWriter( const fs::Path& filePath ); /// Create a FileWriter object which should write to the specified file. FileWriter( const fs::File& file ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Destructor /// Destroy a file reader and free all of it's resources (close the file). ~FileWriter(); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** File Attribute Accessor Methods /// Get the file object that this file writer is reading from. /** * This method returns a constant reference to a file object representing * the file that this file writer is associated with. * * @return the file this file writer is associated with. */ RIM_INLINE const fs::File& getFile() const { return file; } /// Get the path to the file that this file writer is reading. /** * This method returns a constant reference to a string representing * the path to the file that this file writer is associated with. * * @return the path to the file this file writer is associated with. */ RIM_INLINE const fs::Path& getFilePath() const { return file.getPath(); } /// Get the size of the file in bytes. /** * This method queries and returns the size of the file * in bytes. The file does not have to be open to do this, but * it does have to exist. If the file does not exist, then * a IOException is thrown. * * @return the total size of the file in bytes. */ RIM_INLINE LargeSize getFileSize() const { return file.getSize(); } /// Get whether or not the file associated with this writer exists. /** * This method checks whether or not the file pointed to by the * path queried by getFilePath() exists. It then returns TRUE * if the file exists or returns FALSE if the file does not exist. * * @return whether or not the file associated with this file writer exists. */ RIM_INLINE Bool fileExists() const { return file.exists(); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** File Writer Open/Close Methods /// Open the file writer, allocating whatever resources needed to do so. Bool open(); /// Close the file writer, freeing all resources used during writing. /** * This method closes the file writer, and ensures that all resources * that it used to perform output are freed (such as files, etc.). * If the file writer is currently open, then this method guarantees that * the writer is closed. If the file is unable to be closed, an IOException is * thrown. If the file writer is already closed when the method is called, * then nothing is done. */ void close() throw(IOException); /// Return whether or not the file writer's file is open. /** * This method gets a boolean value from the file writer indicating * whether or not the file is currently open. If the file is open, * then TRUE is returned, and if it is closed, FALSE is returned. * * @return whether or not the file writer is open */ RIM_INLINE Bool isOpen() const { return stream != NULL; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** File Writer Flush Method /// Flush the file stream, sending all internally buffered output to the file. /** * This method causes all currently pending output data to be sent to * the file. This method ensures that this is done and that all internal * data buffers are emptied if they have any contents. If this method is called * when the file is not open, then a IOException is thrown indicating * this mistake. */ virtual void flush() throw(IOException); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** File Erase Methods /// Erase the file associated with this file writer. /** * This method erases the entire contents of the file being written * and resets the current write pointer to the begining of the file. * The method returns whether or not the erase operation was successful. * Erasing a file can fail if the file is not open or if the file is not * valid. */ Bool erase(); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Seek/Move Methods /// Return whether or not this file writer allows seeking. /** * If the file which is being written is open and valid, this * method returns TRUE. Otherwise, the method returns false indicating * that seeking is not allowed. */ virtual Bool canSeek() const; /// Return whether or not this stream can seek by the specified amount in bytes. /** * Since some streams may not support rewinding, this method can be used * to determine if a given seek operation can succeed. The method can also * be used to determine if the end of a stream has been reached, a seek past * the end of a file will fail. */ virtual Bool canSeek( Int64 relativeOffset ) const; /// Move the current position in the stream by the specified relative signed offset in bytes. /** * The method attempts to seek in the stream by the specified amount and * returns the signed amount that the position in the stream was changed by * in bytes. A negative offset indicates that the position should be moved in * reverse and a positive offset indicates that the position should be moved * forwards. */ virtual Int64 seek( Int64 relativeOffset ); /// Seek to an absolute position in the file. /** * This method attempts to seek to the specified absolute * position in the file, and then returns the resulting * position in the file of the file reader after the method call. * Positions within a file are specified with 0 representing * the beginning of the file, and each positive increment * of 1 representing a position 1 more byte * further in the file. If the file is not open when the method * is called, no seek operation is performed and the current position in * the file is returned. * * @param newFilePosition - The desired position in the file to seek to. * @return the resulting position in the file after the method call. */ LargeIndex seekAbsolute( LargeIndex newFilePosition ); /// Rewind the file pointer to the beginning of the file. /** * This method moves the position in the file of the file writer * to the beginning of the file. The method returns whether or not * the seek operation was successful. The seek operation can fail * if seeking is not allowed or the file is not open. */ Bool seekStart(); /// Seek to the end of the file. /** * This method sets the current position in the file of the file * writer to be the end of the file. The method returns whether or not * the seek operation was successful. The seek operation can fail * if seeking is not allowed or if the file is not open. */ Bool seekEnd(); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Position Accessor Methods /// Get the absolute position in the file of the file writer in bytes. /** * This method queries and returns the current position in * the file of the file writer. Positions within a file * are specified with 0 representing the beginning of the file, * and each positive increment of 1 representing a position 1 more byte * further in the file. If the file is not open when the method * is called, then a IOException is thrown. * * @return the current position in the file of the file writer. */ LargeIndex getPosition() const; /// Get whether or not the file writer is at the end of the file. /** * This method queries whether or not the file writer is at the * end of the file. If it is, then TRUE is returned, otherwise * FALSE is returned. If the file is not open when the method is * called, then a IOException is thrown. * * @return whether or not the file writer is at the end of the file. */ Bool isAtEndOfFile() const; protected: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Protected Write Methods (Declared in String/DataOutputStream) /// Write the specified number of characters from the character buffer and return the number written. virtual Size writeChars( const Char* characters, Size number ); /// Write the specified number of UTF-8 characters from the character buffer and return the number written. virtual Size writeUTF8Chars( const UTF8Char* characters, Size number ); /// Write the specified number of UTF-16 characters from the character buffer and return the number written. virtual Size writeUTF16Chars( const UTF16Char* characters, Size number ); /// Write the specified number of UTF-32 characters from the character buffer and return the number written. virtual Size writeUTF32Chars( const UTF32Char* characters, Size number ); /// Write the specified number of bytes of data from the buffer to the stream. virtual Size writeData( const UByte* data, Size number ); private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Members /// The C standard stream object for the file the writer is writing to. std::FILE* stream; /// A file object representing the file we are writing to. fs::File file; }; //########################################################################################## //****************************** End Rim IO Namespace ************************************ RIM_IO_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_FILE_WRITER_H <file_sep>/* * rimGraphicsIndexedPrimitiveType.h * Rim Graphics * * Created by <NAME> on 12/27/10. * Copyright 2010 Rim Software. All rights reserved. * */ #ifndef INCLUDE_RIM_GRAPHICS_INDEXED_PRIMITIVE_TYPE_H #define INCLUDE_RIM_GRAPHICS_INDEXED_PRIMITIVE_TYPE_H #include "rimGraphicsBuffersConfig.h" //########################################################################################## //*********************** Start Rim Graphics Buffers Namespace *************************** RIM_GRAPHICS_BUFFERS_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class which is used to specify a type of indexed primitive. /** * This class is used to tell the GPU what kind of primitives are represented * by an index buffer. For instance, one could specify a list of indexed points, * lines, triangles, or quads. */ class IndexedPrimitiveType { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Indexed Primitive Type Enum Definition /// An enum representing the type of indexed primitive. typedef enum Enum { /// An undefined indexed primitive type. UNDEFINED = 0, /// An indexed primitive type where every index represents a point to draw. POINTS = 1, /// An indexed primitive type where every 2 indices represent a line segment to draw. LINES = 2, /// An indexed primitive type where all of the indices in a buffer represent a set of connected line segments to draw. /** * The first index indicates the starting vertex and each additional index indicates * the next vertex in a connected set of line segments. */ LINE_STRIP = 3, /// An indexed primitive type where all of the indices in a buffer represent a set of connected line segments to draw. /** * The first index indicates the starting vertex and each additional index indicates * the next vertex in a connected set of line segments. At the end of the list, * a line is drawn between the first and last vertex, creating a closed loop. */ LINE_LOOP = 4, /// An indexed primitive type where every 3 indices represent a triangle to draw. TRIANGLES = 5, /// An indexed primitive type where all of the indices in a buffer represent a set of connected triangles to draw. /** * The first index indicates the starting vertex, the next vertex indicates the end of the first * side of the first triangle, and the third vertex completes the first triangle. * Each additional index after that creates a triangle with the last two vertices specified. */ TRIANGLE_STRIP = 6, /// An indexed primitive type where all of the indices in a buffer represent a set of connected triangles to draw. /** * The first index indicates the starting vertex, the next vertex indicates the end of the first * side of the first triangle, and the third vertex completes the first triangle. * Each additional index after that creates a triangle with the first vertex and * the last vertex, resulting in a so-called 'fan' of triangles. */ TRIANGLE_FAN = 7, /// An indexed primitive type where every 3 indices represent a quad to draw. QUADS = 8, /// An indexed primitive type where all of the indices in a buffer represent a set of connected quads to draw. /** * The first index indicates the starting vertex, the next vertex indicates the end of the first * side of the first quad, and the third and fourth vertices completes the first quad. * Each additional 2 indices after that creates a quad with the last two vertices specified. */ QUAD_STRIP = 9, /// A polygon with 3 or more vertices. /** * For an index buffer with this type, all of the indices in the buffer define the edge * of the polygon. * * This primitive type may not be supported on all hardware but is provided for completeness. */ POLYGON = 10 }; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructors /// Create a default indexed primitive type with the UNDEFINED primitive type enum value. RIM_INLINE IndexedPrimitiveType() : type( UNDEFINED ) { } /// Create a new indexed primitive type with the specified indexed primitive type enum value. RIM_INLINE IndexedPrimitiveType( Enum newType ) : type( newType ) { } /// Create a new indexed primitive type for the specified vertex count. /** * The constructor guesses the primitive type from the given vertex count. */ RIM_INLINE IndexedPrimitiveType( Size vertexCount ) { switch ( vertexCount ) { case 1: type = POINTS; break; case 2: type = LINES; break; case 3: type = TRIANGLES; break; case 4: type = QUADS; break; default: type = UNDEFINED; break; } } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Enum Cast Operator /// Convert this indexed primitive type to an enum value. RIM_INLINE operator Enum () const { return (Enum)type; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Type Width Accessor Methods /// Return the minimum number of vertices needed to define an instance of this primitive type. Size getMinimumVertexCount() const; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** String Representation Accessor Methods /// Return a unique string for this indexed primitive type that matches its enum value name. String toEnumString() const; /// Return a indexed primitive type which corresponds to the given enum string. static IndexedPrimitiveType fromEnumString( const String& enumString ); /// Return a string representation of the indexed primitive type. String toString() const; /// Convert this indexed primitive type into a string representation. RIM_INLINE operator String () const { return this->toString(); } private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Members /// An enum for the indexed primitive type. UByte type; }; //########################################################################################## //*********************** End Rim Graphics Buffers Namespace ***************************** RIM_GRAPHICS_BUFFERS_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_GRAPHICS_INDEXED_PRIMITIVE_TYPE_H <file_sep>/* * rimAssetTypeTranscoder.h * Rim Software * * Created by <NAME> on 6/11/14. * Copyright 2014 __MyCompanyName__. All rights reserved. * */ #ifndef INCLUDE_RIM_ASSET_TYPE_TRANSCODER_H #define INCLUDE_RIM_ASSET_TYPE_TRANSCODER_H #include "rimAssetsConfig.h" #include "rimAssetObject.h" //########################################################################################## //**************************** Start Rim Assets Namespace ******************************** RIM_ASSETS_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class which specifies functions that determine how an asset type should be encoded/decoded. template < typename DataType > class AssetTypeTranscoder { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Destructor virtual ~AssetTypeTranscoder() { } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Text Encoding/Decoding Methods /// Decode an object from the specified string stream, returning a pointer to the final object. virtual Pointer<DataType> decodeText( const AssetType& assetType, const AssetObject& assetObject, ResourceManager* resourceManager = NULL ) = 0; /// Encode an object of this asset type into a text-based format. virtual Bool encodeText( UTF8StringBuffer& buffer, ResourceManager* resourceManager, const DataType& data ) = 0; }; //########################################################################################## //**************************** End Rim Assets Namespace ********************************** RIM_ASSETS_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_ASSET_TYPE_TRANSCODER_H <file_sep>/* * rimGUIButtonDelegate.h * Rim GUI * * Created by <NAME> on 9/25/12. * Copyright 2012 __MyCompanyName__. All rights reserved. * */ #ifndef INCLUDE_RIM_GUI_BUTTON_DELEGATE_H #define INCLUDE_RIM_GUI_BUTTON_DELEGATE_H #include "rimGUIConfig.h" //########################################################################################## //*************************** Start Rim GUI Namespace ****************************** RIM_GUI_NAMESPACE_START //****************************************************************************************** //########################################################################################## class Button; //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class which contains function objects that recieve button events. /** * Any button-related event that might be processed has an appropriate callback * function object. Each callback function is called by the GUI event thread * whenever such an event is received. If a callback function in the delegate * is not initialized, a button simply ignores it. * * It must be noted that the callback functions are asynchronous and * not thread-safe. Thus, it is necessary to perform any additional synchronization * externally. */ class ButtonDelegate { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Button Delegate Callback Functions /// A function object which is called whenever an attached button is selected by the user. /** * This means that the user has put the button into its 'on' state. */ Function<void ( Button& )> select; /// A function object which is called whenever an attached button is pressed by the user. Function<void ( Button& )> press; /// A function object which is called whenever an attached button is released by the user. Function<void ( Button& )> release; }; //########################################################################################## //*************************** End Rim GUI Namespace ******************************** RIM_GUI_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_GUI_BUTTON_DELEGATE_H <file_sep>/* * rimGraphicsSceneRenderer.h * Rim Software * * Created by <NAME> on 3/21/14. * Copyright 2014 __MyCompanyName__. All rights reserved. * */ #ifndef INCLUDE_RIM_GRAPHICS_SCENE_RENDERER_H #define INCLUDE_RIM_GRAPHICS_SCENE_RENDERER_H #include "rimGraphicsRenderersConfig.h" #include "rimGraphicsRenderer.h" #include "rimGraphicsViewportLayout.h" #include "rimGraphicsSceneRendererFlags.h" #include "rimGraphicsSceneRendererConfiguration.h" //########################################################################################## //********************** Start Rim Graphics Renderers Namespace ************************** RIM_GRAPHICS_RENDERERS_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// An interface for classes that draw graphics scenes. class SceneRenderer : public Renderer { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Viewport Layout Accessor Methods /// Return a pointer to the viewport layout that is currently being rendered. virtual Pointer<ViewportLayout> getViewportLayout() const = 0; /// Set a pointer to the viewport layout that should be rendered. virtual void setViewportLayout( const Pointer<ViewportLayout>& newViewportLayout ) = 0; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Configuration Accessor Methods /// Return a reference to an object which contains the configuration of the scene renderer. RIM_INLINE SceneRendererConfiguration& getConfiguration() { return configuration; } /// Return an object which contains the configuration of the scene renderer. RIM_INLINE const SceneRendererConfiguration& getConfiguration() const { return configuration; } /// Set an object which contains the configuration of the scene renderer. RIM_INLINE void setConfiguration( const SceneRendererConfiguration& newConfiguration ) { configuration = newConfiguration; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Flags Accessor Methods /// Return a reference to an object which contains boolean parameters of the scene renderer. RIM_INLINE SceneRendererFlags& getFlags() { return configuration.flags; } /// Return an object which contains boolean parameters of the scene renderer. RIM_INLINE const SceneRendererFlags& getFlags() const { return configuration.flags; } /// Set an object which contains boolean parameters of the scene renderer. RIM_INLINE void setFlags( const SceneRendererFlags& newFlags ) { configuration.flags = newFlags; } /// Return whether or not the specified boolan flag is set for this scene renderer. RIM_INLINE Bool flagIsSet( SceneRendererFlags::Flag flag ) const { return configuration.flags.isSet( flag ); } /// Set whether or not the specified boolan flag is set for this scene renderer. RIM_INLINE void setFlag( SceneRendererFlags::Flag flag, Bool newIsSet = true ) { configuration.flags.set( flag, newIsSet ); } protected: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Protected Data Members /// An object containing the configuration for this scene renderer. SceneRendererConfiguration configuration; }; //########################################################################################## //********************** End Rim Graphics Renderers Namespace **************************** RIM_GRAPHICS_RENDERERS_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_GRAPHICS_SCENE_RENDERER_H <file_sep>/* * rimGUIMenuItemDelegate.h * Rim GUI * * Created by <NAME> on 6/3/09. * Copyright 2009 Rim Software. All rights reserved. * */ #ifndef INCLUDE_RIM_GUI_MENU_ITEM_DELEGATE_H #define INCLUDE_RIM_GUI_MENU_ITEM_DELEGATE_H #include "rimGUIConfig.h" //########################################################################################## //*************************** Start Rim GUI Namespace ****************************** RIM_GUI_NAMESPACE_START //****************************************************************************************** //########################################################################################## class MenuItem; //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class which contains function objects that recieve menu item events. /** * Any menu-item-related event that might be processed has an appropriate callback * function object. Each callback function is called by the GUI event thread * whenever such an event is received. If a callback function in the delegate * is not initialized, a menu item simply ignores it. * * It must be noted that the callback functions are asynchronous and * not thread-safe. Thus, it is necessary to perform any additional synchronization * externally. */ class MenuItemDelegate { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Menu Item Delegate Callback Functions /// A function object which is called whenever an attached menu item is selected by the user. Function<void ( MenuItem& )> select; }; //########################################################################################## //*************************** End Rim GUI Namespace ******************************** RIM_GUI_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_GUI_MENU_ITEM_DELEGATE_H <file_sep>/* * rimOptional.h * Rim Framework * * Created by <NAME> on 6/7/09. * Copyright 2009 Rim Software. All rights reserved. * */ #ifndef INCLUDE_RIM_OPTIONAL_H #define INCLUDE_RIM_OPTIONAL_H #include "rimLanguageConfig.h" //########################################################################################## //*************************** Start Rim Language Namespace ******************************* RIM_LANGUAGE_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class which is used to store a value which may or may not be set. /** * The Optional class is implemented using a pointer to a value which can be * optionally NULL. When setting the value of an Optional object, the provided * value is copy-constructed and stored internally. Accessing the contents of an * Optional object which does not have a value will result in an assertion being raised. */ template < typename T > class Optional { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructors /// Create an optional object whose value is not set. RIM_INLINE Optional() : value( NULL ) { } /// Create an optional object with the specified value. /** * @param newValue - the value to use for this Optional object. */ RIM_INLINE Optional( const T& newValue ) : value( util::construct<T>( newValue ) ) { } /// Create a copy of another Optional object. RIM_INLINE Optional( const Optional& other ) { if ( other.value != NULL ) value = util::construct<T>( *other.value ); else value = NULL; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Destructor /// Destroy an Optional object, destroying any value stored within. RIM_INLINE ~Optional() { if ( value != NULL ) util::destruct( value ); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Assignment Operator /// Assign the value of another Optional object to this object. /** * This method creates a copy of the value stored in the other object. * * @param other - the Optional object whose value should be copied. * @return a reference to this Optional object to allow assignment chaining. */ RIM_INLINE Optional& operator = ( const Optional& other ) { if ( this != &other ) { if ( value != NULL ) util::destruct( value ); if ( other.value != NULL ) value = util::construct<T>( *other.value ); else value = NULL; } return *this; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Cast Operators /// Get a reference to the value contained by this Optional object. /** * If the value is not set, a debug assertion is raised. * * @return a reference to the value contained by this Optional object. */ RIM_INLINE operator T& () { RIM_DEBUG_ASSERT_MESSAGE( value != NULL, "Cannot retrieve optional value which is not set." ); return *value; } /// Get a const reference to the value contained by this Optional object. /** * If the value is not set, a debug assertion is raised. * * @return a const reference to the value contained by this Optional object. */ RIM_INLINE operator const T& () const { RIM_DEBUG_ASSERT_MESSAGE( value != NULL, "Cannot retrieve optional value which is not set." ); return *value; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Value Accessor Methods /// Get a reference to the value contained by this Optional object. /** * If the value is not set, a debug assertion is raised. * * @return a reference to the value contained by this Optional object. */ RIM_INLINE T& get() { RIM_DEBUG_ASSERT_MESSAGE( value != NULL, "Cannot retrieve optional value which is not set." ); return *value; } /// Get a const reference to the value contained by this Optional object. /** * If the value is not set, a debug assertion is raised. * * @return a const reference to the value contained by this Optional object. */ RIM_INLINE const T& get() const { RIM_DEBUG_ASSERT_MESSAGE( value != NULL, "Cannot retrieve optional value which is not set." ); return *value; } /// Set the value contained by this Optional object. /** * This method replaces any existing value with the new value. isSet() will * always return TRUE after this method exits. * * @param newValue - the value to which the Optional should be set. */ RIM_INLINE void set( const T& newValue ) { if ( value != NULL ) util::destruct( value ); value = util::construct<T>( newValue ); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Value-Is-Set State Accessor Method /// Return whether or not the optional value is set. /** * If the value is set, TRUE is returned. Otherwise FALSE * is returned. * * @return whether or not the optional value is set. */ RIM_INLINE Bool isSet() const { return value != NULL; } private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Members /// A pointer to the optional value. NULL if the value is not set. T* value; }; //########################################################################################## //########################################################################################## //############ //############ Optional Class Void Specialization //############ //########################################################################################## //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A 'void' specialization for the Optional class which is provided so that the class works for void types. template <> class Optional<void> { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructor /// Create an Optional object which stores a 'void' type. RIM_INLINE Optional() { } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Cast Operators /// Cast this 'void' Optional object to a void type. RIM_INLINE operator void () { } /// Cast this 'void' Optional object to a void type. RIM_INLINE operator void () const { } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Value Accessor Methods /// Get the 'void' value stored in this Optional object. RIM_INLINE void get() { } /// Get the 'void' value stored in this Optional object. RIM_INLINE void get() const { } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Value-Is-Set State Accessor Method /// Return whether or not the 'void' value in this Optional object is set. /** * This method always returns TRUE. */ RIM_INLINE Bool isSet() const { return true; } }; //########################################################################################## //*************************** End Rim Language Namespace ********************************* RIM_LANGUAGE_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_OPTIONAL_H <file_sep>/* * rimSoundFilterState.h * Rim Sound * * Created by <NAME> on 6/4/13. * Copyright 2013 __MyCompanyName__. All rights reserved. * */ #ifndef INCLUDE_RIM_SOUND_FILTER_STATE_H #define INCLUDE_RIM_SOUND_FILTER_STATE_H #include "rimSoundFiltersConfig.h" //########################################################################################## //************************ Start Rim Sound Filters Namespace ***************************** RIM_SOUND_FILTERS_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class which represents the entire serialized state of a SoundFilter instance. /** * This class is a thin wrapper of a rim::data::DataStore object and is used * as a dictionary to store common types of filter data (numbers, strings, bytes, * and other DataStore objects). */ class SoundFilterState { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructors /// Create a new sound filter state object with no data stored in it. RIM_INLINE SoundFilterState() { } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Data Accessor Methods /// Return the total number of key-value pairs that are stored in this filter state. RIM_INLINE Size getSize() const { return state.getSize(); } /// Get a pointer to the value stored for the specified key string. /** * The types of allowed values are: Bool, Int32, UInt32, Int64, UInt64, Float32, Float64, * UTF8String, Data, and DataStore. This method is a thin wrapper around the * DataStore::get() family of methods. See that class's documentation for more info. * The method returns NULL if there is no value for the given key, or if * the stored value has an incompatible type with the requested template type. */ template < typename V, typename K > RIM_INLINE V* get( const K& key ) { return state.get<V>( String(key) ); } /// Get a const pointer to the value stored for the specified key string. /** * The types of allowed values are: Int32, UInt32, Int64, UInt64, Float32, Float64, * UTF8String, Data, and DataStore. This method is a thin wrapper around the * DataStore::get() family of methods. See that class's documentation for more info. * The method returns NULL if there is no value for the given key, or if * the stored value has an incompatible type with the requested template type. */ template < typename V, typename K > RIM_INLINE const V* get( const K& key ) const { return state.get<V>( String(key) ); } /// Set the filter state to have a mapping from the specified key string to a template data value. /** * The types of allowed values are: Int32, UInt32, Int64, UInt64, Float32, Float64, * UTF8String, Data, and DataStore. This method is a thin wrapper around the * DataStore::set() family of methods. See that class's documentation for more info. * The method returns whether or not the operation was successful. */ template < typename K, typename V > RIM_INLINE Bool set( const K& key, const V& value ) { return state.set( String(key), value ); } /// Remove the entry with the specified string key and return whether or not anything was removed. template < typename K > RIM_INLINE Bool remove( const K& key ) { return state.remove( String(key) ); } /// Clear all stored data from this filter state, resulting in an empty state object. RIM_INLINE void clear() { state.clear(); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Data Store Accessor Methods /// Return a reference to the DataStore object which contains this state's data entries. RIM_INLINE const DataStore& getDataStore() const { return state; } /// Replace this filter state's internal data store with the specified data store, copying all entries. RIM_INLINE void setDataStore( const DataStore& dataStore ) { state = dataStore; } private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Members /// A DataStore object which stores the entire state of a SoundFilter instance. DataStore state; }; //########################################################################################## //************************ End Rim Sound Filters Namespace ******************************* RIM_SOUND_FILTERS_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_SOUND_FILTER_STATE_H <file_sep>/* * rimSoundLimiter.h * Rim Sound * * Created by <NAME> on 12/11/12. * Copyright 2012 __MyCompanyName__. All rights reserved. * */ #ifndef INCLUDE_RIM_SOUND_LIMITER_H #define INCLUDE_RIM_SOUND_LIMITER_H #include "rimSoundFiltersConfig.h" #include "rimSoundFilter.h" //########################################################################################## //************************ Start Rim Sound Filters Namespace ***************************** RIM_SOUND_FILTERS_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class which keeps sound from ever going above a limiting threshold. class Limiter : public SoundFilter { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructors /// Create a new limiter with the default limiting parameters. /** * These are - threshold: 0dB, release: 5ms, input gain: 0dB, * output gain: 0dB, with unlinked channels. */ Limiter(); /// Create a new limiter with the specified threshold. /** * The other limiting parameters are - release: 5ms, input gain: 0dB, * output gain: 0dB, with unlinked channels. */ Limiter( Gain threshold, Gain inputGain, Gain outputGain, Float release ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Input Gain Accessor Methods /// Return the current linear input gain factor of this limiter. /** * This is the gain applied to the input signal before being sent to the * limiter. This allows the user to scale the input to match the limiter * without having to change the limiter threshold. */ RIM_INLINE Gain getInputGain() const { return targetInputGain; } /// Return the current input gain factor in decibels of this limiter. /** * This is the gain applied to the input signal before being sent to the * limiter. This allows the user to scale the input to match the limiter * without having to change the limiter threshold. */ RIM_INLINE Gain getInputGainDB() const { return util::linearToDB( targetInputGain ); } /// Set the target linear input gain for limiter. /** * This is the gain applied to the input signal before being sent to the * limiter. This allows the user to scale the input to match the limiter * without having to change the limiter threshold. */ RIM_INLINE void setInputGain( Gain newInputGain ) { lockMutex(); targetInputGain = newInputGain; unlockMutex(); } /// Set the target input gain in decibels for this limiter. /** * This is the gain applied to the input signal before being sent to the * limiter. This allows the user to scale the input to match the limiter * without having to change the limiter threshold. */ RIM_INLINE void setInputGainDB( Gain newDBInputGain ) { lockMutex(); targetInputGain = util::dbToLinear( newDBInputGain ); unlockMutex(); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Output Gain Accessor Methods /// Return the current linear output gain factor of this limiter. /** * This is the gain applied to the signal after being sent to the * limiter. This value is used to apply make-up gain to the signal * after is has been compressed. */ RIM_INLINE Gain getOutputGain() const { return targetOutputGain; } /// Return the current output gain factor in decibels of this limiter. /** * This is the gain applied to the signal after being sent to the * limiter. This value is used to apply make-up gain to the signal * after is has been compressed. */ RIM_INLINE Gain getOutputGainDB() const { return util::linearToDB( targetOutputGain ); } /// Set the target linear output gain for this limiter. /** * This is the gain applied to the signal after being sent to the * limiter. This value is used to apply make-up gain to the signal * after is has been compressed. */ RIM_INLINE void setOutputGain( Gain newOutputGain ) { lockMutex(); targetOutputGain = newOutputGain; unlockMutex(); } /// Set the target output gain in decibels for this limiter. /** * This is the gain applied to the signal after being sent to the * limiter. This value is used to apply make-up gain to the signal * after is has been compressed. */ RIM_INLINE void setOutputGainDB( Gain newDBOutputGain ) { lockMutex(); targetOutputGain = util::dbToLinear( newDBOutputGain ); unlockMutex(); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Threshold Accessor Methods /// Return the linear full-scale value above which the limiter applies gain reduction. RIM_INLINE Gain getThreshold() const { return targetThreshold; } /// Return the logarithmic full-scale value above which the limiter applies gain reduction. RIM_INLINE Gain getThresholdDB() const { return util::linearToDB( targetThreshold ); } /// Set the linear full-scale value above which the limiter applies gain reduction. /** * The value is clamped to the valid range of [0,infinity] before being stored. */ RIM_INLINE void setThreshold( Gain newThreshold ) { lockMutex(); targetThreshold = math::max( newThreshold, Gain(0) ); unlockMutex(); } /// Set the logarithmic full-scale value above which the limiter applies gain reduction. RIM_INLINE void setThresholdDB( Gain newThresholdDB ) { lockMutex(); targetThreshold = util::dbToLinear( newThresholdDB ); unlockMutex(); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Knee Accessor Methods /// Return the knee radius of this limiter in decibels. /** * This is the amount below the limiter's threshold at which the limiter first * starts limiting. A higher knee will result in a limiter that starts to apply * gain reduction to envelopes that approach the threshold, resulting * in a smoother transition from no gain reduction to full gain reduction. */ RIM_INLINE Gain getKnee() const { return targetKnee; } /// Set the knee radius of this limiter in decibels. /** * This is the amount below the limiter's threshold at which the limiter first * starts limiting. A higher knee will result in a limiter that starts to apply * gain reduction to envelopes that approach the threshold, resulting * in a smoother transition from no gain reduction to full gain reduction. * * The new knee value is clamped to the valid range of [0,+infinity]. */ RIM_INLINE void setKnee( Gain newKnee ) { lockMutex(); targetKnee = math::max( newKnee, Float(0) ); unlockMutex(); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Attack Accessor Methods /// Return the attack of this limiter in seconds. /** * This value indicates the time in seconds that it takes for the limiter's * detection envelope to respond to a sudden increase in signal level. Thus, * a very small attack softens transients more than a slower attack which * lets the transients through the limiter. */ RIM_INLINE Float getAttack() const { return attack; } /// Set the attack of this limiter in seconds. /** * This value indicates the time in seconds that it takes for the limiter's * detection envelope to respond to a sudden increase in signal level. Thus, * a very small attack softens transients more than a slower attack which * lets the transients through the limiter. * * The new attack value is clamped to the range of [0,+infinity]. */ RIM_INLINE void setAttack( Float newAttack ) { lockMutex(); attack = math::max( newAttack, Float(0) ); unlockMutex(); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Release Accessor Methods /// Return the release of this limiter in seconds. /** * This value indicates the time in seconds that it takes for the limiter's * detection envelope to respond to a sudden decrease in signal level. Thus, * a very short release doesn't compress the signal after a transient for as * long as a longer release. Beware, very short release times (< 5ms) can result * in audible distortion. */ RIM_INLINE Float getRelease() const { return release; } /// Set the release of this limiter in seconds. /** * This value indicates the time in seconds that it takes for the limiter's * detection envelope to respond to a sudden decrease in signal level. Thus, * a very short release doesn't limit the signal after a transient for as * long as a longer release. Beware, very short release times (< 5ms) can result * in audible distortion. * * The new release value is clamped to the valid range of [0,+infinity]. */ RIM_INLINE void setRelease( Float newRelease ) { lockMutex(); release = math::max( newRelease, Float(0) ); unlockMutex(); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Channel Link Status Accessor Methods /// Return whether or not all channels in the limiter are linked together. /** * If the value is TRUE, all channels are limited by the maximum limiting * amount selected from all channel envelopes. This allows the limiter * to maintain the stereo image of the audio when limiting hard-panned sounds. */ RIM_INLINE Bool getChannelsAreLinked() const { return linkChannels; } /// Set whether or not all channels in the limiter are linked together. /** * If the value is TRUE, all channels are limited by the maximum limiting * amount selected from all channel envelopes. This allows the limiter * to maintain the stereo image of the audio when limiting hard-panned sounds. */ RIM_INLINE void setChannelsAreLinked( Bool newChannelsAreLinked ) { lockMutex(); linkChannels = newChannelsAreLinked; unlockMutex(); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Channel Link Status Accessor Methods /// Return whether or not output saturation is occurring for the limiter. /** * If this value is TRUE, a soft clipping function is applied to the output of the * limiter which guarantees that the output signal will never exceed the threshold. * This output saturation is usually used in combination with a slower attack to keep * fast transients from going over the threshold while keeping the cleaner sound of * a slow attack. */ RIM_INLINE Bool getSaturationIsEnabled() const { return saturateOutput; } /// Set whether or not output saturation should occur for the limiter. /** * If this value is TRUE, a soft clipping function is applied to the output of the * limiter which guarantees that the output signal will never exceed the threshold. * This output saturation is usually used in combination with a slower attack to keep * fast transients from going over the threshold while keeping the cleaner sound of * a slow attack. */ RIM_INLINE void setSaturationIsEnabled( Bool newSaturationIsEnabled ) { lockMutex(); saturateOutput = newSaturationIsEnabled; unlockMutex(); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Saturation Knee Accessor Methods /// Return the knee of the output clipping function, in decibels. /** * This is the number of decibels below the threshold where the transition from * no saturation to saturation will occurr. A higher knee value indicates softer * output clipping. */ RIM_INLINE Gain getSaturationKnee() const { return targetSaturationKnee; } /// Set the knee of the output clipping function, in decibels. /** * This is the number of decibels below the threshold where the transition from * no saturation to saturation will occurr. A higher knee value indicates softer * output clipping. * * The new knee value is clamped to the valid range of [0.01,+infinity]. */ RIM_INLINE void setSaturationKnee( Gain newSaturationKnee ) { lockMutex(); targetSaturationKnee = math::max( newSaturationKnee, Float(0.01) ); unlockMutex(); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Gain Reduction Accessor Methods /// Return the current gain reduction of the limiter in decibels. /** * This value can be used as a way for humans to visualize how much the * limiter is compressing at any given time. */ RIM_INLINE Gain getGainReductionDB() const { return currentReduction; } /// Return the current gain reduction of the limiter on a linear scale. /** * This value can be used as a way for humans to visualize how much the * limiter is compressing at any given time. */ RIM_INLINE Gain getGainReduction() const { return util::dbToLinear( currentReduction ); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Filter Attribute Accessor Methods /// Return a human-readable name for this limiter. /** * The method returns the string "Compressor". */ virtual UTF8String getName() const; /// Return the manufacturer name of this limiter. /** * The method returns the string "Headspace Sound". */ virtual UTF8String getManufacturer() const; /// Return an object representing the version of this limiter. virtual SoundFilterVersion getVersion() const; /// Return an object which describes the category of effect that this filter implements. /** * This method returns the value SoundFilterCategory::DYNAMICS. */ virtual SoundFilterCategory getCategory() const; /// Return whether or not this limiter can process audio data in-place. /** * This method always returns TRUE, limiters can process audio data in-place. */ virtual Bool allowsInPlaceProcessing() const; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Filter Parameter Accessor Methods /// Return the total number of generic accessible parameters this filter has. virtual Size getParameterCount() const; /// Get information about the filter parameter at the specified index. virtual Bool getParameterInfo( Index parameterIndex, FilterParameterInfo& info ) const; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Public Static Property Objects /// A string indicating the human-readable name of this limiter. static const UTF8String NAME; /// A string indicating the manufacturer name of this limiter. static const UTF8String MANUFACTURER; /// An object indicating the version of this limiter. static const SoundFilterVersion VERSION; private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Filter Parameter Value Accessor Methods /// Place the value of the parameter at the specified index in the output parameter. virtual Bool getParameterValue( Index parameterIndex, FilterParameter& value ) const; /// Attempt to set the parameter value at the specified index. virtual Bool setParameterValue( Index parameterIndex, const FilterParameter& value ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Stream Reset Method /// A method which is called whenever the filter's stream of audio is being reset. /** * This method allows the filter to reset all parameter interpolation * and processing to its initial state to avoid coloration from previous * audio or parameter values. */ virtual void resetStream(); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Filter Processing Methods /// Do compression processing on the input frame and place the results in the output frame. virtual SoundFilterResult processFrame( const SoundFilterFrame& inputFrame, SoundFilterFrame& outputFrame, Size numSamples ); /// Do limiting processing on the input buffer and place the results in the output buffer. /** * This method assumes that none of the limiting parameters changed since the last frame * and thus we can save time by not having to interpolate the parameters. */ RIM_INLINE void limitNoChanges( const SoundBuffer& inputBuffer, SoundBuffer& outputBuffer, Size numSamples, Gain envelopeAttack, Gain envelopeRelease ); /// Do limiting processing on the input buffer and place the results in the output buffer. /** * This method assumes that none of the limiting parameters changed since the last frame * and thus we can save time by not having to interpolate the parameters. */ RIM_INLINE void limit( const SoundBuffer& inputBuffer, SoundBuffer& outputBuffer, Size numSamples, Gain envelopeAttack, Gain envelopeRelease, Gain inputGainChangePerSample, Gain outputGainChangePerSample, Gain thresholdChangePerSample, Gain kneeChangePerSample, Gain saturationKneeChangePerSample ); /// Do limiting processing on the input buffer and place the results in the output buffer. template < Bool interpolateChanges, Bool saturationEnabled > RIM_FORCE_INLINE void limit( const SoundBuffer& inputBuffer, SoundBuffer& outputBuffer, Size numSamples, Gain envelopeAttack, Gain envelopeRelease, Gain inputGainChangePerSample, Gain outputGainChangePerSample, Gain thresholdChangePerSample, Gain kneeChangePerSample, Gain saturationKneeChangePerSample ); /// Return the negative gain reduction in decibels for the specified signal level and compression parameters. RIM_FORCE_INLINE static Gain getDBReduction( Float level, Gain threshold, Float kneeMin, Float kneeMax, Float knee ) { Gain dbOver = util::linearToDB( level / threshold ); if ( knee > Float(0) && level < kneeMax ) { Float x = (dbOver + knee)/knee; return -knee*x*x*Float(0.25); } else return -dbOver; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Members /// The threshold, given as a linear full-scale value, at which compression starts to occur. Gain threshold; /// The target threshold, used to smooth changes in the threshold parameter. Gain targetThreshold; /// The linear gain applied to the signal before it goes through the limiter. Gain inputGain; /// The target input gain of the limiter, used to smooth input gain parameter changes. Gain targetInputGain; /// The linear gain applied to the signal after it has been compressed to restore signal level. Gain outputGain; /// The target output gain of the limiter, used to smooth output gain parameter changes. Gain targetOutputGain; /// The radius of the limiter's knee in decibels. /** * This is the amount below the limiter's threshold at which the limiter first * starts limiting. A higher knee will result in a limiter that starts to apply * gain reduction to envelopes that approach the threshold, resulting * in a smoother transition from no gain reduction to full gain reduction. */ Gain knee; /// The target knee for this limiter, used to smooth knee parameter changes. Gain targetKnee; /// The time in seconds that the limiter envelope takes to respond to an increase in level. Float attack; /// The time in seconds that the limiter envelope takes to respond to a decrease in level. Float release; /// The knee of the output clipping function, in decibels. /** * This is the number of decibels below the threshold where the transition from * no saturation to saturation will occurr. A higher knee value indicates softer output clipping. */ Gain saturationKnee; /// The target saturation knee for this limiter, used to smooth clipping knee parameter changes. Gain targetSaturationKnee; /// An array of envelope values for each of the channels that this limiter is processing. Array<Float> envelope; /// The current gain reduction of the limiter, expressed in decibels. Gain currentReduction; /// A boolean value indicating whether or not all channels processed should be linked. /** * This means that the same compression amount is applied to all channels. The * limiter finds the channel which needs the most gain reduction and uses * that gain reduction for all other channels. This feature allows the limiter * to maintain the original stereo (or multichannel) balance between channels. */ Bool linkChannels; /// A boolean value indicating whether or not output saturation should occur. /** * If this value is TRUE, a soft clipping function is applied to the output of the * limiter which guarantees that the output signal will never exceed the threshold. * This output saturation is usually used in combination with a slower attack to keep * fast transients from going over the threshold while keeping the cleaner sound of * a slow attack. */ Bool saturateOutput; }; //########################################################################################## //************************ End Rim Sound Filters Namespace ******************************* RIM_SOUND_FILTERS_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_SOUND_LIMITER_H <file_sep>/* * rimSoundFilterCategory.h * Rim Sound * * Created by <NAME> on 7/11/13. * Copyright 2013 __MyCompanyName__. All rights reserved. * */ #ifndef INCLUDE_RIM_SOUND_FILTER_TYPE_H #define INCLUDE_RIM_SOUND_FILTER_TYPE_H #include "rimSoundFiltersConfig.h" //########################################################################################## //************************ Start Rim Sound Filters Namespace ***************************** RIM_SOUND_FILTERS_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class which represents the kind of effect that a SoundFilter performs. /** * This allows filters to report a category of effect which they belong to, * and allows filter hosts to sort filters by their type. */ class SoundFilterCategory { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Parameter Type Enum Declaration /// An enum which specifies the different SoundFilter categories. typedef enum Enum { /// An undefined filter category, used when no other category fits. OTHER = 0, /// A category where the filter produces output audio from an internal source, such as a file. /** * This category can include samplers and any filter that plays back audio, like an audio * file player, MIDI file player, etc. */ PLAYBACK = 1, /// A category where the filter records input audio to a destination, such as a file or looping buffer. /** * This category can include filters that record audio to a file, record loops, or other * similar operations. */ RECORDING = 2, /// A category where the filter is used as a musical instrument, taking MIDI input data and producing output audio. /** * This category can include synthesizers, virtual instruments, samplers, drum machines, * etc. */ INSTRUMENT = 3, /// A category where the filter is used to do some sort of routing function. /** * This category can include mixers, splitters, channel strips, processing graphs, etc. */ ROUTING = 4, /// A category where the filter is used to manipulate channel directionality. /** * This category can include panners, HRTF effects, directional mixers, and stereo utilities. */ IMAGING = 5, /// A category where the filter is used to modify the frequency response of audio. /** * This category can include single IIR filters, multi-band equalizers, linear phase equalizers, * crossovers, graphic equalizers, wah effects, etc. */ EQUALIZER = 6, /// A category where the filter is used to control the dynamic range of audio. /** * This category can include compressors, gates, limiters, gain riders, simple gain controls, etc. */ DYNAMICS = 7, /// A category where the filter is used to add some sort of distortion to the audio. /** * This category can include overdrives, hard clipping effects, phase-based distortion, etc. */ DISTORTION = 8, /// A category where the filter is used to produce a delayed version of the audio. /** * This category can include basic delays, stereo delays, etc. */ DELAY = 9, /// A category where the filter is used to produce a reverberant effect, used to model room acoustics. /** * This category can include basic reverb effects, convolution reverb, and other reverb- * based effects. */ REVERB = 10, /// A category where the filter is used to modulate the audio in some way. /** * This category can include amplitude modulation effects (tremolo, ring modulation), * pitch moduation effects (vibrato, flanger, chorus, phase), and other similar effects. */ MODULATION = 11, /// A category where the filter operates on the pitch information of the audio. /** * This categeory can include pitch shifters, pitch correction, tuners, * harmonizers, etc. */ PITCH = 12, /// A category where the filter is used to analyze the input audio. /** * This category can include RTAs, tone generators, and other audio analysis tools. */ ANALYSIS = 13, /// A category where the filter is used to perform a low-level task that doesn't fit in another category. /** * This category can include effects like sample rate conversion, convolution, * phase controls, etc. */ UTILITY = 14 }; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructors /// Create a new filter type object with the OTHER parameter type. RIM_INLINE SoundFilterCategory() : type( OTHER ) { } /// Create a new filter type object with the specified type enum value. RIM_INLINE SoundFilterCategory( Enum newType ) : type( newType ) { } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Enum Cast Operator /// Convert this filter type to an enum value. /** * This operator is provided so that the SoundFilterCategory object can be used * directly in a switch statement without the need to explicitly access * the underlying enum value. * * @return the enum representation of this filter type. */ RIM_INLINE operator Enum () const { return type; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** String Representation Accessor Methods /// Return a string representation of the filter type. UTF8String toString() const; /// Convert this filter type into a string representation. RIM_INLINE operator UTF8String () const { return this->toString(); } private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Members /// An enum value indicating the type of a SoundFilter. Enum type; }; //########################################################################################## //************************ End Rim Sound Filters Namespace ******************************* RIM_SOUND_FILTERS_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_SOUND_FILTER_TYPE_H <file_sep>/* * rimSIMDScalarByte16.h * Rim Software * * Created by <NAME> on 9/21/14. * Copyright 2014 __MyCompanyName__. All rights reserved. * */ <file_sep>/* * rimEngineConfig.h * Rim Engine * * Created by <NAME> on 5/13/12. * Copyright 2012 __MyCompanyName__. All rights reserved. * */ #ifndef INCLUDE_RIM_ENGINE_CONFIG_H #define INCLUDE_RIM_ENGINE_CONFIG_H #include "rim/rimFramework.h" #include "rim/rimImages.h" #include "rim/rimGUI.h" #include "rim/rimBVH.h" #include "rim/rimGraphics.h" #include "rim/rimGraphicsGUI.h" #include "rim/rimPhysics.h" #include "rim/rimSound.h" #include "rim/rimEntities.h" //########################################################################################## //########################################################################################## //############ //############ Library Namespace Configuration //############ //########################################################################################## //########################################################################################## #ifndef RIM_ENGINE_NAMESPACE_START #define RIM_ENGINE_NAMESPACE_START RIM_NAMESPACE_START namespace engine { #endif #ifndef RIM_ENGINE_NAMESPACE_END #define RIM_ENGINE_NAMESPACE_END }; RIM_NAMESPACE_END #endif //########################################################################################## //*************************** Start Rim Engine Namespace ********************************* RIM_ENGINE_NAMESPACE_START //****************************************************************************************** //########################################################################################## using namespace rim::gui; using namespace rim::gui::system; using namespace rim::graphics; using namespace rim::graphics; using namespace rim::physics; using namespace rim::entities; //########################################################################################## //*************************** End Rim Engine Namespace *********************************** RIM_ENGINE_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_ENGINE_CONFIG_H <file_sep>/* * rimFunctionBase.h * Rim Framework * * Created by <NAME> on 6/22/08. * Copyright 2008 Rim Software. All rights reserved. * */ #ifndef INCLUDE_RIM_FUNCTION_DEFINITION_H #define INCLUDE_RIM_FUNCTION_DEFINITION_H #include "../rimLanguageConfig.h" #include "rimNullType.h" //########################################################################################## //*********************** Start Rim Language Internal Namespace ************************** RIM_LANGUAGE_INTERNAL_NAMESPACE_START //****************************************************************************************** //########################################################################################## template < typename R, typename T1 = NullType, typename T2 = NullType, typename T3 = NullType, typename T4 = NullType, typename T5 = NullType, typename T6 = NullType, typename T7 = NullType, typename T8 = NullType, typename T9 = NullType, typename T10 = NullType > class FunctionDefinition { public: typedef FunctionDefinition<R,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10> ThisType; virtual ~FunctionDefinition() {} virtual void operator () ( T1, T2, T3, T4, T5, T6, T7, T8, T9, T10 ) const = 0; virtual Bool equals( const ThisType& other ) const = 0; virtual ThisType* clone() const = 0; }; template < typename R > class FunctionDefinition< R, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType > { public: typedef FunctionDefinition<R> ThisType; virtual ~FunctionDefinition() {} virtual R operator () () const = 0; virtual Bool equals( const ThisType& other ) const = 0; virtual ThisType* clone() const = 0; }; template < typename R, typename T1 > class FunctionDefinition< R, T1, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType > { public: typedef FunctionDefinition<R,T1> ThisType; virtual ~FunctionDefinition() {} virtual R operator () ( T1 ) const = 0; virtual Bool equals( const ThisType& other ) const = 0; virtual ThisType* clone() const = 0; }; template < typename R, typename T1, typename T2 > class FunctionDefinition< R, T1, T2, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType > { public: typedef FunctionDefinition<R,T1,T2> ThisType; virtual ~FunctionDefinition() {} virtual R operator () ( T1, T2 ) const = 0; virtual Bool equals( const ThisType& other ) const = 0; virtual ThisType* clone() const = 0; }; template < typename R, typename T1, typename T2, typename T3 > class FunctionDefinition< R, T1, T2, T3, NullType, NullType, NullType, NullType, NullType, NullType, NullType > { public: typedef FunctionDefinition<R,T1,T2,T3> ThisType; virtual ~FunctionDefinition() {} virtual R operator () ( T1, T2, T3 ) const = 0; virtual Bool equals( const ThisType& other ) const = 0; virtual ThisType* clone() const = 0; }; template < typename R, typename T1, typename T2, typename T3, typename T4 > class FunctionDefinition< R, T1, T2, T3, T4, NullType, NullType, NullType, NullType, NullType, NullType > { public: typedef FunctionDefinition<R,T1,T2,T3,T4> ThisType; virtual ~FunctionDefinition() {} virtual R operator () ( T1, T2, T3, T4 ) const = 0; virtual Bool equals( const ThisType& other ) const = 0; virtual ThisType* clone() const = 0; }; template < typename R, typename T1, typename T2, typename T3, typename T4, typename T5 > class FunctionDefinition< R, T1, T2, T3, T4, T5, NullType, NullType, NullType, NullType, NullType > { public: typedef FunctionDefinition<R,T1,T2,T3,T4,T5> ThisType; virtual ~FunctionDefinition() {} virtual R operator () ( T1, T2, T3, T4, T5 ) const = 0; virtual Bool equals( const ThisType& other ) const = 0; virtual ThisType* clone() const = 0; }; template < typename R, typename T1, typename T2, typename T3, typename T4, typename T5, typename T6 > class FunctionDefinition< R, T1, T2, T3, T4, T5, T6, NullType, NullType, NullType, NullType > { public: typedef FunctionDefinition<R,T1,T2,T3,T4,T5,T6> ThisType; virtual ~FunctionDefinition() {} virtual R operator () ( T1, T2, T3, T4, T5, T6 ) const = 0; virtual Bool equals( const ThisType& other ) const = 0; virtual ThisType* clone() const = 0; }; template < typename R, typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7 > class FunctionDefinition< R, T1, T2, T3, T4, T5, T6, T7, NullType, NullType, NullType > { public: typedef FunctionDefinition<R,T1,T2,T3,T4,T5,T6,T7> ThisType; virtual ~FunctionDefinition() {} virtual R operator () ( T1, T2, T3, T4, T5, T6, T7 ) const = 0; virtual Bool equals( const ThisType& other ) const = 0; virtual ThisType* clone() const = 0; }; template < typename R, typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8 > class FunctionDefinition< R, T1, T2, T3, T4, T5, T6, T7, T8, NullType, NullType > { public: typedef FunctionDefinition<R,T1,T2,T3,T4,T5,T6,T7,T8> ThisType; virtual ~FunctionDefinition() {} virtual R operator () ( T1, T2, T3, T4, T5, T6, T7, T8 ) const = 0; virtual Bool equals( const ThisType& other ) const = 0; virtual ThisType* clone() const = 0; }; template < typename R, typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8, typename T9 > class FunctionDefinition< R, T1, T2, T3, T4, T5, T6, T7, T8, T9, NullType > { public: typedef FunctionDefinition<R,T1,T2,T3,T4,T5,T6,T7,T8,T9> ThisType; virtual ~FunctionDefinition() {} virtual R operator () ( T1, T2, T3, T4, T5, T6, T7, T8, T9 ) const = 0; virtual Bool equals( const ThisType& other ) const = 0; virtual ThisType* clone() const = 0; }; //########################################################################################## //*********************** End Rim Language Internal Namespace **************************** RIM_LANGUAGE_INTERNAL_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_FUNCTION_DEFINITION_H <file_sep>/* * rimSoundFilterParameterInfo.h * Rim Sound * * Created by <NAME> on 8/16/12. * Copyright 2012 __MyCompanyName__. All rights reserved. * */ #ifndef INCLUDE_RIM_SOUND_FILTER_PARAMETER_INFO_H #define INCLUDE_RIM_SOUND_FILTER_PARAMETER_INFO_H #include "rimSoundFiltersConfig.h" #include "rimSoundFilterParameterType.h" #include "rimSoundFilterParameterValue.h" #include "rimSoundFilterParameterUnits.h" #include "rimSoundFilterParameterCurve.h" #include "rimSoundFilterParameterFlags.h" #include "rimSoundFilterParameter.h" //########################################################################################## //************************ Start Rim Sound Filters Namespace ***************************** RIM_SOUND_FILTERS_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class which represents information about a particular SoundFilter parameter. class FilterParameterInfo { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructors /// Create an uninitialized filter parameter information class. /** * The information stored in this class does not represent any valid * parameter information. */ RIM_INLINE FilterParameterInfo() : index( 0 ) { } /// Create a new parameter information object with the specified attributes. RIM_INLINE FilterParameterInfo( UInt32 newIndex, const UTF8String& newName, FilterParameterType newType, FilterParameterUnits newUnits, FilterParameterCurve newCurve, FilterParameterValue newMinimum, FilterParameterValue newMaximum, FilterParameterValue newDefault, FilterParameterFlags newFlags ) : index( newIndex ), name( newName ), minimum( newMinimum ), maximum( newMaximum ), defaultValue( newDefault ), type( newType ), units( newUnits ), curve( newCurve ), flags( newFlags ) { } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Parameter Index Accessor Methods /// Return the index of this parameter within its host SoundFilter. RIM_INLINE UInt32 getIndex() const { return index; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Parameter Name Accessor Methods /// Return a reference to a human-readable name string for this parameter. RIM_INLINE const UTF8String& getName() const { return name; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Parameter Type Accessor Methods /// Return an object indicating the actual type of this filter parameter. RIM_INLINE FilterParameterType getType() const { return type; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Parameter Units Type Accessor Methods /// Return an object indicating the units of this filter parameter. RIM_INLINE FilterParameterUnits getUnits() const { return units; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Parameter Curve Type Accessor Methods /// Return an object indicating the display curve of this filter parameter. RIM_INLINE FilterParameterCurve getCurve() const { return curve; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Parameter Flags Accessor Methods /// Return an object indicating boolean attributes of this filter parameter. RIM_INLINE FilterParameterFlags getFlags() const { return flags; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Parameter Minimum Value Accessor Methods /// Query a boolean minimum value of this filter parameter. /** * If this parameter can be converted to a type of BOOLEAN, the method returns * TRUE and the minimum boolean value for this parameter is placed in * the output parameter. Otherwise, FALSE is returned and no minimum * value is set. */ RIM_INLINE Bool getMinimum( Bool& booleanValue ) const { return minimum.getValueAsType( type, booleanValue ); } /// Query an integer or enumeration minimum value of this filter parameter. /** * If this parameter can be converted to a type of INTEGER or ENUMERATION, * the method returns TRUE and the minimum integer value for this parameter is placed in * the output parameter. Otherwise, FALSE is returned and no minimum * value is set. */ RIM_INLINE Bool getMinimum( Int64& integerValue ) const { return minimum.getValueAsType( type, integerValue ); } /// Query a float minimum value of this filter parameter. /** * If this parameter can be converted to a type of FLOAT, the method returns * TRUE and the minimum float value for this parameter is placed in * the output parameter. Otherwise, FALSE is returned and no minimum * value is set. */ RIM_INLINE Bool getMinimum( Float32& floatValue ) const { return minimum.getValueAsType( type, floatValue ); } /// Query a double minimum value of this filter parameter. /** * If this parameter can be converted to a type of DOUBLE, the method returns * TRUE and the minimum double value for this parameter is placed in * the output parameter. Otherwise, FALSE is returned and no minimum * value is set. */ RIM_INLINE Bool getMinimum( Float64& doubleValue ) const { return minimum.getValueAsType( type, doubleValue ); } /// Return a generic-typed minimum value for this parameter. RIM_INLINE FilterParameter getMinimum() const { return FilterParameter( type, minimum ); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Parameter Maximum Value Accessor Methods /// Query a boolean maximum value of this filter parameter. /** * If this parameter can be converted to a type of BOOLEAN, the method returns * TRUE and the maximum boolean value for this parameter is placed in * the output parameter. Otherwise, FALSE is returned and no maximum * value is set. */ RIM_INLINE Bool getMaximum( Bool& booleanValue ) const { return maximum.getValueAsType( type, booleanValue ); } /// Query an integer or enumeration maximum value of this filter parameter. /** * If this parameter can be converted to a type of INTEGER or ENUMERATION, the method returns * TRUE and the maximum integer value for this parameter is placed in * the output parameter. Otherwise, FALSE is returned and no maximum * value is set. */ RIM_INLINE Bool getMaximum( Int64& integerValue ) const { return maximum.getValueAsType( type, integerValue ); } /// Query a float maximum value of this filter parameter. /** * If this parameter can be converted to a type of FLOAT, the method returns * TRUE and the maximum float value for this parameter is placed in * the output parameter. Otherwise, FALSE is returned and no maximum * value is set. */ RIM_INLINE Bool getMaximum( Float32& floatValue ) const { return maximum.getValueAsType( type, floatValue ); } /// Query a double maximum value of this filter parameter. /** * If this parameter can be converted to a type of DOUBLE, the method returns * TRUE and the maximum double value for this parameter is placed in * the output parameter. Otherwise, FALSE is returned and no maximum * value is set. */ RIM_INLINE Bool getMaximum( Float64& doubleValue ) const { return maximum.getValueAsType( type, doubleValue ); } /// Return a generic-typed maximum value for this parameter. RIM_INLINE FilterParameter getMaximum() const { return FilterParameter( type, maximum ); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Parameter Default Value Accessor Methods /// Query a boolean default value of this filter parameter. /** * If this parameter can be converted to a type of BOOLEAN, the method returns * TRUE and the default boolean value for this parameter is placed in * the output parameter. Otherwise, FALSE is returned and no default * value is set. */ RIM_INLINE Bool getDefault( Bool& booleanValue ) const { return defaultValue.getValueAsType( type, booleanValue ); } /// Query an integer or enumeration default value of this filter parameter. /** * If this parameter can be converted to a type of INTEGER or ENUMERATION, the method returns * TRUE and the default integer value for this parameter is placed in * the output parameter. Otherwise, FALSE is returned and no default * value is set. */ RIM_INLINE Bool getDefault( Int64& integerValue ) const { return defaultValue.getValueAsType( type, integerValue ); } /// Query a float default value of this filter parameter. /** * If this parameter can be converted to a type of FLOAT, the method returns * TRUE and the default float value for this parameter is placed in * the output parameter. Otherwise, FALSE is returned and no default * value is set. */ RIM_INLINE Bool getDefault( Float32& floatValue ) const { return defaultValue.getValueAsType( type, floatValue ); } /// Query a double default value of this filter parameter. /** * If this parameter can be converted to a type of DOUBLE, the method returns * TRUE and the default double value for this parameter is placed in * the output parameter. Otherwise, FALSE is returned and no default * value is set. */ RIM_INLINE Bool getDefault( Float64& doubleValue ) const { return defaultValue.getValueAsType( type, doubleValue ); } /// Return a generic-typed default value for this parameter. RIM_INLINE FilterParameter getDefault() const { return FilterParameter( type, defaultValue ); } private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Members /// The index of this parameter within its host SoundFilter. UInt32 index; /// A human-readable name for this filter parameter. UTF8String name; /// The minimum allowed value of this filter parameter. FilterParameterValue minimum; /// The maximum allowed value of this filter parameter. FilterParameterValue maximum; /// The default value of this filter parameter. FilterParameterValue defaultValue; /// An object representing the type of this filter parameter. FilterParameterType type; /// An object which declares the unit type of this filter parameter. FilterParameterUnits units; /// An object which declares the curve type of this filter parameter. FilterParameterCurve curve; /// An object which encapsulates boolean flags for this filter parameter. FilterParameterFlags flags; }; //########################################################################################## //************************ End Rim Sound Filters Namespace ******************************* RIM_SOUND_FILTERS_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_SOUND_FILTER_PARAMETER_INFO_H <file_sep>/* * rimGUIRenderViewDelegate.h * Rim GUI * * Created by <NAME> on 3/1/13. * Copyright 2013 __MyCompanyName__. All rights reserved. * */ #ifndef INCLUDE_RIM_GUI_RENDER_VIEW_DELEGATE_H #define INCLUDE_RIM_GUI_RENDER_VIEW_DELEGATE_H #include "rimGUIConfig.h" #include "rimGUIInput.h" //########################################################################################## //*************************** Start Rim GUI Namespace ****************************** RIM_GUI_NAMESPACE_START //****************************************************************************************** //########################################################################################## class RenderView; //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class which contains function objects that recieve RenderView events. /** * Any RenderView-related event that might be processed has an appropriate callback * function object. Each callback function is called by the GUI event thread * whenever such an event is received. If a callback function in the delegate * is not initialized, the RenderView simply ignores it and doesn't call the function. * * It must be noted that the callback functions are asynchronous and * not thread-safe. Thus, it is necessary to perform any additional synchronization * externally. */ class RenderViewDelegate { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Sizing Callback Functions /// A function object which is called whenever an attached RenderView is resized. /** * The delegate function may choose to return either a value of TRUE, indicating * that the change in size is allowed, or a value of FALSE, indicating that the * change in size should be ignored. * * The RenderView provides the desired new size of the view as a (width, height) pair. */ Function<Bool ( RenderView&, const Size2D& )> resize; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Positioning Callback Functions /// A function object which is called whenever an attached RenderView is moved. /** * The delegate function may choose to return either a value of TRUE, indicating * that the change in position is allowed, or a value of FALSE, indicating that the * change in position should be ignored. * * The RenderView provides the desired new position of the view as a 2D vector. */ Function<Bool ( RenderView&, const Vector2i& )> move; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** User Input Callback Functions /// A function object called whenever an attached render view receives a keyboard event. Function<void ( RenderView&, const input::KeyboardEvent& )> keyEvent; /// A function object called whenever an attached render view receives a mouse-motion event. Function<void ( RenderView&, const input::MouseMotionEvent& )> mouseMotionEvent; /// A function object called whenever an attached render view receives a mouse-button event. Function<void ( RenderView&, const input::MouseButtonEvent& )> mouseButtonEvent; /// A function object called whenever an attached render view receives a mouse-wheel event. Function<void ( RenderView&, const input::MouseWheelEvent& )> mouseWheelEvent; }; //########################################################################################## //*************************** End Rim GUI Namespace ******************************** RIM_GUI_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_GUI_RENDER_VIEW_DELEGATE_H <file_sep>/* * rimGraphicsContextObject.h * Rim Graphics * * Created by <NAME> on 3/10/13. * Copyright 2013 __MyCompanyName__. All rights reserved. * */ #ifndef INCLUDE_RIM_GRAPHICS_CONTEXT_OBJECT_H #define INCLUDE_RIM_GRAPHICS_CONTEXT_OBJECT_H #include "rimGraphicsDevicesConfig.h" //########################################################################################## //*********************** Start Rim Graphics Devices Namespace *************************** RIM_GRAPHICS_DEVICES_NAMESPACE_START //****************************************************************************************** //########################################################################################## class GraphicsContext; //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class which represents the base class for a hardware-based context-specific object. /** * Examples of types that should inherit from ContextObject: textures, hardware-based * buffer objects, shader objects, framebuffers, etc. * * The main reason for this class is to provide a common interface for * all hardware-based objects to access the context that is associated with them. * * A context object cannot be directly copied (it has a private copy constructor * and assignment operator). */ class ContextObject { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Destructor /// Destroy a context object, releasing all internal state. virtual ~ContextObject() { } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Context Accessor Method /// Return a pointer to the graphics context associated with this ContextObject. /** * This is the context that created this object. The object cannot * be used with any other context. This pointer is mainly used by contexts * to make sure that the context object is associated with the same context * which is trying to use it. */ RIM_INLINE const GraphicsContext* getContext() const { return context; } protected: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Protected Constructor /// Create a new context object which is associated with the specified graphics context. RIM_INLINE ContextObject( const GraphicsContext* newContext ) : context( newContext ) { RIM_DEBUG_ASSERT_MESSAGE( context != NULL, "Cannot create a new ContextObject with a NULL context" ); } private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Copy Operations /// Declared private to prevent user copying of context objects. RIM_INLINE ContextObject( const ContextObject& other ) : context( other.context ) { } /// Declared private to prevent user copying of context objects. RIM_INLINE ContextObject& operator = ( const ContextObject& other ) { context = other.context; return *this; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Members /// A pointer to the graphics context associated with this context object. /** * This is the context that created this object. The object cannot * be used with any other context. */ const GraphicsContext* context; }; //########################################################################################## //*********************** End Rim Graphics Devices Namespace ***************************** RIM_GRAPHICS_DEVICES_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_GRAPHICS_CONTEXT_OBJECT_H <file_sep>/* * rimGraphicsGUIMeter.h * Rim Graphics GUI * * Created by <NAME> on 2/13/13. * Copyright 2013 Headspace Systems. All rights reserved. * */ #ifndef INCLUDE_RIM_GRAPHICS_GUI_METER_H #define INCLUDE_RIM_GRAPHICS_GUI_METER_H #include "rimGraphicsGUIBase.h" #include "rimGraphicsGUIObject.h" #include "rimGraphicsGUIMeterDelegate.h" //########################################################################################## //************************ Start Rim Graphics GUI Namespace ****************************** RIM_GRAPHICS_GUI_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class which represents a sliding rectangular region that allows the user to modify a ranged value. class Meter : public GUIObject { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructors /// Create a new sizeless meter positioned at the origin of its coordinate system. Meter(); /// Create a new meter which occupies the specified rectangle and has the default range. Meter( const Rectangle& newRectangle ); /// Create a new meter which has the specified rectangle, orientation, range, and value. Meter( const Rectangle& newRectangle, const Orientation& newOrientation, const AABB1f& newRange, Float newValue ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Value Accessor Methods /// Return the current value for the meter. RIM_INLINE Float getValue() const { return value; } /// Set the current value for the meter. /** * The new meter value is clamped to lie within the meter's valid * range of values. */ void setValue( Float newValue ); /// Set the value for the meter with the specified transition time in seconds. /** * The new target meter value is clamped to lie within the meter's valid * range of values. The meter's displayed value will smoothly transition over the * specified transition time interval to the target value. */ void setValue( Float newValue, Float newTransitionTime ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Range Accessor Methods /// Return an object which describes the minimum and maximum allowed values for the meter. /** * The range's minimum value is placed at the minimum coordinate of the meter's major axis, * and the maximum value is placed at the maximum coordinate of the meter's major axis. * * The minimum and maximum values do not have to be properly ordered - they can be * reversed in order to reverse the effective direction of the meter. */ RIM_INLINE const AABB1f& getRange() const { return range; } /// Set an object which describes the minimum and maximum allowed values for the meter. /** * The range's minimum value is placed at the minimum coordinate of the meter's major axis, * and the maximum value is placed at the maximum coordinate of the meter's major axis. * * The minimum and maximum values do not have to be properly ordered - they can be * reversed in order to reverse the effective direction of the meter. * * The meter's value is clamped so that is lies within the new range. */ void setRange( const AABB1f& newRange ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Value Curve Accessor Methods /// Return an object representing the curve which is used to map from meter values to displayed positions. RIM_INLINE ValueCurve getValueCurve() const { return valueCurve; } /// Set an object representing the curve which is used to map from meter values to displayed positions. RIM_INLINE void setValueCurve( ValueCurve newCurve ) { valueCurve = newCurve; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Orientation Accessor Methods /// Return an object which describes how this meter's area is rotated. RIM_INLINE const Orientation& getOrientation() const { return orientation; } /// Set an object which describes how this meter's area is rotated. RIM_INLINE void setOrientation( const Orientation& newOrientation ) { orientation = newOrientation; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Border Accessor Methods /// Return a mutable object which describes this meter's border. RIM_INLINE Border& getBorder() { return border; } /// Return an object which describes this meter's border. RIM_INLINE const Border& getBorder() const { return border; } /// Set an object which describes this meter's border. RIM_INLINE void setBorder( const Border& newBorder ) { border = newBorder; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Meter Border Accessor Methods /// Return a mutable object which describes the border for this meter's moving area. RIM_INLINE Border& getMeterBorder() { return meterBorder; } /// Return an object which describes the border for this meter's moving area. RIM_INLINE const Border& getMeterBorder() const { return meterBorder; } /// Set an object which describes the border for this meter's moving area. RIM_INLINE void setMeterBorder( const Border& newMeterBorder ) { meterBorder = newMeterBorder; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Content Bounding Box Accessor Methods /// Return the 3D bounding box for the meter's content display area in its local coordinate frame. RIM_INLINE AABB3f getLocalContentBounds() const { return AABB3f( this->getLocalContentBoundsXY(), AABB1f( Float(0), this->getSize().z ) ); } /// Return the 2D bounding box for the meter's content display area in its local coordinate frame. RIM_INLINE AABB2f getLocalContentBoundsXY() const { return border.getContentBounds( AABB2f( Vector2f(), this->getSizeXY() ) ); } /// Return the local bounding box for the meter's moving area. AABB2f getLocalMeterBounds() const; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Meter State Accessor Methods /// Return whether or not this meter is currently active. RIM_INLINE Bool getIsEnabled() const { return isEnabled; } /// Set whether or not this meter is currently active. RIM_INLINE void setIsEnabled( Bool newIsEnabled ) { isEnabled = newIsEnabled; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Delegate Accessor Methods /// Return a reference to the delegate which responds to events for this meter. RIM_INLINE MeterDelegate& getDelegate() { return delegate; } /// Return a reference to the delegate which responds to events for this meter. RIM_INLINE const MeterDelegate& getDelegate() const { return delegate; } /// Return a reference to the delegate which responds to events for this meter. RIM_INLINE void setDelegate( const MeterDelegate& newDelegate ) { delegate = newDelegate; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Color Accessor Methods /// Return the background color for this meter's area. RIM_INLINE const Color4f& getBackgroundColor() const { return backgroundColor; } /// Set the background color for this meter's area. RIM_INLINE void setBackgroundColor( const Color4f& newBackgroundColor ) { backgroundColor = newBackgroundColor; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Border Color Accessor Methods /// Return the border color used when rendering a meter. RIM_INLINE const Color4f& getBorderColor() const { return borderColor; } /// Set the border color used when rendering a meter. RIM_INLINE void setBorderColor( const Color4f& newBorderColor ) { borderColor = newBorderColor; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Meter Color Accessor Methods /// Return the color used when rendering a meter's moving area. RIM_INLINE const Color4f& getMeterColor() const { return meterColor; } /// Set the color used when rendering a meter's moving area. RIM_INLINE void setMeterColor( const Color4f& newMeterColor ) { meterColor = newMeterColor; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Meter Border Color Accessor Methods /// Return the border color used when rendering a meter's moving area. RIM_INLINE const Color4f& getMeterBorderColor() const { return meterBorderColor; } /// Set the border color used when rendering a meter's moving area. RIM_INLINE void setMeterBorderColor( const Color4f& newMeterBorderColor ) { meterBorderColor = newMeterBorderColor; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Update Method /// Update the current internal state of this meter for the specified time interval in seconds. virtual void update( Float dt ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Drawing Method /// Draw this object using the specified GUI renderer to the given parent coordinate system bounds. /** * The method returns whether or not the object was successfully drawn. * * The default implementation draws nothing and returns TRUE. */ virtual Bool drawSelf( GUIRenderer& renderer, const AABB3f& parentBounds ) const; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Static Construction Methods /// Construct a smart-pointer-wrapped instance of this class using the constructor with the given arguments. RIM_INLINE static Pointer<Meter> construct() { return Pointer<Meter>::construct(); } /// Construct a smart-pointer-wrapped instance of this class using the constructor with the given arguments. RIM_INLINE static Pointer<Meter> construct( const Rectangle& newRectangle ) { return Pointer<Meter>::construct( newRectangle ); } /// Construct a smart-pointer-wrapped instance of this class using the constructor with the given arguments. RIM_INLINE static Pointer<Meter> construct( const Rectangle& newRectangle, const Orientation& newOrientation, const AABB1f& newRange, Float newValue ) { return Pointer<Meter>::construct( newRectangle, newOrientation, newRange, newValue ); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Public Static Data Members /// The default border that is used for a meter. static const Border DEFAULT_BORDER; /// The default meter border that is used for a meter's moving area. static const Border DEFAULT_METER_BORDER; /// The default background color that is used for a meter's area. static const Color4f DEFAULT_BACKGROUND_COLOR; /// The default border color that is used for a meter's area. static const Color4f DEFAULT_BORDER_COLOR; /// The default color that is used for a meter's moving area. static const Color4f DEFAULT_METER_COLOR; /// The default meter border color that is used for a meter's moving area. static const Color4f DEFAULT_METER_BORDER_COLOR; private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Helper Methods /// Return the bounding box for this meter's moving area given the bounds for its content area. RIM_INLINE AABB2f getMeterBoundsForContentBounds( const AABB2f& contentBounds ) const; /// Return the position of the meter from [0,1], based on the current value within the meter's range. RIM_INLINE Float getMeterPosition() const { if ( range.min <= range.max ) return valueCurve.evaluateInverse( value, range ); else return valueCurve.evaluateInverse( value, AABB1f( range.max, range.min ) ); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Members /// An object which describes how this meter is rotated within its area. Orientation orientation; /// The range of allowed values for this meter. /** * The range's minimum value is placed at the minimum coordinate of the meter's major axis, * and the maximum value is placed at the maximum coordinate of the meter's major axis. * * The minimum and maximum values do not have to be properly ordered - they can be * reversed in order to reverse the effective direction of the meter. */ AABB1f range; /// The current value for the meter. Float value; /// The target value for the meter. Float targetValue; /// The amount that the meter's value should change by for each second that passes. Float valueChangeRate; /// An object representing the curve which is used to map from meter values to positions. ValueCurve valueCurve; /// An object which describes the border for this meter. Border border; /// An object which describes the border for this meter's moving area. Border meterBorder; /// An object which contains function pointers that respond to meter events. MeterDelegate delegate; /// The background color for the meter's area. Color4f backgroundColor; /// The border color for the meter's background area. Color4f borderColor; /// The color used for the moving part of the meter's area. Color4f meterColor; /// The border color used for the moving part of the meter's area. Color4f meterBorderColor; /// A boolean value indicating whether or not this meter is active. /** * If the meter is not enabled, it will not display its moving meter area * and will not indicate a value or allow the user to edit the meter. */ Bool isEnabled; }; //########################################################################################## //************************ End Rim Graphics GUI Namespace ******************************** RIM_GRAPHICS_GUI_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_GRAPHICS_GUI_METER_H <file_sep>/* * rimPhysicsObjectPair.h * Rim Physics * * Created by <NAME> on 11/28/09. * Copyright 2009 Rim Software. All rights reserved. * */ #ifndef INCLUDE_RIM_PHYSICS_OBJECT_PAIR_H #define INCLUDE_RIM_PHYSICS_OBJECT_PAIR_H #include "rimPhysicsObjectsConfig.h" //########################################################################################## //*********************** Start Rim Physics Objects Namespace **************************** RIM_PHYSICS_OBJECTS_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class which encapsulates a pair of physics objects of different types. template < typename ObjectType1, typename ObjectType2 > class ObjectPair { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructors /// Create an object pair from the two specified objects. RIM_INLINE ObjectPair( const ObjectType1* newObject1, const ObjectType2* newObject2 ) : object1( newObject1 ), object2( newObject2 ) { RIM_DEBUG_ASSERT_MESSAGE( newObject1 != NULL, "Cannot use NULL object in collision pair." ); RIM_DEBUG_ASSERT_MESSAGE( newObject2 != NULL, "Cannot use NULL object in collision pair." ); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Collider Accessor Methods /// Return a const pointer to the first object in this object pair. RIM_FORCE_INLINE const ObjectType1* getObject1() const { return object1; } /// Set the first object in this object pair. RIM_INLINE void setObject1( const ObjectType1* newObject1 ) { RIM_DEBUG_ASSERT_MESSAGE( newObject1 != NULL, "Cannot use NULL object in collision pair." ); object1 = newObject1; } /// Return a const pointer to the first object in this object pair. RIM_FORCE_INLINE const ObjectType2* getObject2() const { return object2; } /// Set the second object in this object pair. RIM_INLINE void setObject2( const ObjectType2* newObject2 ) { RIM_DEBUG_ASSERT_MESSAGE( newObject2 != NULL, "Cannot use NULL object in collision pair." ); object2 = newObject2; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Object Pair Comparison Operators /// Return whether or not this object pair is equal to another. RIM_FORCE_INLINE Bool operator == ( const ObjectPair& other ) const { return object1 == other.object1 && object2 == other.object2; } /// Return whether or not this object pair is not equal to another. RIM_FORCE_INLINE Bool operator != ( const ObjectPair& other ) const { return object1 != other.object1 || object2 != other.object2; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Hash Code Accessor Methods /// Return a hash code for this object pair. RIM_INLINE Hash getHashCode() const { return object1->getHashCode() ^ object2->getHashCode(); } private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Members /// The first object in this object pair. const ObjectType1* object1; /// The second object in this object pair. const ObjectType2* object2; }; //########################################################################################## //########################################################################################## //############ //############ Same-Type Object Pair Template Specialization //############ //########################################################################################## //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class which encapsulates a pair of physics objects of the same type. /** * This ObjectPair specialization exists to account for the fact that * objects of the same type may be reversed and thus it is necessary to * test pairs for equality with both combinations of objects. */ template < typename ObjectType > class ObjectPair<ObjectType,ObjectType> { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructors /// Create an object pair from the two specified objects. RIM_INLINE ObjectPair( const ObjectType* newObject1, const ObjectType* newObject2 ) : object1( newObject1 ), object2( newObject2 ) { RIM_DEBUG_ASSERT_MESSAGE( newObject1 != NULL, "Cannot use NULL object in collision pair." ); RIM_DEBUG_ASSERT_MESSAGE( newObject2 != NULL, "Cannot use NULL object in collision pair." ); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Collider Accessor Methods /// Return a const pointer to the first object in this object pair. RIM_FORCE_INLINE const ObjectType* getObject1() const { return object1; } /// Set the first object in this object pair. RIM_INLINE void setObject1( const ObjectType* newObject1 ) { RIM_DEBUG_ASSERT_MESSAGE( newObject1 != NULL, "Cannot use NULL object in collision pair." ); object1 = newObject1; } /// Return a const pointer to the first object in this object pair. RIM_FORCE_INLINE const ObjectType* getObject2() const { return object2; } /// Set the second object in this object pair. RIM_INLINE void setObject2( const ObjectType* newObject2 ) { RIM_DEBUG_ASSERT_MESSAGE( newObject2 != NULL, "Cannot use NULL object in collision pair." ); object2 = newObject2; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Object Pair Comparison Operators /// Return whether or not this object pair is equal to another. RIM_FORCE_INLINE Bool operator == ( const ObjectPair& other ) const { return (object1 == other.object1 && object2 == other.object2) || (object1 == other.object2 && object2 == other.object1); } /// Return whether or not this object pair is not equal to another. RIM_FORCE_INLINE Bool operator != ( const ObjectPair& other ) const { return !(*this == other); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Hash Code Accessor Methods /// Return a hash code for this object pair. RIM_INLINE Hash getHashCode() const { return object1->getHashCode() ^ object2->getHashCode(); } private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Members /// The first object in this object pair. const ObjectType* object1; /// The second object in this object pair. const ObjectType* object2; }; //########################################################################################## //*********************** End Rim Physics Objects Namespace ****************************** RIM_PHYSICS_OBJECTS_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_PHYSICS_OBJECT_PAIR_H <file_sep>/* * rimTuple.h * Rim Framework * * Created by <NAME> on 7/2/09. * Copyright 2009 Rim Software. All rights reserved. * */ #ifndef INCLUDE_RIM_TUPLE_H #define INCLUDE_RIM_TUPLE_H #include "rimLanguageConfig.h" #include "detail/rimNullType.h" //########################################################################################## //*************************** Start Rim Language Namespace ******************************* RIM_LANGUAGE_NAMESPACE_START //****************************************************************************************** //########################################################################################## //########################################################################################## //########################################################################################## //############ //############ 0-Element Tuple Class //############ //########################################################################################## //########################################################################################## template < typename T1 = internal::NullType, typename T2 = internal::NullType, typename T3 = internal::NullType, typename T4 = internal::NullType, typename T5 = internal::NullType, typename T6 = internal::NullType, typename T7 = internal::NullType > class Tuple { public: RIM_INLINE Tuple( const T1& v1, const T2& v2, const T3& v3, const T4& v4, const T5& v5, const T6& v6, const T7& v7 ) : value1( v1 ), value2( v2 ), value3( v3 ), value4( v4 ), value5( v5 ), value6( v6 ), value7( v7 ) { } T1 value1; T2 value2; T3 value3; T4 value4; T5 value5; T6 value6; T7 value7; }; //########################################################################################## //########################################################################################## //############ //############ 1-Element Tuple Class //############ //########################################################################################## //########################################################################################## template < typename T1 > class Tuple<T1, internal::NullType, internal::NullType, internal::NullType, internal::NullType, internal::NullType, internal::NullType> { public: RIM_INLINE Tuple( const T1& v1 ) : value1( v1 ) { } T1 value1; }; //########################################################################################## //########################################################################################## //############ //############ 2-Element Tuple Class //############ //########################################################################################## //########################################################################################## template < typename T1, typename T2 > class Tuple<T1, T2, internal::NullType, internal::NullType, internal::NullType, internal::NullType, internal::NullType> { public: RIM_INLINE Tuple( const T1& v1, const T2& v2 ) : value1( v1 ), value2( v2 ) { } T1 value1; T2 value2; }; //########################################################################################## //########################################################################################## //############ //############ 3-Element Tuple Class //############ //########################################################################################## //########################################################################################## template < typename T1, typename T2, typename T3 > class Tuple<T1, T2, T3, internal::NullType, internal::NullType, internal::NullType, internal::NullType> { public: RIM_INLINE Tuple( const T1& v1, const T2& v2, const T3& v3 ) : value1( v1 ), value2( v2 ), value3( v3 ) { } T1 value1; T2 value2; T3 value3; }; //########################################################################################## //########################################################################################## //############ //############ 4-Element Tuple Class //############ //########################################################################################## //########################################################################################## template < typename T1, typename T2, typename T3, typename T4 > class Tuple<T1, T2, T3, T4, internal::NullType, internal::NullType, internal::NullType> { public: RIM_INLINE Tuple( const T1& v1, const T2& v2, const T3& v3, const T4& v4 ) : value1( v1 ), value2( v2 ), value3( v3 ), value4( v4 ) { } T1 value1; T2 value2; T3 value3; T4 value4; }; //########################################################################################## //########################################################################################## //############ //############ 5-Element Tuple Class //############ //########################################################################################## //########################################################################################## template < typename T1, typename T2, typename T3, typename T4, typename T5 > class Tuple<T1, T2, T3, T4, T5, internal::NullType, internal::NullType> { public: RIM_INLINE Tuple( const T1& v1, const T2& v2, const T3& v3, const T4& v4, const T5& v5 ) : value1( v1 ), value2( v2 ), value3( v3 ), value4( v4 ), value5( v5 ) { } T1 value1; T2 value2; T3 value3; T4 value4; T5 value5; }; //########################################################################################## //########################################################################################## //############ //############ 6-Element Tuple Class //############ //########################################################################################## //########################################################################################## template < typename T1, typename T2, typename T3, typename T4, typename T5, typename T6 > class Tuple<T1, T2, T3, T4, T5, T6, internal::NullType> { public: RIM_INLINE Tuple( const T1& v1, const T2& v2, const T3& v3, const T4& v4, const T5& v5, const T6& v6 ) : value1( v1 ), value2( v2 ), value3( v3 ), value4( v4 ), value5( v5 ), value6( v6 ) { } T1 value1; T2 value2; T3 value3; T4 value4; T5 value5; T6 value6; }; //########################################################################################## //*************************** End Rim Language Namespace ********************************* RIM_LANGUAGE_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_TUPLE_H <file_sep>/* * rimGUITextField.h * Rim GUI * * Created by <NAME> on 9/24/12. * Copyright 2012 __MyCompanyName__. All rights reserved. * */ #ifndef INCLUDE_RIM_GUI_TEXT_FIELD_H #define INCLUDE_RIM_GUI_TEXT_FIELD_H #include "rimGUIConfig.h" #include "rimGUIWindowElement.h" #include "rimGUITextFieldDelegate.h" //########################################################################################## //*************************** Start Rim GUI Namespace ****************************** RIM_GUI_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class which represents a single-line text label or field that is part of a window. class TextField : public WindowElement { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructors /// Create a new text field with no text content and positioned at the origin of its coordinate system. TextField(); /// Create a new text field which uses the specified text content, positioned at the origin of its coordinate system. TextField( const UTF8String& newText, const Size2D& newSize ); /// Create a new text field which uses the specified text content and position. TextField( const UTF8String& newText, const Size2D& newSize, const Vector2i& newPosition ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Destructor /// Destroy a text field, releasing all resources associated with it. ~TextField(); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Text Accessor Methods /// Return a string which contains the contents of this text field. UTF8String getText() const; /// Set the text contents of this text field. /** * The method returns whether or not the text change operation was successful. */ Bool setText( const UTF8String& newText ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Size Accessor Methods /// Return a 2D vector indicating the size on the screen of this text field in pixels. virtual Size2D getSize() const; /// Set the size on the screen of this text field in pixels. /** * The method returns whether or not the size change operation was * successful. */ virtual Bool setSize( const Size2D& size ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Position Accessor Methods /// Return the 2D position of this text field in pixels, relative to the bottom left corner. /** * The coordinate position is defined relative to its enclosing coordinate frame * where the origin will be the bottom left corner of the enclosing view or window. */ virtual Vector2i getPosition() const; /// Set the 2D position of this text field in pixels, relative to the bottom left corner. /** * The coordinate position is defined relative to its enclosing coordinate frame * where the origin will be the bottom left corner of the enclosing view or window. * * If the position change operation is successful, TRUE is returned and the text field is * moved. Otherwise, FALSE is returned and the text field is not moved. */ virtual Bool setPosition( const Vector2i& position ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Editing State Accessor Methods /// Return whether or not the text field is able to be edited by the user. /** * A text field that is not editable will appear as a simple text label. */ Bool getIsEditable() const; /// Set whether or not the text field is able to be edited by the user. /** * A text field that is not editable will appear as a simple text label. */ void setIsEditable( Bool newIsEditable ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Selecting State Accessor Methods /// Return whether or not the contents of the text field are able to be selected by the user. Bool getIsSelectable() const; /// Set whether or not the contents of the text field are able to be selected by the user. void setIsSelectable( Bool newIsSelectable ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Delegate Accessor Methods /// Return a const reference to the object which responds to events for this TextField. const TextFieldDelegate& getDelegate() const; /// Set the object to which TextField events should be delegated. void setDelegate( const TextFieldDelegate& newDelegate ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Parent Window Accessor Methods /// Return the window which is a parent of this text field. /** * If NULL is returned, it indicates that the text field is not part of a window. */ virtual Window* getParentWindow() const; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Platform-Specific Element Pointer Accessor Method /// Return a pointer to platform-specific data for this text field. /** * On Mac OS X, this method returns a pointer to a subclass of NSTextField * which represents the text field. * * On Windows, this method returns an HWND indicating the 'window' which * represents the text field. */ virtual void* getInternalPointer() const; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Static Shared Construction Methods /// Create a shared-pointer text field object, calling the constructor with the same arguments. RIM_INLINE static Pointer<TextField> construct() { return Pointer<TextField>( util::construct<TextField>() ); } /// Create a shared-pointer text field object, calling the constructor with the same arguments. RIM_INLINE static Pointer<TextField> construct( const UTF8String& newText, const Size2D& newSize ) { return Pointer<TextField>( util::construct<TextField>( newText, newSize ) ); } /// Create a shared-pointer text field object, calling the constructor with the same arguments. RIM_INLINE static Pointer<TextField> construct( const UTF8String& newText, const Size2D& newSize, const Vector2i& newPosition ) { return Pointer<TextField>( util::construct<TextField>( newText, newSize, newPosition ) ); } public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Wrapper Class Declaration /// A class which wraps platform-specific data for a text field. class Wrapper; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Parent Accessor Methods /// Set the window which is going to be a parent of this text field. /** * Setting this value to NULL should indicate that the text field is no longer * part of a window. */ virtual void setParentWindow( Window* parentWindow ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Members /// A pointer to an object which wraps platform-specific data for this text field. Wrapper* wrapper; }; //########################################################################################## //*************************** End Rim GUI Namespace ******************************** RIM_GUI_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_GUI_TEXT_FIELD_H <file_sep>/* * rimGraphicsShaderPassSourceAssetTranscoder.h * Rim Software * * Created by <NAME> on 6/22/14. * Copyright 2014 __MyCompanyName__. All rights reserved. * */ #ifndef INCLUDE_RIM_GRAPHICS_SHADER_PASS_SOURCE_ASSET_TRANSCODER_H #define INCLUDE_RIM_GRAPHICS_SHADER_PASS_SOURCE_ASSET_TRANSCODER_H #include "rimGraphicsAssetsConfig.h" #include "rimGraphicsShaderProgramAssetTranscoder.h" //########################################################################################## //*********************** Start Rim Graphics Assets Namespace **************************** RIM_GRAPHICS_ASSETS_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class which encodes and decodes graphics shader passes to the asset format. class GraphicsShaderPassSourceAssetTranscoder : public AssetTypeTranscoder<ShaderPassSource> { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Destructor //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Text Encoding/Decoding Methods /// Decode an object from the specified string stream, returning a pointer to the final object. virtual Pointer<ShaderPassSource> decodeText( const AssetType& assetType, const AssetObject& assetObject, ResourceManager* resourceManager = NULL ); /// Encode an object of this asset type into a text-based format. virtual Bool encodeText( UTF8StringBuffer& buffer, ResourceManager* resourceManager, const ShaderPassSource& shaderPassSource ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Public Static Data Members /// An object indicating the asset type for a graphics shader pass source. static const AssetType SHADER_PASS_SOURCE_ASSET_TYPE; private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Type Declarations /// An enum describing the fields that a graphics shader pass can have. typedef enum Field { /// An undefined field. UNDEFINED = 0, /// "program" The shader program that this shader pass source is using. PROGRAM, /// "renderMode" The rendering mode that this shader pass source is using. RENDER_MODE, /// "constantBindings" The constant bindings that this shader pass source has. CONSTANT_BINDINGS, /// "textureBindings" The texture bindings that this shader pass source has. TEXTURE_BINDINGS, /// "vertexBindings" The vertex bindings that this shader pass source has. VERTEX_BINDINGS }; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Helper Methods /// Return an enum value indicating the field indicated by the given field name. static Field getFieldType( const AssetObject::String& name ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Members /// An object that handles encoding/decoding shader programs. GraphicsShaderProgramAssetTranscoder programTranscoder; /// A temporary asset object used when parsing shader pass source child objects. AssetObject tempObject; }; //########################################################################################## //*********************** End Rim Graphics Assets Namespace ****************************** RIM_GRAPHICS_ASSETS_NAMESPACE_END //****************************************************************************************** //########################################################################################## //########################################################################################## //**************************** Start Rim Assets Namespace ******************************** RIM_ASSETS_NAMESPACE_START //****************************************************************************************** //########################################################################################## template <> RIM_INLINE const AssetType& AssetType::of<rim::graphics::shaders::ShaderPassSource>() { return rim::graphics::assets::GraphicsShaderPassSourceAssetTranscoder::SHADER_PASS_SOURCE_ASSET_TYPE; } //########################################################################################## //**************************** End Rim Assets Namespace ********************************** RIM_ASSETS_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_GRAPHICS_SHADER_PASS_SOURCE_ASSET_TRANSCODER_H <file_sep>/* * rimGraphicsShaderTechnique.h * Rim Graphics * * Created by <NAME> on 1/6/11. * Copyright 2011 Rim Software. All rights reserved. * */ #ifndef INCLUDE_RIM_GRAPHICS_MATERIAL_TECHNIQUE_H #define INCLUDE_RIM_GRAPHICS_MATERIAL_TECHNIQUE_H #include "rimGraphicsMaterialsConfig.h" #include "rimGraphicsMaterialTechniqueUsage.h" //########################################################################################## //********************** Start Rim Graphics Materials Namespace ************************** RIM_GRAPHICS_MATERIALS_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class which represents a kind of visual effect that uses an ordered series of shader passes. /** * A material technique contains an ordered list of shader passes which indicate * the different passes that are part of rendering a particular visual effect. * These passes are performed in series during rendering in the order stored in the * technique. * * A material technique may be simply a different visual style (shiny or not shiny) * or a totally different rendering technique (standard versus shadow map rendering). */ class MaterialTechnique { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructors /// Create a new empty material technique with no shader passes. MaterialTechnique(); /// Create a new empty material technique with the specified usage type. MaterialTechnique( const MaterialTechniqueUsage& newUsage ); /// Create a new material technique with the specified usage type and first shader pass. MaterialTechnique( const MaterialTechniqueUsage& newUsage, const Pointer<ShaderPass>& newPass ); /// Create a new material technique with undefined usage and the specified shader pass pass. MaterialTechnique( const Pointer<ShaderPass>& newPass ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Usage Accessor Methods /// Return an enum value indicating the semantic usage of this material technique. RIM_INLINE const MaterialTechniqueUsage& getUsage() const { return usage; } /// Set an enum value indicating the semantic usage of this material technique. RIM_INLINE void setUsage( const MaterialTechniqueUsage& newUsage ) { usage = newUsage; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Shader Pass Accessor Methods /// Return the number of shader passes that are part of this material technique. RIM_INLINE Size getPassCount() const { return passes.getSize(); } /// Return a pointer to the shader pass at the specified index in this material technique. RIM_INLINE const Pointer<ShaderPass>& getPass( Index index ) const { return passes.get( index ); } /// Add the specified shader pass to the end of this material technique's list of passes. /** * If the pointer to the pass is NULL, the method fails and FALSE is returned. * Otherise, the shader pass is added and TRUE is returned. */ Bool addPass( const Pointer<ShaderPass>& newPass ); /// Insert the specified shader pass at the given position in this material technique's list of passes. /** * If the pointer to the pass is NULL, the method fails and FALSE is returned. * Otherise, the shader pass is inserted and TRUE is returned. */ Bool insertPass( Index index, const Pointer<ShaderPass>& newPass ); /// Replace the shader pass at the specified index in this material technique. /** * If the pointer to the pass is NULL, the method fails and FALSE is returned. * Otherise, the shader pass is replaced and TRUE is returned. */ Bool setPass( Index index, const Pointer<ShaderPass>& newPass ); /// Remove the shader pass at the specified index in this material technique. /** * This method shifts all shader passes after the removed one back one index * in the shader pass list. */ void removePass( Index index ); /// Remove all shader passes from this material technique. void clearPasses(); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Transparency Accessor Methods /// Return whether or not this material technique produces transparent pixels. Bool getIsTransparent() const; private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Members /// A list of the shader passes that make up this material technique, in order of their execution. ShortArrayList<Pointer<ShaderPass>,2> passes; /// An enum value indicating the semantic usage of this material technique. MaterialTechniqueUsage usage; }; //########################################################################################## //********************** End Rim Graphics Materials Namespace **************************** RIM_GRAPHICS_MATERIALS_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_GRAPHICS_MATERIAL_TECHNIQUE_H <file_sep>/* * rimSoundFilterParameterFlags.h * Rim Sound * * Created by <NAME> on 8/21/12. * Copyright 2012 __MyCompanyName__. All rights reserved. * */ #ifndef INCLUDE_RIM_SOUND_FILTER_PARAMETER_FLAGS_H #define INCLUDE_RIM_SOUND_FILTER_PARAMETER_FLAGS_H #include "rimSoundFiltersConfig.h" //########################################################################################## //************************ Start Rim Sound Filters Namespace ***************************** RIM_SOUND_FILTERS_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class which encapsulates the different flags that a sound filter parameter can have. /** * These flags provide boolean information about a certain filter parameter. * For example, flags can indicate the read/write status of a parameter. Flags * are indicated by setting a single bit of a 32-bit unsigned integer to 1. * * Enum values for the different flags are defined as members of the class. Typically, * the user would bitwise-OR the flag enum values together to produce a final set * of set flags. */ class FilterParameterFlags { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Parameter Type Enum Declaration /// An enum which specifies the different filter parameter flags. typedef enum Enum { /// A flag set when a parameter's value can be read. READ_ACCESS = 1 << 0, /// A flag set when a parameter's value can be changed. WRITE_ACCESS = 1 << 1, /// A flag set when some of a parameter's values may have special names associated with them. NAMED_VALUES = 1 << 2, /// The flag value when all flags are not set. UNDEFINED = 0 }; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructors /// Create a new filter parameter flags object with no flags set. RIM_INLINE FilterParameterFlags() : flags( UNDEFINED ) { } /// Create a new filter parameter flags object with the specified flags value. RIM_INLINE FilterParameterFlags( UInt32 newFlags ) : flags( newFlags ) { } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Integer Cast Operator /// Convert this filter parameter flags object to an integer value. /** * This operator is provided so that the FilterParameterFlags object * can be used as an integer value for bitwise logical operations. */ RIM_INLINE operator UInt32 () const { return flags; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Read Status Accessor Methods /// Return whether or not these parameter flags indicate that read access is enabled. RIM_INLINE Bool getIsReadable() const { return (flags & READ_ACCESS) != UNDEFINED; } /// Set whether or not these parameter flags indicate that read access is enabled. RIM_INLINE void setIsReadable( Bool newIsReadable ) { if ( newIsReadable ) flags |= READ_ACCESS; else flags &= ~READ_ACCESS; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Write Status Accessor Methods /// Return whether or not these parameter flags indicate that write access is enabled. RIM_INLINE Bool getIsWriteable() const { return (flags & WRITE_ACCESS) != UNDEFINED; } /// Set whether or not these parameter flags indicate that write access is enabled. RIM_INLINE void setIsWriteable( Bool newIsWritable ) { if ( newIsWritable ) flags |= WRITE_ACCESS; else flags &= ~WRITE_ACCESS; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Name Value Status Accessor Methods /// Return whether or not these parameter flags indicate the parameter has any specially named values. RIM_INLINE Bool getHasNamedValues() const { return (flags & NAMED_VALUES) != UNDEFINED; } /// Set whether or not these parameter flags indicate the parameter has any specially named values. RIM_INLINE void setHasNamedValues( Bool newHasNamedValues ) { if ( newHasNamedValues ) flags |= NAMED_VALUES; else flags &= ~NAMED_VALUES; } private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Members /// A value indicating the flags that are set for this filter parameter. UInt32 flags; }; //########################################################################################## //************************ End Rim Sound Filters Namespace ******************************* RIM_SOUND_FILTERS_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_SOUND_FILTER_PARAMETER_FLAGS_H <file_sep>/* * rimGraphicsShaderPassUsage.h * Rim Graphics * * Created by <NAME> on 10/5/13. * Copyright 2013 __MyCompanyName__. All rights reserved. * */ #ifndef INCLUDE_RIM_GRAPHICS_SHADER_PASS_USAGE_H #define INCLUDE_RIM_GRAPHICS_SHADER_PASS_USAGE_H #include "rimGraphicsShadersConfig.h" //########################################################################################## //*********************** Start Rim Graphics Shaders Namespace *************************** RIM_GRAPHICS_SHADERS_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class which represents the semantic usage for a ShaderPass. /** * This enum class contains various values which describe different common * types of shading. */ class ShaderPassUsage { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Shader Pass Usage Enum Definition /// An enum value which indicates the type of shader pass usage. typedef enum Enum { /// This usage specifies an undefined shader pass usage. UNDEFINED = 0, /// The shader pass renders geometry using a flat-shading model (no lighting). /** * This shading model should use a uniform surface color. */ FLAT, /// The shader pass renders geometry using a flat vertex-color-shading model (no lighting). /** * This shading model should use a per-vertex surface color. */ FLAT_VERTEX_COLOR, /// The shader pass renders geometry using a lambertian illumination model. LAMBERTIAN, /// The shader pass renders using a lambertian vertex-color-shading model. /** * This shading model should use a per-vertex surface color. */ LAMBERTIAN_VERTEX_COLOR, /// The shader pass renders geometry using a phong illumination model. PHONG, /// The shader pass renders using a phong vertex-color-shading model. /** * This shading model should use a per-vertex surface color. */ PHONG_VERTEX_COLOR, /// The shader pass is used to render depth information only, i.e. for shadow maps. DEPTH }; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructors /// Create a new shader pass usage with an undefined usage enum value.. RIM_INLINE ShaderPassUsage() : usage( UNDEFINED ) { } /// Create a new shader pass usage with the specified shader pass usage enum value. RIM_INLINE ShaderPassUsage( Enum newUsage ) : usage( newUsage ) { } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Enum Cast Operator /// Convert this shader pass usage to an enum value. RIM_INLINE operator Enum () const { return usage; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** String Representation Accessor Methods /// Return a unique string for this shader pass usage that matches its enum value name. data::String toEnumString() const; /// Return a shader pass usage which corresponds to the given enum string. static ShaderPassUsage fromEnumString( const data::String& enumString ); /// Return a string representation of the shader pass usage. String toString() const; /// Convert this shader pass usage into a string representation. RIM_INLINE operator String () const { return this->toString(); } private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Members /// An enum for the shader pass usage. Enum usage; }; //########################################################################################## //*********************** End Rim Graphics Shaders Namespace ***************************** RIM_GRAPHICS_SHADERS_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_GRAPHICS_SHADER_PASS_USAGE_H <file_sep>/* * rimSoundDeviceDelegate.h * Rim Sound * * Created by <NAME> on 4/2/13. * Copyright 2013 __MyCompanyName__. All rights reserved. * */ #ifndef INCLUDE_RIM_SOUND_DEVICE_DELEGATE_H #define INCLUDE_RIM_SOUND_DEVICE_DELEGATE_H #include "rimSoundDevicesConfig.h" //########################################################################################## //************************ Start Rim Sound Devices Namespace ***************************** RIM_SOUND_DEVICES_NAMESPACE_START //****************************************************************************************** //########################################################################################## class SoundDevice; /// Define a short name for the type of the function object that is used to recieve audio from SoundDevice objects. /** * The implementor of the function can read the specified number of samples from the input buffer and * use them in some way. * * The given time represents the absolute time of the first sample in the buffer, * measured relative to the Epoch, 1970-01-01 00:00:00 +0000 (UTC). */ typedef Function<void ( SoundDevice& device, const SoundBuffer& inputBuffer, Size numInputSamples, const Time& time )> SoundInputCallback; /// Define a short name for the type of the function object that is used to send audio to SoundDevice objects for output. /** * The implementor should write the specified number of samples to the output buffer for each channel * and then return the number of samples that were successfully written to the output buffer. * * The given time represents the absolute time of the first sample in the buffer, * measured relative to the Epoch, 1970-01-01 00:00:00 +0000 (UTC). */ typedef Function<Size ( SoundDevice& device, SoundBuffer& outputBuffer, Size numOutputSamples, const Time& time )> SoundOutputCallback; //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class which contains function objects that recieve SoundDevice events. /** * Any device-related event that might be processed has an appropriate callback * function object. Each callback function is called by the device * whenever such an event is received. If a callback function in the delegate * is not initialized, the device simply ignores it. */ class SoundDeviceDelegate { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Sound Device Delegate Callback Functions /// A function object which is called whenever the device provides input audio. /** * This callback is called whenever the SoundDevice has audio that it has captured on its inputs. * The implementor of the callback method can read the samples from the given input sound buffer. * * This method will be called from a separate thread (the audio processing thread) * so any data accessed in the callback function should use proper thread synchonization * to avoid unsafe access. */ SoundInputCallback inputCallback; /// A function object which is called whenever the device requests output audio. /** * This callback is called whenever the SoundDevice needs output audio to send to the device. * The implementor of the callback method should produce sound which is written to the output * buffer for the requested number of samples. If the callback takes too long to process * the samples for output, the result is that output buffers are dropped, producing choppy audio. * * This method will be called from a separate thread (the audio processing thread) * so any data accessed in the callback function should use proper thread synchonization * to avoid unsafe access. */ SoundOutputCallback outputCallback; /// A function called whenever the device detects that the user has taken too long to process audio I/O. /** * When this happens, the device must drop input or output frames, causing glitchy audio. * This callback exists so that the user can detect this event and reduce the audio thread * processing load. */ Function<void ( SoundDevice& device )> processOverload; /// A function object which is called whenever the sound device is removed from the system. Function<void ( SoundDevice& device )> removed; /// A function object which is called whenever the sampling rate for a SoundDevice has changed. Function<void ( SoundDevice& device, SampleRate newSampleRate )> sampleRateChanged; }; //########################################################################################## //************************ End Rim Sound Devices Namespace ******************************* RIM_SOUND_DEVICES_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_SOUND_DEVICE_DELEGATE_H <file_sep>/* * rimImageIO.h * Rim Images * * Created by <NAME> on 12/29/08. * Copyright 2008 Rim Software. All rights reserved. * */ #ifndef INCLUDE_RIM_IMAGE_IO_H #define INCLUDE_RIM_IMAGE_IO_H #include "io/rimImageIOConfig.h" #include "io/rimImageFormat.h" #include "io/rimImageTranscoder.h" #include "io/rimImagesBMPTranscoder.h" #include "io/rimImagesJPEGTranscoder.h" #include "io/rimImagesPNGTranscoder.h" #include "io/rimImagesTGATranscoder.h" #include "io/rimImageConverter.h" #ifdef RIM_IMAGE_IO_NAMESPACE_START #undef RIM_IMAGE_IO_NAMESPACE_START #endif #ifdef RIM_IMAGE_IO_NAMESPACE_END #undef RIM_IMAGE_IO_NAMESPACE_END #endif #endif // INCLUDE_RIM_IMAGE_IO_H <file_sep>/* * rimArrayMath.h * Rim Software * * Created by <NAME> on 9/19/14. * Copyright 2014 __MyCompanyName__. All rights reserved. * */ #ifndef INCLUDE_RIM_ARRAY_MATH_H #define INCLUDE_RIM_ARRAY_MATH_H #include "rimMathConfig.h" //########################################################################################## //***************************** Start Rim Math Namespace ********************************* RIM_MATH_NAMESPACE_START //****************************************************************************************** //########################################################################################## //########################################################################################## //########################################################################################## //############ //############ Array Add Methods //############ //########################################################################################## //########################################################################################## template < typename T > void add( T* destination, T b, Size number ); template < typename T > void add( T* destination, const T* b, Size number ); template < typename T > void add( T* destination, const T* a, const T* b, Size number ); template < typename T > void add( T* destination, const T* a, T b, Size number ); //########################################################################################## //########################################################################################## //############ //############ Array Subtract Methods //############ //########################################################################################## //########################################################################################## template < typename T > void negate( T* destination, Size number ); template < typename T > void negate( T* destination, const T* a, Size number ); template < typename T > void subtract( T* destination, T b, Size number ); template < typename T > void subtract( T* destination, const T* b, Size number ); template < typename T > void subtract( T* destination, const T* a, const T* b, Size number ); template < typename T > void subtract( T* destination, const T* a, T b, Size number ); //########################################################################################## //########################################################################################## //############ //############ Array Multiply Methods //############ //########################################################################################## //########################################################################################## template < typename T > void multiply( T* destination, T b, Size number ); template < typename T > void multiply( T* destination, const T* b, Size number ); template < typename T > void multiply( T* destination, const T* a, const T* b, Size number ); template < typename T > void multiply( T* destination, const T* a, T b, Size number ); //########################################################################################## //########################################################################################## //############ //############ Array Multiply-Add Methods //############ //########################################################################################## //########################################################################################## template < typename T > void multiplyAdd( T* destination, T b, Size number ); template < typename T > void multiplyAdd( T* destination, const T* b, Size number ); template < typename T > void multiplyAdd( T* destination, const T* a, const T* b, Size number ); template < typename T > void multiplyAdd( T* destination, const T* a, T b, Size number ); //########################################################################################## //########################################################################################## //############ //############ Array Multiply-Subtract Methods //############ //########################################################################################## //########################################################################################## template < typename T > void multiplySubtract( T* destination, T b, Size number ); template < typename T > void multiplySubtract( T* destination, const T* b, Size number ); template < typename T > void multiplySubtract( T* destination, const T* a, const T* b, Size number ); template < typename T > void multiplySubtract( T* destination, const T* a, T b, Size number ); //########################################################################################## //########################################################################################## //############ //############ Array Divide Methods //############ //########################################################################################## //########################################################################################## template < typename T > void divide( T* destination, T b, Size number ); template < typename T > void divide( T* destination, const T* b, Size number ); template < typename T > void divide( T* destination, const T* a, const T* b, Size number ); template < typename T > void divide( T* destination, const T* a, T b, Size number ); //########################################################################################## //########################################################################################## //############ //############ Array Divide-Add Methods //############ //########################################################################################## //########################################################################################## template < typename T > void divideAdd( T* destination, T b, Size number ); template < typename T > void divideAdd( T* destination, const T* b, Size number ); template < typename T > void divideAdd( T* destination, const T* a, const T* b, Size number ); template < typename T > void divideAdd( T* destination, const T* a, T b, Size number ); //########################################################################################## //########################################################################################## //############ //############ Array Divide-Subtract Methods //############ //########################################################################################## //########################################################################################## template < typename T > void divideSubtract( T* destination, T b, Size number ); template < typename T > void divideSubtract( T* destination, const T* b, Size number ); template < typename T > void divideSubtract( T* destination, const T* a, const T* b, Size number ); template < typename T > void divideSubtract( T* destination, const T* a, T b, Size number ); //########################################################################################## //########################################################################################## //############ //############ Array Function Methods //############ //########################################################################################## //########################################################################################## template < typename T > void abs( T* destination, Size number ); template < typename T > void abs( T* destination, const T* a, Size number ); template < typename T > void sqrt( T* destination, Size number ); template < typename T > void sqrt( T* destination, const T* a, Size number ); template < typename T > void floor( T* destination, Size number ); template < typename T > void floor( T* destination, const T* a, Size number ); template < typename T > void ceiling( T* destination, Size number ); template < typename T > void ceiling( T* destination, const T* a, Size number ); template < typename T > void min( T* destination, const T* a, const T* b, Size number ); template < typename T > void max( T* destination, const T* a, const T* b, Size number ); //########################################################################################## //***************************** End Rim Math Namespace *********************************** RIM_MATH_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_ARRAY_MATH_H <file_sep>/* * rimGraphicsGUIGraphView.h * Rim Graphics GUI * * Created by <NAME> on 7/9/13. * Copyright 2013 __MyCompanyName__. All rights reserved. * */ #ifndef INCLUDE_RIM_GRAPHICS_GUI_GRAPH_VIEW_H #define INCLUDE_RIM_GRAPHICS_GUI_GRAPH_VIEW_H #include "rimGraphicsGUIBase.h" #include "rimGraphicsGUIObject.h" #include "rimGraphicsGUIGraphViewAxis.h" #include "rimGraphicsGUIGraphViewDelegate.h" //########################################################################################## //************************ Start Rim Graphics GUI Namespace ****************************** RIM_GRAPHICS_GUI_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class which contains a 2D graph of rectangular cells that can contain child GUI objects. /** * A graph view is an optionally-bordered rectangular area whose content area (inside * the border) is divided into a 2D graph of cells. Each cell can contain any number of * child GUI objects. */ class GraphView : public GUIObject { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Series Type Enumeration /// An enum representing the different kinds of series that a graph view can have. typedef enum SeriesType { /// A series where data points are drawn as a sequence of disconnected points. POINTS, /// A series where data points are drawn as a sequence of disconnected lines. /** * Every 2 points represents a line that is drawn on the graph. */ LINES, /// A series where data points are drawn as a sequence of connected lines. /** * Each point is connected to the previous and next data points. */ LINE_STRIP, /// An undefined series type. A series with this type is not drawn. UNDEFINED }; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructors /// Create a new graph view with no width or height and no visible graph range. GraphView(); /// Create a new graph view with the given rectangle and visible graph range. GraphView( const Rectangle& newRectangle, const AABB2f& range ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Range Accessor Methods /// Return a 2D range indicating the visible range of values for this graph view's series. RIM_INLINE const AABB2f& getRange() const { return range; } /// Set a 2D range indicating the visible range of values for this graph view's series. /** * Changing the visible range for the graph view causes it to refresh the currently * visible data points in the same way that refresh() does. */ RIM_INLINE void setRange( const AABB2f& newRange ) { range = newRange; this->refresh(); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Horizontal Axis Accessor Methods /// Return an object which describes the appearance of the horizontal graph axis. RIM_INLINE GraphViewAxis& getHorizontalAxis() { return horizontalAxis; } /// Return an object which describes the appearance of the horizontal graph axis. RIM_INLINE const GraphViewAxis& getHorizontalAxis() const { return horizontalAxis; } /// Set an object which describes the appearance of the horizontal graph axis. RIM_INLINE void setHorizontalAxis( const GraphViewAxis& newHorizontalAxis ) { horizontalAxis = newHorizontalAxis; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Vertical Axis Accessor Methods /// Return an object which describes the appearance of the vertical graph axis. RIM_INLINE GraphViewAxis& getVerticalAxis() { return verticalAxis; } /// Return an object which describes the appearance of the vertical graph axis. RIM_INLINE const GraphViewAxis& getVerticalAxis() const { return verticalAxis; } /// Set an object which describes the appearance of the vertical graph axis. RIM_INLINE void setVerticalAxis( const GraphViewAxis& newVerticalAxis ) { verticalAxis = newVerticalAxis; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Series Accessor Methods /// Return the total number of series that are part of this graph view. RIM_INLINE Size getSeriesCount() const { return series.getSize(); } /// Add a new series to this graph view with the specified type and attributes. /** * The method adds a new series to the graph. The data for the series will be * refreshed from the delegate the next time that the graph view is drawn. * * The method returns the index of the new series. */ RIM_INLINE Index addSeries( SeriesType type, const Color4f& color = Color4f::BLACK, Float weight = Float(2) ) { Index index = series.getSize(); series.add( GraphSeries( type, color, weight ) ); return index; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Series Type Accessor Methods /// Return the type of the graph series which has the specified index in this graph view. /** * If the specified series index is invalid, SeriesType::UNDEFINED is returned. */ RIM_INLINE SeriesType getSeriesType( Index seriesIndex ) const { if ( seriesIndex < series.getSize() ) return series[seriesIndex].type; else return UNDEFINED; } /// Set the type of the graph series which has the specified index in this graph view. /** * If the specified series index is invalid, the method has no effect. */ RIM_INLINE void setSeriesType( Index seriesIndex, SeriesType newType ) { if ( seriesIndex < series.getSize() ) series[seriesIndex].type = newType; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Series Color Accessor Methods /// Return the color of the graph series which has the specified index in this graph view. /** * If the specified series index is invalid, Color4f::ZERO is returned. */ RIM_INLINE const Color4f& getSeriesColor( Index seriesIndex ) const { if ( seriesIndex < series.getSize() ) return series[seriesIndex].color; else return Color4f::ZERO; } /// Set the color of the graph series which has the specified index in this graph view. /** * If the specified series index is invalid, the method has no effect. */ RIM_INLINE void setSeriesColor( Index seriesIndex, const Color4f& newColor ) { if ( seriesIndex < series.getSize() ) series[seriesIndex].color = newColor; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Series Size Accessor Methods /// Return the display weight in pixels of the graph series which has the specified index in this graph view. /** * If the specified series index is invalid, 0 is returned. */ RIM_INLINE Float getSeriesWeight( Index seriesIndex ) const { if ( seriesIndex < series.getSize() ) return series[seriesIndex].weight; else return 0; } /// Set the display weight in pixels of the graph series which has the specified index in this graph view. /** * If the specified series index is invalid, the method has no effect. */ RIM_INLINE void setSeriesWeight( Index seriesIndex, Float newWeight ) { if ( seriesIndex < series.getSize() ) series[seriesIndex].weight = math::max( newWeight, Float(0) ); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Series Data Accessor Methods /// Return a reference to the current array of data points for the specified graph series. /** * The returned array represents the current state of the series, though it * may change if the series is updated by the delegate. */ RIM_INLINE const ArrayList<Vector2f>& getSeriesData( Index seriesIndex ) const { return series[seriesIndex].points; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Refresh Methods /// Refresh all of the graph view's data for all of its series. /** * The graph view calls the updateSeries delegate method for each series to update its internal * data structures with the new data. */ void refresh(); /// Refresh the graph series with the specified index in this graph view. /** * The graph view calls the updateSeries delegate method to update its internal * data structures with the new data. */ void refreshSeries( Index seriesIndex ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Border Accessor Methods /// Return a mutable object which describes this graph view's border. RIM_INLINE Border& getBorder() { return border; } /// Return an object which describes this graph view's border. RIM_INLINE const Border& getBorder() const { return border; } /// Set an object which describes this graph view's border. RIM_INLINE void setBorder( const Border& newBorder ) { border = newBorder; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Content Bounding Box Accessor Methods /// Return the 3D bounding box for the graph view's content display area in its local coordinate frame. RIM_INLINE AABB3f getLocalContentBounds() const { return AABB3f( this->getLocalContentBoundsXY(), AABB1f( Float(0), this->getSize().z ) ); } /// Return the 2D bounding box for the graph view's content display area in its local coordinate frame. RIM_INLINE AABB2f getLocalContentBoundsXY() const { return border.getContentBounds( AABB2f( Vector2f(), this->getSizeXY() ) ); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Color Accessor Methods /// Return the background color for this graph view's main area. RIM_INLINE const Color4f& getBackgroundColor() const { return backgroundColor; } /// Set the background color for this graph view's main area. RIM_INLINE void setBackgroundColor( const Color4f& newBackgroundColor ) { backgroundColor = newBackgroundColor; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Border Color Accessor Methods /// Return the border color used when rendering a graph view. RIM_INLINE const Color4f& getBorderColor() const { return borderColor; } /// Set the border color used when rendering a graph view. RIM_INLINE void setBorderColor( const Color4f& newBorderColor ) { borderColor = newBorderColor; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Drawing Method /// Draw this graph view using the specified GUI renderer to the given parent coordinate system bounds. /** * The method returns whether or not the graph view was successfully drawn. */ virtual Bool drawSelf( GUIRenderer& renderer, const AABB3f& parentBounds ) const; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Input Handling Methods /// Handle the specified keyboard event for the entire graph view. virtual void keyEvent( const KeyboardEvent& event ); /// Handle the specified mouse motion event for the entire graph view. virtual void mouseMotionEvent( const MouseMotionEvent& event ); /// Handle the specified mouse button event for the entire graph view. virtual void mouseButtonEvent( const MouseButtonEvent& event ); /// Handle the specified mouse wheel event for the entire graph view. virtual void mouseWheelEvent( const MouseWheelEvent& event ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Delegate Accessor Methods /// Return a reference to the delegate which responds to events for this graph view. RIM_INLINE GraphViewDelegate& getDelegate() { return delegate; } /// Return a reference to the delegate which responds to events for this graph view. RIM_INLINE const GraphViewDelegate& getDelegate() const { return delegate; } /// Return a reference to the delegate which responds to events for this graph view. RIM_INLINE void setDelegate( const GraphViewDelegate& newDelegate ) { delegate = newDelegate; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Static Construction Methods /// Construct a smart-pointer-wrapped instance of this class using the constructor with the given arguments. RIM_INLINE static Pointer<GraphView> construct() { return Pointer<GraphView>::construct(); } /// Construct a smart-pointer-wrapped instance of this class using the constructor with the given arguments. RIM_INLINE static Pointer<GraphView> construct( const Rectangle& newRectangle, const AABB2f& newRange ) { return Pointer<GraphView>::construct( newRectangle, newRange ); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Public Static Data Members /// The default border that is used for a graph view. static const Border DEFAULT_BORDER; /// The default background color that is used for a graph view's area. static const Color4f DEFAULT_BACKGROUND_COLOR; /// The default border color that is used for a graph view. static const Color4f DEFAULT_BORDER_COLOR; private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Class Declaration /// A class which stores information about a single series of data points on the graph. class GraphSeries { public: /// Create a new graph series with the specified series type and color. RIM_INLINE GraphSeries( SeriesType newType, const Color4f& newColor, Float newWeight ) : color( newColor ), type( newType ), weight( math::max( newWeight, Float(0) ) ), pointImage(), points(), needsRefresh( true ) { } /// The color which should be used to draw this series. Color4f color; /// An enum value which indicates how the series should be interpreted. SeriesType type; /// The line width or point size to use when rendering this series. Float weight; /// An image which is drawn for every data point in the series. /** * If the image pointer is NULL, a default point image is used when * rendering the series. */ Pointer<GUIImage> pointImage; /// An array of the 2D data points for this graph view series. ArrayList<Vector2f> points; /// A boolean value which indicates whether or not this series should be refreshed. Bool needsRefresh; }; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Members /// A 2D range of values indicating the visible coordinates for the graph. AABB2f range; /// An object which stores information for the graph's horizontal axis. GraphViewAxis horizontalAxis; /// An object which stores information for the graph's vertical axis. GraphViewAxis verticalAxis; /// A list of the series that are part of this graph view. ArrayList<GraphSeries> series; /// An object which describes the border for this graph view. Border border; /// An object which responds to events for this graph view. GraphViewDelegate delegate; /// The background color for the graph view's area. Color4f backgroundColor; /// The border color for the graph view's background area. Color4f borderColor; /// The minimum range vector for the graph before it was grabbed by the mouse. Vector2f previousRangeMin; /// A vector indicating the position in the graph where the mouse was clicked. Vector2f grabOffset; /// A boolean value indicating whether or not the graph is currently grabbed by the mouse. Bool grabbed; /// A boolean value indicating whether or not the graph view allows automatic scrolling. Bool scrollingEnabled; }; //########################################################################################## //************************ End Rim Graphics GUI Namespace ******************************** RIM_GRAPHICS_GUI_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_GRAPHICS_GUI_GRAPH_VIEW_H <file_sep>/* * main.cpp * HW 1 * * Created by <NAME> on 9/9/14. * Copyright 2014 __MyCompanyName__. All rights reserved. * */ #include "QuadcopterDemo.h" using namespace rim::gui; void mainThread( Application& application ) { QuadcopterDemo demo; demo.run(); } int main (int argc, char * const argv[]) { Application::start( mainThread ); return 0; } <file_sep>/* * rimPhysicsCollisionAlgorithmsGJK.h * Rim Physics * * Created by <NAME> on 7/1/12. * Copyright 2012 __MyCompanyName__. All rights reserved. * */ #ifndef INCLUDE_RIM_PHYSICS_COLLISION_ALGORITHMS_GJK_H #define INCLUDE_RIM_PHYSICS_COLLISION_ALGORITHMS_GJK_H #include "rimPhysicsCollisionConfig.h" #include "rimPhysicsCollisionAlgorithmGJK.h" //########################################################################################## //********************** Start Rim Physics Collision Namespace *************************** RIM_PHYSICS_COLLISION_NAMESPACE_START //****************************************************************************************** //########################################################################################## /// Return the point on the specified sphere that is farthest in the given normalized direction. RIM_INLINE Vector3 getSphereSupportPoint( const Vector3& direction, const CollisionShapeSphere::Instance* sphere ) { return sphere->getPosition() + direction*sphere->getRadius(); } /// Return the point on the specified cylinder that is farthest in the given normalized direction. RIM_INLINE Vector3 getCylinderSupportPoint( const Vector3& direction, const CollisionShapeCylinder::Instance* cylinder ) { // Assume the direction is normalized. const Vector3& axis = cylinder->getAxis(); Real aDotS = math::dot( axis, direction ); // Make sure that the support direction isn't parallel to the axis. if ( Real(1.0) - math::abs(aDotS) < math::epsilon<Real>() ) { // If so, return one of the endpoints. if ( aDotS > Real(0) ) return cylinder->getEndpoint2(); else return cylinder->getEndpoint1(); } Vector3 point1 = cylinder->getEndpoint1() + cylinder->getRadius1()*(direction - axis*aDotS).normalize(); Vector3 point2 = cylinder->getEndpoint2() + cylinder->getRadius2()*(direction - axis*aDotS).normalize(); Vector3 edge = point2 - point1; Real edgeDotS = math::dot( edge, direction ); if ( edgeDotS > Real(0) ) return point2; else return point1; } /// Return the point on the specified capsule that is farthest in the given normalized direction. RIM_INLINE Vector3 getCapsuleSupportPoint( const Vector3& direction, const CollisionShapeCapsule::Instance* capsule ) { // Assume the direction is normalized. const Vector3& axis = capsule->getAxis(); Real height = capsule->getHeight(); Real radius1 = capsule->getRadius1(); Real radius2 = capsule->getRadius2(); Real aDotS = math::dot( axis, direction ); Real threshold = radius1 != radius2 ? (radius1 / (height + radius2*height/(radius1 - radius2))) : Real(0); if ( aDotS > threshold ) return capsule->getEndpoint2() + direction*radius2; else return capsule->getEndpoint1() + direction*radius1; } /// Return the point on the box that is farthest in the given normalized direction. RIM_INLINE Vector3 getBoxSupportPoint( const Vector3& direction, const CollisionShapeBox::Instance* box ) { const Matrix3& o = box->getOrientation(); const Vector3 halfSize = box->getSize()*Real(0.5); Vector3 supportPoint = box->getPosition(); if ( math::dot( o.x, direction ) >= Real(0) ) supportPoint += o.x*halfSize.x; else supportPoint -= o.x*halfSize.x; if ( math::dot( o.y, direction ) >= Real(0) ) supportPoint += o.y*halfSize.y; else supportPoint -= o.y*halfSize.y; if ( math::dot( o.z, direction ) >= Real(0) ) supportPoint += o.z*halfSize.z; else supportPoint -= o.z*halfSize.z; return supportPoint; } /// Return the point on the convex shape that is farthest in the given normalized direction. RIM_INLINE Vector3 getConvexSupportPoint( const Vector3& direction, const CollisionShapeConvex::Instance* convex ) { return convex->getSupportVertex( direction ); } //########################################################################################## //########################################################################################## //############ //############ Sphere Vs. Shape Algorithm Declarations //############ //########################################################################################## //########################################################################################## /// A class which detects collisions between two Rigid Objects with sphere and capsule shapes. typedef CollisionAlgorithmGJK<CollisionShapeSphere,CollisionShapeCapsule, CollisionShapeSphere::Instance,CollisionShapeCapsule::Instance, getSphereSupportPoint,getCapsuleSupportPoint> CollisionAlgorithmSphereVsCapsule; /// A class which detects collisions between two Rigid Objects with sphere and convex shapes. typedef CollisionAlgorithmGJK<CollisionShapeSphere,CollisionShapeConvex, CollisionShapeSphere::Instance,CollisionShapeConvex::Instance, getSphereSupportPoint,getConvexSupportPoint> CollisionAlgorithmSphereVsConvex; //########################################################################################## //########################################################################################## //############ //############ Capsule Vs. Shape Algorithm Declarations //############ //########################################################################################## //########################################################################################## /// A class which detects collisions between two Rigid Objects with capsule and sphere shapes. typedef CollisionAlgorithmGJK<CollisionShapeCapsule,CollisionShapeSphere, CollisionShapeCapsule::Instance,CollisionShapeSphere::Instance, getCapsuleSupportPoint,getSphereSupportPoint> CollisionAlgorithmCapsuleVsSphere; /// A class which detects collisions between two Rigid Objects with capsule shapes. typedef CollisionAlgorithmGJK<CollisionShapeCapsule,CollisionShapeCapsule, CollisionShapeCapsule::Instance,CollisionShapeCapsule::Instance, getCapsuleSupportPoint,getCapsuleSupportPoint> CollisionAlgorithmCapsuleVsCapsule; /// A class which detects collisions between two Rigid Objects with capsule and cylinder shapes. typedef CollisionAlgorithmGJK<CollisionShapeCapsule,CollisionShapeCylinder, CollisionShapeCapsule::Instance,CollisionShapeCylinder::Instance, getCapsuleSupportPoint,getCylinderSupportPoint> CollisionAlgorithmCapsuleVsCylinder; /// A class which detects collisions between two Rigid Objects with capsule and box shapes. typedef CollisionAlgorithmGJK<CollisionShapeCapsule,CollisionShapeBox, CollisionShapeCapsule::Instance,CollisionShapeBox::Instance, getCapsuleSupportPoint,getBoxSupportPoint> CollisionAlgorithmCapsuleVsBox; /// A class which detects collisions between two Rigid Objects with capsule and convex shapes. typedef CollisionAlgorithmGJK<CollisionShapeCapsule,CollisionShapeConvex, CollisionShapeCapsule::Instance,CollisionShapeConvex::Instance, getCapsuleSupportPoint,getConvexSupportPoint> CollisionAlgorithmCapsuleVsConvex; //########################################################################################## //########################################################################################## //############ //############ Cylinder Vs. Shape Algorithm Declarations //############ //########################################################################################## //########################################################################################## /// A class which detects collisions between two Rigid Objects with cylinder and capsule shapes. typedef CollisionAlgorithmGJK<CollisionShapeCylinder,CollisionShapeCapsule, CollisionShapeCylinder::Instance,CollisionShapeCapsule::Instance, getCylinderSupportPoint,getCapsuleSupportPoint> CollisionAlgorithmCylinderVsCapsule; /// A class which detects collisions between two Rigid Objects with cylinder shapes. typedef CollisionAlgorithmGJK<CollisionShapeCylinder,CollisionShapeCylinder, CollisionShapeCylinder::Instance,CollisionShapeCylinder::Instance, getCylinderSupportPoint,getCylinderSupportPoint> CollisionAlgorithmCylinderVsCylinder; /// A class which detects collisions between two Rigid Objects with cylinder and box shapes. typedef CollisionAlgorithmGJK<CollisionShapeCylinder,CollisionShapeBox, CollisionShapeCylinder::Instance,CollisionShapeBox::Instance, getCylinderSupportPoint,getBoxSupportPoint> CollisionAlgorithmCylinderVsBox; /// A class which detects collisions between two Rigid Objects with cylinder and convex shapes. typedef CollisionAlgorithmGJK<CollisionShapeCylinder,CollisionShapeConvex, CollisionShapeCylinder::Instance,CollisionShapeConvex::Instance, getCylinderSupportPoint,getConvexSupportPoint> CollisionAlgorithmCylinderVsConvex; //########################################################################################## //########################################################################################## //############ //############ Box Vs. Shape Algorithm Declarations //############ //########################################################################################## //########################################################################################## /// A class which detects collisions between two Rigid Objects with box and capsule shapes. typedef CollisionAlgorithmGJK<CollisionShapeBox,CollisionShapeCapsule, CollisionShapeBox::Instance,CollisionShapeCapsule::Instance, getBoxSupportPoint,getCapsuleSupportPoint> CollisionAlgorithmBoxVsCapsule; /// A class which detects collisions between two Rigid Objects with box and cylinder shapes. typedef CollisionAlgorithmGJK<CollisionShapeBox,CollisionShapeCylinder, CollisionShapeBox::Instance,CollisionShapeCylinder::Instance, getBoxSupportPoint,getCylinderSupportPoint> CollisionAlgorithmBoxVsCylinder; /// A class which detects collisions between two Rigid Objects with box shapes. typedef CollisionAlgorithmGJK<CollisionShapeBox,CollisionShapeBox, CollisionShapeBox::Instance,CollisionShapeBox::Instance, getBoxSupportPoint,getBoxSupportPoint> CollisionAlgorithmBoxVsBox; /// A class which detects collisions between two Rigid Objects with box and convex shapes. typedef CollisionAlgorithmGJK<CollisionShapeBox,CollisionShapeConvex, CollisionShapeBox::Instance,CollisionShapeConvex::Instance, getBoxSupportPoint,getConvexSupportPoint> CollisionAlgorithmBoxVsConvex; /// A class which detects collisions between two Rigid Objects with convex and sphere shapes. typedef CollisionAlgorithmGJK<CollisionShapeConvex,CollisionShapeSphere, CollisionShapeConvex::Instance,CollisionShapeSphere::Instance, getConvexSupportPoint,getSphereSupportPoint> CollisionAlgorithmConvexVsSphere; /// A class which detects collisions between two Rigid Objects with convex and capsule shapes. typedef CollisionAlgorithmGJK<CollisionShapeConvex,CollisionShapeCapsule, CollisionShapeConvex::Instance,CollisionShapeCapsule::Instance, getConvexSupportPoint,getCapsuleSupportPoint> CollisionAlgorithmConvexVsCapsule; /// A class which detects collisions between two Rigid Objects with convex and cylinder shapes. typedef CollisionAlgorithmGJK<CollisionShapeConvex,CollisionShapeCylinder, CollisionShapeConvex::Instance,CollisionShapeCylinder::Instance, getConvexSupportPoint,getCylinderSupportPoint> CollisionAlgorithmConvexVsCylinder; /// A class which detects collisions between two Rigid Objects with convex and box shapes. typedef CollisionAlgorithmGJK<CollisionShapeConvex,CollisionShapeBox, CollisionShapeConvex::Instance,CollisionShapeBox::Instance, getConvexSupportPoint,getBoxSupportPoint> CollisionAlgorithmConvexVsBox; /// A class which detects collisions between two Rigid Objects with convex shapes. typedef CollisionAlgorithmGJK<CollisionShapeConvex,CollisionShapeConvex, CollisionShapeConvex::Instance,CollisionShapeConvex::Instance, getConvexSupportPoint,getConvexSupportPoint> CollisionAlgorithmConvexVsConvex; //########################################################################################## //********************** End Rim Physics Collision Namespace ***************************** RIM_PHYSICS_COLLISION_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_PHYSICS_COLLISION_ALGORITHMS_GJK_H <file_sep>/* * rimGraphicsGraphics.h * Rim Graphics * * Created by <NAME> on 11/28/11. * Copyright 2011 __MyCompanyName__. All rights reserved. * */ #ifndef INCLUDE_RIM_GRAPHICS_CAMERAS_H #define INCLUDE_RIM_GRAPHICS_CAMERAS_H #include "cameras/rimGraphicsCamerasConfig.h" #include "cameras/rimGraphicsProjectionType.h" #include "cameras/rimGraphicsCamera.h" #include "cameras/rimGraphicsOrthographicCamera.h" #include "cameras/rimGraphicsPerspectiveCamera.h" #endif // INCLUDE_RIM_GRAPHICS_CAMERAS_H <file_sep>/* * rimPhysicsConstraints.h * Rim Physics * * Created by <NAME> on 6/1/12. * Copyright 2012 __MyCompanyName__. All rights reserved. * */ #ifndef INCLUDE_RIM_PHYSICS_CONSTRAINTS_H #define INCLUDE_RIM_PHYSICS_CONSTRAINTS_H #include "rimPhysicsConfig.h" #include "constraints/rimPhysicsConstraintsConfig.h" #include "constraints/rimPhysicsConstraint.h" #include "constraints/rimPhysicsCollisionConstraint.h" #include "constraints/rimPhysicsCollisionConstraintRigidVsRigid.h" #endif // INCLUDE_RIM_PHYSICS_CONSTRAINTS_H <file_sep>/* * rimPhysicsMinkowskiVertex.h * Rim Physics * * Created by <NAME> on 6/7/12. * Copyright 2012 __MyCompanyName__. All rights reserved. * */ #ifndef INCLUDE_RIM_PHYSICS_MINKOWSKI_VERTEX_H #define INCLUDE_RIM_PHYSICS_MINKOWSKI_VERTEX_H #include "rimPhysicsUtilitiesConfig.h" //########################################################################################## //********************** Start Rim Physics Utilities Namespace *************************** RIM_PHYSICS_UTILITIES_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class which represents a point on the minkowski difference between two collision shapes. template < typename T > class MinkowskiVertex3D { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructor /// Create a vertex in minkowski space representing the origin. RIM_INLINE MinkowskiVertex3D() { } /// Create a vertex in minkowski space from the two cartesian vertices. RIM_INLINE MinkowskiVertex3D( const Vector3D<T>& newPoint1, const Vector3D<T>& newPoint2 ) : point( newPoint1 - newPoint2 ), pointOnShape2( newPoint2 ) { } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Point Accessor Methods /// Return the position of this minkowski vertex in minkowski difference space. RIM_FORCE_INLINE const Vector3D<T>& getPosition() const { return point; } /// Return the position of this minkowski vertex on the first shape in world space. RIM_FORCE_INLINE Vector3D<T> getPositionOnShape1() const { return point + pointOnShape2; } /// Return the position of this minkowski vertex on the second shape in world space. RIM_FORCE_INLINE const Vector3D<T>& getPositionOnShape2() const { return pointOnShape2; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Public Cast Operators /// Cast this minkowski vertex to a 3D vector representing the position of the vertex in minkowski space. RIM_FORCE_INLINE operator const Vector3D<T>& () const { return point; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Public Negation Operator /// Return the negation of this minkowski vertex's position in minkowski space. RIM_FORCE_INLINE Vector3D<T> operator - () const { return -point; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Public Arithmetic Operators /// Add the minkowski space vertex position of this vertex and another and return the result. RIM_FORCE_INLINE Vector3D<T> operator + ( const MinkowskiVertex3D<T>& other ) const { return point + other.point; } /// Subtract the minkowski space vertex position of this vertex and another and return the result. RIM_FORCE_INLINE Vector3D<T> operator - ( const MinkowskiVertex3D<T>& other ) const { return point - other.point; } private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Members /// The vertex's position in minkowski space. /** * This is equal to the point on shape 1 minus the point on * shape 2. */ Vector3D<T> point; /// The world-space position of this minkowski vertex on the second collision shape. Vector3D<T> pointOnShape2; }; typedef MinkowskiVertex3D<rim::physics::Real> MinkowskiVertex3; typedef MinkowskiVertex3D<Float> MinkowskiVertex3f; typedef MinkowskiVertex3D<Double> MinkowskiVertex3d; //########################################################################################## //********************** End Rim Physics Utilities Namespace ***************************** RIM_PHYSICS_UTILITES_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_PHYSICS_MINKOWSKI_VERTEX_H <file_sep>/* * rimAny.h * Rim Software * * Created by <NAME> on 1/22/14. * Copyright 2014 __MyCompanyName__. All rights reserved. * */ #ifndef INCLUDE_RIM_ANY_H #define INCLUDE_RIM_ANY_H #include "rimLanguageConfig.h" //########################################################################################## //*************************** Start Rim Language Namespace ******************************* RIM_LANGUAGE_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class which is able to store and retrieve a value of any arbitrary type in an opaque manner. class Any { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructor /// Create an Any object which has a NULL value. RIM_INLINE Any() : value( NULL ) { } /// Create an Any object which stores a copy of the specified templated type. template < typename T > RIM_INLINE Any( const T& value ) : value( util::construct<Storage<T> >( value ) ) { } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Copy Constructors /// Make a deep copy of the specified Any object, copying its internal value. RIM_INLINE Any( const Any& other ) : value( other.value ? other.value->copy() : NULL ) { } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Assignment Operators /// Copy the value from another Any object into this Any, replacing the current value. RIM_INLINE Any& operator = ( const Any& other ) { if ( this != &other ) { if ( value != NULL ) util::destruct( value ); other.value ? other.value->copy() : NULL; } return *this; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Destructor /// Destroy an Any object and deallocate its internal storage. RIM_INLINE ~Any() { if ( value ) util::destruct( value ); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Value Accessor Methods /// Access this Any's value and place it in the output parameter. /** * If the Any object has a NULL value, or if the value's type does not * match that of the output parameter, FALSE is returned and no value is * retrieved. Otherwise, the method succeeds and TRUE is returned. */ template < typename T > RIM_INLINE Bool getValue( T& output ) const { const T* pointer; if ( !value || !(pointer = value->getValue<T>()) ) return false; output = *pointer; return true; } /// Set this Any object to have a new value. template < typename T > RIM_INLINE void setValue( const T& newValue ) { if ( value ) util::destruct( value ); value = util::construct< Storage<T> >( newValue ); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Value Pointer Accessor Methods /// Return a pointer to the value stored by this Any object. /** * If the specified template type is not the same as the stored value, * NULL is returned. */ template < typename T > RIM_INLINE T* getPointer() { return value ? value->getValue<T>() : NULL; } /// Return a const pointer to the value stored by this Any object. /** * If the specified template type is not the same as the stored value, * NULL is returned. */ template < typename T > RIM_INLINE const T* getPointer() const { return value ? value->getValue<T>() : NULL; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Equality Operators /// Compare this array to another array for equality. /** * If this array has the same size as the other array and * has the same elements, the arrays are equal and TRUE is * returned. Otherwise, the arrays are not equal and FALSE is returned. */ RIM_INLINE Bool operator == ( const Any& other ) const { // Catch NULL values or copies that shouldn't happen. if ( value == other.value ) return true; return value->equals( *other.value ); } /// Compare this array to another array for inequality. /** * If this array has a different size than the other array or * has different elements, the arrays are not equal and TRUE is * returned. Otherwise, the arrays are equal and FALSE is returned. */ RIM_INLINE Bool operator != ( const Any& other ) const { return !(*this == other); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Any Status Accessor Methods /// Return whether or not this Any object's internal array is NULL. RIM_INLINE Bool isNull() const { return value == NULL; } /// Get whether or not this Any object's internal array is not NULL. RIM_INLINE Bool isSet() const { return value != NULL; } private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Class Declaration /// The base class for classes that store objects of an arbitrary type. class StorageBase { public: virtual ~StorageBase() { } /// Construct and return a copy of this storage object, creating a new value. virtual StorageBase* copy() const = 0; /// Return whether or not this object's value is equal to another. virtual Bool equals( const StorageBase& other ) const = 0; template < typename T > RIM_INLINE T* getValue(); template < typename T > RIM_INLINE const T* getValue() const; }; /// A class which is used to store arbitrarily-typed values in an opaque manner. template < typename T > class Storage : public StorageBase { public: /// Create a new storage object which copies the specified value. RIM_FORCE_INLINE Storage( const T& newValue ) : value( newValue ) { } /// Destroy this storage object. RIM_INLINE ~Storage() { } /// Construct and return a copy of this storage object, creating a new value. virtual StorageBase* copy() const { return util::construct< Storage<T> >( value ); } /// Return whether or not this object's value is equal to another. virtual Bool equals( const StorageBase& other ) const { const Storage<T>* concreteObject = dynamic_cast<const Storage<T>*>( &other ); if ( concreteObject ) return value == concreteObject->value; else return false; } /// The actual object which is stored by an Any object. T value; }; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Members /// A pointer to the object which stores this Any's value. StorageBase* value; }; //########################################################################################## //########################################################################################## //############ //############ Storage Value Accessor Methods //############ //########################################################################################## //########################################################################################## template < typename T > T* Any::StorageBase:: getValue() { Storage<T>* derived = dynamic_cast<Storage<T>*>( this ); if ( derived ) return &derived->value; else return NULL; } template < typename T > const T* Any::StorageBase:: getValue() const { const Storage<T>* derived = dynamic_cast<const Storage<T>*>( this ); if ( derived ) return &derived->value; else return NULL; } //########################################################################################## //*************************** End Rim Language Namespace ********************************* RIM_LANGUAGE_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_ANY_H <file_sep>/* * rimFile.h * Rim IO * * Created by <NAME> on 5/22/08. * Copyright 2008 __MyCompanyName__. All rights reserved. * */ #ifndef INCLUDE_RIM_FILE_H #define INCLUDE_RIM_FILE_H #include "rimFileSystemConfig.h" #include "rimFileSystemNode.h" //########################################################################################## //************************* Start Rim File System Namespace ****************************** RIM_FILE_SYSTEM_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class which represents a file in the global file system. /** * A File object can represent a local file, network file, or any other type * of file resource. This class also allows the user to create and delete files * with the given file path and determine other basic information about the file. */ class File : public FileSystemNode { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructors /// Create a file object which corresponds to the specified path string. File( const UTF8String& newPathString ); /// Create a file object which corresponds to the specified path. File( const Path& newPath ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** File Attribute Accessor Methods /// Return whether or not the file system node is a file. RIM_INLINE virtual Bool isAFile() const { return true; } /// Return whether or not the file system node is a directory. RIM_INLINE virtual Bool isADirectory() const { return false; } /// Return whether or not this file system node exists. virtual Bool exists() const; /// Return the total size of the file system node. /** * For files, this is the total size of the file. For directories, * this is the total size of all child file system nodes. If the file * does not exist, the size 0 is returned. */ virtual LargeSize getSize() const; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** File Modification Methods /// Set the name of the file, the last component of its path. virtual Bool setName( const UTF8String& newName ); /// Create this file if it doesn't exist. /** * If the file system node already exists, no operation is performed * and FALSE is returned. If the creation operation was not successful, * FALSE is returned. Otherwise, TRUE is returned and the node is created. */ virtual Bool create(); /// Delete this file system node and all children (if it is a directory). virtual Bool remove(); /// Erase this file or create it if it doesn't exist. /** * If there was an error during creation, FALSE is returned. * Otherwise, TRUE is returned and the file is erased. */ Bool erase(); }; //########################################################################################## //************************* End Rim File System Namespace ******************************** RIM_FILE_SYSTEM_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_FILE_H <file_sep>/* * rimExceptions.h * Rim Framework * * Created by <NAME> on 12/28/08. * Copyright 2008 Rim Software. All rights reserved. * */ #ifndef INCLUDE_RIM_EXCEPTIONS_H #define INCLUDE_RIM_EXCEPTIONS_H #include "exceptions/rimExceptionsConfig.h" #include "exceptions/rimException.h" #include "exceptions/rimIOException.h" /* #ifdef RIM_EXCEPTIONS_NAMESPACE_START #undef RIM_EXCEPTIONS_NAMESPACE_START #endif #ifdef RIM_EXCEPTIONS_NAMESPACE_END #undef RIM_EXCEPTIONS_NAMESPACE_END #endif */ #endif // INCLUDE_RIM_EXCEPTIONS_H <file_sep>/* * rimPhysicsRigidObject.h * Rim Physics * * Created by <NAME> on 11/28/09. * Copyright 2009 Rim Software. All rights reserved. * */ #ifndef INCLUDE_RIM_PHYSICS_COLLISION_SHAPE_H #define INCLUDE_RIM_PHYSICS_COLLISION_SHAPE_H #include "rimPhysicsShapesConfig.h" #include "rimPhysicsCollisionShapeType.h" #include "rimPhysicsCollisionShapeMaterial.h" //########################################################################################## //************************ Start Rim Physics Shapes Namespace **************************** RIM_PHYSICS_SHAPES_NAMESPACE_START //****************************************************************************************** //########################################################################################## class CollisionShapeInstance; //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class which represents an abstract shape in 3D space with various physical attributes. class CollisionShape { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Destructor /// Destroy this collision shape and all resources it has. virtual ~CollisionShape() { } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Material Accessor Methods /// Return a const reference to the material of this collision shape. RIM_FORCE_INLINE const CollisionShapeMaterial& getMaterial() const { return material; } /// Return a reference to the material of this collision shape. RIM_FORCE_INLINE CollisionShapeMaterial& getMaterial() { return material; } /// Set the material of this collision shape to be the specified material. RIM_INLINE void setMaterial( const CollisionShapeMaterial& newMaterial ) { material = newMaterial; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Mass and Volume Accessor Methods /// Return the mass in mass units (kg) of this CollisionShape as determined by its volume and density. RIM_FORCE_INLINE Real getMass() const { return this->getVolume()*material.getDensity(); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Mass Distribution Accessor Methods /// Return a 3x3 matrix for the inertia tensor of this shape relative to its center of mass. virtual Matrix3 getInertiaTensor() const = 0; /// Return a 3D vector representing the center-of-mass of this shape in its coordinate frame. virtual Vector3 getCenterOfMass() const = 0; /// Return the volume of this shape in length units cubed (m^3) in its coordinate frame. virtual Real getVolume() const = 0; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Bounding Sphere Accessor Methods /// Return a const reference to the bounding sphere of this collision shape in its coordinate frame. RIM_FORCE_INLINE const BoundingSphere& getBoundingSphere() const { return boundingSphere; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Shape Type Accessor Methods /// Return an integer identifying the sub type of this collision shape. /** * This ID is a 32-bit integer that is generated by hashing the string * generated for the SubType template parameter. While the posibility of * ID collisions is very low, duplicates are nonetheless a possibility. */ RIM_FORCE_INLINE CollisionShapeTypeID getTypeID() const { return type->getID(); } /// Return an object representing the type of this CollisionShape. RIM_FORCE_INLINE const CollisionShapeType& getType() const { return *type; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Instance Creation Methods /// Create and return an instance of this shape. virtual Pointer<CollisionShapeInstance> getInstance() const = 0; protected: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Protected Constructor /// Create a CollisionShape object which has the specified subtype. RIM_FORCE_INLINE CollisionShape( const CollisionShapeType* newType ) : type( newType ) { RIM_DEBUG_ASSERT_MESSAGE( type != NULL, "Cannot have NULL type for collision shape." ); } /// Create a CollisionShape object which has the specified subtype and material. RIM_FORCE_INLINE CollisionShape( const CollisionShapeType* newType, const CollisionShapeMaterial& newMaterial ) : type( newType ), material( newMaterial ) { RIM_DEBUG_ASSERT_MESSAGE( type != NULL, "Cannot have NULL type for collision shape." ); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Protected Accessor Methods /// Set the bounding sphere to use for this CollisionShape. /** * This method should be called by a subclass of the CollisionShape * class in order to assure that the shape has the proper bounding sphere. * If this attribute is not properly set, collision detection will fail. * * The radius of the sphere is clamped to the range of [0,+infinity] for safety. */ RIM_INLINE void setBoundingSphere( const BoundingSphere& newBoundingSphere ) { boundingSphere.position = newBoundingSphere.position; boundingSphere.radius = math::max( newBoundingSphere.radius, Real(0) ); } private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Members /// A 3D bounding sphere for this shape in its coordinate frame. BoundingSphere boundingSphere; /// An object representing the material that this CollisionShape has. CollisionShapeMaterial material; /// A CollisionShapeType object representing the subtype of this collision shape. const CollisionShapeType* type; }; //########################################################################################## //************************ End Rim Physics Shapes Namespace ****************************** RIM_PHYSICS_SHAPES_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_PHYSICS_COLLISION_SHAPE_H <file_sep>/* * rimSoundMonoSplitter.h * Rim Sound * * Created by <NAME> on 12/11/12. * Copyright 2012 __MyCompanyName__. All rights reserved. * */ #ifndef INCLUDE_RIM_SOUND_MONO_SPLITTER_H #define INCLUDE_RIM_SOUND_MONO_SPLITTER_H #include "rimSoundFiltersConfig.h" #include "rimSoundFilter.h" //########################################################################################## //************************ Start Rim Sound Filters Namespace ***************************** RIM_SOUND_FILTERS_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class that copies a single input channel into multiple output channels. /** * This class takes the first channel of its input buffer and copies to a * user-defined number of channels in the output buffer. */ class MonoSplitter : public SoundFilter { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructors /// Create a new mono splitter with the default number of output channels, 1. RIM_INLINE MonoSplitter() : SoundFilter( 1, 1 ), numOutputChannels( 1 ) { } /// Create a new mono splitter which has the specified number of output channels. RIM_INLINE MonoSplitter( Size newNumOutputChannels ) : SoundFilter( 1, 1 ), numOutputChannels( math::max( newNumOutputChannels, Size(1) ) ) { } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Output Channel Count Accessor Methods /// Return the total number of output channels that this mono splitter has. /** * This is the number of channels that the first input channel is split into. */ RIM_INLINE Size getChannelCount() const { return numOutputChannels; } /// Set the total number of output channels that this mono splitter has. /** * This is the number of channels that the first input channel is split into. * * The specified number of channels is clamped to be in the range [1,infinity]. */ RIM_INLINE void setChannelCount( Size newNumOutputChannels ) { numOutputChannels = math::max( newNumOutputChannels, Size(1) ); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Filter Attribute Accessor Methods /// Return a human-readable name for this mono splitter. /** * The method returns the string "Mono Splitter". */ virtual UTF8String getName() const; /// Return the manufacturer name of this mono splitter. /** * The method returns the string "Headspace Sound". */ virtual UTF8String getManufacturer() const; /// Return an object representing the version of this mono splitter. virtual SoundFilterVersion getVersion() const; /// Return an object which describes the category of effect that this filter implements. /** * This method returns the value SoundFilterCategory::IMAGING. */ virtual SoundFilterCategory getCategory() const; /// Return whether or not this splitter can process audio data in-place. /** * This method always returns TRUE, splitters can process audio data in-place. */ virtual Bool allowsInPlaceProcessing() const; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Filter Parameter Accessor Methods /// Return the total number of generic accessible parameters this filter has. virtual Size getParameterCount() const; /// Get information about the parameter at the specified index. virtual Bool getParameterInfo( Index parameterIndex, FilterParameterInfo& info ) const; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Public Static Property Objects /// A string indicating the human-readable name of this mono splitter. static const UTF8String NAME; /// A string indicating the manufacturer name of this mono splitter. static const UTF8String MANUFACTURER; /// An object indicating the version of this mono splitter. static const SoundFilterVersion VERSION; private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Filter Parameter Value Accessor Methods /// Place the value of the parameter at the specified index in the output parameter. virtual Bool getParameterValue( Index parameterIndex, FilterParameter& value ) const; /// Attempt to set the parameter value at the specified index. virtual Bool setParameterValue( Index parameterIndex, const FilterParameter& value ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Filter Processing Method /// Split the sound in the first input buffer channel to as many output channels as necessary. virtual SoundFilterResult processFrame( const SoundFilterFrame& inputFrame, SoundFilterFrame& outputFrame, Size numSamples ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Members /// The number of channels into which the first input buffer channel is being split. Size numOutputChannels; }; //########################################################################################## //************************ End Rim Sound Filters Namespace ******************************* RIM_SOUND_FILTERS_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_SOUND_MONO_SPLITTER_H <file_sep>/* * rimGraphicsGUIGlyphMetrics.h * Rim Graphics GUI * * Created by <NAME> on 1/16/13. * Copyright 2013 Headspace Systems. All rights reserved. * */ #ifndef INCLUDE_RIM_GRAPHICS_GUI_GLYPH_METRICS_H #define INCLUDE_RIM_GRAPHICS_GUI_GLYPH_METRICS_H #include "rimGraphicsGUIFontsConfig.h" //########################################################################################## //********************* Start Rim Graphics GUI Fonts Namespace *************************** RIM_GRAPHICS_GUI_FONTS_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class which describes sizing information about a particular font glyph. class GlyphMetrics { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructor /// Create a default glyph metrics object. RIM_INLINE GlyphMetrics() : size( 0 ), height( 0 ) { } /// Create a glyph metrics object with the specified attributes. RIM_INLINE GlyphMetrics( Float newSize, Float newHeight, const AABB2f& newBounds, const Vector2f& newAdvance ) : size( newSize ), height( newHeight ), bounds( newBounds ), advance( newAdvance ) { } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Font Size Accessor Methods /// Return the nominal size of the glyph's font in pixels. RIM_INLINE Float getSize() const { return size; } /// Set the nominal size of the glyph's font in pixels. RIM_INLINE void setSize( Float newSize ) { size = newSize; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Font Height Accessor Methods /// Return the distance in pixels between consecutive horizontal lines of text of the glyph's font. RIM_INLINE Float getHeight() const { return height; } /// Set the distance in pixels between consecutive horizontal lines of text of the glyph's font. RIM_INLINE void setHeight( Float newHeight ) { height = newHeight; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Bounding Box Accessor Methods /// Return a 2D bounding box which completely encloses the glyphs. /** * This bounding box is specified where (0,0) is the origin of a glyph. * The bounding box is expressed in units of pixels. */ RIM_INLINE const AABB2f& getBounds() const { return bounds; } /// Set a 2D bounding box which completely encloses the glyphs. /** * This bounding box is specified where (0,0) is the origin of a glyph. * The bounding box is expressed in units of pixels. */ RIM_INLINE void setBounds( const AABB2f& newBounds ) { bounds = newBounds; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Maximum Advance Accessor Methods /// Return the vector in pixels from the origin of the glyph to the next glyph for the font. /** * This value is returned for both the horizontal and vertical directions. * It does not include any kerning between the glyphs. Use the font's kerning * accessor method to get the proper kerning for pairs of glyphs. */ RIM_INLINE const Vector2f& getAdvance() const { return advance; } /// Set the vector in pixels from the origin of the glyph to the next glyph for the font. /** * This value is returned for both the horizontal and vertical directions. * It does not include any kerning between the glyphs. Use the font's kerning * accessor method to get the proper kerning for pairs of glyphs. */ RIM_INLINE void setAdvance( const Vector2f& newAdvance ) { advance = newAdvance; } private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Members /// The nominal size of the glyph's font. Float size; /// The distance in pixels between successive horizontal lines of the glyph. /** * This value will likely be the same for all glyphs that are part of a font. */ Float height; /// A 2D axis-aligned bounding box which completely encloses the glyph. /** * This bounding box is specified where (0,0) is the origin of the glyph. * The bounding box is expressed in units of pixels. */ AABB2f bounds; /// The advance vector between this glyph and the next (not kerned). Vector2f advance; }; //########################################################################################## //********************* End Rim Graphics GUI Fonts Namespace ***************************** RIM_GRAPHICS_GUI_FONTS_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_GRAPHICS_GUI_GLYPH_METRICS_H <file_sep>/* * rimPhysicsCollisionShapeSphere.h * Rim Physics * * Created by <NAME> on 11/28/09. * Copyright 2009 Rim Software. All rights reserved. * */ #ifndef INCLUDE_RIM_PHYSICS_COLLISION_SHAPE_SPHERE_H #define INCLUDE_RIM_PHYSICS_COLLISION_SHAPE_SPHERE_H #include "rimPhysicsShapesConfig.h" #include "rimPhysicsCollisionShape.h" #include "rimPhysicsCollisionShapeBase.h" #include "rimPhysicsCollisionShapeInstance.h" //########################################################################################## //************************ Start Rim Physics Shapes Namespace **************************** RIM_PHYSICS_SHAPES_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class which represents a spherical collision shape. class CollisionShapeSphere : public CollisionShapeBase<CollisionShapeSphere> { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Public Class Declarations class Instance; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructors /// Create a default sphere shape with radius 1 centered at the origin. RIM_INLINE CollisionShapeSphere() { this->setBoundingSphere( BoundingSphere( Vector3::ZERO, Real(1) ) ); } /// Create a sphere shape with the specified position and radius and default material. /** * The radius parameter is automatically clamped to the range [0,+infinity]. */ RIM_INLINE CollisionShapeSphere( const Vector3& newPosition, Real newRadius ) { this->setBoundingSphere( BoundingSphere( newPosition, newRadius ) ); } /// Create a sphere shape with the specified position and radius and material. /** * The radius parameter is automatically clamped to the range [0,+infinity]. */ RIM_INLINE CollisionShapeSphere( const Vector3& newPosition, Real newRadius, const CollisionShapeMaterial& newMaterial ) : CollisionShapeBase<CollisionShapeSphere>( newMaterial ) { this->setBoundingSphere( BoundingSphere( newPosition, newRadius ) ); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Position Accessor Methods /// Return the position of this sphere in shape-space. RIM_INLINE const Vector3& getPosition() const { return this->getBoundingSphere().position; } /// Set the position of this sphere in shape-space. RIM_INLINE void setPosition( const Vector3& newPosition ) { this->setBoundingSphere( BoundingSphere( newPosition, this->getRadius() ) ); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Radius Accessor Methods /// Return the radius of this sphere in shape-space. RIM_INLINE Real getRadius() const { return this->getBoundingSphere().radius; } /// Set the radius of this sphere in shape-space. RIM_INLINE void setRadius( Real newRadius ) { this->setBoundingSphere( BoundingSphere( this->getPosition(), newRadius ) ); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Mass Distribution Accessor Methods /// Return a 3x3 matrix for the inertia tensor of this shape relative to its center of mass. virtual Matrix3 getInertiaTensor() const; /// Return a 3D vector representing the center-of-mass of this shape in its coordinate frame. virtual Vector3 getCenterOfMass() const; /// Return the volume of this shape in length units cubed (m^3). virtual Real getVolume() const; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Instance Creation Methods /// Create and return an instance of this shape. virtual Pointer<CollisionShapeInstance> getInstance() const; }; //########################################################################################## //########################################################################################## //############ //############ Sphere Shape Instance Class Definition //############ //########################################################################################## //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class which is used to instance a CollisionShapeSphere object with an arbitrary rigid transformation. class CollisionShapeSphere:: Instance : public CollisionShapeInstance { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Transform Update Method /// Update this sphere instance with the specified 3D rigid transformation from shape to world space. /** * This method transforms this instance's position and radius from * shape space to world space. */ virtual void setTransform( const Transform3& newTransform ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Attribute Accessor Methods /// Return a const reference to this sphere shape instance's position in world space. RIM_FORCE_INLINE const Vector3& getPosition() const { return this->getBoundingSphere().position; } /// Return this sphere shape instance's radius in world space. RIM_FORCE_INLINE Real getRadius() const { return this->getBoundingSphere().radius; } private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Constructors /// Create a new sphere shape instance which uses the specified base sphere shape. RIM_INLINE Instance( const CollisionShapeSphere* newSphere ) : CollisionShapeInstance( newSphere ) { } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Friend Declarations /// Declare the sphere collision shape as a friend so that it can construct instances. friend class CollisionShapeSphere; }; //########################################################################################## //************************ End Rim Physics Shapes Namespace ****************************** RIM_PHYSICS_SHAPES_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_PHYSICS_COLLISION_SHAPE_SPHERE_H <file_sep>/* * rimMath.h * Rim Math * * Created by <NAME> on 4/20/07. * Copyright 2007 Rim Software. All rights reserved. * */ #ifndef INCLUDE_RIM_MATH_H #define INCLUDE_RIM_MATH_H #include "math/rimMathConfig.h" #include "math/rimScalarMath.h" #include "math/rimArrayMath.h" #include "math/rimAABB1D.h" #include "math/rimAABB2D.h" #include "math/rimAABB3D.h" #include "math/rimVector2D.h" #include "math/rimVector3D.h" #include "math/rimVector4D.h" #include "math/rimVectorND.h" #include "math/rimMatrix2D.h" #include "math/rimMatrix3D.h" #include "math/rimMatrix4D.h" #include "math/rimMatrixND.h" #include "math/rimMatrix.h" #include "math/rimQuaternion.h" #include "math/rimTransform2D.h" #include "math/rimTransform3D.h" #include "math/rimRay2D.h" #include "math/rimRay3D.h" #include "math/rimPlane2D.h" #include "math/rimPlane3D.h" #include "math/rimFixed.h" #include "math/rimComplex.h" // SIMD Scalar/Vector Classes. #include "math/rimSIMD.h" #include "math/rimMathPrimitives.h" #include "math/rimUniformDistribution.h" #include "math/rimNormalDistribution.h" #include "math/rimExponentialDistribution.h" #include "math/rimPoissonDistribution.h" #include "math/rimFFT.h" #include "math/rimConvolution.h" //########################################################################################## //***************************** Start Rim Math Namespace ********************************* RIM_MATH_NAMESPACE_START //****************************************************************************************** //########################################################################################## // 1D Bounding Box Type Definitions. typedef AABB1D<int> AABB1i; typedef AABB1D<float> AABB1f; typedef AABB1D<double> AABB1d; // 2D Bounding Box Type Definitions. typedef AABB2D<int> AABB2i; typedef AABB2D<float> AABB2f; typedef AABB2D<double> AABB2d; // 3D Bounding Box Type Definitions. typedef AABB3D<int> AABB3i; typedef AABB3D<float> AABB3f; typedef AABB3D<double> AABB3d; // 2D Matrix Type Definitions. typedef Matrix2D<int> Matrix2i; typedef Matrix2D<float> Matrix2f; typedef Matrix2D<double> Matrix2d; // 3D Matrix Type Definitions. typedef Matrix3D<int> Matrix3i; typedef Matrix3D<float> Matrix3f; typedef Matrix3D<double> Matrix3d; // 4D Matrix Type Definitions. typedef Matrix4D<int> Matrix4i; typedef Matrix4D<float> Matrix4f; typedef Matrix4D<double> Matrix4d; // Quaternion Type Definitions. typedef Quaternion<int> Quaternioni; typedef Quaternion<float> Quaternionf; typedef Quaternion<double> Quaterniond; // 2D Vector Type Definitions. typedef Vector2D<int> Vector2i; typedef Vector2D<float> Vector2f; typedef Vector2D<double> Vector2d; // 3D Vector Type Definitions. typedef Vector3D<int> Vector3i; typedef Vector3D<float> Vector3f; typedef Vector3D<double> Vector3d; // 4D Vector Type Definitions. typedef Vector4D<int> Vector4i; typedef Vector4D<float> Vector4f; typedef Vector4D<double> Vector4d; // 2D Plane Type Definitions. typedef Plane2D<int> Plane2i; typedef Plane2D<float> Plane2f; typedef Plane2D<double> Plane2d; // 3D Plane Type Definitions. typedef Plane3D<int> Plane3i; typedef Plane3D<float> Plane3f; typedef Plane3D<double> Plane3d; // 2D Ray Type Definitions. typedef Ray2D<int> Ray2i; typedef Ray2D<float> Ray2f; typedef Ray2D<double> Ray2d; // 3D Ray Type Definitions. typedef Ray3D<int> Ray3i; typedef Ray3D<float> Ray3f; typedef Ray3D<double> Ray3d; //########################################################################################## //***************************** End Rim Math Namespace *********************************** RIM_MATH_NAMESPACE_END //****************************************************************************************** //########################################################################################## #ifdef RIM_MATH_NAMESPACE_START #undef RIM_MATH_NAMESPACE_START #endif #ifdef RIM_MATH_NAMESPACE_END #undef RIM_MATH_NAMESPACE_END #endif #endif // INCLUDE_RIM_MATH_H <file_sep>/* * rimGraphicsSkeleton.h * Rim Software * * Created by <NAME> on 7/3/14. * Copyright 2014 __MyCompanyName__. All rights reserved. * */ #ifndef INCLUDE_RIM_GRAPHICS_SKELETON_H #define INCLUDE_RIM_GRAPHICS_SKELETON_H #include "rimGraphicsShapesConfig.h" #include "rimGraphicsBone.h" //########################################################################################## //*********************** Start Rim Graphics Shapes Namespace **************************** RIM_GRAPHICS_SHAPES_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class which encapsulates geometry and a material with which it should be rendered. /** * A MeshGroup specifies its geometry relative to the origin of its parent * shape and does not have its own transformation. */ class Skeleton { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructors /// Create an empty skeleton with no bones. Skeleton(); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Bone Accessor Methods /// Return the number of bones there are in this skeleton. RIM_INLINE Size getBoneCount() const { return bones.getSize(); } /// Return a pointer to the bone in this skeleton at the specified index. RIM_INLINE Pointer<Bone> getBone( Index boneIndex ) const { return bones[boneIndex]; } /// Determine the index of the first bone in this skeleton with the specified name. /** * The method places the bone index in the output parameter and returns TRUE * if there is a bone with that name in the skeleton. If not, FALSE is returned * indicating there was no bone with that name. */ Bool getBoneIndex( const String& boneName, Index& boneIndex ) const; /// Add a new bone to this skeleton with the specified name, bind transform (relative to parent), and parent index. /** * The method returns the index of the new bone in this skeleton. * There are no restrictions on the parent index range, since the parent index * may reference bones that are not added to the skeleton yet. * During skeleton updating, an out-of-range parent index is interpreted * as INVALID_BONE_INDEX. */ Index addBone( const String& boneName, const Transform3& bindTransform, Index parentIndex = Bone::INVALID_BONE_INDEX ); /// Remove the bone with the specified name from this skeleton. /** * The method returns whether or not the bone was successfully removed. * This method automatically adjusts all bone parent indices that are * greater than the removed bone index so that the reflect the new bone * indices. */ Bool removeBone( const String& boneName ); /// Remove the bone at the specified index from this skeleton. /** * The method returns whether or not the bone was successfully removed. * This method automatically adjusts all bone parent indices that are * greater than the removed bone index so that the reflect the new bone * indices. */ Bool removeBone( Index boneIndex ); /// Remove all bones from this skeleton. void clearBones(); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Bone Transform Accessor Methods /// Return a reference to the parent-relative transformation of the bone at the specified index. RIM_INLINE const Transform3& getBoneTransform( Index boneIndex ) const { return bones[boneIndex]->getTransform(); } /// Set the parent-relative transformation of the bone at the specified index in this skeleton. /** * The method returns whether or not the operation was successful. */ RIM_INLINE Bool setBoneTransform( Index boneIndex, const Transform3& newTransform ) { if ( boneIndex >= bones.getSize() ) return false; bones[boneIndex]->setTransform( newTransform ); return true; } /// Return a reference to the parent-relative bind transformation of the bone at the specified index. RIM_INLINE const Transform3& getBoneBindTransform( Index boneIndex ) const { return bones[boneIndex]->getBindTransform(); } /// Set the parent-relative bind transformation of the bone at the specified index in this skeleton. /** * The method returns whether or not the operation was successful. */ RIM_INLINE Bool setBoneBindTransform( Index boneIndex, const Transform3& newTransform ) { if ( boneIndex >= bones.getSize() ) return false; bones[boneIndex]->setBindTransform( newTransform ); return true; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Bone Name Accessor Methods /// Return a reference to the name of the bone at the specified index. RIM_INLINE const String& getBoneName( Index boneIndex ) const { return bones[boneIndex]->getName(); } /// Set the name of the bone at the specified index in this skeleton. /** * The method returns whether or not the operation was successful. */ RIM_INLINE Bool setBoneName( Index boneIndex, const String& newName ) { if ( boneIndex >= bones.getSize() ) return false; bones[boneIndex]->setName( newName ); return true; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Bone Parent Accessor Methods /// Return the index of the parent of the bone at the specified index. /** * The method returns INVALID_BONE_INDEX if there is no parent for that bone. */ RIM_INLINE Index getBoneParent( Index boneIndex ) const { return bones[boneIndex]->getParentIndex(); } /// Set the index of the parent of the bone at the specified index in this skeleton. /** * The method returns whether or not the operation was successful. */ RIM_INLINE Bool setBoneParent( Index boneIndex, Index newParentIndex ) { if ( boneIndex >= bones.getSize() ) return false; bones[boneIndex]->setParentIndex( newParentIndex ); return true; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Bone Matrix Accessor Methods /// Return a reference to the bone-to-world transformation matrix of the bone at the specified index. RIM_FORCE_INLINE const Matrix4& getBoneMatrix( Index boneIndex ) const { return matrices[boneIndex]; } /// Return a pointer to an array of bone-to-world transformation matrices for this skeleton's bones. RIM_FORCE_INLINE const Matrix4* getBoneMatrices() const { return matrices.getPointer(); } /// Update the bone matrices for this skeleton. /** * This method should be called once per frame before drawing any meshes * that use this skeleton. */ void updateBoneMatrices(); private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Class Declarations /// A class that stores information about a bone that makes up a skeleton. class SkeletonBone : public Bone { public: /// Create a new bone with the specified name, bind transform, and parent index. RIM_INLINE SkeletonBone( const String& newName, const Transform3& newBindTransform, Index newParentIndex ) : Bone( newName, newBindTransform, newParentIndex ), timestamp( 0 ) { } /// A timestamp index indicating whether or not this bone has updated its transformation matrx. Index timestamp; }; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Helper Methods /// Return the complete bone-to-world transformation matrix for the given bone. /** * This method automatically recursively calls this method on any parent * bones that have not yet been updated for the current timestamp. */ Matrix4 getBoneMatrix( Index boneIndex ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Members /// A list of the bones that are part of this skeleton. ArrayList< Pointer<SkeletonBone> > bones; /// A list of the current bone-to-world transformation matrices for all bones in this skeleton. ArrayList<Matrix4> matrices; /// The internal update timestamp that is used to keep track of which bone transformation matrices have been updated. Index timestamp; }; //########################################################################################## //*********************** End Rim Graphics Shapes Namespace ****************************** RIM_GRAPHICS_SHAPES_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_GRAPHICS_SKELETON_H <file_sep>/* * Project: Rim Framework * * File: rim/math/SIMDScalarIntN.h * * Version: 1.0.0 * * Contents: rim::math::SIMDScalar class specialization for an N-integer SIMD data type. * * License: * * Copyright (C) 2010-12 <NAME>. * All rights reserved. * * * Contact Information: * * Please send all bug reports and other contact to: * <NAME> * <EMAIL> * */ #ifndef INCLUDE_RIM_SIMD_ARRAY_INT_32_H #define INCLUDE_RIM_SIMD_ARRAY_INT_32_H #include "rimMathConfig.h" #include "rimSIMDConfig.h" #include "rimSIMDScalar.h" #include "rimSIMDScalarInt32_4.h" #include "rimSIMDArray.h" //########################################################################################## //***************************** Start Rim Math Namespace ********************************* RIM_MATH_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class representing an N-component 32-bit signed-integer SIMD scalar. /** * This specialization of the SIMDScalar class uses one or more 4-component * SIMD values to simulate an N-wide SIMD register. */ template < Size width > class RIM_ALIGN(16) SIMDArray<Int32,width> { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructors /// Create a new SIMD scalar with all elements left uninitialized. RIM_FORCE_INLINE SIMDArray() { } /// Create a new SIMD scalar with all elements equal to the specified value. RIM_FORCE_INLINE SIMDArray( Int32 value ) { SIMDBaseType simdValue( value ); for ( Index i = 0; i < numIterations; i++ ) v[i] = simdValue; } /// Create a new SIMD scalar from the first N values stored at specified pointer's location. RIM_FORCE_INLINE SIMDArray( const Int32* array ) { for ( Index i = 0; i < numIterations; i++ ) { v[i] = SIMDBaseType( array ); array += SIMD_WIDTH; } } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Load Methods /// Load a SIMD array from the specified aligned pointer to values. RIM_FORCE_INLINE static SIMDArray load( const Int32* array ) { SIMDArray result; for ( Index i = 0; i < numIterations; i++ ) { result.v[i] = SIMDBaseType::load( array ); array += SIMD_WIDTH; } return result; } /// Load a SIMD array from the specified unaligned pointer to values. RIM_FORCE_INLINE static SIMDArray loadUnaligned( const Int32* array ) { SIMDArray result; for ( Index i = 0; i < numIterations; i++ ) { result.v[i] = SIMDBaseType::loadUnaligned( array ); array += SIMD_WIDTH; } return result; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Store Method /// Store this SIMD scalar starting at the specified destination pointer. RIM_FORCE_INLINE void store( Int32* destination ) const { for ( Index i = 0; i < numIterations; i++ ) { v[i].store( destination ); destination += SIMD_WIDTH; } } /// Store this SIMD scalar starting at the specified unaligned destination pointer. RIM_FORCE_INLINE void storeUnaligned( Int32* destination ) const { for ( Index i = 0; i < numIterations; i++ ) { v[i].storeUnaligned( destination ); destination += SIMD_WIDTH; } } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Accessor Methods /// Get a reference to the value stored at the specified component index in this scalar. RIM_FORCE_INLINE Int32& operator [] ( Index i ) { return ((Int32*)v)[i]; } /// Get the value stored at the specified component index in this scalar. RIM_FORCE_INLINE Int32 operator [] ( Index i ) const { return ((const Int32*)v)[i]; } /// Get a pointer to the first element in this scalar. /** * The remaining values are in the next 3 locations after the * first element. */ RIM_FORCE_INLINE const Int32* toArray() const { return (const Float32*)v; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Logical Operators /// Return the bitwise NOT of this 4D SIMD vector. RIM_FORCE_INLINE SIMDArray operator ~ () const { SIMDArray result; for ( Index i = 0; i < numIterations; i++ ) result.v[i] = ~v[i]; return result; } /// Compute the bitwise AND of this 4D SIMD vector with another and return the result. RIM_FORCE_INLINE SIMDArray operator & ( const SIMDArray& scalar ) const { SIMDArray result; for ( Index i = 0; i < numIterations; i++ ) result.v[i] = v[i] & scalar.v[i]; return result; } /// Compute the bitwise AND of this 4D SIMD vector with a mask and return the result. RIM_FORCE_INLINE SIMDArray operator & ( const SIMDArray<Bool,width>& scalar ) const { SIMDArray result; for ( Index i = 0; i < numIterations; i++ ) result.v[i] = v[i] & scalar.v[i]; return result; } /// Compute the bitwise OR of this 4D SIMD vector with another and return the result. RIM_FORCE_INLINE SIMDArray operator | ( const SIMDArray& scalar ) const { SIMDArray result; for ( Index i = 0; i < numIterations; i++ ) result.v[i] = v[i] | scalar.v[i]; return result; } /// Compute the bitwise AND of this 4D SIMD vector with a mask and return the result. RIM_FORCE_INLINE SIMDArray operator | ( const SIMDArray<Bool,width>& scalar ) const { SIMDArray result; for ( Index i = 0; i < numIterations; i++ ) result.v[i] = v[i] | scalar.v[i]; return result; } /// Compute the bitwise XOR of this 4D SIMD vector with another and return the result. RIM_FORCE_INLINE SIMDArray operator ^ ( const SIMDArray& scalar ) const { SIMDArray result; for ( Index i = 0; i < numIterations; i++ ) result.v[i] = v[i] ^ scalar.v[i]; return result; } /// Compute the bitwise AND of this 4D SIMD vector with a mask and return the result. RIM_FORCE_INLINE SIMDArray operator ^ ( const SIMDArray<Bool,width>& scalar ) const { SIMDArray result; for ( Index i = 0; i < numIterations; i++ ) result.v[i] = v[i] ^ scalar.v[i]; return result; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Logical Assignment Operators /// Compute the logical AND of this 4D SIMD vector with another and assign it to this vector. RIM_FORCE_INLINE SIMDArray& operator &= ( const SIMDArray& scalar ) { for ( Index i = 0; i < numIterations; i++ ) v[i] &= scalar.v[i]; return *this; } /// Compute the logical OR of this 4D SIMD vector with another and assign it to this vector. RIM_FORCE_INLINE SIMDArray& operator |= ( const SIMDArray& scalar ) { for ( Index i = 0; i < numIterations; i++ ) v[i] |= scalar.v[i]; return *this; } /// Compute the bitwise XOR of this 4D SIMD vector with another and assign it to this vector. RIM_FORCE_INLINE SIMDArray& operator ^= ( const SIMDArray& scalar ) { for ( Index i = 0; i < numIterations; i++ ) v[i] ^= scalar.v[i]; return *this; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Comparison Operators /// Compare two 4D SIMD scalars component-wise for equality. /** * Return a 4D scalar of booleans indicating the result of the comparison. * If each corresponding pair of components is equal, the corresponding result * component is non-zero. Otherwise, that result component is equal to zero. */ RIM_FORCE_INLINE SIMDArray<Bool,width> operator == ( const SIMDArray& scalar ) const { SIMDArray<Bool,width> result; for ( Index i = 0; i < numIterations; i++ ) result.v[i] = v[i] == scalar.v[i]; return result; } /// Compare this scalar to a single value for equality. /** * Return a 4D scalar of booleans indicating the result of the comparison. * The float value is expanded to a 4-wide SIMD scalar and compared with this scalar. * If each corresponding pair of components is equal, the corresponding result * component is non-zero. Otherwise, that result component is equal to zero. */ RIM_FORCE_INLINE SIMDArray<Bool,width> operator == ( const Int32 value ) const { SIMDArray<Bool,width> result; SIMDBaseType simdValue( value ); for ( Index i = 0; i < numIterations; i++ ) result.v[i] = v[i] == simdValue; return result; } /// Compare two 4D SIMD scalars component-wise for inequality /** * Return a 4D scalar of booleans indicating the result of the comparison. * If each corresponding pair of components is not equal, the corresponding result * component is non-zero. Otherwise, that result component is equal to zero. */ RIM_FORCE_INLINE SIMDArray<Bool,width> operator != ( const SIMDArray& scalar ) const { SIMDArray<Bool,width> result; for ( Index i = 0; i < numIterations; i++ ) result.v[i] = v[i] != scalar.v[i]; return result; } /// Compare this scalar to a single floating point value for inequality. /** * Return a 4D scalar of booleans indicating the result of the comparison. * The float value is expanded to a 4-wide SIMD scalar and compared with this scalar. * If each corresponding pair of components is not equal, the corresponding result * component is non-zero. Otherwise, that result component is equal to zero. */ RIM_FORCE_INLINE SIMDArray<Bool,width> operator != ( const Int32 value ) const { SIMDArray<Bool,width> result; SIMDBaseType simdValue( value ); for ( Index i = 0; i < numIterations; i++ ) result.v[i] = v[i] != simdValue; return result; } /// Perform a component-wise less-than comparison between this an another 4D SIMD scalar. /** * Return a 4D scalar of booleans indicating the result of the comparison. * If each corresponding pair of components has this scalar's component less than * the other scalar's component, the corresponding result component is non-zero. * Otherwise, that result component is equal to zero. */ RIM_FORCE_INLINE SIMDArray<Bool,width> operator < ( const SIMDArray& scalar ) const { SIMDArray<Bool,width> result; for ( Index i = 0; i < numIterations; i++ ) result.v[i] = v[i] < scalar.v[i]; return result; } /// Perform a component-wise less-than comparison between this 4D SIMD scalar and an expanded scalar. /** * Return a 4D scalar of booleans indicating the result of the comparison. * The float value is expanded to a 4-wide SIMD scalar and compared with this scalar. * If each corresponding pair of components has this scalar's component less than * the other scalar's component, the corresponding result component is non-zero. * Otherwise, that result component is equal to zero. */ RIM_FORCE_INLINE SIMDArray<Bool,width> operator < ( const Int32 value ) const { SIMDArray<Bool,width> result; SIMDBaseType simdValue( value ); for ( Index i = 0; i < numIterations; i++ ) result.v[i] = v[i] < simdValue; return result; } /// Perform a component-wise greater-than comparison between this an another 4D SIMD scalar. /** * Return a 4D scalar of booleans indicating the result of the comparison. * If each corresponding pair of components has this scalar's component greater than * the other scalar's component, the corresponding result component is non-zero. * Otherwise, that result component is equal to zero. */ RIM_FORCE_INLINE SIMDArray<Bool,width> operator > ( const SIMDArray& scalar ) const { SIMDArray<Bool,width> result; for ( Index i = 0; i < numIterations; i++ ) result.v[i] = v[i] > scalar.v[i]; return result; } /// Perform a component-wise greater-than comparison between this 4D SIMD scalar and an expanded scalar. /** * Return a 4D scalar of booleans indicating the result of the comparison. * The float value is expanded to a 4-wide SIMD scalar and compared with this scalar. * If each corresponding pair of components has this scalar's component greater than * the other scalar's component, the corresponding result component is non-zero. * Otherwise, that result component is equal to zero. */ RIM_FORCE_INLINE SIMDArray<Bool,width> operator > ( const Int32 value ) const { SIMDArray<Bool,width> result; SIMDBaseType simdValue( value ); for ( Index i = 0; i < numIterations; i++ ) result.v[i] = v[i] > simdValue; return result; } /// Perform a component-wise less-than-or-equal-to comparison between this an another 4D SIMD scalar. /** * Return a 4D scalar of booleans indicating the result of the comparison. * If each corresponding pair of components has this scalar's component less than * or equal to the other scalar's component, the corresponding result component is non-zero. * Otherwise, that result component is equal to zero. */ RIM_FORCE_INLINE SIMDArray<Bool,width> operator <= ( const SIMDArray& scalar ) const { SIMDArray<Bool,width> result; for ( Index i = 0; i < numIterations; i++ ) result.v[i] = v[i] <= scalar.v[i]; return result; } /// Perform a component-wise less-than-or-equal-to comparison between this 4D SIMD scalar and an expanded scalar. /** * Return a 4D scalar of booleans indicating the result of the comparison. * The float value is expanded to a 4-wide SIMD scalar and compared with this scalar. * If each corresponding pair of components has this scalar's component less than * or equal to the other scalar's component, the corresponding result component is non-zero. * Otherwise, that result component is equal to zero. */ RIM_FORCE_INLINE SIMDArray<Bool,width> operator <= ( const Int32 value ) const { SIMDArray<Bool,width> result; SIMDBaseType simdValue( value ); for ( Index i = 0; i < numIterations; i++ ) result.v[i] = v[i] <= simdValue; return result; } /// Perform a component-wise greater-than-or-equal-to comparison between this an another 4D SIMD scalar. /** * Return a 4D scalar of booleans indicating the result of the comparison. * If each corresponding pair of components has this scalar's component greater than * or equal to the other scalar's component, the corresponding result component is non-zero. * Otherwise, that result component is equal to zero. */ RIM_FORCE_INLINE SIMDArray<Bool,width> operator >= ( const SIMDArray& scalar ) const { SIMDArray<Bool,width> result; for ( Index i = 0; i < numIterations; i++ ) result.v[i] = v[i] >= scalar.v[i]; return result; } /// Perform a component-wise greater-than-or-equal-to comparison between this 4D SIMD scalar and an expanded scalar. /** * Return a 4D scalar of booleans indicating the result of the comparison. * The float value is expanded to a 4-wide SIMD scalar and compared with this scalar. * If each corresponding pair of components has this scalar's component greater than * or equal to the other scalar's component, the corresponding result component is non-zero. * Otherwise, that result component is equal to zero. */ RIM_FORCE_INLINE SIMDArray<Bool,width> operator >= ( const Int32 value ) const { SIMDArray<Bool,width> result; SIMDBaseType simdValue( value ); for ( Index i = 0; i < numIterations; i++ ) result.v[i] = v[i] >= simdValue; return result; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Shifting Operators /// Shift each component of the SIMD scalar to the left by the specified amount of bits. /** * This method shifts the contents of each component to the left by the specified * amount of bits and inserts zeros. * * @param bitShift - the number of bits to shift this SIMD scalar by. * @return the shifted SIMD scalar. */ RIM_FORCE_INLINE SIMDArray operator << ( Int bitShift ) const { SIMDArray result; for ( Index i = 0; i < numIterations; i++ ) result.v[i] = v[i] << bitShift; return result; } /// Shift each component of the SIMD scalar to the right by the specified amount of bits. /** * This method shifts the contents of each component to the right by the specified * amount of bits and sign extends the original values.. * * @param bitShift - the number of bits to shift this SIMD scalar by. * @return the shifted SIMD scalar. */ RIM_FORCE_INLINE SIMDArray operator >> ( Int bitShift ) const { SIMDArray result; for ( Index i = 0; i < numIterations; i++ ) result.v[i] = v[i] >> bitShift; return result; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Negation/Positivation Operators /// Negate a scalar. /** * This method negates every component of this 4D SIMD scalar * and returns the result, leaving this scalar unmodified. * * @return the negation of the original scalar. */ RIM_FORCE_INLINE SIMDArray operator - () const { SIMDArray result; for ( Index i = 0; i < numIterations; i++ ) result.v[i] = -v[i]; return result; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Arithmetic Operators /// Add this scalar to another and return the result. /** * This method adds another scalar to this one, component-wise, * and returns this addition. It does not modify either of the original * scalars. * * @param scalar - The scalar to add to this one. * @return The addition of this scalar and the parameter. */ RIM_FORCE_INLINE SIMDArray operator + ( const SIMDArray& scalar ) const { SIMDArray result; for ( Index i = 0; i < numIterations; i++ ) result.v[i] = v[i] + scalar.v[i]; return result; } /// Add a value to every component of this scalar. /** * This method adds the value parameter to every component * of the scalar, and returns a scalar representing this result. * It does not modifiy the original scalar. * * @param value - The value to add to all components of this scalar. * @return The resulting scalar of this addition. */ RIM_FORCE_INLINE SIMDArray operator + ( const Int32 value ) const { SIMDArray result; SIMDBaseType simdValue( value ); for ( Index i = 0; i < numIterations; i++ ) result.v[i] = v[i] + simdValue; return result; } /// Subtract a scalar from this scalar component-wise and return the result. /** * This method subtracts another scalar from this one, component-wise, * and returns this subtraction. It does not modify either of the original * scalars. * * @param scalar - The scalar to subtract from this one. * @return The subtraction of the the parameter from this scalar. */ RIM_FORCE_INLINE SIMDArray operator - ( const SIMDArray& scalar ) const { SIMDArray result; for ( Index i = 0; i < numIterations; i++ ) result.v[i] = v[i] - scalar.v[i]; return result; } /// Subtract a value from every component of this scalar. /** * This method subtracts the value parameter from every component * of the scalar, and returns a scalar representing this result. * It does not modifiy the original scalar. * * @param value - The value to subtract from all components of this scalar. * @return The resulting scalar of this subtraction. */ RIM_FORCE_INLINE SIMDArray operator - ( const Int32 value ) const { SIMDArray result; SIMDBaseType simdValue( value ); for ( Index i = 0; i < numIterations; i++ ) result.v[i] = v[i] - simdValue; return result; } /// Multiply component-wise this scalar and another scalar. /** * This operator multiplies each component of this scalar * by the corresponding component of the other scalar and * returns a scalar representing this result. It does not modify * either original scalar. * * @param scalar - The scalar to multiply this scalar by. * @return The result of the multiplication. */ RIM_FORCE_INLINE SIMDArray operator * ( const SIMDArray& scalar ) const { SIMDArray result; for ( Index i = 0; i < numIterations; i++ ) result.v[i] = v[i] * scalar.v[i]; return result; } /// Multiply every component of this scalar by a value and return the result. /** * This method multiplies the value parameter with every component * of the scalar, and returns a scalar representing this result. * It does not modifiy the original scalar. * * @param value - The value to multiplly with all components of this scalar. * @return The resulting scalar of this multiplication. */ RIM_FORCE_INLINE SIMDArray operator * ( const Int32 value ) const { SIMDArray result; SIMDBaseType simdValue( value ); for ( Index i = 0; i < numIterations; i++ ) result.v[i] = v[i] * simdValue; return result; } /// Divide this scalar by another scalar component-wise. /** * This operator divides each component of this scalar * by the corresponding component of the other scalar and * returns a scalar representing this result. It does not modify * either original scalar. * * @param scalar - The scalar to multiply this scalar by. * @return The result of the division. */ RIM_FORCE_INLINE SIMDArray operator / ( const SIMDArray& scalar ) const { SIMDArray result; for ( Index i = 0; i < numIterations; i++ ) result.v[i] = v[i] / scalar.v[i]; return result; } /// Divide every component of this scalar by a value and return the result. /** * This method Divides every component of the scalar by the value parameter, * and returns a scalar representing this result. * It does not modifiy the original scalar. * * @param value - The value to divide all components of this scalar by. * @return The resulting scalar of this division. */ RIM_FORCE_INLINE SIMDArray operator / ( const Int32 value ) const { SIMDArray result; SIMDBaseType simdValue( value ); for ( Index i = 0; i < numIterations; i++ ) result.v[i] = v[i] / simdValue; return result; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Arithmetic Assignment Operators /// Add a scalar to this scalar, modifying this original scalar. /** * This method adds another scalar to this scalar, component-wise, * and sets this scalar to have the result of this addition. * * @param scalar - The scalar to add to this scalar. * @return A reference to this modified scalar. */ RIM_FORCE_INLINE SIMDArray& operator += ( const SIMDArray& scalar ) { for ( Index i = 0; i < numIterations; i++ ) v[i] += scalar.v[i]; return *this; } /// Subtract a scalar from this scalar, modifying this original scalar. /** * This method subtracts another scalar from this scalar, component-wise, * and sets this scalar to have the result of this subtraction. * * @param scalar - The scalar to subtract from this scalar. * @return A reference to this modified scalar. */ RIM_FORCE_INLINE SIMDArray& operator -= ( const SIMDArray& scalar ) { for ( Index i = 0; i < numIterations; i++ ) v[i] -= scalar.v[i]; return *this; } /// Multiply component-wise this scalar and another scalar and modify this scalar. /** * This operator multiplies each component of this scalar * by the corresponding component of the other scalar and * modifies this scalar to contain the result. * * @param scalar - The scalar to multiply this scalar by. * @return A reference to this modified scalar. */ RIM_FORCE_INLINE SIMDArray& operator *= ( const SIMDArray& scalar ) { for ( Index i = 0; i < numIterations; i++ ) v[i] *= scalar.v[i]; return *this; } /// Divide this scalar by another scalar component-wise and modify this scalar. /** * This operator divides each component of this scalar * by the corresponding component of the other scalar and * modifies this scalar to contain the result. * * @param scalar - The scalar to divide this scalar by. * @return A reference to this modified scalar. */ RIM_FORCE_INLINE SIMDArray& operator /= ( const SIMDArray& scalar ) { for ( Index i = 0; i < numIterations; i++ ) v[i] /= scalar.v[i]; return *this; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Required Alignment Accessor Methods /// Return the alignment required for objects of this type. /** * For most SIMD types this value will be 16 bytes. If there is * no alignment required, 0 is returned. */ RIM_FORCE_INLINE static Size getRequiredAlignment() { return SIMDBaseType::getRequiredAlignment(); } /// Get the width of this scalar (number of components it has). RIM_FORCE_INLINE static Size getWidth() { return width; } private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Static Data Members /// The width of the underlying SIMD type used. static const Size SIMD_WIDTH = SIMDType<Int32>::MAX_WIDTH; /// The underlying SIMD type used to implement this class. typedef SIMDScalar<Int32,SIMD_WIDTH> SIMDBaseType; /// The number of SIMD processing iterations that must occur. static const Size numIterations = SIMD_WIDTH*(width / SIMD_WIDTH) == width ? width / SIMD_WIDTH : width / SIMD_WIDTH + 1; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Members /// An array of SIMD values that simulate an N-wide SIMD register. SIMDBaseType v[numIterations]; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Friend Declarations template < typename T, Size dimension > friend class SIMDArray3D; template < Size width2 > friend RIM_FORCE_INLINE SIMDArray<Int32,width2> abs( const SIMDArray<Int32,width2>& scalar ); template < Size width2 > friend RIM_FORCE_INLINE SIMDArray<Int32,width2> sqrt( const SIMDArray<Int32,width2>& scalar ); template < Size width2 > friend RIM_FORCE_INLINE SIMDArray<Int32,width2> min( const SIMDArray<Int32,width2>& scalar1, const SIMDArray<Int32,width2>& scalar2 ); template < Size width2 > friend RIM_FORCE_INLINE SIMDArray<Int32,width2> max( const SIMDArray<Int32,width2>& scalar1, const SIMDArray<Int32,width2>& scalar2 ); template < Size width2 > friend RIM_FORCE_INLINE SIMDArray<Int32,width2> select( const SIMDArray<Bool,width2>& selector, const SIMDArray<Int32,width2>& scalar1, const SIMDArray<Int32,width2>& scalar2 ); }; //########################################################################################## //########################################################################################## //############ //############ Associative SIMD Scalar Operators //############ //########################################################################################## //########################################################################################## /// Add a scalar value to each component of this scalar and return the resulting scalar. template < Size width > RIM_FORCE_INLINE SIMDArray<Int32,width> operator + ( const Int32 value, const SIMDArray<Int32,width>& scalar ) { return SIMDArray<Int32,width>(value) + scalar; } /// Subtract a scalar value from each component of this scalar and return the resulting scalar. template < Size width > RIM_FORCE_INLINE SIMDArray<Int32,width> operator - ( const Int32 value, const SIMDArray<Int32,width>& scalar ) { return SIMDArray<Int32,width>(value) - scalar; } /// Multiply a scalar value by each component of this scalar and return the resulting scalar. template < Size width > RIM_FORCE_INLINE SIMDArray<Int32,width> operator * ( const Int32 value, const SIMDArray<Int32,width>& scalar ) { return SIMDArray<Int32,width>(value) * scalar; } /// Divide each component of this scalar by a scalar value and return the resulting scalar. template < Size width > RIM_FORCE_INLINE SIMDArray<Int32,width> operator / ( const Int32 value, const SIMDArray<Int32,width>& scalar ) { return SIMDArray<Int32,width>(value) / scalar; } //########################################################################################## //########################################################################################## //############ //############ Free Vector Functions //############ //########################################################################################## //########################################################################################## /// Compute the absolute value of each component of the specified SIMD scalar and return the result. template < Size width > RIM_FORCE_INLINE SIMDArray<Int32,width> abs( const SIMDArray<Int32,width>& scalar ) { SIMDArray<Int32,width> result; for ( Index i = 0; i < SIMDArray<Int32,width>::numIterations; i++ ) result.v[i] = math::abs( scalar.v[i] ); return result; } /// Compute the square root of each component of the specified SIMD scalar and return the result. template < Size width > RIM_FORCE_INLINE SIMDArray<Int32,width> sqrt( const SIMDArray<Int32,width>& scalar ) { SIMDArray<Int32,width> result; for ( Index i = 0; i < SIMDArray<Int32,width>::numIterations; i++ ) result.v[i] = math::sqrt( scalar.v[i] ); return result; } /// Compute the minimum of each component of the specified SIMD scalars and return the result. template < Size width > RIM_FORCE_INLINE SIMDArray<Int32,width> min( const SIMDArray<Int32,width>& scalar1, const SIMDArray<Int32,width>& scalar2 ) { SIMDArray<Int32,width> result; for ( Index i = 0; i < SIMDArray<Int32,width>::numIterations; i++ ) result.v[i] = math::min( scalar1.v[i], scalar2.v[i] ); return result; } /// Compute the maximum of each component of the specified SIMD scalars and return the result. template < Size width > RIM_FORCE_INLINE SIMDArray<Int32,width> max( const SIMDArray<Int32,width>& scalar1, const SIMDArray<Int32,width>& scalar2 ) { SIMDArray<Int32,width> result; for ( Index i = 0; i < SIMDArray<Int32,width>::numIterations; i++ ) result.v[i] = math::max( scalar1.v[i], scalar2.v[i] ); return result; } /// Select elements from the first SIMD scalar if the selector is TRUE, otherwise from the second. template < Size width > RIM_FORCE_INLINE SIMDArray<Int32,width> select( const SIMDArray<Bool,width>& selector, const SIMDArray<Int32,width>& scalar1, const SIMDArray<Int32,width>& scalar2 ) { SIMDArray<Int32,width> result; for ( Index i = 0; i < SIMDArray<Int32,width>::numIterations; i++ ) result.v[i] = math::select( selector.v[i], scalar1.v[i], scalar2.v[i] ); return result; } //########################################################################################## //***************************** End Rim Math Namespace *********************************** RIM_MATH_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_SIMD_ARRAY_INT_32_H <file_sep>/* * rimNullType.h * Rim Framework * * Created by <NAME> on 6/7/09. * Copyright 2009 Rim Software. All rights reserved. * */ #ifndef INCLUDE_RIM_NULL_TYPE_H #define INCLUDE_RIM_NULL_TYPE_H #include "../rimLanguageConfig.h" //########################################################################################## //*********************** Start Rim Language Internal Namespace ************************** RIM_LANGUAGE_INTERNAL_NAMESPACE_START //****************************************************************************************** //########################################################################################## /// An empty type used to represent a template argument that is not set. struct NullType; //########################################################################################## //*********************** End Rim Language Internal Namespace **************************** RIM_LANGUAGE_INTERNAL_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_NULL_TYPE_H <file_sep>/* * rimShortArrayList.h * Rim Framework * * Created by <NAME> on 5/9/13. * Copyright 2013 __MyCompanyName__. All rights reserved. * */ #ifndef INCLUDE_RIM_SHORT_ARRAY_LIST_H #define INCLUDE_RIM_SHORT_ARRAY_LIST_H #include "rimUtilitiesConfig.h" #include "rimAllocator.h" #include <stdio.h> //########################################################################################## //*************************** Start Rim Utilities Namespace ****************************** RIM_UTILITIES_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// An array-based list class that uses a fixed-size local buffer for its elements. /** * This fixed-size buffer doesn't require a dynamic allocation and so can improve * both runtime cache performance (as well as reducing unnecessary allocations for * short lists of elements). When the list grows beyond that initial fixed-size capacity, * the elements are reallocated in a dynamic array, allowing the list to be any size. * * This class can be useful anywhere an application only requires a few elements to be * stored on average, and so the elements can be stored locally. */ template < typename T, Size localCapacity = Size(4) > class ShortArrayList { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructors /// Create a new empty short short array list with the default capacity of 8 elements. /** * This is a lightweight operation and the short array list doesn't initialize or allocate any * memory until an element is added to it. */ RIM_INLINE ShortArrayList() : array( (T*)localStorage ), numElements( 0 ), capacity( localCapacity ) { } /// Create a new short array list with its internal array initialized to the specified capacity. RIM_INLINE ShortArrayList( Size newCapacity ) : numElements( 0 ) { if ( newCapacity > localCapacity ) { capacity = newCapacity; array = util::allocate<T>( newCapacity ); } else { capacity = localCapacity; array = (T*)localStorage; } } /// Create a new short array list with its internal array initialized with element from an external array. /** * The initial capacity and size of the short array list is set to the number of * elements that are to be copied from the given array. * * @param elements - an array of contiguous element objects from which to initialize this short array list. * @param newNumElements - the number of elements to copy from the element array. */ RIM_INLINE ShortArrayList( const T* elements, Size newNumElements ) : numElements( newNumElements ) { if ( newNumElements > localCapacity ) { capacity = newNumElements; array = util::allocate<T>( newNumElements ); } else { capacity = localCapacity; array = (T*)localStorage; } copyObjects( array, elements, numElements ); } /// Create a copy of an existing short array list. This is a deep copy. RIM_INLINE ShortArrayList( const ShortArrayList& other ) : numElements( other.numElements ) { if ( numElements > localCapacity ) { capacity = other.capacity; array = util::allocate<T>( capacity ); } else { capacity = localCapacity; array = (T*)localStorage; } copyObjects( array, other.array, numElements ); } /// Create a copy of an existing short array list. This is a deep copy. template < Size otherLocalCapacity > RIM_INLINE ShortArrayList( const ShortArrayList<T,otherLocalCapacity>& other ) : numElements( other.numElements ) { if ( numElements > localCapacity ) { capacity = other.capacity; array = util::allocate<T>( capacity ); } else { capacity = localCapacity; array = (T*)localStorage; } copyObjects( array, other.array, numElements ); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Destructor /// Destroy this short array list, releasing all internal state. RIM_INLINE ~ShortArrayList() { // Call the destructors of all objects that were constructed. callDestructors( array, numElements ); // Deallocate the internal array if necessary. if ( array != (T*)localStorage ) util::deallocate( array ); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Assignment Operator /// Assign the contents of one short array list to another, copying all elements. RIM_NO_INLINE ShortArrayList& operator = ( const ShortArrayList& other ); /// Assign the contents of one short array list to another, copying all elements. template < Size otherLocalCapacity > RIM_NO_INLINE ShortArrayList<T,localCapacity>& operator = ( const ShortArrayList<T,otherLocalCapacity>& other ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Equality Operators /// Return whether or not whether every entry in this list is equal to another list's entries. template < Size otherLocalCapacity > RIM_INLINE Bool operator == ( const ShortArrayList<T,otherLocalCapacity>& other ) const { // If the arraylists point to the same data, they are equal. if ( array == other.array ) return true; else if ( numElements != other.numElements ) return false; // Do an element-wise comparison otherwise. const T* a = array; const T* b = other.array; const T* const aEnd = a + numElements; while ( a != aEnd ) { if ( !(*a == *b) ) return false; a++; b++; } return true; } /// Return whether or not whether any entry in this list is not equal to another list's entries. template < Size otherLocalCapacity > RIM_INLINE Bool operator != ( const ShortArrayList<T,otherLocalCapacity>& other ) const { return !(*this == other); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Add Methods /// Add an element to the end of the list. /** * If the capacity of the short array list is not great enough to hold * the new element, then the internal array is reallocated to be * double the size and all elements are copied to the new array. * * @param newElement - the new element to add to the end of the list */ RIM_INLINE void add( const T& newElement ) { if ( numElements == capacity ) doubleCapacity(); new (array + numElements) T( newElement ); numElements++; } /// Add the contents of one ShortArrayList to another. /** * This method has the effect of adding each element of * the given list to the end of this short array list in order. * * @param list - the list to be added to the end of this list */ template < Size otherLocalCapacity > RIM_INLINE void addAll( const ShortArrayList<T,otherLocalCapacity>& list ) { // resize the internal array if necessary. if ( numElements + list.numElements > capacity ) doubleCapacityUpTo( numElements + list.numElements ); ShortArrayList<T,localCapacity>::copyObjects( array + numElements, list.array, list.numElements ); numElements += list.numElements; } /// Add the contents of the specified array pointer to the end of the list. /** * This method has the effect of adding each element of * the given list to the end of this short array list in order. * * @param list - the list to be added to the end of this list */ RIM_INLINE void addAll( const T* array, Size number ) { // resize the internal array if necessary. if ( numElements + number > capacity ) doubleCapacityUpTo( numElements + number ); ShortArrayList<T,localCapacity>::copyObjects( array + numElements, number, number ); numElements += number; } /// Insert an element at the specified index of the list. /** * The method returns TRUE if the element was successfully inserted * into the short array list. If the index is outside of the bounds of the * short array list, then FALSE is returned, indicating that the element * was not inserted. If needed, the short array list is resized to double * its current size in order to hold the new element. This method * has time complexity of O(n/2) because all subsequent elements in * the short array list have to be moved towards the end of the list by one * index. * * @param newElement - the new element to insert into the short array list. * @param index - the index at which to insert the new element. * @return whether or not the element was successfully inserted into the short array list. */ Bool insert( Index index, const T& newElement ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Set Method /// Set an element at the specified index of the list to a new value. /** * This method returns TRUE if the specified index is within the bounds * of the short array list, indicating that the element was successfully set * at that position in the short array list. Otherwise, FALSE is returned, * indicating that the index was out of bounds of the short array list. This * method has worst-case time complexity of O(1). * * @param newElement - the new element to set in the list. * @param index - the index at which to set the new element. * @return whether or not the element was successfully set to the new value. */ RIM_INLINE Bool set( Index index, const T& newElement ) { if ( index < numElements ) { // destroy the old element. array[index].~T(); // replace it with the new element. new (array + index) T(newElement); return true; } else return false; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Remove Methods /// Remove the element at the specified index, ordered version. /** * If the index is within the bounds of the list ( >= 0 && < getSize() ), * then the list element at that index is removed and TRUE is returned, * indicating that the remove operation was successful. * Otherwise, FALSE is returned and the list * is unaffected. The order of the list is unaffected, meaning that * all of the elements after the removed element must be copied one * index towards the beginning of the list. This gives the method * an average case performance of O(n/2) where n is the number of * elements in the short array list. * * @param index - the index of the list element to remove. * @return whether or not the element was successfully removed. */ RIM_INLINE Bool removeAtIndex( Index index ) { if ( index < numElements ) { // shift all elements forward in the array one index. numElements--; // Destroy the element to be removed. array[index].~T(); // Move the objects to fill the hole in the array. ShortArrayList<T,localCapacity>::moveObjects( array + index, array + index + 1, numElements - index ); return true; } else return false; } /// Remove the element at the specified index, unordered version. /** * If the index is within the bounds of the list ( >= 0 && < getSize() ), * then the list element at that index is removed and TRUE is returned, * indicating that the remove operation was successful. * Otherwise, FALSE is returned and the list is unaffected. * The order of the list is affected when this method * successfully removes the element. It works by replacing the element * at the index to be removed with the last element in the list. This * gives the method a worst case time complexity of O(1), which is * much faster than the ordered remove methods. * * @param index - the index of the list element to remove. * @return whether or not the element was successfully removed. */ RIM_INLINE Bool removeAtIndexUnordered( Index index ) { if ( index < numElements ) { numElements--; // Destroy the element to be removed. T* destination = array + index; destination->~T(); // Replace it with the last element if necessary. if ( index != numElements ) { T* source = array + numElements; new (destination) T(*source); source->~T(); } return true; } else return false; } /// Remove the first element equal to the parameter element, ordered version. /** * If this element is found, then it is removed and TRUE * is returned. Otherwise, FALSE is returned and the list is unaffected. * The order of the list is unaffected, meaning that all of the elements after * the removed element must be copied one index towards the beginning * of the list. This gives the method an average case performance * of O(n) where n is the number of elements in the short array list. This * method's complexity is worse than the ordered index remove method * because it must search through the list for the element and then * copy all subsequent elements one position nearer to the start of the * list. * * @param element - the list element to remove the first instance of. * @return whether or not the element was successfully removed. */ RIM_INLINE Bool remove( const T& object ) { const T* const end = array + numElements; for ( T* element = array; element != end; element++ ) { if ( *element == object ) { numElements--; // Destroy the element to be removed. element->~T(); // Move the objects to fill the hole in the array. ShortArrayList<T,localCapacity>::moveObjects( element, element + 1, end - element - 1 ); return true; } } return false; } /// Remove the first element equal to the parameter element, unordered version. /** * If this element is found, then it is removed and TRUE * is returned. Otherwise, FALSE is returned and the list is unaffected. * The order of the list is affected when this method * successfully removes the element. It works by replacing the element * at the index to be removed with the last element in the list. This * gives the method a worst case time complexity of O(n), which is * much faster than the ordered remove methods (O(n^2)). * * @param object - the list element to remove the first instance of. * @return whether or not the element was successfully removed. */ RIM_INLINE Bool removeUnordered( const T& object ) { const T* const end = array + numElements; for ( T* element = array; element != end; element++ ) { if ( *element == object ) { numElements--; // Destroy the element to be removed. element->~T(); const T* last = array + numElements; // Replace it with the last element if possible. if ( element != last ) { new (element) T(*last); last->~T(); } return true; } } return false; } /// Remove the last element in the short array list. /** * If the short array list has elements remaining in it, then * the last element in the short array list is removed and TRUE is returned. * If the short array list has no remaining elements, then FALSE is returned, * indicating that the list was unchanged. This method has worst * case O(1) time complexity. * * @return whether or not the last element was successfully removed. */ RIM_INLINE Bool removeLast() { if ( numElements != Size(0) ) { numElements--; // destroy the last element. array[numElements].~T(); return true; } else return false; } /// Remove the last N elements from the short array list. /** * If the short array list has at least N elements remaining in it, then * the last N elements in the short array list are removed and N is returned. * If the short array list has less than N elements, then the list will be * completely cleared, resulting in an empty list. The method returns the * number of elements successfully removed. * * @return the number of elements removed from the end of the list. */ RIM_INLINE Size removeLast( Size number ) { number = numElements > number ? number : numElements; numElements -= number; // destroy the elements that were removed. ShortArrayList<T,localCapacity>::callDestructors( array + numElements, number ); return number; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Clear Methods /// Clear the contents of this short array list. /** * This method calls the destructors of all elements in the short array list * and sets the number of elements to zero while maintaining the * array's capacity. */ RIM_INLINE void clear() { if ( array != NULL ) ShortArrayList<T,localCapacity>::callDestructors( array, numElements ); numElements = Size(0); } /// Clear the contents of this short array list and reclaim the allocated memory. /** * This method performs the same function as the clear() method, but * also deallocates the previously allocated internal array and reallocates * it to an small initial starting size. Calling this method is equivalent * to assigning a brand new short array list instance to this one. */ RIM_INLINE void reset() { if ( array != NULL ) util::destructArray( array, numElements ); capacity = Size(0); array = NULL; numElements = Size(0); } /// Clear the contents of this short array list and reclaim the allocated memory. /** * This method performs the same function as the clear() method, but * also deallocates the previously allocated internal array and reallocates * it to a small initial starting size. Calling this method is equivalent * to assigning a brand new short array list instance to this one. This version of * the reset() method allows the caller to specify the new starting * capacity of the short array list. */ RIM_INLINE void reset( Size newCapacity ) { if ( array != NULL ) util::destructArray( array, numElements ); capacity = newCapacity; array = util::allocate<T>( capacity ); numElements = Size(0); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Contains Method /// Return whether or not the specified element is in this list. /** * The method has average case O(n/2) time complexity, where * n is the number of elements in the short array list. This method * is here for convenience. It just calls the short array list's * getIndex() method, and tests to see if the return value is * not equal to -1. It is recommended that if one wants the * index of the element as well as whether or not it is contained * in the list, they should use the getIndex() method exclusively, * and check the return value to make sure that the element is in the * list. This avoids the double O(n/2) lookup that would be performed * one naively called this method and then that method. * * @param element - the element to check to see if it is contained in the list. * @return whether or not the specified element is in the list. */ RIM_INLINE Bool contains( const T& object ) const { T* element = array; const T* const end = array + numElements; while ( element != end ) { if ( *element == object ) return true; element++; } return false; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Element Find Method /// Get the index of the element equal to the parameter object. /** * If the specified element is not found within the list, * then FALSE is returned. Otherwise, FALSE is returned and the index of * the element in the list is placed in the output index parameter. * * @param element - the element to find in the short array list. * @param index - a reference to the variable in which to place the index. * @return TRUE if the object was found, FALSE otherwise. */ RIM_INLINE Bool getIndex( const T& object, Index& index ) const { T* element = array; const T* const end = array + numElements; while ( element != end ) { if ( *element == object ) { index = element - array; return true; } element++; } return false; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Element Accessor Methods /// Return the element at the specified index. /** * If the specified index is not within the valid bounds * of the short array list, then an exception is thrown indicating * an index out of bounds error occurred. This is the non-const version * of the get() method, allowing modification of the element. * * @param index - the index of the desired element. * @return a const reference to the element at the index specified by the parameter. */ RIM_INLINE T& get( Index index ) { RIM_DEBUG_ASSERT_MESSAGE( index < numElements, "Cannot access invalid index in short array list." ); return array[index]; } /// Return the element at the specified index. /** * If the specified index is not within the valid bounds * of the short array list, then an exception is thrown indicating * an index out of bounds error occurred. This is the const version * of the get() method, disallowing modification of the element. * * @param index - the index of the desired element. * @return a const reference to the element at the index specified by the parameter. */ RIM_INLINE const T& get( Index index ) const { RIM_DEBUG_ASSERT( index < numElements ); return array[index]; } /// Return a reference to the first element in the short array list. RIM_INLINE T& getFirst() { RIM_DEBUG_ASSERT( numElements != Size(0) ); return *array; } /// Return a const reference to the first element in the short array list. RIM_INLINE const T& getFirst() const { RIM_DEBUG_ASSERT( numElements != Size(0) ); return *array; } /// Return a reference to the last element in the short array list. RIM_INLINE T& getLast() { RIM_DEBUG_ASSERT( numElements != Size(0) ); return *(array + numElements - 1); } /// Return a const reference to the last element in the short array list. RIM_INLINE const T& getLast() const { RIM_DEBUG_ASSERT( numElements != Size(0) ); return *(array + numElements - 1); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Element Accessor Operators /// Return the element at the specified index. /** * If the specified index is not within the valid bounds * of the short array list, then an exception is thrown indicating * an index out of bounds error occurred. This is the const version * of the operator (), disallowing modification of the element. * * @param index - the index of the desired element. * @return a const reference to the element at the index specified by the parameter. */ RIM_INLINE T& operator () ( Index index ) { RIM_DEBUG_ASSERT( index < numElements ); return array[index]; } /// Return the element at the specified index. /** * If the specified index is not within the valid bounds * of the short array list, then an exception is thrown indicating * an index out of bounds error occurred. This is the const version * of the operator (), disallowing modification of the element. * * @param index - the index of the desired element. * @return a const reference to the element at the index specified by the parameter. */ RIM_INLINE const T& operator () ( Index index ) const { RIM_DEBUG_ASSERT( index < numElements ); return array[index]; } /// Return the element at the specified index. /** * If the specified index is not within the valid bounds * of the short array list, then an exception is thrown indicating * an index out of bounds error occurred. * * @param index - the index of the desired element. * @return a const reference to the element at the index specified by the parameter. */ RIM_INLINE T& operator [] ( Index index ) { RIM_DEBUG_ASSERT( index < numElements ); return array[index]; } /// Return the element at the specified index. /** * If the specified index is not within the valid bounds * of the short array list, then an exception is thrown indicating * an index out of bounds error occurred. This is the const version * of the operator [], disallowing modification of the element. * * @param index - the index of the desired element. * @return a const reference to the element at the index specified by the parameter. */ RIM_INLINE const T& operator [] ( Index index ) const { RIM_DEBUG_ASSERT( index < numElements ); return array[index]; } /// Return a const pointer to the beginning of the internal array. RIM_INLINE const T* getPointer() const { return array; } /// Return a pointer to the beginning of the internal array. RIM_INLINE T* getPointer() { return array; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Size Accessor Methods /// Return whether or not the short array list has any elements. /** * This method returns TRUE if the size of the short array list * is greater than zero, and FALSE otherwise. * This method is here for convenience. * * @return whether or not the short array list has any elements. */ RIM_INLINE Bool isEmpty() const { return numElements == Size(0); } /// Get the number of elements in the short array list. /** * @return the number of elements in the short array list. */ RIM_INLINE Size getSize() const { return numElements; } /// Get the current capacity of the short array list. /** * The capacity is the maximum number of elements that the * short array list can hold before it will have to resize its * internal array. * * @return the current capacity of the short array list. */ RIM_INLINE Size getCapacity() const { return capacity; } /// Set the capacity of the short array list. /** * The capacity is the maximum number of elements that the * short array list can hold before it will have to resize its * internal array. The capacity of the short array list is set to * the specified value unless this value is smaller than the * number of elements in the short array list. If so, the capacity * remains unchanged. * * @param newCapacity the desired capacity of the short array list. */ RIM_INLINE void setCapacity( Size newCapacity ) { if ( newCapacity < localCapacity || newCapacity < numElements || newCapacity == 0 ) return; else resize( newCapacity ); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Iterator Class /// Iterator class for an short array list. /** * The purpose of this class is to iterate through all * or some of the elements in the short array list, making changes as * necessary to the elements. */ class Iterator { public: //******************************************** // Constructor /// Create a new ShortArrayList iterator from a reference to a list. RIM_INLINE Iterator( ShortArrayList<T,localCapacity>& newList ) : list( newList ), current( newList.array ), end( newList.array + newList.numElements ) { } //******************************************** // Public Methods /// Prefix increment operator. RIM_INLINE void operator ++ () { RIM_DEBUG_ASSERT_MESSAGE( current < end, "Cannot increment short array list iterator past end of list." ); current++; } /// Postfix increment operator. RIM_INLINE void operator ++ ( int ) { RIM_DEBUG_ASSERT_MESSAGE( current < end, "Cannot increment short array list iterator past end of list." ); current++; } /// Return whether or not the iterator is at the end of the list. /** * If the iterator is at the end of the list, return FALSE. * Otherwise, return TRUE, indicating that there are more * elements to iterate over. * * @return FALSE if at the end of list, otherwise TRUE. */ RIM_INLINE operator Bool () const { return current < end; } /// Return a reference to the current iterator element. RIM_INLINE T& operator * () { return *current; } /// Access the current iterator element. RIM_INLINE T* operator -> () { return current; } /// Remove the current element from the list. /** * This method calls the removeAtIndex() method of the * iterated short array list, and therefore has an average * time complexity of O(n/2) where n is the size of the * short array list. */ RIM_INLINE void remove() { list.removeAtIndex( getIndex() ); current = current == list.array ? current : current - 1; end--; } /// Remove the current element from the list. /** * This method calls the removeAtIndexUnordered() method of the * iterated short array list, and therefore has an average * time complexity of O(1). */ RIM_INLINE void removeUnordered() { list.removeAtIndexUnordered( getIndex() ); current = current == list.array ? current : current - 1; end--; } /// Reset the iterator to the beginning of the list. RIM_INLINE void reset() { current = list.array; end = current + list.numElements; } /// Get the index of the next element to be iterated over. RIM_INLINE Index getIndex() { return current - list.array; } private: //******************************************** // Private Data Members /// The current position of the iterator T* current; /// A pointer to one element past the end of the list. const T* end; /// The list that is being iterated over. ShortArrayList<T,localCapacity>& list; /// Make the const iterator class a friend. friend class ShortArrayList<T,localCapacity>::ConstIterator; }; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** ConstIterator Class /// An iterator class for an short array list which can't modify it. /** * The purpose of this class is to iterate through all * or some of the elements in the short array list. */ class ConstIterator { public: //******************************************** // Constructor /// Create a new ShortArrayList iterator from a reference to a list. RIM_INLINE ConstIterator( const ShortArrayList<T,localCapacity>& newList ) : list( newList ), current( newList.array ), end( newList.array + newList.numElements ) { } /// Create a new const short array list iterator from a non-const iterator. RIM_INLINE ConstIterator( const Iterator& iterator ) : list( iterator.list ), current( iterator.current ), end( iterator.end ) { } //******************************************** // Public Methods /// Prefix increment operator. RIM_INLINE void operator ++ () { current++; } /// Postfix increment operator. RIM_INLINE void operator ++ ( int ) { current++; } /// Return whether or not the iterator is at the end of the list. /** * If the iterator is at the end of the list, return FALSE. * Otherwise, return TRUE, indicating that there are more * elements to iterate over. * * @return FALSE if at the end of list, otherwise TRUE. */ RIM_INLINE operator Bool () const { return current < end; } /// Return a const-reference to the current iterator element. RIM_INLINE const T& operator * () const { return *current; } /// Access the current iterator element. RIM_INLINE const T* operator -> () const { return current; } /// Reset the iterator to the beginning of the list. RIM_INLINE void reset() { current = list.array; end = current + list.numElements; } /// Get the index of the next element to be iterated over. RIM_INLINE Index getIndex() const { return current - list.array; } private: //******************************************** // Private Data Members /// The current position of the iterator const T* current; /// A pointer to one element past the end of the list. const T* end; /// The list that is being iterated over. const ShortArrayList<T,localCapacity>& list; }; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Iterator Creation Methods /// Return an iterator for the short array list. /** * The iterator serves to provide a way to efficiently iterate * over the elements of the short array list. It is more useful for * a linked list type of data structure, but it is provided for * uniformity among data structures. * * @return an iterator for the short array list. */ RIM_INLINE Iterator getIterator() { return Iterator(*this); } /// Return a const iterator for the short array list. /** * The iterator serves to provide a way to efficiently iterate * over the elements of the short array list. It is more useful for * a linked list type of data structure, but it is provided for * uniformity among data structures. * * @return an iterator for the short array list. */ RIM_INLINE ConstIterator getIterator() const { return ConstIterator(*this); } private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Methods /// Double the capacity of this short array list's internal array of objects. RIM_INLINE void doubleCapacity() { resize( capacity << 1 ); } /// Double the capacity of this short array list's internal array until it is larger than the specified capacity. RIM_INLINE void doubleCapacityUpTo( Size minimumCapacity ) { Size newCapacity = capacity; while ( newCapacity < minimumCapacity ) newCapacity <<= 1; resize( newCapacity ); } RIM_NO_INLINE void resize( Size newCapacity ); static void callDestructors( T* array, Size number ); static void copyObjects( T* destination, const T* source, Size number ); static void moveObjects( T* destination, T* source, Size number ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Members /// A pointer to the array containing all elements in the short array list. T* array; /// The number of elements in the short array list. Size numElements; /// The size of the array in this short array list. Size capacity; /// A local array of bytes used to store short lists of elements. UByte localStorage[localCapacity*sizeof(T)]; }; template < typename T, Size localCapacity > Bool ShortArrayList<T,localCapacity>:: insert( Index index, const T& newElement ) { if ( index <= numElements ) { if ( numElements == capacity ) doubleCapacity(); T* destination = array + numElements; const T* source = array + numElements - 1; const T* const sourceEnd = array + index - 1; while ( source != sourceEnd ) { new (destination) T(*source); source->~T(); source--; destination--; } new (array + index) T( newElement ); numElements++; return true; } else return false; } template < typename T, Size localCapacity > void ShortArrayList<T,localCapacity>:: resize( Size newCapacity ) { // Allocate a new array to hold the new array list. T* newArray = util::allocate<T>( newCapacity ); // Copy objects from the old array if it has any. ShortArrayList<T,localCapacity>::moveObjects( newArray, array, numElements ); // Deallocate the old array if necessary if ( array != (T*)localStorage ) util::deallocate( array ); array = newArray; capacity = newCapacity; } template < typename T, Size localCapacity > void ShortArrayList<T,localCapacity>:: callDestructors( T* array, Size number ) { const T* const arrayEnd = array + number; while ( array != arrayEnd ) { array->~T(); array++; } } template < typename T, Size localCapacity > void ShortArrayList<T,localCapacity>:: copyObjects( T* destination, const T* source, Size number ) { const T* const sourceEnd = source + number; while ( source != sourceEnd ) { new (destination) T(*source); destination++; source++; } } template < typename T, Size localCapacity > void ShortArrayList<T,localCapacity>:: moveObjects( T* destination, T* source, Size number ) { const T* const sourceEnd = source + number; while ( source != sourceEnd ) { // copy the object from the source to destination new (destination) T(*source); // call the destructors on the source source->~T(); destination++; source++; } } template < typename T, Size localCapacity > ShortArrayList<T,localCapacity>& ShortArrayList<T,localCapacity>:: operator = ( const ShortArrayList<T,localCapacity>& other ) { if ( this != &other ) { // Call the destructors of all objects that were constructed. callDestructors( array, numElements ); numElements = other.numElements; if ( numElements > capacity ) { // Deallocate the internal array if necessary. if ( array != (T*)localStorage ) util::deallocate( array ); // Allocate a new array. capacity = other.capacity; array = util::allocate<T>( capacity ); } // copy the elements from the other ShortArrayList. copyObjects( array, other.array, numElements ); } return *this; } template < typename T, Size localCapacity1 > template < Size localCapacity2 > ShortArrayList<T,localCapacity1>& ShortArrayList<T,localCapacity1>:: operator = ( const ShortArrayList<T,localCapacity2>& other ) { if ( this != &other ) { // Call the destructors of all objects that were constructed. callDestructors( array, numElements ); numElements = other.numElements; if ( numElements > capacity ) { // Deallocate the internal array if necessary. if ( array != (T*)localStorage ) util::deallocate( array ); // Allocate a new array. capacity = other.capacity; array = util::allocate<T>( capacity ); } // copy the elements from the other ShortArrayList. copyObjects( array, other.array, numElements ); } return *this; } //########################################################################################## //*************************** End Rim Utilities Namespace ******************************** RIM_UTILITIES_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_SHORT_ARRAY_LIST_H <file_sep>/* * rimGraphicsGUIOptionMenu.h * Rim Graphics GUI * * Created by <NAME> on 2/18/13. * Copyright 2013 Headspace Systems. All rights reserved. * */ #ifndef INCLUDE_RIM_GRAPHICS_GUI_OPTION_MENU_H #define INCLUDE_RIM_GRAPHICS_GUI_OPTION_MENU_H #include "rimGraphicsGUIBase.h" #include "rimGraphicsGUIObject.h" #include "rimGraphicsGUIOptionMenuDelegate.h" #include "rimGraphicsGUIMenu.h" //########################################################################################## //************************ Start Rim Graphics GUI Namespace ****************************** RIM_GRAPHICS_GUI_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class which allows the user to select from a list of options using a menu. /** * Each item is represented by a MenuItem. */ class OptionMenu : public GUIObject { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructors /// Create a new option menu with no width or height positioned at the origin. OptionMenu(); /// Create a new empty option menu which occupies the specified rectangular region. OptionMenu( const Rectangle& newRectangle ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Item Accessor Methods /// Return the total number of items that are part of this option menu. RIM_INLINE Size getItemCount() const { return menu.getItemCount(); } /// Return a pointer to the item at the specified index in this option menu. RIM_INLINE const Pointer<MenuItem>& getItem( Index itemIndex ) const { return menu.getItem( itemIndex ); } /// Add the specified item to this option menu. /** * If the specified item pointer is NULL, the method fails and FALSE * is returned. Otherwise, the item is appended to the end of the menu * and TRUE is returned. */ RIM_INLINE Bool addItem( const Pointer<MenuItem>& newItem ) { if ( newItem.isNull() || newItem->getType() == MenuItem::MENU ) return false; return menu.addItem( newItem ); } /// Insert the specified item at the given index in this option menu. /** * If the specified item pointer is NULL, the method fails and FALSE * is returned. Otherwise, the item is inserted at the given index in the menu * and TRUE is returned. */ RIM_INLINE Bool insertItem( Index itemIndex, const Pointer<MenuItem>& newItem ) { if ( newItem.isNull() || newItem->getType() == MenuItem::MENU ) return false; return menu.insertItem( itemIndex, newItem ); } /// Replace the specified item at the given index in this option menu. /** * If the specified item pointer is NULL or if the item has an invalid type, * the method fails and FALSE is returned. Otherwise, the item is inserted * at the given index in the menu and TRUE is returned. */ RIM_INLINE Bool setItem( Index itemIndex, const Pointer<MenuItem>& newItem ) { if ( newItem.isNull() || newItem->getType() == MenuItem::MENU ) return false; return menu.setItem( itemIndex, newItem ); } /// Remove the specified item from this option menu. /** * If the given item is part of this menu, the method removes it * and returns TRUE. Otherwise, if the specified item is not found, * the method doesn't modify the menu and FALSE is returned. */ Bool removeItem( const MenuItem* oldItem ) { return menu.removeItem( oldItem ); } /// Remove the item at the specified index from this option menu. /** * If the specified index is invalid, FALSE is returned and the Menu * is unaltered. Otherwise, the item at that index is removed and * TRUE is returned. */ RIM_INLINE Bool removeItemAtIndex( Index itemIndex ) { return menu.removeItemAtIndex( itemIndex ); } /// Remove all items from this option menu. RIM_INLINE void clearItems() { menu.clearItems(); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Selected Menu Index Accesor Methods /// Return the index of the currently highlighted item in this option menu. /** * If there is no currently highlighted item, -1 is returned. */ RIM_INLINE Int getHighlightedItemIndex() const { return menu.getHighlightedItemIndex(); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Item Padding Accessor Methods /// Return the padding amount between each item in this option menu. RIM_INLINE Float getItemPadding() const { return menu.getItemPadding(); } /// Set the padding amount between each item in this option menu. RIM_INLINE void setItemPadding( Float newPadding ) { menu.setItemPadding( newPadding ); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Selected Item Index Accesor Methods /// Return the index of the currently selected item in this menu. /** * If there is no currently selected item, -1 is returned. */ RIM_INLINE Int getSelectedItemIndex() const { return selectedItemIndex; } /// Set the index of the currently selected item in this menu. /** * If an invalid index is specified, such as -1, the selected item is cleared. */ RIM_INLINE void setSelectedItemIndex( Int newSelectedItemIndex ) { if ( newSelectedItemIndex < -1 || newSelectedItemIndex >= (Int)menu.getItemCount() ) selectedItemIndex = -1; else selectedItemIndex = newSelectedItemIndex; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Menu Status Accessor Methods /// Return whether or not this option menu is currently open, with the popup menu showing. RIM_INLINE Bool getIsOpen() const { return isOpen; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Menu Accessor Methods /// Return a const reference to the menu object for this option menu. /** * This method is provided primarily so that renderers can access the menu * to draw it. The returned object should not be modified directly. */ RIM_INLINE const Menu& getMenu() const { return menu; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Border Accessor Methods /// Return a mutable object which describes this option menu's border. RIM_INLINE Border& getBorder() { return border; } /// Return an object which describes this option menu's border. RIM_INLINE const Border& getBorder() const { return border; } /// Set an object which describes this option menu's border. RIM_INLINE void setBorder( const Border& newBorder ) { border = newBorder; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Delegate Accessor Methods /// Return a reference to the delegate which responds to events for this option menu. RIM_INLINE OptionMenuDelegate& getDelegate() { return delegate; } /// Return a reference to the delegate which responds to events for this option menu. RIM_INLINE const OptionMenuDelegate& getDelegate() const { return delegate; } /// Return a reference to the delegate which responds to events for this option menu. RIM_INLINE void setDelegate( const OptionMenuDelegate& newDelegate ) { delegate = newDelegate; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Color Accessor Methods /// Return the background color for this option menu's main area. RIM_INLINE const Color4f& getBackgroundColor() const { return backgroundColor; } /// Set the background color for this option menu's main area. RIM_INLINE void setBackgroundColor( const Color4f& newBackgroundColor ) { backgroundColor = newBackgroundColor; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Border Color Accessor Methods /// Return the border color used when rendering a option menu. RIM_INLINE const Color4f& getBorderColor() const { return borderColor; } /// Set the border color used when rendering a option menu. RIM_INLINE void setBorderColor( const Color4f& newBorderColor ) { borderColor = newBorderColor; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Text Style Accessor Methods /// Return a reference to the font style which is used to render the text for a option menu. RIM_INLINE const FontStyle& getTextStyle() const { return textStyle; } /// Set the font style which is used to render the text for a option menu. RIM_INLINE void setTextStyle( const FontStyle& newTextStyle ) { textStyle = newTextStyle; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Drawing Method /// Draw this option menu using the specified GUI renderer to the given parent coordinate system bounds. /** * The method returns whether or not the option menu was successfully drawn. */ virtual Bool drawSelf( GUIRenderer& renderer, const AABB3f& parentBounds ) const; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Input Handling Methods /// Handle the specified keyboard event for the entire option menu. virtual void keyEvent( const KeyboardEvent& event ); /// Handle the specified mouse motion event for the entire option menu. virtual void mouseMotionEvent( const MouseMotionEvent& event ); /// Handle the specified mouse button event for the entire option menu. virtual void mouseButtonEvent( const MouseButtonEvent& event ); /// Handle the specified mouse wheel event for the entire option menu. virtual void mouseWheelEvent( const MouseWheelEvent& event ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Static Construction Methods /// Construct a smart-pointer-wrapped instance of this class using the constructor with the given arguments. RIM_INLINE static Pointer<OptionMenu> construct() { return Pointer<OptionMenu>::construct(); } /// Construct a smart-pointer-wrapped instance of this class using the constructor with the given arguments. RIM_INLINE static Pointer<OptionMenu> construct( const Rectangle& newRectangle ) { return Pointer<OptionMenu>::construct( newRectangle ); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Public Static Data Members /// The default border that is used for an option menu. static const Border DEFAULT_BORDER; /// The default background color that is used for an option menu's area. static const Color4f DEFAULT_BACKGROUND_COLOR; /// The default border color that is used for an option menu. static const Color4f DEFAULT_BORDER_COLOR; /// The default color for the down arrow for an option menu. static const Color4f DEFAULT_ARROW_COLOR; /// The default color for the down arrow divider line for an option menu. static const Color4f DEFAULT_DIVIDER_COLOR; private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Helper Methods /// Return the bounding box of the child menu of this option menu in its local coordinate frame. RIM_INLINE AABB2f getLocalMenuBounds() const { const Vector3f& menuSize = menu.getSize(); return AABB2f( Float(0), menuSize.x, -menuSize.y, Float(0) ); } /// Change whether or not the option menu's popup menu is open, sending any necessary delegate events. void setIsOpen( Bool newIsOpen ); /// A callback method called when a menu item is selected. void selectMenuItem( Menu& menu, Index itemIndex ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Members /// The menu object which is used to implement most of the option menu functionality. Menu menu; /// An object which describes the border for this option menu. Border border; /// An object which contains function pointers that respond to option menu events. OptionMenuDelegate delegate; /// The index of the currently selected menu item, or -1 if there is no selected item. Int selectedItemIndex; /// The background color for the option menu's area. Color4f backgroundColor; /// The border color for the option menu's background area. Color4f borderColor; /// The color for the down arrow image for this option menu. Color4f arrowColor; /// The color for the down arrow divider line for this option menu. Color4f dividerColor; /// An object which determines the style of the text for this option menu's items. FontStyle textStyle; /// The image of a downward arrow which is used when rendering an option menu. Pointer<GUIImage> downArrowImage; /// A boolean value indicating whether or not this option menu is currently open. Bool isOpen; /// A boolean value indicating whether or not the user has clicked the option menu with the mouse. Bool mousePressed; }; //########################################################################################## //************************ End Rim Graphics GUI Namespace ******************************** RIM_GRAPHICS_GUI_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_GRAPHICS_GUI_OPTION_MENU_H <file_sep>/* * rimGraphicsGUIButton.h * Rim Graphics GUI * * Created by <NAME> on 1/29/13. * Copyright 2013 Headspace Systems. All rights reserved. * */ #ifndef INCLUDE_RIM_GRAPHICS_GUI_BUTTON_H #define INCLUDE_RIM_GRAPHICS_GUI_BUTTON_H #include "rimGraphicsGUIBase.h" #include "rimGraphicsGUIObject.h" #include "rimGraphicsGUIFonts.h" #include "rimGraphicsGUIButtonDelegate.h" #include "rimGraphicsGUIButtonType.h" //########################################################################################## //************************ Start Rim Graphics GUI Namespace ****************************** RIM_GRAPHICS_GUI_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class which represents a rectangular region that can be clicked on to perform an action. class Button : public GUIObject { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructors /// Create a new sizeless button with no text label and positioned at the origin of its coordinate system. Button(); /// Create a new button which occupies the specified rectangle with no text label. Button( const Rectangle& newRectangle ); /// Create a new button which occupies the specifieid rectangle with the given label text. Button( const Rectangle& newRectangle, const UTF8String& newText ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Text Accessor Methods /// Return a reference to a string representing the text label of this button. RIM_INLINE const UTF8String& getText() const { return text; } /// Set a string representing the text label of this button. RIM_INLINE void setText( const UTF8String& newText ) { text = newText; } /// Return a reference to a string representing the text label of this button when it is selected. RIM_INLINE const UTF8String& getAlternateText() const { return alternateText; } /// Set a string representing the text label of this button when it is selected. RIM_INLINE void setAlternateText( const UTF8String& newAlternateText ) { alternateText = newAlternateText; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Text Alignment Accessor Methods /// Return an object which describes how this button's text is aligned within the button's bounds. RIM_INLINE const Origin& getTextAlignment() const { return textAlignment; } /// Set an object which describes how this button's text is aligned within the button's bounds. RIM_INLINE void setTextAlignment( const Origin& newTextAlignment ) { textAlignment = newTextAlignment; } /// Set an object which describes how this button's text is aligned within the button's bounds. RIM_INLINE void setTextAlignment( Origin::XOrigin newXOrigin, Origin::YOrigin newYOrigin ) { textAlignment = Origin( newXOrigin, newYOrigin ); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Text Visibility Accessor Methods /// Return a boolean value indicating whether or not this button's text label is displayed. RIM_INLINE Bool getTextIsVisible() const { return textIsVisible; } /// Set a boolean value indicating whether or not this button's text label is displayed. RIM_INLINE void setTextIsVisible( Bool newTextIsVisible ) { textIsVisible = newTextIsVisible; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Image Accessor Methods /// Return a reference to the image which is displayed in the button's content area when in its normal state. RIM_INLINE const Pointer<GUIImage>& getImage() const { return image; } /// Set the image which is displayed in the button's content area when in its normal state. RIM_INLINE void setImage( const Pointer<GUIImage>& newImage ) { image = newImage; } /// Return a reference to the image which is displayed in the button's content area when in its alternate state. RIM_INLINE const Pointer<GUIImage>& getAlternateImage() const { return alternateImage; } /// Set the image which is displayed in the button's content area when in its alternate state. RIM_INLINE void setAlternateImage( const Pointer<GUIImage>& newAlternateImage ) { alternateImage = newAlternateImage; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Image Alignment Accessor Methods /// Return an object which describes how this button's image is aligned within the button's bounds. RIM_INLINE const Origin& getImageAlignment() const { return imageAlignment; } /// Set an object which describes how this button's image is aligned within the button's bounds. RIM_INLINE void setImageAlignment( const Origin& newImageAlignment ) { imageAlignment = newImageAlignment; } /// Set an object which describes how this button's image is aligned within the button's bounds. RIM_INLINE void setImageAlignment( Origin::XOrigin newXOrigin, Origin::YOrigin newYOrigin ) { imageAlignment = Origin( newXOrigin, newYOrigin ); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Image Visibility Accessor Methods /// Return a boolean value indicating whether or not this button's image is displayed. RIM_INLINE Bool getImageIsVisible() const { return imageIsVisible; } /// Set a boolean value indicating whether or not this button's image is displayed. RIM_INLINE void setImageIsVisible( Bool newImageIsVisible ) { imageIsVisible = newImageIsVisible; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Button State Accessor Methods /// Return whether or not this button is currently active. /** * An enabled button (the default) can be interacted with by the user * and is displayed normally. A disabled button can't be pressed by the * user and displays more transparently, indicating its state. */ RIM_INLINE Bool getIsEnabled() const { return isEnabled; } /// Set whether or not this button is currently active. /** * An enabled button (the default) can be interacted with by the user * and is displayed normally. A disabled button can't be pressed by the * user and displays more transparently, indicating its state. */ RIM_INLINE void setIsEnabled( Bool newIsEnabled ) { isEnabled = newIsEnabled; } /// Return whether or not this button is currently selected (in its alternate state). /** * When a button is selected, its alternate text and image will be displayed * instead of the normal text or image. */ RIM_INLINE Bool getIsSelected() const { return isSelected; } /// Set whether or not this button is currently selected (in its alternate state). /** * When a button is selected, its alternate text and image will be displayed * instead of the normal text or image. */ RIM_INLINE void setIsSelected( Bool newIsSelected ) { isSelected = newIsSelected; } /// Return whether or not this button is currently pressed by the user. /** * If this method returns TRUE, the user is currently pressing the button * but has not yet released the button. Depending on the type of button * different actions will be taken after the button is released. */ RIM_INLINE Bool getIsPressed() const { return isPressed; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Button Type Accessor Methods /// Return an object which represents the type of this button. RIM_INLINE ButtonType getType() const { return type; } /// Return an object which represents the type of this button. RIM_INLINE void setType( ButtonType newType ) { type = newType; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Border Accessor Methods /// Return a mutable object which describes this button's border. RIM_INLINE Border& getBorder() { return border; } /// Return an object which describes this button's border. RIM_INLINE const Border& getBorder() const { return border; } /// Set an object which describes this button's border. RIM_INLINE void setBorder( const Border& newBorder ) { border = newBorder; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Content Bounding Box Accessor Methods /// Return the 3D bounding box for the button's content display area in its local coordinate frame. RIM_INLINE AABB3f getLocalContentBounds() const { return AABB3f( this->getLocalContentBoundsXY(), AABB1f( Float(0), this->getSize().z ) ); } /// Return the 2D bounding box for the button's content display area in its local coordinate frame. RIM_INLINE AABB2f getLocalContentBoundsXY() const { return border.getContentBounds( AABB2f( Vector2f(), this->getSizeXY() ) ); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Background Color Accessor Methods /// Return the background color for this button's main area. RIM_INLINE const Color4f& getBackgroundColor() const { return backgroundColor; } /// Set the background color for this button's main area. RIM_INLINE void setBackgroundColor( const Color4f& newBackgroundColor ) { backgroundColor = newBackgroundColor; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Border Color Accessor Methods /// Return the border color used when rendering a button. RIM_INLINE const Color4f& getBorderColor() const { return borderColor; } /// Set the border color used when rendering a button. RIM_INLINE void setBorderColor( const Color4f& newBorderColor ) { borderColor = newBorderColor; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Alternate Color Accessor Methods /// Return the alternate color for this button's main area. /** * This is the color of the button when it is pressed. */ RIM_INLINE const Color4f& getAlternateColor() const { return alternateColor; } /// Set the alternate color for this button's main area. /** * This is the color of the button when it is pressed. */ RIM_INLINE void setAlternateColor( const Color4f& newAlternateColor ) { alternateColor = newAlternateColor; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Style Accessor Methods /// Return a reference to the font style which is used to render the text for a button. RIM_INLINE const FontStyle& getTextStyle() const { return textStyle; } /// Set the font style which is used to render the text for a button. RIM_INLINE void setTextStyle( const FontStyle& newTextStyle ) { textStyle = newTextStyle; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Drawing Method /// Draw this object using the specified GUI renderer to the given parent coordinate system bounds. /** * The method returns whether or not the object was successfully drawn. * * The default implementation draws nothing and returns TRUE. */ virtual Bool drawSelf( GUIRenderer& renderer, const AABB3f& parentBounds ) const; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Input Handling Methods /// Handle the specified keyboard event that occured when this object had focus. virtual void keyEvent( const KeyboardEvent& event ); /// Handle the specified mouse motion event that occurred. virtual void mouseMotionEvent( const MouseMotionEvent& event ); /// Handle the specified mouse button event that occurred. virtual void mouseButtonEvent( const MouseButtonEvent& event ); /// Handle the specified mouse wheel event that occurred. virtual void mouseWheelEvent( const MouseWheelEvent& event ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Delegate Accessor Methods /// Return a reference to the delegate which responds to events for this button. RIM_INLINE ButtonDelegate& getDelegate() { return delegate; } /// Return a reference to the delegate which responds to events for this button. RIM_INLINE const ButtonDelegate& getDelegate() const { return delegate; } /// Return a reference to the delegate which responds to events for this button. RIM_INLINE void setDelegate( const ButtonDelegate& newDelegate ) { delegate = newDelegate; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Static Construction Methods /// Construct a smart-pointer-wrapped instance of this class using the constructor with the given arguments. RIM_INLINE static Pointer<Button> construct() { return Pointer<Button>::construct(); } /// Construct a smart-pointer-wrapped instance of this class using the constructor with the given arguments. RIM_INLINE static Pointer<Button> construct( const Rectangle& newRectangle ) { return Pointer<Button>::construct( newRectangle ); } /// Construct a smart-pointer-wrapped instance of this class using the constructor with the given arguments. RIM_INLINE static Pointer<Button> construct( const Rectangle& newRectangle, const UTF8String& newText ) { return Pointer<Button>::construct( newRectangle, newText ); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Public Static Data Members /// The default border that is used for a button. static const Border DEFAULT_BORDER; /// The default alignment that is used for a button's text label. static const Origin DEFAULT_TEXT_ALIGNMENT; /// The default background color that is used for a button's area. static const Color4f DEFAULT_BACKGROUND_COLOR; /// The default border color that is used for a button. static const Color4f DEFAULT_BORDER_COLOR; /// The default color that is used for a button's background when it is pressed. static const Color4f DEFAULT_ALTERNATE_COLOR; private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Members /// A string representing the text label of this button. UTF8String text; /// A string representing the text label of this button when it is selected. UTF8String alternateText; /// An image which is displayed within the content rectangle of this button. Pointer<GUIImage> image; /// An image which is displayed within the content rectangle of this button when it is selected. Pointer<GUIImage> alternateImage; /// An object which describes how this button's text is aligned within the button. Origin textAlignment; /// An object which describes how this button's image is aligned within the button. Origin imageAlignment; /// An object which describes the border of this button. Border border; /// An object which contains function pointers that respond to button events. ButtonDelegate delegate; /// An object which represents the type of this button. ButtonType type; /// The background color for the button's main area. Color4f backgroundColor; /// The border color for the button. Color4f borderColor; /// The alternate color for the button when it is pressed. Color4f alternateColor; /// An object which determines the style of the text contained by this button. FontStyle textStyle; /// A boolean value indicating whether or not this button's text label is visible. Bool textIsVisible; /// A boolean value indicating whether or not this button's image is visible. Bool imageIsVisible; /// A boolean value which indicates whether or not this button is currently pressed. Bool isPressed; /// A boolean value which indicates whether or not this button is currently selected. Bool isSelected; /// A boolean value indicating whether or not this button is enabled and able to be pressed by the user. Bool isEnabled; }; //########################################################################################## //************************ End Rim Graphics GUI Namespace ******************************** RIM_GRAPHICS_GUI_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_GRAPHICS_GUI_BUTTON_H <file_sep>/* * rimGraphicsTextureFilterType.h * Rim Graphics * * Created by <NAME> on 12/21/10. * Copyright 2010 Rim Software. All rights reserved. * */ #ifndef INCLUDE_RIM_GRAPHICS_TEXTURE_FILTER_TYPE_H #define INCLUDE_RIM_GRAPHICS_TEXTURE_FILTER_TYPE_H #include "rimGraphicsTexturesConfig.h" //########################################################################################## //********************** Start Rim Graphics Textures Namespace *************************** RIM_GRAPHICS_TEXTURES_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class which specifies how texture should be magnified or reduced in size. /** * This class allows the user to specify the basic filter type used to decrease * or increase the size of a texture, as well as a floating-point anisotropy * level. This anisotropy level indicates how much anisotropic filtering can be done. */ class TextureFilterType { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Public Enum Declaration /// An enum type which represents the different texture filtering types. typedef enum Enum { /// A nearest-neighbor filter type. The closest texel is chosen without any interpolation. /** * This filter type is generally undesireable because it will produce blocky artifacts * when used to enlarge a texture and will produce texture 'sparkling' when used * to reduce a texture's size. */ NEAREST, /// A linear filter type. The final texel is computed from a linear interpolation of the nearest texels. /** * This filter type produces smooth texel interpolation when used for texture magnification. * This filter type is undesirable for texture minification because it produces * 'sparkling' artifacts because no mip-maps are used. */ LINEAR, /// A linear filter type. The final texel is computed from a linear interpolation of the nearest texels in the nearest mipmap level. /** * This filter type should not be used for texture magnification (it is needless overkill, use LINEAR instead). * This filter type produces better results for texture minification than LINEAR, but * still produces artifacts where mip-map levels change. */ BILINEAR, /// A linear filter type. The final texel is computed from a linear interpolation of the nearest texels in the nearest two mipmap levels. /** * This filter type should not be used for texture magnification (it is needless overkill, use LINEAR instead). * This filter type produces better results for texture minification than LINEAR or BILINEAR. * Texture mip-map levels are smoothly interpolated between, resulting in the smoothest kind * of texture filtering. */ TRILINEAR, /// An undefined type of textuer filtering. UNDEFINED }; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructors /// Create a new UNDEFINED texture filter type. RIM_INLINE TextureFilterType() : type( UNDEFINED ), anisotropy( 1.0f ) { } /// Create a new texture filter type with the specified filter type and default anisotropy of 1.0 RIM_INLINE TextureFilterType( Enum newType ) : type( newType ), anisotropy( 1.0f ) { } /// Create a new texture filter type with the specified filter type and anisotropy. RIM_INLINE TextureFilterType( Enum newType, Float newAnisotropy ) : type( newType ), anisotropy( newAnisotropy ) { } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Enum Cast Operator /// Convert this texture filter type to an enum value. RIM_INLINE operator Enum () const { return type; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Anisotropy Accessor Methods /// Get the maximum level of anisotropy which this texture filter type should use. RIM_INLINE Float getAnisotropy() const { return anisotropy; } /// Set the maximum level of anisotropy which this texture filter type should use. RIM_INLINE void setAnisotropy( Float newAnisotropy ) { anisotropy = newAnisotropy; } /// Return the maximum texture filter anisotropy allowed by the graphics implementation. static Float getMaxAnisotropy(); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** String Representation Accessor Methods /// Return a unique string for this texture filter type that matches its enum value name. String toEnumString() const; /// Return a texture filter type which corresponds to the given enum string. static TextureFilterType fromEnumString( const String& enumString ); /// Return a string representation of the texture filter type. String toString() const; /// Convert this texture filter type into a string representation. RIM_INLINE operator String () const { return this->toString(); } private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Members /// An enum for the texture filter type. Enum type; /// The maximum level of anisotropy which this texture filter type should use. Float anisotropy; }; //########################################################################################## //********************** End Rim Graphics Textures Namespace ***************************** RIM_GRAPHICS_TEXTURES_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_GRAPHICS_TEXTURE_FILTER_TYPE_H <file_sep>/* * rimGUIInputMouseButton.h * Rim GUI * * Created by <NAME> on 1/30/08. * Copyright 2008 __MyCompanyName__. All rights reserved. * */ #ifndef INCLUDE_RIM_GUI_INPUT_MOUSE_BUTTON_H #define INCLUDE_RIM_GUI_INPUT_MOUSE_BUTTON_H #include "rimGUIInputConfig.h" //########################################################################################## //************************ Start Rim GUI Input Namespace *************************** RIM_GUI_INPUT_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class representing a mouse button. /** * There are several possible types of mouse buttons and they are accessed * as public static members of the mouse button class. Each button is uniquely * idenfitifed by an integer button code and has a name. User-defined mouse button * types can also be created. * * This class also provides statically-defined MouseButton objects that encompass * most types of mouse buttons. These objects can be queried directly as public * static members or by hash table key code lookup. */ class MouseButton { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Public Type Definitions /// The type to use for a mouse button code. typedef UInt Code; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructors /// Create a new mouse button with the specified code and name as a string. RIM_INLINE MouseButton( Code buttonCode, const String& buttonName ) : code( buttonCode ), name( buttonName ) { } /// Create a new mouse button with the specified code and name as a character array. RIM_INLINE MouseButton( Code buttonCode, const Char* buttonName ) : code( buttonCode ), name( buttonName ) { } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Mouse Button Code and Name Accessors /// Get a string representing the button's name. RIM_INLINE const String& toString() const { return name; } /// Get a string representing the button's name. RIM_INLINE const String& getName() const { return name; } /// Get an integer code representing the mouse button. RIM_INLINE Code getCode() const { return code; } /// Get a hash code for the mouse button. RIM_INLINE Hash getHashCode() const { return (Hash)code; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Equality Comparison Operators /// Test whether or not this button is equal to another. (compares button code) RIM_INLINE Bool operator == ( const MouseButton& button ) const { return code == button.code ; } /// Test whether or not this button is not equal to another. (compares button code) RIM_INLINE Bool operator != ( const MouseButton& button ) const { return code != button.code ; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Static Mouse Button Accessors /// Get a reference to a mouse button, based on it's button code (an integer). RIM_INLINE static const MouseButton& getButtonWithCode( Code buttonCode ) { if ( !buttonDataStructuresAreInitialized ) initializeButtonDataStructures(); const MouseButton** button; if ( buttonMap.find( (Hash)buttonCode, buttonCode, button ) ) return **button; else return UNKNOWN; } /// Get a reference of an array list of all predefined mouse buttons RIM_INLINE static const ArrayList<const MouseButton*>& getButtons() { if ( !buttonDataStructuresAreInitialized ) initializeButtonDataStructures(); return buttons; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Statically Defined Mouse Buttons /// Unknown mouse button (used as a catch-all) static const MouseButton UNKNOWN; /// Left mouse button. static const MouseButton LEFT; /// Middle mouse button. static const MouseButton MIDDLE; /// Right mouse button. static const MouseButton RIGHT; private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Static Key Data Structure Initializer Methods /// Add the specified mouse button to the static mouse button data structures. RIM_NO_INLINE static void addButtonToDataStructures( const MouseButton& button ) { buttons.add( &button ); buttonMap.add( (Hash)button.getCode(), button.getCode(), &button ); } /// Initialize the data structures used for mouse button lookup. static void initializeButtonDataStructures(); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Members /// An integer button code serving as a uniqued identifier for the button. Code code; /// A string representing the name of the button String name; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Static Data Members /// A static hash map mapping integer button codes to mouse button pointer. static HashMap<Code,const MouseButton*> buttonMap; /// A static array list which contains all possible mouse buttons. static ArrayList<const MouseButton*> buttons; /// Whether or not the static mouse button data structures have been initialized. static Bool buttonDataStructuresAreInitialized; }; //########################################################################################## //************************ End Rim GUI Input Namespace ***************************** RIM_GUI_INPUT_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_GUI_INPUT_MOUSE_BUTTON_H <file_sep>/* * rimGraphicsObjectCuller.h * Rim Graphics * * Created by <NAME> on 12/5/09. * Copyright 2009 Rim Software. All rights reserved. * */ #ifndef INCLUDE_RIM_GRAPHICS_OBJECT_CULLER_H #define INCLUDE_RIM_GRAPHICS_OBJECT_CULLER_H #include "rimGraphicsObjectsConfig.h" #include "rimGraphicsObject.h" //########################################################################################## //************************ Start Rim Graphics Objects Namespace ************************** RIM_GRAPHICS_OBJECTS_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class interface which determines which objects in a scene are visible to cameras and lights. /** * This class keeps an internal set of objects that it queries for visibility. * * Typically, a class implementing this interface will have data structures * that speed up the O(n) problem of determining which objects intersect any given * bounding sphere, bounding cone, or view volume. */ class ObjectCuller { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Destructor /// Destroy this object culler. virtual ~ObjectCuller() { } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Visibile Object Query Methods /// Add a pointer to each object that intersects the specified bounding sphere to the output list. virtual void getIntersectingObjects( const BoundingSphere& sphere, ArrayList< Pointer<GraphicsObject> >& outputList ) const = 0; /// Add a pointer to each object that intersects the specified bounding cone to the output list. virtual void getIntersectingObjects( const BoundingCone& cone, ArrayList< Pointer<GraphicsObject> >& outputList ) const = 0; /// Add a pointer to each object that intersects the specified view volume to the output list. virtual void getIntersectingObjects( const ViewVolume& viewVolume, ArrayList< Pointer<GraphicsObject> >& outputList ) const = 0; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Visibile Mesh Chunk Query Methods /// Add each object's mesh chunks that intersect the specified camera's view volume to the output list. virtual void getIntersectingChunks( const Camera& camera, const ViewVolume* viewVolume, const Vector2D<Size>& viewportSize, const GraphicsObjectFlags& requiredFlags, ArrayList<MeshChunk>& outputList ) const = 0; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Update Method /// Update the bounding volumes of all objects that are part of this object culler and any spatial data structures. virtual void update() = 0; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Object Accessor Methods /// Return the number of objects that are in this object culler. virtual Size getObjectCount() const = 0; /// Return whether or not this object culler contains the specified object. virtual Bool containsObject( const Pointer<GraphicsObject>& object ) const = 0; /// Add the specified object to this object culler. virtual Bool addObject( const Pointer<GraphicsObject>& object ) = 0; /// Remove the specified object from this object culler and return whether or not it was removed. virtual Bool removeObject( const Pointer<GraphicsObject>& object ) = 0; /// Remove all objects from this object culler. virtual void clearObjects() = 0; }; //########################################################################################## //************************ End Rim Graphics Objects Namespace **************************** RIM_GRAPHICS_OBJECTS_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_GRAPHICS_OBJECT_CULLER_H <file_sep>/* * rimGraphicsShadersConfig.h * Rim Graphics * * Created by <NAME> on 11/28/11. * Copyright 2011 __MyCompanyName__. All rights reserved. * */ #ifndef INCLUDE_RIM_GRAPHICS_SHADERS_CONFIG_H #define INCLUDE_RIM_GRAPHICS_SHADERS_CONFIG_H #include "../rimGraphicsConfig.h" #include "../rimGraphicsUtilities.h" #include "../rimGraphicsTextures.h" #include "../rimGraphicsBuffers.h" #include "../devices/rimGraphicsContextObject.h" //########################################################################################## //########################################################################################## //############ //############ Library Namespace Configuration //############ //########################################################################################## //########################################################################################## #ifndef RIM_GRAPHICS_SHADERS_NAMESPACE_START #define RIM_GRAPHICS_SHADERS_NAMESPACE_START RIM_GRAPHICS_NAMESPACE_START namespace shaders { #endif #ifndef RIM_GRAPHICS_SHADERS_NAMESPACE_END #define RIM_GRAPHICS_SHADERS_NAMESPACE_END }; RIM_GRAPHICS_NAMESPACE_END #endif //########################################################################################## //*********************** Start Rim Graphics Shaders Namespace *************************** RIM_GRAPHICS_SHADERS_NAMESPACE_START //****************************************************************************************** //########################################################################################## using rim::graphics::util::AttributeType; using rim::graphics::util::AttributeValue; using rim::graphics::util::RenderMode; using rim::graphics::util::RenderFlags; using rim::graphics::textures::Texture; using rim::graphics::textures::GenericTexture; using rim::graphics::textures::TextureFormat; using rim::graphics::textures::TextureUsage; using rim::graphics::textures::TextureType; using rim::graphics::buffers::GenericBuffer; using rim::graphics::buffers::VertexBuffer; using rim::graphics::buffers::VertexUsage; using rim::graphics::devices::ContextObject; /// A type which represents the location of a shader variable within a linked shader program. typedef UInt32 ShaderVariableLocation; //########################################################################################## //*********************** End Rim Graphics Shaders Namespace ***************************** RIM_GRAPHICS_SHADERS_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_GRAPHICS_SHADERS_CONFIG_H <file_sep>/* * rimGraphicsPerspectiveCamera.h * Rim Graphics * * Created by <NAME> on 9/7/09. * Copyright 2009 Rim Software. All rights reserved. * */ #ifndef INCLUDE_RIM_GRAPHICS_PERSPECTIVE_CAMERA_H #define INCLUDE_RIM_GRAPHICS_PERSPECTIVE_CAMERA_H #include "rimGraphicsCamerasConfig.h" #include "rimGraphicsCamera.h" //########################################################################################## //*********************** Start Rim Graphics Cameras Namespace *************************** RIM_GRAPHICS_CAMERAS_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class which represents a camera which uses a perspective projection transformation. class PerspectiveCamera : public Camera { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructors /// Create a perspective camera with the specified aspect ratio. PerspectiveCamera( Real aspectRatio = Real(1) ); /// Create a perspective camera with the specified aspect ratio, position and orientation. PerspectiveCamera( Real aspectRatio, const Vector3& newPosition, const Matrix3& newOrientation ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Field of View Accessor Methods /// Get the horizontal field of view of the camera's view frustum. /** * This value is specified in degrees. */ RIM_INLINE Real getHorizontalFieldOfView() const { return horizontalFieldOfView; } /// Set the horizontal field of view of the camera's view frustum. /** * This value, specified in degrees, is clamped between 0 and 180. */ RIM_INLINE void setHorizontalFieldOfView( Real newHorizontalFieldOfView ) { horizontalFieldOfView = math::clamp( newHorizontalFieldOfView, Real(0), Real(180) ); horizontalSlope = math::tan( Real(0.5)*math::degreesToRadians( horizontalFieldOfView ) ); } /// Get the vertical field of view of the camera's view frustum. /** * This value is specified in degrees. */ RIM_INLINE Real getVerticalFieldOfView() const { Real nearWidth = nearPlaneDistance*math::tan( math::degreesToRadians( horizontalFieldOfView*Real(0.5) ) ); Real nearHeight = nearWidth / aspectRatio; return math::radiansToDegrees( math::atan( nearHeight/nearPlaneDistance ) ); } /// Get the vertical field of view of the camera's view frustum. /** * This value, specified in degrees, is clamped between 0 and 180. */ RIM_INLINE void setVerticalFieldOfView( Real newVerticalFieldOfView ) { newVerticalFieldOfView = math::clamp( newVerticalFieldOfView, Real(0), Real(180) ); Real nearHeight = nearPlaneDistance*math::tan( math::degreesToRadians( newVerticalFieldOfView*Real(0.5) ) ); Real nearWidth = nearHeight * aspectRatio; horizontalFieldOfView = math::radiansToDegrees( math::atan( nearWidth/nearPlaneDistance ) ); horizontalSlope = math::tan( Real(0.5)*math::degreesToRadians( horizontalFieldOfView ) ); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Aspect Ratio Accessor Methods /// Return the aspect ratio of this perspective camera (the ratio of the frustum's width to its height). /** * The default aspect ratio is 1. */ RIM_INLINE Real getAspectRatio() const { return aspectRatio; } /// Set the aspect ratio of this perspective camera (the ratio of the frustum's width to its height). /** * The default aspect ratio is 1. */ RIM_INLINE void setAspectRatio( Real newAspectRatio ) { aspectRatio = math::abs( newAspectRatio ); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Transform Matrix Accessor Methods /// Get a matrix which projects points in camera space onto the near plane of the camera. virtual Matrix4 getProjectionMatrix() const; /// Return a depth-biased projection matrix for this camera for the given depth and bias distance. virtual Matrix4 getDepthBiasProjectionMatrix( Real depth, Real bias ) const; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** View Volume Accessor Method /// Return an object specifying the volume of this camera's view. virtual ViewVolume getViewVolume() const; /// Compute the 8 corners of this camera's view volume and place them in the output array. virtual void getViewVolumeCorners( StaticArray<Vector3,8>& corners ) const; /// Return whether or not the specified direction is within the camera's field of view. virtual Bool canViewDirection( const Vector3f& direction ) const; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Screen-Space Size Accessor Methods /// Return the screen-space radius in pixels of the specified world-space bounding sphere. virtual Real getScreenSpaceRadius( const BoundingSphere& sphere ) const; /// Return the distance to the center of the specified bounding sphere along the view direction. virtual Real getDepth( const Vector3f& position ) const; private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Helper Methods /// Return a projection matrix for the specified viewing plane distances. RIM_FORCE_INLINE static Matrix4 perspectiveProjection( Real left, Real right, Real bottom, Real top, Real near, Real far ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Members /// The horizontal field of view of the camera's viewing frustum. Real horizontalFieldOfView; /// The ratio of a change in the width of the view frustum to a change in depth, i.e. tan( 0.5*horizFOV ). /** * Mulitplying this value by a screen-space depth value gives the width of the frustum at that depth. */ Real horizontalSlope; /// The aspect ratio of this perspective camera (the ratio of the frustum's width to its height). /** * The default aspect ratio is 1. */ Real aspectRatio; }; //########################################################################################## //*********************** End Rim Graphics Cameras Namespace ***************************** RIM_GRAPHICS_CAMERAS_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_GRAPHICS_PERSPECTIVE_CAMERA_H <file_sep>/* * rimGraphicsGenericSphereShape.h * Rim Software * * Created by <NAME> on 2/2/14. * Copyright 2014 __MyCompanyName__. All rights reserved. * */ #ifndef INCLUDE_RIM_GRAPHICS_GENERIC_SPHERE_SHAPE_H #define INCLUDE_RIM_GRAPHICS_GENERIC_SPHERE_SHAPE_H #include "rimGraphicsShapesConfig.h" #include "rimGraphicsShapeBase.h" //########################################################################################## //*********************** Start Rim Graphics Shapes Namespace **************************** RIM_GRAPHICS_SHAPES_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class which represents a generic sphere shape. /** * A sphere is specified by a position and radius, and has an associated * material for use in drawing. */ class GenericSphereShape : public GraphicsShapeBase<GenericSphereShape> { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructors /// Create a sphere shape for the given graphics context centered at the origin with a radius of 1. RIM_INLINE GenericSphereShape() : radius( 1 ) { } /// Create a sphere shape for the given graphics context centered at the origin with the specified radius. RIM_INLINE GenericSphereShape( Real newRadius ) : radius( math::max( newRadius, Real(0) ) ) { } /// Create a sphere shape for the given graphics context with the specified position and radius. RIM_INLINE GenericSphereShape( const Vector3& newPosition, Real newRadius ) : radius( math::max( newRadius, Real(0) ) ) { this->setPosition( newPosition ); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Radius Accessor Methods /// Get the radius of this sphere shape in local coordinates. RIM_INLINE Real getRadius() const { return radius; } /// Set the radius of this sphere shape in local coordinates. /** * The radius is clamed to the range of [0,+infinity). */ RIM_INLINE void setRadius( Real newRadius ) { radius = math::max( newRadius, Real(0) ); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Material Accessor Methods /// Get the material of this generic sphere shape. RIM_INLINE Pointer<GenericMaterial>& getMaterial() { return material; } /// Get the material of this generic sphere shape. RIM_INLINE const Pointer<GenericMaterial>& getMaterial() const { return material; } /// Set the material of this generic sphere shape. RIM_INLINE void setMaterial( const Pointer<GenericMaterial>& newMaterial ) { material = newMaterial; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Bounding Box Update Method /// Update the shape's bounding box based on its current geometric representation. virtual void updateBoundingBox() { setLocalBoundingBox( AABB3( Vector3(-radius), Vector3(radius) ) ); } private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Members /// The radius of this sphere in shape-coordinates. Real radius; /// A pointer to the material to use when rendering this generic sphere shape. Pointer<GenericMaterial> material; }; //########################################################################################## //*********************** End Rim Graphics Shapes Namespace ****************************** RIM_GRAPHICS_SHAPES_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_GRAPHICS_GENERIC_SPHERE_SHAPE_H <file_sep>/* * rimPhysicsCollisionShapeBox.h * Rim Physics * * Created by <NAME> on 6/6/12. * Copyright 2012 __MyCompanyName__. All rights reserved. * */ #ifndef INCLUDE_RIM_PHYSICS_COLLISION_SHAPE_BOX_H #define INCLUDE_RIM_PHYSICS_COLLISION_SHAPE_BOX_H #include "rimPhysicsShapesConfig.h" #include "rimPhysicsCollisionShape.h" #include "rimPhysicsCollisionShapeBase.h" #include "rimPhysicsCollisionShapeInstance.h" //########################################################################################## //************************ Start Rim Physics Shapes Namespace **************************** RIM_PHYSICS_SHAPES_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class which represents a rectangular collision shape. class CollisionShapeBox : public CollisionShapeBase<CollisionShapeBox> { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Public Class Declarations class Instance; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructors /// Create a default box centered at the origin with width, height, and depth = 1. CollisionShapeBox(); /// Create a default box centered at the origin with the specified width, height, and depth. CollisionShapeBox( Real newWidth, Real newHeight, Real newDepth ); /// Create a box at the specified position and orientation with the specified sizes. CollisionShapeBox( const Vector3& newPosition, const Matrix3& newOrientation, Real newWidth, Real newHeight, Real newDepth ); /// Create a box at the specified position and orientation with the specified sizes and material, CollisionShapeBox( const Vector3& newPosition, const Matrix3& newOrientation, Real newWidth, Real newHeight, Real newDepth, const CollisionShapeMaterial& newMaterial ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Position Accessor Methods /// Return a const reference to the position of this box's center. RIM_FORCE_INLINE const Vector3& getPosition() const { return position; } /// Set the position of this box's center. RIM_INLINE void setPosition( const Vector3& newPosition ) { position = newPosition; updateBoundingSphere(); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Orientation Accessor Methods /// Return a const reference to the orientation of this box in its enclosing coordinate frame. /** * This orientation is specified by a 3x3 rotation matrix where each * column vector indicates the positive direction of the box's local * coordinate frame. Thus, each column vector is the normal or antinormal * for the faces in that direction. */ RIM_FORCE_INLINE const Matrix3& getOrientation() const { return orientation; } /// Set the orientation of this box in its enclosing coordinate frame. /** * This orientation is specified by a 3x3 rotation matrix where each * column vector indicates the positive direction of the box's local * coordinate frame. Thus, each column vector is the normal or antinormal * for the faces in that direction. */ RIM_INLINE void setOrientation( const Matrix3& newOrientation ) { orientation = newOrientation.orthonormalize(); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Size Accessor Methods /// Return a const reference to a 3D vector indicating the size of this box's dimensions. /** * The x coordinate indicates the box's local width, y is the local height, * and z is the local depth of the box. */ RIM_FORCE_INLINE const Vector3& getSize() const { return size; } /// Set a 3D vector indicating the size of this box's dimensions. /** * The x coordinate indicates the box's local width, y is the local height, * and z is the local depth of the box. */ RIM_INLINE void setSize( const Vector3& newSize ) { size.x = math::max( newSize.x, Real(0) ); size.y = math::max( newSize.y, Real(0) ); size.z = math::max( newSize.z, Real(0) ); updateBoundingSphere(); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Width Accessor Methods /// Return the width of this box (x dimension) in its local coordinate frame. RIM_FORCE_INLINE Real getWidth() const { return size.x; } /// Set the width of this box (x dimension) in its local coordinate frame. RIM_INLINE void setWidth( Real newWidth ) { size.x = math::max( newWidth, Real(0) ); updateBoundingSphere(); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Height Accessor Methods /// Return the height of this box (x dimension) in its local coordinate frame. RIM_FORCE_INLINE Real getHeight() const { return size.y; } /// Set the height of this box (x dimension) in its local coordinate frame. RIM_INLINE void setHeight( Real newHeight ) { size.y = math::max( newHeight, Real(0) ); updateBoundingSphere(); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Depth Accessor Methods /// Return the depth of this box (x dimension) in its local coordinate frame. RIM_FORCE_INLINE Real getDepth() const { return size.z; } /// Set the depth of this box (x dimension) in its local coordinate frame. RIM_INLINE void setDepth( Real newDepth ) { size.z = math::max( newDepth, Real(0) ); updateBoundingSphere(); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Mass Distribution Accessor Methods /// Return a 3x3 matrix for the inertia tensor of this shape relative to its center of mass. virtual Matrix3 getInertiaTensor() const; /// Return a 3D vector representing the center-of-mass of this shape in its coordinate frame. virtual Vector3 getCenterOfMass() const; /// Return the volume of this shape in length units cubed (m^3). virtual Real getVolume() const; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Instance Creation Methods /// Create and return an instance of this shape. virtual Pointer<CollisionShapeInstance> getInstance() const; private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Helper Methods /// Recalculate this cylinder's bounding sphere from the current cylinder description. RIM_INLINE void updateBoundingSphere() { this->setBoundingSphere( BoundingSphere( position, Real(0.5)*size.getMagnitude() ) ); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Members /// The position of the center of this box. Vector3 position; /// A 3x3 rotation matrix representing the orientation of this box. Matrix3 orientation; /// A 3-component vector containing the sizes for this box along each dimension. Vector3 size; }; //########################################################################################## //########################################################################################## //############ //############ Sphere Shape Instance Class Definition //############ //########################################################################################## //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class which is used to instance a CollisionShapeBox object with an arbitrary rigid transformation. class CollisionShapeBox:: Instance : public CollisionShapeInstance { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Transform Update Method /// Update this box instance with the specified 3D rigid transformation from shape to world space. virtual void setTransform( const Transform3& newTransform ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Attribute Accessor Methods /// Return a const reference to the position of this box's center in world space. RIM_FORCE_INLINE const Vector3& getPosition() const { return position; } /// Return a const reference to the orientation of this box in world space. /** * This orientation is specified by a 3x3 rotation matrix where each * column vector indicates the positive direction of the box's local * coordinate frame. Thus, each column vector is the normal or antinormal * for the faces in that direction. */ RIM_FORCE_INLINE const Matrix3& getOrientation() const { return orientation; } /// Return a const reference to a 3D vector indicating the size of this box's dimensions. /** * The x coordinate indicates the box's local width, y is the local height, * and z is the local depth of the box. */ RIM_FORCE_INLINE const Vector3& getSize() const { return size; } /// Return the width of this box (x dimension) in its local coordinate frame. RIM_FORCE_INLINE Real getWidth() const { return size.x; } /// Return the height of this box (x dimension) in its local coordinate frame. RIM_FORCE_INLINE Real getHeight() const { return size.y; } /// Return the depth of this box (x dimension) in its local coordinate frame. RIM_FORCE_INLINE Real getDepth() const { return size.z; } private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Constructors /// Create a new box shape instance which uses the specified base box shape. RIM_INLINE Instance( const CollisionShapeBox* newBox ) : CollisionShapeInstance( newBox ) { } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Members /// The position of the center of this box. Vector3 position; /// A 3x3 rotation matrix representing the orientation of this box. Matrix3 orientation; /// A 3-component vector containing the sizes for this box along each dimension. Vector3 size; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Friend Declarations /// Declare the box collision shape as a friend so that it can construct instances. friend class CollisionShapeBox; }; //########################################################################################## //************************ End Rim Physics Shapes Namespace ****************************** RIM_PHYSICS_SHAPES_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_PHYSICS_COLLISION_SHAPE_BOX_H <file_sep>/* * rimSoundStreamPlayer.h * Rim Sound * * Created by <NAME> on 7/31/12. * Copyright 2012 __MyCompanyName__. All rights reserved. * */ #ifndef INCLUDE_RIM_SOUND_STREAM_PLAYER_H #define INCLUDE_RIM_SOUND_STREAM_PLAYER_H #include "rimSoundFiltersConfig.h" #include "rimSoundFilter.h" //########################################################################################## //************************ Start Rim Sound Filters Namespace ***************************** RIM_SOUND_FILTERS_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class that handles complex playback of a streaming sound source. /** * This class takes a pointer to a SoundInputStream and can then play the sound * provided by that stream. The player supports basic start-to-stop playback, looping * playback (if the stream allows it), and continuous playback from an infinite stream. */ class StreamPlayer : public SoundFilter, public SoundInputStream { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructors /// Create a default sound stream player without any stream to play. /** * The constructed object will not produce any output until it has a * valid SoundInputStream. */ StreamPlayer(); /// Create a sound stream player which plays from the specified sound input stream. /** * If the supplied stream is NULL or invalid, the stream player produces no output. * All playback and looping occurs relative to the initial position * within the stream. */ StreamPlayer( const Pointer<SoundInputStream>& newStream ); /// Create a copy of this stream player and its state. StreamPlayer( const StreamPlayer& other ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Destructor /// Destroy a sound stream player and release all resources associated with it. ~StreamPlayer(); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Assignment Operator /// Assign the state of one sound stream player to another. StreamPlayer& operator = ( const StreamPlayer& other ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Stream Accessor Methods /// Return a const pointer to the SoundInputStream which is being used as a sound source. /** * If there is no sound input stream set or if the stream is not valid, a NULL * pointer is returned, indicating the problem. */ const SoundInputStream* getStream() const; /// Set the SoundInputStream which this player should use as a sound source. /** * If the supplied pointer is NULL, the sound player is deactivated and doesn't * produce any more audio. Otherwise, the player resets its current playback * position to be the start of the sound and starts playback from the current position * of the stream. Thus, all playback and looping occurs relative to the initial position * within the stream. */ void setStream( const Pointer<SoundInputStream>& newStream ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Playback Accessor Methods /// Return whether or not this sound player is current playing. Bool isPlaying() const; /// Set whether or not this sound player should be playing sound. /** * The method returns whether or not playback will occurr, based on the type * of SoundInputStream which this player has and the requested playback * state. */ Bool setIsPlaying( Bool newIsPlaying ); /// Tell the sound player to start playing the sound from the current position. /** * The method returns whether or not playback will occurr, based on the type * of SoundInputStream that this player has. */ Bool play(); /// Stop playing the sound and keep the playhead at the last position. void stop(); /// Reset the playback position to the first position within the stream. /** * The method returns whether or not the rewind operation was successul. * For SoundInputStream objects that don't allow seeking, this method * will always fail. This method does not affect the playback state of the * player, thus rewinding will cause the playback to jump to the beginning * of the stream if the player is currently playing. */ Bool rewind(); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Looping Accessor Methods /// Return whether or not this sound player is currently looping. /** * If the underlying SoundInputStream for the sound player does not allow * seeking within the stream, looping cannot occur. */ Bool isLooping() const; /// Set whether or not this sound player should try to loop its sound source. /** * If the underlying SoundInputStream for the sound player does not allow * seeking within the stream, looping cannot occur. Otherwise, the sound player * loops the sound if the looping flag is set to TRUE. * * The method returns whether or not looping will occurr, based on the type * of SoundInputStream which this player is playing. This value is independent * of the current playback state of the player. */ Bool setIsLooping( Bool newIsLooping ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Public Seek Status Accessor Methods /// Return whether or not seeking is allowed in this input stream. virtual Bool canSeek() const; /// Return whether or not this input stream's current position can be moved by the specified signed sample offset. virtual Bool canSeek( Int64 relativeSampleOffset ) const; /// Move the current sample frame position in the stream by the specified signed amount. virtual Int64 seek( Int64 relativeSampleOffset ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Stream Size Accessor Methods /// Return the number of samples remaining in the sound input stream. /** * The value returned must only be a lower bound on the total number of sample * frames in the stream. For instance, if there are samples remaining, the method * should return at least 1. If there are no samples remaining, the method should * return 0. This behavior is allowed in order to support never-ending streams * which might not have a defined endpoint. */ virtual SoundSize getSamplesRemaining() const; /// Return the current position of the stream in samples relative to the start of the stream. /** * The returned value indicates the sample index of the current read * position within the sound stream. For unbounded streams, this indicates * the number of samples that have been read by the stream since it was opened. */ virtual SampleIndex getPosition() const; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Stream Format Accessor Methods /// Return the number of channels that are in the sound input stream. virtual Size getChannelCount() const; /// Return the sample rate of the sound input stream's source audio data. virtual SampleRate getSampleRate() const; /// Return the actual sample type used in the stream. virtual SampleType getNativeSampleType() const; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Stream Status Accessor Method /// Return whether or not the stream has a valid source of sound data. virtual Bool isValid() const; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Filter Attribute Accessor Methods /// Return a human-readable name for this stream player. /** * The method returns the string "Stream Player". */ virtual UTF8String getName() const; /// Return the manufacturer name of this stream player. /** * The method returns the string "Stream Player". */ virtual UTF8String getManufacturer() const; /// Return an object representing the version of this stream player. virtual SoundFilterVersion getVersion() const; /// Return an object which describes the category of effect that this filter implements. /** * This method returns the value SoundFilterCategory::PLAYBACK. */ virtual SoundFilterCategory getCategory() const; /// Return whether or not this stream player can process audio data in-place. /** * This method always returns TRUE, stream players can process audio data in-place. */ virtual Bool allowsInPlaceProcessing() const; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Public Static Property Objects /// A string indicating the human-readable name of this stream player. static const UTF8String NAME; /// A string indicating the manufacturer name of this stream player. static const UTF8String MANUFACTURER; /// An object indicating the version of this stream player. static const SoundFilterVersion VERSION; private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Filter Processing Methods /// Play the specified number of samples from the sound input stream and place them in the output frame. virtual SoundFilterResult processFrame( const SoundFilterFrame& inputFrame, SoundFilterFrame& outputFrame, Size numSamples ); /// Read the specified number of samples from the input stream into the output buffer. virtual Size readSamples( SoundBuffer& outputBuffer, Size numSamples ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Members /// A pointer to the sound input stream from which this sound's playback samples are read. Pointer<SoundInputStream> stream; /// The current position within the stream, relative to the initial position within the stream. SampleIndex currentStreamPosition; /// The current maximum position that has been reached in the stream. /** * This value allows the player to determine the total size of the stream * indirectly by noting the positions within the sound stream where playback * started and ended. The difference is the total length of the sound and it * is used when looping the sound to determine how far to seek backwards in the * stream. */ SoundSize currentStreamLength; /// A boolean value indicating whether or not the stream player should be playing the stream. Bool playingEnabled; /// A boolean value indicating whether or not the sound stream player should loop its sound source. Bool loopingEnabled; /// A boolean value indicating whether or not the sound stream supports seeking. Bool seekingAllowed; }; //########################################################################################## //************************ End Rim Sound Filters Namespace ******************************* RIM_SOUND_FILTERS_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_SOUND_STREAM_PLAYER_H <file_sep>/* * rimDataConfig.h * Rim Framework * * Created by <NAME> on 12/28/08. * Copyright 2008 Rim Software. All rights reserved. * */ #ifndef INCLUDE_RIM_DATA_CONFIG_H #define INCLUDE_RIM_DATA_CONFIG_H #include "../rimConfig.h" #include <cstdlib> #include <new> #include "../util/rimAllocator.h" #include "../math/rimScalarMath.h" //########################################################################################## //########################################################################################## //############ //############ Library Namespace Configuration //############ //########################################################################################## //########################################################################################## /// Define the name of the data library namespace. #ifndef RIM_DATA_NAMESPACE #define RIM_DATA_NAMESPACE data #endif #ifndef RIM_DATA_NAMESPACE_START #define RIM_DATA_NAMESPACE_START RIM_NAMESPACE_START namespace RIM_DATA_NAMESPACE { #endif #ifndef RIM_DATA_NAMESPACE_END #define RIM_DATA_NAMESPACE_END }; RIM_NAMESPACE_END #endif RIM_NAMESPACE_START /// A namespace containing basic data manipulation classes: strings, buffers, and hashing. namespace RIM_DATA_NAMESPACE { }; RIM_NAMESPACE_END //########################################################################################## //******************************* Start Data Namespace ********************************* RIM_DATA_NAMESPACE_START //****************************************************************************************** //########################################################################################## //########################################################################################## //******************************* End Data Namespace *********************************** RIM_DATA_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_DATA_CONFIG_H <file_sep>/* * rimTimeConfig.h * Rim Framework * * Created by <NAME> on 12/28/08. * Copyright 2008 Rim Software. All rights reserved. * */ #ifndef INCLUDE_RIM_TIME_CONFIG_H #define INCLUDE_RIM_TIME_CONFIG_H #include "../rimConfig.h" #include "../rimData.h" //########################################################################################## //########################################################################################## //############ //############ Library Namespace Configuration //############ //########################################################################################## //########################################################################################## /// Define the name of the time library namespace. #ifndef RIM_TIME_NAMESPACE #define RIM_TIME_NAMESPACE time #endif #ifndef RIM_TIME_NAMESPACE_START #define RIM_TIME_NAMESPACE_START RIM_NAMESPACE_START namespace RIM_TIME_NAMESPACE { #endif #ifndef RIM_TIME_NAMESPACE_END #define RIM_TIME_NAMESPACE_END }; RIM_NAMESPACE_END #endif RIM_NAMESPACE_START /// A namespace containing classes which are related to keeping track of time. namespace RIM_TIME_NAMESPACE { }; RIM_NAMESPACE_END //########################################################################################## //******************************* Start Time Namespace ********************************* RIM_TIME_NAMESPACE_START //****************************************************************************************** //########################################################################################## //########################################################################################## //******************************* End Time Namespace *********************************** RIM_TIME_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_TIME_CONFIG_H <file_sep>/* * rimMatrix2D.h * Rim Math * * Created by <NAME> on 1/23/08. * Copyright 2008 Rim Software. All rights reserved. * */ #ifndef INCLUDE_RIM_MATRIX_2D_H #define INCLUDE_RIM_MATRIX_2D_H #include "rimMathConfig.h" #include "../data/rimBasicString.h" #include "../data/rimBasicStringBuffer.h" #include "rimVector2D.h" //########################################################################################## //***************************** Start Rim Math Namespace ********************************* RIM_MATH_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class which represents a 2x2 matrix. /** * Elements in the matrix are stored in column-major order. */ template < typename T> class Matrix2D { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructors /// Create a 2x2 matrix with all elements equal to zero. RIM_FORCE_INLINE Matrix2D() : x( 0, 0 ), y( 0, 0 ) { } /// Create a 2x2 matrix from two column vectors. RIM_FORCE_INLINE Matrix2D( const Vector2D<T>& column1, const Vector2D<T>& column2 ) : x( column1 ), y( column2 ) { } /// Create a 2x2 matrix with elements specified in row-major order. RIM_FORCE_INLINE Matrix2D( T a, T b, T c, T d ) : x( a, c ), y( b, d ) { } /// Create a 2x2 matrix from a pointer to an array of elements in column-major order. RIM_FORCE_INLINE explicit Matrix2D( const T* array ) : x( array[0], array[2] ), y( array[1], array[3] ) { } /// Create a copy of the specified 2x2 matrix with different template parameter type. template < typename U > RIM_FORCE_INLINE Matrix2D( const Matrix2D<U>& other ) : x( other.x ), y( other.y ) { } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Static Matrix Constructors /// Create a 2x2 rotation matrix with the specified rotation in radians. RIM_FORCE_INLINE static Matrix2D<T> rotation( T radians ) { return Matrix2D<T>( math::cos(radians), math::sin(radians), -math::sin(radians), math::cos(radians) ); } /// Create a 2x2 rotation matrix with the specified rotation in degrees. RIM_FORCE_INLINE static Matrix2D<T> rotationDegrees( T degrees ) { return Matrix2D<T>::rotation( math::degreesToRadians( degrees ) ); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Accessor Methods /// Return a pointer to the matrix's elements in colunn-major order. /** * Since matrix elements are stored in column-major order, * no allocation is performed and the elements are accessed directly. */ RIM_FORCE_INLINE T* toArrayColumnMajor() { return (T*)&x; } /// Return a pointer to the matrix's elements in colunn-major order. /** * Since matrix elements are stored in column-major order, * no allocation is performed and the elements are accessed directly. */ RIM_FORCE_INLINE const T* toArrayColumnMajor() const { return (T*)&x; } /// Place the elements of the matrix at the location specified in row-major order. /** * The output array must be at least 4 elements long. */ RIM_FORCE_INLINE void toArrayRowMajor( T* outputArray ) const { outputArray[0] = x.x; outputArray[1] = y.x; outputArray[2] = x.y; outputArray[3] = y.y; } /// Get the column at the specified index in the matrix. RIM_FORCE_INLINE Vector2D<T>& getColumn( Index columnIndex ) { RIM_DEBUG_ASSERT( columnIndex < 2 ); return (&x)[columnIndex]; } /// Get the column at the specified index in the matrix. RIM_FORCE_INLINE const Vector2D<T>& getColumn( Index columnIndex ) const { RIM_DEBUG_ASSERT( columnIndex < 2 ); return (&x)[columnIndex]; } /// Get the column at the specified index in the matrix. RIM_FORCE_INLINE Vector2D<T>& operator () ( Index columnIndex ) { RIM_DEBUG_ASSERT( columnIndex < 2 ); return (&x)[columnIndex]; } /// Get the column at the specified index in the matrix. RIM_FORCE_INLINE const Vector2D<T>& operator () ( Index columnIndex ) const { RIM_DEBUG_ASSERT( columnIndex < 2 ); return (&x)[columnIndex]; } /// Get the column at the specified index in the matrix. RIM_FORCE_INLINE Vector2D<T>& operator [] ( Index columnIndex ) { RIM_DEBUG_ASSERT( columnIndex < 2 ); return (&x)[columnIndex]; } /// Get the column at the specified index in the matrix. RIM_FORCE_INLINE const Vector2D<T>& operator [] ( Index columnIndex ) const { RIM_DEBUG_ASSERT( columnIndex < 2 ); return (&x)[columnIndex]; } /// Get the row at the specified index in the matrix. RIM_FORCE_INLINE Vector2D<T> getRow( Index rowIndex ) const { RIM_DEBUG_ASSERT( rowIndex < 2 ); switch ( rowIndex ) { case 0: return Vector2D<T>( x.x, y.x ); case 1: return Vector2D<T>( x.y, y.y ); default: return Vector2D<T>::ZERO; } } /// Get the element at the specified (column, row) index in the matrix. RIM_FORCE_INLINE T& get( Index columnIndex, Index rowIndex ) { RIM_DEBUG_ASSERT( columnIndex < 2 && rowIndex < 2 ); return (&x)[columnIndex][rowIndex]; } /// Get the element at the specified (column, row) index in the matrix. RIM_FORCE_INLINE const T& get( Index columnIndex, Index rowIndex ) const { RIM_DEBUG_ASSERT( columnIndex < 2 && rowIndex < 2 ); return (&x)[columnIndex][rowIndex]; } /// Get the element at the specified (column, row) index in the matrix. RIM_FORCE_INLINE T& operator () ( Index columnIndex, Index rowIndex ) { RIM_DEBUG_ASSERT( columnIndex < 2 && rowIndex < 2 ); return (&x)[columnIndex][rowIndex]; } /// Get the element at the specified (column, row) index in the matrix. RIM_FORCE_INLINE const T& operator () ( Index columnIndex, Index rowIndex ) const { RIM_DEBUG_ASSERT( columnIndex < 2 && rowIndex < 2 ); return (&x)[columnIndex][rowIndex]; } /// Return the diagonal vector of this matrix. RIM_FORCE_INLINE Vector2D<T> getDiagonal() const { return Vector2D<T>( x.x, y.y ); } /// Set the element in the matrix at the specified (row, column) index. RIM_FORCE_INLINE void set( Index columnIndex, Index rowIndex, T value ) { RIM_DEBUG_ASSERT( columnIndex < 2 && rowIndex < 2 ); return (&x)[columnIndex][rowIndex] = value; } /// Set the column in the matrix at the specified index. RIM_FORCE_INLINE void setColumn( Index columnIndex, const Vector2D<T>& newColumn ) { RIM_DEBUG_ASSERT( columnIndex < 2 ); (&x)[columnIndex] = newColumn; } /// Set the row in the matrix at the specified index. RIM_FORCE_INLINE void setRow( Index rowIndex, const Vector2D<T>& newRow ) { RIM_DEBUG_ASSERT( rowIndex < 2 ); switch ( rowIndex ) { case 0: x.x = newRow.x; y.x = newRow.y; return; case 1: x.y = newRow.x; y.y = newRow.y; return; } } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Accessor Methods /// Return the determinant of this matrix. RIM_FORCE_INLINE T getDeterminant() const { return x.x*y.y - y.x*x.y; } /// Return the inverse of this matrix, or the zero matrix if the matrix has no inverse. /** * Whether or not the matrix is invertable is determined by comparing the determinant * to a threshold - if the absolute value of the determinant is less than the threshold, * the matrix is not invertable. */ RIM_FORCE_INLINE Matrix2D<T> invert( T threshold = 0 ) const { T det = getDeterminant(); if ( math::abs(det) <= threshold ) return Matrix2D<T>::ZERO; T detInv = T(1)/det; return Matrix2D<T>( y.y*detInv, -y.x*detInv, -x.y*detInv, x.x*detInv ); } /// Compute the inverse of this matrix, returning the result in the output parameter. /** * The method returns whether or not the matrix was able to be inverted. This propery * is determined by comparing the determinant to a threshold - if the absolute value of * the determinant is less than the threshold, the matrix is not invertable. */ RIM_FORCE_INLINE Bool invert( Matrix2D<T>& inverse, T threshold = 0 ) const { T det = getDeterminant(); if ( math::abs(det) <= threshold ) return false; T detInv = T(1)/det; inverse = Matrix2D<T>( y.y*detInv, -y.x*detInv, -x.y*detInv, x.x*detInv ); return true; } /// Return the orthonormalization of this matrix. /** * This matrix that is returned has both column vectors of unit * length and perpendicular to each other. */ RIM_FORCE_INLINE Matrix2D<T> orthonormalize() const { Vector2D<T> X = x.normalize(); return Matrix2D( X, Vector2D<T>( -X.y, X.x ) ); } /// Return the transposition of this matrix. RIM_FORCE_INLINE Matrix2D<T> transpose() const { return Matrix2D( x.x, x.y, y.x, y.y ); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Comparison Operators /// Compare two matrices component-wise for equality. RIM_FORCE_INLINE Bool operator == ( const Matrix2D<T>& m ) const { return x == m.x && y == m.y; } /// Compare two matrices component-wise for inequality. RIM_FORCE_INLINE Bool operator != ( const Matrix2D<T>& m ) const { return x != m.x || y != m.y; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Matrix Negation/Positivation Operators /// Negate every element of this matrix and return the resulting matrix. RIM_FORCE_INLINE Matrix2D<T> operator - () const { return Matrix2D<T>( -x, -y ); } /// 'Positivate' every element of this matrix, returning a copy of the original matrix. RIM_FORCE_INLINE Matrix2D<T> operator + () const { return Matrix2D<T>( x, y ); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Arithmetic Operators /// Add this matrix to another and return the resulting matrix. RIM_FORCE_INLINE Matrix2D<T> operator + ( const Matrix2D<T>& matrix ) const { return Matrix2D<T>( x + matrix.x, y + matrix.y ); } /// Add a scalar to the elements of this matrix and return the resulting matrix. RIM_FORCE_INLINE Matrix2D<T> operator + ( const T& value ) const { return Matrix2D<T>( x + value, y + value ); } /// Subtract a matrix from this matrix and return the resulting matrix. RIM_FORCE_INLINE Matrix2D<T> operator - ( const Matrix2D<T>& matrix ) const { return Matrix2D<T>( x - matrix.x, y - matrix.y ); } /// Subtract a scalar from the elements of this matrix and return the resulting matrix. RIM_FORCE_INLINE Matrix2D<T> operator - ( const T& value ) const { return Matrix2D<T>( x - value, y - value ); } /// Multiply a matrix by this matrix and return the result. RIM_FORCE_INLINE Matrix2D<T> operator * ( const Matrix2D<T>& matrix ) const { return Matrix2D<T>( x.x*matrix.x.x + y.x*matrix.x.y, x.x*matrix.y.x + y.x*matrix.y.y, x.y*matrix.x.x + y.y*matrix.x.y, x.y*matrix.y.x + y.y*matrix.y.y ); } /// Multiply a vector/point by this matrix and return the result. RIM_FORCE_INLINE Vector2D<T> operator * ( const Vector2D<T>& vector ) const { return Vector2D<T>( x.x*vector.x + y.x*vector.y, x.y*vector.x + y.y*vector.y ); } /// Multiply this matrix's elements by a scalar and return the resulting matrix. RIM_FORCE_INLINE Matrix2D<T> operator * ( const T& value ) const { return Matrix2D<T>( x*value, y*value ); } /// Divide the elements of this matrix by a scalar and return the resulting matrix. RIM_FORCE_INLINE Matrix2D<T> operator / ( const T& value ) const { return Matrix2D<T>( x/value, y/value ); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Arithmetic Assignment Operators /// Add the elements of another matrix to this matrix. RIM_FORCE_INLINE Matrix2D<T>& operator += ( const Matrix2D<T>& matrix2 ) { x += matrix2.x; y += matrix2.y; return *this; } /// Subtract the elements of another matrix from this matrix. RIM_FORCE_INLINE Matrix2D<T>& operator -= ( const Matrix2D<T>& matrix2 ) { x -= matrix2.x; y -= matrix2.y; return *this; } /// Add a scalar value to the elements of this matrix. RIM_FORCE_INLINE Matrix2D<T>& operator += ( const T& value ) { x += value; y += value; return *this; } /// Subtract a scalar value from the elements of this matrix. RIM_FORCE_INLINE Matrix2D<T>& operator -= ( const T& value ) { x -= value; y -= value; return *this; } /// Multiply the elements of this matrix by a scalar value. RIM_FORCE_INLINE Matrix2D<T>& operator *= ( const T& value ) { x *= value; y *= value; return *this; } /// Divide the elements of this matrix by a scalar value. RIM_FORCE_INLINE Matrix2D<T>& operator /= ( const T& value ) { x /= value; y /= value; return *this; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** String Conversion Methods /// Convert this 2x2 matrix into a human-readable string representation. RIM_NO_INLINE data::String toString() const { data::StringBuffer buffer; buffer << "[ " << x.x << ", " << y.x << " ]\n"; buffer << "[ " << x.y << ", " << y.y << " ]"; return buffer.toString(); } /// Convert this 2x2 matrix into a human-readable string representation. RIM_FORCE_INLINE operator data::String () const { return this->toString(); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Public Data Members /// The first column vector of the matrix. Vector2D<T> x; /// The second column vector of the matrix. Vector2D<T> y; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Public Static Data Members /// Constant matrix with all elements equal to zero. static const Matrix2D<T> ZERO; /// Constant matrix with diagonal elements equal to one and all others equal to zero. static const Matrix2D<T> IDENTITY; }; template <typename T> const Matrix2D<T> Matrix2D<T>:: ZERO( T(0), T(0), T(0), T(0) ); template <typename T> const Matrix2D<T> Matrix2D<T>:: IDENTITY( T(1), T(0), T(0), T(1) ); //########################################################################################## //########################################################################################## //############ //############ Reverse Matrix Arithmetic Operators //############ //########################################################################################## //########################################################################################## /// 'Reverse' multiply a vector/point by matrix: multiply it by the matrix's transpose. template < typename T > RIM_FORCE_INLINE Vector2D<T> operator * ( const Vector2D<T>& vector, const Matrix2D<T>& matrix ) { return Vector2D<T>( matrix.x.x * vector.x + matrix.x.y * vector.y, matrix.y.x * vector.x + matrix.y.y * vector.y ); } /// Multiply a matrix's elements by a scalar and return the resulting matrix template < typename T> RIM_FORCE_INLINE Matrix2D<T> operator * ( const T& value, const Matrix2D<T>& matrix ) { return Matrix2D<T>( matrix.x*value, matrix.y*value, matrix.z*value ); } /// Add a scalar to the elements of a matrix and return the resulting matrix. template < typename T> RIM_FORCE_INLINE Matrix2D<T> operator + ( const T& value, const Matrix2D<T>& matrix ) { return Matrix2D<T>( matrix.x + value, matrix.y + value, matrix.z + value ); } //########################################################################################## //########################################################################################## //############ //############ Other Matrix Functions //############ //########################################################################################## //########################################################################################## /// Return the absolute value of the specified matrix, such that the every component is positive. template < typename T > RIM_FORCE_INLINE Matrix2D<T> abs( const Matrix2D<T>& matrix ) { return Matrix2D<T>( math::abs(matrix.x.x), math::abs(matrix.y.x), math::abs(matrix.x.y), math::abs(matrix.y.y) ); } //########################################################################################## //########################################################################################## //############ //############ 2D Matrix Type Definitions //############ //########################################################################################## //########################################################################################## typedef Matrix2D<int> Matrix2i; typedef Matrix2D<float> Matrix2f; typedef Matrix2D<double> Matrix2d; //########################################################################################## //***************************** End Rim Math Namespace *********************************** RIM_MATH_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_MATRIX_2D_H <file_sep>/* * rimSemaphore.h * Rim Threads * * Created by <NAME> on 4/16/10. * Copyright 2010 Rim Software. All rights reserved. * */ #ifndef INCLUDE_RIM_SEMAPHORE_H #define INCLUDE_RIM_SEMAPHORE_H #include "rimThreadsConfig.h" #include "../rimUtilities.h" //########################################################################################## //*************************** Start Rim Threads Namespace ******************************** RIM_THREADS_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class which implements a count-based synchronization object. class Semaphore { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructors /// Create a new semaphore object with an initial value of 0. Semaphore(); /// Create a new semaphore object with the specified initial value. Semaphore( UInt initialValue ); /// Create a new semaphore with the same value as the specified semaphore. Semaphore( const Semaphore& semaphore ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Destructor /// Destroy a semaphore object. /** * This has the effect of awakening all waiting * threads. This is done in order to prevent deadlocks * in the case of accidental destruction. */ ~Semaphore(); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Assignment Operator /// Assign one semaphore to another. /** * This awakens all threads currently waiting on the semaphore * and gives the semaphore an initial value equal to the other * semaphore's current value. */ Semaphore& operator = ( const Semaphore& semaphore ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Up/Down Methods /// Increase the value of the semaphore by 1. /** * This awakens at most 1 thread which was suspended after a call * to down() when the value of the semaphore was 0. The awoken thread * then decreases the value of the semaphore by 1 and returns from * down(). Threads are awoken in a first-in-first-out order: the first * thread to start waiting on a call to down is the first awoken after * a call to up(). */ void up(); /// Decrease the value of the semaphore by 1. /** * If the value of the semaphore before the call to down() was 0, * then the calling thread is blocked until another thread makes * a call to up(). */ void down(); /// Awaken all threads that are waiting on the semaphore and set its value to 0. void reset(); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Value Accessor Method /// Get the current value of the semaphore. /** * The returned value is always greater than or equal to zero. * * Since this method may be emulated on some platforms that don't support * getting the semaphore value, sychronization is not guaranteed and so * the returned value may not necessarily represent the current semaphore value. */ UInt getValue() const; private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Semaphore Wrapper Class Declaration /// A class which encapsulates internal platform-specific Semaphore code. class SemaphoreWrapper; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Members /// A wrapper of the internal platform-specific state of the semaphore. SemaphoreWrapper* wrapper; }; //########################################################################################## //*************************** End Rim Threads Namespace ********************************** RIM_THREADS_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_SEMAPHORE_H <file_sep>/* * rimEngineTrajectory.h * Rim Software * * Created by <NAME> on 7/1/14. * Copyright 2014 __MyCompanyName__. All rights reserved. * */ #ifndef INCLUDE_RIM_ENGINE_TRAJECTORY_H #define INCLUDE_RIM_ENGINE_TRAJECTORY_H #include "rimEngineConfig.h" //########################################################################################## //*************************** Start Rim Engine Namespace ********************************* RIM_ENGINE_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class that stores a 3D transformation and motion information for a generic object. /** * This class allows unrelated systems to communicate the positions of common objects. * For example, a physics object can set the trajectory, which is then read by a graphics * object. */ class Trajectory { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructors /// Create a default identity trajectory transformation with no motion. RIM_INLINE Trajectory() { } /// Create a trajectory with the specified static transformation. RIM_INLINE Trajectory( const Transform3f& newTransform ) : transform( newTransform ) { } /// Create a trajectory with the specified transformation and velocities. RIM_INLINE Trajectory( const Transform3f& newTransform, const Vector3f& newVelocity, const Vector3f& newAngularVelocity = Vector3f() ) : transform( newTransform ), velocity( newVelocity ), angularVelocity( newAngularVelocity ) { } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Position Accessor Methods /// Return the position of this trajectory in world space. RIM_INLINE const Vector3f& getPosition() const { return transform.position; } /// Set the position of this trajectory in world space. RIM_INLINE void setPosition( const Vector3f& newPosition ) { transform.position = newPosition; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Orientation Accessor Methods /// Return a reference to this trajectory's 3x3 orthonormal rotation matrix. /** * This is the orthonormal matrix which defines the rotational transformation * from object to world space. */ RIM_INLINE const Matrix3f& getOrientation() const { return transform.orientation; } /// Set this trajectory's 3x3 orthonormal rotation matrix. /** * This is the orthonormal matrix which defines the rotational transformation * from object to world space. */ RIM_INLINE void setOrientation( const Matrix3f& newOrientation ) { transform.orientation = newOrientation; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Transform Accessor Methods /// Return a const reference to this trajectory's transformation. RIM_INLINE const Transform3f& getTransform() const { return transform; } /// Set this trajectory's transformation. RIM_INLINE void setTransform( const Transform3f& newTransform ) { transform = newTransform; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Velocity Accessor Methods /// Return the linear velocity of this trajectory in world units per second. RIM_INLINE const Vector3f& getVelocity() const { return velocity; } /// Set the linear velocity of this trajectory in world units per second. RIM_INLINE void setVelocity( const Vector3f& newVelocity ) { velocity = newVelocity; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Angular Velocity Accessor Methods /// Return the angular velocity of this trajectory in radians per second. RIM_INLINE const Vector3f& getAngularVelocity() const { return angularVelocity; } /// Set the angular velocity of this trajectory in radians per second. RIM_INLINE void setAngularVelocity( const Vector3f& newAngularVelocity ) { angularVelocity = newAngularVelocity; } private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Members /// A 3D transformation from object to world space for the trajectory. Transform3f transform; /// The linear velocity of this trajectory in world space. Vector3f velocity; /// The angular velocity of this trajectory along the 3 principle axes. Vector3f angularVelocity; }; //########################################################################################## //*************************** End Rim Engine Namespace *********************************** RIM_ENGINE_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_ENGINE_TRAJECTORY_H <file_sep>/* * rimGraphicsMaterialTechniqueUsage.h * Rim Graphics * * Created by <NAME> on 1/11/11. * Copyright 2011 Rim Software. All rights reserved. * */ #ifndef INCLUDE_RIM_GRAPHICS_MATERIAL_TECHNIQUE_USAGE_H #define INCLUDE_RIM_GRAPHICS_MATERIAL_TECHNIQUE_USAGE_H #include "rimGraphicsMaterialsConfig.h" //########################################################################################## //********************** Start Rim Graphics Materials Namespace ************************** RIM_GRAPHICS_MATERIALS_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class which represents the semantic usage for a MaterialTechnique. /** * This enum class contains various values which describe different common * types of rendering techniques. These can include standard forward rendering, * deferred rendering, or shadow map rendering. This allows a MaterialTechnique * to be labeled with a particular semantic usage so that the renderer can decide * at render-time which is the correct technique for rendering an object. */ class MaterialTechniqueUsage { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Material Technique Usage Enum Definition /// An enum value which indicates the type of technique usage. typedef enum Enum { /// This usage specifies the technique to use when no other is available. DEFAULT = 1, /// This usage specifies a technique used for traditional forward rendering. FORWARD_RENDERING = 1 << 1, /// This usage specifies a technique used to fill the GBuffer during deferred rendering. DEFERRED_GBUFFER_RENDERING = 1 << 2, /// This usage specifies a technique used for shadow map rendering. SHADOW_MAP_RENDERING = 1 << 3, /// This usage specifies a technique for an undefined usage. UNDEFINED = 0 }; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructors /// Create a new undefined material technique usage. RIM_INLINE MaterialTechniqueUsage() : usage( UNDEFINED ) { } /// Create a new material technique usage with the specified material technique usage enum value. RIM_INLINE MaterialTechniqueUsage( Enum newUsage ) : usage( newUsage ) { } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Enum Cast Operator /// Convert this material technique usage to an enum value. RIM_INLINE operator Enum () const { return usage; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** String Representation Accessor Methods /// Return a unique string for this technique usage that matches its enum value name. String toEnumString() const; /// Return a technique usage which corresponds to the given enum string. static MaterialTechniqueUsage fromEnumString( const String& enumString ); /// Return a string representation of the material technique usage. String toString() const; /// Convert this material technique usage into a string representation. RIM_INLINE operator String () const { return this->toString(); } private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Members /// An enum for the material technique usage. Enum usage; }; //########################################################################################## //********************** End Rim Graphics Materials Namespace **************************** RIM_GRAPHICS_MATERIALS_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_GRAPHICS_MATERIAL_TECHNIQUE_USAGE_H <file_sep>/* * rimPhysicsGJKSolver.h * Rim Physics * * Created by <NAME> on 8/29/08. * Copyright 2008 Rim Software. All rights reserved. * */ #ifndef INCLUDE_RIM_PHYSICS_GJK_SOLVER_H #define INCLUDE_RIM_PHYSICS_GJK_SOLVER_H #include "rimPhysicsUtilitiesConfig.h" #include "rimPhysicsMinkowskiVertex.h" //########################################################################################## //********************** Start Rim Physics Utilities Namespace *************************** RIM_PHYSICS_UTILITIES_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class which iteratively refines a 4-point simplex to determine if two convex shapes intersect. class GJKSolver { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructors /// Create a default GJKSolver object with the default max number of iterations, intial search direction. RIM_INLINE GJKSolver() : initialSearchDirection( 1, 0, 0 ), maximumNumberOfIterations( DEFAULT_MAXIMUM_NUMBER_OF_ITERATIONS ) { } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** GJK Solve Method /// Determine whether or not two convex shapes intersect. /** * This method uses the specified template support point generation function * to iteratively refine a 4-point simplex in minkowski-space until it * contains the origin. When this happens, an intersection occurrs and TRUE * is returned. If the algorithm does not converge and there is no way that * the two shapes could intersect, FALSE is returned. * * The function allows the user to specify a user data pointer which gets * passed to the support point generation function. This is so that users * of this class can easily access data necessary for support point generation. * * The support point generation function should return a minkowski vertex * object for the two points on the two convex shapes that are farthest * in the given search direction (1st parameter). */ template < typename UserDataType1, typename UserDataType2, MinkowskiVertex3 (*getSupportPoint)( const Vector3&, const UserDataType1*, const UserDataType2* ) > Bool solve( StaticArray<MinkowskiVertex3,4>& simplexResult, const UserDataType1* userData1 = NULL, const UserDataType2* userData2 = NULL ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Maximum Number of Iterations Accessor Methods /// Return the maximum number of iterations that this GJK solver can perform. /** * An upper bound to the number of iterations is necessary so that degenerate * cases don't produce an infinite solver loop. Values in the range of 10 to 30 * are typical good iteration count limits. Your mileage may vary. */ RIM_FORCE_INLINE Size getMaximumNumberOfIterations() const { return maximumNumberOfIterations; } /// Set the maximum number of iterations that this GJK solver can perform. /** * An upper bound to the number of iterations is necessary so that degenerate * cases don't produce an infinite solver loop. Values in the range of 10 to 30 * are typical good iteration count limits. Your mileage may vary. */ RIM_FORCE_INLINE void setMaximumNumberOfIterations( Size newMaximumNumberOfIterations ) { maximumNumberOfIterations = newMaximumNumberOfIterations; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Initial Search Direction Accessor Methods /// Get the initial search direction that this GJK solver uses when solving for shape intersection. /** * Using a carefully chosen initial search direction can much increase the * rate at which the solver converges on a solution. */ RIM_FORCE_INLINE const Vector3& getInitialSearchDirection() const { return initialSearchDirection; } /// Set the initial search direction that this GJK solver uses when solving for shape intersection. /** * Using a carefully chosen initial search direction can much increase the * rate at which the solver converges on a solution. Setting this vector to * a search direction that converged quickly in the past can produce better results. */ RIM_FORCE_INLINE void setInitialSearchDirection( const Vector3& newInitialSearchDirection ) { initialSearchDirection = newInitialSearchDirection; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Last Search Direction Accessor Methods /// Get a const reference to the last search direction used by this GJK solver. /** * This value might be of use as an initial search direction if it is * cached for each shape pair and restored each time they are tested for collisions. */ RIM_FORCE_INLINE const Vector3& getLastSearchDirection() const { return lastSearchDirection; } private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Simplex Update Methods /// Update a 2-point simplex and return the next search vector in the output parameter. void updateSimplex2( Vector3& searchDirection ); /// Update a 3-point simplex and return the next search vector in the output parameter. void updateSimplex3( Vector3& searchDirection ); /// Update a 4-point simplex and return whether or not the simplex is complete. /** * If TRUE is returned, the simplex is complete and the convex shapes must * intersect. Otherwise, if FALSE is returned, the next search direction * is placed in the output parameter. */ Bool updateSimplex4( Vector3& searchDirection ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Members /// A pointer to a list representing the current minkowski simplex for the solver. MinkowskiVertex3* simplex; /// The current number of points in the simplex. Size numSimplexPoints; /// The maximum allowed number of iterations for this GJK solver. Size maximumNumberOfIterations; /// The initial search direction for this GJK solver. Vector3 initialSearchDirection; /// The last search direction used to enclose the origin using the simplex. /** * This value might be of use as an initial search direction if it is * cached for each shape pair and restored each time they are tested for collisions. */ Vector3 lastSearchDirection; /// The default starting maximum number of iterations that this GJK solver performs. static const Size DEFAULT_MAXIMUM_NUMBER_OF_ITERATIONS = 30; }; //########################################################################################## //########################################################################################## //############ //############ GJK Solve Method //############ //########################################################################################## //########################################################################################## template < typename UserDataType1, typename UserDataType2, MinkowskiVertex3 (*getSupportPoint)( const Vector3&, const UserDataType1*, const UserDataType2* ) > Bool GJKSolver:: solve( StaticArray<MinkowskiVertex3,4>& simplexResult, const UserDataType1* userData1, const UserDataType2* userData2 ) { //*************************************************************************** // Make sure that the simplex is empty from previous collision tests. // Store a pointer to the first simplex vertex so that we can add more vertices later. simplex = simplexResult.getPointer(); //*************************************************************************** // Pick a starting direction (arbitrary for now, later a direction caching // method might be used to improve the algorithm's convergence.), and get // the support point for this direction. Add this point to the simplex. Vector3 searchDirection = initialSearchDirection; MinkowskiVertex3 supportPoint = getSupportPoint( searchDirection, userData1, userData2 ); // Add the first support point to the simplex. simplex[0] = supportPoint; numSimplexPoints = 1; //*************************************************************************** // The new direction in which to search for the origin is by definition // the direction from this first support point to the origin, its negation. searchDirection = -supportPoint.getPosition(); //*************************************************************************** // Start the main GJK algortihm loop. In this loop, we first get a new // support point in the current origin search direction. If the dot product // of this support point and the search direction is less than zero, then // there is no way that the two shapes can intersect (because the algorithm // has backtracked). Otherwise, add this point to the simplex and then update // the search direction based on the current state of the simplex and the // position of the origin relative to it. Index numberOfIterations = 0; while ( numberOfIterations < maximumNumberOfIterations ) { //*************************************************************************** // Get the support point of the two shapes in the current search direction. supportPoint = getSupportPoint( searchDirection, userData1, userData2 ); //*************************************************************************** // Test to see if there is no way that the shapes can intersect. If // the result of the dot product of the new support point and the search // direction is less than zero, then that means that the new support point // does not get any closer to the origin than where the simplex is, and // therefore the shapes cannot intersect. // Break from the GJK iteration loop, indicating that there can be no intersecion. // This happens whenever the search direction vector is a separating axis for // the two convex shape (dot < -epsilon), or if we weren't able to get any closer // to the origin with this support point (dot < epsilon). if ( math::dot( searchDirection, supportPoint.getPosition() ) < math::epsilon<Real>() ) break; //*************************************************************************** // Add this new support point to the simplex. simplex[numSimplexPoints] = supportPoint; numSimplexPoints++; //*************************************************************************** // Update the search direction by analyzing the state of the simplex // and the origin's position relative to it. We have to split the simplex // processing into 3 different cases. // The algorithm that we run on the simplex depends on the number // of points it contains. The valid possible numbers of points are // 2, 3, and 4. Switch between the algorithm based on this number. switch ( numSimplexPoints ) { //*************************************************************************** // The first case is that the simplex consists of 2 points. This means // that it forms a line. We need to determine in which direction relative // to the line that the origin is in. It can be either in-between the two // planes defined by the endpoints of the line and the line as the plane // normals. Otherwise, the origin must lie on the other side of the plane // of the newest point of the simplex. case 2: updateSimplex2( searchDirection ); break; //*************************************************************************** // The second case is that the simplex has 3 points in it which form // a triangle. We need to determine where the origin is, relative to the // triangle. It can be closest to an edge of the triangle, closest to a // vertex, or it can be closest to the face of the triangle in either // direction. Determine which case we are in, update the simplex and // provide a new direction in which to search for the origin. case 3: updateSimplex3( searchDirection ); break; //*************************************************************************** // The third case is that the simplex has 4 points in it which form // a tetrahedron. We need to determine where the origin is, relative to the // tetrahedron. It can be closest to an edge of the tetrahedron, closest to a // vertex of the tetrahedron, closest to a face of the tetrahedron, // or it can be inside the tetrahedron. Determine which case we are // in, update the simplex and provide a new direction in which to // search for the origin if the tetrahedron does not contain the origin. case 4: if ( updateSimplex4( searchDirection ) ) { // The shapes intersect. lastSearchDirection = searchDirection; return true; } break; } numberOfIterations++; } lastSearchDirection = searchDirection; return false; } //########################################################################################## //********************** End Rim Physics Utilities Namespace ***************************** RIM_PHYSICS_UTILITES_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_PHYSICS_GJK_SOLVER_H <file_sep>/* * rimGraphicsShaderPassSource.h * Rim Software * * Created by <NAME> on 1/30/14. * Copyright 2014 __MyCompanyName__. All rights reserved. * */ #ifndef INCLUDE_RIM_GRAPHICS_SHADER_PASS_SOURCE_H #define INCLUDE_RIM_GRAPHICS_SHADER_PASS_SOURCE_H #include "rimGraphicsShadersConfig.h" #include "rimGraphicsShaderLanguage.h" #include "rimGraphicsShaderSource.h" #include "rimGraphicsShaderConfiguration.h" #include "rimGraphicsGenericShaderProgram.h" #include "rimGraphicsGenericConstantBinding.h" #include "rimGraphicsGenericTextureBinding.h" #include "rimGraphicsGenericVertexBinding.h" //########################################################################################## //*********************** Start Rim Graphics Shaders Namespace *************************** RIM_GRAPHICS_SHADERS_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class which describes a source-code implementation of a shader pass. class ShaderPassSource { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructors /// Create a new shader pass source object with no shader program. ShaderPassSource(); /// Create a new shader pass source object that uses the specified shader program. ShaderPassSource( const Pointer<GenericShaderProgram>& newProgram ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Language Accessor Methods /// Return an object describing the language in which this shader pass source is written. RIM_INLINE ShaderLanguage getLanguage() const { if ( program.isSet() ) return program->getLanguage(); else return ShaderLanguage::UNDEFINED; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Shader Program Accessor Methods /// Return a pointer to the shader program source code that should be used to render this shader pass. RIM_INLINE const Pointer<GenericShaderProgram>& getProgram() const { return program; } /// Return a pointer to the shader program source code that should be used to render this shader pass. RIM_INLINE void setProgram( const Pointer<GenericShaderProgram>& newProgram ) { program = newProgram; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constant Binding Accessor Methods /// Get the number of constant bindings associated with this shader pass. RIM_FORCE_INLINE Size getConstantBindingCount() const { return constantBindings.getSize(); } /// Return a pointer to the ConstantBinding at the specified index in this shader pas. /** * Binding indices range from 0 to the number of bindings minus one. * If there is no constant binding that corresponds to that index, * NULL is returned. Otherwise, a pointer to the binding is returned. */ const GenericConstantBinding* getConstantBinding( Index bindingIndex ) const { if ( bindingIndex < constantBindings.getSize() ) return &constantBindings[bindingIndex]; else return NULL; } /// Return a pointer to the first constant binding in this shader pass associated with the specified usage. /** * If there is no binding for that usage, NULL is returned. */ const GenericConstantBinding* getConstantBindingWithUsage( const ConstantUsage& usage ) const; /// Get the index of the binding for the constant variable with the specified name. /** * This method does an expensive linear search through the array of bindings * until it finds the variable with the specified name and places its index * in the output reference parameter. * * The method returns whether or not there was a binding for a variable with that name. */ Bool getConstantBindingIndex( const String& constantName, Index& bindingIndex ) const; /// Add a constant binding input for the variable with the given name to this shader pass. /** * If there is no shader for this shader pass, or the shader doesn't have a * variable with the specified name, or the specified usage has an incompatible * type with the shader variable, the method call fails and FALSE is returned. * Otherwise, a new binding is added to the shader pass with the given attributes * and TRUE is returned. */ Bool addConstantBinding( const String& constantName, const ConstantUsage& usage ); /// Add a constant binding for the variable with the given name to this shader pass. /** * If there is no shader for this shader pass, or the shader doesn't have a * variable with the specified name, or the specified constant or usage has an incompatible * type with the shader variable, the method call fails and FALSE is returned. * Otherwise, a new binding is added to the shader pass with the given attributes * and TRUE is returned. */ Bool addConstantBinding( const String& constantName, const AttributeValue& value, const ConstantUsage& usage, Bool isInput = true ); /// Set the constant binding for this shader pass at the specified index, replacing any previous binding. /** * If there is no shader for this shader pass, or the shader doesn't have a * binding with the specified index, or the specified constant or usage has an incompatible * type with the shader variable, the method call fails and FALSE is returned. * Otherwise, the previously existing binding is updated with the given attributes * and TRUE is returned. */ Bool setConstantBinding( Index bindingIndex, const AttributeValue& value, const ConstantUsage& usage = ConstantUsage::UNDEFINED, Bool isInput = true ); /// Set the constant usage for this shader pass at the specified binding index, replacing any previous usage. /** * If there is no shader for this shader pass, or the shader doesn't have a * binding with the specified index, or the specified usage has an incompatible * type with the shader variable, the method call fails and FALSE is returned. * Otherwise, the previously existing binding is updated with the given constant usage * and TRUE is returned. */ Bool setConstantUsage( Index bindingIndex, const ConstantUsage& usage ); /// Remove the constant binding with the specified index in this shader pass. /** * If the constant binding is successfully removed, TRUE is returned. * Otherwise FALSE is returned and the shader pass is unmodified. This method * removes the constant binding and replaces it with the shader pass's last * constant binding (if there is one) in the list order. */ Bool removeConstantBinding( Index bindingIndex ); /// Clear all constant bindings from this shader pass. void clearConstantBindings(); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constant Value Accessor Methods /// Get the value of the constant with the specified binding index in this shader pass. /** * If a binding exists with that index and its value is set, TRUE is returned and the value of * the constant is written to the output value parameter. Otherwise, FALSE is returned * and the value parameter is unmodified. */ template < typename T > Bool getConstantValue( Index bindingIndex, T& value ) const { if ( bindingIndex < constantBindings.getSize() ) { const AttributeValue& value = constantBindings[bindingIndex].getValue(); return value.isSet() && value.getValue( value ); } return false; } /// Set the value of the constant with the specified binding index in this shader pass. /** * If there was not an attribute already bound to this ID, a new * attribute is added to the shader pass with the specified name and value. */ template < typename T > Bool setConstantValue( Index bindingIndex, const T& value ) { if ( bindingIndex < constantBindings.getSize() ) { GenericConstantBinding& binding = constantBindings[bindingIndex]; return binding.getValue().setValue( value ); } return false; } /// Set the value of the constant with the specified binding index in this shader pass. /** * If there was not an attribute already bound to this ID, a new * attribute is added to the shader pass with the specified name and value. */ Bool setConstant( Index bindingIndex, const AttributeValue& value ) { if ( bindingIndex < constantBindings.getSize() ) { GenericConstantBinding& binding = constantBindings[bindingIndex]; binding.getValue() = value; } return false; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Texture Binding Accessor Methods /// Get the number of texture bindings associated with this shader pass. RIM_FORCE_INLINE Size getTextureBindingCount() const { return textureBindings.getSize(); } /// Return a pointer to the TextureBinding at the specified index in this shader pas. /** * Binding indices range from 0 to the number of bindings minus one. * If there is no texture binding that corresponds to that index, * NULL is returned. Otherwise, a pointer to the binding is returned. */ const GenericTextureBinding* getTextureBinding( Index bindingIndex ) const { if ( bindingIndex < textureBindings.getSize() ) return &textureBindings[bindingIndex]; else return NULL; } /// Return a pointer to the first texture binding in this shader pass associated with the specified usage. /** * If there is no binding for that usage, NULL is returned. */ const GenericTextureBinding* getTextureBindingWithUsage( const TextureUsage& usage ) const; /// Get the index of the binding for the texture variable with the specified name. /** * This method does an expensive linear search through the array of bindings * until it finds the variable with the specified name and places its index * in the output reference parameter. * * The method returns whether or not there was a binding for a variable with that name. */ Bool getTextureBindingIndex( const String& variableName, Index& bindingIndex ) const; /// Add a texture binding for the variable with the given name to this shader pass. /** * If there is no shader for this shader pass, or the shader doesn't have a * variable with the specified name, or the specified usage has an incompatible * type with the shader variable, the method call fails and FALSE is returned. * Otherwise, a new binding is added to the shader pass with the given attributes * and TRUE is returned. */ Bool addTextureBinding( const String& variableName, const TextureUsage& usage ); /// Add a texture binding for the variable with the given name to this shader pass. /** * If there is no shader for this shader pass, or the shader doesn't have a * variable with the specified name, or the specified texture or usage has an incompatible * type with the shader variable, the method call fails and FALSE is returned. * Otherwise, a new binding is added to the shader pass with the given attributes * and TRUE is returned. */ Bool addTextureBinding( const String& variableName, const Resource<GenericTexture>& texture, const TextureUsage& usage = TextureUsage::UNDEFINED, Bool isInput = true ); /// Set the texture binding for this shader pass at the specified index, replacing any previous binding. /** * If there is no shader for this shader pass, or the shader doesn't have a * binding with the specified index, or the specified texture or usage has an incompatible * type with the shader variable, the method call fails and FALSE is returned. * Otherwise, the previously existing binding is updated with the given attributes * and TRUE is returned. */ Bool setTextureBinding( Index bindingIndex, const Resource<GenericTexture>& texture, const TextureUsage& usage = TextureUsage::UNDEFINED, Bool isInput = true ); /// Set the texture usage for this shader pass at the specified binding index, replacing any previous usage. /** * If there is no shader for this shader pass, or the shader doesn't have a * binding with the specified index, or the specified usage has an incompatible * type with the shader variable, the method call fails and FALSE is returned. * Otherwise, the previously existing binding is updated with the given texture usage * and TRUE is returned. */ Bool setTextureUsage( Index bindingIndex, const TextureUsage& usage ); /// Remove the texture binding with the specified index in this shader pass. /** * If the texture binding is successfully removed, TRUE is returned. * Otherwise FALSE is returned and the shader pass is unmodified. */ Bool removeTextureBinding( Index bindingIndex ); /// Clear all texture bindings from this shader pass. void clearTextureBindings(); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Texture Accessor Methods /// Set the texture for this shader pass at the specified binding index, replacing any previous texture. /** * If there is no shader for this shader pass, or the shader doesn't have a * binding with the specified index, or the specified texture has an incompatible * type with the shader variable, the method call fails and FALSE is returned. * Otherwise, the previously existing binding is updated with the given texture * and TRUE is returned.. */ Bool setTexture( Index bindingIndex, const Resource<GenericTexture>& texture ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Vertex Binding Accessor Methods /// Get the number of vertex bindings associated with this shader pass. RIM_FORCE_INLINE Size getVertexBindingCount() const { return vertexBindings.getSize(); } /// Return a pointer to the VertexBinding at the specified index in this shader pas. /** * Binding indices range from 0 to the number of bindings minus one. * If there is no vertex binding that corresponds to that index, * NULL is returned. Otherwise, a pointer to the binding is returned. */ const GenericVertexBinding* getVertexBinding( Index bindingIndex ) const { if ( bindingIndex < vertexBindings.getSize() ) return &vertexBindings[bindingIndex]; else return NULL; } /// Return a pointer to the first vertex binding in this shader pass associated with the specified usage. /** * If there is no binding for that usage, NULL is returned. */ const GenericVertexBinding* getVertexBindingWithUsage( const VertexUsage& usage ) const; /// Get the index of the binding for the vertex variable with the specified name. /** * This method does an expensive linear search through the array of bindings * until it finds the variable with the specified name and places its index * in the output reference parameter. * * The method returns whether or not there was a binding for a variable with that name. */ Bool getVertexBindingIndex( const String& variableName, Index& bindingIndex ) const; /// Add a vertex binding for the variable with the given name to this shader pass. /** * If there is no shader for this shader pass, or the shader doesn't have a * variable with the specified name, or the specified vertex or usage has an incompatible * type with the shader variable, the method call fails and FALSE is returned. * Otherwise, a new binding is added to the shader pass with the given attributes * and TRUE is returned. */ Bool addVertexBinding( const String& variableName, const VertexUsage& usage ); /// Add a vertex binding for the variable with the given name to this shader pass. /** * If there is no shader for this shader pass, or the shader doesn't have a * variable with the specified name, or the specified vertex or usage has an incompatible * type with the shader variable, the method call fails and FALSE is returned. * Otherwise, a new binding is added to the shader pass with the given attributes * and TRUE is returned. */ Bool addVertexBinding( const String& variableName, const Pointer<GenericBuffer>& vertexBuffer, const VertexUsage& usage = VertexUsage::UNDEFINED, Bool isInput = true ); /// Set the vertex binding for this shader pass at the specified index, replacing any previous binding. /** * If there is no shader for this shader pass, or the shader doesn't have a * binding with the specified index, or the specified vertex or usage has an incompatible * type with the shader variable, the method call fails and FALSE is returned. * Otherwise, the previously existing binding is updated with the given attributes * and TRUE is returned. */ Bool setVertexBinding( Index bindingIndex, const Pointer<GenericBuffer>& vertexBuffer, const VertexUsage& usage = VertexUsage::UNDEFINED, Bool isInput = true ); /// Set the vertex for this shader pass at the specified binding index, replacing any previous vertex. /** * If there is no shader for this shader pass, or the shader doesn't have a * binding with the specified index, or the specified vertex has an incompatible * type with the shader variable, the method call fails and FALSE is returned. * Otherwise, the previously existing binding is updated with the given vertex * and TRUE is returned.. */ Bool setVertexBuffer( Index bindingIndex, const Pointer<GenericBuffer>& vertexBuffer ); /// Set the vertex usage for this shader pass at the specified binding index, replacing any previous usage. /** * If there is no shader for this shader pass, or the shader doesn't have a * binding with the specified index, or the specified usage has an incompatible * type with the shader variable, the method call fails and FALSE is returned. * Otherwise, the previously existing binding is updated with the given vertex usage * and TRUE is returned. */ Bool setVertexUsage( Index bindingIndex, const VertexUsage& usage ); /// Remove the vertex binding with the specified index in this shader pass. /** * If the vertex binding is successfully removed, TRUE is returned. * Otherwise FALSE is returned and the shader pass is unmodified. */ Bool removeVertexBinding( Index bindingIndex ); /// Clear all vertex bindings from this shader pass. void clearVertexBindings(); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Transparency Accessor Methods /// Get whether or not this shader pass produces pixels which are transparent. /** * A shader pass is deemed to be transparent if blending is enabled by the * shader pass's render mode. */ RIM_INLINE Bool getIsTransparent() const { return renderMode.flagIsSet( RenderFlags::BLENDING ); } /// Set whether or not this shader pass produces pixels which are transparent. /** * A shader pass is deemed to be transparent if blending is enabled by the * shader pass's render mode. Calling this method causes blending to be * enabled or disabled. */ RIM_INLINE void setIsTransparent( Bool newIsTransparent ) { renderMode.setFlag( RenderFlags::BLENDING, newIsTransparent ); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Render Mode Accessor Methods /// Return a reference to the object that determines the fixed-function rendering mode for this shader pass. RIM_INLINE RenderMode& getRenderMode() { return renderMode; } /// Return a const reference to the object that determines the fixed-function rendering mode for this shader pass. RIM_INLINE const RenderMode& getRenderMode() const { return renderMode; } /// Set an object that determines the fixed-function rendering mode for this shader pass. RIM_INLINE void setRenderMode( const RenderMode& newRenderMode ) { renderMode = newRenderMode; } private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Members /// A pointer to an object containing the source code for this shader pass's shader program. Pointer<GenericShaderProgram> program; /// An object which encapsulates the configuration of this shader pass's rendering pipeline. RenderMode renderMode; /// A list of the constant bindings for this shader pass source. ArrayList<GenericConstantBinding> constantBindings; /// A list of the texture bindings for this shader pass source. ArrayList<GenericTextureBinding> textureBindings; /// A list of the vertex bindings for this shader pass source. ArrayList<GenericVertexBinding> vertexBindings; }; //########################################################################################## //*********************** End Rim Graphics Shaders Namespace ***************************** RIM_GRAPHICS_SHADERS_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_GRAPHICS_SHADER_PASS_SOURCE_H <file_sep>/* * rimSIMDPlane3D.h * Rim Framework * * Created by <NAME> on 7/12/12. * Copyright 2012 __MyCompanyName__. All rights reserved. * */ #ifndef INCLUDE_RIM_SIMD_PLANE_3D_H #define INCLUDE_RIM_SIMD_PLANE_3D_H #include "rimMathConfig.h" #include "rimPlane3D.h" #include "rimSIMDVector3D.h" //########################################################################################## //***************************** Start Rim Math Namespace ********************************* RIM_MATH_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A template prototype declaration for the SIMDPlane3D class. /** * This class is used to store and operate on a set of N 3D planes * in a SIMD fashion. The planes are stored in a structure-of-arrays format * that accelerates SIMD operations. Each plane is specified by a normal and * origin offset. */ template < typename T, Size dimension > class SIMDPlane3D; //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A specialization for the SIMDPlane3D class that has a SIMD width of 4. /** * This class is used to store and operate on a set of 4 3D planes * in a SIMD fashion. The planes are stored in a structure-of-arrays format * that accelerates SIMD operations. Each plane is specified by a normal and * origin offset. */ template < typename T > class RIM_ALIGN(16) SIMDPlane3D<T,4> { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructors /// Create a SIMD plane with N copies of the specified plane for a SIMD width of N. RIM_FORCE_INLINE SIMDPlane3D( const Plane3D<T>& plane ) : normal( plane.normal ), offset( plane.offset ) { } /// Create a SIMD plane with the 4 planes it contains equal to the specified planes. RIM_FORCE_INLINE SIMDPlane3D( const Plane3D<T>& plane1, const Plane3D<T>& plane2, const Plane3D<T>& plane3, const Plane3D<T>& plane4 ) : normal( plane1.normal, plane2.normal, plane3.normal, plane4.normal ), offset( plane1.offset, plane2.offset, plane3.offset, plane4.offset ) { } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Point Distance Methods /// Get the perpendicular distance from the specified point to the plane. RIM_FORCE_INLINE SIMDScalar<T,4> getDistanceTo( const SIMDVector3D<T,4>& point ) const { return math::abs( math::dot( normal, point ) + offset ); } /// Get the perpendicular distance from the specified point to the plane. RIM_FORCE_INLINE SIMDScalar<T,4> getSignedDistanceTo( const SIMDVector3D<T,4>& point ) const { return math::dot( normal, point ) + offset; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Public Data Members /// A SIMD 3D vector indicating the normals of the planes. SIMDVector3D<T,4> normal; /// A SIMD scalar indicating the distance that the planes are offset from the origin. SIMDScalar<T,4> offset; }; //########################################################################################## //***************************** End Rim Math Namespace *********************************** RIM_MATH_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_SIMD_PLANE_3D_H <file_sep>/* * rimGraphicsTexture.h * Rim Graphics * * Created by <NAME> on 11/28/09. * Copyright 2009 Rim Software. All rights reserved. * */ #ifndef INCLUDE_RIM_GRAPHICS_TEXTURE_H #define INCLUDE_RIM_GRAPHICS_TEXTURE_H #include "rimGraphicsTexturesConfig.h" #include "rimGraphicsTextureFormat.h" #include "rimGraphicsTextureFilterType.h" #include "rimGraphicsTextureWrapType.h" #include "rimGraphicsTextureFace.h" //########################################################################################## //********************** Start Rim Graphics Textures Namespace *************************** RIM_GRAPHICS_TEXTURES_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class which represents an image stored on the graphics hardware. /** * A texture can be either 1D, 2D, 3D, or a cube map (six 2D faces), with * any common texture format (Alpha, Gray, RGB, RGBA, etc.). */ class Texture : public ContextObject { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Size Accessor Methods /// Return the number of dimensions in this texture, usually 1, 2, or 3. virtual Size getDimensionCount() const = 0; /// Return the size of the texture along the X direction (dimension 0). RIM_INLINE Size getWidth() const { return this->getSize( 0 ); } /// Return the size of the texture along the Y direction (dimension 1). RIM_INLINE Size getHeight() const { return this->getSize( 1 ); } /// Return the size of the texture along the Z direction (dimension 2). RIM_INLINE Size getDepth() const { return this->getSize( 2 ); } /// Return the size of the texture along the specified dimension index. /** * Indices start from 0 and count to d-1 for a texture with d dimensions. * The method returns a size of 1 for all out-of-bounds dimensions. */ virtual Size getSize( Index dimension ) const = 0; /// Return the total number of texels in the texture. Size getTexelCount() const; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Texture Face Accessor Methods /// Return the number of faces that this texture has. /** * A normal texture will have 1 face, while a cube map texture will have * 6 faces. */ RIM_INLINE Size getFaceCount() const { if ( this->isACubeMap() ) return 6; else return 1; } /// Return whether or not this texture is a cube map texture. virtual Bool isACubeMap() const = 0; /// Return whether or not the specified face is valid for this texture. RIM_INLINE Bool isValidFace( TextureFace face ) const { return face == TextureFace::FRONT || this->isACubeMap(); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Texture Format Accessor Method /// Return a object which represents the internal storage format for the texture. virtual TextureFormat getFormat() const = 0; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Image Data Accessor Methods /// Get the texture's image data for the specified face index with the data in the default pixel type. /** * If the face type is not equal to TextureFace::FRONT and the texture is not a cube map * texture, the method can fail and FALSE is returned. Otherwise, the method succeeds and * TRUE is returned. */ RIM_INLINE Bool getImage( Image& image, TextureFace face = TextureFace::FRONT, Index mipmapLevel = 0 ) const { return this->getImage( image, this->getFormat().getPixelFormat(), face, mipmapLevel ); } /// Get the texture's image data for the specified face index with the data in the specified pixel type. /** * If the face type is not equal to TextureFace::FRONT and the texture is not a cube map * texture, an empty image with UNDEFINED pixel type is returned. */ virtual Bool getImage( Image& image, const PixelFormat& pixelType, TextureFace face = TextureFace::FRONT, Index mipmapLevel = 0 ) const = 0; /// Replace the current contents of the texture with the specified image. /** * If the image's pixel type is not compatable with the current type of the * texture, or if the face index is not equal to TextureFace::FRONT and the texture * is not a cube map texture, or if an invalid mipmap level is specified, * FALSE is returned indicating failure and the method has no effect. * Otherwise, the method succeeds and TRUE is returned. */ RIM_INLINE Bool setImage( const Image& newImage, TextureFace face = TextureFace::FRONT, Index mipmapLevel = 0 ) { return this->setImage( newImage, TextureFormat(newImage.getPixelFormat()), face, mipmapLevel ); } /// Replace the current contents of the texture with the specified image. /** * If the image's pixel type is not compatable with the current type of the * texture, or if the face index is not equal to TextureFace::FRONT and the texture * is not a cube map texture, or if an invalid mipmap level is specified, * FALSE is returned indicating failure and the method has no effect. * Otherwise, the method succeeds and TRUE is returned. */ virtual Bool setImage( const Image& newImage, TextureFormat newTextureFormat, TextureFace face = TextureFace::FRONT, Index mipmapLevel = 0 ) = 0; /// Update a region of the texture with the specified image. RIM_INLINE Bool updateImage( const Image& newImage, Int position, TextureFace face = TextureFace::FRONT, Index mipmapLevel = 0 ) { return this->updateImage( newImage, Vector3i( position, 0, 0 ), face, mipmapLevel ); } /// Update a region of the texture with the specified image. RIM_INLINE Bool updateImage( const Image& newImage, const Vector2i& position, TextureFace face = TextureFace::FRONT, Index mipmapLevel = 0 ) { return this->updateImage( newImage, Vector3i( position, 0 ), face, mipmapLevel ); } /// Update a region of the texture with the specified image. /** * This method replaces some of the pixels that are currently part of the texture * with the pixels stored in the specified image. The texture is replaced with the * image starting at the specified position in pixels from its lower left corner. * * If the updated pixels will lie outside of the texture's area, or if the * image's pixel type is not compatable with the current type of the * texture, or if the face index is not equal to TextureFace::FRONT and the texture * is not a cube map texture, FALSE is returned indicating failure and the method * has no effect. Otherwise, the method succeeds and TRUE is returned. */ virtual Bool updateImage( const Image& newImage, const Vector3i& position, TextureFace face = TextureFace::FRONT, Index mipmapLevel = 0 ) = 0; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Texture Clear Method /// Clear this texture's image using the specified clear color component for the given face and mipmap level. /** * This method initializes every texel of the texture with the specified * color component for every texture component. * * The method returns whether or not the clear operation was successful. */ virtual Bool clear( Float channelColor, TextureFace face = TextureFace::FRONT, Index mipmapLevel = 0 ) = 0; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Texture Wrap Type Accessor Methods /// Get the type of texture wrapping to do when texture coordinates are outside of the range [0,1]. virtual TextureWrapType getWrapType() const = 0; /// Set the type of texture wrapping to do when texture coordinates are outside of the range [0,1]. virtual Bool setWrapType( const TextureWrapType& newWrapType ) = 0; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Texture Minification Filter Type Accessor Methods /// Get the type of texture filtering which is used when the texture is reduced in size. virtual TextureFilterType getMinificationFilterType() const = 0; /// Set the type of texture filtering which is used when the texture is reduced in size. virtual Bool setMinificationFilterType( const TextureFilterType& newMinificationFilterType ) = 0; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Texture Magnification Filter Type Accessor Methods /// Get the type of texture filtering which is used when the texture is increased in size. virtual TextureFilterType getMagnificationFilterType() const = 0; /// Set the type of texture filtering which is used when the texture is increased in size. virtual Bool setMagnificationFilterType( const TextureFilterType& newMagnificationFilterType ) = 0; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Mipmap Accessor Methods /// Generate smaller mipmaps of the texture from the largest texture image (level 0). /** * This method automatically scales down the largest mipmap level (level 0) for * each of the smaller mipmap levels (>1), replacing any previous mipmap information. */ virtual Bool generateMipmaps() = 0; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Texture Residency Accessor Methods /// Return whether or not the texture is currently in memory on the GPU. virtual Bool isResident() const = 0; protected: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Protected Constructor /// Create a new texture which is associated with the specified graphics context. RIM_INLINE Texture( const devices::GraphicsContext* newContext ) : ContextObject( newContext ) { } }; //########################################################################################## //********************** End Rim Graphics Textures Namespace ***************************** RIM_GRAPHICS_TEXTURES_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_GRAPHICS_TEXTURE_H <file_sep>/* * rimSoundMIDIDeviceID.h * Rim Sound * * Created by <NAME> on 4/2/13. * Copyright 2013 __MyCompanyName__. All rights reserved. * */ #ifndef INCLUDE_RIM_SOUND_MIDI_DEVICE_ID_H #define INCLUDE_RIM_SOUND_MIDI_DEVICE_ID_H #include "rimSoundDevicesConfig.h" //########################################################################################## //************************ Start Rim Sound Devices Namespace ***************************** RIM_SOUND_DEVICES_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class which is used to encapsulate a unique identifier for a system MIDI device. /** * This opaque type uses a platform-dependent internal representation which uniquelly * identifies a MIDI device. */ class MIDIDeviceID { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Public Constants /// Define an instance of MIDIDeviceID that represents an invalid device. static const MIDIDeviceID INVALID_DEVICE; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Comparison Operators /// Return whether or not this device ID represents the same device as another. RIM_INLINE Bool operator == ( const MIDIDeviceID& other ) const { return deviceID == other.deviceID && input == other.input && output == other.output; } /// Return whether or not this device ID represents a different device than another. RIM_INLINE Bool operator != ( const MIDIDeviceID& other ) const { return deviceID != other.deviceID || input != other.input || output != other.output; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Device Status Accessor Methods /// Return whether or not this MIDIDeviceID represents a valid device. /** * This condition is met whenever the device ID is not equal to INVALID_DEVICE_ID. */ RIM_INLINE Bool isValid() const { return deviceID != INVALID_DEVICE_ID; } /// Return whether or not this device ID represents a device capable of MIDI input. RIM_INLINE Bool isInput() const { return input; } /// Return whether or not this device ID represents a device capable of MIDI output. RIM_INLINE Bool isOutput() const { return output; } private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Constructor #if defined(RIM_PLATFORM_APPLE) #if defined(RIM_PLATFORM_64_BIT) /// Create a MIDIDeviceID object which represents the device with the specified device ID. RIM_INLINE MIDIDeviceID( UInt32 newDeviceID, Bool newIsInput, Bool newIsOutput ) : deviceID( newDeviceID ), input( newIsInput ), output( newIsOutput ) { } #else /// Create a MIDIDeviceID object which represents the device with the specified device ID. RIM_INLINE MIDIDeviceID( void* newDeviceID, Bool newIsInput, Bool newIsOutput ) : deviceID( newDeviceID ), input( newIsInput ), output( newIsOutput ) { } #endif #elif defined(RIM_PLATFORM_WINDOWS) RIM_INLINE MIDIDeviceID( UInt newDeviceID, Bool newIsInput, Bool newIsOutput ) : deviceID( newDeviceID ), input( newIsInput ), output( newIsOutput ) { } #endif //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Conversion Methods #if defined(RIM_PLATFORM_APPLE) #if defined(RIM_PLATFORM_64_BIT) /// Convert this MIDIDeviceID object to a 32-bit integer which uniquely represents a MIDI device. RIM_INLINE UInt32 getInternalID() const { return deviceID; } #else /// Convert this MIDIDeviceID object to a pointer which uniquely represents a MIDI device. RIM_INLINE void* getInternalID() const { return deviceID; } #endif #elif defined(RIM_PLATFORM_WINDOWS) /// Convert this MIDIDeviceID object to an integer which uniquely represents a MIDI device. RIM_INLINE UInt getInternalID() const { return deviceID; } #endif #if defined(RIM_PLATFORM_APPLE) #if defined(RIM_PLATFORM_64_BIT) /// Convert this MIDIDeviceID object to a 32-bit integer which uniquely represents a MIDI device. RIM_INLINE operator UInt32 () const { return deviceID; } #else /// Convert this MIDIDeviceID object to a pointer which uniquely represents a MIDI device. RIM_INLINE operator void* () const { return deviceID; } #endif #elif defined(RIM_PLATFORM_WINDOWS) /// Convert this MIDIDeviceID object to an integer which uniquely represents a MIDI device. RIM_INLINE operator UInt () const { return deviceID; } #endif //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Members #if defined(RIM_PLATFORM_APPLE) #if defined(RIM_PLATFORM_64_BIT) /// The underlying representation of a MIDIDeviceID on 64-bit Mac OS X, a 32-bit integer. UInt32 deviceID; /// The reserved ID used to indicate an invalid device. static UInt32 INVALID_DEVICE_ID; #else /// The underlying representation of a MIDIDeviceID on 32-bit Mac OS X, a pointer. void* deviceID; /// The reserved ID used to indicate an invalid device. static void* INVALID_DEVICE_ID; #endif #elif defined(RIM_PLATFORM_WINDOWS) /// The underlying representation of a MIDIDeviceID on Windows, an unsigned integer. UInt deviceID; /// The reserved ID used to indicate an invalid device. static UInt INVALID_DEVICE_ID; #endif /// A boolean value indicating whether or not this device ID represents an input device. Bool input; /// A boolean value indicating whether or not this device ID represents an output device. Bool output; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Friend Declaration /// Declare the MIDIDeviceManager a friend so that it can construct MIDIDeviceID objects. friend class MIDIDeviceManager; /// Declare the MIDIDevice a friend so that it can construct MIDIDeviceID objects. friend class MIDIDevice; }; //########################################################################################## //************************ End Rim Sound Devices Namespace ******************************* RIM_SOUND_DEVICES_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_SOUND_MIDI_DEVICE_ID_H <file_sep>/* * Project: Rim Framework * * File: rim/math/SIMDScalarInt16_8.h * * Version: 1.0.0 * * Contents: rim::math::SIMDScalar class specialization for an 8x16-bit integer SIMD data type. * * License: * * Copyright (C) 2010-12 <NAME>. * All rights reserved. * * * Contact Information: * * Please send all bug reports and other contact to: * <NAME> * <EMAIL> * */ #ifndef INCLUDE_RIM_SIMD_SCALAR_INT_16_8_H #define INCLUDE_RIM_SIMD_SCALAR_INT_16_8_H #include "rimMathConfig.h" #include "rimSIMDScalar.h" //########################################################################################## //***************************** Start Rim Math Namespace ********************************* RIM_MATH_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class representing a 8-component 16-bit signed-integer SIMD scalar. /** * This specialization of the SIMDScalar class uses a 128-bit value to encode * 8 16-bit signed-integer values. All basic arithmetic operations are supported, * plus a subset of standard scalar operations: abs(), min(), max(), sqrt(). */ template <> class RIM_ALIGN(16) SIMDScalar<Int16,8> { private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Type Declarations /// Define the type for a 4x float scalar structure. #if RIM_USE_SIMD && defined(RIM_SIMD_ALTIVEC) typedef RIM_ALTIVEC_VECTOR short SIMDInt16; #elif RIM_USE_SIMD && defined(RIM_SIMD_SSE) #if RIM_SSE_VERSION_IS_SUPPORTED(1,0) typedef __m128 SIMDInt16Float; #endif #if RIM_SSE_VERSION_IS_SUPPORTED(2,0) typedef __m128i SIMDInt16; #endif #endif //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Constructor #if RIM_USE_SIMD && (defined(RIM_SIMD_ALTIVEC) || defined(RIM_SIMD_SSE) && RIM_SSE_VERSION_IS_SUPPORTED(2,0)) /// Create a new 4D vector with the specified 4D SIMD vector value. RIM_FORCE_INLINE SIMDScalar( SIMDInt16 simdScalar ) : v( simdScalar ) { } #endif #if RIM_USE_SIMD && defined(RIM_SIMD_SSE) && RIM_SSE_VERSION_IS_SUPPORTED(1,0) /// Create a new 4D vector with the specified 4D SIMD vector value. RIM_FORCE_INLINE SIMDScalar( SIMDInt16Float simdScalar ) : vFloat( simdScalar ) { } #endif public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructors /// Create a new 4D SIMD scalar with all elements left uninitialized. RIM_FORCE_INLINE SIMDScalar() { } /// Create a new 4D SIMD scalar with all elements equal to the specified value. RIM_FORCE_INLINE SIMDScalar( Int16 value ) { #if RIM_USE_SIMD && defined(RIM_SIMD_ALTIVEC) v = (SIMDInt16)(value); #elif RIM_USE_SIMD && defined(RIM_SIMD_SSE) && RIM_SSE_VERSION_IS_SUPPORTED(2,0) v = _mm_set1_epi16( value ); #else a = b = c = d = e = f = g = h = value; #endif } /// Create a new 4D SIMD scalar with the elements equal to the specified 4 values. RIM_FORCE_INLINE SIMDScalar( Int16 newA, Int16 newB, Int16 newC, Int16 newD, Int16 newE, Int16 newF, Int16 newG, Int16 newH ) { #if RIM_USE_SIMD && defined(RIM_SIMD_ALTIVEC) v = (SIMDInt16)( newA, newB, newC, newD, newE, newF, newG, newH ); #elif RIM_USE_SIMD && defined(RIM_SIMD_SSE) && RIM_SSE_VERSION_IS_SUPPORTED(2,0) // The parameters are reversed to keep things consistent with loading from an address. v = _mm_set_epi16( newH, newG, newF, newE, newD, newC, newB, newA ); #else a = newA; b = newB; c = newC; d = newD; e = newE; f = newF; g = newG; h = newH; #endif } /// Create a new 4D SIMD scalar from the first 4 values stored at specified pointer's location. RIM_FORCE_INLINE SIMDScalar( const Int16* array ) { #if RIM_USE_SIMD && defined(RIM_SIMD_ALTIVEC) a = array[0]; b = array[1]; c = array[2]; d = array[3]; e = array[4]; f = array[5]; g = array[6]; h = array[7]; #elif RIM_USE_SIMD && defined(RIM_SIMD_SSE) && RIM_SSE_VERSION_IS_SUPPORTED(2,0) v = _mm_load_si128( (const SIMDInt16*)array ); #else a = array[0]; b = array[1]; c = array[2]; d = array[3]; e = array[4]; f = array[5]; g = array[6]; h = array[7]; #endif } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Copy Constructor /// Create a new SIMD scalar with the same contents as another. /** * This shouldn't have to be overloaded, but for some reason the compiler (GCC) * optimizes SIMD code better with it overloaded. Before, the compiler would * store the result of a SIMD operation on the stack before transfering it to * the destination, resulting in an extra 8+ load/stores per computation. */ RIM_FORCE_INLINE SIMDScalar( const SIMDScalar& other ) { #if RIM_USE_SIMD && defined(RIM_SIMD_ALTIVEC) v = other.v; #elif RIM_USE_SIMD && defined(RIM_SIMD_SSE) && RIM_SSE_VERSION_IS_SUPPORTED(2,0) v = other.v; #elif RIM_USE_SIMD && defined(RIM_SIMD_SSE) && RIM_SSE_VERSION_IS_SUPPORTED(1,0) vFloat = other.vFloat; #else a = other.a; b = other.b; c = other.c; d = other.d; e = other.e; f = other.f; g = other.g; h = other.h; #endif } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Assignment Operator /// Assign the contents of one SIMDScalar object to another. /** * This shouldn't have to be overloaded, but for some reason the compiler (GCC) * optimizes SIMD code better with it overloaded. Before, the compiler would * store the result of a SIMD operation on the stack before transfering it to * the destination, resulting in an extra 8+ load/stores per computation. */ RIM_FORCE_INLINE SIMDScalar& operator = ( const SIMDScalar& other ) { #if RIM_USE_SIMD && defined(RIM_SIMD_ALTIVEC) v = other.v; #elif RIM_USE_SIMD && defined(RIM_SIMD_SSE) && RIM_SSE_VERSION_IS_SUPPORTED(2,0) v = other.v; #elif RIM_USE_SIMD && defined(RIM_SIMD_SSE) && RIM_SSE_VERSION_IS_SUPPORTED(1,0) vFloat = other.vFloat; #else a = other.a; b = other.b; c = other.c; d = other.d; e = other.e; f = other.f; g = other.g; h = other.h; #endif return *this; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Load Methods RIM_FORCE_INLINE static SIMDScalar load( const Int16* array ) { #if RIM_USE_SIMD && defined(RIM_SIMD_ALTIVEC) return SIMDScalar( array[0], array[1], array[2], array[3], array[4], array[5], array[6], array[7] ); #elif RIM_USE_SIMD && defined(RIM_SIMD_SSE) && RIM_SSE_VERSION_IS_SUPPORTED(1,0) return SIMDScalar( _mm_load_si128( (const SIMDInt16*)array ) ); #else return SIMDScalar( array[0], array[1], array[2], array[3], array[4], array[5], array[6], array[7] ); #endif } RIM_FORCE_INLINE static SIMDScalar loadUnaligned( const Int16* array ) { #if RIM_USE_SIMD && defined(RIM_SIMD_ALTIVEC) return SIMDScalar( array[0], array[1], array[2], array[3], array[4], array[5], array[6], array[7] ); #elif RIM_USE_SIMD && defined(RIM_SIMD_SSE) && RIM_SSE_VERSION_IS_SUPPORTED(1,0) return SIMDScalar( _mm_loadu_si128( (const SIMDInt16*)array ) ); #else return SIMDScalar( array[0], array[1], array[2], array[3], array[4], array[5], array[6], array[7] ); #endif } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Store Method /// Store the contents of this SIMD scalar into the specified aligned destination pointer. RIM_FORCE_INLINE void store( Int16* destination ) const { #if RIM_USE_SIMD && defined(RIM_SIMD_ALTIVEC) destination[0] = a; destination[1] = b; destination[2] = c; destination[3] = d; destination[4] = e; destination[5] = f; destination[6] = g; destination[7] = h; #elif RIM_USE_SIMD && defined(RIM_SIMD_SSE) && RIM_SSE_VERSION_IS_SUPPORTED(2,0) _mm_store_si128( (SIMDInt16*)destination, v ); #else destination[0] = a; destination[1] = b; destination[2] = c; destination[3] = d; destination[4] = e; destination[5] = f; destination[6] = g; destination[7] = h; #endif } /// Store the contents of this SIMD scalar into the specified unaligned destination pointer. RIM_FORCE_INLINE void storeUnaligned( Int16* destination ) const { #if RIM_USE_SIMD && defined(RIM_SIMD_ALTIVEC) destination[0] = a; destination[1] = b; destination[2] = c; destination[3] = d; destination[4] = e; destination[5] = f; destination[6] = g; destination[7] = h; #elif RIM_USE_SIMD && defined(RIM_SIMD_SSE) && RIM_SSE_VERSION_IS_SUPPORTED(1,0) _mm_storeu_si128( (SIMDInt16*)destination, v ); #else destination[0] = a; destination[1] = b; destination[2] = c; destination[3] = d; destination[4] = e; destination[5] = f; destination[6] = g; destination[7] = h; #endif } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Accessor Methods /// Return a reference to the value stored at the specified component index in this scalar. RIM_FORCE_INLINE Int16& operator [] ( Index i ) { return x[i]; } /// Return the value stored at the specified component index in this scalar. RIM_FORCE_INLINE Int16 operator [] ( Index i ) const { return x[i]; } /// Return a pointer to the first element in this scalar. /** * The remaining values are in the next 7 locations after the * first element. */ RIM_FORCE_INLINE const Int16* toArray() const { return x; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Logical Operators /// Return the bitwise NOT of this 4D SIMD vector. RIM_FORCE_INLINE SIMDScalar operator ~ () const { #if RIM_USE_SIMD && defined(RIM_SIMD_ALTIVEC) return SIMDScalar( vec_nor( v, v ) ); #elif RIM_USE_SIMD && defined(RIM_SIMD_SSE) && RIM_SSE_VERSION_IS_SUPPORTED(2,0) return SIMDScalar( _mm_xor_si128( v, _mm_set1_epi16( Int16(0xFFFF) ) ) ); #else return SIMDScalar( ~a, ~b, ~c, ~d, ~e, ~f, ~g, ~h ); #endif } /// Compute the bitwise AND of this 4D SIMD vector with another and return the result. RIM_FORCE_INLINE SIMDScalar operator & ( const SIMDScalar& vector ) const { #if RIM_USE_SIMD && defined(RIM_SIMD_ALTIVEC) return SIMDScalar( vec_and( v, vector.v ) ); #elif RIM_USE_SIMD && defined(RIM_SIMD_SSE) && RIM_SSE_VERSION_IS_SUPPORTED(2,0) return SIMDScalar( _mm_and_si128( v, vector.v ) ); #else return SIMDScalar( a & vector.a, b & vector.b, c & vector.c, d & vector.d, e & vector.e, f & vector.f, g & vector.g, h & vector.h ); #endif } /// Compute the bitwise OR of this 4D SIMD vector with another and return the result. RIM_FORCE_INLINE SIMDScalar operator | ( const SIMDScalar& vector ) const { #if RIM_USE_SIMD && defined(RIM_SIMD_ALTIVEC) return SIMDScalar( vec_or( v, vector.v ) ); #elif RIM_USE_SIMD && defined(RIM_SIMD_SSE) && RIM_SSE_VERSION_IS_SUPPORTED(2,0) return SIMDScalar( _mm_or_si128( v, vector.v ) ); #else return SIMDScalar( a | vector.a, b | vector.b, c | vector.c, d | vector.d, e | vector.e, f | vector.f, g | vector.g, h | vector.h ); #endif } /// Compute the bitwise XOR of this 4D SIMD vector with another and return the result. RIM_FORCE_INLINE SIMDScalar operator ^ ( const SIMDScalar& vector ) const { #if RIM_USE_SIMD && defined(RIM_SIMD_ALTIVEC) return SIMDScalar( vec_xor( v, vector.v ) ); #elif RIM_USE_SIMD && defined(RIM_SIMD_SSE) && RIM_SSE_VERSION_IS_SUPPORTED(2,0) return SIMDScalar( _mm_xor_si128( v, vector.v ) ); #else return SIMDScalar( a ^ vector.a, b ^ vector.b, c ^ vector.c, d ^ vector.d, e ^ vector.e, f ^ vector.f, g ^ vector.g, h ^ vector.h ); #endif } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Logical Assignment Operators /// Compute the logical AND of this 4D SIMD vector with another and assign it to this vector. RIM_FORCE_INLINE SIMDScalar& operator &= ( const SIMDScalar& vector ) { #if RIM_USE_SIMD && defined(RIM_SIMD_ALTIVEC) v = vec_and( v, vector.v ); #elif RIM_USE_SIMD && defined(RIM_SIMD_SSE) && RIM_SSE_VERSION_IS_SUPPORTED(2,0) v = _mm_and_si128( v, vector.v ); #else a &= vector.a; b &= vector.b; c &= vector.c; d &= vector.d; e &= vector.e; f &= vector.f; g &= vector.g; h &= vector.h; #endif return *this; } /// Compute the logical OR of this 4D SIMD vector with another and assign it to this vector. RIM_FORCE_INLINE SIMDScalar& operator |= ( const SIMDScalar& vector ) { #if RIM_USE_SIMD && defined(RIM_SIMD_ALTIVEC) v = vec_or( v, vector.v ); #elif RIM_USE_SIMD && defined(RIM_SIMD_SSE) && RIM_SSE_VERSION_IS_SUPPORTED(2,0) v = _mm_or_si128( v, vector.v ); #else a |= vector.a; b |= vector.b; c |= vector.c; d |= vector.d; e |= vector.e; f |= vector.f; g |= vector.g; h |= vector.h; #endif return *this; } /// Compute the bitwise XOR of this 4D SIMD vector with another and assign it to this vector. RIM_FORCE_INLINE SIMDScalar& operator ^= ( const SIMDScalar& vector ) { #if RIM_USE_SIMD && defined(RIM_SIMD_ALTIVEC) v = vec_xor( v, vector.v ); #elif RIM_USE_SIMD && defined(RIM_SIMD_SSE) && RIM_SSE_VERSION_IS_SUPPORTED(2,0) v = _mm_xor_si128( v, vector.v ); #else a ^= vector.a; b ^= vector.b; c ^= vector.c; d ^= vector.d; e ^= vector.e; f ^= vector.f; g ^= vector.g; h ^= vector.h; #endif return *this; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Comparison Operators /// Compare two 4D SIMD scalars component-wise for equality. /** * Return a 4D scalar of booleans indicating the result of the comparison. * If each corresponding pair of components is equal, the corresponding result * component is non-zero. Otherwise, that result component is equal to zero. */ RIM_FORCE_INLINE SIMDScalar operator == ( const SIMDScalar& scalar ) const { #if RIM_USE_SIMD && defined(RIM_SIMD_ALTIVEC) return SIMDScalar( vec_cmpeq( v, scalar.v ) ); #elif RIM_USE_SIMD && defined(RIM_SIMD_SSE) && RIM_SSE_VERSION_IS_SUPPORTED(2,0) return SIMDScalar( _mm_cmpeq_epi16( v, scalar.v ) ); #else return SIMDScalar( a == scalar.a, b == scalar.b, c == scalar.c, d == scalar.d, e == scalar.e, f == scalar.f, g == scalar.g, h == scalar.h ); #endif } /// Compare this scalar to a single floating point value for equality. /** * Return a 4D scalar of booleans indicating the result of the comparison. * The float value is expanded to a 4-wide SIMD scalar and compared with this scalar. * If each corresponding pair of components is equal, the corresponding result * component is non-zero. Otherwise, that result component is equal to zero. */ RIM_FORCE_INLINE SIMDScalar operator == ( const Int16 value ) const { #if RIM_USE_SIMD && defined(RIM_SIMD_ALTIVEC) return SIMDScalar( vec_cmpeq( v, (SIMDInt16)(value) ) ); #elif RIM_USE_SIMD && defined(RIM_SIMD_SSE) && RIM_SSE_VERSION_IS_SUPPORTED(2,0) return SIMDScalar( _mm_cmpeq_epi16( v, _mm_set1_epi16(value) ) ); #else return SIMDScalar( a == value, b == value, c == value, d == value, e == value, f == value, g == value, h == value ); #endif } /// Compare two 4D SIMD scalars component-wise for inequality /** * Return a 4D scalar of booleans indicating the result of the comparison. * If each corresponding pair of components is not equal, the corresponding result * component is non-zero. Otherwise, that result component is equal to zero. */ RIM_FORCE_INLINE SIMDScalar operator != ( const SIMDScalar& scalar ) const { #if RIM_USE_SIMD && defined(RIM_SIMD_ALTIVEC) const SIMDInt16 temp = vec_cmpeq( v, scalar.v ); return SIMDScalar( vec_nor( temp, temp ) ); #elif RIM_USE_SIMD && defined(RIM_SIMD_SSE) && RIM_SSE_VERSION_IS_SUPPORTED(2,0) return SIMDScalar( _mm_xor_si128( _mm_cmpeq_epi16( v, scalar.v ), _mm_set1_epi16( Int16(0xFFFF) ) ) ); #else return SIMDScalar( a != scalar.a, b != scalar.b, c != scalar.c, d != scalar.d, e != scalar.e, f != scalar.f, g != scalar.g, h != scalar.h ); #endif } /// Compare this scalar to a single floating point value for inequality. /** * Return a 4D scalar of booleans indicating the result of the comparison. * The float value is expanded to a 4-wide SIMD scalar and compared with this scalar. * If each corresponding pair of components is not equal, the corresponding result * component is non-zero. Otherwise, that result component is equal to zero. */ RIM_FORCE_INLINE SIMDScalar operator != ( const Int16 value ) const { #if RIM_USE_SIMD && defined(RIM_SIMD_ALTIVEC) const SIMDInt16 temp = vec_cmpeq( v, (SIMDInt16)(value) ); return SIMDScalar( vec_nor( temp, temp ) ); #elif RIM_USE_SIMD && defined(RIM_SIMD_SSE) && RIM_SSE_VERSION_IS_SUPPORTED(2,0) return SIMDScalar( _mm_xor_si128( _mm_cmpeq_epi16( v, _mm_set1_epi16(value) ), _mm_set1_epi16( Int16(0xFFFF) ) ) ); #else return SIMDScalar( a != value, b != value, c != value, d != value, e != value, f != value, g != value, h != value ); #endif } /// Perform a component-wise less-than comparison between this an another 4D SIMD scalar. /** * Return a 4D scalar of booleans indicating the result of the comparison. * If each corresponding pair of components has this scalar's component less than * the other scalar's component, the corresponding result component is non-zero. * Otherwise, that result component is equal to zero. */ RIM_FORCE_INLINE SIMDScalar operator < ( const SIMDScalar& scalar ) const { #if RIM_USE_SIMD && defined(RIM_SIMD_ALTIVEC) return SIMDScalar( vec_cmplt( v, scalar.v ) ); #elif RIM_USE_SIMD && defined(RIM_SIMD_SSE) && RIM_SSE_VERSION_IS_SUPPORTED(2,0) return SIMDScalar( _mm_cmplt_epi16( v, scalar.v ) ); #else return SIMDScalar( a < scalar.a, b < scalar.b, c < scalar.c, d < scalar.d, e < scalar.e, f < scalar.f, g < scalar.g, h < scalar.h ); #endif } /// Perform a component-wise less-than comparison between this 4D SIMD scalar and an expanded scalar. /** * Return a 4D scalar of booleans indicating the result of the comparison. * The float value is expanded to a 4-wide SIMD scalar and compared with this scalar. * If each corresponding pair of components has this scalar's component less than * the other scalar's component, the corresponding result component is non-zero. * Otherwise, that result component is equal to zero. */ RIM_FORCE_INLINE SIMDScalar operator < ( const Int16 value ) const { #if RIM_USE_SIMD && defined(RIM_SIMD_ALTIVEC) return SIMDScalar( vec_cmplt( v, (SIMDInt16)(value) ) ); #elif RIM_USE_SIMD && defined(RIM_SIMD_SSE) && RIM_SSE_VERSION_IS_SUPPORTED(2,0) return SIMDScalar( _mm_cmplt_epi16( v, _mm_set1_epi16(value) ) ); #else return SIMDScalar( a < value, b < value, c < value, d < value, e < value, f < value, g < value, h < value ); #endif } /// Perform a component-wise greater-than comparison between this an another 4D SIMD scalar. /** * Return a 4D scalar of booleans indicating the result of the comparison. * If each corresponding pair of components has this scalar's component greater than * the other scalar's component, the corresponding result component is non-zero. * Otherwise, that result component is equal to zero. */ RIM_FORCE_INLINE SIMDScalar operator > ( const SIMDScalar& scalar ) const { #if RIM_USE_SIMD && defined(RIM_SIMD_ALTIVEC) return SIMDScalar( vec_cmpgt( v, scalar.v ) ); #elif RIM_USE_SIMD && defined(RIM_SIMD_SSE) && RIM_SSE_VERSION_IS_SUPPORTED(2,0) return SIMDScalar( _mm_cmpgt_epi16( v, scalar.v ) ); #else return SIMDScalar( a > scalar.a, b > scalar.b, c > scalar.c, d > scalar.d, e > scalar.e, f > scalar.f, g > scalar.g, h > scalar.h ); #endif } /// Perform a component-wise greater-than comparison between this 4D SIMD scalar and an expanded scalar. /** * Return a 4D scalar of booleans indicating the result of the comparison. * The float value is expanded to a 4-wide SIMD scalar and compared with this scalar. * If each corresponding pair of components has this scalar's component greater than * the other scalar's component, the corresponding result component is non-zero. * Otherwise, that result component is equal to zero. */ RIM_FORCE_INLINE SIMDScalar operator > ( const Int16 value ) const { #if RIM_USE_SIMD && defined(RIM_SIMD_ALTIVEC) return SIMDScalar( vec_cmpgt( v, (SIMDInt16)(value) ) ); #elif RIM_USE_SIMD && defined(RIM_SIMD_SSE) && RIM_SSE_VERSION_IS_SUPPORTED(2,0) return SIMDScalar( _mm_cmpgt_epi16( v, _mm_set1_epi16(value) ) ); #else return SIMDScalar( a > value, b > value, c > value, d > value, e > value, f > value, g > value, h > value ); #endif } /// Perform a component-wise less-than-or-equal-to comparison between this an another 4D SIMD scalar. /** * Return a 4D scalar of booleans indicating the result of the comparison. * If each corresponding pair of components has this scalar's component less than * or equal to the other scalar's component, the corresponding result component is non-zero. * Otherwise, that result component is equal to zero. */ RIM_FORCE_INLINE SIMDScalar operator <= ( const SIMDScalar& scalar ) const { #if RIM_USE_SIMD && defined(RIM_SIMD_ALTIVEC) return SIMDScalar( vec_cmple( v, scalar.v ) ); #elif RIM_USE_SIMD && defined(RIM_SIMD_SSE) && RIM_SSE_VERSION_IS_SUPPORTED(2,0) return SIMDScalar( _mm_or_si128( _mm_cmplt_epi16( v, scalar.v ), _mm_cmpeq_epi16( v, scalar.v ) ) ); #else return SIMDScalar( a <= scalar.a, b <= scalar.b, c <= scalar.c, d <= scalar.d, e <= scalar.e, f <= scalar.f, g <= scalar.g, h <= scalar.h ); #endif } /// Perform a component-wise less-than-or-equal-to comparison between this 4D SIMD scalar and an expanded scalar. /** * Return a 4D scalar of booleans indicating the result of the comparison. * The float value is expanded to a 4-wide SIMD scalar and compared with this scalar. * If each corresponding pair of components has this scalar's component less than * or equal to the other scalar's component, the corresponding result component is non-zero. * Otherwise, that result component is equal to zero. */ RIM_FORCE_INLINE SIMDScalar operator <= ( const Int16 value ) const { #if RIM_USE_SIMD && defined(RIM_SIMD_ALTIVEC) return SIMDScalar( vec_cmple( v, (SIMDInt16)(value) ) ); #elif RIM_USE_SIMD && defined(RIM_SIMD_SSE) && RIM_SSE_VERSION_IS_SUPPORTED(2,0) SIMDInt16 scalar = _mm_set1_epi16(value); return SIMDScalar( _mm_or_si128( _mm_cmplt_epi16( v, scalar ), _mm_cmpeq_epi16( v, scalar ) ) ); #else return SIMDScalar( a <= value, b <= value, c <= value, d <= value, e <= value, f <= value, g <= value, h <= value ); #endif } /// Perform a component-wise greater-than-or-equal-to comparison between this an another 4D SIMD scalar. /** * Return a 4D scalar of booleans indicating the result of the comparison. * If each corresponding pair of components has this scalar's component greater than * or equal to the other scalar's component, the corresponding result component is non-zero. * Otherwise, that result component is equal to zero. */ RIM_FORCE_INLINE SIMDScalar operator >= ( const SIMDScalar& scalar ) const { #if RIM_USE_SIMD && defined(RIM_SIMD_ALTIVEC) return SIMDScalar( vec_cmpge( v, scalar.v ) ); #elif RIM_USE_SIMD && defined(RIM_SIMD_SSE) && RIM_SSE_VERSION_IS_SUPPORTED(2,0) return SIMDScalar( _mm_or_si128( _mm_cmpgt_epi16( v, scalar.v ), _mm_cmpeq_epi16( v, scalar.v ) ) ); #else return SIMDScalar( a >= scalar.a, b >= scalar.b, c >= scalar.c, d >= scalar.d, e >= scalar.e, f >= scalar.f, g >= scalar.g, h >= scalar.h ); #endif } /// Perform a component-wise greater-than-or-equal-to comparison between this 4D SIMD scalar and an expanded scalar. /** * Return a 4D scalar of booleans indicating the result of the comparison. * The float value is expanded to a 4-wide SIMD scalar and compared with this scalar. * If each corresponding pair of components has this scalar's component greater than * or equal to the other scalar's component, the corresponding result component is non-zero. * Otherwise, that result component is equal to zero. */ RIM_FORCE_INLINE SIMDScalar operator >= ( const Int16 value ) const { #if RIM_USE_SIMD && defined(RIM_SIMD_ALTIVEC) return SIMDScalar( vec_cmpge( v, (SIMDInt16)(value) ) ); #elif RIM_USE_SIMD && defined(RIM_SIMD_SSE) && RIM_SSE_VERSION_IS_SUPPORTED(2,0) SIMDInt16 scalar = _mm_set1_epi16(value); return SIMDScalar( _mm_or_si128( _mm_cmpgt_epi16( v, scalar ), _mm_cmpeq_epi16( v, scalar ) ) ); #else return SIMDScalar( a >= value, b >= value, c >= value, d >= value, e >= value, f >= value, g >= value, h >= value ); #endif } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Shifting Operators /// Shift each component of the SIMD scalar to the left by the specified amount of bits. /** * This method shifts the contents of each component to the left by the specified * amount of bits and inserts zeros. * * @param bitShift - the number of bits to shift this SIMD scalar by. * @return the shifted SIMD scalar. */ RIM_FORCE_INLINE SIMDScalar operator << ( Int16 bitShift ) const { #if RIM_USE_SIMD && defined(RIM_SIMD_ALTIVEC) return SIMDScalar( vec_sl( v, (SIMDInt16)(bitShift) ) ); #elif RIM_USE_SIMD && defined(RIM_SIMD_SSE) && RIM_SSE_VERSION_IS_SUPPORTED(2,0) return SIMDScalar( _mm_slli_epi16( v, bitShift ) ); #else return SIMDScalar( a << bitShift, b << bitShift, c << bitShift, d << bitShift ); #endif } /// Shift each component of the SIMD scalar to the right by the specified amount of bits. /** * This method shifts the contents of each component to the right by the specified * amount of bits and sign extends the original values.. * * @param bitShift - the number of bits to shift this SIMD scalar by. * @return the shifted SIMD scalar. */ RIM_FORCE_INLINE SIMDScalar operator >> ( Int16 bitShift ) const { #if RIM_USE_SIMD && defined(RIM_SIMD_ALTIVEC) return SIMDScalar( vec_sra( v, (SIMDInt16)(bitShift) ) ); #elif RIM_USE_SIMD && defined(RIM_SIMD_SSE) && RIM_SSE_VERSION_IS_SUPPORTED(2,0) return SIMDScalar( _mm_srai_epi16( v, bitShift ) ); #else return SIMDScalar( a >> bitShift, b >> bitShift, c >> bitShift, d >> bitShift ); #endif } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Negation/Positivation Operators /// Negate a scalar. /** * This method negates every component of this 4D SIMD scalar * and returns the result, leaving this scalar unmodified. * * @return the negation of the original scalar. */ RIM_FORCE_INLINE SIMDScalar operator - () const { #if RIM_USE_SIMD && defined(RIM_SIMD_ALTIVEC) return SIMDScalar( vec_sub( (SIMDInt16)(0), v ) ); #elif RIM_USE_SIMD && defined(RIM_SIMD_SSE) && RIM_SSE_VERSION_IS_SUPPORTED(2,0) return SIMDScalar( _mm_sub_epi16( _mm_set1_epi16(0), v ) ); #else return SIMDScalar( -a, -b, -c, -d ); #endif } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Arithmetic Operators /// Add this scalar to another and return the result. /** * This method adds another scalar to this one, component-wise, * and returns this addition. It does not modify either of the original * scalars. * * @param scalar - The scalar to add to this one. * @return The addition of this scalar and the parameter. */ RIM_FORCE_INLINE SIMDScalar operator + ( const SIMDScalar& scalar ) const { #if RIM_USE_SIMD && defined(RIM_SIMD_ALTIVEC) return SIMDScalar( vec_add( v, scalar.v ) ); #elif RIM_USE_SIMD && defined(RIM_SIMD_SSE) && RIM_SSE_VERSION_IS_SUPPORTED(2,0) return SIMDScalar( _mm_add_epi16( v, scalar.v ) ); #else return SIMDScalar( a + scalar.a, b + scalar.b, c + scalar.c, d + scalar.d ); #endif } /// Add a value to every component of this scalar. /** * This method adds the value parameter to every component * of the scalar, and returns a scalar representing this result. * It does not modifiy the original scalar. * * @param value - The value to add to all components of this scalar. * @return The resulting scalar of this addition. */ RIM_FORCE_INLINE SIMDScalar operator + ( const Int16 value ) const { #if RIM_USE_SIMD && defined(RIM_SIMD_ALTIVEC) return SIMDScalar( vec_add( v, (SIMDInt16)(value) ) ); #elif RIM_USE_SIMD && defined(RIM_SIMD_SSE) && RIM_SSE_VERSION_IS_SUPPORTED(2,0) return SIMDScalar( _mm_add_epi16( v, _mm_set1_epi16(value) ) ); #else return SIMDScalar( a + value, b + value, c + value, d + value ); #endif } /// Subtract a scalar from this scalar component-wise and return the result. /** * This method subtracts another scalar from this one, component-wise, * and returns this subtraction. It does not modify either of the original * scalars. * * @param scalar - The scalar to subtract from this one. * @return The subtraction of the the parameter from this scalar. */ RIM_FORCE_INLINE SIMDScalar operator - ( const SIMDScalar& scalar ) const { #if RIM_USE_SIMD && defined(RIM_SIMD_ALTIVEC) return SIMDScalar( vec_sub( v, scalar.v ) ); #elif RIM_USE_SIMD && defined(RIM_SIMD_SSE) && RIM_SSE_VERSION_IS_SUPPORTED(2,0) return SIMDScalar( _mm_sub_epi16( v, scalar.v ) ); #else return SIMDScalar( a - scalar.a, b - scalar.b, c - scalar.c, d - scalar.d ); #endif } /// Subtract a value from every component of this scalar. /** * This method subtracts the value parameter from every component * of the scalar, and returns a scalar representing this result. * It does not modifiy the original scalar. * * @param value - The value to subtract from all components of this scalar. * @return The resulting scalar of this subtraction. */ RIM_FORCE_INLINE SIMDScalar operator - ( const Int16 value ) const { #if RIM_USE_SIMD && defined(RIM_SIMD_ALTIVEC) return SIMDScalar( vec_sub( v, (SIMDInt16)(value) ) ); #elif RIM_USE_SIMD && defined(RIM_SIMD_SSE) && RIM_SSE_VERSION_IS_SUPPORTED(2,0) return SIMDScalar( _mm_sub_epi16( v, _mm_set1_epi16(value) ) ); #else return SIMDScalar( a - value, b - value, c - value, d - value ); #endif } /// Multiply component-wise this scalar and another scalar. /** * This operator multiplies each component of this scalar * by the corresponding component of the other scalar and * returns a scalar representing this result. It does not modify * either original scalar. * * @param scalar - The scalar to multiply this scalar by. * @return The result of the multiplication. */ RIM_FORCE_INLINE SIMDScalar operator * ( const SIMDScalar& scalar ) const { return SIMDScalar( a*scalar.a, b*scalar.b, c*scalar.c, d*scalar.d, e*scalar.e, f*scalar.f, g*scalar.g, h*scalar.h ); } /// Multiply every component of this scalar by a value and return the result. /** * This method multiplies the value parameter with every component * of the scalar, and returns a scalar representing this result. * It does not modifiy the original scalar. * * @param value - The value to multiplly with all components of this scalar. * @return The resulting scalar of this multiplication. */ RIM_FORCE_INLINE SIMDScalar operator * ( const Int16 value ) const { return SIMDScalar( a*value, b*value, c*value, d*value, e*value, f*value, g*value, h*value ); } /// Divide this scalar by another scalar component-wise. /** * This operator divides each component of this scalar * by the corresponding component of the other scalar and * returns a scalar representing this result. It does not modify * either original scalar. * * @param scalar - The scalar to multiply this scalar by. * @return The result of the division. */ RIM_FORCE_INLINE SIMDScalar operator / ( const SIMDScalar& scalar ) const { return SIMDScalar( a/scalar.a, b/scalar.b, c/scalar.c, d/scalar.d, e/scalar.e, f/scalar.f, g/scalar.g, h/scalar.h ); } /// Divide every component of this scalar by a value and return the result. /** * This method Divides every component of the scalar by the value parameter, * and returns a scalar representing this result. * It does not modifiy the original scalar. * * @param value - The value to divide all components of this scalar by. * @return The resulting scalar of this division. */ RIM_FORCE_INLINE SIMDScalar operator / ( const Int16 value ) const { return SIMDScalar( a/value, b/value, c/value, d/value, e/value, f/value, g/value, h/value ); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Arithmetic Assignment Operators /// Add a scalar to this scalar, modifying this original scalar. /** * This method adds another scalar to this scalar, component-wise, * and sets this scalar to have the result of this addition. * * @param scalar - The scalar to add to this scalar. * @return A reference to this modified scalar. */ RIM_FORCE_INLINE SIMDScalar& operator += ( const SIMDScalar& scalar ) { #if RIM_USE_SIMD && defined(RIM_SIMD_ALTIVEC) v = vec_add( v, scalar.v ); #elif RIM_USE_SIMD && defined(RIM_SIMD_SSE) && RIM_SSE_VERSION_IS_SUPPORTED(2,0) v = _mm_add_epi16( v, scalar.v ); #else a += scalar.a; b += scalar.b; c += scalar.c; d += scalar.d; e += scalar.e; f += scalar.f; g += scalar.g; h += scalar.h; #endif return *this; } /// Subtract a scalar from this scalar, modifying this original scalar. /** * This method subtracts another scalar from this scalar, component-wise, * and sets this scalar to have the result of this subtraction. * * @param scalar - The scalar to subtract from this scalar. * @return A reference to this modified scalar. */ RIM_FORCE_INLINE SIMDScalar& operator -= ( const SIMDScalar& scalar ) { #if RIM_USE_SIMD && defined(RIM_SIMD_ALTIVEC) v = vec_sub( v, scalar.v ); #elif RIM_USE_SIMD && defined(RIM_SIMD_SSE) && RIM_SSE_VERSION_IS_SUPPORTED(2,0) v = _mm_sub_epi16( v, scalar.v ); #else a -= scalar.a; b -= scalar.b; c -= scalar.c; d -= scalar.d; e -= scalar.e; f -= scalar.f; g -= scalar.g; h -= scalar.h; #endif return *this; } /// Multiply component-wise this scalar and another scalar and modify this scalar. /** * This operator multiplies each component of this scalar * by the corresponding component of the other scalar and * modifies this scalar to contain the result. * * @param scalar - The scalar to multiply this scalar by. * @return A reference to this modified scalar. */ RIM_FORCE_INLINE SIMDScalar& operator *= ( const SIMDScalar& scalar ) { a *= scalar.a; b *= scalar.b; c *= scalar.c; d *= scalar.d; e *= scalar.e; f *= scalar.f; g *= scalar.g; h *= scalar.h; return *this; } /// Divide this scalar by another scalar component-wise and modify this scalar. /** * This operator divides each component of this scalar * by the corresponding component of the other scalar and * modifies this scalar to contain the result. * * @param scalar - The scalar to divide this scalar by. * @return A reference to this modified scalar. */ RIM_FORCE_INLINE SIMDScalar& operator /= ( const SIMDScalar& scalar ) { a /= scalar.a; b /= scalar.b; c /= scalar.c; d /= scalar.d; e /= scalar.e; f /= scalar.f; g /= scalar.g; h /= scalar.h; return *this; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Required Alignment Accessor Methods /// Return the alignment required for objects of this type. /** * For most SIMD types this value will be 16 bytes. If there is * no alignment required, 0 is returned. */ RIM_FORCE_INLINE static Size getRequiredAlignment() { #if RIM_USE_SIMD && (defined(RIM_SIMD_ALTIVEC) || defined(RIM_SIMD_SSE) && RIM_SSE_VERSION_IS_SUPPORTED(1,0)) return 16; #else return 0; #endif } /// Get the width of this scalar (number of components it has). RIM_FORCE_INLINE static Size getWidth() { return 8; } /// Return whether or not this SIMD type is supported by the current CPU. RIM_FORCE_INLINE static Bool isSupported() { SIMDFlags flags = SIMDFlags::get(); return (flags & SIMDFlags::SSE_2) != 0 || (flags & SIMDFlags::ALTIVEC) != 0; } private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Members RIM_ALIGN(16) union { #if RIM_USE_SIMD && (defined(RIM_SIMD_ALTIVEC) || defined(RIM_SIMD_SSE) && RIM_SSE_VERSION_IS_SUPPORTED(2,0)) /// The 4D SIMD vector used internally. SIMDInt16 v; #endif #if RIM_USE_SIMD && defined(RIM_SIMD_SSE) && RIM_SSE_VERSION_IS_SUPPORTED(1,0) /// A floating-point alias of the integer SIMD scalar. SIMDInt16Float vFloat; #endif struct { /// The first component of a 8x16-bit SIMD integer. Int16 a; /// The second component of a 4D SIMD scalar. Int16 b; /// The third component of a 4D SIMD scalar. Int16 c; /// The fourth component of a 4D SIMD scalar. Int16 d; /// The fifth component of a 4D SIMD scalar. Int16 e; /// The sixth component of a 4D SIMD scalar. Int16 f; /// The seventh component of a 4D SIMD scalar. Int16 g; /// The eighth component of a 4D SIMD scalar. Int16 h; }; /// The components of a 4D SIMD scalar in array format. Int16 x[8]; }; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Friend Declarations template < typename T, Size width > friend class SIMDVector3D; friend RIM_FORCE_INLINE SIMDScalar abs( const SIMDScalar& scalar ); friend RIM_FORCE_INLINE SIMDScalar sqrt( const SIMDScalar& scalar ); friend RIM_FORCE_INLINE SIMDScalar min( const SIMDScalar& scalar1, const SIMDScalar& scalar2 ); friend RIM_FORCE_INLINE SIMDScalar max( const SIMDScalar& scalar1, const SIMDScalar& scalar2 ); template < UInt i1, UInt i2, UInt i3, UInt i4 > friend RIM_FORCE_INLINE SIMDScalar shuffle( const SIMDScalar& scalar1 ); template < UInt i1, UInt i2, UInt i3, UInt i4 > friend RIM_FORCE_INLINE SIMDScalar shuffle( const SIMDScalar& scalar1, const SIMDScalar& scalar2 ); friend RIM_FORCE_INLINE SIMDScalar select( const SIMDScalar& selector, const SIMDScalar& scalar1, const SIMDScalar& scalar2 ); friend RIM_FORCE_INLINE SIMDScalar lows( const SIMDScalar& scalar ); friend RIM_FORCE_INLINE SIMDScalar highs( const SIMDScalar& scalar ); }; //########################################################################################## //########################################################################################## //############ //############ Associative SIMD Scalar Operators //############ //########################################################################################## //########################################################################################## /// Add a scalar value to each component of this scalar and return the resulting scalar. RIM_FORCE_INLINE SIMDScalar<Int16,8> operator + ( const Int16 value, const SIMDScalar<Int16,8>& scalar ) { return SIMDScalar<Int16,8>(value) + scalar; } /// Subtract a scalar value from each component of this scalar and return the resulting scalar. RIM_FORCE_INLINE SIMDScalar<Int16,8> operator - ( const Int16 value, const SIMDScalar<Int16,8>& scalar ) { return SIMDScalar<Int16,8>(value) - scalar; } /// Multiply a scalar value by each component of this scalar and return the resulting scalar. RIM_FORCE_INLINE SIMDScalar<Int16,8> operator * ( const Int16 value, const SIMDScalar<Int16,8>& scalar ) { return SIMDScalar<Int16,8>(value) * scalar; } /// Divide each component of this scalar by a scalar value and return the resulting scalar. RIM_FORCE_INLINE SIMDScalar<Int16,8> operator / ( const Int16 value, const SIMDScalar<Int16,8>& scalar ) { return SIMDScalar<Int16,8>(value) / scalar; } //########################################################################################## //########################################################################################## //############ //############ Free Vector Functions //############ //########################################################################################## //########################################################################################## /// Compute the absolute value of each component of the specified SIMD scalar and return the result. RIM_FORCE_INLINE SIMDScalar<Int16,8> abs( const SIMDScalar<Int16,8>& scalar ) { #if RIM_USE_SIMD && defined(RIM_SIMD_ALTIVEC) return SIMDScalar<Int16,8>( vec_abs( scalar.v ) ); #elif RIM_USE_SIMD && defined(RIM_SIMD_SSE) return SIMDScalar<Int16,8>( math::abs(scalar.a), math::abs(scalar.b), math::abs(scalar.c), math::abs(scalar.d), math::abs(scalar.e), math::abs(scalar.f), math::abs(scalar.g), math::abs(scalar.h) ); #else return SIMDScalar<Int16,8>( math::abs(scalar.a), math::abs(scalar.b), math::abs(scalar.c), math::abs(scalar.d) ); #endif } /// Compute the minimum of each component of the specified SIMD scalars and return the result. RIM_FORCE_INLINE SIMDScalar<Int16,8> min( const SIMDScalar<Int16,8>& scalar1, const SIMDScalar<Int16,8>& scalar2 ) { #if RIM_USE_SIMD && defined(RIM_SIMD_ALTIVEC) return SIMDScalar<Int16,8>( vec_min( scalar1.v, scalar2.v ) ); #elif RIM_USE_SIMD && defined(RIM_SIMD_SSE) return SIMDScalar<Int16,8>( math::min(scalar1.a, scalar2.a), math::min(scalar1.b, scalar2.b), math::min(scalar1.c, scalar2.c), math::min(scalar1.d, scalar2.d), math::min(scalar1.e, scalar2.e), math::min(scalar1.f, scalar2.f), math::min(scalar1.g, scalar2.g), math::min(scalar1.h, scalar2.h) ); #else return SIMDScalar<Int16,8>( math::min(scalar1.a, scalar2.a), math::min(scalar1.b, scalar2.b), math::min(scalar1.c, scalar2.c), math::min(scalar1.d, scalar2.d), math::min(scalar1.e, scalar2.e), math::min(scalar1.f, scalar2.f), math::min(scalar1.g, scalar2.g), math::min(scalar1.h, scalar2.h) ); #endif } /// Compute the maximum of each component of the specified SIMD scalars and return the result. RIM_FORCE_INLINE SIMDScalar<Int16,8> max( const SIMDScalar<Int16,8>& scalar1, const SIMDScalar<Int16,8>& scalar2 ) { #if RIM_USE_SIMD && defined(RIM_SIMD_ALTIVEC) return SIMDScalar<Int16,8>( vec_max( scalar1.v, scalar2.v ) ); #elif RIM_USE_SIMD && defined(RIM_SIMD_SSE) return SIMDScalar<Int16,8>( math::max(scalar1.a, scalar2.a), math::max(scalar1.b, scalar2.b), math::max(scalar1.c, scalar2.c), math::max(scalar1.d, scalar2.d), math::max(scalar1.e, scalar2.e), math::max(scalar1.f, scalar2.f), math::max(scalar1.g, scalar2.g), math::max(scalar1.h, scalar2.h) ); #else return SIMDScalar<Int16,8>( math::max(scalar1.a, scalar2.a), math::max(scalar1.b, scalar2.b), math::max(scalar1.c, scalar2.c), math::max(scalar1.d, scalar2.d), math::max(scalar1.e, scalar2.e), math::max(scalar1.f, scalar2.f), math::max(scalar1.g, scalar2.g), math::max(scalar1.h, scalar2.h) ); #endif } /// Select elements from the first SIMD scalar if the selector is TRUE, otherwise from the second. RIM_FORCE_INLINE SIMDScalar<Int16,8> select( const SIMDScalar<Int16,8>& selector, const SIMDScalar<Int16,8>& scalar1, const SIMDScalar<Int16,8>& scalar2 ) { #if RIM_USE_SIMD && defined(RIM_SIMD_ALTIVEC) return SIMDScalar<Int16,8>( vec_sel( scalar2.v, scalar1.v, selector.v ) ); #elif RIM_USE_SIMD && defined(RIM_SIMD_SSE) && RIM_SSE_VERSION_IS_SUPPORTED(1,0) // (((b^a) & selector) ^ a) return SIMDScalar<Int16,8>( _mm_xor_ps( scalar2.vFloat, _mm_and_ps( selector.vFloat, _mm_xor_ps( scalar1.vFloat, scalar2.vFloat ) ) ) ); #else return SIMDScalar<Int16,8>( selector.a ? scalar1.a : scalar2.a, selector.b ? scalar1.b : scalar2.b, selector.c ? scalar1.c : scalar2.c, selector.d ? scalar1.d : scalar2.d, selector.e ? scalar1.e : scalar2.e, selector.f ? scalar1.f : scalar2.f, selector.g ? scalar1.g : scalar2.g, selector.h ? scalar1.h : scalar2.h ); #endif } //########################################################################################## //***************************** End Rim Math Namespace *********************************** RIM_MATH_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_SIMD_SCALAR_INT_16_8_H <file_sep>/* * rimPrimitiveInterfaceType.h * Rim Software * * Created by <NAME> on 5/4/14. * Copyright 2014 __MyCompanyName__. All rights reserved. * */ #ifndef INCLUDE_RIM_BVH_PRIMITIVE_INTERFACE_TYPE_H #define INCLUDE_RIM_BVH_PRIMITIVE_INTERFACE_TYPE_H #include "rimBVHConfig.h" //########################################################################################## //***************************** Start Rim BVH Namespace ********************************** RIM_BVH_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class which represents the type of a primitive. class PrimitiveInterfaceType { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Public Enum Declaration /// An enum which specifies the different allowed texture faces. typedef enum Enum { /// An enum corresponding to a primitive interface for points. POINTS = 1, /// An enum corresponding to a primitive interface for line segments. LINES = 2, /// An enum corresponding to a primitive interface for triangles. TRIANGLES = 3, /// An enum corresponding to a primitive interface for quads. QUADS = 4, /// An enum corresponding to a primitive interface for axis-aligned bounding boxes. AABBS = 5, /// An enum corresponding to a primitive interface for spheres. SPHERES = 6, /// An enum corresponding to a primitive interface for cylinders. CYLINDERS = 7, /// An enum corresponding to a primitive interface for capsules. CAPSULES = 8, /// An enum corresponding to a primitive interface for oriented boxes. BOXES = 9, /// An undefined primitive type, the default. UNDEFINED = 0 }; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructors /// Create a new primitive type with an UNDEFINED type value. RIM_INLINE PrimitiveInterfaceType() : type( UNDEFINED ) { } /// Create a new primitive type with the specified primitive type enum value. RIM_INLINE PrimitiveInterfaceType( Enum newType ) : type( newType ) { } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Enum Cast Operator /// Convert this primitive type to an enum value. RIM_INLINE operator Enum () const { return type; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** String Representation Accessor Methods /// Return a string representation of the primitive type. String toString() const; /// Convert this primitive type into a string representation. RIM_INLINE operator String () const { return this->toString(); } private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Members /// An enum value which represents the primitive type. Enum type; }; //########################################################################################## //***************************** End Rim BVH Namespace ************************************ RIM_BVH_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_BVH_PRIMITIVE_INTERFACE_TYPE_H <file_sep>/* * rimTimer.h * Rim Time * * Created by <NAME> on 11/9/07. * Copyright 2007 __MyCompanyName__. All rights reserved. * */ #ifndef INCLUDE_RIM_TIMER_H #define INCLUDE_RIM_TIMER_H #include "rimTimeConfig.h" #include "rimTime.h" //########################################################################################## //******************************* Start Time Namespace ********************************* RIM_TIME_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A timer class which behaves like a stopwatch. /** * This class serves to provide a way for the user to mark * times and to measure the intervals between them. This can * be used to do application profiling/timing, to provide a * frame time interval counter for games, etc. It uses the highest * performance timers availible on the system it is compiled under, * and therefore should have sub-millisecond accuracy. The timer * is also able to be paused, such that it then behaves as if it * was stuck in that instance in which it was paused. It can later * be resumed and carry on as if it had never been paused, reflecting * this in it's attributes accordingly. */ class Timer { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructor /// Create a new timer and start it's first interval (by calling update()). /** * This constructor creates a new timer, and then * initializes the timer by starting it's first time interval, * done by calling the timer's update() function internally. */ Timer(); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Stopwatch Timing Methods /// Update the timer to the current time, store the interval between updates. /** * This method updates the timer, and calculates and * stores the time between the last update and this update * internally, so that it can be accessed using the * getElapsedTime() method. If the timer is paused * when this function is called, then the method does nothing. */ void update(); /// Get the time interval of the last update /** * This method retrieves the time interval (in seconds) * of the elapsed time between the last call to the update() * method and the second to last call to the update() method. * * @return the time interval between the last two timer updates */ RIM_INLINE const Time& getLastInterval() const { return lastInterval; } /// Get the time interval since the last update without updating the timer. /** * This method gets the time passed since the last call to the update() * method in seconds. The method does not reset the timer, and therefore * can be used to get a running total of the time since some arbitrary * moment (set by calling the update method). If the timer is paused, * this method returns the time between the last call to update() and * the time when the timer was paused. * * @return the time since the last call to update() */ Time getElapsedTime() const; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Timer State Methods /// Get whether or not the timer is currently paused. /** * If the timer is paused, then this means that the timer * is no longer keeping track of time, and will behave as if * it is stuck in the instant that it was paused in until it * is unpaused. This can be useful in many situations where * one needs to stop timing and later resume timing as if * the timer has never been stopped. * * @return whether or not the timer is currently paused. */ RIM_INLINE Bool getIsPaused() const { return isPaused; } /// Set whether or not the timer is paused with a boolean flag. /** * If the timer is paused, then this means that the timer * is no longer keeping track of time, and will behave as if * it is stuck in the instant that it was paused in until it * is unpaused. This can be useful in many situations where * one needs to stop timing and later resume timing as if * the timer has never been stopped. If this method is called * with a parameter that is equal to the return value of * getIsPaused(), then it does nothing (the timer's state doesn't * need to change). * * @param newIsPaused - whether or not the timer should be paused. */ void setIsPaused( Bool newIsPaused ); /// Pause the timer. /** * If the timer is already paused, then this method does * nothing (the timer's state doesn't need to change to * reflect the function call). */ RIM_INLINE void pause() { this->setIsPaused( true ); } /// Resume the timer if it is currently paused. /** * If the timer is not paused, then this method does * nothing (the timer's state doesn't need to change to * reflect the function call). */ RIM_INLINE void resume() { this->setIsPaused( false ); } private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Members /// The second to last time the timer was updated. Time oldTime; /// The last time the timer was updated. Time currentTime; /// The positive time interval between the last and second to last times. Time lastInterval; /// Whether or not the timer is currently paused. Bool isPaused; }; //########################################################################################## //******************************* End Time Namespace *********************************** RIM_TIME_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_TIMER_H <file_sep>/* * rimSoundCompressor.h * Rim Sound * * Created by <NAME> on 8/3/12. * Copyright 2012 __MyCompanyName__. All rights reserved. * */ #ifndef INCLUDE_RIM_SOUND_COMPRESSOR_H #define INCLUDE_RIM_SOUND_COMPRESSOR_H #include "rimSoundFiltersConfig.h" #include "rimSoundFilter.h" //########################################################################################## //************************ Start Rim Sound Filters Namespace ***************************** RIM_SOUND_FILTERS_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class which reduces the level of sound above a certain threshold. /** * This compressor class uses an arbitrary-length RMS peak sensing function to * determine the envelope level at each sample. If the envelope is above a user-defined * threshold, the compressor applies gain reduction to the sound at the compressor's * logarithmic compression ratio. The compressor also has a variable-hardness * knee which allows the user to smooth the transition from compressed to non- * compressed audio. * * This compressor can also be used as a limiter by setting the ratio to be equal * to positive infinity. */ class Compressor : public SoundFilter { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructors /// Create a new compressor with the default compression parameters. /** * These are - threshold: -6dB, ratio: 2:1, knee: 0dB, attack: 15ms, release: 50ms, * input gain: 0dB, output gain: 0dB, RMS time of 0 seconds (peak detection), * with unlinked channels. */ Compressor(); /// Create a new compressor with specified threshold, ratio, attack, and release. /** * This compressor uses peak-sensing detection (RMS time of 0), and has unlinked * channels. The compressor has the default knee of 0dB. The input and output * gains of the compressor are 0dB. All gain and threshold values are specified * on a linear scale. */ Compressor( Gain threshold, Float ratio, Float attack, Float release ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Input Gain Accessor Methods /// Return the current linear input gain factor of this compressor. /** * This is the gain applied to the input signal before being sent to the * compressor. This allows the user to scale the input to match the compressor * without having to change the compressor threshold. */ RIM_INLINE Gain getInputGain() const { return targetInputGain; } /// Return the current input gain factor in decibels of this compressor. /** * This is the gain applied to the input signal before being sent to the * compressor. This allows the user to scale the input to match the compressor * without having to change the compressor threshold. */ RIM_INLINE Gain getInputGainDB() const { return util::linearToDB( targetInputGain ); } /// Set the target linear input gain for compressor. /** * This is the gain applied to the input signal before being sent to the * compressor. This allows the user to scale the input to match the compressor * without having to change the compressor threshold. */ RIM_INLINE void setInputGain( Gain newInputGain ) { lockMutex(); targetInputGain = newInputGain; unlockMutex(); } /// Set the target input gain in decibels for this compressor. /** * This is the gain applied to the input signal before being sent to the * compressor. This allows the user to scale the input to match the compressor * without having to change the compressor threshold. */ RIM_INLINE void setInputGainDB( Gain newDBInputGain ) { lockMutex(); targetInputGain = util::dbToLinear( newDBInputGain ); unlockMutex(); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Output Gain Accessor Methods /// Return the current linear output gain factor of this compressor. /** * This is the gain applied to the signal after being sent to the * compressor. This value is used to apply make-up gain to the signal * after is has been compressed. */ RIM_INLINE Gain getOutputGain() const { return targetOutputGain; } /// Return the current output gain factor in decibels of this compressor. /** * This is the gain applied to the signal after being sent to the * compressor. This value is used to apply make-up gain to the signal * after is has been compressed. */ RIM_INLINE Gain getOutputGainDB() const { return util::linearToDB( targetOutputGain ); } /// Set the target linear output gain for this compressor. /** * This is the gain applied to the signal after being sent to the * compressor. This value is used to apply make-up gain to the signal * after is has been compressed. */ RIM_INLINE void setOutputGain( Gain newOutputGain ) { lockMutex(); targetOutputGain = newOutputGain; unlockMutex(); } /// Set the target output gain in decibels for this compressor. /** * This is the gain applied to the signal after being sent to the * compressor. This value is used to apply make-up gain to the signal * after is has been compressed. */ RIM_INLINE void setOutputGainDB( Gain newDBOutputGain ) { lockMutex(); targetOutputGain = util::dbToLinear( newDBOutputGain ); unlockMutex(); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Output Mix Accessor Methods /// Return the ratio of input signal to compressed signal sent to the output of the compressor. /** * Valid mix values are in the range [0,1]. * A mix value of 1 indicates that only the output of the compressor should be * heard at the output, while a value of 0 indicates that only the input of the * compressor should be heard at the output. A value of 0.5 indicates that both * should be mixed together equally at -6dB. */ RIM_INLINE Gain getMix() const { return targetMix; } /// Set the ratio of input signal to compressed signal sent to the output of the compressor. /** * Valid mix values are in the range [0,1]. * A mix value of 1 indicates that only the output of the compressor should be * heard at the output, while a value of 0 indicates that only the input of the * compressor should be heard at the output. A value of 0.5 indicates that both * should be mixed together equally at -6dB. * * The new mix value is clamped to the valid range of [0,1]. */ RIM_INLINE void setMix( Gain newMix ) { lockMutex(); targetMix = math::clamp( newMix, Gain(0), Gain(1) ); unlockMutex(); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Threshold Accessor Methods /// Return the linear full-scale value above which the compressor applies gain reduction. RIM_INLINE Gain getThreshold() const { return targetThreshold; } /// Return the logarithmic full-scale value above which the compressor applies gain reduction. RIM_INLINE Gain getThresholdDB() const { return util::linearToDB( targetThreshold ); } /// Set the linear full-scale value above which the compressor applies gain reduction. /** * The value is clamped to the valid range of [0,infinity] before being stored. */ RIM_INLINE void setThreshold( Gain newThreshold ) { lockMutex(); targetThreshold = math::max( newThreshold, Gain(0) ); unlockMutex(); } /// Set the logarithmic full-scale value above which the compressor applies gain reduction. RIM_INLINE void setThresholdDB( Gain newThresholdDB ) { lockMutex(); targetThreshold = util::dbToLinear( newThresholdDB ); unlockMutex(); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Ratio Accessor Methods /// Return the compression ratio that the compressor is using. /** * This value is expressed as a ratio of input to output gain above * the compression threshold, expressed in decibels. For instance, a * ratio of 2 indicates that for ever 2 decibels that the signal is over * the threshold, the output signal will only be 1 decibel over the threshold. * Thus, higher ratios indicate harder compression. A ratio of +infinity * is equivalent to a brickwall limiter. */ RIM_INLINE Float getRatio() const { return targetRatio; } /// Set the compression ratio that the compressor is using. /** * This value is expressed as a ratio of input to output gain above * the compression threshold, expressed in decibels. For instance, a * ratio of 2 indicates that for ever 2 decibels that the signal is over * the threshold, the output signal will only be 1 decibel over the threshold. * Thus, higher ratios indicate harder compression. A ratio of +infinity * is equivalent to a brickwall limiter. * * The new ratio is clamped to the range of [1,+infinity]. */ RIM_INLINE void setRatio( Float newRatio ) { lockMutex(); targetRatio = math::max( newRatio, Float(1) ); unlockMutex(); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Knee Accessor Methods /// Return the knee radius of this compressor in decibels. /** * This is the amount below the compressor's threshold at which the compressor first * starts compressing, as well as the amount above the compressor's threshold where * the actual compressor ratio starts to be used. A higher knee will result in a compressor * that starts to apply gain reduction to envelopes that approach the threshold, resulting * in a smoother transition from no gain reduction to full gain reduction. */ RIM_INLINE Gain getKnee() const { return targetKnee; } /// Set the knee radius of this compressor in decibels. /** * This is the amount below the compressor's threshold at which the compressor first * starts compressing, as well as the amount above the compressor's threshold where * the actual compressor ratio starts to be used. A higher knee will result in a compressor * that starts to apply gain reduction to envelopes that approach the threshold, resulting * in a smoother transition from no gain reduction to full gain reduction. * * The new knee value is clamped to the valid range of [0,+infinity]. */ RIM_INLINE void setKnee( Gain newKnee ) { lockMutex(); targetKnee = math::max( newKnee, Float(0) ); unlockMutex(); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Attack Accessor Methods /// Return the attack of this compressor in seconds. /** * This value indicates the time in seconds that it takes for the compressor's * detection envelope to respond to a sudden increase in signal level. Thus, * a very small attack softens transients more than a slower attack which * lets the transients through the compressor. */ RIM_INLINE Float getAttack() const { return attack; } /// Set the attack of this compressor in seconds. /** * This value indicates the time in seconds that it takes for the compressor's * detection envelope to respond to a sudden increase in signal level. Thus, * a very small attack softens transients more than a slower attack which * lets the transients through the compressor. * * The new attack value is clamped to the range of [0,+infinity]. */ RIM_INLINE void setAttack( Float newAttack ) { lockMutex(); attack = math::max( newAttack, Float(0) ); unlockMutex(); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Release Accessor Methods /// Return the release of this compressor in seconds. /** * This value indicates the time in seconds that it takes for the compressor's * detection envelope to respond to a sudden decrease in signal level. Thus, * a very short release doesn't compress the signal after a transient for as * long as a longer release. Beware, very short release times (< 5ms) can result * in audible distortion. */ RIM_INLINE Float getRelease() const { return release; } /// Set the release of this compressor in seconds. /** * This value indicates the time in seconds that it takes for the compressor's * detection envelope to respond to a sudden decrease in signal level. Thus, * a very short release doesn't compress the signal after a transient for as * long as a longer release. Beware, very short release times (< 5ms) can result * in audible distortion. * * The new release value is clamped to the valid range of [0,+infinity]. */ RIM_INLINE void setRelease( Float newRelease ) { lockMutex(); release = math::max( newRelease, Float(0) ); unlockMutex(); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** RMS Time Accessor Methods /// Return the RMS averaging time for the compressor, expressed in seconds. /** * This value indicates the total time in seconds over which the compressor * is applying an RMS averaging function. The default value is 0, indicating * that no RMS detection is desired, peak detection is used instead. A compressor * with a longer RMS time will compress the input signal more smoothly than * peak detection but may not respond to transients as quickly. */ RIM_INLINE Float getRMSTime() const { return rmsTime; } /// Set the RMS averaging time for the compressor, expressed in seconds. /** * This value indicates the total time in seconds over which the compressor * is applying an RMS averaging function. The default value is 0, indicating * that no RMS detection is desired, peak detection is used instead. A compressor * with a longer RMS time will compress the input signal more smoothly than * peak detection but may not respond to transients as quickly. * * The new RMS averaging time is clamped to the valid range of [0,+infinity]. */ RIM_INLINE void setRMSTime( Float newRMSTime ) { lockMutex(); rmsTime = math::max( newRMSTime, Float(0) ); unlockMutex(); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Channel Link Status Accessor Methods /// Return whether or not all channels in the compressor are linked together. /** * If the value is TRUE, all channels are compressed by the maximum compression * amount selected from all channel envelopes. This allows the compressor * to maintain the stereo image of the audio when compressing hard-panned sounds. */ RIM_INLINE Bool getChannelsAreLinked() const { return linkChannels; } /// Set whether or not all channels in the compressor are linked together. /** * If the value is TRUE, all channels are compressed by the maximum compression * amount selected from all channel envelopes. This allows the compressor * to maintain the stereo image of the audio when compressing hard-panned sounds. */ RIM_INLINE void setChannelsAreLinked( Bool newChannelsAreLinked ) { lockMutex(); linkChannels = newChannelsAreLinked; unlockMutex(); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Gain Reduction Accessor Methods /// Return the current gain reduction of the compressor in decibels. /** * This value can be used as a way for humans to visualize how much the * compressor is compressing at any given time. */ RIM_INLINE Gain getGainReductionDB() const { return currentReduction; } /// Return the current gain reduction of the compressor on a linear scale. /** * This value can be used as a way for humans to visualize how much the * compressor is compressing at any given time. */ RIM_INLINE Gain getGainReduction() const { return util::dbToLinear( currentReduction ); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Transfer Function Accessor Methods /// Evaluate the transfer function of the compressor for an envelope with the specified amplitude. /** * This method returns the output gain applied */ Gain evaluateTransferFunction( Gain input ) const; /// Evaluate the transfer function of the compressor for an envelope with the specified amplitude. RIM_INLINE Gain evaluateTransferFunctionDB( Gain input ) const { return util::linearToDB( this->evaluateTransferFunction( util::dbToLinear( input ) ) ); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Input and Output Accessor Methods /// Return a human-readable name of the compressor input at the specified index. /** * The compressor has 2 inputs: * - 0: the compressor's main input, the source of the signal that is going to be compressed. * - 1: the compressor's sidechain input, the main input is compressed using this input if provided. * * The main input's name is "Main Input", while the sidechain's name is "Sidechain". */ virtual UTF8String getInputName( Index inputIndex ) const; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Filter Attribute Accessor Methods /// Return a human-readable name for this compressor. /** * The method returns the string "Compressor". */ virtual UTF8String getName() const; /// Return the manufacturer name of this compressor. /** * The method returns the string "Headspace Sound". */ virtual UTF8String getManufacturer() const; /// Return an object representing the version of this compressor. virtual SoundFilterVersion getVersion() const; /// Return an object which describes the category of effect that this filter implements. /** * This method returns the value SoundFilterCategory::DYNAMICS. */ virtual SoundFilterCategory getCategory() const; /// Return whether or not this compressor can process audio data in-place. /** * This method always returns TRUE, compressors can process audio data in-place. */ virtual Bool allowsInPlaceProcessing() const; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Filter Parameter Accessor Methods /// Return the total number of generic accessible parameters this filter has. virtual Size getParameterCount() const; /// Get information about the filter parameter at the specified index. virtual Bool getParameterInfo( Index parameterIndex, FilterParameterInfo& info ) const; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Public Static Property Objects /// A string indicating the human-readable name of this compressor. static const UTF8String NAME; /// A string indicating the manufacturer name of this compressor. static const UTF8String MANUFACTURER; /// An object indicating the version of this compressor. static const SoundFilterVersion VERSION; private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Filter Parameter Value Accessor Methods /// Place the value of the parameter at the specified index in the output parameter. virtual Bool getParameterValue( Index parameterIndex, FilterParameter& value ) const; /// Attempt to set the parameter value at the specified index. virtual Bool setParameterValue( Index parameterIndex, const FilterParameter& value ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Stream Reset Method /// A method which is called whenever the filter's stream of audio is being reset. /** * This method allows the filter to reset all parameter interpolation * and processing to its initial state to avoid coloration from previous * audio or parameter values. */ virtual void resetStream(); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Filter Processing Methods /// Do compression processing on the input frame and place the results in the output frame. virtual SoundFilterResult processFrame( const SoundFilterFrame& inputFrame, SoundFilterFrame& outputFrame, Size numSamples ); /// Do compression processing on the input buffer and place the results in the output buffer. template < Bool interpolateChanges, Bool rmsEnabled > RIM_FORCE_INLINE void compress( const SoundBuffer& inputBuffer, SoundBuffer& outputBuffer, Size numSamples, Gain envelopeAttack, Gain envelopeRelease, Gain inputGainChangePerSample, Gain outputGainChangePerSample, Gain mixChangePerSample, Gain thresholdChangePerSample, Gain kneeChangePerSample, Float ratioChangePerSample ); /// Return the negative gain reduction in decibels for the specified signal level and compression parameters. RIM_FORCE_INLINE static Gain getDBReduction( Float level, Gain threshold, Float ratio, Float kneeMin, Float kneeMax, Float knee ) { Float reductionConstant = (Float(1) - ratio)/ratio; Gain dbOver = util::linearToDB( level / threshold ); if ( knee > Float(0) && level < kneeMax ) { Float x = (dbOver + knee)/knee; return knee*reductionConstant*x*x*Float(0.25); } else return dbOver*reductionConstant; } /// Return the negative gain reduction in decibels for the specified signal level and compression parameters. RIM_FORCE_INLINE static Gain getDBReduction2( Float level, Gain threshold, Float reductionConstant, Float kneeMin, Float kneeMax, Float knee ) { Gain dbOver = util::linearToDB( level / threshold ); if ( knee > Float(0) && level < kneeMax ) { Float x = (dbOver + knee)/knee; return knee*reductionConstant*x*x*Float(0.25); } else return dbOver*reductionConstant; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Members /// The threshold, given as a linear full-scale value, at which compression starts to occur. Gain threshold; /// The target threshold, used to smooth changes in the threshold parameter. Gain targetThreshold; /// The ratio at which the compressor applies gain reduction to signals above the threshold. Float ratio; /// The target ratio of the compressor, used to smooth ratio parameter changes. Float targetRatio; /// The radius of the compressor's knee in decibels. /** * This is the amount below the compressor's threshold at which the compressor first * starts compressing, as well as the amount above the compressor's threshold where * the actual compressor ratio starts to be used. A higher knee will result in a compressor * that starts to apply gain reduction to envelopes that approach the threshold, resulting * in a smoother transition from no gain reduction to full gain reduction. */ Gain knee; /// The target knee for this compressor, used to smooth knee parameter changes. Gain targetKnee; /// The linear gain applied to the signal before it goes through the compressor. Gain inputGain; /// The target input gain of the compressor, used to smooth input gain parameter changes. Gain targetInputGain; /// The linear gain applied to the signal after it has been compressed to restore signal level. Gain outputGain; /// The target output gain of the compressor, used to smooth output gain parameter changes. Gain targetOutputGain; /// The ratio of input signal to compressed signal sent to the output of the compressor. /** * The mix factor determines the ratio of the input signal (post input gain) to the * compressed signal which is sent to the final output buffer. Thus, a mix factor * of 1 indicates only the compressed signal is sent to the output. Likewise, a mix * factor of 0 indicates that only the input signal is sent to the output. */ Gain mix; /// The target mix factor of the compressor, used to smooth mix parameter changes. Gain targetMix; /// The time in seconds that the compressor envelope takes to respond to an increase in level. Float attack; /// The time in seconds that the compressor envelope takes to respond to a decrease in level. Float release; /// An array of envelope values for each of the channels that this compressor is processing. Array<Float> envelope; /// The time in seconds for which we are computing the RMS level of the input signal. Float rmsTime; /// The active length of the RMS buffer in samples. Size rmsLengthInSamples; /// The sum of the squares of the active RMS samples. Array<Float> rmsSumSquares; /// The current sample index within the RMS buffer. Size currentRMSIndex; /// A buffer used to store the last N samples, used in RMS level detection. SoundBuffer rmsBuffer; /// The current gain reduction of the compressor, expressed in decibels. Gain currentReduction; /// A boolean value indicating whether or not all channels processed should be linked. /** * This means that the same compression amount is applied to all channels. The * compressor finds the channel which needs the most gain reduction and uses * that gain reduction for all other channels. This feature allows the compressor * to maintain the original stereo (or multichannel) balance between channels. */ Bool linkChannels; }; //########################################################################################## //************************ End Rim Sound Filters Namespace ******************************* RIM_SOUND_FILTERS_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_SOUND_COMPRESSOR_H <file_sep>/* * rimGraphicsCameraFlags.h * Rim Software * * Created by <NAME> on 7/3/14. * Copyright 2014 __MyCompanyName__. All rights reserved. * */ #ifndef INCLUDE_RIM_GRAPHICS_CAMERA_FLAGS_H #define INCLUDE_RIM_GRAPHICS_CAMERA_FLAGS_H #include "rimGraphicsCamerasConfig.h" //########################################################################################## //************************ Start Rim Graphics Cameras Namespace ************************** RIM_GRAPHICS_CAMERAS_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class which encapsulates the different boolean flags that a camera can have. /** * These flags provide boolean information about a certain camera. Flags * are indicated by setting a single bit of a 32-bit unsigned integer to 1. * * Enum values for the different flags are defined as members of the class. Typically, * the user would bitwise-OR the flag enum values together to produce a final set * of set flags. */ class CameraFlags { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Graphics Camera Flags Enum Declaration /// An enum which specifies the different camera flags. typedef enum Flag { /// A flag indicating that an camera is enabled to be drawn to the screen. ENABLED = (1 << 0), /// The flag value when all flags are not set. UNDEFINED = 0 }; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructors /// Create a new camera flags camera with no flags set. RIM_INLINE CameraFlags() : flags( UNDEFINED ) { } /// Create a new camera flags camera with the specified flag value initially set. RIM_INLINE CameraFlags( Flag flag ) : flags( flag ) { } /// Create a new camera flags camera with the specified initial combined flags value. RIM_INLINE CameraFlags( UInt32 newFlags ) : flags( newFlags ) { } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Integer Cast Operator /// Convert this camera flags camera to an integer value. /** * This operator is provided so that the CameraFlags camera * can be used as an integer value for bitwise logical operations. */ RIM_INLINE operator UInt32 () const { return flags; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Flag Status Accessor Methods /// Return whether or not the specified flag value is set for this flags camera. RIM_INLINE Bool isSet( Flag flag ) const { return (flags & flag) != UNDEFINED; } /// Set whether or not the specified flag value is set for this flags camera. RIM_INLINE void set( Flag flag, Bool newIsSet ) { if ( newIsSet ) flags |= flag; else flags &= ~flag; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Flag String Accessor Methods /// Return the flag for the specified literal string representation. static Flag fromEnumString( const String& enumString ); /// Convert the specified flag to its literal string representation. static String toEnumString( Flag flag ); /// Convert the specified flag to human-readable string representation. static String toString( Flag flag ); private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Members /// A value indicating the flags that are set for a camera. UInt32 flags; }; //########################################################################################## //************************ End Rim Graphics Cameras Namespace **************************** RIM_GRAPHICS_CAMERAS_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_GRAPHICS_CAMERA_FLAGS_H <file_sep>/* * rimPhysicsObjects.h * Rim Physics * * Created by <NAME> on 5/8/08. * Copyright 2008 Rim Software. All rights reserved. * */ #ifndef INCLUDE_RIM_PHYSICS_OBJECTS_H #define INCLUDE_RIM_PHYSICS_OBJECTS_H #include "rimPhysicsConfig.h" #include "objects/rimPhysicsObjectsConfig.h" #include "objects/rimPhysicsObjectCollider.h" #include "objects/rimPhysicsObjectPair.h" #include "objects/rimPhysicsRigidObject.h" #include "objects/rimPhysicsRigidObjectCollider.h" #endif // INCLUDE_RIM_PHYSICS_OBJECTS_H <file_sep>/* * rimGraphicsVertexBinding.h * Rim Graphics * * Created by <NAME> on 3/10/13. * Copyright 2013 __MyCompanyName__. All rights reserved. * */ #ifndef INCLUDE_RIM_GRAPHICS_VERTEX_BINDING_H #define INCLUDE_RIM_GRAPHICS_VERTEX_BINDING_H #include "rimGraphicsShadersConfig.h" #include "rimGraphicsVertexVariable.h" //########################################################################################## //*********************** Start Rim Graphics Shaders Namespace *************************** RIM_GRAPHICS_SHADERS_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class used to represent the binding between a per-vertex shader variable and its buffer and usage. class VertexBinding { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Shader Vertex Variable Accessor Methods /// Get the shader vertex variable to which a buffer is bound. RIM_FORCE_INLINE const VertexVariable& getVariable() const { return *variable; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Vertex Attribute Usage Accessor Methods /// Return the semantic usage for this vertex attribute binding. RIM_FORCE_INLINE const VertexUsage& getUsage() const { return usage; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Buffer Offset Accessor Methods /// Return the starting index for the first buffer of this binding in its shader pass's buffer storage buffer. RIM_FORCE_INLINE UInt getBufferOffset() const { return bufferOffset; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Input Status Accessor Methods /// Return whether or not this constant binding is a dynamic input to a shader pass. /** * If so, the renderer can provide dynamic scene information for this binding * (such as nearby lights, textures, etc) that aren't explicitly part of this * binding. By default, all bindings are inputs. */ RIM_INLINE Bool getIsInput() const { return isInput; } private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Friend Class Declarations /// Declare the ShaderPass class a friend so that it can manipulate internal data easily. friend class ShaderPass; /// Declare the ShaderBindingSet class a friend so that it can manipulate internal data easily. friend class ShaderBindingSet; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Constructors /// Create a vertex binding for the specified shader variable, value, and attribute usage. RIM_INLINE VertexBinding( const VertexVariable* newVariable, const VertexUsage& newUsage, UInt newBufferOffset, Bool newIsInput = true ) : variable( newVariable ), usage( newUsage ), bufferOffset( newBufferOffset ), isInput( newIsInput ) { RIM_DEBUG_ASSERT_MESSAGE( newVariable != NULL, "Cannot create VertexBinding with NULL vertex variable." ); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Members /// The vertex variable which is bound. const VertexVariable* variable; /// The semantic usage for this vertex attribute binding. /** * This object allows the creator to specify the semantic usage for the vertex attribute * variable. For instance, the usage could be to specify a the vertex's position. This * allows the rendering system to automatically update certain shader parameters * that are environmental. */ VertexUsage usage; /// The starting index for the first buffer of this binding in its shader pass's buffer storage buffer. UInt bufferOffset; /// A boolean value indicating whether or not this binding represents a dynamic input. Bool isInput; }; //########################################################################################## //*********************** End Rim Graphics Shaders Namespace ***************************** RIM_GRAPHICS_SHADERS_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_GRAPHICS_VERTEX_BINDING_H <file_sep>/* * rimGraphicsAssets.h * Rim Software * * Created by <NAME> on 6/11/14. * Copyright 2014 __MyCompanyName__. All rights reserved. * */ #ifndef INCLUDE_RIM_GRAPHICS_ASSETS_H #define INCLUDE_RIM_GRAPHICS_ASSETS_H #include "assets/rimGraphicsAssetsConfig.h" #include "assets/rimGraphicsSceneAssetTranscoder.h" #include "assets/rimGraphicsObjectAssetTranscoder.h" #include "assets/rimGraphicsCameraAssetTranscoder.h" #include "assets/rimGraphicsLightAssetTranscoder.h" #include "assets/rimGraphicsShapeAssetTranscoder.h" #include "assets/rimGraphicsMaterialAssetTranscoder.h" #include "assets/rimGraphicsTechniqueAssetTranscoder.h" #include "assets/rimGraphicsShaderPassAssetTranscoder.h" #endif // INCLUDE_RIM_GRAPHICS_ASSETS_H <file_sep>/* * rimCopy.h * Rim Framework * * Created by <NAME> on 12/5/11. * Copyright 2011 __MyCompanyName__. All rights reserved. * */ #ifndef INCLUDE_RIM_COPY_H #define INCLUDE_RIM_COPY_H #include "rimUtilitiesConfig.h" #include "../math/rimSIMD.h" //########################################################################################## //*************************** Start Rim Utilities Namespace ****************************** RIM_UTILITIES_NAMESPACE_START //****************************************************************************************** //########################################################################################## //########################################################################################## //########################################################################################## //############ //############ Primary Copy Method For Complex Types //############ //########################################################################################## //########################################################################################## /// Copy the specified number of objects from the source pointer to the destination pointer. /** * This method does not check the validity of the arguments in order to not * impose unnecessary overhead on this low-level method. */ template < typename T > RIM_INLINE void copy( T* destination, const T* source, Size number ) { const T* const sourceEnd = source + number; while ( source < sourceEnd ) { *destination = *source; destination++; source++; } } template <> RIM_FORCE_INLINE void copy( unsigned char* destination, const unsigned char* source, Size number ) { std::memcpy( (void*)destination, (void*)source, number*sizeof(unsigned char) ); } template <> RIM_FORCE_INLINE void copy( char* destination, const char* source, Size number ) { std::memcpy( (void*)destination, (void*)source, number*sizeof(char) ); } template <> RIM_FORCE_INLINE void copy( unsigned short* destination, const unsigned short* source, Size number ) { std::memcpy( (void*)destination, (void*)source, number*sizeof(unsigned short) ); } template <> RIM_FORCE_INLINE void copy( short* destination, const short* source, Size number ) { std::memcpy( (void*)destination, (void*)source, number*sizeof(short) ); } template <> RIM_FORCE_INLINE void copy( unsigned int* destination, const unsigned int* source, Size number ) { std::memcpy( (void*)destination, (void*)source, number*sizeof(unsigned int) ); } template <> RIM_FORCE_INLINE void copy( int* destination, const int* source, Size number ) { std::memcpy( (void*)destination, (void*)source, number*sizeof(int) ); } template <> RIM_FORCE_INLINE void copy( unsigned long* destination, const unsigned long* source, Size number ) { std::memcpy( (void*)destination, (void*)source, number*sizeof(unsigned long) ); } template <> RIM_FORCE_INLINE void copy( long* destination, const long* source, Size number ) { std::memcpy( (void*)destination, (void*)source, number*sizeof(long) ); } template <> RIM_FORCE_INLINE void copy( unsigned long long* destination, const unsigned long long* source, Size number ) { std::memcpy( (void*)destination, (void*)source, number*sizeof(unsigned long long) ); } template <> RIM_FORCE_INLINE void copy( long long* destination, const long long* source, Size number ) { std::memcpy( (void*)destination, (void*)source, number*sizeof(long long) ); } template <> RIM_FORCE_INLINE void copy( float* destination, const float* source, Size number ) { std::memcpy( (void*)destination, (void*)source, number*sizeof(float) ); } template <> RIM_FORCE_INLINE void copy( double* destination, const double* source, Size number ) { std::memcpy( (void*)destination, (void*)source, number*sizeof(double) ); } //########################################################################################## //########################################################################################## //############ //############ Primary Convert Method For Complex Types //############ //########################################################################################## //########################################################################################## /// Copy the specified number of objects from the source pointer to the destination pointer, converting object type. /** * This method does not check the validity of the arguments in order to not * impose unnecessary overhead on this low-level method. */ template < typename T, typename U > RIM_INLINE void convert( T* destination, const U* source, Size number ) { const U* const sourceEnd = source + number; while ( source < sourceEnd ) { *destination = *source; destination++; source++; } } //########################################################################################## //########################################################################################## //############ //############ Memory Set Methods //############ //########################################################################################## //########################################################################################## /// Set the specified number of objects at the destination pointer to the given value. /** * This method does not check the validity of the arguments in order to not * impose unnecessary overhead on this low-level method. */ template < typename T > RIM_INLINE void set( T* destination, T value, Size number ) { const T* const destinationEnd = destination + number; while ( destination < destinationEnd ) { *destination = value; destination++; } } template <> RIM_INLINE void set( unsigned char* destination, unsigned char value, Size number ) { std::memset( destination, value, number ); } //########################################################################################## //########################################################################################## //############ //############ Memory Zero Methods //############ //########################################################################################## //########################################################################################## /// Set the specified number of objects at the destination pointer to zero. /** * This method does not check the validity of the arguments in order to not * impose unnecessary overhead on this low-level method. */ template < typename T > RIM_INLINE void zero( T* destination, Size number ) { const T* const destinationEnd = destination + number; while ( destination < destinationEnd ) { *destination = T(); destination++; } } template <> RIM_FORCE_INLINE void zero( unsigned char* destination, Size number ) { std::memset( (unsigned char*)destination, 0, number*sizeof(unsigned char) ); } template <> RIM_FORCE_INLINE void zero( char* destination, Size number ) { std::memset( (unsigned char*)destination, 0, number*sizeof(char) ); } template <> RIM_FORCE_INLINE void zero( unsigned short* destination, Size number ) { std::memset( (unsigned char*)destination, 0, number*sizeof(unsigned short) ); } template <> RIM_FORCE_INLINE void zero( short* destination, Size number ) { std::memset( (unsigned char*)destination, 0, number*sizeof(short) ); } template <> RIM_FORCE_INLINE void zero( unsigned int* destination, Size number ) { std::memset( (unsigned char*)destination, 0, number*sizeof(unsigned int) ); } template <> RIM_FORCE_INLINE void zero( int* destination, Size number ) { std::memset( (unsigned char*)destination, 0, number*sizeof(int) ); } template <> RIM_FORCE_INLINE void zero( unsigned long* destination, Size number ) { std::memset( (unsigned char*)destination, 0, number*sizeof(unsigned long) ); } template <> RIM_FORCE_INLINE void zero( long* destination, Size number ) { std::memset( (unsigned char*)destination, 0, number*sizeof(long) ); } template <> RIM_FORCE_INLINE void zero( unsigned long long* destination, Size number ) { std::memset( (unsigned char*)destination, 0, number*sizeof(unsigned long long) ); } template <> RIM_FORCE_INLINE void zero( long long* destination, Size number ) { std::memset( (unsigned char*)destination, 0, number*sizeof(long long) ); } template <> RIM_FORCE_INLINE void zero( float* destination, Size number ) { std::memset( (unsigned char*)destination, 0, number*sizeof(float) ); } template <> RIM_FORCE_INLINE void zero( double* destination, Size number ) { std::memset( (unsigned char*)destination, 0, number*sizeof(double) ); } //########################################################################################## //########################################################################################## //############ //############ Memory Add Methods //############ //########################################################################################## //########################################################################################## /// Add the specified number of objects from the destination pointer to the source pointer. /** * This method does not check the validity of the arguments in order to not * impose unnecessary overhead on this low-level method. */ template < typename T > RIM_INLINE void add( T* destination, const T* source, Size number ) { const T* const sourceEnd = source + number; while ( source < sourceEnd ) { *destination += *source; destination++; source++; } } //########################################################################################## //*************************** End Rim Utilities Namespace ******************************** RIM_UTILITIES_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_COPY_H <file_sep>/* * rimGraphicsObjects.h * Rim Graphics * * Created by <NAME> on 5/16/12. * Copyright 2012 __MyCompanyName__. All rights reserved. * */ #ifndef INCLUDE_RIM_GRAPHICS_OBJECTS_H #define INCLUDE_RIM_GRAPHICS_OBJECTS_H #include "objects/rimGraphicsObjectsConfig.h" #include "objects/rimGraphicsObject.h" #include "objects/rimGraphicsObjectCuller.h" #include "objects/rimGraphicsObjectCullerSimple.h" #endif // INCLUDE_RIM_GRAPHICS_OBJECTS_H <file_sep>#pragma once /** * This is supposed to be a "simple" rotorcraft but still have the ability to * test. As such a move method which adjusts attitude * during translation is needed. For the case of "simplicity", this craft does * not yaw. To move, in a given time step, the craft moves in the direction of * the position correction vector at its maximum velocity. To do this, it moves * first in the z direction with a level attitude. Next, it tilts by * <code>VEHICLE_MAX_TILT_ANGLE_RADIANS</code> and moves in the global xy plane. * <p> * The attitude of a spacecraft is its rotational orientation in space relative * to a defined reference coordinate system. Yaw, pitch, and roll angles are * alpha, beta, and gamma, respectively. * </p> * * Author: <NAME> * */ #include "VehicleState.h" #include "AngularVelocity.h" #include "Orientation.h" #include "VehicleAttitudeHelpers.h" //#include "vmath.h" #include "rim/rimEngine.h" using namespace rim; using namespace rim::math; static float VEHICLE_MAX_SPEED_MPS = 10.0f; static float VEHICLE_MAX_TILT_ANGLE_RADIANS = 0.26f; static float VEHICLE_MAX_THRUST = 20; static float VEHICLE_MIN_THRUST = 5; static Vector3f VEHICLE_DELTA_THRUST = Vector3f(20, 20, 25); static float VEHICLE_CLOSE_RANGE = 7; static float VEHICLE_CLOSE_RANGE_SCALE_FACTOR = 0.2f; static Vector3f GRAVITY_VECTOR = Vector3f(0, 0, -9.8f); class Vehicle{ private: Vector3f linearAccelerations; AngularVelocity angularVelocities; Vector3f positionCorrection; VehicleState vehicleState; VehicleState lastStateGlobalFrame; Vector3f lastThrustVector; Vector3f currentVelocityBodyFrame; public: /** * This constructor builds a new <code>SimpleMultiRotoCopter</code>. It * takes a <code>VehicleState</code> which places it in its proper location * and orientation in space as well as a starting velocity. * * @param startingState * A <code>VehicleState</code> representing the craft's starting * state. */ Vehicle(VehicleState startingState) { linearAccelerations = Vector3f(); angularVelocities = AngularVelocity(); positionCorrection = Vector3f(); vehicleState = VehicleState(); setVehicleState(vehicleState.deepCopy(startingState)); lastStateGlobalFrame.deepCopy(startingState); lastThrustVector = Vector3f(GRAVITY_VECTOR*(-1)); float yaw = (float) getVehicleState().orientation.x; //getYawRadians(); float pitch = (float) getVehicleState().orientation.y; //getPitchRadians(); float roll = (float) getVehicleState().orientation.z; //getRollRadians(); VehicleAttitudeHelpers vehiclehelpers; currentVelocityBodyFrame = vehiclehelpers .translateVectorToBodyFrame(vehiclehelpers .getAttitudeMatrix(yaw, pitch, roll), getVehicleState().velocity); } Vector3f getLinearAccelerations() { Vector3f returnAccelerations = Vector3f(); returnAccelerations.x = linearAccelerations.x; returnAccelerations.y = linearAccelerations.y; returnAccelerations.z = linearAccelerations.z; return returnAccelerations; } Vector3f getGravityVector() { Vector3f gravityBodyFrame = Vector3f(); float yaw = (float) getVehicleState().orientation.x; //getYawRadians(); float pitch = (float) getVehicleState().orientation.y; //getPitchRadians(); float roll = (float) getVehicleState().orientation.z; //getRollRadians(); VehicleAttitudeHelpers vehiclehelpers; gravityBodyFrame = vehiclehelpers .translateVectorToBodyFrame(vehiclehelpers .getAttitudeMatrix(yaw, pitch, roll), GRAVITY_VECTOR); return gravityBodyFrame; } Vector3f getCurrentPosition() { Vector3f returnCurrentPosition = Vector3f(); returnCurrentPosition.x = vehicleState.position.x; returnCurrentPosition.y = vehicleState.position.y; returnCurrentPosition.z = vehicleState.position.z; return returnCurrentPosition; } AngularVelocity getAngularVelocities() { AngularVelocity returnAngularVelocities = AngularVelocity(); returnAngularVelocities = AngularVelocity(angularVelocities); return returnAngularVelocities; } Vector3f getNegativeZAxis() { Vector3f returnNegativeZAxis = Vector3f(); float yaw = (float) vehicleState.orientation.x; //getYawRadians(); float pitch = (float) vehicleState.orientation.y; //getPitchRadians(); float roll = (float) vehicleState.orientation.z; //getRollRadians(); VehicleAttitudeHelpers vehiclehelpers; returnNegativeZAxis = vehiclehelpers .getAttitudeMatrix(yaw, pitch, roll) .getColumn(vehiclehelpers.INDEX_Z)*(-1); return returnNegativeZAxis; } VehicleState getVehicleState() { VehicleState returnVehicleState = VehicleState(); returnVehicleState = returnVehicleState.deepCopy(vehicleState); return returnVehicleState; } protected: Vector3f getPositionCorrection() { Vector3f returnPositionCorrection = Vector3f(); returnPositionCorrection.x = positionCorrection.x; returnPositionCorrection.y = positionCorrection.y; returnPositionCorrection.z = positionCorrection.z; return returnPositionCorrection; } public: void setPositionCorrection(Vector3f newPositionCorrection) { positionCorrection.x = newPositionCorrection.x; positionCorrection.y = newPositionCorrection.y; positionCorrection.z = newPositionCorrection.z; } protected: void setLinearAccelerations(Vector3f newLinearAccelerations) { linearAccelerations.x = newLinearAccelerations.x; linearAccelerations.y = newLinearAccelerations.y; linearAccelerations.z = newLinearAccelerations.z; } void setAngularVelocities(AngularVelocity newAngularVelocity) { angularVelocities = AngularVelocity(newAngularVelocity); } void setVehicleState(VehicleState newVehicleState) { vehicleState.deepCopy(newVehicleState); } public: void move(double timeStep) { // Save current state as last state lastStateGlobalFrame.deepCopy(getVehicleState()); Vector3f accelerationVector = getAccelerationVector(timeStep); Vector3f thrustVector = setZComponentOfThrustVector(accelerationVector); thrustVector = calculateXAndYComponentsOfThrust(timeStep, thrustVector, accelerationVector); lastThrustVector = thrustVector; setNewVelocity(timeStep, thrustVector); setNewPosition(timeStep); setNewOrientation(thrustVector); Matrix3f currentAttitudeMatrix = getNewAttitudeMatrix(); calculateNewLinearAccelerations(timeStep, currentAttitudeMatrix); calculateAngularVelocities(timeStep, currentAttitudeMatrix); } /* * This helper method calculates and returns the desired acceleration vector * which would correct the vehicle's velocity vector. * * @param timeStep The time step in seconds of this move step. * * @return A Vector3f of the desired acceleration vector. */ private: Vector3f getAccelerationVector(double timeStep) { /* * Divide positionCorrection by its magnitude to get a unit vector * \hat{\rho} and Multiply \hat{\rho} by max velocity to get * newVelocityVector. This limits speed. */ Vector3f positionCorrectionVector = getPositionCorrection(); float vehicleCalculatedMaxSpeed = VEHICLE_MAX_SPEED_MPS; if (positionCorrectionVector.getMagnitude() < VEHICLE_CLOSE_RANGE) { vehicleCalculatedMaxSpeed = VEHICLE_MAX_SPEED_MPS * VEHICLE_CLOSE_RANGE_SCALE_FACTOR; } Vector3f newVelocityVector = positionCorrectionVector.normalize()*( vehicleCalculatedMaxSpeed); // Calculate thrust needed to correct velocity. Vector3f deltaVelocityVector = newVelocityVector - (lastStateGlobalFrame.velocity); return deltaVelocityVector/((float) timeStep); } /* * This helper method calculates sets the Z component of the thrust vector * as not crashing to the Earth is of most importance. * * @param accelerationVector The desired acceleration vector. * * @return A Vector3f object containing only the Z component of the vehicles * new thrust vector. */ Vector3f setZComponentOfThrustVector(Vector3f accelerationVector) { Vector3f thrustVector = Vector3f(); if (accelerationVector.z < GRAVITY_VECTOR.z) { // If we need to accelerate downward faster than gravity, the best // we can do is VEHICLE_MIN_THRUST. thrustVector.z = VEHICLE_MIN_THRUST; } else if (accelerationVector.z >= VEHICLE_MAX_THRUST) { // If we need to accelerate upward harder than we are capable of, // the best we can do is most of MAX_THRUST. thrustVector.z = VEHICLE_MAX_THRUST - VEHICLE_MIN_THRUST; } else { // Otherwise we have to calculate our z thrust as what we want // vector plus gravity vector. thrustVector.z = accelerationVector.z + GRAVITY_VECTOR.z; } return thrustVector; } /* * This helper method calculates sets the X and Y component of the thrust * vector but does not allow the craft to tilt by more than the crafts * VEHICLE_MAX_TILT_ANGLE_RADIANS. If there is not enough thrust available * to achieve the desired acceleration, the X and Y components are scaled * such that the acceleration is in the correct direction but not the * correct amount. * * @param thrustVector The current thrustVector which should only have a the * Z component set at this time. * * @param accelerationVector The desired acceleration vector. * * @return A Vector3f object containing only the final new thrust vector of * the vehicle. */ Vector3f calculateXAndYComponentsOfThrust(double timeStep, Vector3f thrustVector, Vector3f accelerationVector) { // Now we know what z must be. // Get the R component of the desired acceleration vector. Vector3f rOfAcceleration = Vector3f(accelerationVector.x, accelerationVector.y, 0); // Get the amount of MAX_THRUST we have left to utilize float value = (VEHICLE_MAX_THRUST * VEHICLE_MAX_THRUST) - (thrustVector.z * thrustVector.z); if (value < 0) { value = 0; } float magnitudeOfThrustLeftForR = (float) sqrt(value); // Calculate components of available thrust in x and y to thrust in the // direction of acceleration R. float xComponentOfThrustRInAccelerationR = magnitudeOfThrustLeftForR * rOfAcceleration.normalize().x; float yComponentOfThrustRInAccelerationR = magnitudeOfThrustLeftForR * rOfAcceleration.normalize().y; // Make a thrustVectorR Vector3f thrustR = Vector3f(xComponentOfThrustRInAccelerationR, yComponentOfThrustRInAccelerationR, 0); // thrustR.length() and thrustVector.z will be zero or positive from // above. if (abs(thrustVector.z) < 0.5 || abs(atan(thrustR.getMagnitude() / thrustVector.z)) > VEHICLE_MAX_TILT_ANGLE_RADIANS) { // If the angle phi is greater than our // VEHICLE_MAX_TILT_ANGLE_RADIANS, reduce the angle and deal with // reduced R thrust. float newThrustRMagnitude = (float) (abs(thrustVector.z) *tan(VEHICLE_MAX_TILT_ANGLE_RADIANS)); thrustVector.x = thrustR.normalize().x * newThrustRMagnitude; thrustVector.y = thrustR.normalize().y * newThrustRMagnitude; } else { // If phi is not greater than VEHICLE_MAX_TILT_ANGLE_RADIANS, let it // roll. thrustVector.x = thrustR.x; thrustVector.y = thrustR.y; } thrustVector = adjustLimitDeltaThrustVector(timeStep, thrustVector); return thrustVector; } /* * This helper method helps stop the jerky motion of the copter and makes it * such that it must slowly change from one direction to another. * * @param timeStep * The number of seconds in this time step. * @param thrustVector * A <code>Vector3f</code> object representing the currently * calculated thrust. * @return The adjusted thrustVector. */ Vector3f adjustLimitDeltaThrustVector(double timeStep, Vector3f thrustVector) { Vector3f deltaThrust = thrustVector - (lastThrustVector); if (deltaThrust.getMagnitude() / timeStep > VEHICLE_DELTA_THRUST.getMagnitude()) { deltaThrust = deltaThrust.normalize()*( VEHICLE_DELTA_THRUST*((float) timeStep)); thrustVector = Vector3f(lastThrustVector + (deltaThrust)); Vector3f thrustR = Vector3f(thrustVector.x, thrustVector.y, 0); float maxR = thrustVector.z / sin(VEHICLE_MAX_TILT_ANGLE_RADIANS); if (thrustR.getMagnitude() > maxR) { thrustVector.x = thrustR.normalize().x * maxR; thrustVector.y = thrustR.normalize().y * maxR; } } return thrustVector; } /* * This helper method sets the currentStateGlobalFrame's new velocity. * * @param timeStep * The time step in seconds of this move step. * @param thrustVector * The thrust vector of the vehicle. */ void setNewVelocity(double timeStep, Vector3f thrustVector) { VehicleState newState = VehicleState(); newState.deepCopy(getVehicleState()); newState.velocity.x += (float) ((thrustVector.x + GRAVITY_VECTOR.x) * timeStep); newState.velocity.y += (float) ((thrustVector.y + GRAVITY_VECTOR.y) * timeStep); newState.velocity.z += (float) ((thrustVector.z + GRAVITY_VECTOR.z) * timeStep); setVehicleState(newState); } /* * This helper method sets the currentStateGlobalFrame's new position. * * @param timeStep * The time step in seconds of this move step. */ void setNewPosition(double timeStep) { VehicleState newState = VehicleState(); newState.deepCopy(getVehicleState()); newState.position.x += (float) ((newState.velocity.x) * timeStep); newState.position.y += (float) ((newState.velocity.y) * timeStep); newState.position.z += (float) ((newState.velocity.z) * timeStep); setVehicleState(newState); } /* * This helper method calculates sets the new orientation in the global * frame and stores it in the currentStateGlobalFrame's orientation. * * @param thrustVector * The thrust vector of the vehicle. */ void setNewOrientation(Vector3f thrustVector) { Vector3f positiveZAxis = Vector3f(thrustVector); if (positiveZAxis.z < 0) { positiveZAxis = positiveZAxis*(-1); } VehicleAttitudeHelpers vehiclehelpers; Vector3f yawPitchRollGlobalFrame = vehiclehelpers .getPitchAndRollFromZWhenYawIsZero(positiveZAxis); VehicleState newState = VehicleState(); newState.deepCopy(getVehicleState()); /*newState.orientation.buildOrientationFromRadians( yawPitchRollGlobalFrame.x, yawPitchRollGlobalFrame.y, yawPitchRollGlobalFrame.z);*/ newState.orientation.x = yawPitchRollGlobalFrame.x; newState.orientation.y = yawPitchRollGlobalFrame.y; newState.orientation.z = yawPitchRollGlobalFrame.z; setVehicleState(newState); } /* * This helper method gets the new attitude coordinate system from the * currentStateGlobalFrame's orientation's yaw, pitch and roll values * * @return A Matrix3f representing the vehicles attitude in the global * frame. */ Matrix3f getNewAttitudeMatrix() { float yaw = (float) getVehicleState().orientation.x; //getYawRadians(); float pitch = (float) getVehicleState().orientation.y; //getPitchRadians(); float roll = (float) getVehicleState().orientation.z; //getRollRadians(); VehicleAttitudeHelpers vehiclehelpers; return vehiclehelpers.getAttitudeMatrix(yaw, pitch, roll); } /* * This helper method calculates the linear accelerations on the body frame * of the vehicle and stores them in the linearAccelerationsBodyFrame * variable. * * @param timeStep * The time step in seconds of this move step. * @param currentAttitudeMatrix * The current coordinate system representing the vehicles * attitude. */ void calculateNewLinearAccelerations(double timeStep, Matrix3f currentAttitudeMatrix) { Vector3f lastVelocityBodyFrame = Vector3f(currentVelocityBodyFrame); VehicleAttitudeHelpers vehiclehelpers; currentVelocityBodyFrame = vehiclehelpers .translateVectorToBodyFrame(currentAttitudeMatrix, getVehicleState().velocity); float linearAccelInX = (float) ((currentVelocityBodyFrame.x - lastVelocityBodyFrame.x) / timeStep); float linearAccelInY = (float) ((currentVelocityBodyFrame.y - lastVelocityBodyFrame.y) / timeStep); float linearAccelInZ = (float) ((currentVelocityBodyFrame.z - lastVelocityBodyFrame.z) / timeStep); setLinearAccelerations(Vector3f(linearAccelInX, linearAccelInY, linearAccelInZ)); } /* * This helper method calculates the angular velocities on the body frame of * the vehicle and stores them in the angularVelocitiesBodyFrame variable. * * @param timeStep * The time step in seconds of this move step. * @param currentAttitudeMatrix * The current coordinate system representing the vehicles * attitude. */ void calculateAngularVelocities(double timeStep, Matrix3f currentAttitudeMatrix) { float oldYaw = (float) lastStateGlobalFrame.orientation.x; //getYawRadians(); float oldPitch = (float) lastStateGlobalFrame.orientation .y; //getPitchRadians(); float oldRoll = (float) lastStateGlobalFrame.orientation .z; //getRollRadians(); VehicleAttitudeHelpers vehiclehelpers; Matrix3f oldAttitudeMatrix = vehiclehelpers.getAttitudeMatrix( oldYaw, oldPitch, oldRoll); Matrix3f newAttitudeMatrixBodyFrame = vehiclehelpers .translateCoordinateSystemToBodyFrame(oldAttitudeMatrix, currentAttitudeMatrix); // Get yaw, pitch, and roll from newAttitudeMatrixBodyFrame Vector3f yawPitchRollBodyFrame = vehiclehelpers .getYawPitchRollFromCoordinateSystemInRadians(newAttitudeMatrixBodyFrame); float angularVelocityX = (float) (yawPitchRollBodyFrame.z / timeStep); float angularVelocityY = (float) (yawPitchRollBodyFrame.y / timeStep); float angularVelocityZ = (float) (yawPitchRollBodyFrame.x / timeStep); setAngularVelocities(AngularVelocity(angularVelocityZ, angularVelocityY, angularVelocityX)); } }; <file_sep>/* * rimFunction.h * Rim Framework * * Created by <NAME> on 6/22/08. * Copyright 2008 Rim Software. All rights reserved. * */ #ifndef INCLUDE_RIM_FUNCTION_H #define INCLUDE_RIM_FUNCTION_H #include "rimLanguageConfig.h" #include "detail/rimFunctionDefinition.h" #include "detail/rimMemberFunction.h" //########################################################################################## //*************************** Start Rim Language Namespace ******************************* RIM_LANGUAGE_NAMESPACE_START //****************************************************************************************** //########################################################################################## /// Prototype for the function object template class. template < typename Signature > class Function; //########################################################################################## //########################################################################################## //############ //############ Function Object With 0 Parameters Class Definition //############ //########################################################################################## //########################################################################################## /// Specialization of the function template class for a method with 0 parameters. template < typename R > class Function< R () > { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Public Type Definitions /// The return type of this function object. typedef R ReturnType; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructors /// Create a new default function object with a NULL function pointer. /** * Calling a NULL function object will cause an assertion to be raised. * One should always check to see if the function is NULL by calling the * isNull() method before calling it. */ RIM_INLINE Function() : staticFunctionPointer( NULL ), isMember( false ) { } /// Create a new function object which wraps the specified non-member function pointer. RIM_INLINE Function( R (*functionPointer)() ) : staticFunctionPointer( functionPointer ), isMember( false ) { } /// Create a new function object which wraps the specified object and member function pointer. template < typename ObjectType, typename ObjectType2 > RIM_INLINE Function( R (ObjectType2::*functionPointer)(), ObjectType* objectPointer ) { constructMemberFunction( functionPointer, objectPointer ); } /// Create a new function object which wraps the specified object and const member function pointer. template < typename ObjectType, typename ObjectType2 > RIM_INLINE Function( R (ObjectType2::*functionPointer)() const, const ObjectType* objectPointer ) { constructMemberFunction( functionPointer, objectPointer ); } /// Create a copy of the specified function object. RIM_INLINE Function( const Function& other ) : isMember( other.isMember ) { if ( other.isMember ) memberFunction = other.memberFunction->clone(); else staticFunctionPointer = other.staticFunctionPointer; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Destructor /// Destroy this function object, releasing all internal state. RIM_INLINE ~Function() { if ( isMember ) util::destruct( memberFunction ); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Assignment Operator /// Assign the state of one function object to another. RIM_INLINE Function& operator = ( const Function& other ) { if ( this != &other ) { // Clean up the old member function if there was one. if ( isMember ) util::destruct( memberFunction ); // Copy the other function pointer. if ( isMember = other.isMember ) memberFunction = other.memberFunction->clone(); else staticFunctionPointer = other.staticFunctionPointer; } return *this; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Function Call Method /// Call this function and return its return value. /** * Calling a NULL function object will cause an assertion to be raised. * One should always check to see if the function is NULL by calling the * isNull() method before calling it. */ RIM_INLINE ReturnType operator () () const { if ( isMember ) return (*memberFunction)(); else { RIM_DEBUG_ASSERT_MESSAGE( staticFunctionPointer == NULL, "Cannot call NULL function object." ); return staticFunctionPointer(); } } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Function Equality Comparison Operators /// Return whether or not this function references the same function as another function object. RIM_INLINE Bool operator == ( const Function& other ) const { if ( isMember ) return other.isMember && memberFunction->equals( *other.memberFunction ); else return !other.isMember && staticFunctionPointer == other.staticFunctionPointer; } /// Return whether or not this function references a different function as onother function object. RIM_INLINE Bool operator != ( const Function& other ) const { return !(*this == other); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Function Equality Comparison Operators /// Return whether or not this function object has a function/object pointer that is NULL. /** * If this method returns TRUE, calling the function will result in * an assertion being raised. */ RIM_INLINE Bool isNull() const { return !isMember && staticFunctionPointer == NULL; } /// Return whether or not this function object has a function/object pointer that is not NULL. /** * If this method returns FALSE, calling the function will result in * an assertion being raised. */ RIM_INLINE Bool isSet() const { return isMember || staticFunctionPointer != NULL; } private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Helper Methods template < typename SignatureType, typename ObjectType > RIM_INLINE void constructMemberFunction( SignatureType functionPointer, ObjectType* object ) { if ( object == NULL || functionPointer == NULL ) { staticFunctionPointer = NULL; isMember = false; } else { memberFunction = util::construct<internal::MemberFunction< ObjectType, SignatureType, R> >( functionPointer, object ); isMember = true; } } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Members /// A union which saves space when storing the static and member function pointers. union { /// A non-member function pointer to use when the function object represents a non-member function. R (*staticFunctionPointer)(); /// A pointer to an object which wraps a member function when this function is a member function. internal::FunctionDefinition<R>* memberFunction; }; /// A boolean value indicating whether or not this function object is a member function. Bool isMember; }; template < typename R > RIM_INLINE Function<R ()> bind( R (*functionPointer)() ) { return Function<R ()>( functionPointer ); } template < typename ObjectType, typename ObjectType2, typename R > RIM_INLINE Function<R ()> bind( R (ObjectType2::*functionPointer)(), ObjectType* objectPointer ) { return Function<R ()>( functionPointer, objectPointer ); } template < typename ObjectType, typename ObjectType2, typename R > RIM_INLINE Function<R ()> bind( R (ObjectType2::*functionPointer)() const, const ObjectType* objectPointer ) { return Function<R ()>( functionPointer, objectPointer ); } //########################################################################################## //########################################################################################## //############ //############ Function Object With 1 Parameter Class Definition //############ //########################################################################################## //########################################################################################## /// Specialization of the function template class for a method with 1 parameter. template < typename R, typename T1 > class Function< R ( T1 ) > { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Public Type Definitions /// The return type of this function object. typedef R ReturnType; /// The type of the first parameter of this function object. typedef T1 ParameterType1; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructors /// Create a new default function object with a NULL function pointer. /** * Calling a NULL function object will cause an assertion to be raised. * One should always check to see if the function is NULL by calling the * isNull() method before calling it. */ RIM_INLINE Function() : staticFunctionPointer( NULL ), isMember( false ) { } /// Create a new function object which wraps the specified non-member function pointer. RIM_INLINE Function( R (*functionPointer)( T1 ) ) : staticFunctionPointer( functionPointer ), isMember( false ) { } /// Create a new function object which wraps the specified object and member function pointer. template < typename ObjectType, typename ObjectType2 > RIM_INLINE Function( R (ObjectType2::*functionPointer)( T1 ), ObjectType* objectPointer ) { constructMemberFunction( functionPointer, objectPointer ); } /// Create a new function object which wraps the specified object and const member function pointer. template < typename ObjectType, typename ObjectType2 > RIM_INLINE Function( R (ObjectType2::*functionPointer)( T1 ) const, const ObjectType* objectPointer ) { constructMemberFunction( functionPointer, objectPointer ); } /// Create a copy of the specified function object. RIM_INLINE Function( const Function& other ) : isMember( other.isMember ) { if ( other.isMember ) memberFunction = other.memberFunction->clone(); else staticFunctionPointer = other.staticFunctionPointer; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Destructor /// Destroy this function object, releasing all internal state. RIM_INLINE ~Function() { if ( isMember ) util::destruct( memberFunction ); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Assignment Operator /// Assign the state of one function object to another. RIM_INLINE Function& operator = ( const Function& other ) { if ( this != &other ) { // Clean up the old member function if there was one. if ( isMember ) util::destruct( memberFunction ); // Copy the other function pointer. if ( isMember = other.isMember ) memberFunction = other.memberFunction->clone(); else staticFunctionPointer = other.staticFunctionPointer; } return *this; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Function Call Method /// Call this function and return its return value. /** * Calling a NULL function object will cause an assertion to be raised. * One should always check to see if the function is NULL by calling the * isNull() method before calling it. */ RIM_INLINE ReturnType operator () ( T1 p1 ) const { if ( isMember ) return (*memberFunction)( p1 ); else { RIM_DEBUG_ASSERT_MESSAGE( staticFunctionPointer == NULL, "Cannot call NULL function object." ); return staticFunctionPointer( p1 ); } } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Function Equality Comparison Operators /// Return whether or not this function references the same function as another function object. RIM_INLINE Bool operator == ( const Function& other ) const { if ( isMember ) return other.isMember && memberFunction->equals( *other.memberFunction ); else return !other.isMember && staticFunctionPointer == other.staticFunctionPointer; } /// Return whether or not this function references a different function as onother function object. RIM_INLINE Bool operator != ( const Function& other ) const { return !(*this == other); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Function Equality Comparison Operators /// Return whether or not this function object has a function/object pointer that is NULL. /** * If this method returns TRUE, calling the function will result in * an assertion being raised. */ RIM_INLINE Bool isNull() const { return !isMember && staticFunctionPointer == NULL; } /// Return whether or not this function object has a function/object pointer that is not NULL. /** * If this method returns FALSE, calling the function will result in * an assertion being raised. */ RIM_INLINE Bool isSet() const { return isMember || staticFunctionPointer != NULL; } private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Helper Methods template < typename SignatureType, typename ObjectType > RIM_INLINE void constructMemberFunction( SignatureType functionPointer, ObjectType* object ) { if ( object == NULL || functionPointer == NULL ) { staticFunctionPointer = NULL; isMember = false; } else { memberFunction = util::construct<internal::MemberFunction< ObjectType, SignatureType, R, T1> >( functionPointer, object ); isMember = true; } } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Members /// A union which saves space when storing the static and member function pointers. union { /// A non-member function pointer to use when the function object represents a non-member function. R (*staticFunctionPointer)( T1 ); /// A pointer to an object which wraps a member function when this function is a member function. internal::FunctionDefinition<R,T1>* memberFunction; }; /// A boolean value indicating whether or not this function object is a member function. Bool isMember; }; template < typename R, typename T1 > RIM_INLINE Function<R ( T1 )> bind( R (*functionPointer)( T1 ) ) { return Function<R ( T1 )>( functionPointer ); } template < typename ObjectType, typename ObjectType2, typename R, typename T1 > RIM_INLINE Function<R ( T1 )> bind( R (ObjectType2::*functionPointer)( T1 ), ObjectType* objectPointer ) { return Function<R ( T1 )>( functionPointer, objectPointer ); } template < typename ObjectType, typename ObjectType2, typename R, typename T1 > RIM_INLINE Function<R ( T1 )> bind( R (ObjectType2::*functionPointer)( T1 ) const, const ObjectType* objectPointer ) { return Function<R ( T1 )>( functionPointer, objectPointer ); } //########################################################################################## //########################################################################################## //############ //############ Function Object With 2 Parameters Class Definition //############ //########################################################################################## //########################################################################################## /// Specialization of the function template class for a method with 2 parameters. template < typename R, typename T1, typename T2 > class Function< R ( T1, T2 ) > { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Public Type Definitions /// The return type of this function object. typedef R ReturnType; /// The type of the first parameter of this function object. typedef T1 ParameterType1; /// The type of the second parameter of this function object. typedef T2 ParameterType2; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructors /// Create a new default function object with a NULL function pointer. /** * Calling a NULL function object will cause an assertion to be raised. * One should always check to see if the function is NULL by calling the * isNull() method before calling it. */ RIM_INLINE Function() : staticFunctionPointer( NULL ), isMember( false ) { } /// Create a new function object which wraps the specified non-member function pointer. RIM_INLINE Function( R (*functionPointer)( T1, T2 ) ) : staticFunctionPointer( functionPointer ), isMember( false ) { } /// Create a new function object which wraps the specified object and member function pointer. template < typename ObjectType, typename ObjectType2 > RIM_INLINE Function( R (ObjectType2::*functionPointer)( T1, T2 ), ObjectType* objectPointer ) { constructMemberFunction( functionPointer, objectPointer ); } /// Create a new function object which wraps the specified object and const member function pointer. template < typename ObjectType, typename ObjectType2 > RIM_INLINE Function( R (ObjectType2::*functionPointer)( T1, T2 ) const, const ObjectType* objectPointer ) { constructMemberFunction( functionPointer, objectPointer ); } /// Create a copy of the specified function object. RIM_INLINE Function( const Function& other ) : isMember( other.isMember ) { if ( other.isMember ) memberFunction = other.memberFunction->clone(); else staticFunctionPointer = other.staticFunctionPointer; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Destructor /// Destroy this function object, releasing all internal state. RIM_INLINE ~Function() { if ( isMember ) util::destruct( memberFunction ); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Assignment Operator /// Assign the state of one function object to another. RIM_INLINE Function& operator = ( const Function& other ) { if ( this != &other ) { // Clean up the old member function if there was one. if ( isMember ) util::destruct( memberFunction ); // Copy the other function pointer. if ( isMember = other.isMember ) memberFunction = other.memberFunction->clone(); else staticFunctionPointer = other.staticFunctionPointer; } return *this; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Function Call Method /// Call this function and return its return value. /** * Calling a NULL function object will cause an assertion to be raised. * One should always check to see if the function is NULL by calling the * isNull() method before calling it. */ RIM_INLINE ReturnType operator () ( T1 p1, T2 p2 ) const { if ( isMember ) return (*memberFunction)( p1, p2 ); else { RIM_DEBUG_ASSERT_MESSAGE( staticFunctionPointer == NULL, "Cannot call NULL function object." ); return staticFunctionPointer( p1, p2 ); } } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Function Equality Comparison Operators /// Return whether or not this function references the same function as another function object. RIM_INLINE Bool operator == ( const Function& other ) const { if ( isMember ) return other.isMember && memberFunction->equals( *other.memberFunction ); else return !other.isMember && staticFunctionPointer == other.staticFunctionPointer; } /// Return whether or not this function references a different function as onother function object. RIM_INLINE Bool operator != ( const Function& other ) const { return !(*this == other); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Function Equality Comparison Operators /// Return whether or not this function object has a function/object pointer that is NULL. /** * If this method returns TRUE, calling the function will result in * an assertion being raised. */ RIM_INLINE Bool isNull() const { return !isMember && staticFunctionPointer == NULL; } /// Return whether or not this function object has a function/object pointer that is not NULL. /** * If this method returns FALSE, calling the function will result in * an assertion being raised. */ RIM_INLINE Bool isSet() const { return isMember || staticFunctionPointer != NULL; } private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Helper Methods template < typename SignatureType, typename ObjectType > RIM_INLINE void constructMemberFunction( SignatureType functionPointer, ObjectType* object ) { if ( object == NULL || functionPointer == NULL ) { staticFunctionPointer = NULL; isMember = false; } else { memberFunction = util::construct<internal::MemberFunction< ObjectType, SignatureType, R, T1, T2> >( functionPointer, object ); isMember = true; } } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Members /// A union which saves space when storing the static and member function pointers. union { /// A non-member function pointer to use when the function object represents a non-member function. R (*staticFunctionPointer)( T1, T2 ); /// A pointer to an object which wraps a member function when this function is a member function. internal::FunctionDefinition<R,T1,T2>* memberFunction; }; /// A boolean value indicating whether or not this function object is a member function. Bool isMember; }; template < typename R, typename T1, typename T2 > RIM_INLINE Function<R ( T1, T2 )> bind( R (*functionPointer)( T1, T2 ) ) { return Function<R ( T1, T2 )>( functionPointer ); } template < typename ObjectType, typename ObjectType2, typename R, typename T1, typename T2 > RIM_INLINE Function<R ( T1, T2 )> bind( R (ObjectType2::*functionPointer)( T1, T2 ), ObjectType* objectPointer ) { return Function<R ( T1, T2 )>( functionPointer, objectPointer ); } template < typename ObjectType, typename ObjectType2, typename R, typename T1, typename T2 > RIM_INLINE Function<R ( T1, T2 )> bind( R (ObjectType2::*functionPointer)( T1, T2 ) const, const ObjectType* objectPointer ) { return Function<R ( T1, T2 )>( functionPointer, objectPointer ); } //########################################################################################## //########################################################################################## //############ //############ Function Object With 3 Parameters Class Definition //############ //########################################################################################## //########################################################################################## /// Specialization of the function template class for a method with 3 parameters. template < typename R, typename T1, typename T2, typename T3 > class Function< R ( T1, T2, T3 ) > { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Public Type Definitions /// The return type of this function object. typedef R ReturnType; /// The type of the first parameter of this function object. typedef T1 ParameterType1; /// The type of the second parameter of this function object. typedef T2 ParameterType2; /// The type of the third parameter of this function object. typedef T3 ParameterType3; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructors /// Create a new default function object with a NULL function pointer. /** * Calling a NULL function object will cause an assertion to be raised. * One should always check to see if the function is NULL by calling the * isNull() method before calling it. */ RIM_INLINE Function() : staticFunctionPointer( NULL ), isMember( false ) { } /// Create a new function object which wraps the specified non-member function pointer. RIM_INLINE Function( R (*functionPointer)( T1, T2, T3 ) ) : staticFunctionPointer( functionPointer ), isMember( false ) { } /// Create a new function object which wraps the specified object and member function pointer. template < typename ObjectType, typename ObjectType2 > RIM_INLINE Function( R (ObjectType2::*functionPointer)( T1, T2, T3 ), ObjectType* objectPointer ) { constructMemberFunction( functionPointer, objectPointer ); } /// Create a new function object which wraps the specified object and const member function pointer. template < typename ObjectType, typename ObjectType2 > RIM_INLINE Function( R (ObjectType2::*functionPointer)( T1, T2, T3 ) const, const ObjectType* objectPointer ) { constructMemberFunction( functionPointer, objectPointer ); } /// Create a copy of the specified function object. RIM_INLINE Function( const Function& other ) : isMember( other.isMember ) { if ( other.isMember ) memberFunction = other.memberFunction->clone(); else staticFunctionPointer = other.staticFunctionPointer; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Destructor /// Destroy this function object, releasing all internal state. RIM_INLINE ~Function() { if ( isMember ) util::destruct( memberFunction ); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Assignment Operator /// Assign the state of one function object to another. RIM_INLINE Function& operator = ( const Function& other ) { if ( this != &other ) { // Clean up the old member function if there was one. if ( isMember ) util::destruct( memberFunction ); // Copy the other function pointer. if ( isMember = other.isMember ) memberFunction = other.memberFunction->clone(); else staticFunctionPointer = other.staticFunctionPointer; } return *this; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Function Call Method /// Call this function and return its return value. /** * Calling a NULL function object will cause an assertion to be raised. * One should always check to see if the function is NULL by calling the * isNull() method before calling it. */ RIM_INLINE ReturnType operator () ( T1 p1, T2 p2, T3 p3 ) const { if ( isMember ) return (*memberFunction)( p1, p2, p3 ); else { RIM_DEBUG_ASSERT_MESSAGE( staticFunctionPointer == NULL, "Cannot call NULL function object." ); return staticFunctionPointer( p1, p2, p3 ); } } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Function Equality Comparison Operators /// Return whether or not this function references the same function as another function object. RIM_INLINE Bool operator == ( const Function& other ) const { if ( isMember ) return other.isMember && memberFunction->equals( *other.memberFunction ); else return !other.isMember && staticFunctionPointer == other.staticFunctionPointer; } /// Return whether or not this function references a different function as onother function object. RIM_INLINE Bool operator != ( const Function& other ) const { return !(*this == other); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Function Equality Comparison Operators /// Return whether or not this function object has a function/object pointer that is NULL. /** * If this method returns TRUE, calling the function will result in * an assertion being raised. */ RIM_INLINE Bool isNull() const { return !isMember && staticFunctionPointer == NULL; } /// Return whether or not this function object has a function/object pointer that is not NULL. /** * If this method returns FALSE, calling the function will result in * an assertion being raised. */ RIM_INLINE Bool isSet() const { return isMember || staticFunctionPointer != NULL; } private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Helper Methods template < typename SignatureType, typename ObjectType > RIM_INLINE void constructMemberFunction( SignatureType functionPointer, ObjectType* object ) { if ( object == NULL || functionPointer == NULL ) { staticFunctionPointer = NULL; isMember = false; } else { memberFunction = util::construct<internal::MemberFunction< ObjectType, SignatureType, R, T1, T2, T3> >( functionPointer, object ); isMember = true; } } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Members /// A union which saves space when storing the static and member function pointers. union { /// A non-member function pointer to use when the function object represents a non-member function. R (*staticFunctionPointer)( T1, T2, T3 ); /// A pointer to an object which wraps a member function when this function is a member function. internal::FunctionDefinition<R,T1,T2,T3>* memberFunction; }; /// A boolean value indicating whether or not this function object is a member function. Bool isMember; }; template < typename R, typename T1, typename T2, typename T3 > RIM_INLINE Function<R ( T1, T2, T3 )> bind( R (*functionPointer)( T1, T2, T3 ) ) { return Function<R ( T1, T2, T3 )>( functionPointer ); } template < typename ObjectType, typename ObjectType2, typename R, typename T1, typename T2, typename T3 > RIM_INLINE Function<R ( T1, T2, T3 )> bind( R (ObjectType2::*functionPointer)( T1, T2, T3 ), ObjectType* objectPointer ) { return Function<R ( T1, T2, T3 )>( functionPointer, objectPointer ); } template < typename ObjectType, typename ObjectType2, typename R, typename T1, typename T2, typename T3 > RIM_INLINE Function<R ( T1, T2, T3 )> bind( R (ObjectType2::*functionPointer)( T1, T2, T3 ) const, const ObjectType* objectPointer ) { return Function<R ( T1, T2, T3 )>( functionPointer, objectPointer ); } //########################################################################################## //########################################################################################## //############ //############ Function Object With 4 Parameters Class Definition //############ //########################################################################################## //########################################################################################## /// Specialization of the function template class for a method with 4 parameters. template < typename R, typename T1, typename T2, typename T3, typename T4 > class Function< R ( T1, T2, T3, T4 ) > { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Public Type Definitions /// The return type of this function object. typedef R ReturnType; /// The type of the first parameter of this function object. typedef T1 ParameterType1; /// The type of the second parameter of this function object. typedef T2 ParameterType2; /// The type of the third parameter of this function object. typedef T3 ParameterType3; /// The type of the fourth parameter of this function object. typedef T4 ParameterType4; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructors /// Create a new default function object with a NULL function pointer. /** * Calling a NULL function object will cause an assertion to be raised. * One should always check to see if the function is NULL by calling the * isNull() method before calling it. */ RIM_INLINE Function() : staticFunctionPointer( NULL ), isMember( false ) { } /// Create a new function object which wraps the specified non-member function pointer. RIM_INLINE Function( R (*functionPointer)( T1, T2, T3, T4 ) ) : staticFunctionPointer( functionPointer ), isMember( false ) { } /// Create a new function object which wraps the specified object and member function pointer. template < typename ObjectType, typename ObjectType2 > RIM_INLINE Function( R (ObjectType2::*functionPointer)( T1, T2, T3, T4 ), ObjectType* objectPointer ) { constructMemberFunction( functionPointer, objectPointer ); } /// Create a new function object which wraps the specified object and const member function pointer. template < typename ObjectType, typename ObjectType2 > RIM_INLINE Function( R (ObjectType2::*functionPointer)( T1, T2, T3, T4 ) const, const ObjectType* objectPointer ) { constructMemberFunction( functionPointer, objectPointer ); } /// Create a copy of the specified function object. RIM_INLINE Function( const Function& other ) : isMember( other.isMember ) { if ( other.isMember ) memberFunction = other.memberFunction->clone(); else staticFunctionPointer = other.staticFunctionPointer; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Destructor /// Destroy this function object, releasing all internal state. RIM_INLINE ~Function() { if ( isMember ) util::destruct( memberFunction ); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Assignment Operator /// Assign the state of one function object to another. RIM_INLINE Function& operator = ( const Function& other ) { if ( this != &other ) { // Clean up the old member function if there was one. if ( isMember ) util::destruct( memberFunction ); // Copy the other function pointer. if ( isMember = other.isMember ) memberFunction = other.memberFunction->clone(); else staticFunctionPointer = other.staticFunctionPointer; } return *this; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Function Call Method /// Call this function and return its return value. /** * Calling a NULL function object will cause an assertion to be raised. * One should always check to see if the function is NULL by calling the * isNull() method before calling it. */ RIM_INLINE ReturnType operator () ( T1 p1, T2 p2, T3 p3, T4 p4 ) const { if ( isMember ) return (*memberFunction)( p1, p2, p3, p4 ); else { RIM_DEBUG_ASSERT_MESSAGE( staticFunctionPointer == NULL, "Cannot call NULL function object." ); return staticFunctionPointer( p1, p2, p3, p4 ); } } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Function Equality Comparison Operators /// Return whether or not this function references the same function as another function object. RIM_INLINE Bool operator == ( const Function& other ) const { if ( isMember ) return other.isMember && memberFunction->equals( *other.memberFunction ); else return !other.isMember && staticFunctionPointer == other.staticFunctionPointer; } /// Return whether or not this function references a different function as onother function object. RIM_INLINE Bool operator != ( const Function& other ) const { return !(*this == other); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Function Equality Comparison Operators /// Return whether or not this function object has a function/object pointer that is NULL. /** * If this method returns TRUE, calling the function will result in * an assertion being raised. */ RIM_INLINE Bool isNull() const { return !isMember && staticFunctionPointer == NULL; } /// Return whether or not this function object has a function/object pointer that is not NULL. /** * If this method returns FALSE, calling the function will result in * an assertion being raised. */ RIM_INLINE Bool isSet() const { return isMember || staticFunctionPointer != NULL; } private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Helper Methods template < typename SignatureType, typename ObjectType > RIM_INLINE void constructMemberFunction( SignatureType functionPointer, ObjectType* object ) { if ( object == NULL || functionPointer == NULL ) { staticFunctionPointer = NULL; isMember = false; } else { memberFunction = util::construct<internal::MemberFunction< ObjectType, SignatureType, R, T1, T2, T3, T4> >( functionPointer, object ); isMember = true; } } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Members /// A union which saves space when storing the static and member function pointers. union { /// A non-member function pointer to use when the function object represents a non-member function. R (*staticFunctionPointer)( T1, T2, T3, T4 ); /// A pointer to an object which wraps a member function when this function is a member function. internal::FunctionDefinition<R,T1,T2,T3,T4>* memberFunction; }; /// A boolean value indicating whether or not this function object is a member function. Bool isMember; }; template < typename R, typename T1, typename T2, typename T3, typename T4 > RIM_INLINE Function<R ( T1, T2, T3, T4 )> bind( R (*functionPointer)( T1, T2, T3, T4 ) ) { return Function<R ( T1, T2, T3, T4 )>( functionPointer ); } template < typename ObjectType, typename ObjectType2, typename R, typename T1, typename T2, typename T3, typename T4 > RIM_INLINE Function<R ( T1, T2, T3, T4 )> bind( R (ObjectType2::*functionPointer)( T1, T2, T3, T4 ), ObjectType* objectPointer ) { return Function<R ( T1, T2, T3, T4 )>( functionPointer, objectPointer ); } template < typename ObjectType, typename ObjectType2, typename R, typename T1, typename T2, typename T3, typename T4 > RIM_INLINE Function<R ( T1, T2, T3, T4 )> bind( R (ObjectType2::*functionPointer)( T1, T2, T3, T4 ) const, const ObjectType* objectPointer ) { return Function<R ( T1, T2, T3, T4 )>( functionPointer, objectPointer ); } //########################################################################################## //########################################################################################## //############ //############ Function Object With 5 Parameters Class Definition //############ //########################################################################################## //########################################################################################## /// Specialization of the function template class for a method with 5 parameters. template < typename R, typename T1, typename T2, typename T3, typename T4, typename T5 > class Function< R ( T1, T2, T3, T4, T5 ) > { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Public Type Definitions /// The return type of this function object. typedef R ReturnType; /// The type of the first parameter of this function object. typedef T1 ParameterType1; /// The type of the second parameter of this function object. typedef T2 ParameterType2; /// The type of the third parameter of this function object. typedef T3 ParameterType3; /// The type of the fourth parameter of this function object. typedef T4 ParameterType4; /// The type of the fifth parameter of this function object. typedef T5 ParameterType5; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructors /// Create a new default function object with a NULL function pointer. /** * Calling a NULL function object will cause an assertion to be raised. * One should always check to see if the function is NULL by calling the * isNull() method before calling it. */ RIM_INLINE Function() : staticFunctionPointer( NULL ), isMember( false ) { } /// Create a new function object which wraps the specified non-member function pointer. RIM_INLINE Function( R (*functionPointer)( T1, T2, T3, T4, T5 ) ) : staticFunctionPointer( functionPointer ), isMember( false ) { } /// Create a new function object which wraps the specified object and member function pointer. template < typename ObjectType, typename ObjectType2 > RIM_INLINE Function( R (ObjectType2::*functionPointer)( T1, T2, T3, T4, T5 ), ObjectType* objectPointer ) { constructMemberFunction( functionPointer, objectPointer ); } /// Create a new function object which wraps the specified object and const member function pointer. template < typename ObjectType, typename ObjectType2 > RIM_INLINE Function( R (ObjectType2::*functionPointer)( T1, T2, T3, T4, T5 ) const, const ObjectType* objectPointer ) { constructMemberFunction( functionPointer, objectPointer ); } /// Create a copy of the specified function object. RIM_INLINE Function( const Function& other ) : isMember( other.isMember ) { if ( other.isMember ) memberFunction = other.memberFunction->clone(); else staticFunctionPointer = other.staticFunctionPointer; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Destructor /// Destroy this function object, releasing all internal state. RIM_INLINE ~Function() { if ( isMember ) util::destruct( memberFunction ); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Assignment Operator /// Assign the state of one function object to another. RIM_INLINE Function& operator = ( const Function& other ) { if ( this != &other ) { // Clean up the old member function if there was one. if ( isMember ) util::destruct( memberFunction ); // Copy the other function pointer. if ( isMember = other.isMember ) memberFunction = other.memberFunction->clone(); else staticFunctionPointer = other.staticFunctionPointer; } return *this; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Function Call Method /// Call this function and return its return value. /** * Calling a NULL function object will cause an assertion to be raised. * One should always check to see if the function is NULL by calling the * isNull() method before calling it. */ RIM_INLINE ReturnType operator () ( T1 p1, T2 p2, T3 p3, T4 p4, T5 p5 ) const { if ( isMember ) return (*memberFunction)( p1, p2, p3, p4, p5 ); else { RIM_DEBUG_ASSERT_MESSAGE( staticFunctionPointer == NULL, "Cannot call NULL function object." ); return staticFunctionPointer( p1, p2, p3, p4, p5 ); } } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Function Equality Comparison Operators /// Return whether or not this function references the same function as another function object. RIM_INLINE Bool operator == ( const Function& other ) const { if ( isMember ) return other.isMember && memberFunction->equals( *other.memberFunction ); else return !other.isMember && staticFunctionPointer == other.staticFunctionPointer; } /// Return whether or not this function references a different function as onother function object. RIM_INLINE Bool operator != ( const Function& other ) const { return !(*this == other); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Function Equality Comparison Operators /// Return whether or not this function object has a function/object pointer that is NULL. /** * If this method returns TRUE, calling the function will result in * an assertion being raised. */ RIM_INLINE Bool isNull() const { return !isMember && staticFunctionPointer == NULL; } /// Return whether or not this function object has a function/object pointer that is not NULL. /** * If this method returns FALSE, calling the function will result in * an assertion being raised. */ RIM_INLINE Bool isSet() const { return isMember || staticFunctionPointer != NULL; } private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Helper Methods template < typename SignatureType, typename ObjectType > RIM_INLINE void constructMemberFunction( SignatureType functionPointer, ObjectType* object ) { if ( object == NULL || functionPointer == NULL ) { staticFunctionPointer = NULL; isMember = false; } else { memberFunction = util::construct<internal::MemberFunction< ObjectType, SignatureType, R, T1, T2, T3, T4, T5> >( functionPointer, object ); isMember = true; } } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Members /// A union which saves space when storing the static and member function pointers. union { /// A non-member function pointer to use when the function object represents a non-member function. R (*staticFunctionPointer)( T1, T2, T3, T4, T5 ); /// A pointer to an object which wraps a member function when this function is a member function. internal::FunctionDefinition<R,T1,T2,T3,T4,T5>* memberFunction; }; /// A boolean value indicating whether or not this function object is a member function. Bool isMember; }; template < typename R, typename T1, typename T2, typename T3, typename T4, typename T5 > RIM_INLINE Function<R ( T1, T2, T3, T4, T5 )> bind( R (*functionPointer)( T1, T2, T3, T4, T5 ) ) { return Function<R ( T1, T2, T3, T4, T5 )>( functionPointer ); } template < typename ObjectType, typename ObjectType2, typename R, typename T1, typename T2, typename T3, typename T4, typename T5 > RIM_INLINE Function<R ( T1, T2, T3, T4, T5 )> bind( R (ObjectType2::*functionPointer)( T1, T2, T3, T4, T5 ), ObjectType* objectPointer ) { return Function<R ( T1, T2, T3, T4, T5 )>( functionPointer, objectPointer ); } template < typename ObjectType, typename ObjectType2, typename R, typename T1, typename T2, typename T3, typename T4, typename T5 > RIM_INLINE Function<R ( T1, T2, T3, T4, T5 )> bind( R (ObjectType2::*functionPointer)( T1, T2, T3, T4, T5 ) const, const ObjectType* objectPointer ) { return Function<R ( T1, T2, T3, T4, T5 )>( functionPointer, objectPointer ); } //########################################################################################## //########################################################################################## //############ //############ Function Object With 6 Parameters Class Definition //############ //########################################################################################## //########################################################################################## /// Specialization of the function template class for a method with 6 parameters. template < typename R, typename T1, typename T2, typename T3, typename T4, typename T5, typename T6 > class Function< R ( T1, T2, T3, T4, T5, T6 ) > { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Public Type Definitions /// The return type of this function object. typedef R ReturnType; /// The type of the first parameter of this function object. typedef T1 ParameterType1; /// The type of the second parameter of this function object. typedef T2 ParameterType2; /// The type of the third parameter of this function object. typedef T3 ParameterType3; /// The type of the fourth parameter of this function object. typedef T4 ParameterType4; /// The type of the fifth parameter of this function object. typedef T5 ParameterType5; /// The type of the sixth parameter of this function object. typedef T6 ParameterType6; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructors /// Create a new default function object with a NULL function pointer. /** * Calling a NULL function object will cause an assertion to be raised. * One should always check to see if the function is NULL by calling the * isNull() method before calling it. */ RIM_INLINE Function() : staticFunctionPointer( NULL ), isMember( false ) { } /// Create a new function object which wraps the specified non-member function pointer. RIM_INLINE Function( R (*functionPointer)( T1, T2, T3, T4, T5, T6 ) ) : staticFunctionPointer( functionPointer ), isMember( false ) { } /// Create a new function object which wraps the specified object and member function pointer. template < typename ObjectType, typename ObjectType2 > RIM_INLINE Function( R (ObjectType2::*functionPointer)( T1, T2, T3, T4, T5, T6 ), ObjectType* objectPointer ) { constructMemberFunction( functionPointer, objectPointer ); } /// Create a new function object which wraps the specified object and const member function pointer. template < typename ObjectType, typename ObjectType2 > RIM_INLINE Function( R (ObjectType2::*functionPointer)( T1, T2, T3, T4, T5, T6 ) const, const ObjectType* objectPointer ) { constructMemberFunction( functionPointer, objectPointer ); } /// Create a copy of the specified function object. RIM_INLINE Function( const Function& other ) : isMember( other.isMember ) { if ( other.isMember ) memberFunction = other.memberFunction->clone(); else staticFunctionPointer = other.staticFunctionPointer; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Destructor /// Destroy this function object, releasing all internal state. RIM_INLINE ~Function() { if ( isMember ) util::destruct( memberFunction ); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Assignment Operator /// Assign the state of one function object to another. RIM_INLINE Function& operator = ( const Function& other ) { if ( this != &other ) { // Clean up the old member function if there was one. if ( isMember ) util::destruct( memberFunction ); // Copy the other function pointer. if ( isMember = other.isMember ) memberFunction = other.memberFunction->clone(); else staticFunctionPointer = other.staticFunctionPointer; } return *this; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Function Call Method /// Call this function and return its return value. /** * Calling a NULL function object will cause an assertion to be raised. * One should always check to see if the function is NULL by calling the * isNull() method before calling it. */ RIM_INLINE ReturnType operator () ( T1 p1, T2 p2, T3 p3, T4 p4, T5 p5, T6 p6 ) const { if ( isMember ) return (*memberFunction)( p1, p2, p3, p4, p5, p6 ); else { RIM_DEBUG_ASSERT_MESSAGE( staticFunctionPointer == NULL, "Cannot call NULL function object." ); return staticFunctionPointer( p1, p2, p3, p4, p5, p6 ); } } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Function Equality Comparison Operators /// Return whether or not this function references the same function as another function object. RIM_INLINE Bool operator == ( const Function& other ) const { if ( isMember ) return other.isMember && memberFunction->equals( *other.memberFunction ); else return !other.isMember && staticFunctionPointer == other.staticFunctionPointer; } /// Return whether or not this function references a different function as onother function object. RIM_INLINE Bool operator != ( const Function& other ) const { return !(*this == other); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Function Equality Comparison Operators /// Return whether or not this function object has a function/object pointer that is NULL. /** * If this method returns TRUE, calling the function will result in * an assertion being raised. */ RIM_INLINE Bool isNull() const { return !isMember && staticFunctionPointer == NULL; } /// Return whether or not this function object has a function/object pointer that is not NULL. /** * If this method returns FALSE, calling the function will result in * an assertion being raised. */ RIM_INLINE Bool isSet() const { return isMember || staticFunctionPointer != NULL; } private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Helper Methods template < typename SignatureType, typename ObjectType > RIM_INLINE void constructMemberFunction( SignatureType functionPointer, ObjectType* object ) { if ( object == NULL || functionPointer == NULL ) { staticFunctionPointer = NULL; isMember = false; } else { memberFunction = util::construct<internal::MemberFunction< ObjectType, SignatureType, R, T1, T2, T3, T4, T5, T6> >( functionPointer, object ); isMember = true; } } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Members /// A union which saves space when storing the static and member function pointers. union { /// A non-member function pointer to use when the function object represents a non-member function. R (*staticFunctionPointer)( T1, T2, T3, T4, T5, T6 ); /// A pointer to an object which wraps a member function when this function is a member function. internal::FunctionDefinition<R,T1,T2,T3,T4,T5,T6>* memberFunction; }; /// A boolean value indicating whether or not this function object is a member function. Bool isMember; }; template < typename R, typename T1, typename T2, typename T3, typename T4, typename T5, typename T6 > RIM_INLINE Function<R ( T1, T2, T3, T4, T5, T6 )> bind( R (*functionPointer)( T1, T2, T3, T4, T5, T6 ) ) { return Function<R ( T1, T2, T3, T4, T5, T6 )>( functionPointer ); } template < typename ObjectType, typename ObjectType2, typename R, typename T1, typename T2, typename T3, typename T4, typename T5, typename T6 > RIM_INLINE Function<R ( T1, T2, T3, T4, T5, T6 )> bind( R (ObjectType2::*functionPointer)( T1, T2, T3, T4, T5, T6 ), ObjectType* objectPointer ) { return Function<R ( T1, T2, T3, T4, T5, T6 )>( functionPointer, objectPointer ); } template < typename ObjectType, typename ObjectType2, typename R, typename T1, typename T2, typename T3, typename T4, typename T5, typename T6 > RIM_INLINE Function<R ( T1, T2, T3, T4, T5, T6 )> bind( R (ObjectType2::*functionPointer)( T1, T2, T3, T4, T5, T6 ) const, const ObjectType* objectPointer ) { return Function<R ( T1, T2, T3, T4, T5, T6 )>( functionPointer, objectPointer ); } //########################################################################################## //########################################################################################## //############ //############ Function Object With 7 Parameters Class Definition //############ //########################################################################################## //########################################################################################## /// Specialization of the function template class for a method with 7 parameters. template < typename R, typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7 > class Function< R ( T1, T2, T3, T4, T5, T6, T7 ) > { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Public Type Definitions /// The return type of this function object. typedef R ReturnType; /// The type of the first parameter of this function object. typedef T1 ParameterType1; /// The type of the second parameter of this function object. typedef T2 ParameterType2; /// The type of the third parameter of this function object. typedef T3 ParameterType3; /// The type of the fourth parameter of this function object. typedef T4 ParameterType4; /// The type of the fifth parameter of this function object. typedef T5 ParameterType5; /// The type of the sixth parameter of this function object. typedef T6 ParameterType6; /// The type of the seventh parameter of this function object. typedef T7 ParameterType7; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructors /// Create a new default function object with a NULL function pointer. /** * Calling a NULL function object will cause an assertion to be raised. * One should always check to see if the function is NULL by calling the * isNull() method before calling it. */ RIM_INLINE Function() : staticFunctionPointer( NULL ), isMember( false ) { } /// Create a new function object which wraps the specified non-member function pointer. RIM_INLINE Function( R (*functionPointer)( T1, T2, T3, T4, T5, T6, T7 ) ) : staticFunctionPointer( functionPointer ), isMember( false ) { } /// Create a new function object which wraps the specified object and member function pointer. template < typename ObjectType, typename ObjectType2 > RIM_INLINE Function( R (ObjectType2::*functionPointer)( T1, T2, T3, T4, T5, T6, T7 ), ObjectType* objectPointer ) { constructMemberFunction( functionPointer, objectPointer ); } /// Create a new function object which wraps the specified object and const member function pointer. template < typename ObjectType, typename ObjectType2 > RIM_INLINE Function( R (ObjectType2::*functionPointer)( T1, T2, T3, T4, T5, T6, T7 ) const, const ObjectType* objectPointer ) { constructMemberFunction( functionPointer, objectPointer ); } /// Create a copy of the specified function object. RIM_INLINE Function( const Function& other ) : isMember( other.isMember ) { if ( other.isMember ) memberFunction = other.memberFunction->clone(); else staticFunctionPointer = other.staticFunctionPointer; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Destructor /// Destroy this function object, releasing all internal state. RIM_INLINE ~Function() { if ( isMember ) util::destruct( memberFunction ); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Assignment Operator /// Assign the state of one function object to another. RIM_INLINE Function& operator = ( const Function& other ) { if ( this != &other ) { // Clean up the old member function if there was one. if ( isMember ) util::destruct( memberFunction ); // Copy the other function pointer. if ( isMember = other.isMember ) memberFunction = other.memberFunction->clone(); else staticFunctionPointer = other.staticFunctionPointer; } return *this; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Function Call Method /// Call this function and return its return value. /** * Calling a NULL function object will cause an assertion to be raised. * One should always check to see if the function is NULL by calling the * isNull() method before calling it. */ RIM_INLINE ReturnType operator () ( T1 p1, T2 p2, T3 p3, T4 p4, T5 p5, T6 p6, T7 p7 ) { if ( isMember ) return (*memberFunction)( p1, p2, p3, p4, p5, p6, p7 ); else { RIM_DEBUG_ASSERT_MESSAGE( staticFunctionPointer == NULL, "Cannot call NULL function object." ); return staticFunctionPointer( p1, p2, p3, p4, p5, p6, p7 ); } } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Function Equality Comparison Operators /// Return whether or not this function references the same function as another function object. RIM_INLINE Bool operator == ( const Function& other ) const { if ( isMember ) return other.isMember && memberFunction->equals( *other.memberFunction ); else return !other.isMember && staticFunctionPointer == other.staticFunctionPointer; } /// Return whether or not this function references a different function as onother function object. RIM_INLINE Bool operator != ( const Function& other ) const { return !(*this == other); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Function Equality Comparison Operators /// Return whether or not this function object has a function/object pointer that is NULL. /** * If this method returns TRUE, calling the function will result in * an assertion being raised. */ RIM_INLINE Bool isNull() const { return !isMember && staticFunctionPointer == NULL; } /// Return whether or not this function object has a function/object pointer that is not NULL. /** * If this method returns FALSE, calling the function will result in * an assertion being raised. */ RIM_INLINE Bool isSet() const { return isMember || staticFunctionPointer != NULL; } private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Helper Methods template < typename SignatureType, typename ObjectType > RIM_INLINE void constructMemberFunction( SignatureType functionPointer, ObjectType* object ) { if ( object == NULL || functionPointer == NULL ) { staticFunctionPointer = NULL; isMember = false; } else { memberFunction = util::construct<internal::MemberFunction< ObjectType, SignatureType, R, T1, T2, T3, T4, T5, T6, T7> >( functionPointer, object ); isMember = true; } } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Members /// A union which saves space when storing the static and member function pointers. union { /// A non-member function pointer to use when the function object represents a non-member function. R (*staticFunctionPointer)( T1, T2, T3, T4, T5, T6, T7 ); /// A pointer to an object which wraps a member function when this function is a member function. internal::FunctionDefinition<R,T1,T2,T3,T4,T5,T6,T7>* memberFunction; }; /// A boolean value indicating whether or not this function object is a member function. Bool isMember; }; template < typename R, typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7 > RIM_INLINE Function<R ( T1, T2, T3, T4, T5, T6, T7 )> bind( R (*functionPointer)( T1, T2, T3, T4, T5, T6, T7 ) ) { return Function<R ( T1, T2, T3, T4, T5, T6, T7 )>( functionPointer ); } template < typename ObjectType, typename ObjectType2, typename R, typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7 > RIM_INLINE Function<R ( T1, T2, T3, T4, T5, T6, T7 )> bind( R (ObjectType2::*functionPointer)( T1, T2, T3, T4, T5, T6, T7 ), ObjectType* objectPointer ) { return Function<R ( T1, T2, T3, T4, T5, T6, T7 )>( functionPointer, objectPointer ); } template < typename ObjectType, typename ObjectType2, typename R, typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7 > RIM_INLINE Function<R ( T1, T2, T3, T4, T5, T6, T7 )> bind( R (ObjectType2::*functionPointer)( T1, T2, T3, T4, T5, T6, T7 ) const, const ObjectType* objectPointer ) { return Function<R ( T1, T2, T3, T4, T5, T6, T7 )>( functionPointer, objectPointer ); } //########################################################################################## //########################################################################################## //############ //############ Function Object With 8 Parameters Class Definition //############ //########################################################################################## //########################################################################################## /// Specialization of the function template class for a method with 8 parameters. template < typename R, typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8 > class Function< R ( T1, T2, T3, T4, T5, T6, T7, T8 ) > { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Public Type Definitions /// The return type of this function object. typedef R ReturnType; /// The type of the first parameter of this function object. typedef T1 ParameterType1; /// The type of the second parameter of this function object. typedef T2 ParameterType2; /// The type of the third parameter of this function object. typedef T3 ParameterType3; /// The type of the fourth parameter of this function object. typedef T4 ParameterType4; /// The type of the fifth parameter of this function object. typedef T5 ParameterType5; /// The type of the sixth parameter of this function object. typedef T6 ParameterType6; /// The type of the seventh parameter of this function object. typedef T7 ParameterType7; /// The type of the seventh parameter of this function object. typedef T8 ParameterType8; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructors /// Create a new default function object with a NULL function pointer. /** * Calling a NULL function object will cause an assertion to be raised. * One should always check to see if the function is NULL by calling the * isNull() method before calling it. */ RIM_INLINE Function() : staticFunctionPointer( NULL ), isMember( false ) { } /// Create a new function object which wraps the specified non-member function pointer. RIM_INLINE Function( R (*functionPointer)( T1, T2, T3, T4, T5, T6, T7, T8 ) ) : staticFunctionPointer( functionPointer ), isMember( false ) { } /// Create a new function object which wraps the specified object and member function pointer. template < typename ObjectType, typename ObjectType2 > RIM_INLINE Function( R (ObjectType2::*functionPointer)( T1, T2, T3, T4, T5, T6, T7, T8 ), ObjectType* objectPointer ) { constructMemberFunction( functionPointer, objectPointer ); } /// Create a new function object which wraps the specified object and const member function pointer. template < typename ObjectType, typename ObjectType2 > RIM_INLINE Function( R (ObjectType2::*functionPointer)( T1, T2, T3, T4, T5, T6, T7, T8 ) const, const ObjectType* objectPointer ) { constructMemberFunction( functionPointer, objectPointer ); } /// Create a copy of the specified function object. RIM_INLINE Function( const Function& other ) : isMember( other.isMember ) { if ( other.isMember ) memberFunction = other.memberFunction->clone(); else staticFunctionPointer = other.staticFunctionPointer; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Destructor /// Destroy this function object, releasing all internal state. RIM_INLINE ~Function() { if ( isMember ) util::destruct( memberFunction ); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Assignment Operator /// Assign the state of one function object to another. RIM_INLINE Function& operator = ( const Function& other ) { if ( this != &other ) { // Clean up the old member function if there was one. if ( isMember ) util::destruct( memberFunction ); // Copy the other function pointer. if ( isMember = other.isMember ) memberFunction = other.memberFunction->clone(); else staticFunctionPointer = other.staticFunctionPointer; } return *this; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Function Call Method /// Call this function and return its return value. /** * Calling a NULL function object will cause an assertion to be raised. * One should always check to see if the function is NULL by calling the * isNull() method before calling it. */ RIM_INLINE ReturnType operator () ( T1 p1, T2 p2, T3 p3, T4 p4, T5 p5, T6 p6, T7 p7, T8 p8 ) { if ( isMember ) return (*memberFunction)( p1, p2, p3, p4, p5, p6, p7, p8 ); else { RIM_DEBUG_ASSERT_MESSAGE( staticFunctionPointer == NULL, "Cannot call NULL function object." ); return staticFunctionPointer( p1, p2, p3, p4, p5, p6, p7, p8 ); } } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Function Equality Comparison Operators /// Return whether or not this function references the same function as another function object. RIM_INLINE Bool operator == ( const Function& other ) const { if ( isMember ) return other.isMember && memberFunction->equals( *other.memberFunction ); else return !other.isMember && staticFunctionPointer == other.staticFunctionPointer; } /// Return whether or not this function references a different function as onother function object. RIM_INLINE Bool operator != ( const Function& other ) const { return !(*this == other); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Function Equality Comparison Operators /// Return whether or not this function object has a function/object pointer that is NULL. /** * If this method returns TRUE, calling the function will result in * an assertion being raised. */ RIM_INLINE Bool isNull() const { return !isMember && staticFunctionPointer == NULL; } /// Return whether or not this function object has a function/object pointer that is not NULL. /** * If this method returns FALSE, calling the function will result in * an assertion being raised. */ RIM_INLINE Bool isSet() const { return isMember || staticFunctionPointer != NULL; } private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Helper Methods template < typename SignatureType, typename ObjectType > RIM_INLINE void constructMemberFunction( SignatureType functionPointer, ObjectType* object ) { if ( object == NULL || functionPointer == NULL ) { staticFunctionPointer = NULL; isMember = false; } else { memberFunction = util::construct<internal::MemberFunction< ObjectType, SignatureType, R, T1, T2, T3, T4, T5, T6, T7, T8> >( functionPointer, object ); isMember = true; } } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Members /// A union which saves space when storing the static and member function pointers. union { /// A non-member function pointer to use when the function object represents a non-member function. R (*staticFunctionPointer)( T1, T2, T3, T4, T5, T6, T7, T8 ); /// A pointer to an object which wraps a member function when this function is a member function. internal::FunctionDefinition<R,T1,T2,T3,T4,T5,T6,T7,T8>* memberFunction; }; /// A boolean value indicating whether or not this function object is a member function. Bool isMember; }; template < typename R, typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8 > RIM_INLINE Function<R ( T1, T2, T3, T4, T5, T6, T7, T8 )> bind( R (*functionPointer)( T1, T2, T3, T4, T5, T6, T7, T8 ) ) { return Function<R ( T1, T2, T3, T4, T5, T6, T7, T8 )>( functionPointer ); } template < typename ObjectType, typename ObjectType2, typename R, typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8 > RIM_INLINE Function<R ( T1, T2, T3, T4, T5, T6, T7, T8 )> bind( R (ObjectType2::*functionPointer)( T1, T2, T3, T4, T5, T6, T7, T8 ), ObjectType* objectPointer ) { return Function<R ( T1, T2, T3, T4, T5, T6, T7, T8 )>( functionPointer, objectPointer ); } template < typename ObjectType, typename ObjectType2, typename R, typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8 > RIM_INLINE Function<R ( T1, T2, T3, T4, T5, T6, T7, T8 )> bind( R (ObjectType2::*functionPointer)( T1, T2, T3, T4, T5, T6, T7, T8 ) const, const ObjectType* objectPointer ) { return Function<R ( T1, T2, T3, T4, T5, T6, T7, T8 )>( functionPointer, objectPointer ); } //########################################################################################## //########################################################################################## //############ //############ Function Object With 9 Parameters Class Definition //############ //########################################################################################## //########################################################################################## /// Specialization of the function template class for a method with 8 parameters. template < typename R, typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8, typename T9 > class Function< R ( T1, T2, T3, T4, T5, T6, T7, T8, T9 ) > { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Public Type Definitions /// The return type of this function object. typedef R ReturnType; /// The type of the first parameter of this function object. typedef T1 ParameterType1; /// The type of the second parameter of this function object. typedef T2 ParameterType2; /// The type of the third parameter of this function object. typedef T3 ParameterType3; /// The type of the fourth parameter of this function object. typedef T4 ParameterType4; /// The type of the fifth parameter of this function object. typedef T5 ParameterType5; /// The type of the sixth parameter of this function object. typedef T6 ParameterType6; /// The type of the seventh parameter of this function object. typedef T7 ParameterType7; /// The type of the eighth parameter of this function object. typedef T8 ParameterType8; /// The type of the nineth parameter of this function object. typedef T9 ParameterType9; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructors /// Create a new default function object with a NULL function pointer. /** * Calling a NULL function object will cause an assertion to be raised. * One should always check to see if the function is NULL by calling the * isNull() method before calling it. */ RIM_INLINE Function() : staticFunctionPointer( NULL ), isMember( false ) { } /// Create a new function object which wraps the specified non-member function pointer. RIM_INLINE Function( R (*functionPointer)( T1, T2, T3, T4, T5, T6, T7, T8, T9 ) ) : staticFunctionPointer( functionPointer ), isMember( false ) { } /// Create a new function object which wraps the specified object and member function pointer. template < typename ObjectType, typename ObjectType2 > RIM_INLINE Function( R (ObjectType2::*functionPointer)( T1, T2, T3, T4, T5, T6, T7, T8, T9 ), ObjectType* objectPointer ) { constructMemberFunction( functionPointer, objectPointer ); } /// Create a new function object which wraps the specified object and const member function pointer. template < typename ObjectType, typename ObjectType2 > RIM_INLINE Function( R (ObjectType2::*functionPointer)( T1, T2, T3, T4, T5, T6, T7, T8, T9 ) const, const ObjectType* objectPointer ) { constructMemberFunction( functionPointer, objectPointer ); } /// Create a copy of the specified function object. RIM_INLINE Function( const Function& other ) : isMember( other.isMember ) { if ( other.isMember ) memberFunction = other.memberFunction->clone(); else staticFunctionPointer = other.staticFunctionPointer; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Destructor /// Destroy this function object, releasing all internal state. RIM_INLINE ~Function() { if ( isMember ) util::destruct( memberFunction ); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Assignment Operator /// Assign the state of one function object to another. RIM_INLINE Function& operator = ( const Function& other ) { if ( this != &other ) { // Clean up the old member function if there was one. if ( isMember ) util::destruct( memberFunction ); // Copy the other function pointer. if ( isMember = other.isMember ) memberFunction = other.memberFunction->clone(); else staticFunctionPointer = other.staticFunctionPointer; } return *this; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Function Call Method /// Call this function and return its return value. /** * Calling a NULL function object will cause an assertion to be raised. * One should always check to see if the function is NULL by calling the * isNull() method before calling it. */ RIM_INLINE ReturnType operator () ( T1 p1, T2 p2, T3 p3, T4 p4, T5 p5, T6 p6, T7 p7, T8 p8, T9 p9 ) { if ( isMember ) return (*memberFunction)( p1, p2, p3, p4, p5, p6, p7, p8, p9 ); else { RIM_DEBUG_ASSERT_MESSAGE( staticFunctionPointer == NULL, "Cannot call NULL function object." ); return staticFunctionPointer( p1, p2, p3, p4, p5, p6, p7, p8, p9 ); } } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Function Equality Comparison Operators /// Return whether or not this function references the same function as another function object. RIM_INLINE Bool operator == ( const Function& other ) const { if ( isMember ) return other.isMember && memberFunction->equals( *other.memberFunction ); else return !other.isMember && staticFunctionPointer == other.staticFunctionPointer; } /// Return whether or not this function references a different function as onother function object. RIM_INLINE Bool operator != ( const Function& other ) const { return !(*this == other); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Function Equality Comparison Operators /// Return whether or not this function object has a function/object pointer that is NULL. /** * If this method returns TRUE, calling the function will result in * an assertion being raised. */ RIM_INLINE Bool isNull() const { return !isMember && staticFunctionPointer == NULL; } /// Return whether or not this function object has a function/object pointer that is not NULL. /** * If this method returns FALSE, calling the function will result in * an assertion being raised. */ RIM_INLINE Bool isSet() const { return isMember || staticFunctionPointer != NULL; } private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Helper Methods template < typename SignatureType, typename ObjectType > RIM_INLINE void constructMemberFunction( SignatureType functionPointer, ObjectType* object ) { if ( object == NULL || functionPointer == NULL ) { staticFunctionPointer = NULL; isMember = false; } else { memberFunction = util::construct<internal::MemberFunction< ObjectType, SignatureType, R, T1, T2, T3, T4, T5, T6, T7, T8, T9> >( functionPointer, object ); isMember = true; } } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Members /// A union which saves space when storing the static and member function pointers. union { /// A non-member function pointer to use when the function object represents a non-member function. R (*staticFunctionPointer)( T1, T2, T3, T4, T5, T6, T7, T8, T9 ); /// A pointer to an object which wraps a member function when this function is a member function. internal::FunctionDefinition<R,T1,T2,T3,T4,T5,T6,T7,T8,T9>* memberFunction; }; /// A boolean value indicating whether or not this function object is a member function. Bool isMember; }; template < typename R, typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8, typename T9 > RIM_INLINE Function<R ( T1, T2, T3, T4, T5, T6, T7, T8, T9 )> bind( R (*functionPointer)( T1, T2, T3, T4, T5, T6, T7, T8, T9 ) ) { return Function<R ( T1, T2, T3, T4, T5, T6, T7, T8, T9 )>( functionPointer ); } template < typename ObjectType, typename ObjectType2, typename R, typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8, typename T9 > RIM_INLINE Function<R ( T1, T2, T3, T4, T5, T6, T7, T8, T9 )> bind( R (ObjectType2::*functionPointer)( T1, T2, T3, T4, T5, T6, T7, T8, T9 ), ObjectType* objectPointer ) { return Function<R ( T1, T2, T3, T4, T5, T6, T7, T8, T9 )>( functionPointer, objectPointer ); } template < typename ObjectType, typename ObjectType2, typename R, typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8, typename T9 > RIM_INLINE Function<R ( T1, T2, T3, T4, T5, T6, T7, T8, T9 )> bind( R (ObjectType2::*functionPointer)( T1, T2, T3, T4, T5, T6, T7, T8, T9 ) const, const ObjectType* objectPointer ) { return Function<R ( T1, T2, T3, T4, T5, T6, T7, T8, T9 )>( functionPointer, objectPointer ); } //########################################################################################## //########################################################################################## //############ //############ Function Object With 10 Parameters Class Definition //############ //########################################################################################## //########################################################################################## /// Specialization of the function template class for a method with 10 parameters. template < typename R, typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8, typename T9, typename T10 > class Function< R ( T1, T2, T3, T4, T5, T6, T7, T8, T9, T10 ) > { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Public Type Definitions /// The return type of this function object. typedef R ReturnType; /// The type of the first parameter of this function object. typedef T1 ParameterType1; /// The type of the second parameter of this function object. typedef T2 ParameterType2; /// The type of the third parameter of this function object. typedef T3 ParameterType3; /// The type of the fourth parameter of this function object. typedef T4 ParameterType4; /// The type of the fifth parameter of this function object. typedef T5 ParameterType5; /// The type of the sixth parameter of this function object. typedef T6 ParameterType6; /// The type of the seventh parameter of this function object. typedef T7 ParameterType7; /// The type of the eighth parameter of this function object. typedef T8 ParameterType8; /// The type of the nineth parameter of this function object. typedef T9 ParameterType9; /// The type of the tenth parameter of this function object. typedef T10 ParameterType10; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructors /// Create a new default function object with a NULL function pointer. /** * Calling a NULL function object will cause an assertion to be raised. * One should always check to see if the function is NULL by calling the * isNull() method before calling it. */ RIM_INLINE Function() : staticFunctionPointer( NULL ), isMember( false ) { } /// Create a new function object which wraps the specified non-member function pointer. RIM_INLINE Function( R (*functionPointer)( T1, T2, T3, T4, T5, T6, T7, T8, T9, T10 ) ) : staticFunctionPointer( functionPointer ), isMember( false ) { } /// Create a new function object which wraps the specified object and member function pointer. template < typename ObjectType, typename ObjectType2 > RIM_INLINE Function( R (ObjectType2::*functionPointer)( T1, T2, T3, T4, T5, T6, T7, T8, T9, T10 ), ObjectType* objectPointer ) { constructMemberFunction( functionPointer, objectPointer ); } /// Create a new function object which wraps the specified object and const member function pointer. template < typename ObjectType, typename ObjectType2 > RIM_INLINE Function( R (ObjectType2::*functionPointer)( T1, T2, T3, T4, T5, T6, T7, T8, T9, T10 ) const, const ObjectType* objectPointer ) { constructMemberFunction( functionPointer, objectPointer ); } /// Create a copy of the specified function object. RIM_INLINE Function( const Function& other ) : isMember( other.isMember ) { if ( other.isMember ) memberFunction = other.memberFunction->clone(); else staticFunctionPointer = other.staticFunctionPointer; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Destructor /// Destroy this function object, releasing all internal state. RIM_INLINE ~Function() { if ( isMember ) util::destruct( memberFunction ); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Assignment Operator /// Assign the state of one function object to another. RIM_INLINE Function& operator = ( const Function& other ) { if ( this != &other ) { // Clean up the old member function if there was one. if ( isMember ) util::destruct( memberFunction ); // Copy the other function pointer. if ( isMember = other.isMember ) memberFunction = other.memberFunction->clone(); else staticFunctionPointer = other.staticFunctionPointer; } return *this; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Function Call Method /// Call this function and return its return value. /** * Calling a NULL function object will cause an assertion to be raised. * One should always check to see if the function is NULL by calling the * isNull() method before calling it. */ RIM_INLINE ReturnType operator () ( T1 p1, T2 p2, T3 p3, T4 p4, T5 p5, T6 p6, T7 p7, T8 p8, T9 p9, T10 p10 ) { if ( isMember ) return (*memberFunction)( p1, p2, p3, p4, p5, p6, p7, p8, p9, p10 ); else { RIM_DEBUG_ASSERT_MESSAGE( staticFunctionPointer == NULL, "Cannot call NULL function object." ); return staticFunctionPointer( p1, p2, p3, p4, p5, p6, p7, p8, p9, p10 ); } } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Function Equality Comparison Operators /// Return whether or not this function references the same function as another function object. RIM_INLINE Bool operator == ( const Function& other ) const { if ( isMember ) return other.isMember && memberFunction->equals( *other.memberFunction ); else return !other.isMember && staticFunctionPointer == other.staticFunctionPointer; } /// Return whether or not this function references a different function as onother function object. RIM_INLINE Bool operator != ( const Function& other ) const { return !(*this == other); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Function Equality Comparison Operators /// Return whether or not this function object has a function/object pointer that is NULL. /** * If this method returns TRUE, calling the function will result in * an assertion being raised. */ RIM_INLINE Bool isNull() const { return !isMember && staticFunctionPointer == NULL; } /// Return whether or not this function object has a function/object pointer that is not NULL. /** * If this method returns FALSE, calling the function will result in * an assertion being raised. */ RIM_INLINE Bool isSet() const { return isMember || staticFunctionPointer != NULL; } private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Helper Methods template < typename SignatureType, typename ObjectType > RIM_INLINE void constructMemberFunction( SignatureType functionPointer, ObjectType* object ) { if ( object == NULL || functionPointer == NULL ) { staticFunctionPointer = NULL; isMember = false; } else { memberFunction = util::construct<internal::MemberFunction< ObjectType, SignatureType, R, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10> >( functionPointer, object ); isMember = true; } } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Members /// A union which saves space when storing the static and member function pointers. union { /// A non-member function pointer to use when the function object represents a non-member function. R (*staticFunctionPointer)( T1, T2, T3, T4, T5, T6, T7, T8, T9, T10 ); /// A pointer to an object which wraps a member function when this function is a member function. internal::FunctionDefinition<R,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10>* memberFunction; }; /// A boolean value indicating whether or not this function object is a member function. Bool isMember; }; template < typename R, typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8, typename T9, typename T10 > RIM_INLINE Function<R ( T1, T2, T3, T4, T5, T6, T7, T8, T9, T10 )> bind( R (*functionPointer)( T1, T2, T3, T4, T5, T6, T7, T8, T9, T10 ) ) { return Function<R ( T1, T2, T3, T4, T5, T6, T7, T8, T9, T10 )>( functionPointer ); } template < typename ObjectType, typename ObjectType2, typename R, typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8, typename T9, typename T10 > RIM_INLINE Function<R ( T1, T2, T3, T4, T5, T6, T7, T8, T9, T10 )> bind( R (ObjectType2::*functionPointer)( T1, T2, T3, T4, T5, T6, T7, T8, T9, T10 ), ObjectType* objectPointer ) { return Function<R ( T1, T2, T3, T4, T5, T6, T7, T8, T9, T10 )>( functionPointer, objectPointer ); } template < typename ObjectType, typename ObjectType2, typename R, typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8, typename T9, typename T10 > RIM_INLINE Function<R ( T1, T2, T3, T4, T5, T6, T7, T8, T9, T10 )> bind( R (ObjectType2::*functionPointer)( T1, T2, T3, T4, T5, T6, T7, T8, T9, T10 ) const, const ObjectType* objectPointer ) { return Function<R ( T1, T2, T3, T4, T5, T6, T7, T8, T9, T10 )>( functionPointer, objectPointer ); } //########################################################################################## //*************************** End Rim Language Namespace ********************************* RIM_LANGUAGE_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_FUNCTION_H <file_sep>/* * rimGraphicsHardwareBuffer.h * Rim Graphics * * Created by <NAME> on 11/29/09. * Copyright 2009 Rim Software. All rights reserved. * */ #ifndef INCLUDE_RIM_GRAPHICS_HARDWARE_BUFFER_H #define INCLUDE_RIM_GRAPHICS_HARDWARE_BUFFER_H #include "rimGraphicsBuffersConfig.h" #include "rimGraphicsGenericBuffer.h" #include "rimGraphicsHardwareBufferAccessType.h" #include "rimGraphicsHardwareBufferUsage.h" #include "rimGraphicsHardwareBufferType.h" //########################################################################################## //*********************** Start Rim Graphics Buffers Namespace *************************** RIM_GRAPHICS_BUFFERS_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class which represents a buffer of shader attributes stored in GPU memory. /** * This class allows attribute data to be stored in the graphics card's RAM for * faster access. It is analogous to the Texture class which performs the same * function but for pixel data. */ class HardwareBuffer : public ContextObject { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Buffer Capacity Accessor Methods /// Return the total number of elements of this buffer's current attribute type that it can hold. RIM_INLINE Size getCapacity() const { Size attributeSizeInBytes = attributeType.getSizeInBytes(); if ( attributeSizeInBytes != 0 ) return capacityInBytes / attributeSizeInBytes; else return capacityInBytes; } /// Set the number of elements of this buffer's current attribute type that this buffer is able to hold. /** * This method invalidates any contents of the buffer and reallocates the buffer's * data store to have the specified capacity. * * If the method fails (i.e. capacity too big), the method returns FALSE. Otherwise, * the method returns TRUE indicating that the buffer was successfully resized. */ Bool setCapacity( Size newCapacity ); /// Return the capacity of the hardware attribute buffer in bytes. RIM_INLINE Size getCapacityInBytes() const { return capacityInBytes; } /// Set the number of bytes that this buffer is able to hold. /** * This method invalidates any contents of the buffer and reallocates the buffer's * data store to have the specified capacity. * * If the method fails (i.e. capacity too big), the method returns FALSE. Otherwise, * the method returns TRUE indicating that the buffer was successfully resized. */ virtual Bool setCapacityInBytes( Size newCapacityInBytes ); /// Return whether or not this buffer has been initialized with any attribute data or a capacity. RIM_INLINE Bool hasData() const { return capacityInBytes > 0; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Buffer Nominal Size Accessor Methods /// Return the number of valid attributes that this buffer has. /** * The number returned is independent of the buffer's capacity but must * be less than or equal to the return value of getCapacity(). It indicates * a user-defined 'size' of the buffer that may be different than the * buffer's actual capacity. This allows the user to encode the number of * valid attributes into the buffer itself. */ RIM_INLINE Size getNominalSize() const { return nominalSize; } /// Set the nominal size of this hardware buffer /** * This number is clamped to be less than the buffer's capacity. * It indicates a user-defined 'size' of the buffer that may be different than the * buffer's actual capacity. This allows the user to encode the number of * valid attributes into the buffer itself. */ RIM_INLINE void setNominalSize( Size newNominalSize ) { nominalSize = math::min( newNominalSize, this->getCapacity() ); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Attribute Type Accessor Methods /// Return the type of elements that this hardware attribute buffer can hold. RIM_INLINE const AttributeType& getAttributeType() const { return attributeType; } /// Set the type of elements that this hardware attribute buffer can hold. /** * This method will not alter the contents of the buffer but it changes * how they will be interpreted. The old attribute type is replaced * but the capacity and contents are unchanged. * * The method returns whether or not the attribute type was able to be changed. * A return value of FALSE means that the specified attribute type was * incompatible with this buffer. */ virtual Bool setAttributeType( const AttributeType& newAttributeType ); //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Attribute Accessor Methods /// Read the specified number of attributes from the hardware buffer into the specified output pointer. /** * If the method succeeds, it reads the specified number of attributes from the buffer * and writes them to the specified attribute pointer and returns TRUE. The number of * attributes read from the buffer is written to the output numAttributes reference. * If the method fails, FALSE is returned. * * The attribute pointer should be allocated with enough room to hold that many attributes * of the buffer's type. */ virtual Bool getAttributes( void* attributes, Size& numAttributes ) const = 0; /// Read all of the attributes from the hardware buffer into the specified output buffer. /** * If the method succeeds, it reads all of the attributes from the buffer * and writes them to the specified attribute buffer and returns TRUE. The method replaces * any data that was previously in the opaque buffer. * * The attribute pointer should be allocated with enough room to hold that many attributes * of the buffer's type. */ Bool getAttributes( GenericBuffer& attributes ) const; /// Read the specified number of attributes from the hardware buffer into the specified output buffer. /** * If the method succeeds, it reads the specified number of attributes from the buffer * and writes them to the specified attribute buffer and returns TRUE. The method replaces * any data that was previously in the opaque buffer. The number of * attributes read from the buffer is written to the output numAttributes reference. * * The attribute pointer should be allocated with enough room to hold that many attributes * of the buffer's type. */ Bool getAttributes( GenericBuffer& attributes, Size& numAttributes ) const; /// Replace the contents of this hardware attribute buffer with the specified attributes. /** * This method replaces the current contents of the buffer (reallocating the buffer * if necessary), and sets this buffer to have the same attribute type as the given buffer. * * This variant allows the user to modify the usage type of the buffer's data store. * * If the method fails (i.e. if the buffer's attribute type is incompatible with this * buffer), FALSE is returned the buffer is unchanged. If the method succeeds, TRUE * is returned. */ virtual Bool setAttributes( const void* attributes, const AttributeType& attributeType, Size numAttributes, HardwareBufferUsage newUsage = HardwareBufferUsage::STATIC ) = 0; /// Replace the contents of this hardware attribute buffer with the specified attributes. /** * This method replaces the current contents of the buffer (reallocating the buffer * if necessary), and sets this buffer to have the same attribute type as the given buffer. * * If the method fails (i.e. if the buffer's attribute type is incompatible with this * buffer), FALSE is returned the buffer is unchanged. If the method succeeds, TRUE * is returned. */ RIM_INLINE Bool setAttributes( const GenericBuffer& attributes, HardwareBufferUsage newUsage = HardwareBufferUsage::STATIC ) { return this->setAttributes( attributes.getPointer(), attributes.getAttributeType(), attributes.getSize(), newUsage ); } /// Update a region of this hardware attribute buffer with the specified attributes. /** * This method updates the current contents of the buffer, starting at the specified * attribute start index within the buffer. * * If the method fails (i.e. if the buffer's attribute type is incompatible with this * buffer), FALSE is returned the buffer is unchanged. If the method succeeds, TRUE * is returned. */ virtual Bool updateAttributes( const void* attributes, const AttributeType& attributeType, Size numAttributes, Index startIndex = 0 ) = 0; /// Update a region of this hardware attribute buffer with the specified attributes. /** * This method updates the current contents of the buffer, starting at the specified * attribute start index within the buffer. * * If the method fails (i.e. if the buffer's attribute type is incompatible with this * buffer), FALSE is returned the buffer is unchanged. If the method succeeds, TRUE * is returned. */ RIM_INLINE Bool updateAttributes( const GenericBuffer& attributes, Index startIndex ) { return this->updateAttributes( attributes.getPointer(), attributes.getAttributeType(), attributes.getSize(), startIndex ); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Buffer Reallocation Method /// Reallocate this buffer's data store using its current capacity. /** * This method allows the user to get a new data store for the buffer, * releasing the previous data store. This is useful if you are using * a memory-mapped buffer to transfer vertices to the GPU. By releasing * the buffer before mapping it, you signal that you don't need the old * buffer anymore, avoiding synchronization stalls. * * The resulting contents of the buffer are undefined. */ virtual Bool reallocate() = 0; /// Reallocate this buffer's data store using its current capacity, changing its usage type. /** * This method allows the user to get a new data store for the buffer, * releasing the previous data store. This is useful if you are using * a memory-mapped buffer to transfer vertices to the GPU. By releasing * the buffer before mapping it, you signal that you don't need the old * buffer anymore, avoiding synchronization stalls. * * The resulting contents of the buffer are undefined. * * This variant allows the user to change the usage of the buffer when it is * reallocated. */ virtual Bool reallocate( HardwareBufferUsage newUsage ) = 0; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Buffer Mapping Methods /// Map this buffer's data store to the main memory address space and return a pointer to it. /** * The method returns NULL if the buffer is unable to be mapped with the * given access type. The method allows the user to specify an offset within * the buffer which is applied to the returned pointer, in units of the attribute type width. * * This method is called by HardwareBufferIterator when an object * of that class is constructed. */ virtual void* mapBuffer( HardwareBufferAccessType accessType, Index startIndex = 0 ) = 0; /// Unmap this buffer's data store to the main memory address space. /** * This method is called by HardwareBufferIterator when an object * of that class is destroyed. */ virtual void unmapBuffer() const = 0; /// Return whether or not this attribute buffer is currently mapped to main memory. /** * If this method returns TRUE, it means that a HardwareBufferIterator is * probably iterating over the buffer. The buffer cannot be used for any drawing * until the iterator object is destroyed, causing the buffer's data to be unmapped * from main memory. */ virtual Bool isMapped() const = 0; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Hardware Attribute Buffer Type Accessor Methods /// Get the current expected usage pattern for this hardware attribute buffer. /** * The usage type can be changed any time the buffer's contents are reallocated. */ virtual HardwareBufferUsage getUsage() const = 0; //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Hardware Attribute Buffer Type Accessor Methods /// Return an object representing the semantic type of this hardware buffer. RIM_INLINE const HardwareBufferType& getType() const { return bufferType; } protected: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Protected Constructor /// Create a hardware attribute buffer for the specified context with the given buffer type. RIM_INLINE HardwareBuffer( const devices::GraphicsContext* context, HardwareBufferType newBufferType ) : ContextObject( context ), bufferType( newBufferType ), attributeType( AttributeType::UNDEFINED ), capacityInBytes( 0 ), nominalSize( 0 ) { } private: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Private Data Members /// An enum value which is set by subclasses that determines the kind of hardware attribute buffer this is. /** * This can be used to specify that a buffer is a vertex attribute buffer * or an index buffer or some other kind of buffer. These buffers types allow * different kinds of attributes to be stored in them. */ HardwareBufferType bufferType; /// An object which indicates the kind of attribute data stored in this buffer. AttributeType attributeType; /// The total capacity of this buffer's data store in bytes. Size capacityInBytes; /// The nominal size of the hardware buffer which can be used to indicate how many buffer elements are valid. Size nominalSize; }; //########################################################################################## //*********************** End Rim Graphics Buffers Namespace ***************************** RIM_GRAPHICS_BUFFERS_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_GRAPHICS_HARDWARE_BUFFER_H <file_sep>/* * rimPlane3D.h * Rim Math * * Created by <NAME> on 10/12/10. * Copyright 2010 Rim Software. All rights reserved. * */ #ifndef INCLUDE_RIM_PLANE_3D_H #define INCLUDE_RIM_PLANE_3D_H #include "rimMathConfig.h" #include "rimVector3D.h" //########################################################################################## //***************************** Start Rim Math Namespace ********************************* RIM_MATH_NAMESPACE_START //****************************************************************************************** //########################################################################################## //******************************************************************************** //******************************************************************************** //******************************************************************************** /// A class which represents a plane in 3D space. /** * It uses the normal and offset plane representation as it is the most universally * useful in computational mathematics, especially relating to graphics and geometry. */ template < typename T > class Plane3D { public: //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Constructors /// Create a plane in 3D space with the normal pointing along the positive Z axis with offset = 0. RIM_FORCE_INLINE Plane3D() : normal( 0, 0, 1 ), offset( 0 ) { } /// Create a plane in 3D space with the specified normal and offset from the origin. RIM_FORCE_INLINE Plane3D( const Vector3D<T>& planeNormal, T planeOffset ) : normal( planeNormal ), offset( planeOffset ) { } /// Create a plane in 3D space from the specified normal and point on the plane. RIM_FORCE_INLINE Plane3D( const Vector3D<T>& planeNormal, const Vector3D<T>& pointOnPlane ) : normal( planeNormal ), offset( -math::dot( pointOnPlane, normal ) ) { } /// Create a plane in 3D space from three points in that plane. RIM_FORCE_INLINE Plane3D( const Vector3D<T>& p1, const Vector3D<T>& p2, const Vector3D<T>& p3 ) : normal( math::cross( p2 - p1, p3 - p1 ).normalize() ) { offset = -math::dot( p1, normal ); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Point Distance Methods /// Get the perpendicular distance from the specified point to the plane. RIM_FORCE_INLINE T getDistanceTo( const Vector3D<T>& point ) const { return math::abs( math::dot( normal, point ) + offset ); } /// Get the perpendicular distance from the specified point to the plane. RIM_FORCE_INLINE T getSignedDistanceTo( const Vector3D<T>& point ) const { return math::dot( normal, point ) + offset; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Point Projection Methods /// Return the projection of the given point onto the plane. RIM_FORCE_INLINE Vector3D<T> getProjection( const Vector3D<T>& point ) const { T t = getSignedDistanceTo(point) / math::dot( normal, normal ); return point - t*normal; } /// Return the projection of the given point onto the plane. /** * The plane is assumed to have a normal vector of unit length. This * results in a significantly faster function, however the results are * meaningless if the precondition is not met. */ RIM_FORCE_INLINE Vector3D<T> getProjectionNormalized( const Vector3D<T>& point ) const { return point - getSignedDistanceTo(point)*normal; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Vector Projection Methods /// Return the projection of the given point onto the plane. RIM_FORCE_INLINE Vector3D<T> getVectorProjection( const Vector3D<T>& vector ) const { T t = math::dot(vector,normal) / math::dot( normal, normal ); return vector - t*normal; } /// Return the projection of the given point onto the plane. /** * The plane is assumed to have a normal vector of unit length. This * results in a significantly faster function, however the results are * meaningless if the precondition is not met. */ RIM_FORCE_INLINE Vector3D<T> getVectorProjectionNormalized( const Vector3D<T>& vector ) const { return vector - math::dot(vector,normal)*normal; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Point Reflection Methods /// Get the reflection of a point over the plane. RIM_FORCE_INLINE Vector3D<T> getReflection( const Vector3D<T>& point ) const { T t = getSignedDistanceTo(point) / math::dot( normal, normal ); return point - T(2)*t*normal; } /// Get the reflection of a point over the plane. /** * The plane is assumed to have a normal vector of unit length. This * results in a significantly faster function, however the results are * meaningless if the precondition is not met. */ RIM_FORCE_INLINE Vector3D<T> getReflectionNormalized( const Vector3D<T>& point ) const { return point - T(2)*getSignedDistanceTo(point)*normal; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Vector Reflection Methods /// Return the specular reflection of a vector off the plane. RIM_FORCE_INLINE Vector3D<T> getVectorReflection( const Vector3D<T>& vector ) const { T t = math::dot(vector,normal) / math::dot( normal, normal ); return vector - T(2)*t*normal; } /// Return the specular reflection of a vector off the plane, if the plane has a unit normal vector. /** * The plane is assumed to have a normal vector of unit length. This * results in a significantly faster function, however the results are * meaningless if the precondition is not met. */ RIM_FORCE_INLINE Vector3D<T> getVectorReflectionNormalized( const Vector3D<T>& vector ) const { return vector - T(2)*math::dot(vector,normal)*normal; } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Plane Normalization Method /// Normalize the plane's normal vector and correct the offset to match. RIM_FORCE_INLINE Plane3D normalize() const { T inverseMagnitude = T(1)/normal.getMagnitude(); return Plane3D( normal*inverseMagnitude, offset*inverseMagnitude ); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Plane Inversion Operator /// Return the plane with the opposite normal vector and offset. /** * This plane is mathematically the same as the original plane. */ RIM_FORCE_INLINE Plane3D operator - () const { return Plane3D( -normal, -offset ); } //******************************************************************************** //******************************************************************************** //******************************************************************************** //****** Public Data Members /// A vector perpendicular to the plane. Vector3D<T> normal; /// The distance that the plane is offset from the origin. T offset; }; //########################################################################################## //########################################################################################## //############ //############ 3D Plane Type Definitions //############ //########################################################################################## //########################################################################################## typedef Plane3D<int> Plane3i; typedef Plane3D<float> Plane3f; typedef Plane3D<double> Plane3d; //########################################################################################## //***************************** End Rim Math Namespace *********************************** RIM_MATH_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_PLANE_3D_H <file_sep>/* * RimConfig.h * Rim Framework * * Created by <NAME> on 2/6/11. * Copyright 2011 Rim Software. All rights reserved. * */ #ifndef INCLUDE_RIM_CONFIG_H #define INCLUDE_RIM_CONFIG_H #include <cstddef> #include <cstdlib> #include <cstdio> #include <cstring> //########################################################################################## //########################################################################################## //############ //############ Library Debugging Configuration //############ //########################################################################################## //########################################################################################## #ifndef RIM_DEBUG #if defined(_DEBUG) /// Define whether or not internal debugging checks should be force-enabled. #define RIM_DEBUG #endif #endif //########################################################################################## //########################################################################################## //############ //############ Library Configuration //############ //########################################################################################## //########################################################################################## /// Define whether or not to turn off all assertion (including assertions active during release-mode builds). #ifndef RIM_DISABLE_ASSERTIONS #define RIM_DISABLE_ASSERTIONS 0 #endif /// Define the function to use for all library memory allocations. #ifndef RIM_MALLOC #define RIM_MALLOC(X) (std::malloc(X)) #endif /// Define the function to use for all library memory deallocations. #ifndef RIM_FREE #define RIM_FREE(X) (std::free(X)) #endif /// Define a macro that converts its argument to its literal string representation. #ifndef RIM_STRINGIFY #ifndef RIM_STRINGIFIY_WRAPPER #define RIM_STRINGIFIY_WRAPPER( x ) #x #endif #define RIM_STRINGIFY( x ) (RIM_STRINGIFIY_WRAPPER(x)) #endif //########################################################################################## //########################################################################################## //############ //############ Library Platform Configuration //############ //########################################################################################## //########################################################################################## #ifdef __APPLE__ #define RIM_PLATFORM_APPLE #endif #if defined(_WIN32) || defined(__WIN32__) #define RIM_PLATFORM_WIN32 #endif #if defined(_WIN64) #define RIM_PLATFORM_WIN64 #endif #if defined(RIM_PLATFORM_WIN32) || defined(RIM_PLATFORM_WIN64) || defined(__WINDOWS__) #define RIM_PLATFORM_WINDOWS #endif #if defined( __GNUC__ ) #define RIM_COMPILER_GCC __GNUC__ #define RIM_COMPILER RIM_COMPILER_GCC #define RIM_GCC_VERSION( Major, Minor ) (Major*10000 + Minor*100 ) #define RIM_COMPILER_VERSION RIM_GCC_VERSION( __GNUC__, __GNUC_MINOR__ ) #elif defined( _MSC_VER ) #define RIM_COMPILER_MSVC _MSC_VER #define RIM_COMPILER RIM_COMPILER_MSVC #define RIM_COMPILER_VERSION _MSC_VER #else #error Unsupported compiler. #endif #if defined( RIM_COMPILER_GCC ) #ifdef RIM_DEBUG #define RIM_INLINE inline #define RIM_FORCE_INLINE inline #else #define RIM_INLINE inline #define RIM_FORCE_INLINE __attribute__((__always_inline__)) inline #endif #define RIM_NO_INLINE __attribute__((noinline)) #define RIM_EXPORT __attribute__((visibility("default"))) #define RIM_ALIGN(alignment) __attribute__((aligned(alignment))) #if defined(RIM_PLATFORM_APPLE) #if !defined(__MAC_10_6) #define RIM_ALIGNED_MALLOC( size, alignment ) (RIM_MALLOC( size )) #else namespace rim { namespace util { RIM_FORCE_INLINE void* posix_memalign_wrapper( size_t size, size_t alignment ) { void* pointer; posix_memalign( &pointer, alignment, size ); return pointer; } }; }; #include <malloc/malloc.h> #define RIM_ALIGNED_MALLOC( size, alignment ) (posix_memalign_wrapper( size, alignment )) #endif #else #define RIM_ALIGNED_MALLOC( size, alignment ) (RIM_MALLOC( size )) #endif #define RIM_ALIGNED_FREE(X) (std::free(X)) #define RIM_DEPRECATED __attribute__((deprecated)) #if __LP64__ #define RIM_PLATFORM_64_BIT #else #define RIM_PLATFORM_32_BIT #endif #elif defined( RIM_COMPILER_MSVC ) #include <malloc.h> #ifdef RIM_DEBUG #define RIM_INLINE inline #define RIM_FORCE_INLINE inline #else #if RIM_COMPILER_VERSION >= 1200 #define RIM_INLINE inline #define RIM_FORCE_INLINE __forceinline #else #define RIM_INLINE inline #define RIM_FORCE_INLINE inline #endif #endif #define RIM_NO_INLINE __declspec(noinline) #define RIM_EXPORT __declspec(dllexport) #define RIM_ALIGN(alignment) __declspec(align(alignment)) #define RIM_ALIGNED_MALLOC( size, alignment ) (_aligned_malloc( size, alignment )) #define RIM_ALIGNED_FREE(X) (_aligned_free(X)) #define RIM_DEPRECATED __declspec(deprecated) #if defined(_WIN64) #define RIM_PLATFORM_64_BIT #else #define RIM_PLATFORM_32_BIT #endif #else /// Define the inlining procedure to use for methods that should be inlined. #define RIM_INLINE inline #define RIM_FORCE_INLINE inline #define RIM_NO_INLINE /// Define the alignment declaration to be use when aligning structure/class members. #define RIM_ALIGN(alignment) #define RIM_EXPORT /// Define the function to use when allocating aligned blocks of memory. #define RIM_ALIGNED_MALLOC( size, alignment ) (RIM_MALLOC(size)) /// Define the function to use when freeing an aligned block of memory. #define RIM_ALIGNED_FREE(X) (RIM_FREE(X)) /// Define the marker which is used when defining methods, types, and variables as deprecated. #define RIM_DEPRECATED #endif #if defined(_M_PPC) || defined(__ppc__) || defined(__POWERPC__) #define RIM_CPU_POWER_PC #elif defined(_M_X64) || defined(_M_IX86) || defined(__x86_64__) || defined(__i386__) #define RIM_CPU_INTEL #else #error Unsupported CPU type. #endif //########################################################################################## //########################################################################################## //############ //############ Library Assertion Configuration //############ //########################################################################################## //########################################################################################## #if !RIM_DISABLE_ASSERTIONS // Define the assertion to use in only debug builds. #ifdef RIM_DEBUG // Make sure that debugging is enabled. #ifdef NDEBUG #undef NDEBUG #include <assert.h> #define RIM_DEBUG_ASSERT(X) assert(X) #define RIM_DEBUG_ASSERT_MESSAGE(X, MESSAGE) { ( X ? 0 : std::printf("%s\n",MESSAGE)); assert(X); } #define RIM_DEBUG_ASSERT_MESSAGE_CODE(X, MESSAGE, CODE) { ( X ? 0 : \ std::printf("%s\nError Code: %X\n",MESSAGE,(int)CODE)); assert(X); } #define NDEBUG #else #include <assert.h> #define RIM_DEBUG_ASSERT(X) assert(X) #define RIM_DEBUG_ASSERT_MESSAGE(X, MESSAGE) { ( X ? 0 : std::printf("%s\n",MESSAGE)); assert(X); } #define RIM_DEBUG_ASSERT_MESSAGE_CODE(X, MESSAGE, CODE) { ( X ? 0 : \ std::printf("%s\nError Code: %X\n",MESSAGE,(int)CODE)); assert(X); } #endif #else #define RIM_DEBUG_ASSERT(X) ((void)0) #define RIM_DEBUG_ASSERT_MESSAGE(X, MESSAGE) ((void)0) #endif // Define the assertion to use for release builds. #ifdef NDEBUG #undef NDEBUG #include <assert.h> #define RIM_ASSERT(X) assert(X) #define RIM_ASSERT_MESSAGE(X, MESSAGE) { ( X ? 0 : std::printf("%s\n",MESSAGE)); assert(X); } #define RIM_ASSERT_MESSAGE_CODE(X, MESSAGE, CODE) { ( X ? 0 : \ std::printf("%s\nError Code: %X\n",MESSAGE,(int)CODE)); assert(X); } #define NDEBUG #else #include <assert.h> #define RIM_ASSERT(X) assert(X) #define RIM_ASSERT_MESSAGE(X, MESSAGE) { ( X ? 0 : std::printf("%s\n",MESSAGE)); assert(X); } #define RIM_ASSERT_MESSAGE_CODE(X, MESSAGE, CODE) { ( X ? 0 : \ std::printf("%s\nError Code: %X\n",MESSAGE,(int)CODE)); assert(X); } #endif #else // Define dummy assertion macros if assertions are disabled. #define RIM_ASSERT(X) ((void)0) #define RIM_ASSERT_MESSAGE(X, MESSAGE) ((void)0) #define RIM_ASSERT_MESSAGE_CODE(X, MESSAGE, CODE) ((void)0) #define RIM_DEBUG_ASSERT(X) ((void)0) #define RIM_DEBUG_ASSERT_MESSAGE(X, MESSAGE) ((void)0) #endif //########################################################################################## //########################################################################################## //############ //############ Library Endian-ness Configuration //############ //########################################################################################## //########################################################################################## #if defined(__hppa__) || \ defined(__m68k__) || defined(mc68000) || defined(_M_M68K) || \ (defined(__MIPS__) && defined(__MISPEB__)) || \ defined(__ppc__) || defined(__POWERPC__) || defined(_M_PPC) || \ defined(__sparc__) #define RIM_BIG_ENDIAN #else #define RIM_LITTLE_ENDIAN #endif //########################################################################################## //########################################################################################## //############ //############ Library Namespace Configuration //############ //########################################################################################## //########################################################################################## /// Define the name of the main rim library namespace. #ifndef RIM_NAMESPACE #define RIM_NAMESPACE rim #endif /// Define a macro used to start the rim namespace. #ifndef RIM_NAMESPACE_START #define RIM_NAMESPACE_START namespace RIM_NAMESPACE { #endif /// Define a macro used to end the rim namespace. #ifndef RIM_NAMESPACE_END #define RIM_NAMESPACE_END }; #endif /// The enclosing namespace for the entire Rim library. RIM_NAMESPACE_START RIM_NAMESPACE_END //########################################################################################## //****************************** Start Rim Namespace ********************************** RIM_NAMESPACE_START //****************************************************************************************** //########################################################################################## //########################################################################################## //########################################################################################## //############ //############ Define NULL (if not already avalible) //############ //########################################################################################## //########################################################################################## #ifndef NULL #ifndef __cplusplus #define NULL ((void *)0) #else #define NULL 0 #endif #endif //########################################################################################## //########################################################################################## //############ //############ Sized Floating-Point Primitive Type Definitions //############ //########################################################################################## //########################################################################################## /// Define the type used to represent a 32-bit floating point number. typedef float Float32; /// Define the type used to represent a 64-bit floating point number. typedef double Float64; //########################################################################################## //########################################################################################## //############ //############ Sized Integer Primitive Type Definitions //############ //########################################################################################## //########################################################################################## /// Define the type used to represent an 8-bit signed integral number. typedef signed char Int8; /// Define the type used to represent an 8-bit unsigned integral number. typedef unsigned char UInt8; /// Define the type used to represent a 16-bit signed integral number. typedef signed short Int16; /// Define the type used to represent a 16-bit unsigned integral number. typedef unsigned short UInt16; /// Define the type used to represent a 32-bit signed integral number. typedef signed int Int32; /// Define the type used to represent a 32-bit unsigned integral number. typedef unsigned int UInt32; /// Define the type used to represent a 64-bit signed integral number. typedef signed long long Int64; /// Define the type used to represent a 64-bit unsigned integral number. typedef unsigned long long UInt64; //########################################################################################## //########################################################################################## //############ //############ Standard Primitive Type Redefinitions //############ //########################################################################################## //########################################################################################## /// Redefine the standard 'bool' primitive type to use the library's type naming conventions. typedef bool Bool; /// Redefine the standard 'short' primitive type to use the library's type naming conventions. typedef short Short; /// Redefine the standard 'unsigned short' primitive type to use the library's type naming conventions. typedef unsigned short UShort; /// Redefine the standard 'int' primitive type to use the library's type naming conventions. typedef int Int; /// Redefine the standard 'unsigned int' primitive type to use the library's type naming conventions. typedef unsigned int UInt; /// Redefine the standard 'long' primitive type to use the library's type naming conventions. typedef long Long; /// Redefine the standard 'unsigned long' primitive type to use the library's type naming conventions. typedef unsigned long ULong; /// Redefine the standard 'long long' primitive type to use the library's type naming conventions. typedef long long LongLong; /// Redefine the standard 'unsigned long long' primitive type to use the library's type naming conventions. typedef unsigned long long ULongLong; /// Redefine the standard 'float' primitive type to use the library's type naming conventions. typedef float Float; /// Redefine the standard 'double' primitive type to use the library's type naming conventions. typedef double Double; //########################################################################################## //########################################################################################## //############ //############ Application-Specific Primitive Type Definitions //############ //########################################################################################## //########################################################################################## /// Define the type to use when holding signed data, should be 8 bits wide. typedef Int8 Byte; /// Define the type to use when holding generic data, should be 8 bits wide. typedef UInt8 UByte; /// Define the type to use when working with ASCII character data. typedef char Char; /// Define the type to use for hash codes in hash tables, should be an unsigned integer. typedef std::size_t Hash; /// Define the type to use to represent a quanitity of something, should be an unsigned integer. typedef std::size_t Size; /// Define the type to use for a large-scale size. This is the largest supported unsigned integer type. typedef UInt64 LargeSize; /// Define the type to use to represent an offset (index) in an array or sequence of things. typedef std::size_t Index; /// Define the type to use for a large-scale index. This is the largest supported unsigned integer type. typedef UInt64 LargeIndex; #if defined(RIM_PLATFORM_32_BIT) /// Define the type on 32-bit systems that is the same size as a pointer. typedef UInt32 PointerInt; typedef Int32 SignedIndex; #elif defined(RIM_PLATFORM_64_BIT) /// Define the type on 64-bit systems that is the same size as a pointer. typedef UInt64 PointerInt; typedef Int64 SignedIndex; #endif /// Define the type for a UTF-8 unicode character. typedef UInt8 UTF8Char; /// Define the type for a UTF-16 unicode character. typedef UInt16 UTF16Char; /// Define the type for a UTF-32 unicode character. typedef UInt32 UTF32Char; /// Define the type for a unicode character that can hold the data for any other unicode character type. typedef UTF32Char UniChar; //########################################################################################## //****************************** End Rim Namespace ************************************ RIM_NAMESPACE_END //****************************************************************************************** //########################################################################################## #endif // INCLUDE_RIM_CONFIG_H
fc79fe29914d224d9f3a1e494aff6b8937be723f
[ "C", "C++" ]
679
C++
niti1987/Quadcopter
6ca26b1224395c51369442f202d1b4c4b7188351
e078d23dd1e736fda19b516a5cd5e4aca5aa3c50
refs/heads/master
<file_sep>const graphql = require("graphql"); const _ = require("lodash"); const Book = require("../models/books"); const Author = require("../models/author"); //lets set up some schema const { GraphQLObjectType, GraphQLString, GraphQLSchema, GraphQLID, GraphQLInt, GraphQLList, GraphQLNonNull } = graphql; //develop type relations //dummy data // let books = [ // { name: "Name of the Wind", genre: "Fantasy", id: "1", authorId: "1" }, // { // name: "To Kill a Mocking Bird", // genre: "Historical", // id: "2", // authorId: "2" // }, // { name: "<NAME>", genre: "Sci-Fi", id: "3", authorId: "3" }, // { name: "<NAME>", genre: "Fantasy", id: "4", authorId: "1" }, // { // name: "Dance Off: The Biography", // genre: "Historical", // id: "5", // authorId: "2" // }, // { name: "Purge", genre: "Sci-Fi", id: "6", authorId: "2" } // ]; // let authors = [ // { name: "<NAME>", age: 55, id: "1" }, // { name: "<NAME>", age: 1000, id: "2" }, // { name: "<NAME>", age: 52, id: "3" } // ]; const BookType = new GraphQLObjectType({ name: "Book", fields: () => ({ id: { type: GraphQLID }, name: { type: GraphQLString }, genre: { type: GraphQLString }, author: { type: AuthorType, resolve(parent, args) { return Author.findById(parent.authorId); } } }) }); const AuthorType = new GraphQLObjectType({ name: "Author", fields: () => ({ id: { type: GraphQLID }, name: { type: GraphQLString }, age: { type: GraphQLInt }, books: { type: GraphQLList(BookType), resolve(parent, args) { return Book.find({ authorId: parent.id }); } } }) }); //how we initially jump into the graph const RootQuery = new GraphQLObjectType({ name: "RootQueryType", fields: { book: { type: BookType, args: { id: { type: GraphQLID } }, resolve(parent, args) { //code to get data from other db/source // return _.find(books, { id: args.id }); return Book.findById(args.id); } }, author: { type: AuthorType, args: { id: { type: GraphQLID } }, resolve(parent, args) { // return _.find(authors, { id: args.id }); return Author.findById(args.id); } }, books: { type: new GraphQLList(BookType), resolve(parent, args) { return Book.find({}); } }, authors: { type: new GraphQLList(AuthorType), resolve(parent, args) { return Author.find({}); } } } }); //Mutations const Mutation = new GraphQLObjectType({ name: "Mutation", fields: { addAuthor: { type: AuthorType, args: { name: { type: new GraphQLNonNull(GraphQLString) }, age: { type: new GraphQLNonNull(GraphQLInt) } }, resolve(parent, args) { let author = new Author({ name: args.name, age: args.age }); return author.save(); } }, addBook: { type: BookType, args: { name: { type: new GraphQLNonNull(GraphQLString) }, genre: { type: new GraphQLNonNull(GraphQLString) }, authorId: { type: new GraphQLNonNull(GraphQLID) } }, resolve(parent, args) { let book = new Book({ name: args.name, genre: args.genre, authorId: args.authorId }); return book.save(); } } } }); module.exports = new GraphQLSchema({ query: RootQuery, mutation: Mutation }); <file_sep>import React, { useState } from "react"; import { useQuery, useMutation } from "@apollo/react-hooks"; import { getAuthorsQuery, getBooksQuery, addBookMutation } from "../queries/queries"; const initialValues = { name: "", genre: "", authorId: "" }; const AddBookInput = () => { const [inputState, setInputState] = useState(initialValues); const { loading, error, data } = useQuery(getAuthorsQuery); const [addBook] = useMutation(addBookMutation); const displayAuthors = () => { if (loading) { return <option disabled>Loading Authors...</option>; } else { return data.authors.map(author => { return ( <option key={author.id} value={author.id}> {author.name} </option> ); }); } }; const handleChange = e => { const update = { ...inputState, [e.target.name]: e.target.value }; setInputState(update); }; const handleSubmit = e => { e.preventDefault(); console.log("This is the inputState", inputState); addBook({ variables: { ...inputState }, refetchQueries: [{ query: getBooksQuery }] }); }; return ( <form id="add-book" onSubmit={handleSubmit}> <div className="field"> <label htmlFor="name">Book Name:</label> <input type="text" onChange={handleChange} name="name" /> </div> <div className="field"> <label htmlFor="genre">Genre:</label> <input type="text" onChange={handleChange} name="genre" /> </div> <div className="field"> <label htmlFor="authorId">Author:</label> <select onChange={handleChange} name="authorId"> <option>Select Author</option> {displayAuthors()} </select> </div> <button>+</button> </form> ); }; export default AddBookInput; <file_sep>import React, { useState } from "react"; import { useQuery } from "@apollo/react-hooks"; import { getBookQuery } from "./../queries/queries"; const BookDetails = ({ book_id }) => { const { loading, data } = useQuery(getBookQuery, { variables: { id: book_id } }); const displayBookDetails = () => { if (data) { return ( <div> <h2>{data.book.name}</h2> <p>{data.book.genre}</p> <p>{data.book.author.name}</p> <p>All Books by this author:</p> <ul className="other-books"> {data.book.author.books.map(item => { return <li key={item.id}>{item.name}</li>; })} </ul> </div> ); } else { return <div>No Books selected</div>; } }; return <div id="book-details">{displayBookDetails()}</div>; }; export default BookDetails;
aa0d8a9ada7ee4be82e43aba460f09cb21de7bf4
[ "JavaScript" ]
3
JavaScript
bsherwood9/graphql-tutorial
5786d03e8cccf699d72020a5e7d236de5a41a8d3
b164c5272aed4e6c372f9b947af2b68b1ea9d527
refs/heads/master
<file_sep># Cleanup - WoW 1.12 addOn This addOn automatically stacks and sorts your items. ![Alt text](http://i.imgur.com/DZgQPaa.png) [Video demonstration](https://www.youtube.com/watch?v=DGjBcyg4cys) (The minimap button is from an older version) ### Commands **/cleanupbags** (starts button placement mode)<br/> **/cleanupbank** (starts button placement mode) #### Button placement mode Use the mouse wheel to iterate through the visible frames to choose a parent for the button. When holding down ctrl the mouse wheel will resize the button instead. Finally click to place the button. ### Sort order The highest priority is to fill special bags (e.g., herb bag) with fitting items. Besides that, the primary sort order is: **hearthstone**<br/> **mounts**<br/> **special items** (items of arbitrary categories that tend to be kept for a long time for some reason. e.g., cosmetic items like dartol's rod, items that give you some ability like cenarion beacon)<br/> **key items** (keys that aren't actual keys. e.g., mara scepter, zf hammer, ubrs key)<br/> **tools**<br/> **other soulbound items**<br/> **reagents**<br/> **consumables**<br/> **quest items**<br/> **high quality items** (which aren't in any other category)<br/> **enchanting materials**<br/> **herbs**<br/> **common quality items** (which aren't in any other category)<br/> **junk**<br/> **soul shards**<br/> **conjured items** The basic intuition for the primary sort order is how long items are expected to be kept around. The more "permanent" an item is the lower it is placed in your bags. Within the primary groups items are further sorted by **itemclass**, **itemequiploc**, **itemsubclass**, **itemname** and **stacksize/charges** in this order of priority. <file_sep>local _G, _M = getfenv(0), {} setfenv(1, setmetatable(_M, {__index=_G})) do local f = CreateFrame'Frame' f:SetScript('OnEvent', function(self, event, ...) _M[event](self, ...) end) f:RegisterEvent'ADDON_LOADED' end _G.Cleanup = { BAGS = {}, BANK = {}, } BAGS = { FUNCTION = SortBags, TOOLTIP = 'Clean Up Bags', } BANK = { FUNCTION = SortBankBags, TOOLTIP = 'Clean Up Bank', } _G.SLASH_CLEANUPBAGS1 = '/cleanupbags' function _G.SlashCmdList.CLEANUPBAGS(arg) buttonPlacer.key = 'BAGS' buttonPlacer:Show() end _G.SLASH_CLEANUPBANK1 = '/cleanupbank' function _G.SlashCmdList.CLEANUPBANK(arg) buttonPlacer.key = 'BANK' buttonPlacer:Show() end function ADDON_LOADED(_, arg1) if arg1 ~= 'Cleanup' then return end CreateButtonPlacer() CreateButton'BAGS' CreateButton'BANK' end function CleanupButton(parent) local button = CreateFrame('Button', nil, parent) button:SetWidth(28) button:SetHeight(26) button:SetNormalTexture[[Interface\AddOns\Cleanup\Bags]] button:GetNormalTexture():SetTexCoord(.12109375, .23046875, .7265625, .9296875) button:SetPushedTexture[[Interface\AddOns\Cleanup\Bags]] button:GetPushedTexture():SetTexCoord(.00390625, .11328125, .7265625, .9296875) button:SetHighlightTexture[[Interface\Buttons\ButtonHilight-Square]] button:GetHighlightTexture():ClearAllPoints() button:GetHighlightTexture():SetPoint('CENTER', 0, 0) button:GetHighlightTexture():SetWidth(24) button:GetHighlightTexture():SetHeight(23) return button end function CreateButton(key) local settings = Cleanup[key] local button = CleanupButton() _M[key].button = button button:SetScript('OnUpdate', function(self) if settings.parent and getglobal(settings.parent) then UpdateButton(key) self:SetScript('OnUpdate', nil) end end) button:SetScript('OnClick', function() PlaySoundFile[[Interface\AddOns\Cleanup\UI_BagSorting_01.ogg]] _M[key].FUNCTION() end) button:SetScript('OnEnter', function(self) GameTooltip:SetOwner(self) GameTooltip:AddLine(_M[key].TOOLTIP) GameTooltip:Show() end) button:SetScript('OnLeave', function() GameTooltip:Hide() end) end function UpdateButton(key) local button, settings = _M[key].button, Cleanup[key] button:SetParent(_G[settings.parent]) button:SetPoint('CENTER', unpack(settings.position)) button:SetScale(settings.scale) button:Show() end function CollectFrames() frames = {} local f while true do f = EnumerateFrames(f) if not f then break end if f.GetName and f:GetName() and f.IsVisible and f:IsVisible() and f.GetCenter and f:GetCenter() then tinsert(frames, f) end end end function CreateButtonPlacer() local frame = CreateFrame('Frame', nil, UIParent) buttonPlacer = frame frame:EnableMouse(true) frame:EnableMouseWheel(true) frame:EnableKeyboard(true) frame:SetFrameStrata'FULLSCREEN_DIALOG' frame:SetAllPoints() frame:Hide() local targetMarker = frame:CreateTexture() targetMarker:SetColorTexture(1, 1, 0, .5) local buttonPreview = CleanupButton(frame) buttonPreview:EnableMouse(false) buttonPreview:SetAlpha(.5) local function target(self) local f = frames[frame.index] frame.target = f local scale, x, y = f:GetEffectiveScale(), GetCursorPosition() targetMarker:SetAllPoints(f) buttonPreview:SetScale(scale * self.scale) RaidNotice_Clear(RaidWarningFrame) RaidNotice_AddMessage(RaidWarningFrame, f:GetName(), ChatTypeInfo["SAY"]) end frame:SetScript('OnShow', function(self) self.scale = 1 self.index = 1 CollectFrames() target(self) end) frame:SetScript('OnKeyDown', function(self, arg1) if arg1 == 'ESCAPE' then self:Hide() end end) frame:SetScript('OnMouseWheel', function(self, arg1) if IsControlKeyDown() then self.scale = max(0, self.scale + arg1 * .05) buttonPreview:SetScale(self.target:GetEffectiveScale() * self.scale) else self.index = self.index + arg1 if self.index < 1 then self.index = #frames elseif self.index > #frames then self.index = 1 end target(self) end end) frame:SetScript('OnMouseDown', function(self) self:Hide() local x, y = GetCursorPosition() local targetScale, targetX, targetY = self.target:GetEffectiveScale(), self.target:GetCenter() Cleanup[self.key] = {parent=self.target:GetName(), position={(x/targetScale-targetX)/self.scale, (y/targetScale-targetY)/self.scale}, scale=self.scale} UpdateButton(self.key) end) frame:SetScript('OnUpdate', function() local scale, x, y = buttonPreview:GetEffectiveScale(), GetCursorPosition() buttonPreview:SetPoint('CENTER', UIParent, 'BOTTOMLEFT', x/scale, y/scale) end) end
8364929120e78015f293edc47843ab2624b64cca
[ "Markdown", "Lua" ]
2
Markdown
shirsig/Cleanup
6b0c8207e2317843db1b9b5d6072faf6f523dafc
d5c096ba3f99cafdb8e029efa7d762773cb22e73
refs/heads/master
<file_sep>package fr.BullCheat.gui; import java.util.ArrayList; import java.util.List; import org.bukkit.Bukkit; import org.bukkit.Material; import org.bukkit.OfflinePlayer; import org.bukkit.craftbukkit.v1_8_R3.inventory.CraftInventoryCustom; import org.bukkit.enchantments.Enchantment; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.EventPriority; import org.bukkit.event.Listener; import org.bukkit.event.inventory.InventoryClickEvent; import org.bukkit.event.inventory.InventoryCloseEvent; import org.bukkit.inventory.ItemFlag; import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.meta.ItemMeta; import org.bukkit.inventory.meta.SkullMeta; import org.bukkit.plugin.Plugin; public abstract class GUI extends CraftInventoryCustom implements Listener { ClickCallback[] callbacks; boolean disabled; private Player player; private boolean closesOnReload = true; private Plugin plugin; private int backPosition; private GUI lastGUI; /** * * @param name The display name for the GUI * @param p The player the GUI is for * @param autoreload If true, reload() will be called automatically when created. Disable this if you want to add custom variables to your GUI class. * @param plugin Your plugin, used to get logger and to register events. */ public GUI(String name, Player p, boolean autoreload, Plugin plugin, GUI lastGUI, int bPos) { super(p, 9*6, name); player = p; Bukkit.getPluginManager().registerEvents(this, plugin); callbacks = new ClickCallback[this.getSize()]; this.plugin = plugin; this.lastGUI = lastGUI; this.backPosition = bPos; if (autoreload) reload(); } /** * * This function must reload the GUI. * */ public abstract void reload(); /** * * Opens the GUI to its owner. * */ public void open() { this.disabled = false; getPlayer().openInventory(this); } /** * Adds a button to the GUI * @param y Vertical, first row = 0 * @param x Horizontal, first column = 0 * @param i The itemstack to put * @param callback What to run when clicked. If you pass null, this will be an inactive button. */ public void addButton(int y, int x, ItemStack i, ClickCallback callback) { int pos = y*9 + x; addButton(pos, i, callback); } /** * Adds the button to the GUI * @param pos The slot ID. * @param i The itemstack to put * @param callback What to run when clicked. If you pass null, this will be an inactive button. */ public void addButton(int pos, ItemStack i, ClickCallback callback) { if (pos > this.getSize()) { throw new IllegalArgumentException("Asked pos " + pos + " while available = " + this.getSize()); } this.setItem(pos, i); this.callbacks[pos] = callback; } /** * Will fill all the slots within a and b * @param is The ItemStack to fill with */ public void fill(int a, int b, ItemStack is) { int max = Math.max(a, b); int min = Math.min(a, b); if (max >= this.getSize() || min < 0) { throw new IllegalArgumentException(min + " -> " + max + " while max = " + this.getSize()); } for (int i = min; i <= max; i++) { this.setItem(i, is.clone()); } } /** * Sets a GUI item * @param y Vertical, first row = 0 * @param x Horizontal, first column = 0 * @param i The item stack to set */ public void set(int x, int y, ItemStack i) { this.setItem(getSlot(x, y), i); } protected static byte getSlot(int x, int y) { return (byte) (x * 9 + y); } @EventHandler(priority = EventPriority.LOWEST) private void onPlayerClickInventory(InventoryClickEvent e) { if (this.disabled) return; if ((e.getInventory() != null && e.getInventory().hashCode() == this.hashCode()) || (e.getInventory() != null && e.getInventory().hashCode() == this.hashCode())) { e.setCancelled(true); if (isOpOnly() && !player.isOp()) return; if (e.getSlot() < this.getSize() && e.getSlot() > -1) { if (callbacks[e.getSlot()] != null) { callbacks[e.getSlot()].call(e); } try { this.getClass().getMethod("onClick", int.class).invoke(this, e.getSlot()); } catch (Throwable t) {} } else { plugin.getLogger().severe("WTF?! " + e.getWhoClicked().getName() + " clicked slot " + e.getSlot() + " while max size = " + getSize() + " GUI:\n" + this.toString()); } } } @EventHandler public void onPlayerCloseGUI(InventoryCloseEvent e) { if (e.getInventory().hashCode() == this.hashCode()) { this.disabled = true; } } /** * Creates an ItemStack easily, using the provided elements. Remove an element if you want to leave it default. * @param material * @param name The custom name you want on the ItemStack. Set to null to leave default. * @param quantity * @param meta Also called durability * @param enchant If true, the item will appear as enchanted * @param lores * @return */ public static ItemStack forgeItem(Material material, String name, int quantity, short meta, boolean enchant, String... lores) { ItemStack is = new ItemStack(material, quantity, meta); ItemMeta imeta = is.getItemMeta(); if (name != null) imeta.setDisplayName("§f" + name); if (lores.length > 0) { List<String> l = new ArrayList<String>(); for (String s : lores) { l.add("§f" + s); } imeta.setLore(l); } imeta.addItemFlags(ItemFlag.values()); is.setItemMeta(imeta); if (enchant) { is.addUnsafeEnchantment(Enchantment.DURABILITY, 1); } return is; } public static ItemStack forgeItem(Material material, String name) { return forgeItem(material, name, 1, (short) 0, false); } public static ItemStack forgeItem(Material material, String name, boolean enchant) { return forgeItem(material, name, 1, (short) 0, enchant); } public static ItemStack forgeItem(Material material, String name, boolean enchant, String... lores) { return forgeItem(material, name, 1, (short) 0, enchant, lores); } public static ItemStack forgeItem(Material material, String name, String... lores) { return forgeItem(material, name, 1, (short) 0, false, lores); } public static ItemStack forgeItem(Material material, String name, int quantity) { return forgeItem(material, name, quantity, (short) 0, false); } public static ItemStack forgeItem(Material material, String name, int quantity, String... lores) { return forgeItem(material, name, quantity, (short) 0, false, lores); } public static ItemStack forgeItem(Material material, String name, short meta) { return forgeItem(material, name, 1, meta, false); } public static ItemStack forgeItem(Material material, String name, short meta, boolean enchant) { return forgeItem(material, name, 1, meta, enchant); } public static ItemStack forgeItem(Material material, String name, short meta, String... lores) { return forgeItem(material, name, 1, meta, false, lores); } /** * @param p The player you want on the skull * @param name The name to put on the skull * @return The skull of the passed player */ public static ItemStack getSkull(OfflinePlayer p, String name) { return getSkull(p.getName(), name); } /** * @param p The name of the player you want on the skull * @param name The name to put on the skull * @return The skull of the passed player */ public static ItemStack getSkull(String p, String name) { ItemStack i = forgeItem(Material.SKULL_ITEM, name, (short) 3); return setSkull(i, p); } private static ItemStack setSkull(ItemStack s, String p) { if (!(s.getItemMeta() instanceof SkullMeta)) throw new IllegalArgumentException("Need skull, got " + s.getType()); s.setDurability((short) 3); SkullMeta m = (SkullMeta) s.getItemMeta(); m.setOwner(p); s.setItemMeta(m); return s; } /** * Sets an ItemStack's lores. * @param item The ItemStack to put the lores on * @param lores The lores you want to put on the ItemStack */ public void setLore(ItemStack item, String... lores) { setLore(item, lores); } /** * Sets an ItemStack's lores. * @param item The ItemStack to put the lores on * @param lores The lores you want to put on the ItemStack */ public void setLore(ItemStack item, List<String> lores) { ItemMeta meta = item.getItemMeta(); meta.setLore(lores); item.setItemMeta(meta); } /** * Helps you to determine if an ItemStack's Material is the same as another one. * This saves you from having to check for null, etc… * @param a First ItemStack * @param b Second ItemStack * @return true if a.getType() == b.getType() */ public static boolean is(ItemStack a, ItemStack b) { if (a == b) return true; if (a == null || b == null) return false; if (a.getType() == b.getType()) return true; return false; } public static boolean is(Material a, ItemStack b) { if (a == null || b == null) return false; if (a == b.getType()) return true; return false; } public Player getPlayer() { return player; } public boolean closesOnReload() { return closesOnReload; } /** * This is used to restrict a GUI to OPs only. * @return If true, the GUI won't open on a non-op player */ public abstract boolean isOpOnly(); @Override public String toString() { return this.getClass().getName() + "{Player=" + getPlayer().getName() + "}"; } /** * Puts the back button automatically. * @param name The name that you want on the button */ public void putBackButton(String name) { if (backPosition >= this.getSize() || backPosition < 0) { throw new IllegalArgumentException("Backbutton pos = " + backPosition + " while size = " + this.getSize()); } this.addButton(backPosition, forgeItem(Material.STAINED_GLASS_PANE, name, (short) 14), new ClickCallback() { @Override public void call(InventoryClickEvent e) { try { goBack(); } catch (IllegalAccessException e1) { e1.printStackTrace(); } } }); } public void goBack() throws IllegalAccessException { if (lastGUI == null) { throw new IllegalAccessException("There is no previous GUI. Please use goBack(GUI)."); } goBack(lastGUI); } public void goBack(GUI gui) { gui.reload(); gui.open(); } } <file_sep>package fr.BullCheat.gui; import org.bukkit.event.inventory.InventoryClickEvent; public interface ClickCallback { /** * This will be executed when the button it is associated to is clicked. * @param e The click event */ public void call(InventoryClickEvent e); } <file_sep># BullLib To use, just include what's in the src folder to your project and follow JavaDoc. Start by instancing a new GUI().
71272a4c33f332f42142cd8430a4a9b94f45dfdf
[ "Markdown", "Java" ]
3
Java
Thecrafteur75/BullLib
ad0aeadba44f2180f7983b93b3a641ab8bd44465
b3d6e531ea088742b428197048aedc02171bfd78
refs/heads/master
<repo_name>rafflesargentina/l57-enterprise-boilerplate<file_sep>/app/Repositories/CompanyRepository.php <?php namespace Raffles\Repositories; use Raffles\Models\Company; use Caffeinated\Repository\Repositories\EloquentRepository; class CompanyRepository extends EloquentRepository { /** * @var Model */ public $model = Company::class; /** * @var array */ public $tag = ['Company']; } <file_sep>/resources/js/store/modules/users/getters.js export default { allUsersPending (state) { return state.allPending }, oneUserPending (state) { return state.onePending }, } <file_sep>/app/Modules/Dashboard/Repositories/BaseRepository.php <?php namespace Raffles\Modules\Dashboard\Repositories; use Caffeinated\Repository\Repositories\EloquentRepository; use Illuminate\Database\Eloquent\Collection; use DB; class BaseRepository extends EloquentRepository { /** * Find all entities. * * @param array $columns * @param array $with */ public function findAll($columns = ['*'], $with = []) { $cacheKey = $this->generateKey([$columns, $with]); return $this->cacheResults(get_called_class(), __FUNCTION__, $cacheKey, function () use ($columns, $with) { return $this->model->with($with) ->filter() ->sort() ->get($columns); }); } /** * Get records count. * * @return Collection */ public function getCount() { $dateFormats = $this->dateFormats(); $cacheKey = $this->generateKey(['count', $dateFormats]); return $this->cacheResults( get_called_class(), __FUNCTION__, $cacheKey, function () use ($dateFormats) { return $this->model ->select(DB::raw('*, count(*) as count, '.$dateFormats)) ->get(); } ); } /** * Get grouped records count. * * @return Collection */ public function getGroupedCount($groupBy, $columns = []) { $dateFormats = $this->dateFormats(); $cacheKey = $this->generateKey(['groupedCount', $dateFormats, $groupBy, $columns]); return $this->cacheResults( get_called_class(), __FUNCTION__, $cacheKey, function () use ($dateFormats, $groupBy, $columns) { return $this->model ->select(DB::raw('*, count(*) as count, '.$dateFormats)) ->groupBy($groupBy) ->filter() ->sort() ->get($columns); } ); } /** * Get only trashed records count. * * @return Collection */ public function getOnlyTrashedCount() { $dateFormats = $this->dateFormats(); $cacheKey = $this->generateKey(['onlyTrashedCount', $dateFormats]); return $this->cacheResults( get_called_class(), __FUNCTION__, $cacheKey, function () use ($dateFormats) { return $this->model ->onlyTrashed() ->select(DB::raw('*, count(*) as count, '.$dateFormats)) ->get(); } ); } /** * Get grouped records count with trashed. * * @return Collection */ public function getGroupedCountWithTrashed($groupBy, $columns = []) { $dateFormats = $this->dateFormats(); $cacheKey = $this->generateKey(['groupedCountWithTrashed', $dateFormats, $groupBy, $columns]); return $this->cacheResults( get_called_class(), __FUNCTION__, $cacheKey, function () use ($dateFormats, $groupBy, $columns) { return $this->model->withTrashed() ->select(DB::raw('*, count(*) as count, '.$dateFormats)) ->groupBy($groupBy) ->filter() ->sort() ->get($columns); } ); } /** * DATE_FORMAT queries. * * @return string */ protected function dateFormats() { $createdAtPreset = request()->created_at_preset; $deletedAtPreset = request()->deleted_at_preset; $updatedAtPreset = request()->updated_at_preset; $dateFormats = $createdAtPreset === 'today' ? 'DATE_FORMAT(created_at, "%y-%m-%d %H") as creation_date,' : 'DATE_FORMAT(created_at, "%y-%m-%d") as creation_date,'; $dateFormats .= $deletedAtPreset === 'today' ? 'DATE_FORMAT(deleted_at, "%y-%m-%d %H") as deletion_date,' : 'DATE_FORMAT(deleted_at, "%y-%m-%d") as deletion_date,'; $dateFormats .= $updatedAtPreset === 'today' ? 'DATE_FORMAT(updated_at, "%y-%m-%d %H") as updating_date,' : 'DATE_FORMAT(updated_at, "%Y-%m-%d") as updating_date'; return $dateFormats; } } <file_sep>/app/Modules/Dashboard/Resources/Javascript/store/modules/userTraffic/userTraffic.js import actions from "./actions" import getters from "./getters" import mutations from "./mutations" export function initialState() { return { all: [], browserUsage: [], count: [], deviceUsage: [], deviceTypeUsage: [], geoUsage: [], platformUsage: [], } } export const state = { initialState: initialState(), ...initialState() } export default { actions, getters, mutations, state } <file_sep>/app/Modules/Dashboard/Resources/Javascript/index.js /** * First we will load all of this project's JavaScript dependencies which * includes Vue and other libraries. It is a great starting point when * building robust, powerful web applications using Vue and Laravel. */ import * as apiKeys from "./apiKeys" import Chart from "chart.js" import Vue from "vue" import VueChartkick from "vue-chartkick" Vue.use(VueChartkick, { adapter: Chart }) require("./router") require("./store") /** * The following block of code may be used to automatically register your * Vue components. It will recursively scan this directory for the Vue * components and automatically register them with their "basename". * * Eg. ./components/ExampleComponent.vue -> <example-component></example-component> */ const files = require.context("./", true, /\.vue$/i) files.keys().map(key => Vue.component(key.split("/").pop().split(".")[0], (resolve) => resolve(files(key)))) window.google.charts.load({ packages: ["geochart"], mapsApiKey: apiKeys.GOOGLE_MAPS }) <file_sep>/app/Modules/Dashboard/Models/User.php <?php namespace Raffles\Modules\Dashboard\Models; use Raffles\Models\User as BaseUser; use Raffles\Modules\Dashboard\Filters\UserFilters; use Raffles\Modules\Dashboard\Sorters\UserSorters; use RafflesArgentina\FilterableSortable\FilterableSortableTrait; class User extends BaseUser { use FilterableSortableTrait; /** * The query filters associated class. * * @var mixed */ protected $filters = UserFilters::class; /** * The query sorters associated class. * * @var mixed */ protected $sorters = UserSorters::class; } <file_sep>/app/Listeners/SendEmailUserRegistered.php <?php namespace Raffles\Listeners; use Raffles\Notifications\UserRegistered; use Illuminate\Queue\InteractsWithQueue; use Illuminate\Contracts\Queue\ShouldQueue; class SendEmailUserRegistered { /** * Handle the event. * * @param object $event * @return void */ public function handle($event) { $event->user->notify(new UserRegistered); } } <file_sep>/database/factories/AddressFactory.php <?php use Faker\Generator as Faker; $factory->define(Raffles\Models\Address::class, function (Faker $faker) { return [ 'addressable_id' => '1', 'addressable_type' => 'Raffles\Models\User', 'country' => $faker->country, 'door_number' => rand(1,25000), 'featured' => rand(0,1), 'floor_number' => rand(1,25), 'lat' => $faker->latitude, 'lng' => $faker->longitude, 'locality' => $faker->city, 'state' => $faker->state, 'street_name' => $faker->streetName, 'street_number' => rand(10, 15000), 'sublocality' => $faker->city, 'zip' => $faker->postCode, ]; }); <file_sep>/app/Modules/Dashboard/Resources/Javascript/store/modules/users/mutations.js import * as types from "../../mutation-types" export default { [types.USERS_ACTIVE] (state, payload) { state.active = payload }, [types.USERS_COUNT] (state, payload) { state.count = payload }, [types.USERS_CREATED] (state, payload) { state.created = payload }, [types.USERS_ERROR] (state, payload) { state.error = JSON.stringify(payload) } } <file_sep>/app/Http/Controllers/UserController.php <?php namespace Raffles\Http\Controllers; use Raffles\Repositories\UserRepository; use RafflesArgentina\ResourceController\ApiResourceController; class UserController extends ApiResourceController { protected $repository = UserRepository::class; protected $resourceName = 'users'; } <file_sep>/app/Modules/Dashboard/Resources/Javascript/router/middleware.js import store from "@/store" export const canAccessDashboard = (to, from, next) => { if (store.getters["auth/isAuthenticated"] && store.getters["auth/isAdmin"]) { return next() } return next({ name: "Unauthorized"}) } <file_sep>/app/Modules/Dashboard/Sorters/UserTrafficSorters.php <?php namespace Raffles\Modules\Dashboard\Sorters; class UserTrafficSorters extends BaseSorters { protected static $defaultOrder = "asc"; protected static $defaultOrderBy = "created_at"; } <file_sep>/app/Modules/Dashboard/Models/UserTraffic.php <?php namespace Raffles\Modules\Dashboard\Models; use Raffles\Modules\Dashboard\Filters\UserTrafficFilters; use Raffles\Modules\Dashboard\Sorters\UserTrafficSorters; use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\SoftDeletes; use RafflesArgentina\FilterableSortable\FilterableSortableTrait; class UserTraffic extends Model { use FilterableSortableTrait, SoftDeletes; /** * The attributes that should be mutated to dates. * * @var array */ protected $dates = ['deleted_at']; /** * The attributes that are mass assignable. * * @var array */ protected $fillable = [ 'browser', 'country_code', 'country_name', 'device', 'device_type', 'platform', 'robot_name', 'token', 'user_id', ]; /** * The query filters associated class. * * @var mixed */ protected $filters = UserTrafficFilters::class; /** * The query sorters associated class. * * @var mixed */ protected $sorters = UserTrafficSorters::class; /** * The table associated with the model. * * @var string */ protected $table = 'user_traffic'; } <file_sep>/app/Http/Controllers/HomeController.php <?php namespace Raffles\Http\Controllers; use Illuminate\Http\Request; class HomeController extends Controller { /** * Show the home page. * * @return \Illuminate\Http\Response */ public function __invoke() { return view('layouts.app'); } } <file_sep>/app/Modules/Dashboard/Filters/UserFilters.php <?php namespace Raffles\Modules\Dashboard\Filters; class UserFilters extends BaseFilters {} <file_sep>/app/Modules/Dashboard/Listeners/RecordSuccessfulLogout.php <?php namespace Raffles\Modules\Dashboard\Listeners; use Raffles\Modules\Dashboard\Repositories\UserTrafficRepository; use Illuminate\Contracts\Queue\ShouldQueue; use Illuminate\Http\Request; use Illuminate\Queue\InteractsWithQueue; class RecordSuccessfulLogout implements ShouldQueue { /** * The request object. * * @var Request $request */ protected $request; /** * The UserTraffic repository. * * @var $repository */ protected $repository; /** * Create the event listener. * * @param Request $request The request object. * @param UserTrafficRepository $repository The UserTraffic repository. */ public function __construct(Request $request, UserTrafficRepository $repository) { $this->request = $request; $this->repository = $repository; } /** * Handle the event. * * @param object $event * @return void */ public function handle($event) { $user = $event->user; $session = $this->repository->findBy('token', $this->request->session()->get('_token')); if ($session) { $session->delete(); $session->save(); } \Log::info('User with ID '.$user->id.' has logged out.'); } } <file_sep>/resources/js/store/mutation-types.js export const AUTH_ERROR = "AUTH_ERROR" export const AUTH_PENDING = "AUTH_PENDING" export const AUTH_RESET = "AUTH_RESET" export const AUTH_TOKEN = "AUTH_TOKEN" export const AUTH_USER = "AUTH_USER" export const DOCUMENT_TYPES_DELETE_ONE = "DOCUMENT_TYPES_DELETE_ONE" export const DOCUMENT_TYPES_ERROR = "DOCUMENT_TYPES_ERROR" export const DOCUMENT_TYPES_FETCH_ONE = "DOCUMENT_TYPES_FETCH_ONE" export const DOCUMENT_TYPES_FETCH_ONE_PENDING = "DOCUMENT_TYPES_FETCH_ONE_PENDING" export const DOCUMENT_TYPES_FETCH_ALL = "DOCUMENT_TYPES_FETCH_ALL" export const DOCUMENT_TYPES_FETCH_ALL_PENDING = "DOCUMENT_TYPES_FETCH_ALL_PENDING" export const DOCUMENT_TYPES_RESET = "DOCUMENT_TYPES_RESET" export const PHOTOS_DELETE_ONE = "PHOTOS_DELETE_ONE" export const PHOTOS_ERROR = "PHOTOS_ERROR" export const PHOTOS_FEATURED = "PHOTOS_FEATURED" export const PHOTOS_FETCH_ONE = "PHOTOS_FETCH_ONE" export const PHOTOS_FETCH_ONE_PENDING = "PHOTOS_FETCH_ONE_PENDING" export const PHOTOS_FETCH_ALL = "PHOTOS_FETCH_ALL" export const PHOTOS_FETCH_ALL_PENDING = "PHOTOS_FETCH_ALL_PENDING" export const PHOTOS_NON_FEATURED = "PHOTOS_NON_FEATURED" export const PHOTOS_RESET = "PHOTOS_RESET" export const USERS_DELETE_ONE = "USERS_DELETE_ONE" export const USERS_ERROR = "USERS_ERROR" export const USERS_FETCH_ONE = "USERS_FETCH_ONE" export const USERS_FETCH_ONE_PENDING = "USERS_FETCH_ONE_PENDING" export const USERS_FETCH_ALL = "USERS_FETCH_ALL" export const USERS_FETCH_ALL_PENDING = "USERS_FETCH_ALL_PENDING" export const USERS_ONE_PERMISSION_MAP_TAGS = "USERS_ONE_PERMISSION_MAP_TAGS" export const USERS_ONE_ROLE_MAP_TAGS = "USERS_ONE_ROLE_MAP_TAGS" export const USERS_RESET = "USERS_RESET" <file_sep>/database/factories/ContactFactory.php <?php use Faker\Generator as Faker; $factory->define(Raffles\Models\Contact::class, function (Faker $faker) { return [ 'contactable_id' => '1', 'contactable_type' => 'Raffles\Models\User', 'email' => $faker->email, 'fax' => $faker->phoneNumber, 'mobile' => $faker->phoneNumber, 'phone' => $faker->phoneNumber, 'position' => $faker->word, 'website' => $faker->domainName, ]; }); <file_sep>/resources/js/store/modules/users/actions.js import * as types from "../../mutation-types" import { mapTags } from "@/utilities/helpers" export default { deleteOneUser ({ commit }, id) { return window.axios.delete("/api/users/" + id) .then(response => { const r = response.data.data commit(types.USERS_DELETE_ONE, r) return r }) .catch(error => { commit(types.USERS_ERROR, error) return error }) }, fetchAllUsers ({ commit }, params) { commit(types.USERS_FETCH_ALL_PENDING, true) return window.axios.get("/api/users", { params: params }) .then(response => { const all = response.data.data commit(types.USERS_FETCH_ALL, all) commit(types.USERS_FETCH_ALL_PENDING, false) return all }) .catch(error => { commit(types.USERS_ERROR, error) commit(types.USERS_FETCH_ALL_PENDING, false) return error }) }, fetchOneUser ({ commit, dispatch }, id) { commit(types.USERS_FETCH_ONE_PENDING, true) return window.axios.get("/api/users/" + id) .then(response => { const one = response.data commit(types.USERS_FETCH_ONE, one) commit(types.USERS_FETCH_ONE_PENDING, false) dispatch("mapOnePermissionTags", one) dispatch("mapOneRoleTags", one) return one }) .catch(error => { commit(types.USERS_ERROR, error) commit(types.USERS_FETCH_ONE_PENDING, false) return error }) }, mapOnePermissionTags ({ commit }, one) { const onePermissionTags = mapTags(one.permissions) commit(types.USERS_ONE_PERMISSION_MAP_TAGS, onePermissionTags) return onePermissionTags }, mapOneRoleTags ({ commit }, one) { const oneRoleTags = mapTags(one.roles) commit(types.USERS_ONE_ROLE_MAP_TAGS, oneRoleTags) return oneRoleTags }, reset ({ commit }) { commit(types.USERS_RESET) return null } } <file_sep>/app/Repositories/AddressRepository.php <?php namespace Raffles\Repositories; use Raffles\Models\Address; use Caffeinated\Repository\Repositories\EloquentRepository; class AddressRepository extends EloquentRepository { /** * @var Model */ public $model = Address::class; /** * @var array */ public $tag = ['Address']; } <file_sep>/app/Http/Controllers/AvatarController.php <?php namespace Raffles\Http\Controllers; use Raffles\Http\Requests\AvatarRequest; use Raffles\Repositories\UserRepository; use RafflesArgentina\ResourceController\ApiResourceController; class AvatarController extends ApiResourceController { protected $formRequest = AvatarRequest::class; protected $pruneHasOne = true; protected $repository = UserRepository::class; protected $resourceName = 'avatars'; } <file_sep>/app/Modules/Dashboard/Resources/Javascript/store/mutation-types.js export const USERS_ACTIVE = "USERS_ACTIVE" export const USERS_COUNT = "USERS_COUNT" export const USERS_CREATED = "USERS_CREATED" export const USERS_ERROR = "USERS_ERROR" export const USER_TRAFFIC_BROWSER_USAGE = "USER_TRAFFIC_BROWSER_USAGE" export const USER_TRAFFIC_COUNT = "USER_TRAFFIC_COUNT" export const USER_TRAFFIC_ERROR = "USER_TRAFFIC_ERROR" export const USER_TRAFFIC_FETCH_ALL = "USER_TRAFFIC_FETCH_ALL" export const USER_TRAFFIC_DEVICE_USAGE = "USER_TRAFFIC_DEVICE_USAGE" export const USER_TRAFFIC_DEVICE_TYPE_USAGE = "USER_TRAFFIC_DEVICE_TYPE_USAGE" export const USER_TRAFFIC_GEO_USAGE = "USER_TRAFFIC_GEO_USAGE" export const USER_TRAFFIC_PLATFORM_USAGE = "USER_TRAFFIC_PLATFORM_USAGE" <file_sep>/app/Modules/Dashboard/Http/Controllers/UserTrafficController.php <?php namespace Raffles\Modules\Dashboard\Http\Controllers; use Raffles\Modules\Dashboard\Repositories\UserTrafficRepository; use RafflesArgentina\ResourceController\ApiResourceController; class UserTrafficController extends ApiResourceController { protected $repository = UserTrafficRepository::class; protected $resourceName = 'user-traffic'; protected $useSoftDeletes = true; /** * Get items collection. * * @param string $orderBy The order key. * @param string $order The order direction. * * @return \Illuminate\Database\Eloquent\Collection */ public function getItemsCollection($orderBy = 'updated_at', $order = 'desc') { return $this->repository->findAll(); } } <file_sep>/app/Repositories/MapRepository.php <?php namespace Raffles\Repositories; use Raffles\Models\Map; use Caffeinated\Repository\Repositories\EloquentRepository; class MapRepository extends EloquentRepository { /** * @var Model */ public $model = Map::class; /** * @var array */ public $tag = ['Map']; } <file_sep>/set_permissions.sh #!/bin/bash /usr/bin/find ./storage -type d -exec chmod 775 {} \; /usr/bin/find ./bootstrap/cache -type d -exec chmod 775 {} \; <file_sep>/app/Modules/Dashboard/Filters/UserTrafficFilters.php <?php namespace Raffles\Modules\Dashboard\Filters; class UserTrafficFilters extends BaseFilters { } <file_sep>/database/factories/MapFactory.php <?php use Faker\Generator as Faker; $factory->define(Raffles\Models\Map::class, function (Faker $faker) { return [ 'lat' => $faker->latitude, 'lng' => $faker->longitude, 'mapable_id' => '1', 'mapable_type' => 'Raffles\Models\User', 'zoom' => rand(0,22) ]; }); <file_sep>/app/Http/Requests/AccountRequest.php <?php namespace Raffles\Http\Requests; use Illuminate\Foundation\Http\FormRequest; use Illuminate\Validation\Rule; class AccountRequest extends FormRequest { /** * Determine if the user is authorized to make this request. * * @return bool */ public function authorize() { return $this->user(); } /** * Get the validation rules that apply to the request. * * @return array */ public function rules() { $user = $this->user(); return [ 'email' => [ 'required', Rule::unique($user->getTable())->ignore($user->id), ], 'first_name' => 'required', 'last_name' => 'required', 'password' => '<PASSWORD>', ]; } } <file_sep>/app/Modules/Dashboard/Filters/BaseFilters.php <?php namespace Raffles\Modules\Dashboard\Filters; use Carbon\Carbon; use RafflesArgentina\FilterableSortable\QueryFilters; class BaseFilters extends QueryFilters { /** * The format of the dates. * * @var string */ protected $dateFormat = "d-m-Y"; /** * Created After * * @param mixed $query * * @return \Illuminate\Database\Eloquent\Builder */ public function created_after($query) { $date = Carbon::createFromFormat($this->dateFormat, $query); return $this->builder->where('created_at', '>=', $date->toDateString()); } /** * Created At Preset * * @param mixed $query * * @return \Illuminate\Database\Eloquent\Builder */ public function created_at_preset($query) { switch ($query) { case "30days": return $this->builder->where('created_at', '>=', Carbon::now()->subDays(30)->toDateTimeString()) ->where('created_at', '<=', Carbon::now()->endOfDay()->toDateTimeString()); break; case "60days": return $this->builder->where('created_at', '>=', Carbon::now()->subDays(60)->toDateTimeString()) ->where('created_at', '<=', Carbon::now()->endOfDay()->toDateTimeString()); break; case "365days": return $this->builder->where('created_at', '>=', Carbon::now()->subDays(365)->toDateTimeString()) ->where('created_at', '<=', Carbon::now()->endOfDay()->toDateTimeString()); case "today": return $this->builder->where('created_at', '>=', Carbon::now()->startOfDay()->toDateTimeString()) ->where('created_at', '<=', Carbon::now()->endOfDay()->toDateTimeString()); break; case "thisWeek": return $this->builder->where('created_at', '>=', Carbon::now()->startOfWeek()->toDateTimeString()) ->where('created_at', '<=', Carbon::now()->endOfWeek()->toDateTimeString()); break; case "thisMonth": return $this->builder->where('created_at', '>=', Carbon::now()->startOfMonth()->toDateTimeString()) ->where('created_at', '<=', Carbon::now()->endOfMonth()->toDateTimeString()); break; case "thisQuarter": return $this->builder->where('created_at', '>=', Carbon::now()->startOfQuarter()->toDateTimeString()) ->where('created_at', '<=', Carbon::now()->endOfMonth()->toDateTimeString()); break; case "thisYear": return $this->builder->where('created_at', '>=', Carbon::now()->startOfYear()->toDateTimeString()) ->where('created_at', '<=', Carbon::now()->endOfMonth()->toDateTimeString()); break; } } /** * Created Before * * @param mixed $query * * @return \Illuminate\Database\Eloquent\Builder */ public function created_before($query) { $date = Carbon::createFromFormat($this->dateFormat, $query); return $this->builder->where('created_at', '<=', $date->toDateString()); } /** * Deleted After * * @param mixed $query * * @return \Illuminate\Database\Eloquent\Builder */ public function deleted_after($query) { $date = Carbon::createFromFormat($this->dateFormat, $query); return $this->builder->whereNotNull('deleted_at')->where('deleted_at', '>=', $date->toDateString()); } /** * Deleted At Preset * * @param mixed $query * * @return \Illuminate\Database\Eloquent\Builder */ public function deleted_at_preset($query) { switch ($query) { case "30days": return $this->builder->whereNotNull('deleted_at')->where('deleted_at', '>=', Carbon::now()->subDays(30)->toDateTimeString()) ->where('deleted_at', '<=', Carbon::now()->endOfDay()->toDateTimeString()); break; case "60days": return $this->builder->whereNotNull('deleted_at')->where('deleted_at', '>=', Carbon::now()->subDays(60)->toDateTimeString()) ->where('deleted_at', '<=', Carbon::now()->endOfDay()->toDateTimeString()); break; case "365days": return $this->builder->whereNotNull('deleted_at')->where('deleted_at', '>=', Carbon::now()->subDays(365)->toDateTimeString()) ->where('deleted_at', '<=', Carbon::now()->endOfDay()->toDateTimeString()); case "today": return $this->builder->whereNotNull('deleted_at')->where('deleted_at', '>=', Carbon::now()->startOfDay()->toDateTimeString()) ->where('deleted_at', '<=', Carbon::now()->endOfDay()->toDateTimeString()); break; case "thisWeek": return $this->builder->whereNotNull('deleted_at')->where('deleted_at', '>=', Carbon::now()->startOfWeek()->toDateTimeString()) ->where('deleted_at', '<=', Carbon::now()->endOfWeek()->toDateTimeString()); break; case "thisMonth": return $this->builder->whereNotNull('deleted_at')->where('deleted_at', '>=', Carbon::now()->startOfMonth()->toDateTimeString()) ->where('deleted_at', '<=', Carbon::now()->endOfMonth()->toDateTimeString()); break; case "thisQuarter": return $this->builder->whereNotNull('deleted_at')->where('deleted_at', '>=', Carbon::now()->startOfQuarter()->toDateTimeString()) ->where('deleted_at', '<=', Carbon::now()->endOfMonth()->toDateTimeString()); break; case "thisYear": return $this->builder->whereNotNull('deleted_at')->where('deleted_at', '>=', Carbon::now()->startOfYear()->toDateTimeString()) ->where('deleted_at', '<=', Carbon::now()->endOfMonth()->toDateTimeString()); break; } } /** * Deleted Before * * @param mixed $query * * @return \Illuminate\Database\Eloquent\Builder */ public function deleted_before($query) { $date = Carbon::createFromFormat($this->dateFormat, $query); return $this->builder->whereNotNull('deleted_at')->where('deleted_at', '<=', $date->toDateString()); } /** * Updated After * * @param mixed $query * * @return \Illuminate\Database\Eloquent\Builder */ public function updated_after($query) { $date = Carbon::createFromFormat($this->dateFormat, $query); return $this->builder->where('updated_at', '>=', $date->toDateString()); } /** * Updated At Preset * * @param mixed $query * * @return \Illuminate\Database\Eloquent\Builder */ public function updated_at_preset($query) { switch ($query) { case "30days": return $this->builder->where('updated_at', '>=', Carbon::now()->subDays(30)->toDateTimeString()) ->where('updated_at', '<=', Carbon::now()->endOfDay()->toDateTimeString()); break; case "60days": return $this->builder->where('updated_at', '>=', Carbon::now()->subDays(60)->toDateTimeString()) ->where('updated_at', '<=', Carbon::now()->endOfDay()->toDateTimeString()); break; case "365days": return $this->builder->where('updated_at', '>=', Carbon::now()->subDays(365)->toDateTimeString()) ->where('updated_at', '<=', Carbon::now()->endOfDay()->toDateTimeString()); case "today": return $this->builder->where('updated_at', '>=', Carbon::now()->startOfDay()->toDateTimeString()) ->where('updated_at', '<=', Carbon::now()->endOfDay()->toDateTimeString()); break; case "thisWeek": return $this->builder->where('updated_at', '>=', Carbon::now()->startOfWeek()->toDateTimeString()) ->where('updated_at', '<=', Carbon::now()->endOfWeek()->toDateTimeString()); break; case "thisMonth": return $this->builder->where('updated_at', '>=', Carbon::now()->startOfMonth()->toDateTimeString()) ->where('updated_at', '<=', Carbon::now()->endOfMonth()->toDateTimeString()); break; case "thisQuarter": return $this->builder->where('updated_at', '>=', Carbon::now()->startOfQuarter()->toDateTimeString()) ->where('updated_at', '<=', Carbon::now()->endOfMonth()->toDateTimeString()); break; case "thisYear": return $this->builder->where('updated_at', '>=', Carbon::now()->startOfYear()->toDateTimeString()) ->where('updated_at', '<=', Carbon::now()->endOfMonth()->toDateTimeString()); break; } } /** * Updated Before * * @param mixed $query * * @return \Illuminate\Database\Eloquent\Builder */ public function updated_before($query) { $date = Carbon::createFromFormat($this->dateFormat, $query); return $this->builder->where('updated_at', '<=', $date->toDateString()); } } <file_sep>/app/Modules/Dashboard/Listeners/RecordSuccessfulLogin.php <?php namespace Raffles\Modules\Dashboard\Listeners; use Raffles\Modules\Dashboard\Repositories\UserTrafficRepository; use Illuminate\Http\Request; use Illuminate\Contracts\Queue\ShouldQueue; use Illuminate\Queue\InteractsWithQueue; use Jenssegers\Agent\Agent; use IP2LocationLaravel; class RecordSuccessfulLogin implements ShouldQueue { /** * The request object. * * @var Request $request */ protected $request; /** * The Agent object. * * @var object $agent */ protected $agent; /** * The UserTraffic repository. * * @var $repository */ protected $repository; /** * Create the event listener. * * @param Request $request The request object. * @param Agent $agent The agent object. * @param UserTrafficRepository $repository The UserTraffic repository. * * @return void */ public function __construct(Request $request, Agent $agent, UserTrafficRepository $repository) { $this->request = $request; $this->agent = $agent; $this->repository = $repository; } /** * Handle the event. * * @param object $event * @return void */ public function handle($event) { $browser = $this->agent->browser(); $device = $this->agent->device(); $deviceType = null; $ip = $this->request->ip(); $platform = $this->agent->platform(); $robot = $this->agent->robot(); if ($this->agent->isDesktop()) { $deviceType = "Desktop"; } if ($this->agent->isPhone()) { $deviceType = "Móvil"; } if ($this->agent->isRobot()) { $deviceType = "Robot"; } if ($this->agent->isTablet()) { $deviceType = "Tablet"; } $records = IP2LocationLaravel::get($ip); $countryCode = $records['countryCode']; $countryName = $records['countryName']; $user = $event->user; $this->repository->create( [ 'browser' => $browser, 'country_code' => $countryCode, 'country_name' => $countryName, 'device' => $device, 'device_type' => $deviceType, 'ip_address' => $ip, 'platform' => $platform, 'robot_name' => $robot, 'token' => $this->request->session()->get('_token'), 'user_id' => $user->id ] ); \Log::info('User with ID '.$user->id.' has logged in.'); } } <file_sep>/app/Http/Controllers/DocumentTypeController.php <?php namespace Raffles\Http\Controllers; use Raffles\Repositories\DocumentTypeRepository; use RafflesArgentina\ResourceController\ApiResourceController; class DocumentTypeController extends ApiResourceController { protected $repository = DocumentTypeRepository::class; protected $resourceName = 'document-types'; } <file_sep>/app/Modules/Dashboard/Http/Controllers/DeviceUsageController.php <?php namespace Raffles\Modules\Dashboard\Http\Controllers; class DeviceUsageController extends UserTrafficController { /** * Handle the incoming request. * * @return \Illuminate\Http\JsonResponse */ public function __invoke() { return $this->validSuccessJsonResponse("Success", $this->getItemsCollection()); } /** * Get items collection. * * @param string $orderBy The order key. * @param string $order The order direction. * * @return \Illuminate\Database\Eloquent\Collection */ public function getItemsCollection($orderBy = 'updated_at', $order = 'desc') { $groupBy = 'device'; return $this->repository->getGroupedCountWithTrashed($groupBy, ['count', $groupBy])->pluck('count', $groupBy); } } <file_sep>/app/Repositories/ContactRepository.php <?php namespace Raffles\Repositories; use Raffles\Models\Contact; use Caffeinated\Repository\Repositories\EloquentRepository; class ContactRepository extends EloquentRepository { /** * @var Model */ public $model = Contact::class; /** * @var array */ public $tag = ['Contact']; } <file_sep>/resources/js/utilities/mixins/gmaps.js export const gmaps = { data() { return { autocomplete: null, bounds: [], circle: null, pickedAddressComponents: { street_number: ["street_number", "short_name"], route: ["street_name", "long_name"], locality: ["locality", "long_name"], administrative_area_level_1: ["state", "short_name"], country: ["country", "long_name"], postal_code: ["zip", "short_name"], sublocality_level_1: ["sublocality", "long_name"], }, geolocation: null, infowindow: null, map: null, marker: null, markers: [], place: null, } }, methods: { fillInAddress() { return new Promise((resolve, reject)=> { if (this.form.address) { // Get the place details from the autocomplete object. this.place = this.autocomplete.getPlace() // Clear and enable the form fields. for (var component in this.pickedAddressComponents) { var addressType = this.pickedAddressComponents[component][0] if (this.form.address[addressType]) { this.form.address[addressType] = "" } var el = document.getElementById(component) if (el) { el.disabled = false } } // Get each component of the address from the place details, // and then fill-in the corresponding field on the form. var addressComponents = this.place.address_components for (var i = 0; i < addressComponents.length; i++) { var addressType = addressComponents[i].types[0] if (this.pickedAddressComponents[addressType]) { var val = addressComponents[i][this.pickedAddressComponents[addressType][1]] component = this.pickedAddressComponents[addressType][0] this.form.address[component] = val } } this.updateFormMapCoordinates(this.place.geometry.location.toJSON()) return resolve(this.form.address) } return reject("There's no address object to fill.") }) }, fitBoundsToVisibleMarkers() { this.bounds = new window.google.maps.LatLngBounds() for (var i=0; i < this.markers.length; i++) { if(this.markers[i].getVisible()) { this.bounds.extend( this.markers[i].getPosition() ) } } this.map.fitBounds(this.bounds) }, geolocate() { return new Promise((resolve, reject)=> { return navigator.geolocation.getCurrentPosition((position, error) => { if (position) { this.geolocation = { lat: position.coords.latitude, lng: position.coords.longitude } this.circle = this.makeCircle( { center: this.geolocation, radius: position.coords.accuracy } ) if (this.autocomplete) { this.autocomplete.setBounds(this.circle.getBounds()) } return resolve(this.geolocation) } return reject(error) }) }) }, initAutocomplete(el = "autocomplete", options = { types: ["geocode"], componentRestrictions: { country: "ar" }}) { // Create the autocomplete object, restricting the search predictions to geographical location types. this.autocomplete = new window.google.maps.places.Autocomplete( document.getElementById(el), options ) // Avoid paying for data that you don't need by restricting the set of // place fields that are returned to just the address components. // Set the data fields to return when the user selects a place. this.autocomplete.setFields(["address_components", "geometry", "icon", "name"]), // When the user selects an address from the drop-down, populate the address fields in the form. this.autocomplete.addListener("place_changed", this.fillInAddress) return Promise.resolve(this.autocomplete) }, initMap(el, options) { this.map = this.makeMap(el, options) if (this.form) { if (this.form.map) { this.map.addListener("zoom_changed", ()=> { this.form.map.zoom = this.map.getZoom() }) } } var markerOptions = { draggable: true, map: this.map, position: options.center } this.marker = this.makeMarker(markerOptions) this.marker.addListener("dragend", (event)=> this.updateFormMapCoordinates(event.latLng.toJSON())) if (this.autocomplete) { // Bind the map's bounds (viewport) property to the autocomplete object, // so that the autocomplete requests use the current map bounds for the // bounds option in the request. this.autocomplete.bindTo("bounds", this.map) this.autocomplete.addListener("place_changed", ()=> { this.marker.setVisible(false) if (!this.place.geometry) { // User entered the name of a Place that was not suggested and // pressed the Enter key, or the Place Details request failed. console.error("No details available for input: '" + this.place.name + "'") } else { // If the place has a geometry, then present it on a map. if (this.place.geometry.viewport) { this.map.fitBounds(this.place.geometry.viewport) } else { this.map.setCenter(this.place.geometry.location) this.map.setZoom(zoom) } this.marker.setPosition(this.place.geometry.location) this.marker.setVisible(true) } }) } return Promise.resolve(this.map) }, makeCircle(options) { return new window.google.maps.Circle(options) }, makeInfowindow(el) { var infowindow = new window.google.maps.InfoWindow() var infowindowContent = document.getElementById(el) infowindow.setContent(infowindowContent) return infowindow }, makeMap(el, options) { return new window.google.maps.Map(document.getElementById(el), options) }, makeMarker(options) { var marker = new window.google.maps.Marker(options) this.markers.push(marker) return marker }, updateFormMapCoordinates(coordinates) { if (this.form.map) { this.form.map.lat = coordinates.lat this.form.map.lng = coordinates.lng } } } } <file_sep>/app/Modules/Dashboard/Resources/Javascript/store/modules/users/users.js import actions from "./actions" import getters from "./getters" import mutations from "./mutations" export function initialState() { return { active: {}, all: [], count: 0, created: [], error: {}, scopesAll: [], scopeMappedTags: [], one: { email: "", first_name: "", last_name: "", password: "" } } } export const state = { initialState: initialState(), ...initialState() } export default { actions, getters, mutations, state } <file_sep>/app/Http/Controllers/Auth/SocialLoginController.php <?php namespace Raffles\Http\Controllers\Auth; use Raffles\Models\User; use Illuminate\Http\Request; use Illuminate\Auth\Events\Registered; use Laravel\Socialite\Contracts\Factory as Socialite; class SocialLoginController extends LoginController { /** * The Socialite contract. * * @var Socialite $socialite */ protected $socialite; /** * The User model. * * @var User $user */ protected $user; /** * Create a new SocialLoginController instance. * * @param Socialite $socialite The Socialite contract. * @param User $user The User model. * * @return void */ public function __construct(Socialite $socialite, User $user) { parent::__construct(); $this->socialite = $socialite; $this->User = $user; } /** * Redirect the user to the specified provider authentication page. * * @param string $provider The Socialite provider. * @param string $scopes The scopes. * * @return \Illuminate\Http\Response */ public function authenticate($provider, $scopes = null) { return $this->socialite->driver($provider) ->scopes($scopes) ->stateless() ->redirect(); } /** * Handle a social login request to the application. * * @param Request $request The Request object. * @param string|null $provider The Socialite provider. * * @return mixed */ public function login(Request $request) { return $this->sendLoginResponse($request); } /** * Validate the user login request. * * @param \Illuminate\Http\Request $request * @return void * * @throws \Illuminate\Validation\ValidationException */ protected function validateLogin(Request $request) { $request->validate( [ 'code' => 'required', 'state' => 'required', ] ); } /** * Send the response after the user was authenticated. * * @param \Illuminate\Http\Request $request * @return \Illuminate\Http\Response */ protected function sendLoginResponse(Request $request) { \Log::info('asdasdasd'); $provider = $request->provider; $socialUser = $this->socialite->driver($provider)->stateless()->user(); $user = $this->firstOrCreateUser($socialUser); $avatar = $this->firstOrCreateAvatar($user, $socialUser); $this->updateOrCreateSocialLoginProfile($user, $socialUser, $provider); if ($request->wantsJson()) { try { $user->load('permissions', 'roles'); $token = $user->createToken(env('APP_NAME')); $accessToken = $token->accessToken; } catch (\Exception $e) { //return $this->validInternalServerErrorJsonResponse($e, $e->getMessage()); } $data = [ 'token' => $accessToken, 'remember' => $request->remember, 'user' => $user ]; return $this->authenticated($request, $request->user()) ?: $this->validSuccessJsonResponse('Success', $data, $this->redirectPath()); } $sessionKey = "{$provider}_token"; $request->session()->put($sessionKey, $socialUser->token); $this->guard('socialite')->login($user); $request->session()->regenerate(); $this->clearLoginAttempts($request); return $this->authenticated($request, $this->guard()->user()) ?: redirect()->intended($this->redirectPath()); } /** * Get first or create User model. * * @param mixed $socialUser The Socialite User object. * * @return \Illuminate\Database\Eloquent\Model */ protected function firstOrCreateUser($socialUser) { $user = $this->User->firstOrCreate( ['email' => $socialUser->getEmail()], [ 'nickname' => $socialUser->getNickname(), 'first_name' => $socialUser->getName(), ] ); if ($user->wasRecentlyCreated) { event(new Registered($user)); } return $user; } /** * Get first or create Avatar relation. * * @param mixed $user The User model. * @param mixed $socialUser The Socialite User object. * * @return \Illuminate\Database\Eloquent\Model */ protected function firstOrCreateAvatar($user, $socialUser) { $data = ['location' => $socialUser->getAvatar()]; if (!$user->avatar) { return $user->avatar()->create($data); } return $user->avatar()->update($data); } /** * Update or create SocialLoginProfile relation. * * @param mixed $user The User model. * @param mixed $socialUser The Socialite User object. * @param string $provider The Socialite provider. * * @return \Illuminate\Database\Eloquent\Model */ protected function updateOrCreateSocialLoginProfile($user, $socialUser, $provider) { $providerId = "{$provider}_id"; return $user->socialLoginProfile()->updateOrCreate( ['user_id' => $user->id], [$providerId => $socialUser->getId()] ); } } <file_sep>/app/Modules/Dashboard/Resources/Javascript/store/helpers.js import { mapActions, mapState } from "vuex" export const usersComputed = { ...mapState("users", { usersActive: state => state.active, usersCount: state => state.count, usersCreated: state => state.created }) } export const usersMethods = { ...mapActions("users", [ "fetchUsersActive", "fetchUsersCount", "fetchUsersCreated" ]) } export const userTrafficComputed = { ...mapState("userTraffic", { allUserTraffic: state => state.all, userTrafficBrowserUsage: state => state.browserUsage, userTrafficCount: state => state.count, userTrafficDeviceUsage: state => state.deviceUsage, userTrafficDeviceTypeUsage: state => state.deviceTypeUsage, userTrafficGeoUsage: state => state.geoUsage, userTrafficPlatformUsage: state => state.platformUsage }) } export const userTrafficMethods = { ...mapActions("userTraffic", [ "fetchAllUserTraffic", "fetchUserTrafficBrowserUsage", "fetchUserTrafficCount", "fetchUserTrafficDeviceUsage", "fetchUserTrafficDeviceTypeUsage", "fetchUserTrafficGeoUsage", "fetchUserTrafficPlatformUsage", ]) } <file_sep>/app/Modules/Dashboard/Resources/Javascript/store/modules/userTraffic/actions.js import * as types from "@dashboard/store/mutation-types" export default { fetchAllUserTraffic ({ commit }, params) { return window.axios.get("/api/user-traffic", { params: params }) .then(response => { const all = response.data.data commit(types.USER_TRAFFIC_FETCH_ALL, all) return all }) .catch(error => { commit(types.USER_TRAFFIC_ERROR, error) return error }) }, fetchUserTrafficBrowserUsage ({ commit }, params) { return window.axios.get("/api/browser-usage", { params: params }) .then(response => { const all = response.data.data commit(types.USER_TRAFFIC_BROWSER_USAGE, all) return all }) .catch(error => { commit(types.USER_TRAFFIC_ERROR, error) return error }) }, fetchUserTrafficCount ({ commit }, params) { return window.axios.get("/api/user-traffic-count", { params: params }) .then(response => { const all = response.data.data commit(types.USER_TRAFFIC_COUNT, all) return all }) .catch(error => { commit(types.USER_TRAFFIC_ERROR, error) return error }) }, fetchUserTrafficDeviceUsage ({ commit }, params) { return window.axios.get("/api/device-usage", { params: params }) .then(response => { const all = response.data.data commit(types.USER_TRAFFIC_DEVICE_USAGE, all) return all }) .catch(error => { commit(types.USER_TRAFFIC_ERROR, error) return error }) }, fetchUserTrafficDeviceTypeUsage ({ commit }, params) { return window.axios.get("/api/device-type-usage", { params: params }) .then(response => { const all = response.data.data commit(types.USER_TRAFFIC_DEVICE_TYPE_USAGE, all) return all }) .catch(error => { commit(types.USER_TRAFFIC_ERROR, error) return error }) }, fetchUserTrafficGeoUsage ({ commit }, params) { return window.axios.get("/api/geo-usage", { params: params }) .then(response => { const all = response.data.data commit(types.USER_TRAFFIC_GEO_USAGE, all) return all }) .catch(error => { commit(types.USER_TRAFFIC_ERROR, error) return error }) }, fetchUserTrafficPlatformUsage ({ commit }, params) { return window.axios.get("/api/platform-usage", { params: params }) .then(response => { const all = response.data.data commit(types.USER_TRAFFIC_PLATFORM_USAGE, all) return all }) .catch(error => { commit(types.USER_TRAFFIC_ERROR, error) return error }) } } <file_sep>/app/Modules/Dashboard/Http/Controllers/UserController.php <?php namespace Raffles\Modules\Dashboard\Http\Controllers; use Raffles\Modules\Dashboard\Repositories\UserRepository; use RafflesArgentina\ResourceController\ApiResourceController; class UserController extends ApiResourceController { protected $repository = UserRepository::class; protected $resourceName = 'users'; protected $useSoftDeletes = true; /** * Get items collection. * * @param string $orderBy The order key. * @param string $order The order direction. * * @return \Illuminate\Database\Eloquent\Collection */ public function getItemsCollection($orderBy = 'updated_at', $order = 'desc') { return $this->repository->findAll(); } } <file_sep>/resources/js/store/modules/auth/actions.js import { deleteSavedState } from "@/utilities/helpers" import * as types from "../../mutation-types" import axios from "axios" import router from "@/router" export default { init({ commit, dispatch, state }) { commit(types.AUTH_PENDING, true) commit(types.AUTH_TOKEN, state.token) return dispatch("validate") }, login ({ commit, dispatch, getters }, response) { if (getters.isAuthenticated) return dispatch("validate") const token = response.data.token commit(types.AUTH_TOKEN, token) const user = response.data.user commit(types.AUTH_USER, user) commit(types.AUTH_PENDING, false) return response }, logout ({ commit, dispatch }) { var redirect axios.post("/logout") .then(response => { redirect = response.data.redirect || "/" return window.location.href = redirect }) .catch(error => { router.push({ path: redirect }) let data = error.response.data commit(types.AUTH_ERROR, data) return data }) unsetDefaultAuthHeaders() deleteSavedState("auth.token") deleteSavedState("auth.user") commit(types.AUTH_PENDING, false) return dispatch("reset") }, reset ({ commit }) { commit(types.AUTH_RESET) return null }, validate ({ commit, dispatch, state }) { if (!state.user) return null return axios.get("/api/account") .then(response => { const user = response.data.data.user commit(types.AUTH_USER, user) commit(types.AUTH_PENDING, false) return user }) .catch(error => { dispatch("logout") commit(types.AUTH_ERROR, error.message || error) commit(types.AUTH_PENDING, false) return error }) }, } // Helpers export function setDefaultAuthHeaders(token) { axios.defaults.headers.common["Authorization"] = "Bearer " + token } export function unsetDefaultAuthHeaders() { delete axios.defaults.headers.common["Authorization"] } <file_sep>/database/factories/CompanyFactory.php <?php use Faker\Generator as Faker; $factory->define(Raffles\Models\Company::class, function (Faker $faker) { $name = $faker->company; return [ 'companyable_id' => '1', 'companyable_type' => 'Raffles\Models\User', 'description' => $faker->paragraph, 'name' => $name, 'slug' => str_slug($name), ]; }); <file_sep>/app/Models/SocialLoginProfile.php <?php namespace Raffles\Models; use Illuminate\Database\Eloquent\Model; class SocialLoginProfile extends Model { /** * The attributes that are mass assignable. * * @var array */ protected $fillable = [ 'user_id', 'github_id', 'google_id', 'twitter_id', 'facebook_id', 'linkedin_id', ]; /** * Get the user that owns the social login profile. */ public function user() { return $this->belongsTo(User::class); } } <file_sep>/app/Repositories/UserRepository.php <?php namespace Raffles\Repositories; use Raffles\Models\User; use Caffeinated\Repository\Repositories\EloquentRepository; class UserRepository extends EloquentRepository { /** * @var Model */ public $model = User::class; /** * @var array */ public $tag = ['User']; } <file_sep>/resources/js/store/modules/auth/getters.js import { strLimit } from "@/utilities/helpers" export default { authPending (state) { return state.authPending }, isAdmin (state) { var user = state.user if (user) { var roles = user.roles if (roles) { return roles.map(item => item["slug"]).includes("admin") } } return false }, isAuthenticated (state) { return !!state.user }, username (state) { return state.user && undefined !== state.user.email ? strLimit(state.user.email) : "..." } } <file_sep>/app/Http/Controllers/UpdateAccountController.php <?php namespace Raffles\Http\Controllers; use Raffles\Http\Requests\AccountRequest; use Raffles\Repositories\UserRepository; use RafflesArgentina\ResourceController\Traits\FormatsValidJsonResponses; class UpdateAccountController extends Controller { use FormatsValidJsonResponses; /** * Update the account for the authenticated user. * * @param AccountRequest $request The AccountRequest object. * @param UserRepository $repository The UserRepository object. * * @return \Illuminate\Http\JsonResponse */ public function __invoke(AccountRequest $request, UserRepository $repository) { $user = $request->user(); $repository->update($user, $request->all()); return $this->validSuccessJsonResponse('Success', ['user' => $user->refresh()]); } } <file_sep>/resources/js/router/index.js import * as middleware from "./middleware" import Vue from "vue" import VueRouter from "vue-router" Vue.use(VueRouter) const routes = [ { children: [ { beforeEnter: middleware.authRequired, name: "Account", path: "", component: view("Account/PersonalData"), }, { beforeEnter: middleware.authRequired, name: "AuthorizedClientTokens", path: "/account/authorized-client-tokens", component: view("Account/AuthorizedClientTokens"), }, { beforeEnter: middleware.authRequired, name: "PersonalTokens", path: "/account/personal-tokens", component: view("Account/PersonalTokens"), }, { beforeEnter: middleware.authRequired, name: "ClientTokens", path: "/account/client-tokens", component: view("Account/TokenClients"), }, ], component: view("Account/Account"), path: "/account" }, { component: view("Home"), name: "Home", path: "/" }, { component: view("Contact"), name: "Contact", path: "/contact" }, { beforeEnter: middleware.authNotRequired, component: view("auth/Login"), meta: { footer: false }, name: "Login", path: "/login" }, { component: view("socialite/ProviderCallback"), path: "/auth/:provider/callback", }, { component: view("auth/Logout"), meta: { footer: false, }, name: "Logout", path: "/logout" }, { beforeEnter: middleware.authNotRequired, component: view("auth/Register"), meta: { footer: false }, name: "Register", path: "/register" }, { beforeEnter: middleware.authNotRequired, component: view("auth/passwords/Request"), meta: { footer: false }, name: "PasswordRequest", path: "/password/request" }, { beforeEnter: middleware.authNotRequired, component: view("auth/passwords/Reset"), meta: { footer: false }, name: "PasswordReset", path: "/password/reset/:token" }, { name: "InternalServerError", path: "/sorry", component: view("Errors/InternalServerError"), }, { name: "Unauthorized", path: "/unauthorized", component: view("Errors/Unauthorized"), }, { name: "PageNotFound", path: "*", component: view("Errors/PageNotFound"), }, ] /** * Asynchronously load view (Webpack Lazy loading compatible) * * @param {string} name The filename (basename) of the view to load. */ function view(name) { return function(resolve) { require(["./views/" + name + ".vue"], resolve) } } export default new VueRouter({ history: true, mode: "history", routes, scrollBehavior() { return { x: 0, y: 0 }; }, }) <file_sep>/app/Models/Contact.php <?php namespace Raffles\Models; use Illuminate\Database\Eloquent\Model; class Contact extends Model { /** * The attributes that are mass assignable. * * @var array */ protected $fillable = [ 'contactable_id', 'contactable_type', 'email', 'fax', 'mobile', 'phone', 'position', 'website', ]; /** * Get all of the owning contactable models. */ public function contactable() { return $this->morphTo(); } } <file_sep>/database/seeds/DocumentTypesTableSeeder.php <?php use Raffles\Models\DocumentType; use Illuminate\Database\Seeder; class DocumentTypesTableSeeder extends Seeder { /** * Run the database seeds. * * @return void */ public function run() { $types = [ [ 'name' => 'DNI', 'description' => 'Documento Nacional de Identidad', 'slug' => 'dni', ], [ 'id' => '99', 'name' => 'Otro', 'description' => 'Otro no listado', 'slug' => 'otro', ] ]; foreach ($types as $type) { DocumentType::create($type); } } } <file_sep>/database/factories/PhotoFactory.php <?php use Faker\Generator as Faker; $factory->define( Raffles\Models\Photo::class, function (Faker $faker) { $name = $faker->unique()->word; $user = factory(Raffles\Models\User::class)->create(); return [ 'description' => $faker->sentence, 'featured' => rand(0, 1), 'location' => $faker->imageUrl, 'name' => $name, 'photoable_id' => '1', 'photoable_type' => 'Raffles\Models\User', 'slug' => str_slug($name), 'user_id' => $user->id ]; } ); <file_sep>/app/Modules/Dashboard/Resources/Javascript/router/index.js import * as middleware from "@/router/middleware" import { canAccessDashboard } from "./middleware" import multiguard from "vue-router-multiguard" import router from "@/router" router.addRoutes( [ { children: [ { beforeEnter: multiguard([middleware.authRequired, canAccessDashboard]), meta: { footer: false }, name: "Dashboard", path: "", component: view("Admin/Dashboard"), }, ], component: view("Admin/Admin"), meta: { footer: false }, path: "/admin" }, ] ) /** * Asynchronously load view (Webpack Lazy loading compatible) * @param {string} name The filename (basename) of the view to load. */ function view(name) { return function(resolve) { require(["./views/" + name + ".vue"], resolve) } } <file_sep>/resources/js/store/modules/documentTypes/getters.js export default { allDocumentTypesPending (state) { return state.allPending }, oneDocumentTypePending (state) { return state.onePending }, } <file_sep>/database/factories/ArticleCategoryFactory.php <?php use Raffles\Models\User; use Faker\Generator as Faker; $factory->define(Raffles\Models\ArticleCategory::class, function (Faker $faker) { $name = $faker->word; $user = factory(User::class)->create(); return [ 'description' => $faker->paragraph, 'name' => $name, 'slug' => str_slug($name), 'user_id' => $user->id, ]; }); <file_sep>/app/Modules/Dashboard/Sorters/UserSorters.php <?php namespace Raffles\Modules\Dashboard\Sorters; class UserSorters extends BaseSorters {} <file_sep>/app/Repositories/DocumentTypeRepository.php <?php namespace Raffles\Repositories; use Raffles\Models\DocumentType; use Caffeinated\Repository\Repositories\EloquentRepository; class DocumentTypeRepository extends EloquentRepository { /** * @var Model */ public $model = DocumentType::class; /** * @var array */ public $tag = ['DocumentType']; } <file_sep>/database/factories/ArticleFactory.php <?php use Raffles\Models\User; use Faker\Generator as Faker; $factory->define(Raffles\Models\Article::class, function (Faker $faker) { $title = $faker->sentence; $user = factory(User::class)->create(); return [ 'body' => $faker->paragraph, 'published' => rand(0,1), 'published_at' => \Carbon\Carbon::now(), 'slug' => str_slug($title), 'title' => $title, 'user_id' => $user->id, ]; }); <file_sep>/app/Modules/Dashboard/Routes/api.php <?php /* |-------------------------------------------------------------------------- | API Routes |-------------------------------------------------------------------------- | | Here is where you can register API routes for your module. These | routes are loaded by the RouteServiceProvider within a group which | is assigned the "api" middleware group. Enjoy building your API! | */ Route::get('browser-usage', 'BrowserUsageController'); Route::get('device-usage', 'DeviceUsageController'); Route::get('device-type-usage', 'DeviceTypeUsageController'); Route::get('geo-usage', 'GeoUsageController'); Route::get('platform-usage', 'PlatformUsageController'); Route::get('user-traffic-count', 'UserTrafficCountController'); Route::get('users-active', 'UserActiveController'); Route::get('users-count', 'UserCountController'); Route::get('users-created', 'UserCreatedController'); Route::apiResource('user-traffic', 'UserTrafficController'); Route::apiResource('user-traffic-count', 'UserTrafficCountController'); <file_sep>/app/Models/User.php <?php namespace Raffles\Models; use Raffles\Models\Traits\UserTrait; use Caffeinated\Shinobi\Traits\ShinobiTrait; use Illuminate\Database\Eloquent\SoftDeletes; use Illuminate\Notifications\Notifiable; use Illuminate\Contracts\Auth\MustVerifyEmail; use Illuminate\Foundation\Auth\User as Authenticatable; use Laravel\Passport\HasApiTokens; class User extends Authenticatable { use HasApiTokens, Notifiable, ShinobiTrait, SoftDeletes, UserTrait; /** * The accessors to append to the model's array form. * * @var array */ protected $appends = [ 'name' ]; /** * The attributes that should be mutated to dates. * * @var array */ protected $dates = ['deleted_at']; /** * The attributes that are mass assignable. * * @var array */ protected $fillable = [ 'email', 'first_name', 'last_name', 'password', 'slug' ]; /** * The attributes that should be hidden for arrays. * * @var array */ protected $hidden = [ 'password', 'remember_token', ]; /** * The relations to eager load on every query. * * @var array */ protected $with = 'avatar'; /** * Get the user's address. */ public function address() { return $this->morphOne(Address::class, 'addressable'); } /** * Get the user's addresses. */ public function addresses() { return $this->morphMany(Address::class, 'addressable'); } /** * Get the user's companies. */ public function companies() { return $this->hasMany(Company::class); } /** * Get the user's contact. */ public function contact() { return $this->morphOne(Contact::class, 'contactable'); } /** * Get the user's contacts. */ public function contacts() { return $this->hasMany(Contact::class); } /** * Get the user's avatar. */ public function avatar() { return $this->morphOne(FeaturedPhoto::class, 'photoable')->withDefault(); } /** * Get the user's featured address. */ public function featured_address() { return $this->morphOne(FeaturedAddress::class, 'addressable'); } /** * Get the user's photos. */ public function photos() { return $this->hasMany(Photo::class); } /** * Get the social login profile record associated with the user. */ public function socialLoginProfile() { return $this->hasOne(SocialLoginProfile::class); } /** * Get the user's unfeatured address. */ public function unfeatured_address() { return $this->morphOne(UnfeaturedAddress::class, 'addressable'); } } <file_sep>/app/Modules/Dashboard/Resources/Javascript/store/modules/users/actions.js import * as types from "@dashboard/store/mutation-types" export default { fetchUsersActive ({ commit }, params) { return window.axios.get("/api/users-active", { params: params }) .then(response => { const all = response.data.data commit(types.USERS_ACTIVE, all) return all }) .catch(error => { commit(types.USERS_ERROR, error) return error }) }, fetchUsersCount ({ commit }, params) { return window.axios.get("/api/users-count", { params: params }) .then(response => { const all = response.data.data commit(types.USERS_COUNT, all) return all }) .catch(error => { commit(types.USERS_ERROR, error) return error }) }, fetchUsersCreated ({ commit }, params) { return window.axios.get("/api/users-created", { params: params }) .then(response => { const all = response.data.data commit(types.USERS_CREATED, all) return all }) .catch(error => { commit(types.USERS_ERROR, error) return error }) }, } <file_sep>/app/Modules/Dashboard/Repositories/UserRepository.php <?php namespace Raffles\Modules\Dashboard\Repositories; use Raffles\Modules\Dashboard\Models\User; class UserRepository extends BaseRepository { /** * @var Model */ public $model = User::class; /** * @var array */ public $tag = ['User']; } <file_sep>/app/Modules/Dashboard/Resources/Javascript/store/modules/userTraffic/mutations.js import * as types from "../../mutation-types" export default { [types.USER_TRAFFIC_COUNT] (state, payload) { state.count = payload }, [types.USER_TRAFFIC_ERROR] (state, payload) { state.error = JSON.stringify(payload) }, [types.USER_TRAFFIC_FETCH_ALL] (state, payload) { state.all = payload }, [types.USER_TRAFFIC_BROWSER_USAGE] (state, payload) { state.browserUsage = payload }, [types.USER_TRAFFIC_DEVICE_USAGE] (state, payload) { state.deviceUsage = payload }, [types.USER_TRAFFIC_DEVICE_TYPE_USAGE] (state, payload) { state.deviceTypeUsage = payload }, [types.USER_TRAFFIC_GEO_USAGE] (state, payload) { state.geoUsage = payload }, [types.USER_TRAFFIC_PLATFORM_USAGE] (state, payload) { state.platformUsage = payload }, } <file_sep>/app/Models/Address.php <?php namespace Raffles\Models; use Raffles\Models\Traits\AddressTrait; use Illuminate\Database\Eloquent\Model; class Address extends Model { use AddressTrait; /** * The accessors to append to the model's array form. * * @var array */ protected $appends = [ 'location', ]; /** * The attributes that are mass assignable. * * @var array */ protected $fillable = [ 'addressable_id', 'addressable_type', 'country', 'door_number', 'featured', 'floor_number', 'lat', 'lng', 'locality', 'state', 'street_name', 'street_number', 'sublocality', 'zip', ]; /** * The relations to eager load on every query. * * @var array */ protected $with = 'map'; /** * Get all of the owning addressable models. */ public function addressable() { return $this->morphTo(); } /** * Get the address's map. */ public function map() { return $this->morphOne(Map::class, 'mapable'); } } <file_sep>/app/Repositories/PhotoRepository.php <?php namespace Raffles\Repositories; use Raffles\Models\Photo; use Caffeinated\Repository\Repositories\EloquentRepository; class PhotoRepository extends EloquentRepository { /** * @var Model */ public $model = Photo::class; /** * @var array */ public $tag = ['Photo']; } <file_sep>/resources/js/store/modules/documentTypes/mutations.js import * as types from "../../mutation-types" import { initialState } from "./documentTypes" export default { [types.DOCUMENT_TYPES_DELETE_ONE] () {}, [types.DOCUMENT_TYPES_ERROR] (state, payload) { state.error = JSON.stringify(payload) }, [types.DOCUMENT_TYPES_FETCH_ALL] (state, payload) { state.all = payload }, [types.DOCUMENT_TYPES_FETCH_ALL_PENDING] (state, payload) { state.allPending = payload }, [types.DOCUMENT_TYPES_FETCH_ONE] (state, payload) { state.one = Object.freeze(payload) }, [types.DOCUMENT_TYPES_FETCH_ONE_PENDING] (state, payload) { state.onePending = payload }, [types.DOCUMENT_TYPES_RESET] (state) { Object.assign(state, { initialState: initialState(), ...initialState() }) } } <file_sep>/app/Modules/Dashboard/Resources/Javascript/utilities/presets.js export const DATE_RANGES = { "30days": "30 días", "60days": "60 días", "365days": "365 días", "today": "Hoy", "thisWeek": "Esta semana", "thisMonth": "Este mes", "thisQuarter": "Este trimestre", "thisYear": "Este año", } <file_sep>/app/Modules/Dashboard/Repositories/UserTrafficRepository.php <?php namespace Raffles\Modules\Dashboard\Repositories; use Raffles\Modules\Dashboard\Models\UserTraffic; class UserTrafficRepository extends BaseRepository { /** * @var Model */ public $model = UserTraffic::class; /** * @var array */ public $tag = ['UserTraffic']; }
9ac1b8edcaa7212e7182be23f5c4f3f3f31f7237
[ "JavaScript", "PHP", "Shell" ]
65
PHP
rafflesargentina/l57-enterprise-boilerplate
f6055f6c258a7ad8d1efdcbb073e1849968b660d
48c85fea7740d2bd9d8fb5eea4577638f17ebb80
refs/heads/master
<repo_name>sheinker/Google-project-autoComplete<file_sep>/offline/data.py import json import os import pickle from collections import defaultdict from itertools import combinations from offline.autoCompleteData import AutoCompleteData sent_dict = {} bad_chars = [';', ':', '-', '!', '*', ',', '$', '@'] data = defaultdict(set) # best_sen = defaultdict(int) objects_list = [] class SetEncoder(json.JSONEncoder): def default(self, obj): if isinstance(obj, set): return list(obj) return json.JSONEncoder.default(self, obj) def read_file(): for root, dirs, files in os.walk("../my_files/python-3.8.4-docs-text/", topdown=True): for file in files: if file.endswith(".txt"): with open(os.path.join(root, file), encoding="utf8") as my_file: sentences_list = my_file.read().split("\n") for index, item in enumerate(sentences_list): # sent_dict[index] = AutoCompleteData(item, file, index) objects_list.append(AutoCompleteData(item, file, index + 1)) with open('sentences.pkl', 'wb') as sentences: pickle.dump(objects_list, sentences) def init_data(): for index, sentence in sent_dict.items(): count = 0 substr_list = [sentence.completed_sentence[x:y] for x, y in combinations(range(len(sentence.completed_sentence) + 1), r=2)] for substr in substr_list: for char in bad_chars: substr = substr.replace(char, '') if not substr.startswith(" ") and not substr.endswith(" "): if count < 5: data[substr.lower()].add(index) count += 1 with open("data.json", "w") as f: json.dump(data, f, cls=SetEncoder) def print_data(): for item in data: print(f'{item}: {data[item]}') read_file() init_data() <file_sep>/online/autoComplete.py import string from collections import defaultdict from string import ascii_lowercase from online.load import data_, sentences_ best_sen = defaultdict(int) def get_data_at_key(key): key = key.lower() sentences = [] for k in data_[key]: sentences.append(sentences_[k]) return sentences def get_five_best_sentences(sub_str): best_sentences_dict = {} best_sentences = get_data_at_key(sub_str) for item in best_sentences: item.score = 2 * len(sub_str) if len(best_sentences) >= 5: return best_sentences[:5] else: result = replace_char(sub_str) for i in result: best_sen[i] = i.score result = delete_unnecessary_char(sub_str) for i in result: best_sen[i] = i.score result = add_missed_char(sub_str) for i in result: best_sentences_dict[i] = i.score a = set(sorted(best_sen, key=best_sentences_dict.get, reverse=False)) a = set(best_sentences).union(a) return list(a)[:5] def get_best_k_completions(sub_str): return get_five_best_sentences(sub_str) def get_sentence_score(sentence): x = 0 if sentence in data_.keys(): x = len(sentence) * 2 return max(x, replace_char(sentence)[1], delete_unnecessary_char(sentence)[1], add_missed_char(sentence)[1]) def replace_char(word): for index, char in enumerate(word): for letter in ascii_lowercase: if char != letter: new_word = word[:index] + letter + word[index+1:] if new_word in data_.keys(): score = (5 - index) if index < 5 else 1 score = (len(word) * 2) - score result = get_data_at_key(new_word) for item in result: item.score = 0 if item not in best_sen: item.score = score return result return [] def delete_unnecessary_char(word): for index in range(1, len(word)-1): new_word = word[:index] + word[index + 1:] if new_word in data_.keys(): score = (10 - 2 * index) if index < 4 else 2 score = (len(word) * 2) - score result = get_data_at_key(new_word) for item in result: item.score = 0 if item not in best_sen: item.score = score return result return [] def add_missed_char(word): for index, char in enumerate(word): for letter in string.printable: new_word = word[:index] + letter + word[index:] if new_word in data_.keys(): score = (10 - 2 * index) if index < 4 else 2 score = (len(word) * 2) - score print(score) result = get_data_at_key(new_word) for item in result: item.score = 0 if item not in best_sen: item.score = score return result return []<file_sep>/online/main.py from online.autoComplete import get_best_k_completions if __name__ == '__main__': text = input("The system is ready, Enter your text: ") while True: if not text or "#" == text[-1]: print("Enter your text:") text = input() result = get_best_k_completions(text) i = len(result) print(f"There are {i} suggestions:") for index, item in enumerate(result): print(f'{index + 1}. {item.get_completed_sentence()} ({item.get_source_text()} {item.get_offset()})') print(text, end="") text += input()<file_sep>/online/GUI.py import PySimpleGUI as sg from online.autoComplete import get_best_k_completions def searchButton(command): result = pg.get_best_k_completions(values[0]) i = len(result) print(f"There are {i} suggestions:") for index, item in enumerate(result): print(f'{index + 1}. {item.get_completed_sentence()} ({item.get_source_text()} {item.get_offset()})') sg.theme('lightGreen') # Add a touch of color # All the stuff inside your window. layout = [[sg.Text('Hello to AutoComplete Search', size=(30, 1))], [sg.Text('Enter your text:', size=(15, 1)), sg.InputText(focus=True), sg.Button('Search', bind_return_key=True)], # [sg.Output(size=(80, 10))], [sg.Output(size=(80, 10))], [sg.Button('Cancel')]] window = sg.Window('AutoComplete', layout) # pg.read_file() # pg.init_data() while True: event, values = window.read() if event == sg.WIN_CLOSED or event == 'Cancel': # if user closes window or clicks cancel break if event == 'Search': searchButton(values[0]) window.close() # import PySimpleGUI as sg # import time # # def excecutetest(command): # for i in range(5): # print (command + str(i)) # time.sleep(2) # # layout = [ # [sg.Text('Information:', size=(40, 1))], # [sg.Output(size=(88, 20))], # [sg.Text('Input:', size=(15, 1)), sg.InputText(focus=True), sg.Button('Run', bind_return_key=True)], # [sg.Button('EXIT')] # ] # # window = sg.Window('testing', layout) # # # ---===--- Loop taking in user input and using it to call scripts --- # # # while True: # (event, value) = window.Read() # if event == 'EXIT' or event is None: # break # exit button clicked # if event == 'Run': # excecutetest(value[0]) # window.Close() <file_sep>/README.md # google-project-sheinker <file_sep>/online/load.py import json import pickle def load_text_sources(): print("Loading the files and preparing the system...") with open("../offline/data.json", "r") as data_file: data = json.load(data_file) with open("../offline/sentences.pkl", "rb") as sentences_file: sentences = pickle.load(sentences_file) return data, sentences data_, sentences_ = load_text_sources()
86068985a993ee690b1eb6fb83087773ce1b2dd2
[ "Markdown", "Python" ]
6
Python
sheinker/Google-project-autoComplete
f990412b87ad3691225b82e3dfec3b1958a5bb0b
f4276f747fee90edade4c7411857e65faf782c40
refs/heads/master
<repo_name>element114/e114_core<file_sep>/Cargo.toml [package] name = "e114_core" version = "0.3.1-alpha.0" authors = ["<NAME> <<EMAIL>>"] edition = "2018" repository = "https://github.com/element114/e114_core" documentation = "https://docs.rs/e114_core" license = "MIT OR Apache-2.0" description = "A convenient wrapper around several rust web frameworks to isolate business logic from protocol handling." publish = true # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] serde = { version = "1.*", features = ["derive"] } serde_json = "1.*" # this crate is compatible with schemars 0.6.* and 0.7.* schemars = { version = ">=0.6", optional = true } log = ">=0.4" # this crate is compatible with http 0.2.* only http = ">=0.2.*" # this crate is compatible with actix-web 3.* only actix-web = { version = ">=3.0", optional = true } hyper = { version = ">=0.11", optional = true } http-serde = "1.0.3" [features] default = [] jsonschema = ["schemars"] actix_web = ["actix-web"] hyper_body = ["hyper"] [dev-dependencies] schemars = { version = ">=0.6" } [package.metadata.docs.rs] all-features = true <file_sep>/src/hyper/mod.rs use crate::responses::WebResult; use http::{Response, StatusCode}; use hyper::Body; #[allow(clippy::use_self)] impl From<WebResult> for Response<Body> { #[must_use] fn from(res: WebResult) -> Self { match res { WebResult::Ok(v) => { let mut resp_builder = Response::builder(); if let Some(total) = &v.get("full_count") { resp_builder = resp_builder.header("X-Total-Count", total.to_string()); } resp_builder.body(Body::from(serde_json::to_string(&v).unwrap())).unwrap() } WebResult::Err(e) => e .errors .iter() .max_by_key(|e| e.status) .map_or_else( || Response::builder().status(StatusCode::INTERNAL_SERVER_ERROR), |large_error| Response::builder().status(large_error.status), ) .body(Body::from(serde_json::to_string(&e).unwrap())) .unwrap(), } } } <file_sep>/src/lib.rs #![forbid(unsafe_code)] #![warn(clippy::pedantic)] #[cfg(feature = "actix_web")] pub mod actix_web; #[cfg(feature = "hyper")] pub mod hyper; pub mod responses; pub mod typed; #[cfg(feature = "jsonschema")] use schemars::JsonSchema; use serde::{Deserialize, Serialize}; /// Skip as many entires as specified in @offset, default 0. /// List at most as many entries as specified in @limit, default 100. #[cfg_attr(feature = "jsonschema", derive(JsonSchema))] #[derive(Debug, Serialize, Deserialize, Clone)] pub struct ListOptions { pub offset: Option<u64>, pub limit: Option<u64>, pub order: Option<ListOrder>, pub sort: Option<String>, } impl Default for ListOptions { #[must_use] fn default() -> Self { Self { offset: None, limit: Some(100), order: None, sort: None } } } #[cfg_attr(feature = "jsonschema", derive(JsonSchema))] #[derive(Debug, Serialize, Deserialize, Clone)] pub enum ListOrder { #[serde(alias = "ASC", alias = "asc")] Asc, #[serde(alias = "DESC", alias = "desc")] Desc, } <file_sep>/src/actix_web/mod.rs use crate::responses::WebResult; use actix_web::HttpResponse; use http::StatusCode; impl From<WebResult> for HttpResponse { #[must_use] fn from(res: WebResult) -> Self { match res { WebResult::Ok(v) => { let mut resp_builder = Self::Ok(); if let Some(total) = &v.get("full_count") { resp_builder.set_header("X-Total-Count", total.to_string()); } resp_builder.json(&v) } WebResult::Err(e) => e .errors .iter() .max_by_key(|e| e.status) .map_or_else( || Self::build(StatusCode::INTERNAL_SERVER_ERROR), |large_error| Self::build(large_error.status), ) .json(&e), } } } <file_sep>/README.md # E114 core is the lowest layer in the e114 architecture It provides the `WebResult` type to be returned by business logic functions. It provides standardized error structs based on `JSONAPI#Error` format. It also contains the web framework connectors (feature gated), because in rust either the type or the trait should be in your crate in order to be able to implement it. This crate is: ```rust #![forbid(unsafe_code)] #![warn(clippy::pedantic)] ``` # This crate implements JSONAPI#Error format https://jsonapi.org/format/#errors ## Optional features ```toml e114_core = { version = "0.3.0", features = ["jsonschema"] } ``` Adds `#[derive(JsonSchema)]` to certain types and the `schemars` dependency. ```toml e114_core = { version = "0.3.0", features = ["actix_web"] } ``` Adds `actix-web` `From` impl for `WebResult` and the `actix-web` dependency. ```toml e114_core = { version = "0.3.0", features = ["hyper_body"] } ``` Adds `http::Response<hyper::Body>` impl for `WebResult` and the `hyper` dependency. This is intended to be used by `warp` and other frameworks which are built on `http` and `hyper`. ## Minimum rust version 1.50.0 ## Build, debug and release tools - cargo fmt & cargo +1.50.0 clippy --tests --features actix_web,hyper_body,jsonschema <file_sep>/src/responses.rs use http::StatusCode; use serde::Serialize; use serde_json::Value; #[cfg(feature = "jsonschema")] use schemars::JsonSchema; /// `WebResult` is a type that represents either success ([`Ok`]) or failure ([`Err`]). /// This type exists to implement glue code for various web frameworks and. /// /// [`Ok`]: enum.Result.html#variant.Ok /// [`Err`]: enum.Result.html#variant.Err #[derive(Debug)] #[must_use = "this `Result` may be an `Err` variant, which should be handled"] pub enum WebResult { /// Contains the success value Ok(Value), /// Contains the error value Err(ErrorResponse), } impl From<Result<Value, ErrorResponse>> for WebResult { fn from(res: Result<Value, ErrorResponse>) -> Self { match res { Ok(v) => Self::Ok(v), Err(e) => Self::Err(e), } } } #[cfg_attr(feature = "jsonschema", derive(JsonSchema))] #[derive(Debug, Clone, Serialize)] #[cfg_attr(feature = "jsonschema", schemars(transparent))] pub struct JsObj { #[serde(flatten)] properties: serde_json::Map<String, Value>, } /// # Panics /// /// Panics if `v.as_object()` fails. impl From<Value> for JsObj { #[must_use] fn from(value: Value) -> Self { JsObj { properties: value.as_object().unwrap().clone() } } } /// The standard singular Error object as per <https://jsonapi.org/format/#error-objects>. #[cfg_attr(feature = "jsonschema", derive(JsonSchema))] #[derive(Debug, Clone, Serialize, Default)] pub struct ErrorWithMessage { /// A human-readable explanation specific to this occurrence of the problem. /// Like `title`, this field's value can be localized. /// /// This used to be `message` pre `0.3`. #[serde(skip_serializing_if = "String::is_empty", default)] pub detail: String, /// A short, human-readable summary of the problem that SHOULD NOT change from occurrence to occurrence of the problem, except for purposes of localization. /// /// This used to be `error_type` pre `0.3`. #[serde(skip_serializing_if = "Option::is_none", default)] pub title: Option<String>, /// A meta object containing non-standard meta-information about the error. /// <https://jsonapi.org/format/#document-meta> /// /// This used to be `value` pre `0.3`. #[serde(skip_serializing_if = "Option::is_none", default)] pub meta: Option<JsObj>, /// A unique identifier for this particular occurrence of the problem. #[serde(skip_serializing_if = "Option::is_none", default)] pub id: Option<String>, /// A links object containing at least an `about` member. /// Not supported at the moment. #[serde(skip_serializing_if = "Option::is_none", default)] pub links: Option<JsObj>, /// The HTTP status code applicable to this problem, expressed as a string value. /// /// This used to be `code` pre `0.3` on the removed `Response` object. #[cfg_attr(feature = "jsonschema", schemars(with = "String"))] #[serde( serialize_with = "http_serde::status_code::serialize", deserialize_with = "http_serde::status_code::deserialize", default )] pub status: StatusCode, /// An application-specific error code, expressed as a string value. #[serde(skip_serializing_if = "Option::is_none", default)] pub code: Option<String>, /// An object containing references to the source of the error, optionally including any of the following members: /// - pointer: a JSON Pointer [RFC6901] to the associated entity in the request document [e.g. "/data" for a primary data object, or "/data/attributes/title" for a specific attribute]. /// - parameter: a string indicating which URI query parameter caused the error. /// /// Not supported at the moment. #[serde(skip_serializing_if = "Option::is_none", default)] pub source: Option<JsObj>, } impl ErrorWithMessage { #[must_use] pub fn new(message: String) -> Self { Self { detail: message, status: StatusCode::INTERNAL_SERVER_ERROR, ..Self::default() } } #[must_use] pub fn str(msg: &str) -> Self { Self { detail: msg.to_owned(), status: StatusCode::INTERNAL_SERVER_ERROR, ..Self::default() } } /// # Panics /// /// Panics if `v.as_object()` fails. #[must_use] pub fn json(message: String, v: &Value) -> Self { Self { detail: message, meta: Some(JsObj { properties: v.as_object().unwrap().clone() }), ..Self::default() } } } /// Error objects MUST be returned as an array keyed by errors in the top level of a `JSON:API`. /// <https://jsonapi.org/format/#errors> #[cfg_attr(feature = "jsonschema", derive(JsonSchema))] #[derive(Debug, Clone, Serialize)] pub struct ErrorResponse { pub errors: Vec<ErrorWithMessage>, } impl From<ErrorWithMessage> for ErrorResponse { #[must_use] fn from(mv: ErrorWithMessage) -> Self { ErrorResponse { errors: vec![mv] } } } #[cfg(test)] mod tests { #[allow(unused_imports)] use super::ErrorWithMessage; #[cfg(feature = "jsonschema")] use schemars::schema_for; #[test] fn test_message_value_schema() { #[cfg(feature = "jsonschema")] { let schema = schema_for!(ErrorWithMessage); println!("{}", serde_json::to_string_pretty(&schema).unwrap()); assert_eq!( serde_json::json!({ "$schema": "http://json-schema.org/draft-07/schema#", "title": "ErrorWithMessage", "description": "The standard singular Error object as per <https://jsonapi.org/format/#error-objects>.", "type": "object", "properties": { "code": { "description": "An application-specific error code, expressed as a string value.", "type": [ "string", "null" ] }, "detail": { "description": "A human-readable explanation specific to this occurrence of the problem. Like `title`, this field's value can be localized.\n\nThis used to be `message` pre `0.3`.", "type": "string" }, "id": { "description": "A unique identifier for this particular occurrence of the problem.", "type": [ "string", "null" ] }, "links": { "description": "A links object containing at least an `about` member. Not supported at the moment.", "type": [ "object", "null" ], "additionalProperties": true }, "meta": { "description": "A meta object containing non-standard meta-information about the error. <https://jsonapi.org/format/#document-meta>\n\nThis used to be `value` pre `0.3`.", "type": [ "object", "null" ], "additionalProperties": true }, "source": { "description": "An object containing references to the source of the error, optionally including any of the following members: - pointer: a JSON Pointer [RFC6901] to the associated entity in the request document [e.g. \"/data\" for a primary data object, or \"/data/attributes/title\" for a specific attribute]. - parameter: a string indicating which URI query parameter caused the error.\n\nNot supported at the moment.", "type": [ "object", "null" ], "additionalProperties": true }, "status": { "description": "The HTTP status code applicable to this problem, expressed as a string value.\n\nThis used to be `code` pre `0.3` on the removed `Response` object.", "default": 200, "type": "string" }, "title": { "description": "A short, human-readable summary of the problem that SHOULD NOT change from occurrence to occurrence of the problem, except for purposes of localization.\n\nThis used to be `error_type` pre `0.3`.", "type": [ "string", "null" ] } } }), serde_json::json!(&schema) ); } } } <file_sep>/src/typed.rs /// # Panics /// /// Panics if `T` can not be formatted as String. pub fn get_type_name<T>(it_is: &T) -> String where T: std::fmt::Debug, { let nm = format!("{:?}", it_is); nm.split_whitespace().next().unwrap().to_owned() } #[cfg(test)] mod tests { use super::get_type_name; #[derive(Debug)] struct Zed(); #[derive(Debug)] struct SuperZed { my_name: String, } #[test] fn test_get_type_name() { let z = Zed(); assert_eq!("Zed", get_type_name(&z)); let sz = SuperZed { my_name: "My name is Zed!".to_owned() }; assert_eq!("SuperZed", get_type_name(&sz)); } }
0226c09c4018034e91ec46e964760be303c0437e
[ "TOML", "Rust", "Markdown" ]
7
TOML
element114/e114_core
dbd18fa428cec50237ba0c566ce3e37383e86225
167b308665ed6d178da2a10ef0e37b8e62a67f94
refs/heads/master
<file_sep># JQuery-RPG Browser RPG game using Javascript opjects and JQuery to dynamically populate page elements. <file_sep>$(document).ready(function() { $("#result").html("Street Fighter"); $(".newGame").hide(); var characterPicked; var enemyPicked; var enemyBattling = false; var playerWon; var enemies = []; var ryu = { name: "ryu", display: "Ryu", health: 120, attack: 5, baseAttack: 5, counterAttack: 12, iconPath: "assets/images/RyuSelect.jpg", charSpritePath: "assets/images/sprites/Ryu.gif", enemySpritePath: "assets/images/sprites/Ryu2.gif" } var ken = { name: "ken", display: "Ken", health: 80, attack: 9, baseAttack: 9, counterAttack: 13, iconPath: "assets/images/KenSelect.jpg", charSpritePath: "assets/images/sprites/Ken.gif", enemySpritePath: "assets/images/sprites/Ken2.gif" } var chunli = { name: "chunli", display: "<NAME>", health: 54, attack: 16, baseAttack: 16, counterAttack: 20, iconPath: "assets/images/ChunSelect.jpg", charSpritePath: "assets/images/sprites/ChunLi.gif", enemySpritePath: "assets/images/sprites/ChunLi2.gif" } var mbison = { name: "mbison", display: "<NAME>", health: 200, attack: 2, baseAttack: 2, counterAttack: 11, iconPath: "assets/images/BisonSelect.jpg", charSpritePath: "assets/images/sprites/Bison.gif", enemySpritePath: "assets/images/sprites/Bison2.gif" } var characters = [ryu, ken, chunli, mbison]; $(".playerCharPick").on("click", function() { characterPicked = eval($(this).data("obj")); $("#playerCharArea").append('<img src="'+ characterPicked.charSpritePath + '" class="image" data-obj="' + characterPicked.name + '">'); $("#playerCharArea").show(); updatePlayerStats(); $("#playerCharSelection").empty(); $("#result").html(""); for (i=0;i<characters.length;i++) { if (characters[i].name !== characterPicked.name) { $("#enemyCharSelection").append('<div class = "col-md-3 cont"><img src="' + characters[i].iconPath + '" class="enemyCharPick" data-obj="' + characters[i].name + '"></div>'); } } }); $("#enemyCharSelection").on("click", ".enemyCharPick", function() { $(".newGame").show(); if (!enemyBattling) { enemyPicked = eval($(this).data("obj")); $("#enemyCharArea").append('<img src="'+ enemyPicked.enemySpritePath + '" class="image" id="enemyChar" data-obj="' + enemyPicked.name + '">'); $("#enemyCharArea").show(); updateEnemyStats(); $("#attack").show(); $(this).hide(); enemies.push(enemyPicked); enemyBattling = true; } }); $(".attack").on("click", function() { // Player attacks enemy, enemy loses health equal to player attk // Player attack increases by base amount // If enemy is not dead, enemy counter attacks, player loses health equal to enemy counter attk if (enemyBattling == true) { enemyPicked.health -= characterPicked.attack; characterPicked.attack += characterPicked.baseAttack; updateEnemyStats(); if (enemyPicked.health <= 0) { //Checks to see if enemy has been defeated $("#enemyChar").remove(); $("#enemyName").html(""); $("#enemyHealth").html(""); enemyBattling = false; if (enemies.length == 3) { //Once all 3 enemies have been fought var enemyLiving = false; for (i=0; i<enemies.length;i++) { if (enemies[i].health > 0) { enemyLiving = true; } } if (enemyLiving == false) { //Once all 3 enemies have 0 health playerWon = true; $("#result").html("Player 1 Wins!"); $(".attack").hide(); } } } else { characterPicked.health -= enemyPicked.counterAttack; updatePlayerStats(); if (characterPicked.health <= 0) { //Checks to see if player has been defeated playerLoss = false; $("#result").html("CPU Wins"); $(".attack").hide(); } } } else { alert("Please select another enemy"); } }); $(".newGame").on("click", function() { location.reload(); }); function updatePlayerStats() { $("#playerHealth").html("HP: " + characterPicked.health + "<br />Attack: " + characterPicked.attack); $("#playerName").html(characterPicked.display); } function updateEnemyStats() { $("#enemyHealth").html("HP: " + enemyPicked.health + "<br />Attack: " + enemyPicked.attack); $("#enemyName").html(enemyPicked.display); } })
5532c51b8f2aceb95849a81c1d410f796df9d296
[ "Markdown", "JavaScript" ]
2
Markdown
tygee713/week-4-game
1a5fc4e3fa24ed2d52ae68991b9989c358f3a028
794fe1a6d8bd026af522ec683b395090132b93d6
refs/heads/master
<file_sep>database.path="test/Invoices" spring.jpa.hibernate.ddl-auto=create-drop<file_sep>package pl.coderstrust.db.impl.memory.SQL.InvoiceItem; import org.junit.Test; public class InvoiceItemControllerTest { @Test public void getInvoiceItems() throws Exception { } @Test public void getInvoiceItemByIdentificationNumber() throws Exception { } @Test public void deleteInvoiceItemById() throws Exception { } @Test public void getInvoiceItemByDescription() throws Exception { } @Test public void deleteInvoiceItemByDescription() throws Exception { } @Test public void updateInvoiceItem() throws Exception { } @Test public void insertInvoiceItem() throws Exception { } }<file_sep>package pl.coderstrust.db.impl.memory.SQL.Company; import org.junit.Test; public class CompanyControllerTest { @Test public void getCompanies() throws Exception { } @Test public void getCompanyByVatIdentificationNumber() throws Exception { } @Test public void deleteCompanyById() throws Exception { } @Test public void getCompanyByName() throws Exception { } @Test public void deleteCompanyByName() throws Exception { } @Test public void updateCompanyName() throws Exception { } @Test public void insertCompany() throws Exception { } }
d3b2148fc5082dd63fcea094326bc7f6e27a28d2
[ "Java", "INI" ]
3
INI
wbogdal/Accounting-System
48c794d969b9c75aed5968857becce6b7a5f946a
4465b15f75ddd22d0b748e3319c97af4fe37c0ca
refs/heads/master
<repo_name>seanrmurphy/lambda-swagger-test<file_sep>/deploy/deploy-without-gw-validation.sh #! /usr/bin/env bash sam deploy -t ./lambda-swagger-test.yaml <file_sep>/test/test.sh #! /usr/bin/env bash if [ -z "$RESTAPI" ] then echo "\$RESTAPI environment variable is undefined - exiting" exit 1 fi curlwithcode() { code=0 # Run curl in a separate command, capturing output of -w "%{http_code}" into statuscode # and sending the content to a file with -o >(cat >/tmp/curl_body) statuscode=$(curl -s -w "%{http_code}" \ -o >(cat >/tmp/curl_body) \ "$@" ) || code="$?" body="$(cat /tmp/curl_body | jq)" echo "statuscode : $statuscode" echo "exitcode : $code" echo "body : $body" } echo echo "Sending GET request to base endpoint to obtain version information" curlwithcode -s $RESTAPI/ echo echo "Sending GET request to /no-params/empty-response - expect HTTP 200 with no body" curlwithcode $RESTAPI/no-params/empty-response echo echo "Sending GET request to /no-params/simple-response - expect HTTP 200 with simple body" curlwithcode $RESTAPI/no-params/simple-response echo echo "Sending GET request to /no-params/complex-response - expect HTTP 200 with complex body" curlwithcode $RESTAPI/no-params/complex-response echo echo "Sending GET request to /no-params/error-response - expect HTTP 418 with error message" curlwithcode $RESTAPI/no-params/empty-response PARAM='1234' echo echo "Sending GET request to /path-param/empty-response - expect HTTP 200 with no body" curlwithcode $RESTAPI/path-param/empty-response/$PARAM echo echo "Sending GET request to /path-param/simple-response - expect HTTP 200 with simple body" curlwithcode $RESTAPI/path-param/simple-response/$PARAM echo echo "Sending GET request to /path-param/complex-response - expect HTTP 200 with complex body" curlwithcode $RESTAPI/path-param/complex-response/$PARAM echo echo "Sending GET request to /path-param/error-response - expect HTTP 418 with error message" curlwithcode $RESTAPI/path-param/empty-response/$PARAM PARAM='5678' echo echo "Sending GET request to /query-param/empty-response - expect HTTP 200 with no body" curlwithcode $RESTAPI/query-param/empty-response?query-param=$PARAM echo echo "Sending GET request to /query-param/simple-response - expect HTTP 200 with simple body" curlwithcode $RESTAPI/query-param/simple-response?query-param=$PARAM echo echo "Sending GET request to /query-param/complex-response - expect HTTP 200 with complex body" curlwithcode $RESTAPI/query-param/complex-response?query-param=$PARAM echo echo "Sending GET request to /query-param/error-response - expect HTTP 418 with error message" curlwithcode $RESTAPI/query-param/empty-response?query-param=$PARAM echo echo "Sending GET request to /body-param/empty-response - expect HTTP 501 with error message" curlwithcode $RESTAPI/body-param/empty-response echo echo "Sending POST request to /body-param/empty-response - expect HTTP 200 with no body" curlwithcode -X POST -H 'Content-Type: application/json' -d '{"string": "hello", "descriptor": "a wonderful day", "int_val": 42}' $RESTAPI/body-param/empty-response echo echo "Sending GET request to /body-param/simple-response - expect HTTP 501 with error message" curlwithcode $RESTAPI/body-param/simple-response echo echo "Sending POST request to /body-param/simple-response - expect HTTP 200 with simple body" curlwithcode -X POST -H 'Content-Type: application/json' -d '{"string": "hello", "descriptor": "a wonderful day", "int_val": 42}' $RESTAPI/body-param/simple-response echo echo "Sending GET request to /body-param/complex-response - expect HTTP 501 with error message" curlwithcode $RESTAPI/body-param/complex-response echo echo "Sending POST request to /body-param/complex-response - expect HTTP 200 with complex body" curlwithcode -X POST -H 'Accept: application/json' -H 'Content-Type: application/json' -d '{"string": "hello", "descriptor": "a wonderful day", "int_val": 42}' $RESTAPI/body-param/complex-response echo echo "Sending GET request to /body-param/error-response - expect HTTP 501 with error message" curlwithcode $RESTAPI/body-param/error-response echo echo "Sending POST request to /body-param/error-response - expect HTTP 418 with error message" curlwithcode -X POST -H 'Content-Type: application/json' -d '{"string": "hello", "descriptor": "a wonderful day", "int_val": 42}' $RESTAPI/body-param/error-response echo echo "Error cases - sending invalid path parameter" PARAM='ABCD' echo echo "Sending GET request to /path-param/empty-response - expect invalid request response" curlwithcode $RESTAPI/path-param/empty-response/$PARAM echo echo "Sending GET request to /path-param/simple-response - expect invalid request response" curlwithcode $RESTAPI/path-param/simple-response/$PARAM echo echo "Sending GET request to /path-param/complex-response - expect invalid request response" curlwithcode $RESTAPI/path-param/complex-response/$PARAM echo echo "Sending GET request to /path-param/error-response - expect invalid request response" curlwithcode $RESTAPI/path-param/empty-response/$PARAM echo echo "Error cases - sending no query parameter" echo echo "Sending GET request to /query-param/empty-response - expect invalid request response" curlwithcode $RESTAPI/query-param/empty-response echo echo "Sending GET request to /query-param/simple-response - expect invalid request response" curlwithcode $RESTAPI/query-param/simple-response echo echo "Sending GET request to /query-param/complex-response - expect invalid request response" curlwithcode $RESTAPI/query-param/complex-response echo echo "Sending GET request to /query-param/error-response - expect invalid request response" curlwithcode $RESTAPI/query-param/empty-response echo echo "Error cases - sending invalid query parameter" PARAM='EFGH' echo echo "Sending GET request to /query-param/empty-response - expect invalid request response" curlwithcode $RESTAPI/query-param/empty-response?query-param=$PARAM echo echo "Sending GET request to /query-param/simple-response - expect invalid request response" curlwithcode $RESTAPI/query-param/simple-response?query-param=$PARAM echo echo "Sending GET request to /query-param/complex-response - expect invalid request response" curlwithcode $RESTAPI/query-param/complex-response?query-param=$PARAM echo echo "Sending GET request to /query-param/error-response - expect invalid request response" curlwithcode $RESTAPI/query-param/empty-response?query-param=$PARAM echo echo "Error cases - sending invalid body parameter" echo echo "Sending POST request to /body-param/empty-response - expect invalid request response" curlwithcode -X POST -H 'Content-Type: application/json' -d '{"string": "hello", "descripto": "a wonderful day", "int_val": 42}' $RESTAPI/body-param/empty-response echo echo "Sending POST request to /body-param/simple-response - expect invalid request response" curlwithcode -X POST -H 'Content-Type: application/json' -d '{"string": "hello", "descripto": "a wonderful day", "int_val": 42}' $RESTAPI/body-param/simple-response echo echo "Sending POST request to /body-param/complex-response - expect invalid request response" curlwithcode -X POST -H 'Accept: application/json' -H 'Content-Type: application/json' -d '{"string": "hello", "descripto": "a wonderful day", "int_val": 42}' $RESTAPI/body-param/complex-response echo echo "Sending POST request to /body-param/error-response - expect invalid request response" curlwithcode -X POST -H 'Content-Type: application/json' -d '{"string": "hello", "descripto": "a wonderful day", "int_val": 42}' $RESTAPI/body-param/error-response <file_sep>/lambda-swagger-test.go package main import ( "net/http" "github.com/aws/aws-lambda-go/events" "github.com/aws/aws-lambda-go/lambda" "github.com/awslabs/aws-lambda-go-api-proxy/httpadapter" loads "github.com/go-openapi/loads" "github.com/seanrmurphy/lambda-swagger-test/handlers" "github.com/seanrmurphy/lambda-swagger-test/restapi" "github.com/seanrmurphy/lambda-swagger-test/restapi/operations" "github.com/seanrmurphy/lambda-swagger-test/restapi/operations/open" ) var httpAdapter *httpadapter.HandlerAdapter var nullHandler = false func setupHandlers() *operations.LambdaGoSwaggerTestAPIAPI { swaggerSpec, err := loads.Embedded(restapi.SwaggerJSON, restapi.FlatSwaggerJSON) if err != nil { panic(err) } api := operations.NewLambdaGoSwaggerTestAPIAPI(swaggerSpec) api.OpenGetAPIIdentifierHandler = open.GetAPIIdentifierHandlerFunc(handlers.GetApiIdentifier) api.OpenGetNoParamsEmptyResponseHandler = open.GetNoParamsEmptyResponseHandlerFunc(handlers.GetNoParamsEmptyResponse) api.OpenGetNoParamsSimpleResponseHandler = open.GetNoParamsSimpleResponseHandlerFunc(handlers.GetNoParamsSimpleResponse) api.OpenGetNoParamsComplexResponseHandler = open.GetNoParamsComplexResponseHandlerFunc(handlers.GetNoParamsComplexResponse) api.OpenGetNoParamsErrorResponseHandler = open.GetNoParamsErrorResponseHandlerFunc(handlers.GetNoParamsErrorResponse) api.OpenGetPathParamEmptyResponseHandler = open.GetPathParamEmptyResponseHandlerFunc(handlers.GetPathParamEmptyResponse) api.OpenGetPathParamSimpleResponseHandler = open.GetPathParamSimpleResponseHandlerFunc(handlers.GetPathParamSimpleResponse) api.OpenGetPathParamComplexResponseHandler = open.GetPathParamComplexResponseHandlerFunc(handlers.GetPathParamComplexResponse) api.OpenGetPathParamErrorResponseHandler = open.GetPathParamErrorResponseHandlerFunc(handlers.GetPathParamErrorResponse) api.OpenGetQueryParamEmptyResponseHandler = open.GetQueryParamEmptyResponseHandlerFunc(handlers.GetQueryParamEmptyResponse) api.OpenGetQueryParamSimpleResponseHandler = open.GetQueryParamSimpleResponseHandlerFunc(handlers.GetQueryParamSimpleResponse) api.OpenGetQueryParamComplexResponseHandler = open.GetQueryParamComplexResponseHandlerFunc(handlers.GetQueryParamComplexResponse) api.OpenGetQueryParamErrorResponseHandler = open.GetQueryParamErrorResponseHandlerFunc(handlers.GetQueryParamErrorResponse) api.OpenGetBodyParamEmptyResponseHandler = open.GetBodyParamEmptyResponseHandlerFunc(handlers.GetBodyParamEmptyResponse) api.OpenPostBodyParamEmptyResponseHandler = open.PostBodyParamEmptyResponseHandlerFunc(handlers.PostBodyParamEmptyResponse) api.OpenGetBodyParamSimpleResponseHandler = open.GetBodyParamSimpleResponseHandlerFunc(handlers.GetBodyParamSimpleResponse) api.OpenPostBodyParamSimpleResponseHandler = open.PostBodyParamSimpleResponseHandlerFunc(handlers.PostBodyParamSimpleResponse) api.OpenGetBodyParamComplexResponseHandler = open.GetBodyParamComplexResponseHandlerFunc(handlers.GetBodyParamComplexResponse) api.OpenPostBodyParamComplexResponseHandler = open.PostBodyParamComplexResponseHandlerFunc(handlers.PostBodyParamComplexResponse) api.OpenGetBodyParamErrorResponseHandler = open.GetBodyParamErrorResponseHandlerFunc(handlers.GetBodyParamErrorResponse) api.OpenPostBodyParamErrorResponseHandler = open.PostBodyParamErrorResponseHandlerFunc(handlers.PostBodyParamErrorResponse) return api } func init() { api := setupHandlers() server := restapi.NewServer(api) server.ConfigureAPI() httpAdapter = httpadapter.New(server.GetHandler()) } // Handler handles API requests func Handler(req events.APIGatewayProxyRequest) (events.APIGatewayProxyResponse, error) { if nullHandler { return events.APIGatewayProxyResponse{ StatusCode: http.StatusOK, Body: `{"message": "Null handler operational - always returns this message"}`, }, nil } else { return httpAdapter.Proxy(req) } } func main() { lambda.Start(Handler) } <file_sep>/README.md # What A small application to demonstrate the use of `go-swagger` in an AWS context, linking in the API Gateway and Lambda functions. Check out [this medium post](https://medium.com/@sean_24982/rest-apis-using-go-swagger-lambda-functions-and-the-api-gateway-b9c0b8c5712b) for more information. # Requirements - Modern [`go`](https://golang.org/) toolchain - I used go 1.14.6 - [`go-swagger`](https://github.com/go-swagger/go-swagger) - I used v0.25.0 - AWS [SAM](https://aws.amazon.com/serverless/sam/) application management tool - Basic utilities: `zip` for function upload to AWS, `curl` and `jq` for testing # Install Install this repo using `go get` ``` go get github.com/seanrmurphy/lambda-swagger-test ``` Note that as it makes reference to code which will be generated using swagger tools, `go get` will generate errors but the content will be there. (It is of course possible to install this using `git clone` in the appropriate place). # Build, deploy, test, clean up - Generate the Swagger server-side stub code ``` swagger generate server -f swagger.yaml ``` This will generate `models` and `restapi` directories in the main directory. Note that there is another swagger defintion, `swagger-req-validation.yaml` - this contains some extra content which instructs the AWS API Gateway to perform request validation; it generates exactly the same autogenerated code for the REST API. - Build the application ``` cd deploy ./build.sh ``` This builds the application in the top level directory of the repo; it copies the resulting executable into the deploy directory. - Deploy the application There are two modes for deploying the application - with and without API Gateway validation - indeed, this sample application highlights the validation performed by the API Gateway. ``` ./deploy-without-gw-validation.sh ``` This zips the executable and uploads it to AWS using the `sam` tool and associated configuration file (`sam-deploy.toml`). On successful completion, it prints the identifier for the Lambda function and the endpoint of the REST API. - Run the tests ``` cd ../tests export RESTAPI=<ENDPOINT OUTPUT FROM DEPLOYMENT PROCESS> ./tests.sh ``` The tests demonstrate both successful and unsuccessful calling of all of the endpoints defined in the API. - Removing the API The easiest way to remove the application is via the AWS CloudFormations dashboard. <file_sep>/deploy/deploy-with-gw-validation.sh #! /usr/bin/env bash sam deploy -t ./lambda-swagger-test-req-validation.yaml <file_sep>/go.mod module github.com/seanrmurphy/lambda-swagger-test go 1.14 require ( github.com/aws/aws-lambda-go v1.19.1 github.com/awslabs/aws-lambda-go-api-proxy v0.8.1 github.com/go-openapi/errors v0.19.7 github.com/go-openapi/loads v0.19.5 github.com/go-openapi/runtime v0.19.22 github.com/go-openapi/spec v0.19.8 github.com/go-openapi/strfmt v0.19.5 github.com/go-openapi/swag v0.19.9 github.com/go-openapi/validate v0.19.11 github.com/jessevdk/go-flags v1.4.0 golang.org/x/net v0.0.0-20200602114024-627f9648deb9 ) <file_sep>/handlers/handlers.go package handlers import ( "fmt" "math/rand" "github.com/go-openapi/runtime/middleware" "github.com/seanrmurphy/lambda-swagger-test/models" "github.com/seanrmurphy/lambda-swagger-test/restapi/operations/open" ) func GetApiIdentifier(params open.GetAPIIdentifierParams) middleware.Responder { str := "go-swagger Lambda integration API - version 1.0" r := models.SimpleMessageResponse{ Message: &str, } resp := open.NewGetAPIIdentifierOK().WithPayload(&r) return resp } func GetNoParamsEmptyResponse(params open.GetNoParamsEmptyResponseParams) middleware.Responder { resp := open.NewGetNoParamsEmptyResponseOK() return resp } func GetNoParamsSimpleResponse(params open.GetNoParamsSimpleResponseParams) middleware.Responder { str := "Response from GetNoParamsSimpleResponse function" r := models.SimpleMessageResponse{ Message: &str, } resp := open.NewGetNoParamsSimpleResponseOK().WithPayload(&r) return resp } func GetNoParamsComplexResponse(params open.GetNoParamsComplexResponseParams) middleware.Responder { stringArray := []string{"param1", "param2"} descriptor1 := "A descriptive string (object1)" intVal := rand.Int63() o1 := models.SimpleObjectOne{ StringArray: stringArray, Descriptor: &descriptor1, IntVal: &intVal, } descriptor2 := "A descriptive string (object2)" intArray := []int64{rand.Int63(), rand.Int63(), rand.Int63(), rand.Int63()} o2 := models.SimpleObjectTwo{ Descriptor: &descriptor2, IntArray: intArray, } r := models.ComplexObjectResponse{ Object1: &o1, Object2: &o2, OptionalParam: rand.Int63(), } resp := open.NewGetNoParamsComplexResponseOK().WithPayload(&r) return resp } func GetNoParamsErrorResponse(params open.GetNoParamsErrorResponseParams) middleware.Responder { str := "Calling this endpoint (GetNoParamsErrorResponse) deliberately generates an error case." randomInt := rand.Int63() r := models.ErrorResponse{ ErrorNumber: &randomInt, ErrorString: &str, } resp := open.NewGetNoParamsErrorResponseIMATeapot().WithPayload(&r) return resp } func GetPathParamEmptyResponse(params open.GetPathParamEmptyResponseParams) middleware.Responder { resp := open.NewGetPathParamEmptyResponseOK() return resp } func GetPathParamSimpleResponse(params open.GetPathParamSimpleResponseParams) middleware.Responder { pathParam := params.PathParam str := fmt.Sprintf("Response from GetPathParamSimpleResponse function - input param = %v", pathParam) r := models.SimpleMessageResponse{ Message: &str, } resp := open.NewGetPathParamSimpleResponseOK().WithPayload(&r) return resp } func GetPathParamComplexResponse(params open.GetPathParamComplexResponseParams) middleware.Responder { pathParam := params.PathParam str := fmt.Sprintf("Input param = %v", pathParam) stringArray := []string{"param1", "param2", str} descriptor1 := "A descriptive string (object1)" intVal := rand.Int63() o1 := models.SimpleObjectOne{ StringArray: stringArray, Descriptor: &descriptor1, IntVal: &intVal, } descriptor2 := "A descriptive string (object2)" intArray := []int64{rand.Int63(), rand.Int63(), rand.Int63(), rand.Int63()} o2 := models.SimpleObjectTwo{ Descriptor: &descriptor2, IntArray: intArray, } r := models.ComplexObjectResponse{ Object1: &o1, Object2: &o2, OptionalParam: rand.Int63(), } resp := open.NewGetPathParamComplexResponseOK().WithPayload(&r) return resp } func GetPathParamErrorResponse(params open.GetPathParamErrorResponseParams) middleware.Responder { pathParam := params.PathParam str := fmt.Sprintf("Calling this endpoint (GetPathParamErrorResponse) deliberately generates an error case - Input param = %v", pathParam) randomInt := rand.Int63() r := models.ErrorResponse{ ErrorNumber: &randomInt, ErrorString: &str, } resp := open.NewGetPathParamErrorResponseIMATeapot().WithPayload(&r) return resp } func GetQueryParamEmptyResponse(params open.GetQueryParamEmptyResponseParams) middleware.Responder { resp := open.NewGetQueryParamEmptyResponseOK() return resp } func GetQueryParamSimpleResponse(params open.GetQueryParamSimpleResponseParams) middleware.Responder { pathParam := params.QueryParam str := fmt.Sprintf("Response from GetQueryParamSimpleResponse function - input param = %v", pathParam) r := models.SimpleMessageResponse{ Message: &str, } resp := open.NewGetQueryParamSimpleResponseOK().WithPayload(&r) return resp } func GetQueryParamComplexResponse(params open.GetQueryParamComplexResponseParams) middleware.Responder { pathParam := params.QueryParam str := fmt.Sprintf("Input param = %v", pathParam) stringArray := []string{"param1", "param2", str} descriptor1 := "A descriptive string (object1)" intVal := rand.Int63() o1 := models.SimpleObjectOne{ StringArray: stringArray, Descriptor: &descriptor1, IntVal: &intVal, } descriptor2 := "A descriptive string (object2)" intArray := []int64{rand.Int63(), rand.Int63(), rand.Int63(), rand.Int63()} o2 := models.SimpleObjectTwo{ Descriptor: &descriptor2, IntArray: intArray, } r := models.ComplexObjectResponse{ Object1: &o1, Object2: &o2, OptionalParam: rand.Int63(), } resp := open.NewGetQueryParamComplexResponseOK().WithPayload(&r) return resp } func GetQueryParamErrorResponse(params open.GetQueryParamErrorResponseParams) middleware.Responder { pathParam := params.QueryParam str := fmt.Sprintf("Calling this endpoint (GetQueryParamErrorResponse) deliberately generates an error case - Input param = %v", pathParam) randomInt := rand.Int63() r := models.ErrorResponse{ ErrorNumber: &randomInt, ErrorString: &str, } resp := open.NewGetQueryParamErrorResponseIMATeapot().WithPayload(&r) return resp } func GetBodyParamEmptyResponse(params open.GetBodyParamEmptyResponseParams) middleware.Responder { str := "GET not implemented on this endpoint - please use POST instead." randomInt := rand.Int63() r := models.ErrorResponse{ ErrorNumber: &randomInt, ErrorString: &str, } resp := open.NewGetBodyParamEmptyResponseNotImplemented().WithPayload(&r) return resp } func PostBodyParamEmptyResponse(params open.PostBodyParamEmptyResponseParams) middleware.Responder { // there are input parameters provided here, but since we cannot return them // in any way, we just ignore them resp := open.NewPostBodyParamEmptyResponseOK() return resp } func GetBodyParamSimpleResponse(params open.GetBodyParamSimpleResponseParams) middleware.Responder { str := "GET not implemented on this endpoint - please use POST instead." randomInt := rand.Int63() r := models.ErrorResponse{ ErrorNumber: &randomInt, ErrorString: &str, } resp := open.NewGetBodyParamSimpleResponseNotImplemented().WithPayload(&r) return resp } func PostBodyParamSimpleResponse(params open.PostBodyParamSimpleResponseParams) middleware.Responder { inputParams := params.BodyParam str := fmt.Sprintf("Response from PostBodyParamSimpleResponse function - called with JSON object {'descriptor': '%v', 'int_val': %v, 'string': '%v'}", inputParams.Descriptor, inputParams.IntVal, inputParams.String) r := models.SimpleMessageResponse{ Message: &str, } resp := open.NewPostBodyParamSimpleResponseOK().WithPayload(&r) return resp } func GetBodyParamComplexResponse(params open.GetBodyParamComplexResponseParams) middleware.Responder { str := "GET not implemented on this endpoint - please use POST instead." randomInt := rand.Int63() r := models.ErrorResponse{ ErrorNumber: &randomInt, ErrorString: &str, } resp := open.NewGetBodyParamComplexResponseNotImplemented().WithPayload(&r) return resp } func PostBodyParamComplexResponse(params open.PostBodyParamComplexResponseParams) middleware.Responder { inputParams := params.BodyParam str := fmt.Sprintf("Response from PostBodyParamSimpleResponse function - called with JSON object {'descriptor': '%v', 'int_val': %v, 'string': '%v'}", inputParams.Descriptor, inputParams.IntVal, inputParams.String) stringArray := []string{"param1", "param2", str} descriptor1 := "A descriptive string (object1)" intVal := rand.Int63() o1 := models.SimpleObjectOne{ StringArray: stringArray, Descriptor: &descriptor1, IntVal: &intVal, } descriptor2 := "A descriptive string (object2)" intArray := []int64{rand.Int63(), rand.Int63(), rand.Int63(), rand.Int63()} o2 := models.SimpleObjectTwo{ Descriptor: &descriptor2, IntArray: intArray, } r := models.ComplexObjectResponse{ Object1: &o1, Object2: &o2, OptionalParam: rand.Int63(), } resp := open.NewPostBodyParamComplexResponseOK().WithPayload(&r) return resp } func GetBodyParamErrorResponse(params open.GetBodyParamErrorResponseParams) middleware.Responder { str := "GET not implemented on this endpoint - please use POST instead." randomInt := rand.Int63() r := models.ErrorResponse{ ErrorNumber: &randomInt, ErrorString: &str, } resp := open.NewGetBodyParamErrorResponseNotImplemented().WithPayload(&r) return resp } func PostBodyParamErrorResponse(params open.PostBodyParamErrorResponseParams) middleware.Responder { inputParams := params.BodyParam str := fmt.Sprintf("Calling this endpoint (PostBodyParamErrorResponse) deliberately generates an error case - called with JSON object {'descriptor': '%v', 'int_val': %v, 'string': '%v'}", inputParams.Descriptor, inputParams.IntVal, inputParams.String) randomInt := rand.Int63() r := models.ErrorResponse{ ErrorNumber: &randomInt, ErrorString: &str, } resp := open.NewPostBodyParamErrorResponseIMATeapot().WithPayload(&r) return resp } //func TestEndpoint(params open.GetTestEndpointParams) middleware.Responder { //str := "Success from Test Endpoint" //r := models.TestResponse{ //Message: &str, //} //resp := open.NewGetTestEndpointOK().WithPayload(&r) //return resp //} //func AlternativeTestEndpoint(params open.GetAlternativeTestEndpointParams) middleware.Responder { //str := "Success from Alternative Test Endpoint" //r := models.TestResponse{ //Message: &str, //} //resp := open.NewGetAlternativeTestEndpointOK().WithPayload(&r) //return resp //} //func TestWithParametersEndpoint(params open.GetTestWithParameterEndpointParams) middleware.Responder { //param := params.Param //str := "Success from Test With Params Endpoint - param = " + param //r := models.TestResponse{ //Message: &str, //} //resp := open.NewGetTestWithParameterEndpointOK().WithPayload(&r) //return resp //} <file_sep>/deploy/build.sh #! /usr/bin/env bash cd .. echo echo "Building application..." go build echo echo "Moving application to this directory and zipping for Lambda upload..." mv lambda-swagger-test deploy cd deploy zip lambda-swagger-test.zip ./lambda-swagger-test rm lambda-swagger-test
6d7ded95fa0e32f898ea220b79c4391b52ae9275
[ "Markdown", "Go Module", "Go", "Shell" ]
8
Shell
seanrmurphy/lambda-swagger-test
78937a473e3ea819d274d5bb777dfba4ccc774ca
b727cce637fba7bb6c9c462c7c1a947fa4b604bf
refs/heads/master
<repo_name>aliona95/Multiplayer1<file_sep>/Multiplayer/app/src/main/java/com/aeappss/multiplayer/OnAzimuthChangedListener.java package com.aeappss.multiplayer; public interface OnAzimuthChangedListener { void onAzimuthChanged(float azimuthFrom, float azimuthTo); } <file_sep>/Multiplayer/app/src/main/java/com/aeappss/multiplayer/MainActivity.java package com.aeappss.multiplayer; import android.app.Activity; import android.content.Intent; import android.graphics.Typeface; import android.os.Bundle; import android.os.Handler; import android.widget.Button; import android.widget.TextView; public class MainActivity extends Activity { private static int SPLASH_TIME_OUT = 2500; Button button; Intent mainIntent; TextView text; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main_splash_screen); Typeface myFont = Typeface.createFromAsset(getAssets(), "fonts/rocko.ttf"); text = (TextView) findViewById(R.id.textView2); text.setTypeface(myFont); /*button = (Button) findViewById(R.id.button); button.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { Log.i("AAA", "AAA"); mainIntent = new Intent(getApplicationContext(), MainActivity1.class); startActivity(mainIntent); finish(); } });*/ new Handler().postDelayed(new Runnable() { @Override public void run() { mainIntent = new Intent(getApplicationContext(), MainActivity1.class); startActivity(mainIntent); finish(); } }, SPLASH_TIME_OUT); } }
e1a5ebd7a79ae22f2a4cb57e551a886a891572fd
[ "Java" ]
2
Java
aliona95/Multiplayer1
692e7acab6a59f3425744769d9b0f1cc1324df63
3da25f9b5fa7b1c18211c9104118e593a2cf9cc5
refs/heads/master
<repo_name>SmithWilson/SomeProject<file_sep>/VikaKursovoy/Enums/ProductType.cs using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace VikaKursovoy.Enums { /// <summary> /// Тип товаров. /// </summary> public enum ProductType { /// <summary> /// Канцелярские товары. /// </summary> Stationery, /// <summary> /// Продовольственные товары. /// </summary> Foodstuffs, /// <summary> /// Хозяйственные товары. /// </summary> HouseholdGoods, /// <summary> /// Игрушки /// </summary> Toys } } <file_sep>/VikaKursovoy/Services/ModelService.cs using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Text.RegularExpressions; using System.Threading.Tasks; using VikaKursovoy.Models; namespace VikaKursovoy.Services { public static class ModelService { /// <summary> /// Получение полей(Перегрузка). /// </summary> /// <param name="product"><see cref="Product"/></param> /// <returns>Строка.</returns> public static string GetPropertys(Product product) => Task.Run(() => String.Format("{0,-10}{1,-30}{2,-30}{3,-10}",product.Id,product.Name,product.Type,product.Price)).Result; /// <summary> /// Получение полей(Перегрузка). /// </summary> /// <param name="baseInfo"><see cref="BaseInfo"/></param> /// <returns>Строка.</returns> public static string GetPropertys(BaseInfo baseInfo) => Task.Run(() => String.Format("{0,-10}{1,-30}{2,-30}",baseInfo.Id,baseInfo.Responsible,baseInfo.Departament)).Result; /// <summary> /// Получение полей(Перегрузка). /// </summary> /// <param name="result"><see cref="ResultFile"/></param> /// <returns>Строка.</returns> public static string GetPropertys(ResultFile result) => Task.Run(() => String.Format("{0,-20}{1,-30}{2,-30}{3,-20}",result.Name,result.Department,result.Type,result.Price)).Result; /// <summary> /// Создание итоговой таблицы. /// </summary> /// <param name="path">Путь к файлу.</param> /// <param name="fileProduct">Имя файла с продуктами.</param> /// <param name="fileResult">Имя файла с основной информацией.</param> /// <returns>Список.</returns> public static List<ResultFile> CreateSelectionStudent(string path, string fileProduct, string fileInfo, string fileResult) { return Task.Run(async () => { var result = new List<ResultFile>(); var products = await FileService.ReadJsonFromFile<Product>(path, fileProduct); var info = await FileService.ReadJsonFromFile<BaseInfo>(path, fileInfo); foreach (var product in products) { foreach (var i in info) { if (product.Id == i.Id) { result.Add(new ResultFile { Type = product.Type, Department = i.Departament, Name = product.Name, Price = product.Price }); } } } if (result.Count == 0) { Console.WriteLine($"Ошибка связывания записей в таблицах."); return new List<ResultFile>(); } foreach (var item in result) { Console.WriteLine(ModelService.GetPropertys(item)); } Console.WriteLine(); GetResultPrice(result); await FileService.WriteObjectToFile(path, fileResult, result); return result; }).Result; } public static void GetResultPrice(List<ResultFile> list) { Console.WriteLine("Канцелярия : " + list.Where(s => s.Type == Enums.ProductType.Stationery).Sum(s => s.Price)); Console.WriteLine("Хозяйственные товары : " + list.Where(s => s.Type == Enums.ProductType.HouseholdGoods).Sum(s => s.Price)); Console.WriteLine("Продовольственные товары : " + list.Where(s => s.Type == Enums.ProductType.Foodstuffs).Sum(s => s.Price)); Console.WriteLine("Продовольственные товары : " + list.Where(s => s.Type == Enums.ProductType.Toys).Sum(s => s.Price)); } } } <file_sep>/VikaKursovoy/Program.cs using System; using System.Collections.Generic; using System.IO; using System.Linq; using System.Text; using System.Threading.Tasks; using VikaKursovoy.Models; using VikaKursovoy.Services; namespace VikaKursovoy { class Program { static async Task Main(string[] args) { #region Fields var path = Directory.GetCurrentDirectory(); string fileProduct; string fileInfo; string fileResult; #endregion #region Method int action; //product.json Console.WriteLine("Имя файла для продуктов : "); fileProduct = Console.ReadLine(); //info.json Console.WriteLine("Имя файла для информации : "); fileInfo = Console.ReadLine(); //result.json Console.WriteLine("Имя файла итоговой информации : "); fileResult = Console.ReadLine(); #region CommentedData //var list1 = new List<Product> //{ // new Product // { // Id = 1, // Name = "Ручка", // Type = Enums.ProductType.Stationery, // Price = 33.50 // }, // new Product // { // Id = 2, // Name = "Молоко", // Type = Enums.ProductType.Foodstuffs, // Price = 70.60 // }, // new Product // { // Id = 3, // Name = "Мыло", // Type = Enums.ProductType.HouseholdGoods, // Price = 20.50 // }, // new Product // { // Id = 4, // Name = "<NAME>", // Type = Enums.ProductType.HouseholdGoods, // Price = 70 // }, // new Product // { // Id = 5, // Name = "<NAME>", // Type = Enums.ProductType.Toys, // Price = 150 // }, // new Product // { // Id = 6, // Name = "Пазл", // Type = Enums.ProductType.Toys, // Price = 100.5 // }, // new Product // { // Id = 7, // Name = "Тетрис", // Type = Enums.ProductType.Toys, // Price = 300.6 // }, // new Product // { // Id = 8, // Name = "Мозаика", // Type = Enums.ProductType.Toys, // Price = 120 // }, // new Product // { // Id = 9, // Name = "Бумага", // Type = Enums.ProductType.Stationery, // Price = 155.9 // }, // new Product // { // Id = 10, // Name = "Карандаш", // Type = Enums.ProductType.Stationery, // Price = 20 // } //}; //var list2 = new List<BaseInfo> //{ // new BaseInfo // { // Id = 1, // Departament = "Отдел N3", // Responsible = "<NAME>" // }, // new BaseInfo // { // Id = 2, // Departament = "Отдел N2", // Responsible = "<NAME>" // }, // new BaseInfo // { // Id = 3, // Departament = "Отдел N4", // Responsible = "<NAME>" // }, // new BaseInfo // { // Id = 4, // Departament = "Отдел N4", // Responsible = "<NAME>" // }, // new BaseInfo // { // Id = 5, // Departament = "Отдел N1", // Responsible = "<NAME>." // }, // new BaseInfo // { // Id = 6, // Departament = "Отдел N1", // Responsible = "<NAME>." // }, // new BaseInfo // { // Id = 7, // Departament = "Отдел N1", // Responsible = "<NAME>." // }, // new BaseInfo // { // Id = 8, // Departament = "Отдел N1", // Responsible = "<NAME>." // }, // new BaseInfo // { // Id = 9, // Departament = "Отдел N3", // Responsible = "<NAME>" // }, // new BaseInfo // { // Id = 10, // Departament = "Отдел N3", // Responsible = "<NAME>" // } //}; //await FileService.WriteObjectToFile<Product>(path, fileProduct, list1); //await FileService.WriteObjectToFile<BaseInfo>(path, fileInfo, list2); #endregion do { Console.WriteLine("0 - Выход, 1 - Считать продукт, 2 - Считать информацию, 3 - Создать выборку, 4 - Считать выборку."); action = int.Parse(Console.ReadLine()); Console.WriteLine(); switch (action) { case 0: Console.WriteLine("Нажмите любую клавишу чтобы выйти."); break; case 1: var listStudent = await FileService.ReadJsonFromFile<Product>(path, fileProduct); foreach (var item in listStudent) { Console.WriteLine(ModelService.GetPropertys(item)); } Console.WriteLine(); break; case 2: var listInfo = await FileService.ReadJsonFromFile<BaseInfo>(path, fileInfo); foreach (var item in listInfo) { Console.WriteLine(ModelService.GetPropertys(item)); } Console.WriteLine(); break; case 3: var selected = ModelService.CreateSelectionStudent(path, fileProduct, fileInfo, fileResult); Console.WriteLine(); break; case 4: var listSelect = await FileService.ReadJsonFromFile<ResultFile>(path, fileResult); foreach (var item in listSelect) { Console.WriteLine(ModelService.GetPropertys(item)); } Console.WriteLine(); Console.WriteLine(); break; default: break; } } while (action != 0); Console.ReadKey(); #endregion } } } <file_sep>/VikaKursovoy/Models/ResultFile.cs using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using Newtonsoft.Json; using VikaKursovoy.Enums; namespace VikaKursovoy.Models { /// <summary> /// Модель итогового файла. /// </summary> public class ResultFile { /// <summary> /// Тип товара. /// </summary> [JsonProperty("type")] public ProductType Type { get; set; } /// <summary> /// Наименование товара. /// </summary> [JsonProperty("name")] public string Name { get; set; } /// <summary> /// Отдел. /// </summary> [JsonProperty("department")] public string Department { get; set; } /// <summary> /// Цена. /// </summary> [JsonProperty("price")] public double Price { get; set; } } } <file_sep>/VikaKursovoy/Models/Product.cs using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using Newtonsoft.Json; using VikaKursovoy.Enums; using VikaKursovoy.Services; namespace VikaKursovoy.Models { /// <summary> /// Модель продуктов. /// </summary> public class Product { private string _name; /// <summary> /// Регистрационный номер. /// </summary> [JsonProperty("id")] public int Id { get; set; } /// <summary> /// Тип товара. /// </summary> [JsonProperty("type")] public ProductType Type { get; set; } /// <summary> /// Наименование товара. /// </summary> [JsonProperty("name")] public string Name { get; set; } /// <summary> /// Цена товара. /// </summary> [JsonProperty("price")] public double Price { get; set; } } } <file_sep>/VikaKursovoy/Models/BaseInfo.cs using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using Newtonsoft.Json; using VikaKursovoy.Services; namespace VikaKursovoy.Models { /// <summary> /// Модель общей информации /// </summary> public class BaseInfo { /// <summary> /// Регистрационный номер. /// </summary> [JsonProperty("id")] public int Id { get; set; } /// <summary> /// Отдел. /// </summary> [JsonProperty("department")] public string Departament { get; set; } /// <summary> /// Материально ответственное лицо. /// </summary> [JsonProperty("responsible")] public string Responsible { get; set; } } } <file_sep>/VikaKursovoy/Services/FileService.cs using System; using System.Collections.Generic; using System.IO; using System.Linq; using System.Text; using System.Text.RegularExpressions; using System.Threading.Tasks; using VikaKursovoy.Models; namespace VikaKursovoy.Services { /// <summary> /// Сервис для работы с файлами. /// </summary> public static class FileService { /// <summary> /// Добавление одного обьекта в конец. /// </summary> /// <typeparam name="T">Передаваемый тип.</typeparam> /// <param name="path">Путь к файлу.</param> /// <param name="fileName">Имя файла.</param> /// <param name="obj">Обьект.</param> /// <returns>Задача. (Используйте await, чтобы дождаться List<typeparamref name="T"/></returns> public static Task<List<T>> AddObjectToFile<T>(string path, string fileName, T obj) { return Task.Run(async () => { if (obj is Product prod && prod.Id == 0 || obj is BaseInfo info && info.Id == 0) { Console.WriteLine($"Обьект пуст. Тип : {obj.GetType()}"); } var data = await ReadJsonFromFile<T>(path, fileName); if (data is List<Product> products && obj is Product product) { foreach (var p in products) { if (p.Id == product.Id || product.Id <= 0) { Console.WriteLine($"Недопустимый регистрационный номер : {product.Id}."); return new List<T>(); } } } if (data is List<BaseInfo> baseInfo && obj is BaseInfo b) { foreach (var i in baseInfo) { if (i.Id == b.Id || b.Id <= 0) { Console.WriteLine($"Недопустимый регистрационный номер : {b.Id}."); return new List<T>(); } } } data.Add(obj); await WriteObjectToFile(path, fileName, data); return data; }); } /// <summary> /// Удаление обькта из списка. /// </summary> /// <typeparam name="T">Передаваемый тип.</typeparam> /// <param name="path">путь к файлу.</param> /// <param name="fileName">Имя файла.</param> /// <param name="obj">Обьект.</param> /// <returns>Задача. (Используйте await, чтобы дождаться List<typeparamref name="T"/></returns> public static Task<List<T>> DeleteObjectFromFile<T>(string path, string fileName, T obj) { return Task.Run(async () => { if (obj is Product prod && prod.Id == 0 || obj is BaseInfo info && info.Id == 0) { Console.WriteLine($"Обьект пуст."); return new List<T>(); } var data = await ReadJsonFromFile<T>(path, fileName); data.Remove(obj); await WriteObjectToFile(path, fileName, data); return data; }); } /// <summary> /// Запись в файл данных. /// </summary> /// <typeparam name="T">Передаваемый тип.</typeparam> /// <param name="path">Путь к файлу.</param> /// <param name="fileName">Имя файла.</param> /// <param name="obj">Обьект.</param> /// <returns>Задача.</returns> public static Task WriteObjectToFile<T>(string path, string fileName, List<T> obj) { return Task.Run(async () => { using (var sw = new StreamWriter(path + "/" + fileName, false, System.Text.Encoding.UTF8)) { if (!sw.BaseStream.CanWrite) { Console.WriteLine($"Ошибка записи в файл {path}/{fileName}."); return; } if (obj == null || obj.Count == 0) { Console.WriteLine($"Обьект пуст."); return; } if (!ValidedKey(obj)) { return; } var json = SerializationService.SerializationObject(obj); await sw.WriteAsync(json); } }); } /// <summary> /// Чтение из файла данных. /// </summary> /// <typeparam name="T">Передаваемый тип.</typeparam> /// <param name="path">Путь к файлу.</param> /// <param name="fileName">Имя файла.</param> /// <returns>Задача. (Используйте await, чтобы дождаться List<typeparamref name="T"/></returns> public static Task<List<T>> ReadJsonFromFile<T>(string path, string fileName) { return Task.Run(async () => { using (var sr = new StreamReader(path + "/" + fileName, Encoding.UTF8)) { if (!sr.BaseStream.CanRead) { Console.WriteLine($"Ошибка чтения файла {path}/{fileName}."); return new List<T>(); } var json = await sr.ReadToEndAsync(); var data = SerializationService.DeserializeJson<T>(json); if (data == null || data.Count == 0) { Console.WriteLine($"Считаный файл пуст. Имя файла : {fileName}"); return new List<T>(); } if (!ValidedKey(data)) { return new List<T>(); } if (data is List<BaseInfo> infos) { foreach (var info in infos) { if (!ValidedString(info.Responsible)) { Console.WriteLine($"Поле «Материально ответсвтенное лицо», содержит недопустимые символы : {info.Responsible}"); return new List<T>(); } } foreach (var info in infos) { if (!ValidedString(info.Departament, true)) { Console.WriteLine($"Поле «Название отдела», содержит недопустимые символы : {info.Departament}"); return new List<T>(); } } } if (data is List<Product> products) { foreach (var product in products) { if (!ValidedString(product.Name)) { Console.WriteLine($"Поле «Имя», содержит недопустимые символы : {product.Name}"); return new List<T>(); } } } return data; } }); } #region No-Public Method /// <summary> /// Проверка на уникальные значения при считывании. /// </summary> /// <typeparam name="T">Передаваемый тип.</typeparam> /// <param name="data">Коллекция данных типа Т.</param> /// <returns>Логическое значение.</returns> private static bool ValidedKey<T>(List<T> data) { if (data is List<Product> products) { foreach (var item in products) { if (products.Where(p => p.Id == item.Id).Count() > 1 || item.Id < 0) { Console.WriteLine($"Поле «регистрационный номер», содержит ошибку значения : {item.Id}."); return false; } } return true; } if (data is List<BaseInfo> info) { foreach (var item in info) { if (info.Where(p => p.Id == item.Id).Count() > 1 || item.Id < 0) { Console.WriteLine($"Поле «регистрационный номер», содержит ошибку значения : {item.Id}."); return false; } } return true; } if (data is List<ResultFile> result) { return true; } return false; } /// <summary> /// Проверка на содержание русского и латинского алфавита. /// </summary> /// <param name="value">Строка.</param> /// <returns>Логическое значение.</returns> private static bool ValidedString(string value) { var symbols = new char[] { '!', '"', '#', '$', '%', '&', '\'', '(', ')', '*', '+', ',', '-', '/', ':', ';', '<', '=', '>', '?', '@', '[', '\\', ']', '^', '_', '`', '{', '|', '}', '~', '0', '1', '2','3','4','5','6','7','8','9'}; foreach (var symbol in symbols) { if (value.Contains(symbol)) { return false; } } return true; } private static bool ValidedString(string value, bool flag) { var symbols = new char[] { '!', '"', '#', '$', '%', '&', '\'', '(', ')', '*', '+', ',', '-', '/', ':', ';', '<', '=', '>', '?', '@', '[', '\\', ']', '^', '_', '`', '{', '|', '}', '~'}; foreach (var symbol in symbols) { if (value.Contains(symbol)) { return false; } } return true; } #endregion } } <file_sep>/VikaKursovoy/Services/SerializationService.cs using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using Newtonsoft.Json; namespace VikaKursovoy.Services { public static class SerializationService { /// <summary> /// Сериализация обьекта. /// </summary> /// <param name="obj">Обьект.</param> /// <returns>Json.</returns> public static string SerializationObject(object obj) => JsonConvert.SerializeObject(obj); /// <summary> /// Десериализация обьекта. /// </summary> /// <typeparam name="T">Передаваемый тип.</typeparam> /// <param name="json">Json.</param> /// <returns>Список обьектов <typeparamref name="T"/>.</returns> public static List<T> DeserializeJson<T>(string json) => JsonConvert.DeserializeObject<List<T>>(json); } }
e1c936246769ad113a7a24dd7169971929ad0891
[ "C#" ]
8
C#
SmithWilson/SomeProject
fd50d302c9a9080fcac465db500d8ff78912040c
c979568dc926d1e11e311ef3622b283ad0db4e7b
refs/heads/master
<repo_name>sumanthreddy1233/team03_medito<file_sep>/Medito/Medito/Player.swift // // Player.swift // Medito // // Created by Student on 11/11/20. // import Foundation import MediaPlayer class Player{ var avPlayer = AVPlayer() init(){ avPlayer = AVPlayer() } var historyImg:[String] = [] var history:[String] = [] static let sharedInstance = Player() func playStream(fileUrl: String){ let url = NSURL(string: fileUrl) avPlayer = AVPlayer(url: url! as URL) avPlayer.play() setPlayingScreen(fileUrl: fileUrl) print("playing stream") } func setPlayingScreen(fileUrl: String){ let urlArray = fileUrl.split{ $0 == "/" }.map(String.init) let name = urlArray[urlArray.endIndex - 1] print(name) let songInfo = [MPMediaItemPropertyTitle: "song", MPMediaItemPropertyArtist: "<NAME>"] MPNowPlayingInfoCenter.default().nowPlayingInfo = songInfo } } <file_sep>/Medito/Medito/ViewController.swift // // ViewController.swift // Medito // // Created by Student on 11/11/20. // import UIKit import AVFoundation import MediaPlayer class ViewController: UIViewController { var player:AVAudioPlayer = AVAudioPlayer() @IBOutlet weak var minTimeLbl: UILabel! @IBOutlet weak var volumeSlider: UISlider! @IBOutlet weak var timeSlider: UISlider! @IBOutlet weak var playBtn: UIButton! @IBOutlet weak var coverImg: UIImageView! var image = UIImage() @IBOutlet weak var maxTimeLbl: UILabel! var status = 0 var audioName: String = "" @IBAction func play(_ sender: Any) { if(status == 0){ self.playAudio() self.status = 1 self.playBtn.setImage(UIImage(named: "rounded-pause-button.png"), for: .normal) }else{ self.pauseAudio() self.status = 0 self.playBtn.setImage(UIImage(named: "play-button.png"), for: .normal) } } override func viewDidLoad() { super.viewDidLoad() // Do any additional setup after loading the view, typically from a nib. setSession() self.coverImg.image = self.image coverImg.layer.shadowColor = UIColor.gray.cgColor coverImg.layer.shadowOpacity = 2.0 coverImg.layer.shadowOffset = CGSize.zero coverImg.layer.shadowRadius = 20 coverImg.layer.masksToBounds = false coverImg.layer.cornerRadius = 15 self.timeSlider.setThumbImage(UIImage(named: "slider-circle.png")!, for: .normal) var Time = Timer.scheduledTimer(timeInterval: 0.1, target: self, selector: #selector(updateTimeSlider), userInfo: nil, repeats: true) UIApplication.shared.beginReceivingRemoteControlEvents() becomeFirstResponder() do { let audioPath = Bundle.main.path(forResource: audioName, ofType: "mp3") try player = AVAudioPlayer(contentsOf: NSURL(fileURLWithPath: audioPath!) as URL) }catch{ print(error,"Errorr") } self.timeSlider.maximumValue = Float(player.duration) self.volumeSlider.maximumValue = Float(player.volume) self.volumeSlider.value = self.volumeSlider.maximumValue let formatter = DateComponentsFormatter() formatter.allowedUnits = [.hour, .minute, .second] formatter.unitsStyle = .positional let formattedString = formatter.string(from: player.duration)! self.maxTimeLbl.text = formattedString self.minTimeLbl.text = "0:00" } override func viewWillAppear(_ animated: Bool) { let formatter = DateComponentsFormatter() formatter.allowedUnits = [.minute, .second] formatter.unitsStyle = .full self.minTimeLbl.text = formatter.string(from: player.currentTime)! } override var canBecomeFirstResponder: Bool{ return true } func pauseAudio(){ player.pause() } func playAudio(){ player.play() } func setSession(){ do{ try AVAudioSession.sharedInstance().setCategory(.playback, mode: .default) try AVAudioSession.sharedInstance().setActive(true) }catch{ print(error) } } @objc func updateTimeSlider(){ self.timeSlider.value = Float(player.currentTime) let formatter = DateComponentsFormatter() formatter.allowedUnits = [.hour, .minute, .second] formatter.unitsStyle = .positional let formattedString = formatter.string(from: player.currentTime)! self.minTimeLbl.text = formattedString } @IBAction func changePlayerVolume(_ sender: Any) { self.player.volume = volumeSlider.value } func secondsToHoursMinutesSeconds (seconds : Double) -> (Double, Double, Double) { let (hr, minf) = modf (seconds / 3600) let (min, secf) = modf (60 * minf) return (hr, min, 60 * secf) } @IBAction func changeAudioTime(_ sender: Any) { self.status = 1 self.playBtn.setImage(UIImage(named: "rounded-pause-button.png"), for: .normal) player.stop() player.currentTime = TimeInterval(timeSlider.value) player.prepareToPlay() player.play() } }
013dc24f398d464180ba72dd3cda616dff69e773
[ "Swift" ]
2
Swift
sumanthreddy1233/team03_medito
bf6988b027481431aafd2883cddbe6aedf4c6c10
37302e2a83fc878b49e538eb47782dc33ddde81f
refs/heads/master
<file_sep>$(document).ready(function () { $("#suggest").keyup(function(){ var search_term=$(this).val(); $.post('submit.php',{search_term:search_term},function(data){ $(".result").html(data); $(".result li").click(function(){ var value=$(this).text(); $("#suggest").val(value); $(".result").html(""); }); }); }); });<file_sep><?php $Link=mysqli_connect("localhost","dbuser","123","form"); $search=$_POST['search_term']; if($search!=""){ $query="select * from autosuggest where city like '$search%'"; $result= mysqli_query($Link, $query); while ($row = mysqli_fetch_assoc($result)) { echo '<li>',$row['city'],'</li>'; } } ?>
43faa4330904f830a67efeb2cc8bc12c3ab934b8
[ "JavaScript", "PHP" ]
2
JavaScript
pawanKarmanya/autosuggest
e8658c9e32c34e485b409152c5409dc237d6c8da
4865a8b354dc96bc6ec3c396456365cbada799a5
refs/heads/master
<repo_name>JustMcCray/blog<file_sep>/posts/sep18d/index.php <?php include("../../php/header.php"); ?> <div class="body"> <div class="page"> <div class="copy"> <h4>Sun Sep 18, 2016</h4> <p class="clear">I did it! Don't know if it was reall necessary, but I did it. I coded my webpage today. I think it looks better than the blog, though it will be a bit more tedious to update. I think I'm still going to use the blog just for ease and update here when I get the chance. Anyways, that was my day.</p> </div> <?php include("../../php/sidebar.php"); ?> </div> </div> <?php include("../../php/footer.php"); ?><file_sep>/posts/sep20/index.php <?php include("../../php/header.php"); ?> <div class="body"> <div class="page"> <div class="copy"> <h4>Tue Sep 20, 2016</h4> <p class="clear">Learned another thing. Instead of having to render from After Effects directly, there's an Adobe Media Encoder that you can push the file to. This allows you to keep using After Effects while the video exports, and it exports faster. But AME doesn't render ray-traced objects, which is what my video is made of. So rendering it out, I end up with floating text instead of on the sides of the letters. Instead of using AME, I now still have to use After Effects to export. This file takes five hours to export, so I have to do it overnight.</p> <div class="vid"> <video controls poster="../../images/sep20.png"> <source src="../../images/animation2.mp4"> </video> </div> <a href="https://youtu.be/OvOW4MsrFIg"> <p class="clear">Click here for the full size video.</p> </a> </div> <?php include("../../php/sidebar.php"); ?> </div> </div> <?php include("../../php/footer.php"); ?><file_sep>/posts/sep19/index.php <?php include("../../php/header.php"); ?> <div class="body"> <div class="page"> <div class="copy"> <h4>Mon Sep 19, 2016</h4> <div class="vid"> <video controls poster="../../images/sep19.png"> <source src="../../images/animation.mov"> </video> </div> <p class="clear">You learn something new everyday! Like how to insert a video into html. So now that I've got that somewhat figured out, here is the first rendering of my animation. It's quite short and still a work in progress, but it's a start.</p> </div> <?php include("../../php/sidebar.php"); ?> </div> </div> <?php include("../../php/footer.php"); ?><file_sep>/posts/oct11/index.php <?php include("../../php/header.php"); ?> <div class="body"> <div class="page"> <div class="copy"> <h4>Tue Oct 11, 2016</h4> <p class="clear">The cinemagraph project is due in two days, but I think I've got an appropriate piece to turn in for it. I went out with my brother and my girlfriend to a park on Sunday and we did a little slacklining. The sun was going down and the lighting was pretty decent, so I thought I'd take a few videos with my phone and see if I could use any of them for the project. This is what I finally came up with.</p> <div class="pic1"> <img class="img1" src="../../images/slackline.gif"> </div> <a href="https://youtu.be/ncJLYh-Luk8"> <p class="clear">Here's a link to a larger video.</p> </a> <p class="clear">I tried doing a video of a burnout in the dirt, but it was hard getting the framing right and getting the tire to stay in the shot because the truck would move forward too fast. Nonetheless, I'm happy with what I finally got for the project.</p> </div> <?php include("../../php/sidebar.php"); ?> </div> </div> <?php include("../../php/footer.php"); ?><file_sep>/posts/sep27/index.php <?php include("../../php/header.php"); ?> <div class="body"> <div class="page"> <div class="copy"> <h4>Tue Sep 27, 2016</h4> <p class="clear">Today's the day the project is due. So I turned it in. Last night was admittedly a late night, ran into a few problems I wasn't expecting. Even still, I forgot to add some stuff to the final project like the class name and school year, although I didn't notice that until this morning. With the render time my video has, I wasn't going to worry about it. It takes something like four hours to render and I didn't have the time to wait for it like I did when I let it render overnight. So, there's a couple things missing. But I otherwise think it turned out alright.</p> <div class="vid"> <video controls poster="../../images/sep27.png"> <source src="../../images/animation3.mov"> </video> </div> <a href="https://youtu.be/OvOW4MsrFIg"> <p class="clear">Click here for the full size video.</p> </a> </div> <?php include("../../php/sidebar.php"); ?> </div> </div> <?php include("../../php/footer.php"); ?><file_sep>/posts/aug30/index.php <?php include("../../php/header.php"); ?> <div class="body"> <div class="page"> <div class="copy"> <h4>Tue Aug 30, 2016</h4> <p class="clear">Simply my link to my After Effects tutorial.</p> <a href="https://youtu.be/3uxue2mEjOY"> <div class="pic1"> <img class="img1" src="../../images/tutorial.png"> </div> </a> <a href="https://youtu.be/3uxue2mEjOY"> <p class="clear">https://youtu.be/3uxue2mEjOY</p> </a> </div> <?php include("../../php/sidebar.php"); ?> </div> </div> <?php include("../../php/footer.php"); ?><file_sep>/posts/oct2/index.php <?php include("../../php/header.php"); ?> <div class="body"> <div class="page"> <div class="copy"> <h4>Sun Oct 2, 2016</h4> <p class="clear">Now I have to do a Cinemagraph for as a project. It's kind of like a GIF, but instead it uses real video, and only part of the frame is animated instead of the whole thing being in motion. We have to shoot our own video for this project, and I may get the chance to shoot what I want, otherwise I'm going to have to think of something else to do for it. Anyways, this is a proof of concept of my original idea, but this is from a video off of YouTube and not my own shot.</p> <div class="pic1"> <img class="img1" src="../../images/burnout2.gif"> </div> <a href="https://www.youtube.com/watch?v=gd34yWquPsY"> <p class="clear">Here's the link to the original video.</p> </a> <p class="clear">So for my idea, I want to do a burnout and freeze the tire, so only dirt and stuff is moving. I don't really have a car that is capable of doing this, but it's rainy outside today. So maybe I'll be able to take our truck out in the mud and get a good shot of a burnout there, which would be pretty cool.</p> </div> <?php include("../../php/sidebar.php"); ?> </div> </div> <?php include("../../php/footer.php"); ?><file_sep>/posts/sep18a/index.php <?php include("../../php/header.php"); ?> <div class="body"> <div class="page"> <div class="copy"> <h4>Sun Sep 18, 2016</h4> <p class="clear">So, our animation project. Supposed to go through a bunch of books to find designers we like and look at a bunch of their posters, immerse ourselves in design, start to create a library of design and inspiration to pull from.</p> <div class="pic1"> <img class="img1" src="../../images/book.jpg"> </div> <p class="clear">Ooh lookey, one of the books I used. I should have taken more pictures of the other books, instead of just the posters. Anyways, here are some of the posters I liked and thought could be cool animations.</p> <div class="pic3"> <img class="img3" src="../../images/palau_musica.jpg"> <img class="img3" src="../../images/happy_days.jpg"> <img class="img3" src="../../images/sum.jpg"> </div> <div class="pic3"> <img class="img3" src="../../images/sncf.jpg"> <img class="img3" src="../../images/letters.jpg"> <img class="img3" src="../../images/cake.jpg"> </div> <p class="clear"> Anyways, those are some of the posters, but this is the one I picked. Turns out it's not really a poster, but a sculpture by a Kumi Yamashita.</p> <div class="pic1"> <img class="img1" src="../../images/profile.jpg"> </div> <p class="clear">I thought it was pretty cool and figured I could make a neat animation with it. So far it's working out alright. We'll see how the end product is.</p> </div> <?php include("../../php/sidebar.php"); ?> </div> </div> <?php include("../../php/footer.php"); ?><file_sep>/posts/sep18c/index.php <?php include("../../php/header.php"); ?> <div class="body"> <div class="page"> <div class="copy"> <h4>Sun Sep 18 2016</h4> <p class="clear">I'm really terrible at coming up with stuff. I need a bunch of defining thoughts that a person would have that would make them who they are. What I have now are just a bunch of random things any ordinary person might think. I need something deep. Something that would cause someone to pause and think about, but not inspirational thoughts or anything. I need thoughts that show the way a specific person is thinking, and how those thoughts might make up their character traits. I feel like I'm also really not great at explaining stuff too, apparently.</p> </div> <?php include("../../php/sidebar.php"); ?> </div> </div> <?php include("../../php/footer.php"); ?>
bc0a6b70831b7056ab6f16dd3d91801de25de475
[ "PHP" ]
9
PHP
JustMcCray/blog
bb5b1f50b3e75df8b62a7e704302ef1470296c84
83dac5e31c8618c00bd10bf2cb2c172841db1a79
refs/heads/master
<file_sep>if (Package["browser-policy-common"]) { var content = Package['browser-policy-common'].BrowserPolicy.content; if (content) { content.allowOriginForAll('s.yjtag.jp'); content.allowOriginForAll('b.yjtag.jp'); content.allowOriginForAll('s.thebrighttag.com'); } }<file_sep># meteor-yahoo-tag-manager Yahoo! Tag Manager for Meteor app # setup 1) Add this package ```bash meteor add jhack:yahoo-tag-manager ``` 2) Write settings.json ```json { "public": { "yahooTagManager": { "id": "YOUR_YAHOO_TAG_MANAGER_ID" } } } ``` 3) Add code below (client-side only) ```js if (Meteor.isClient) { Meteor.startup(function() { YahooTagManager.appendToBody(); }); } ``` 4) Run app with --settings option ```bash meteor run --settings settings.json ``` # License MIT License <file_sep>var getSettingsNamespace = function() { return Meteor.settings && Meteor.settings.public && Meteor.settings.public.yahooTagManager || {}; }; var getYahooTagManagerId = function() { var settings = getSettingsNamespace(); return settings.id; }; var buildYahooTagManagerScript = function() { var tagId = getYahooTagManagerId(); if (tagId) { var script = document.createElement('script'); script.type = 'text/javascript'; var s = '(function () {' + 'var tagjs = document.createElement("script");' + 'var s = document.getElementsByTagName("script")[0];' + 'tagjs.async = true;' + 'tagjs.src = "//s.yjtag.jp/tag.js#site=' + tagId + '";' + 's.parentNode.insertBefore(tagjs, s);' + '}());'; script.innerHTML = s; return script; } }; var buildYahooTagManagerNoScript = function() { var tagId = getYahooTagManagerId(); if (tagId) { var noscript = document.createElement('noscript'); var iframe = document.createElement('iframe'); iframe.src = '//b.yjtag.jp/iframe?c=' + tagId; iframe.width = '1'; iframe.height = '1'; iframe.frameborder = '0'; iframe.scrolling = 'no'; iframe.marginheight = '0'; iframe.marginwidth = '0'; noscript.appendChild(iframe); return noscript; } }; var appendToBody = function() { if (getYahooTagManagerId()) { document.body.appendChild(buildYahooTagManagerScript()); document.body.appendChild(buildYahooTagManagerNoScript()); }; }; YahooTagManager = { getSettingsNamespace: getSettingsNamespace, getYahooTagManagerId: getYahooTagManagerId, buildYahooTagManagerScript: buildYahooTagManagerScript, buildYahooTagManagerNoScript: buildYahooTagManagerNoScript, appendToBody: appendToBody };
8ee0ea9fe0b46bade4c9e992de8d1dd5622453be
[ "JavaScript", "Markdown" ]
3
JavaScript
j-hack/meteor-yahoo-tag-manager
228b828c78210760e7824b17ce7d49b55fed9545
b9419fdf20a0728cf0806b364d50ebc6673d2e6d
refs/heads/master
<file_sep> # coding: utf-8 # In[1]: import os import setGPU import numpy as np import h5py from matplotlib import pyplot as plt import matplotlib import pandas as pd from decimal import Decimal import torch from sklearn.preprocessing import StandardScaler from torch.utils.data import Dataset, DataLoader from glob import glob import torch from torch.autograd import Variable import time import torch.nn as nn import torch.nn.parallel import torch.backends.cudnn as cudnn import torch.distributed as dist import torch.optim import torch.utils.data.distributed import torch.nn.functional as F from torch.utils.data.sampler import SubsetRandomSampler from torch.nn.utils.rnn import pack_padded_sequence, pad_packed_sequence from operator import itemgetter import itertools # In[2]: N=188 infile = h5py.File('/bigdata/shared/HLS4ML/jetMerged', 'r') sorted_pt_constituents = np.array(infile.get('jetConstituentList')) scaled_jets = infile.get('jets') # in any case mass_targets = scaled_jets[:,-6:-1] print("Loading completed") # In[3]: import torch.nn.functional as F class GraphNet(nn.Module): def __init__(self, n_constituents, n_targets, params, hidden): super(GraphNet, self).__init__() self.hidden = hidden self.P = params self.N = n_constituents self.Nr = self.N * (self.N - 1) self.Dr = 0 self.De = 5 self.Dx = 0 self.Do = 6 self.n_targets = n_targets self.assign_matrices() self.Ra = Variable(torch.ones(self.Dr, self.Nr)) self.fr1 = nn.Linear(2 * self.P + self.Dr, hidden) self.fr2 = nn.Linear(hidden, int(hidden/2)) self.fr3 = nn.Linear(int(hidden/2), self.De) self.fo1 = nn.Linear(self.P + self.Dx + self.De, hidden) self.fo2 = nn.Linear(hidden, int(hidden/2)) self.fo3 = nn.Linear(int(hidden/2), self.Do) self.fc1 = nn.Linear(self.Do * self.N, hidden) self.fc2 = nn.Linear(hidden, int(hidden/2)) self.fc3 = nn.Linear(int(hidden/2), self.n_targets) def assign_matrices(self): self.Rr = torch.zeros(self.N, self.Nr) self.Rs = torch.zeros(self.N, self.Nr) receiver_sender_list = [i for i in itertools.product(range(self.N), range(self.N)) if i[0]!=i[1]] for i, (r, s) in enumerate(receiver_sender_list): self.Rr[r, i] = 1 self.Rs[s, i] = 1 self.Rr = Variable(self.Rr).cuda() self.Rs = Variable(self.Rs).cuda() def forward(self, x): x=torch.transpose(x, 1, 2).contiguous() Orr = self.tmul(x, self.Rr) Ors = self.tmul(x, self.Rs) B = torch.cat([Orr, Ors], 1) ### First MLP ### B = torch.transpose(B, 1, 2).contiguous() B = nn.functional.relu(self.fr1(B.view(-1, 2 * self.P + self.Dr))) B = nn.functional.relu(self.fr2(B)) E = nn.functional.relu(self.fr3(B).view(-1, self.Nr, self.De)) del B E = torch.transpose(E, 1, 2).contiguous() Ebar = self.tmul(E, torch.transpose(self.Rr, 0, 1).contiguous()) del E C = torch.cat([x, Ebar], 1) C = torch.transpose(C, 1, 2).contiguous() ### Second MLP ### C = nn.functional.relu(self.fo1(C.view(-1, self.P + self.Dx + self.De))) C = nn.functional.relu(self.fo2(C)) O = nn.functional.relu(self.fo3(C).view(-1, self.N, self.Do)) del C ### Classification MLP ### N = nn.functional.relu(self.fc1(O.view(-1, self.Do * self.N))) del O N = nn.functional.relu(self.fc2(N)) N = self.fc3(N) return N def tmul(self, x, y): #Takes (I * J * K)(K * L) -> I * J * L x_shape = x.size() y_shape = y.size() return torch.mm(x.view(-1, x_shape[2]), y).view(-1, x_shape[1], y_shape[1]) model = GraphNet(n_constituents=188,n_targets=5,params=16, hidden=10) model.cuda() optimizer = torch.optim.Adam(model.parameters(), lr=10e-4) criterion = nn.CrossEntropyLoss() scheduler = torch.optim.lr_scheduler.ReduceLROnPlateau(optimizer,mode ='min',factor=0.5,patience=10) # In[4]: class EventDataset(Dataset): def __init__(self, constituents, targets, constituents_name = ['j1_pt', 'j1_etarel','j1_phirel'] ): self.constituents = torch.from_numpy(constituents) self.targets = torch.from_numpy(targets) self.constituents_name = constituents_name def __len__(self): return self.constituents.shape[0] def __getitem__(self,idx): return self.constituents[idx], self.targets[idx] # In[5]: test_size = 0.2 valid_size = 0.25 batch_size = 20 pin_memory = False num_workers = 4 epochs = 200 # In[6]: def shuffle(a,b): iX = a.shape[1] iY = a.shape[2] b_shape = b.shape[1] a = a.reshape(a.shape[0], iX*iY) total = np.column_stack((a,b)) np.random.shuffle(total) a = total[:,:iX*iY] b = total[:,iX*iY:iX*iY+b_shape] a = a.reshape(a.shape[0],iX, iY) return a,b # In[7]: sorted_pt_constituents, mass_targets = shuffle(sorted_pt_constituents, mass_targets) # In[8]: #for commenting sorted_pt_constituentsnp= sorted_pt_constituents num_train = sorted_pt_constituentsnp.shape[0] split = int(np.floor(test_size * num_train)) #for commenting sorted_indices = list(range(num_train)) split_v=int(np.floor(valid_size * (num_train-split))) train_idx, test_idx = sorted_indices[split:], sorted_indices[:split] train_idx, valid_idx = train_idx[split_v:], train_idx[:split_v] training_data = sorted_pt_constituentsnp[train_idx, :] validation_data = sorted_pt_constituentsnp[valid_idx, :] testing_data = sorted_pt_constituentsnp[test_idx,:] y_train = mass_targets[train_idx, :] y_valid = mass_targets[valid_idx, :] y_test = mass_targets[test_idx, :] # In[9]: y_train_1D =np.argmax(y_train, axis=1) y_valid_1D = np.argmax(y_valid, axis=1) y_test_1D = np.argmax(y_test, axis=1) train = EventDataset(training_data,y_train_1D) valid = EventDataset(validation_data,y_valid_1D) test = EventDataset(testing_data,y_test_1D) train_loader = DataLoader(dataset = train, batch_size = batch_size, shuffle = True, num_workers = 4) valid_loader = DataLoader(dataset = valid, batch_size = batch_size, shuffle = True, num_workers = 4) test_loader = DataLoader(dataset = test, batch_size = batch_size, shuffle = False, num_workers = 4) data_loader = {"training" :train_loader, "validation" : valid_loader} ####### finished # In[10]: class EarlyStopping(): """ Early Stopping to terminate training early under certain conditions """ def __init__(self, monitor='val_loss', min_delta=0, patience=25): super(EarlyStopping, self).__init__() self.monitor = monitor self.min_delta = min_delta self.patience = patience self.wait = 0 self.best_loss = 1e-15 self.stopped_epoch = 0 self.stop_training= False def on_train_begin(self, logs=None): self.wait = 0 self.best_loss = 1e15 def on_epoch_end(self, epoch, current_loss): if current_loss is None: pass else: if (current_loss - self.best_loss) < -self.min_delta: self.best_loss = current_loss self.wait = 1 else: if self.wait >= self.patience: self.stopped_epoch = epoch + 1 self.stop_training = True self.wait += 1 return self.stop_training def on_train_end(self): if self.stopped_epoch > 0: print('\nTerminated Training for Early Stopping at Epoch %04i' % (self.stopped_epoch)) # In[11]: f= open('INresults-JR_suggest.txt', 'w') # In[14]: def train_model(num_epochs, model, criterion, optimizer,scheduler,volatile=False): best_model = model.state_dict() best_acc = 0.0 train_losses ,val_losses = [],[] Early_Stopping = EarlyStopping(patience=30) Early_Stopping.on_train_begin() breakdown = False for epoch in range(num_epochs): if breakdown: print("Early Stopped") # f.write('Early Stopped\n') break print('Epoch {}/{}'.format(epoch, num_epochs - 1)) # f.write('Epoch {}/{}\n'.format(epoch, num_epochs - 1)) print('_' * 10) # f.write('_\n' * 10) # Each epoch has a training and validation phase for phase in ['training', 'validation']: if phase == 'training': model.train() # Set model to training mode else: model.eval() # Set model to evaluate mode volatile=True running_loss = 0.0 running_corrects = 0 # Iterate over data. for batch_idx, (x_data, y_data) in enumerate(data_loader[phase]): x_data, y_data = Variable(x_data.cuda().type(torch.cuda.FloatTensor),volatile),Variable(y_data.cuda().type(torch.cuda.LongTensor)) print("This is {} phase, and data size is {}" .format(phase, x_data.shape)) if phase == 'training': optimizer.zero_grad() # forwardgyg outputs = model(x_data) _, preds = torch.max(outputs.data, 1) loss = criterion(outputs, y_data) # backward + optimize only if in training phase if phase == 'training': loss.backward() optimizer.step() # statistics running_loss += loss.data[0] running_corrects += torch.sum(preds == y_data.data) #print("I finished %d batch" % batch_idx) epoch_loss = running_loss / len(data_loader[phase].dataset) epoch_acc = 100. * running_corrects / len(data_loader[phase].dataset) if phase == 'training': train_losses.append(epoch_loss) else: scheduler.step(epoch_loss) val_losses.append(epoch_loss) print('{} Loss: {:.4f} Acc: {:.4f}'.format( phase, epoch_loss, epoch_acc)) # f.write('{} Loss: {:.4f} Acc: {:.4f}\n'.format( # phase, epoch_loss, epoch_acc)) # deep copy the model if phase == 'validation' and epoch_acc > best_acc: print('Saving..') state = { 'net': model, #.module if use_cuda else net, 'epoch': epoch, 'best_acc':epoch_acc, 'train_loss':train_losses, 'val_loss':val_losses, } if not os.path.isdir('checkpoint_JR'): os.mkdir('checkpoint_JR') torch.save(state, './checkpoint_JR/IN.t7') best_acc = epoch_acc best_model = model.state_dict() if phase == 'validation': breakdown = Early_Stopping.on_epoch_end(epoch,round(epoch_loss,4)) print('Best val Acc: {:4f}'.format(best_acc)) # f.write('Best val Acc: {:4f}\n'.format(best_acc)) # load best model weights model.load_state_dict(best_model) return model,train_losses ,val_losses # In[16]: model_output,train_losses,val_losses = train_model(epochs,model,criterion,optimizer,scheduler) # In[ ]: # train_losses =np.array(train_losses) # val_losses = np.array(val_losses) # np.save('JRtrain_losses',train_losses) # np.save('JRval_losees', val_losses) # In[ ]: predicted = np.zeros((19742, 5)) test_loss = 0 test_correct = 0 for batch_idx, (x_data, y_data) in enumerate (test_loader): x_data, y_data = Variable(x_data.cuda().type(torch.cuda.FloatTensor),volatile=True),Variable(y_data.cuda().type(torch.cuda.LongTensor)) model_out = model_output(x_data) #print(model_output.data.shape) beg = batch_size*batch_idx end = min((batch_idx+1)*batch_size, 19742) predicted[beg:end] = F.softmax(model_out).data.cpu().numpy() # sum up batch loss test_loss += criterion(model_out, y_data).data[0] _, preds = torch.max(model_out.data, 1) # get the index of the max log-probability #predictions.extend(preds) test_correct += preds.eq(y_data.data).sum() test_loss /= len(test_loader.dataset) test_acc = 100. * test_correct/ len(test_loader.dataset) print('\nTest set: Average loss: {:.4f}, Accuracy: {}/{} ({:.0f}%)\n'.format( test_loss, test_correct, len(test_loader.dataset), test_acc)) # f.write('\nTest set: Average loss: {:.4f}, Accuracy: {}/{} ({:.0f}%)\n'.format( # test_loss, test_correct, len(test_loader.dataset), # test_acc)) # In[ ]: # np.save('predictedJR',predicted) # f.close() # In[ ]: # print(predicted) # In[ ]: import pandas as pd import matplotlib.pyplot as plt from sklearn.metrics import roc_curve, auc labels = ['j_g', 'j_q', 'j_w', 'j_z', 'j_t'] predict_test = np.exp(predicted) labels_val = y_test df = pd.DataFrame() fpr = {} tpr = {} auc1 = {} plt.figure() for i, label in enumerate(labels): df[label] = labels_val[:,i] df[label + '_pred_IN'] = predict_test[:,i] fpr[label], tpr[label], threshold = roc_curve(df[label],df[label+'_pred_IN']) auc1[label] = auc(fpr[label], tpr[label]) plt.plot(tpr[label],fpr[label],label='%s tagger, auc = %.1f%%'%(label,auc1[label]*100.)) df.to_csv("IN.csv", sep='\t') plt.semilogy() plt.xlabel("sig. efficiency") plt.ylabel("bkg. mistag rate") plt.ylim(0.0001,1) plt.grid(True) plt.legend(loc='upper left') #plt.savefig('%s/ROC.pdf'%(options.outputDir)) plt.show() # In[ ]: plt.plot(train_losses) plt.plot(val_losses) plt.plot() plt.yscale('log') plt.title('IN') plt.ylabel('loss') plt.xlabel('epoch') plt.legend(['train', 'valid'], loc='upper left') plt.show() <file_sep> # coding: utf-8 # In[1]: import os import setGPU import numpy as np import h5py from matplotlib import pyplot as plt import matplotlib import pandas as pd from decimal import Decimal import torch from sklearn.preprocessing import StandardScaler from torch.utils.data import Dataset, DataLoader from glob import glob import torch from torch.autograd import Variable import time import torch.nn as nn import torch.nn.parallel import torch.backends.cudnn as cudnn import torch.distributed as dist import torch.optim import torch.utils.data.distributed import torch.nn.functional as F from torch.utils.data.sampler import SubsetRandomSampler from torch.nn.utils.rnn import pack_padded_sequence, pad_packed_sequence from operator import itemgetter from sklearn.model_selection import train_test_split, StratifiedKFold from sklearn.preprocessing import MinMaxScaler from sklearn.model_selection import train_test_split, StratifiedKFold # In[3]: infile = h5py.File('/bigdata/shared/HLS4ML/NEW/AS/jetImageMerged.h5', 'r') file_d = h5py.File('/bigdata/shared/HLS4ML/NEW/jetImage_3507666_3511615.h5', 'r') jets = infile.get('jets') jetImageECAL = np.array(infile.get('jetImageECAL')) jetImageHCAL = np.array(infile.get('jetImageHCAL')) featureName = np.array(file_d.get("jetFeatureNames")) target = jets[:,-6:-1] expFeature_labels = [b'j_zlogz', b'j_c1_b0_mmdt',b'j_c1_b1_mmdt',b'j_c1_b2_mmdt',b'j_c2_b1_mmdt',b'j_c2_b2_mmdt',b'j_d2_b1_mmdt', b'j_d2_b2_mmdt',b'j_d2_a1_b1_mmdt',b'j_d2_a1_b2_mmdt',b'j_m2_b1_mmdt',b'j_m2_b2_mmdt',b'j_n2_b1_mmdt', b'j_n2_b2_mmdt',b'j_mass_mmdt',b'j_multiplicity'] exFeature_indexes = [] for feature in expFeature_labels : featureindex = featureName.tolist().index(feature) exFeature_indexes.append(featureindex) exFeature_indexes.sort() expFeature = jets[:,exFeature_indexes] # In[4]: maxPt = max(jets[:,1]) jetImageECAL = jetImageECAL/maxPt jetImageHCAL = jetImageHCAL/maxPt # In[5]: def shuffle(a,d, b, c): iX = a.shape[1] iY = a.shape[2] b_shape = b.shape[1] a = a.reshape(a.shape[0], iX*iY) d = d.reshape(d.shape[0], iX*iY) total = np.column_stack((a,d)) total = np.column_stack((total,b)) total = np.column_stack((total,c)) np.random.shuffle(total) a = total[:,:iX*iY] d = total[:,iX*iY:2*iX*iY] b = total[:,2*iX*iY:2*iX*iY+b_shape] c = total[:,2*iX*iY+b_shape:] a = a.reshape(a.shape[0],iX, iY,1) d = d.reshape(d.shape[0],iX, iY,1) return a,d,b,c,b_shape # In[6]: jetImageECAL,jetImageHCAL, expFeature, target, b_shape = shuffle(jetImageECAL,jetImageHCAL, expFeature, target) # In[7]: from sklearn.preprocessing import StandardScaler scaler = StandardScaler() scaled_expFeature = scaler.fit_transform(expFeature) # In[8]: y_train_in =np.argmax(target, axis=1) epochs=200 batch_size=1024 # In[9]: iSplit_1 = int(0.6*target.shape[0]) iSplit_2 = int(0.8*target.shape[0]) x_train = scaled_expFeature[:iSplit_1, :] x_valid = scaled_expFeature[iSplit_1:iSplit_2, :] x_test = scaled_expFeature[iSplit_2:, :] y_train= y_train_in[:iSplit_1] y_valid = y_train_in[iSplit_1:iSplit_2] y_test = y_train_in[iSplit_2:] training_dataset = np.column_stack((x_train,y_train)) validation_dataset = np.column_stack((x_valid,y_valid)) testing_dataset = np.column_stack((x_test,y_test)) y_test_label = target[iSplit_2:, :] # In[10]: class CustomDataset(Dataset): def __init__(self, data): self.len = data.shape[0] self.x_data = torch.from_numpy(data[:,:b_shape]) self.y_data = torch.from_numpy(data[:, b_shape:]).squeeze(1) def __getitem__(self, index): return self.x_data[index], self.y_data[index] def __len__(self): return self.len # In[11]: training_dataset= CustomDataset(training_dataset) validation_dataset = CustomDataset(validation_dataset) testing_dataset = CustomDataset(testing_dataset) train_loader = torch.utils.data.DataLoader(dataset = training_dataset, batch_size = batch_size, shuffle =True, num_workers = 4) valid_loader = torch.utils.data.DataLoader(dataset = validation_dataset, batch_size = batch_size, shuffle =True, num_workers = 4) test_loader = torch.utils.data.DataLoader(dataset = testing_dataset , batch_size = batch_size, shuffle =False, num_workers = 4) data_loader = {"training" :train_loader, "validation" : valid_loader} # In[16]: class Net(nn.Module): def __init__(self, hidden_layers, dropout, activ_f): super(Net, self).__init__() self.dropout = dropout self.activ_f = activ_f self.linear_layers = nn.ModuleList() self.input = 16 for i in range(int(hidden_layers)): linear_layer = nn.Linear(self.input,2**(4+i)) self.linear_layers.append(linear_layer) self.input = 2**(4+i) self.fc1 = nn.Linear(int(self.input), 5) def forward(self, x): for i in range(len(self.linear_layers)): x= getattr(F, self.activ_f)(self.linear_layers[i](x)) x = F.dropout(x, p= self.dropout, training=True) return F.log_softmax(self.fc1(x)) # In[14]: class EarlyStopping(object): """ Early Stopping to terminate training early under certain conditions """ def __init__(self, monitor='val_loss', min_delta=0, patience=10): super(EarlyStopping, self).__init__() self.monitor = monitor self.min_delta = min_delta self.patience = patience self.wait = 0 self.best_loss = 1e-15 self.stopped_epoch = 0 self.stop_training= False print("This is my patience {}".format(patience)) def on_train_begin(self): self.wait = 0 self.best_loss = 1e15 def on_epoch_end(self, epoch, current_loss): if current_loss is None: pass else: if (current_loss - self.best_loss) < -self.min_delta: self.best_loss = current_loss self.wait = 1 else: if self.wait >= self.patience: self.stopped_epoch = epoch + 1 self.stop_training = True self.wait += 1 return self.stop_training def on_train_end(self): if self.stopped_epoch > 0: print('\nTerminated Training for Early Stopping at Epoch %04i' % (self.stopped_epoch)) # In[15]: def train_model(num_epochs, model, criterion, optimizer,scheduler,volatile=False): best_model = model.state_dict() best_acc = 0.0 train_losses ,val_losses = [],[] Early_Stopping = EarlyStopping(patience=30) Early_Stopping.on_train_begin() breakdown = False p=10 for epoch in range(num_epochs): if breakdown: print("Early Stopped") break print('Epoch {}/{}'.format(epoch, num_epochs - 1)) print('_' * 10) # Each epoch has a training and validation phase for phase in ['training', 'validation']: if phase == 'training': model.train() # Set model to training mode else: model.eval() # Set model to evaluate mode volatile=True running_loss = 0.0 running_corrects = 0 # Iterate over data. for batch_idx, (x_data, y_data) in enumerate(data_loader[phase]): x_data, y_data = Variable(x_data.cuda().type(torch.cuda.FloatTensor),volatile),Variable(y_data.cuda().type(torch.cuda.LongTensor)) if phase == 'training': optimizer.zero_grad() # forwardgyg outputs = model(x_data) _, preds = torch.max(outputs.data, 1) loss = criterion(outputs, y_data) # backward + optimize only if in training phase if phase == 'training': loss.backward() optimizer.step() # statistics running_loss += loss.data[0] running_corrects += torch.sum(preds == y_data.data) epoch_loss = running_loss / len(data_loader[phase].dataset) epoch_acc = 100. * running_corrects / len(data_loader[phase].dataset) if phase == 'training': train_losses.append(epoch_loss) else: scheduler.step(epoch_loss) val_losses.append(epoch_loss) print('{} Loss: {:.4f} Acc: {:.4f}'.format( phase, epoch_loss, epoch_acc)) # deep copy the model if phase == 'validation' and epoch_acc > best_acc: print('Saving..') state = { 'net': model, #.module if use_cuda else net, 'epoch': epoch, 'best_acc':epoch_acc, 'train_loss':train_losses, 'val_loss':val_losses, } if not os.path.isdir('checkpoint4'): os.mkdir('checkpoint4') torch.save(state, './checkpoint4/IN.t7') best_acc = epoch_acc best_model = model.state_dict() if phase == 'validation': breakdown = Early_Stopping.on_epoch_end(epoch,round(epoch_loss, 4)) print() print('Best val Acc: {:4f}'.format(best_acc)) model.load_state_dict(best_model) return best_acc # In[35]: import os from threading import Thread import hashlib import json import time import glob # In[36]: class externalfunc: # call the python_ex_blablabla.py function, get the accuracy , write to the json file and then read it #and return accuracy def __init__(self , prog, names): self.call = prog self.N = names def __call__(self, X): # eto i est' chto tam gp.mimimize call the function with dim self.args = dict(zip(self.N,X)) h = hashlib.md5(str(self.args).encode('utf-8')).hexdigest() com = '%s %s'% (self.call, ' '.join(['--%s %s'%(k,v) for (k,v) in self.args.items() ])) # koroch delaet python lll.py # par0 0.45, par1 0.75 .... com += ' --hash %s'%h com += ' > %s.log'%h print ("Executing: ",com) ## run the command c = os.system( com ) ## get the output try: r = json.loads(open('%s.json'%h).read()) Y = r['result'] except: print ("Failed on",com) Y = None return Y # vernet accuracy po tem parametram chto on tol'ko chto zatestil # In[37]: class manager: def __init__(self, n, skobj, iterations, func, wait=10): self.n = n ## number of parallel processes, smth related with workers self.sk = skobj ## the skoptimizer you created self.iterations = iterations # run_for self.wait = wait self.func = func def run(self): ## first collect all possible existing results for eh in glob.glob('*.json'): try: ehf = json.loads(open(eh).read()) y = ehf['result'] x = [ehf['params'][n] for n in self.func.N] # par0 , par1, par2 print ("pre-fitting",x,y,"remove",eh,"to prevent this") print (skop.__version__) self.sk.tell( x,y ) except: pass workers=[] it = 0 asked = [] while it< self.iterations: ## number of thread going n_on = sum([w.is_alive() for w in workers]) if n_on< self.n: ## find all workers that were not used yet, and tell their value XYs = [] for w in workers: if (not w.used and not w.is_alive()): if w.Y != None: XYs.append((w.X,w.Y)) w.used = True if XYs: one_by_one= False if one_by_one: for xy in XYs: print ("\t got",xy[1],"at",xy[0]) self.sk.tell(xy[0], xy[1]) else: print ("\t got",len(XYs),"values") print ("\n".join(str(xy) for xy in XYs)) self.sk.tell( [xy[0] for xy in XYs], [xy[1] for xy in XYs]) asked = [] ## there will be new suggested values print (len(self.sk.Xi)) ## spawn a new one, with proposed parameters if not asked: asked = self.sk.ask(n_points = self.n) if asked: par = asked.pop(-1) else: print ("no value recommended") it+=1 print ("Starting a thread with",par,"%d/%d"%(it,self.iterations)) workers.append( worker( X=par , func=self.func )) workers[-1].start() time.sleep(self.wait) ## do not start all at the same exact time else: ## threads are still running if self.wait: #print n_on,"still running" pass time.sleep(self.wait) # In[38]: class worker(Thread): def __init__(self, #N, X, func): Thread.__init__(self) self.X = X self.used = False self.func = func def run(self): self.Y = self.func(self.X) # In[39]: def dummy_func( X ): model = Net(X[0],X[1],X[2]) model.cuda() optimizer = torch.optim.Adam(model.parameters(), lr=X[3]) criterion= nn.NLLLoss() scheduler = torch.optim.lr_scheduler.ReduceLROnPlateau(optimizer,mode ='min',factor=0.5,patience=10) best_acc = train_model(epochs,model,criterion,optimizer,scheduler) Y = - (best_acc) return Y # In[40]: if __name__ == "__main__": from skopt import Optimizer from skopt.learning import GaussianProcessRegressor from skopt.space import Real, Categorical, Integer from skopt import gp_minimize import sys n_par = 4 externalize = externalfunc(prog='python run_train_ex.py', names = ['par%s'%d for d in range(n_par)]) # open the json file, and write the results # for each parameter combination (just initialization) run_for = 20 use_func = externalize dim = [Integer(1, 5), Real(0, 0.9),Categorical(['relu', 'tanh','selu','leaky_relu']),Real(1e-5,1e-3)] # eto i X start = time.mktime(time.gmtime()) res = gp_minimize( func=use_func, dimensions=dim, n_calls = run_for, ) print ("GPM best value",res.fun,"at",res.x) # function value at the minimum and location of the minimum #print res print ("took",time.mktime(time.gmtime())-start,"[s]") o = Optimizer( n_initial_points =5, acq_func = 'gp_hedge', acq_optimizer='auto', base_estimator=GaussianProcessRegressor(alpha=0.0, copy_X_train=True, n_restarts_optimizer=2, noise='gaussian', normalize_y=True, optimizer='fmin_l_bfgs_b'), dimensions=dim, ) m = manager(n = 4, skobj = o, iterations = run_for, func = use_func, wait= 0 ) start = time.mktime(time.gmtime()) m.run() # nado posmotret' chto manager .run delaet import numpy as np best = np.argmin( m.sk.yi) print ("Threaded GPM best value",m.sk.yi[best],"at",m.sk.Xi[best],) print ("took",time.mktime(time.gmtime())-start,"[s]") <file_sep> # coding: utf-8 # In[1]: import os import setGPU import numpy as np from numpy import random import h5py from matplotlib import pyplot as plt import matplotlib import pandas as pd from decimal import Decimal import torch from sklearn.preprocessing import StandardScaler from torch.utils.data import Dataset, DataLoader from glob import glob import torch from torch.autograd import Variable import time import torch.nn as nn import torch.nn.parallel import torch.backends.cudnn as cudnn import torch.distributed as dist import torch.optim import torch.utils.data.distributed import torch.nn.functional as F from torch.utils.data.sampler import SubsetRandomSampler from torch.nn.utils.rnn import pack_padded_sequence, pad_packed_sequence from operator import itemgetter import itertools from sklearn.model_selection import train_test_split, StratifiedKFold # In[2]: file = h5py.File('/bigdata/shared/HLS4ML/jetImage.h5', 'r') print(list(file.keys())) sorted_pt_constituents = np.array(file.get('jetConstituentList')) scaled_jets = file.get('jets') targets = scaled_jets[:,-6:-1] # In[3]: def shuffle(a,b): iX = a.shape[1] iY = a.shape[2] b_shape = b.shape[1] a = a.reshape(a.shape[0], iX*iY) total = np.column_stack((a,b)) random.seed(1) np.random.shuffle(total) a = total[:,:iX*iY] b = total[:,iX*iY:iX*iY+b_shape] a = a.reshape(a.shape[0],iX, iY) return a,b # In[4]: sorted_pt_constituents, targets = shuffle(sorted_pt_constituents, targets) y_train =np.argmax(targets, axis=1) # In[5]: fraction = input("Please enter what fraction of dataset you want: ") print("You entered " + str(fraction)) fraction = float(fraction) # In[6]: num = targets.shape[0] split_dataset = int(np.floor(fraction * num)) sorted_pt_constituents = sorted_pt_constituents[:split_dataset,:,:] targets =targets[:split_dataset] print(sorted_pt_constituents.shape) print(targets.shape) # In[7]: No = 188 P=16 Nr = int(No*(No-1)/2) # In[9]: connection_list = [i for i in itertools.product(range(187), range(188)) if i[0]!=i[1] and i[0]<i[1]] # In[ ]: RR = np.array([]) for arr in sorted_pt_constituents: Rr = np.zeros((Nr, No)) for i, (r, s) in enumerate(connection_list): if arr[r, 0]==0 or arr[s,0] == 0: Rr[i, r] = 0 Rr[i, s] = 0 else: Rr[i, r] = 1 Rr[i, s] = 1 RR = np.concatenate((RR,Rr), axis=0) if RR.size else Rr print(RR) # In[ ]: RR = np.transpose(RR) # In[8]: def load_data_kfold(k,sorted_pt_constituents,RR, y_train): folds = list(StratifiedKFold(n_splits=k, shuffle=True, random_state=1).split(sorted_pt_constituents, RR, y_train)) return folds # In[9]: k = 5 folds = load_data_kfold(k,sorted_pt_constituents,RR,y_train) # In[5]: import torch.nn.functional as F class GraphNet(nn.Module): def __init__(self, n_constituents, n_targets, params, hidden): super(GraphNet, self).__init__() self.hidden = hidden self.P = params self.N = n_constituents self.Dr = 0 self.De = 5 self.Dx = 0 self.Do = 6 self.Nr=Nr self.n_targets = n_targets self.fr1 = nn.Linear(self.P + self.Dr, hidden) self.fr2 = nn.Linear(hidden, int(hidden/2)) self.fr3 = nn.Linear(int(hidden/2), self.De) self.fo1 = nn.Linear(self.P + self.Dx + self.De, hidden) self.fo2 = nn.Linear(hidden, int(hidden/2)) self.fo3 = nn.Linear(int(hidden/2), self.Do) self.fc1 = nn.Linear(self.Do * self.N, hidden) self.fc2 = nn.Linear(hidden, int(hidden/2)) self.fc3 = nn.Linear(int(hidden/2), self.n_targets) def forward(self, x, RR): x=torch.transpose(x, 1, 2).contiguous() Orr = self.tmul(x, self.RR) B = torch.transpose(Orr, 1, 2).contiguous() ### First MLP ### B = nn.functional.tanh(self.fr1(B.view(-1, self.P + self.Dr))) B = nn.functional.tanh(self.fr2(B)) E = nn.functional.tanh(self.fr3(B).view(-1, self.Nr, self.De)) del B E = torch.transpose(E, 1, 2).contiguous() Ebar = self.tmul(E, torch.transpose(self.Rr, 0, 1).contiguous()) del E C = torch.cat([x, Ebar], 1) C = torch.transpose(C, 1, 2).contiguous() ### Second MLP ### C = nn.functional.tanh(self.fo1(C.view(-1, self.P + self.Dx + self.De))) C = nn.functional.tanh(self.fo2(C)) O = nn.functional.tanh(self.fo3(C).view(-1, self.N, self.Do)) O = torch.sum(O, dim=1) del C ### Classification MLP ### N = nn.functional.tanh(self.fc1(O.view(-1, self.Do))) del O N = nn.functional.tanh(self.fc2(N)) N = self.fc3(N) return N def tmul(self, x, y): #Takes (I * J * K)(K * L) -> I * J * L x_shape = x.size() y_shape = y.size() return torch.mm(x.view(-1, x_shape[2]), y).view(-1, x_shape[1], y_shape[1]) # In[11]: batch_size=128 epochs =200 # In[12]: class EventDataset(Dataset): def __init__(self, constituents, targets, constituents_name = ['j1_pt', 'j1_etarel','j1_phirel'] ): self.constituents = torch.from_numpy(constituents) self.targets = torch.from_numpy(targets) self.constituents_name = constituents_name def __len__(self): return self.constituents.shape[0] def __getitem__(self,idx): return self.constituents[idx], self.targets[idx] # In[17]: f= open('IN_fr_dataset_%f.txt' % fraction, 'w') # In[14]: class EarlyStopping(object): """ Early Stopping to terminate training early under certain conditions """ def __init__(self, monitor='val_loss', min_delta=0, patience=30): super(EarlyStopping, self).__init__() print("This is my patience {}".format(patience)) f.write("This is my patience {}\n".format(patience)) self.monitor = monitor self.min_delta = min_delta self.patience = patience self.wait = 0 self.best_loss = 1e-15 self.stopped_epoch = 0 self.stop_training= False def on_train_begin(self, logs=None): self.wait = 0 self.best_loss = 1e15 def on_epoch_end(self, epoch, current_loss): print("This is current loss {}".format(current_loss)) f.write("This is current loss {}\n".format(current_loss)) if current_loss is None: pass else: if (current_loss - self.best_loss) < -self.min_delta: self.best_loss = current_loss print("This is best loss {}".format(self.best_loss)) f.write("This is best loss {}\n".format(self.best_loss)) self.wait = 1 else: if self.wait >= self.patience: self.stopped_epoch = epoch + 1 self.stop_training = True self.wait += 1 return self.stop_training def on_train_end(self): if self.stopped_epoch > 0: print('\nTerminated Training for Early Stopping at Epoch %04i' % (self.stopped_epoch)) # In[15]: def train_model(data_loader,num_epochs, model, criterion, optimizer,scheduler,volatile=False): best_model = model.state_dict() best_acc = 0.0 train_losses ,val_losses = [],[] Early_Stopping = EarlyStopping(patience=30) Early_Stopping.on_train_begin() breakdown = False for epoch in range(num_epochs): if breakdown: print("Early Stopped") f.write('Early Stopped\n') break print('Epoch {}/{}'.format(epoch, num_epochs - 1)) f.write('Epoch {}/{}\n'.format(epoch, num_epochs - 1)) print('_' * 10) # Each epoch has a training and validation phase for phase in ['training', 'validation']: if phase == 'training': model.train() # Set model to training mode else: model.eval() # Set model to evaluate mode volatile=True running_loss = 0.0 running_corrects = 0 # Iterate over data. for batch_idx, (x_data, y_data) in enumerate(data_loader[phase]): x_data, y_data = Variable(x_data.cuda().type(torch.cuda.FloatTensor),volatile),Variable(y_data.cuda().type(torch.cuda.LongTensor)) if phase == 'training': optimizer.zero_grad() # forwardgyg outputs = model(x_data) _, preds = torch.max(outputs.data, 1) loss = criterion(outputs, y_data) # backward + optimize only if in training phase if phase == 'training': loss.backward() optimizer.step() # statistics running_loss += loss.data[0] running_corrects += torch.sum(preds == y_data.data) #print("I finished %d batch" % batch_idx) epoch_loss = running_loss / len(data_loader[phase].dataset) epoch_acc = 100. * running_corrects / len(data_loader[phase].dataset) if phase == 'training': train_losses.append(epoch_loss) else: scheduler.step(epoch_loss) val_losses.append(epoch_loss) print('{} Loss: {:.4f} Acc: {:.4f}'.format( phase, epoch_loss, epoch_acc)) f.write('{} Loss: {:.4f} Acc: {:.4f}\n'.format( phase, epoch_loss, epoch_acc)) # deep copy the model if phase == 'validation' and epoch_acc > best_acc: print('Saving..') state = { 'net': model, #.module if use_cuda else net, 'epoch': epoch, 'best_acc':epoch_acc, 'train_loss':train_losses, 'val_loss':val_losses, } if not os.path.isdir('checkpoint4'): os.mkdir('checkpoint4') torch.save(state, './checkpoint4/IN.t7') best_acc = epoch_acc best_model = model.state_dict() if phase == 'validation': breakdown = Early_Stopping.on_epoch_end(epoch,round(epoch_loss,4)) print() print('Best val Acc: {:4f}'.format(best_acc)) f.write('Best val Acc: {:4f}\n'.format(best_acc)) # load best model weights model.load_state_dict(best_model) return model,train_losses ,val_losses # In[16]: for j, (train_idx, val_idx) in enumerate(folds): print('\nFold ',j) f.write('\nFold {}'.format(j)) X_train_cv = sorted_pt_constituents[train_idx] y_train_cv = y_train[train_idx] X_valid_cv = sorted_pt_constituents[val_idx] y_valid_cv= y_train[val_idx] train = EventDataset(X_train_cv,y_train_cv) valid = EventDataset(X_valid_cv,y_valid_cv) train_loader = DataLoader(dataset = train, batch_size = batch_size, shuffle = True, num_workers = 4) valid_loader = DataLoader(dataset = valid, batch_size = batch_size, shuffle = True, num_workers = 4) data_loader = {"training" :train_loader, "validation" : valid_loader} model = GraphNet(n_constituents=188,n_targets=5,params=16, hidden=10) model.cuda() optimizer = torch.optim.Adam(model.parameters(), lr=10e-4) criterion = nn.CrossEntropyLoss() scheduler = torch.optim.lr_scheduler.ReduceLROnPlateau(optimizer,mode ='min',factor=0.5,patience=10) model_output,train_losses,val_losses = train_model(data_loader,epochs,model,criterion,optimizer,scheduler) np.save('train_losses of folder {} and fraction {}'.format(j, fraction),train_losses) np.save('val_losees of folder {} and fraction {}'.format(j, fraction), val_losses) print('Saving after {} fold..'.format(j)) state = { 'net': model_output, #.module if use_cuda else net, 'train_loss':train_losses, 'val_loss':val_losses } if not os.path.isdir('folder_checkpoint_4'): os.mkdir('folder_checkpoint_4') torch.save(state, './folder_checkpoint_4/folder_IN_.t7') # In[ ]: f.close() <file_sep> # coding: utf-8 # In[1]: import os import setGPU import numpy as np import h5py from matplotlib import pyplot as plt import matplotlib import pandas as pd from decimal import Decimal import torch from sklearn.preprocessing import StandardScaler from torch.utils.data import Dataset, DataLoader from glob import glob import torch from torch.autograd import Variable import time import torch.nn as nn import torch.nn.parallel import torch.backends.cudnn as cudnn import torch.distributed as dist import torch.optim import torch.utils.data.distributed import torch.nn.functional as F from torch.utils.data.sampler import SubsetRandomSampler from torch.nn.utils.rnn import pack_padded_sequence, pad_packed_sequence from operator import itemgetter from sklearn.model_selection import train_test_split, StratifiedKFold from sklearn.preprocessing import MinMaxScaler get_ipython().run_line_magic('matplotlib', 'inline') from sklearn.model_selection import train_test_split, StratifiedKFold # In[2]: infile = h5py.File('/bigdata/shared/HLS4ML/NEW/AS/jetImageMerged.h5', 'r') file_m = h5py.File('/bigdata/shared/HLS4ML/NEW/jetImage_983445_990519.h5', 'r') jets = infile.get('jets') jetImageECAL = np.array(infile.get('jetImageECAL')) jetImageHCAL = np.array(infile.get('jetImageHCAL')) featureName = np.array(file_m.get("jetFeatureNames")) print(list(featureName)) target = jets[:,-6:-1] expFeature_labels = [b'j_zlogz', b'j_c1_b0_mmdt',b'j_c1_b1_mmdt',b'j_c1_b2_mmdt',b'j_c2_b1_mmdt',b'j_c2_b2_mmdt',b'j_d2_b1_mmdt', b'j_d2_b2_mmdt',b'j_d2_a1_b1_mmdt',b'j_d2_a1_b2_mmdt',b'j_m2_b1_mmdt',b'j_m2_b2_mmdt',b'j_n2_b1_mmdt', b'j_n2_b2_mmdt',b'j_mass_mmdt',b'j_multiplicity'] exFeature_indexes = [] for feature in expFeature_labels : featureindex = featureName.tolist().index(feature) exFeature_indexes.append(featureindex) exFeature_indexes.sort() print(exFeature_indexes) expFeature = jets[:,exFeature_indexes] print(expFeature.shape) # In[3]: maxPt = max(jets[:,1]) jetImageECAL = jetImageECAL/maxPt jetImageHCAL = jetImageHCAL/maxPt # In[4]: def shuffle(a,d, b, c): iX = a.shape[1] iY = a.shape[2] b_shape = b.shape[1] a = a.reshape(a.shape[0], iX*iY) d = d.reshape(d.shape[0], iX*iY) total = np.column_stack((a,d)) total = np.column_stack((total,b)) total = np.column_stack((total,c)) np.random.shuffle(total) a = total[:,:iX*iY] d = total[:,iX*iY:2*iX*iY] b = total[:,2*iX*iY:2*iX*iY+b_shape] c = total[:,2*iX*iY+b_shape:] a = a.reshape(a.shape[0],iX, iY,1) d = d.reshape(d.shape[0],iX, iY,1) return a,d,b,c,b_shape # In[5]: jetImageECAL,jetImageHCAL, expFeature, target, b_shape = shuffle(jetImageECAL,jetImageHCAL, expFeature, target) # In[6]: from sklearn.preprocessing import StandardScaler print(expFeature.shape) scaler = StandardScaler() scaled_expFeature = scaler.fit_transform(expFeature) print(scaled_expFeature.shape) # In[7]: y_train_in =np.argmax(target, axis=1) # In[8]: epochs=100 batch_size=1024 # In[9]: iSplit_1 = int(0.6*target.shape[0]) iSplit_2 = int(0.8*target.shape[0]) x_train = scaled_expFeature[:iSplit_1, :] x_valid = scaled_expFeature[iSplit_1:iSplit_2, :] x_test = scaled_expFeature[iSplit_2:, :] y_train= y_train_in[:iSplit_1] y_valid = y_train_in[iSplit_1:iSplit_2] y_test = y_train_in[iSplit_2:] training_dataset = np.column_stack((x_train,y_train)) validation_dataset = np.column_stack((x_valid,y_valid)) testing_dataset = np.column_stack((x_test,y_test)) y_test_label = target[iSplit_2:, :] # In[16]: class Net(nn.Module): def __init__(self, hidden_layers, dropout, activ_f): super(Net, self).__init__() self.dropout = dropout self.activ_f = activ_f self.linear_layers = nn.ModuleList() self.input = 16 for i in range(int(hidden_layers)): linear_layer = nn.Linear(self.input,2**(4+i)) self.linear_layers.append(linear_layer) self.input = 2**(4+i) self.fc1 = nn.Linear(int(self.input), 5) def forward(self, x): for i in range(len(self.linear_layers)): x= getattr(F, self.activ_f)(self.linear_layers[i](x)) x = F.dropout(x, p= self.dropout, training=True) return F.log_softmax(self.fc1(x)) model = Net(5,0,'tanh') model.cuda() optimizer = torch.optim.Adam(model.parameters(), lr=1e-3) criterion= nn.NLLLoss() scheduler = torch.optim.lr_scheduler.ReduceLROnPlateau(optimizer,mode ='min',factor=0.5,patience=10) # class Net(nn.Module): # def __init__(self, hidden_layers, dropout, activ_f): # super(Net, self).__init__() # self.dropout = dropout # self.activ_f = activ_f # hidden =64 # nodes = [16] # for i in range(hidden_layers): # if i == hidden_layers-1: # nodes.append(5) # else: # nodes.append(hidden) # hidden = int(hidden/2) # self.linear_layers = nn.ModuleList() # for d in range(1,len(nodes)): # linear_layer = torch.nn.Linear(nodes[d-1],nodes[d]) # self.linear_layers.append(linear_layer) # # print(self.linear_layers) # def forward(self, x): # for i in range (len(self.linear_layers)): # if i == len(self.linear_layers)-1: # return F.log_softmax(self.linear_layers[i](x)) # x = getattr(F, self.activ_f)(self.linear_layers[i](x)) # x = F.dropout(x, p=self.dropout, training=True) # model = Net() # model.cuda() # print(model) # optimizer = torch.optim.Adam(model.parameters(), lr=10e-4) # criterion= nn.NLLLoss() # scheduler = torch.optim.lr_scheduler.ReduceLROnPlateau(optimizer,mode ='min',factor=0.5,patience=10) # In[11]: class CustomDataset(Dataset): def __init__(self, data): self.len = data.shape[0] self.x_data = torch.from_numpy(data[:,:b_shape]) self.y_data = torch.from_numpy(data[:, b_shape:]).squeeze(1) def __getitem__(self, index): return self.x_data[index], self.y_data[index] def __len__(self): return self.len # In[12]: training_dataset= CustomDataset(training_dataset) validation_dataset = CustomDataset(validation_dataset) testing_dataset = CustomDataset(testing_dataset) train_loader = torch.utils.data.DataLoader(dataset = training_dataset, batch_size = batch_size, shuffle =True, num_workers = 4) valid_loader = torch.utils.data.DataLoader(dataset = validation_dataset, batch_size = batch_size, shuffle =True, num_workers = 4) test_loader = torch.utils.data.DataLoader(dataset = testing_dataset , batch_size = batch_size, shuffle =False, num_workers = 4) data_loader = {"training" :train_loader, "validation" : valid_loader} # In[13]: class EarlyStopping(): """ Early Stopping to terminate training early under certain conditions """ def __init__(self, monitor='val_loss', min_delta=0, patience=10): super(EarlyStopping, self).__init__() self.monitor = monitor self.min_delta = min_delta self.patience = patience self.wait = 0 self.best_loss = 1e-15 self.stopped_epoch = 0 self.stop_training= False print("This is my patience {}".format(patience)) def on_train_begin(self): self.wait = 0 self.best_loss = 1e15 def on_epoch_end(self, epoch, current_loss): if current_loss is None: pass else: if (current_loss - self.best_loss) < -self.min_delta: self.best_loss = current_loss self.wait = 1 else: if self.wait >= self.patience: self.stopped_epoch = epoch + 1 self.stop_training = True self.wait += 1 return self.stop_training def on_train_end(self): if self.stopped_epoch > 0: print('\nTerminated Training for Early Stopping at Epoch %04i' % (self.stopped_epoch)) # In[14]: def train_model(num_epochs, model, criterion, optimizer,scheduler,volatile=False): best_model = model.state_dict() best_acc = 0.0 train_losses ,val_losses = [],[] Early_Stopping = EarlyStopping(patience=20) Early_Stopping.on_train_begin() breakdown = False for epoch in range(num_epochs): if breakdown: print("Early Stopped") break print('Epoch {}/{}'.format(epoch, num_epochs - 1)) print('_' * 10) # Each epoch has a training and validation phase for phase in ['training', 'validation']: if phase == 'training': model.train() # Set model to training mode else: model.eval() # Set model to evaluate mode volatile=True running_loss = 0.0 running_corrects = 0 # Iterate over data. for batch_idx, (x_data, y_data) in enumerate(data_loader[phase]): x_data, y_data = Variable(x_data.cuda().type(torch.cuda.FloatTensor),volatile),Variable(y_data.cuda().type(torch.cuda.LongTensor)) if phase == 'training': optimizer.zero_grad() # forwardgyg outputs = model(x_data) _, preds = torch.max(outputs.data, 1) loss = criterion(outputs, y_data) # backward + optimize only if in training phase if phase == 'training': loss.backward() optimizer.step() # statistics running_loss += loss.data[0] running_corrects += torch.sum(preds == y_data.data) #print("I finished %d batch" % batch_idx) epoch_loss = running_loss / len(data_loader[phase].dataset) epoch_acc = 100. * running_corrects / len(data_loader[phase].dataset) if phase == 'training': train_losses.append(epoch_loss) else: scheduler.step(epoch_loss) val_losses.append(epoch_loss) print('{} Loss: {:.4f} Acc: {:.4f}'.format( phase, epoch_loss, epoch_acc)) # deep copy the model if phase == 'validation' and epoch_acc > best_acc: print('Saving..') state = { 'net': model, #.module if use_cuda else net, 'epoch': epoch, 'best_acc':epoch_acc, 'train_loss':train_losses, 'val_loss':val_losses, } if not os.path.isdir('checkpoint_DNN'): os.mkdir('checkpoint_DNN') torch.save(state, './checkpoint_DNN/DNN.t7') best_acc = epoch_acc best_model = model.state_dict() if phase == 'validation': breakdown = Early_Stopping.on_epoch_end(epoch,round(epoch_loss, 5)) print() print('Best val Acc: {:4f}'.format(best_acc)) # load best model weights model.load_state_dict(best_model) return model,train_losses ,val_losses # In[17]: model_output,train_losses_dense,val_losses_dense = train_model(epochs,model,criterion,optimizer,scheduler) # In[18]: plt.figure() plt.plot(train_losses_dense) plt.plot(val_losses_dense) plt.plot() plt.yscale('log') plt.title('dense') plt.ylabel('loss') plt.xlabel('epoch') plt.legend(['train', 'valid'], loc='upper left') plt.show() # In[ ]: print() # In[19]: # run a test loop predicted = np.zeros((x_test.shape[0], 5)) test_loss = 0 test_correct = 0 for batch_idx, (x_data, y_data) in enumerate (test_loader): x_data, y_data = Variable(x_data.cuda().type(torch.cuda.FloatTensor),volatile=True),Variable(y_data.cuda().type(torch.cuda.LongTensor)) model_out = model_output(x_data) beg = batch_size*batch_idx end = min((batch_idx+1)*batch_size, x_test.shape[0]) predicted[beg:end] = model_out.data.cpu().numpy() # sum up batch loss test_loss += criterion(model_out, y_data).data[0] _, preds = torch.max(model_out.data, 1) # get the index of the max log-probability #predictions.extend(preds) test_correct += preds.eq(y_data.data).sum() test_loss /= len(test_loader.dataset) test_acc = 100. * test_correct/ len(test_loader.dataset) print('\nTest set: Average loss: {:.4f}, Accuracy: {}/{} ({:.0f}%)\n'.format( test_loss, test_correct, len(test_loader.dataset), test_acc)) # In[ ]: # x_test_tens=Variable(torch.from_numpy(x_test), volatile=True).float().cuda() # predict_test = model_output(x_test_tens) # In[ ]: # print(predict_test.shape) # In[ ]: # print(predict_test) # In[20]: import pandas as pd import matplotlib.pyplot as plt from sklearn.metrics import roc_curve, auc labels = ['j_g', 'j_q', 'j_w', 'j_z', 'j_t'] predict_test = np.exp(predicted) labels_val = y_test_label df = pd.DataFrame() fpr = {} tpr = {} auc1 = {} plt.figure() for i, label in enumerate(labels): df[label] = labels_val[:,i] df[label + '_pred_dense'] = predict_test[:,i] fpr[label], tpr[label], threshold = roc_curve(df[label],df[label+'_pred_dense']) auc1[label] = auc(fpr[label], tpr[label]) plt.plot(tpr[label],fpr[label],label='%s tagger, auc = %.1f%%'%(label,auc1[label]*100.)) df.to_csv("Dense.csv", sep='\t') plt.semilogy() plt.xlabel("sig. efficiency") plt.ylabel("bkg. mistag rate") plt.ylim(0.0001,1) plt.grid(True) plt.legend(loc='upper left') #plt.savefig('%s/ROC.pdf'%(options.outputDir)) plt.show() <file_sep># InteractionNetwork model based on neural network capable of learning relations between objects in a complex system for classification task written in PyTorch <file_sep> # coding: utf-8 # In[1]: from __future__ import print_function, division import numpy as np import tensorflow as tf import matplotlib.pyplot as plt from tensorflow.contrib import rnn import h5py # In[2]: num_epochs = 200 batch_size = 64 learning_rate = 0.001 num_input = 16 # MNIST data input (img shape: 28*28) timesteps = 188 # timesteps num_hidden = 300 num_classes = 5 display_step = 200 # hz, zachem # In[3]: infile=h5py.File("/bigdata/shared/HLS4ML/jetImage.h5","r") sorted_pt_constituents = np.array(infile.get('jetConstituentList')) scaled_jets = infile.get('jets') # in any case mass_targets = scaled_jets[:,-6:-1] # In[4]: def shuffle(a,b): iX = a.shape[1] iY = a.shape[2] b_shape = b.shape[1] a = a.reshape(a.shape[0], iX*iY) total = np.column_stack((a,b)) np.random.shuffle(total) a = total[:,:iX*iY] b = total[:,iX*iY:iX*iY+b_shape] a = a.reshape(a.shape[0],iX, iY) return a,b # In[5]: sorted_pt_constituentsnp, mass_targets = shuffle(sorted_pt_constituents, mass_targets) # In[6]: X = tf.placeholder("float", [None, timesteps, num_input]) Y = tf.placeholder("float", [None, num_classes]) # In[7]: test_size = 0.2 valid_size = 0.25 num_train = sorted_pt_constituentsnp.shape[0] split = int(np.floor(test_size * num_train)) #for commenting sorted_indices = list(range(num_train)) split_v=int(np.floor(valid_size * (num_train-split))) train_idx, test_idx = sorted_indices[split:], sorted_indices[:split] train_idx, valid_idx = train_idx[split_v:], train_idx[:split_v] training_data = sorted_pt_constituentsnp[train_idx, :] validation_data = sorted_pt_constituentsnp[valid_idx, :] testing_data = sorted_pt_constituentsnp[test_idx,:] y_train = mass_targets[train_idx, :] y_valid = mass_targets[valid_idx, :] y_test = mass_targets[test_idx, :] # training_data = sorted_pt_constituentsnp # y_train = mass_targets # In[8]: # weights = { # 'out': tf.Variable(tf.random_normal([num_hidden, num_classes])) # } # biases = { # 'out': tf.Variable(tf.random_normal([num_classes])) # } # In[9]: def GRU(x): x = tf.unstack(x, timesteps, 1) GRU_cell = rnn.GRUCell(num_hidden) outputs, states = rnn.static_rnn(GRU_cell, x, dtype=tf.float32) print(states.shape) dense1 = tf.layers.dense(inputs=outputs[-1], units=100, activation=tf.nn.relu) logits = tf.layers.dense(inputs=dense1, units=5) return logits # In[10]: logits = GRU(X) # look that when testing it will use softmax directly prediction = tf.nn.softmax(logits) # Define loss and optimizer loss_op = tf.reduce_mean(tf.nn.softmax_cross_entropy_with_logits( logits=logits, labels=Y)) optimizer = tf.train.AdamOptimizer(learning_rate=learning_rate) train_op = optimizer.minimize(loss_op) #for testing Aidan correct_pred = tf.equal(tf.argmax(prediction, 1), tf.argmax(Y, 1)) accuracy = tf.reduce_mean(tf.cast(correct_pred, tf.float32)) # In[11]: # Initialize the variables (i.e. assign their default value) init = tf.global_variables_initializer() # In[12]: # Start training with tf.Session() as sess: # Run the initializer sess.run(init) for epoch in range(num_epochs): running_loss = 0.0 running_corrects = 0 for batch_idx in range(int(training_data.shape[0]/batch_size)+1): beg = batch_size*batch_idx end = min((batch_idx+1)*batch_size, training_data.shape[0]) batch_x, batch_y = training_data[beg:end], y_train[beg:end] # batch_x = batch_x.reshape((batch_size, timesteps, num_input)) sess.run(train_op, feed_dict={X: batch_x, Y: batch_y}) # Calculate batch loss and accuracy loss, acc = sess.run([loss_op, accuracy], feed_dict={X: batch_x, Y: batch_y}) running_loss +=loss running_corrects +=acc epoch_loss = running_loss / training_data.shape[0] print('Loss: {:.4f}'.format( epoch_loss)) <file_sep> # coding: utf-8 # In[1]: import os import setGPU import numpy as np from numpy import random import h5py from matplotlib import pyplot as plt import matplotlib import pandas as pd from decimal import Decimal import torch from sklearn.preprocessing import StandardScaler from torch.utils.data import Dataset, DataLoader from glob import glob import torch from torch.autograd import Variable import time import torch.nn as nn import torch.nn.parallel import torch.backends.cudnn as cudnn import torch.distributed as dist import torch.optim import torch.utils.data.distributed import torch.nn.functional as F from torch.utils.data.sampler import SubsetRandomSampler from torch.nn.utils.rnn import pack_padded_sequence, pad_packed_sequence from operator import itemgetter import itertools from sklearn.model_selection import train_test_split, StratifiedKFold torch.cuda.manual_seed_all(1) import numpy.ma as ma from sklearn.model_selection import train_test_split # In[2]: batch_size=128 epochs =200 test_size = 0.2 valid_size = 0.25 # In[3]: from glob import glob from sklearn.utils import shuffle class EventImage(Dataset): def check_data(self, file_names): #done '''Count the number of events in each file and mark the threshold boundaries between adjacent indices coming from 2 different files''' num_data = 0 thresholds = [0] for in_file_name in file_names: h5_file = h5py.File( in_file_name, 'r' ) X = h5_file[self.const[0]] if hasattr(X, 'keys'): num_data += len(X[X.keys()[0]]) thresholds.append(num_data) else: num_data += len(X) thresholds.append(num_data) h5_file.close() return (num_data, thresholds) # threshholds = [0,20,40,60,80,100 ....], num_data = total data size def __init__(self, dir_name, const = ['RA', 'RR', 'RS', 'jetConstituentList','jets']): #done self.const = const self.file_names = dir_name self.num_data, self.thresholds = self.check_data(self.file_names) def is_numpy_array(self, data): return isinstance(data, np.ndarray) def get_num_samples(self, data): """Input: dataset consisting of a numpy array or list of numpy arrays. Output: number of samples in the dataset""" if self.is_numpy_array(data): return len(data) else: return len(data[0]) def load_data(self, in_file_name): #done """Loads numpy arrays from H5 file. If the features/labels groups contain more than one dataset, we load them all, alphabetically by key.""" h5_file = h5py.File( in_file_name, 'r' ) RA = np.array(self.load_hdf5_data(h5_file[self.const[0]] )) RR = np.array(self.load_hdf5_data(h5_file[self.const[1]] )) RS = np.array(self.load_hdf5_data(h5_file[self.const[2]] )) jetConstituentList = np.array(self.load_hdf5_data(h5_file[self.const[3]])) target = np.array(self.load_hdf5_data(h5_file[self.const[4]])[:,-6:-1]) h5_file.close() RA,RR,RS,jetConstituentList,target = shuffle(RA,RR,RS,jetConstituentList,target,random_state=0) return RA,RR,RS,jetConstituentList,target def load_hdf5_data(self, data): #done """Returns a numpy array or (possibly nested) list of numpy arrays corresponding to the group structure of the input HDF5 data. If a group has more than one key, we give its datasets alphabetically by key""" if hasattr(data, 'keys'): out = [ self.load_hdf5_data( data[key] ) for key in sorted(data.keys()) ] else: out = data[:] return out def get_data(self, data, idx): #done """Input: a numpy array or list of numpy arrays. Gets elements at idx for each array""" if self.is_numpy_array(data): return data[idx] else: return [arr[idx] for arr in data] def get_index(self, idx): #done """Translate the global index (idx) into local indexes, including file index and event index of that file""" file_index = next(i for i,v in enumerate(self.thresholds) if v > idx) file_index -= 1 event_index = idx - self.thresholds[file_index] return file_index, event_index # return file number where the event is located and which event to consider in this file; def get_thresholds(self): return self.thresholds def __len__(self): return self.num_data def __getitem__(self, idx): file_index, event_index = self.get_index(idx) # done RA,RR,RS,jetConstituentList,target = self.load_data(self.file_names[file_index]) # done return self.get_data(RA, event_index), self.get_data(RR, event_index),self.get_data(RS, event_index),self.get_data(jetConstituentList, event_index), np.argmax(self.get_data(target, event_index)) all_files = glob('/bigdata/shared/HLS4ML/NEW/AS/CC/CCC/*.h5') shuffle(all_files) testing_data = all_files[:int(test_size*len(all_files))] training_data = all_files[int(test_size*len(all_files)):] training_data, validation_data = training_data[int(valid_size*len(training_data)):],training_data[:int(valid_size*len(training_data))] # In[4]: train_set = EventImage(training_data) train_loader = DataLoader(train_set, batch_size=batch_size, shuffle=True, num_workers=0) val_set = EventImage(validation_data) val_loader = DataLoader(val_set, batch_size=batch_size, shuffle=True , num_workers=0) test_set = EventImage(testing_data) test_loader = DataLoader(test_set, batch_size=batch_size, shuffle=True , num_workers=0) data_loader = {"training" :train_loader, "validation" : val_loader} # In[5]: import torch.nn.functional as F class GraphNet(nn.Module): def __init__(self, n_constituents, n_targets, params, hidden): super(GraphNet, self).__init__() self.hidden = hidden self.P = params self.N = n_constituents self.Nr = self.N * (self.N - 1) self.Dr = 3 self.De = 5 self.Dx = 0 self.Do = 6 self.n_targets = n_targets self.fr1 = nn.Linear(2 * self.P + self.Dr, hidden) self.fr2 = nn.Linear(hidden, int(hidden/2)) self.fr3 = nn.Linear(int(hidden/2), self.De) self.fo1 = nn.Linear(self.P + self.Dx + self.De, hidden) self.fo2 = nn.Linear(hidden, int(hidden/2)) self.fo3 = nn.Linear(int(hidden/2), self.Do) self.fc1 = nn.Linear(self.Do * self.N, hidden) self.fc2 = nn.Linear(hidden, int(hidden/2)) self.fc3 = nn.Linear(int(hidden/2), self.n_targets) def forward(self, x, RR, RS, RA): x=torch.transpose(x, 1, 2).contiguous() Orr = self.tmul(x, RR) Ors = self.tmul(x, RS) B = torch.cat([Orr, Ors], 1) B = torch.cat([B, RA], 1) ### First MLP ### B = torch.transpose(B, 1, 2).contiguous() B = nn.functional.relu(self.fr1(B.view(-1, 2 * self.P + self.Dr))) B = nn.functional.relu(self.fr2(B)) E = nn.functional.relu(self.fr3(B).view(-1, self.Nr, self.De)) del B E = torch.transpose(E, 1, 2).contiguous() Ebar = self.tmul(E, torch.transpose(RR, 1, 2).contiguous()) del E C = torch.cat([x, Ebar], 1) C = torch.transpose(C, 1, 2).contiguous() ### Second MLP ### C = nn.functional.relu(self.fo1(C.view(-1, self.P + self.Dx + self.De))) C = nn.functional.relu(self.fo2(C)) O = nn.functional.relu(self.fo3(C).view(-1, self.N, self.Do)) del C ### Classification MLP ### N = nn.functional.relu(self.fc1(O.view(-1, self.Do * self.N))) del O N = nn.functional.relu(self.fc2(N)) N = self.fc3(N) return N def tmul(self, x, y): #Takes (I * J * K)(K * L) -> I * J * L XY = np.array([]) for e, Rr in zip(x,y): xy = torch.mm(e, Rr).view(-1, e.shape[0], Rr.shape[1]) XY = np.concatenate((XY,xy), axis=0) if XY.size else xy return Variable(torch.from_numpy(XY)).cuda() model = GraphNet(n_constituents=188,n_targets=5,params=16, hidden=10) model.cuda() optimizer = torch.optim.Adam(model.parameters(), lr=10e-3) criterion = nn.CrossEntropyLoss() scheduler = torch.optim.lr_scheduler.ReduceLROnPlateau(optimizer,mode ='min',factor=0.5,patience=10) # In[6]: class EarlyStopping(object): """ Early Stopping to terminate training early under certain conditions """ def __init__(self, monitor='val_loss', min_delta=0, patience=30): super(EarlyStopping, self).__init__() print("This is my patience {}".format(patience)) self.min_delta = min_delta self.patience = patience self.wait = 0 self.stopped_epoch = 0 self.stop_training= False def on_train_begin(self, logs=None): self.wait = 0 def on_epoch_end(self, epoch, val_loss): if val_loss is None: pass else: if len(val_loss) ==10: self.best_loss = np.mean(val_loss) if np.mean(val_loss[-10:]) < self.best_loss: self.best_loss = np.mean(val_loss[-10:]) self.wait = 1 else: if self.wait >= self.patience: self.stopped_epoch = epoch + 1 self.stop_training = True self.wait += 1 return self.stop_training def on_train_end(self): if self.stopped_epoch > 0: print('\nTerminated Training for Early Stopping at Epoch %04i' % (self.stopped_epoch)) # In[7]: def train_model(num_epochs, model, criterion, optimizer,scheduler,volatile=False): best_model = model.state_dict() best_acc = 0.0 train_losses ,val_losses = [],[] Early_Stopping = EarlyStopping(patience=20) Early_Stopping.on_train_begin() breakdown = False p=10 for epoch in range(num_epochs): if breakdown: print("Early Stopped") f.write('Early Stopped\n') break print('Epoch {}/{}'.format(epoch, num_epochs - 1)) # f.write('Epoch {}/{}\n'.format(epoch, num_epochs - 1)) print('_' * 10) # Each epoch has a training and validation phase for phase in ['training', 'validation']: if phase == 'training': model.train() # Set model to training mode else: model.eval() # Set model to evaluate mode volatile=True running_loss = 0.0 running_corrects = 0 # Iterate over data. for batch_idx, (RA, RR, RS, jetConstituentList,target) in enumerate(data_loader[phase]): RA = Variable(RA,volatile).float().cuda() RS = Variable(RS,volatile).float().cuda() RR = Variable(RR,volatile).float().cuda() jetConstituentList = Variable(jetConstituentList,volatile).float().cuda() target = Variable(target).long().cuda() if phase == 'training': optimizer.zero_grad() # forwarding outputs = model(jetConstituentList, RR, RS, RA) _, preds = torch.max(outputs.data, 1) loss = criterion(outputs, target) # backward + optimize only if in training phase if phase == 'training': loss.backward() optimizer.step() # statistics running_loss += loss.data[0] running_corrects += torch.sum(preds == y_data.data) #print("I finished %d batch" % batch_idx) epoch_loss = running_loss / len(data_loader[phase].dataset) epoch_acc = 100. * running_corrects / len(data_loader[phase].dataset) if phase == 'training': train_losses.append(epoch_loss) else: scheduler.step(epoch_loss) val_losses.append(epoch_loss) print('{} Loss: {:.4f} Acc: {:.4f}'.format( phase, epoch_loss, epoch_acc)) # f.write('{} Loss: {:.4f} Acc: {:.4f}\n'.format( # phase, epoch_loss, epoch_acc)) # deep copy the model if phase == 'validation' and epoch_acc > best_acc: print('Saving..') state = { 'net': model, #.module if use_cuda else net, 'epoch': epoch, 'best_acc':epoch_acc, 'train_loss':train_losses, 'val_loss':val_losses, } if not os.path.isdir('checkpoint4'): os.mkdir('checkpoint4') torch.save(state, './checkpoint4/IN.t7') best_acc = epoch_acc best_model = model.state_dict() if phase == 'validation' and epoch==p-1: breakdown = Early_Stopping.on_epoch_end(epoch, val_losses) p += p print() print('Best val Acc: {:4f}'.format(best_acc)) # f.write('Best val Acc: {:4f}\n'.format(best_acc)) # model.load_state_dict(best_model) return model,train_losses ,val_losses # In[8]: # f= open('IN_Aidanchan_%f.txt', 'w') # In[ ]: model_output,train_losses,val_losses = train_model(epochs,model,criterion,optimizer,scheduler) # In[ ]: # predicted = np.zeros((19661, 5)) # test_loss = 0 # test_correct = 0 # for batch_idx, (x_data,B,RR, y_data) in enumerate(test_loader): # x_data, y_data, B = Variable(x_data,volatile=True).float().cuda(),Variable(y_data).long().cuda(),Variable(B).float().cuda() # RR = Variable(RR,volatile=True).float().cuda() # model_out = model_output(x_data,B,RR) # beg = batch_size*batch_idx # end = min((batch_idx+1)*batch_size, 19661) # predicted[beg:end] = F.softmax(model_out).data.cpu().numpy() # test_loss += criterion(model_out, y_data).data[0] # _, preds = torch.max(model_out.data, 1) # test_correct += preds.eq(y_data.data).sum() # test_loss /= len(test_loader.dataset) # test_acc = 100. * test_correct/ len(test_loader.dataset) # print('\nTest set: Average loss: {:.4f}, Accuracy: {}/{} ({:.0f}%)\n'.format( # test_loss, test_correct, len(test_loader.dataset), # test_acc)) # f.write('\nTest set: Average loss: {:.4f}, Accuracy: {}/{} ({:.0f}%)\n'.format( # test_loss, test_correct, len(test_loader.dataset), # test_acc)) # In[ ]: # np.save('Aidanchan_train_losses',train_losses) # np.save('Aidanchan_val_losses', val_losses) # np.save('Aidanchan_predicted', predicted) # np.save('Aidanchan_y_test', y_test) # In[ ]: # import pandas as pd # import matplotlib.pyplot as plt # from sklearn.metrics import roc_curve, auc # from sklearn.preprocessing import OneHotEncoder # labels = ['j_g', 'j_q', 'j_w', 'j_z', 'j_t'] # predict_test = predicted # enc = OneHotEncoder(5, sparse = False) # labels_val = enc.fit_transform(y_test.reshape((4,1))) # df = pd.DataFrame() # fpr = {} # tpr = {} # auc1 = {} # plt.figure() # for i, label in enumerate(labels): # df[label] = labels_val[:,i] # df[label + '_pred_IN'] = predict_test[:,i] # fpr[label], tpr[label], threshold = roc_curve(df[label],df[label+'_pred_IN']) # auc1[label] = auc(fpr[label], tpr[label]) # plt.plot(tpr[label],fpr[label],label='%s tagger, auc = %.1f%%'%(label,auc1[label]*100.)) # df.to_csv("IN.csv", sep='\t') # plt.semilogy() # plt.xlabel("sig. efficiency") # plt.ylabel("bkg. mistag rate") # plt.ylim(0.0001,1) # plt.grid(True) # plt.legend(loc='upper left') # #plt.savefig('%s/ROC.pdf'%(options.outputDir)) # plt.show() # In[ ]: # for j, (train_idx, val_idx) in enumerate(folds): # print('\n Fold ',j) # # f.write('\nFold {}'.format(j)) # X_train_cv = sorted_pt_constituentsnp[train_idx] # y_train_cv = y_train[train_idx] # X_valid_cv = sorted_pt_constituentsnp[val_idx] # y_valid_cv= y_train[val_idx] # B_train_cv = B[train_idx] # B_valid_cv = B[val_idx] # R_train_cv = RR[train_idx] # R_valid_cv = RR[val_idx] # train = EventDataset(X_train_cv,B_train_cv,R_train_cv,y_train_cv) # valid = EventDataset(X_valid_cv,B_valid_cv,R_valid_cv,y_valid_cv) # train_loader = DataLoader(dataset = train, batch_size = batch_size, shuffle = True, num_workers = 4) # valid_loader = DataLoader(dataset = valid, batch_size = batch_size, shuffle = True, num_workers = 4) # data_loader = {"training" :train_loader, "validation" : valid_loader} # model = GraphNet(n_constituents=5,n_targets=5,params=16, hidden=10) # model = nn.DataParallel(model.cuda()) # optimizer = torch.optim.Adam(model.parameters(), lr=10e-4) # criterion = nn.CrossEntropyLoss() # scheduler = torch.optim.lr_scheduler.ReduceLROnPlateau(optimizer,mode ='min',factor=0.5,patience=10) # model_output,train_losses,val_losses = train_model(data_loader,epochs,model,criterion,optimizer,scheduler) # # np.save('train_losses of folder {} and fraction {}'.format(j, fraction),train_losses) # # np.save('val_losees of folder {} and fraction {}'.format(j, fraction), val_losses) # print('Saving after {} fold..'.format(j)) # state = { # 'net': model_output, #.module if use_cuda else net, # 'train_loss':train_losses, # 'val_loss':val_losses # } # if not os.path.isdir('folder_checkpoint_4'): # os.mkdir('folder_checkpoint_4') # torch.save(state, './folder_checkpoint_4/folder_IN_.t7') # In[ ]: # def load_data_kfold(k,sorted_pt_constituentsnp,y_train): # folds = list(StratifiedKFold(n_splits=k, shuffle=True, random_state=1).split(sorted_pt_constituentsnp,y_train)) # return folds # In[ ]: # k = 3 # folds = load_data_kfold(k,sorted_pt_constituentsnp,y_train) # In[ ]: # def create_B(self,x): # print("This is x shape {}".format(x.shape)) # RA = torch.zeros(x.shape[0], 3, self.Nr) # RR = torch.zeros(x.shape[0], self.N, self.Nr) # RS = torch.zeros(x.shape[0], self.N, self.Nr) # for k, arr in enumerate(x): # arr = arr.data.cpu().numpy() # Rr = torch.zeros(self.N, self.Nr) # Rs = torch.zeros(self.N, self.Nr) # Ra = torch.zeros(3, self.Nr) # for i, (r, s) in enumerate(self.receiver_sender_list): # p = -1 # if arr[r, 0]==0 or arr[s,0] == 0: # Rr[r, i] = 0 # Rs[s, i] = 0 # else: # Rr[r, i] = 1 # Rs[s, i] = 1 # for j in range(3): # if arr[r, 0]==0 or arr[s,0] == 0: # Ra[j, i] = 0 # else: # Ra[j, i] = self.distance(arr[r,5],arr[s,5],arr[r,7],arr[s,7],arr[r,10],arr[s,10],p) # p=p+1 # print("This is Rr shape {}".format(Rr.shape)) # print("This is Rs shape {}".format(Rs.shape)) # print("This is Ra shape {}".format(Ra.shape)) # RA[k] = Ra # RS[k] = Rs # RR[k] = Rr # print("This is RR shape {}".format(RR.shape)) # print("This is RS shape {}".format(RS.shape)) # print("This is RA shape {}".format(RA.shape)) # RR = Variable(RR).cuda() # RS = Variable(RS).cuda() # RA = Variable(RA).cuda() # return RR,RS,RA # In[ ]: # class GraphNet(nn.Module): # def __init__(self, n_constituents, n_targets, params, hidden): # super(GraphNet, self).__init__() # self.hidden = hidden # self.P = params # self.N = n_constituents # self.Nr = self.N * (self.N - 1) # self.Dr = 3 # self.De = 7 # self.Dx = 0 # self.Do = 6 # self.n_targets = n_targets # self.fr1 = nn.Linear(2 * self.P + self.Dr, hidden, bias = False) # self.fr2 = nn.Linear(hidden, int(hidden/2), bias = False) # self.fr3 = nn.Linear(int(hidden/2), self.De, bias = False) # self.fo1 = nn.Linear(self.P + self.Dx + self.De, hidden, bias = False) # self.fo2 = nn.Linear(hidden, int(hidden/2), bias = False) # self.fo3 = nn.Linear(int(hidden/2), self.Do, bias = False) # self.fc1 = nn.Linear(self.Do, hidden) # self.fc2 = nn.Linear(hidden, int(hidden/2)) # self.fc3 = nn.Linear(int(hidden/2), self.n_targets) # self.receiver_sender_list = [i for i in itertools.product(range(self.N), range(self.N)) if i[0]!=i[1]] # def distance(self,pt_1,pt_2,eta_1,eta_2,phi_1,phi_2,p): # deltaR = (phi_1-phi_2)**2 + (eta_1-eta_2)**2 # dist = min(pt_1**(2*p), pt_2**(2*p))*deltaR # return dist # def tmul(self,x, y): #Takes (I * J * K)(K * L) -> I * J * L # x_shape = x.size() # y_shape = y.size() # return torch.mm(x, y).view(-1, x_shape[0], y_shape[1]) # def creation_of_B(self,x): # B = torch.zeros(x.shape[0], 2 * self.P + self.Dr, self.Nr).cuda() # RR = torch.zeros(x.shape[0], self.N, self.Nr).cuda() # for k, arr in enumerate(x): # arr = arr.data.cpu().numpy() # Rr = torch.zeros(self.N, self.Nr) #188*(188*187) # Rs = torch.zeros(self.N, self.Nr) # Ra = torch.zeros(3, self.Nr) # for i, (r, s) in enumerate(self.receiver_sender_list): # p = -1 # if arr[r, 0]==0 or arr[s,0] == 0: # Rr[r, i] = 0 # Rs[s, i] = 0 # else: # Rr[r, i] = 1 # Rs[s, i] = 1 # for j in range(3): # if arr[r, 0]==0 or arr[s,0] == 0: # Ra[j, i] = 0 # else: # Ra[j, i] = self.distance(arr[r,5],arr[s,5],arr[r,7],arr[s,7],arr[r,10],arr[s,10],p) # p=p+1 # arr = torch.transpose(torch.from_numpy(arr).type(torch.cuda.FloatTensor), 0, 1).contiguous() # 98710*16*188 # Rr = Rr.cuda() # Rs = Rs.cuda() # Ra = Ra.cuda() # Orr = self.tmul(arr, Rr) # Ors = self.tmul(arr, Rs) # Bb = torch.cat([Orr, Ors], 1) # Ra=Ra.view(-1,Ra.shape[0],Ra.shape[1]) # Bb = torch.cat([Bb, Ra], 1) # batch_size* (2P+De)*Nr # Bb= Bb.view(-1, Bb.shape[2]) # cgtob batch_size ubrat' # # Bb = torch.transpose(Bb, 1, 2).contiguous() # RR[k] = Rr # B[k] = Bb # del Rr # del Bb # B=torch.transpose(B, 1, 2).contiguous() # return B,RR # def multiplication(self,E,RR): # Ebar = torch.zeros(E.shape[0], self.De, self.N).cuda() # E = E.data # RR = RR.data # for i, (e, Rr) in enumerate(zip(E,RR)): # ebar = torch.mm(e, Rr).view(-1, e.shape[0], Rr.shape[1]) # Ebar[i] = ebar # return Variable(Ebar) # def forward(self, x): # # x - initial dataset # B,RR = self.creation_of_B(x) # B= Variable(B).cuda() # RR = Variable(RR).cuda() # x=torch.transpose(x, 1, 2).contiguous() # B = nn.functional.relu(self.fr1(B.view(-1, 2 * self.P + self.Dr))) # B = nn.functional.relu(self.fr2(B)) # E = nn.functional.relu(self.fr3(B).view(-1, self.Nr, self.De)) # del B # E = torch.transpose(E, 1, 2).contiguous() # Ebar = self.multiplication(E, torch.transpose(RR, 1, 2)) # del E # C = torch.cat([x, Ebar], 1) # del Ebar # C = torch.transpose(C, 1, 2).contiguous() # ### Second MLP ### # C = nn.functional.relu(self.fo1(C.view(-1, self.P + self.Dx + self.De))) # C = nn.functional.relu(self.fo2(C)) # O = nn.functional.relu(self.fo3(C).view(-1, self.N, self.Do)) # O = torch.sum(O, dim=1) # del C # ### Classification MLP ### # N = nn.functional.relu(self.fc1(O.view(-1, self.Do))) # del O # N = nn.functional.relu(self.fc2(N)) # N = self.fc3(N) # return N # model = GraphNet(n_constituents=188,n_targets=5,params=16, hidden=10) # model = model.cuda() # optimizer = torch.optim.Adam(model.parameters(), lr=10e-4) # criterion = nn.CrossEntropyLoss() # scheduler = torch.optim.lr_scheduler.ReduceLROnPlateau(optimizer,mode ='min',factor=0.5,patience=10) <file_sep> # coding: utf-8 # In[1]: import os import setGPU import numpy as np import h5py import matplotlib import pandas as pd from decimal import Decimal import torch from sklearn.preprocessing import StandardScaler from torch.utils.data import Dataset, DataLoader from glob import glob import torch from torch.autograd import Variable import time import torch.nn as nn import torch.nn.parallel import torch.backends.cudnn as cudnn import torch.distributed as dist import torch.optim import torch.utils.data.distributed import torch.nn.functional as F from torch.utils.data.sampler import SubsetRandomSampler from torch.nn.utils.rnn import pack_padded_sequence, pad_packed_sequence from operator import itemgetter from sklearn.model_selection import train_test_split, StratifiedKFold from sklearn.preprocessing import MinMaxScaler from sklearn.model_selection import train_test_split, StratifiedKFold # In[2]: infile = h5py.File('/bigdata/shared/HLS4ML/NEW/AS/jetImageMerged.h5', 'r') file_m = h5py.File('/bigdata/shared/HLS4ML/NEW/jetImage_983445_990519.h5', 'r') jets = infile.get('jets') jetImageECAL = np.array(infile.get('jetImageECAL')) jetImageHCAL = np.array(infile.get('jetImageHCAL')) featureName = np.array(file_m.get("jetFeatureNames")) target = jets[:,-6:-1] expFeature_labels = [b'j_zlogz', b'j_c1_b0_mmdt',b'j_c1_b1_mmdt',b'j_c1_b2_mmdt',b'j_c2_b1_mmdt',b'j_c2_b2_mmdt',b'j_d2_b1_mmdt', b'j_d2_b2_mmdt',b'j_d2_a1_b1_mmdt',b'j_d2_a1_b2_mmdt',b'j_m2_b1_mmdt',b'j_m2_b2_mmdt',b'j_n2_b1_mmdt', b'j_n2_b2_mmdt',b'j_mass_mmdt',b'j_multiplicity'] exFeature_indexes = [] for feature in expFeature_labels : featureindex = featureName.tolist().index(feature) exFeature_indexes.append(featureindex) exFeature_indexes.sort() expFeature = jets[:,exFeature_indexes] # In[3]: maxPt = max(jets[:,1]) jetImageECAL = jetImageECAL/maxPt jetImageHCAL = jetImageHCAL/maxPt # In[4]: def shuffle(a, d, b, c): iX = a.shape[1] iY = a.shape[2] b_shape = b.shape[1] a = a.reshape(a.shape[0], iX*iY) d = d.reshape(d.shape[0], iX*iY) total = np.column_stack((a,d)) total = np.column_stack((total,b)) total = np.column_stack((total,c)) np.random.shuffle(total) a = total[:,:iX*iY] d = total[:,iX*iY:2*iX*iY] b = total[:,2*iX*iY:2*iX*iY+b_shape] c = total[:,2*iX*iY+b_shape:] a = a.reshape(a.shape[0],1,iX, iY) d = d.reshape(d.shape[0],1,iX, iY) return a,d,b,c,b_shape # In[5]: jetImageECAL,jetImageHCAL, expFeature, target, b_shape = shuffle(jetImageECAL,jetImageHCAL, expFeature, target) # In[6]: y_train_in =np.argmax(target, axis=1) # In[7]: class ImageDataset(Dataset): def __init__(self, x1, x2, y): self.len = x1.shape[0] self.x1 = torch.from_numpy(x1) self.x2 = torch.from_numpy(x2) self.y = torch.from_numpy(y) def __getitem__(self, idx): return self.x1[idx], self.x2[idx], self.y[idx] def __len__(self): return self.len # In[8]: epochs=200 batch_size=1024 # In[9]: iSplit_1 = int(0.6*target.shape[0]) iSplit_2 = int(0.8*target.shape[0]) x_train1 = jetImageECAL[:iSplit_1, ...] x_train2 = jetImageHCAL[:iSplit_1, ...] x_valid1 = jetImageECAL[iSplit_1:iSplit_2, ...] x_valid2 = jetImageHCAL[iSplit_1:iSplit_2, ...] x_test1 = jetImageECAL[iSplit_2:, ...] x_test2 = jetImageHCAL[iSplit_2:, ...] y_train= y_train_in[:iSplit_1] y_valid = y_train_in[iSplit_1:iSplit_2] y_test = y_train_in[iSplit_2:] y_test_in = target[iSplit_2:] # In[10]: x_train1 = np.reshape(x_train1, (x_train1.shape[0], 1, x_train1.shape[2],x_train1 .shape[3])) x_train2 = np.reshape(x_train2, (x_train2.shape[0], 1, x_train2.shape[2],x_train2.shape[3])) x_valid1 = np.reshape(x_valid1, (x_valid1.shape[0], 1, x_valid1.shape[2],x_valid1.shape[3])) x_valid2 = np.reshape(x_valid2, (x_valid2.shape[0], 1, x_valid2.shape[2],x_valid2.shape[3])) x_test1 = np.reshape(x_test1, (x_test1.shape[0], 1, x_test1.shape[2], x_test1.shape[3])) x_test2 = np.reshape(x_test2, (x_test2.shape[0], 1, x_test2.shape[2], x_test2.shape[3])) # In[11]: train_loader = DataLoader(dataset = ImageDataset(x_train1,x_train2,y_train), batch_size = batch_size, shuffle =True, num_workers = 4) valid_loader = DataLoader(dataset = ImageDataset(x_valid1,x_valid2,y_valid), batch_size = batch_size, shuffle =True, num_workers = 4) data_loader = {"training" :train_loader, "validation" : valid_loader} test_loader = DataLoader(dataset = ImageDataset(x_test1,x_test2,y_test), batch_size = batch_size, shuffle = False, num_workers = 4) # In[33]: import torch.nn as nn import torch.nn.functional as F class Net(nn.Module): def __init__(self,conv_layers,dense_layers,kernel,padding,dropout_c,dropout_d,actif_func): super(Net, self).__init__() self.layers = nn.ModuleList() self.input_shape = (1,25,25) channel_in =1 self.nodes = 20 self.actif_func = actif_func self.dropout_c = dropout_c self.dropout_d = dropout_d self.conv_layers = int(conv_layers) self.dense_layers = int(dense_layers) for i in range(self.conv_layers): convolution_layer = nn.Conv2d(channel_in,2**(3+i),kernel_size = int(kernel),stride = 1, padding = int(padding),bias = True) self.layers.append(convolution_layer) channel_in = 2**(3+i) n_size = self._get_conv_output(self.input_shape)*2 for i in range(self.dense_layers): linear_layer = nn.Linear(n_size,self.nodes) self.layers.append(linear_layer) n_size = self.nodes self.nodes = self.nodes-5 self.fc1 = nn.Linear(self.nodes+5, 5) def _get_conv_output(self, shape): bs = 1 input = Variable(torch.rand(bs, *shape)) for i in range(len(self.layers)): input = self.layers[i](input) n_size = input.data.view(bs, -1).size(1) return n_size def forward(self,x,y): for i in range (self.conv_layers): x = getattr(F, self.actif_func)(self.layers[i](x)) x = F.dropout(x, p= self.dropout_c, training=True) y = getattr(F, self.actif_func)(self.layers[i](y)) y = F.dropout(y, p= self.dropout_c, training=True) x = torch.cat((x,y), 1) x = x.view(x.size(0), -1) for i in range(self.dense_layers): i = i+self.conv_layers x= getattr(F, self.actif_func)(self.layers[i](x)) x = F.dropout(x, p= self.dropout_d, training=True) return F.log_softmax(self.fc1(x)) # In[24]: class EarlyStopping(object): """ Early Stopping to terminate training early under certain conditions """ def __init__(self, monitor='val_loss', min_delta=0, patience=10): super(EarlyStopping, self).__init__() self.monitor = monitor self.min_delta = min_delta self.patience = patience self.wait = 0 self.best_loss = 1e-15 self.stopped_epoch = 0 self.stop_training= False print("This is my patience {}".format(patience)) def on_train_begin(self): self.wait = 0 self.best_loss = 1e15 def on_epoch_end(self, epoch, current_loss): if current_loss is None: pass else: if (current_loss - self.best_loss) < -self.min_delta: self.best_loss = current_loss self.wait = 1 else: if self.wait >= self.patience: self.stopped_epoch = epoch + 1 self.stop_training = True self.wait += 1 return self.stop_training def on_train_end(self): if self.stopped_epoch > 0: print('\nTerminated Training for Early Stopping at Epoch %04i' % (self.stopped_epoch)) # In[25]: def train_model(num_epochs, model, criterion, optimizer,scheduler,volatile=False): best_model = model.state_dict() best_acc = 0.0 train_losses ,val_losses = [],[] Early_Stopping = EarlyStopping(patience=40) Early_Stopping.on_train_begin() breakdown = False for epoch in range(num_epochs): if breakdown: print("Early Stopped") break print('Epoch {}/{}'.format(epoch, num_epochs - 1)) print('_' * 10) # Each epoch has a training and validation phase for phase in ['training', 'validation']: if phase == 'training': model.train() # Set model to training mode else: model.eval() # Set model to evaluate mode volatile=True running_loss = 0.0 running_corrects = 0 # Iterate over data. for batch_idx, (x_data1,x_data2,y_data) in enumerate(data_loader[phase]): x_data1 = Variable(x_data1.type(torch.cuda.FloatTensor),volatile) x_data2 = Variable(x_data2.type(torch.cuda.FloatTensor), volatile) y_data = Variable(y_data.type(torch.cuda.LongTensor)) if phase == 'training': optimizer.zero_grad() # forwardgyg outputs = model(x_data1,x_data2) _, preds = torch.max(outputs.data, 1) loss = criterion(outputs, y_data) # backward + optimize only if in training phase if phase == 'training': loss.backward() optimizer.step() # statistics running_loss += loss.data[0] running_corrects += torch.sum(preds == y_data.data) #print("I finished %d batch" % batch_idx) epoch_loss = running_loss / len(data_loader[phase].dataset) epoch_acc = 100. * running_corrects / len(data_loader[phase].dataset) if phase == 'training': train_losses.append(epoch_loss) else: scheduler.step(epoch_loss) val_losses.append(epoch_loss) print('{} Loss: {:.4f} Acc: {:.4f}'.format( phase, epoch_loss, epoch_acc)) # deep copy the model if phase == 'validation' and epoch_acc > best_acc: print('Saving..') state = { 'net': model, #.module if use_cuda else net, 'epoch': epoch, 'best_acc':epoch_acc, 'train_loss':train_losses, 'val_loss':val_losses, } if not os.path.isdir('checkpoint_DNN'): os.mkdir('checkpoint_DNN') torch.save(state, './checkpoint_DNN/DNN.t7') best_acc = epoch_acc best_model = model.state_dict() if phase == 'validation': breakdown = Early_Stopping.on_epoch_end(epoch,round(epoch_loss, 4)) print() print('Best val Acc: {:4f}'.format(best_acc)) # load best model weights model.load_state_dict(best_model) return best_acc # In[ ]: import os from threading import Thread import hashlib import json import time import glob # In[ ]: class externalfunc: # call the python_ex_blablabla.py function, get the accuracy , write to the json file and then read it #and return accuracy def __init__(self , prog, names): self.call = prog self.N = names def __call__(self, X): # eto i est' chto tam gp.mimimize call the function with dim self.args = dict(zip(self.N,X)) h = hashlib.md5(str(self.args).encode('utf-8')).hexdigest() com = '%s %s'% (self.call, ' '.join(['--%s %s'%(k,v) for (k,v) in self.args.items() ])) # koroch delaet python lll.py # par0 0.45, par1 0.75 .... com += ' --hash %s'%h com += ' > %s.log'%h print ("Executing: ",com) ## run the command c = os.system( com ) ## get the output try: r = json.loads(open('%s.json'%h).read()) Y = r['result'] except: print ("Failed on",com) Y = None return Y # vernet accuracy po tem parametram chto on tol'ko chto zatestil # In[ ]: class manager: def __init__(self, n, skobj, iterations, func, wait=10): self.n = n ## number of parallel processes, smth related with workers self.sk = skobj ## the skoptimizer you created self.iterations = iterations # run_for self.wait = wait self.func = func def run(self): ## first collect all possible existing results for eh in glob.glob('*.json'): try: ehf = json.loads(open(eh).read()) y = ehf['result'] x = [ehf['params'][n] for n in self.func.N] # par0 , par1, par2 print ("pre-fitting",x,y,"remove",eh,"to prevent this") print (skop.__version__) self.sk.tell( x,y ) except: pass workers=[] it = 0 asked = [] while it< self.iterations: ## number of thread going n_on = sum([w.is_alive() for w in workers]) if n_on< self.n: ## find all workers that were not used yet, and tell their value XYs = [] for w in workers: if (not w.used and not w.is_alive()): if w.Y != None: XYs.append((w.X,w.Y)) w.used = True if XYs: one_by_one= False if one_by_one: for xy in XYs: print ("\t got",xy[1],"at",xy[0]) self.sk.tell(xy[0], xy[1]) else: print ("\t got",len(XYs),"values") print ("\n".join(str(xy) for xy in XYs)) self.sk.tell( [xy[0] for xy in XYs], [xy[1] for xy in XYs]) asked = [] ## there will be new suggested values print (len(self.sk.Xi)) ## spawn a new one, with proposed parameters if not asked: asked = self.sk.ask(n_points = self.n) if asked: par = asked.pop(-1) else: print ("no value recommended") it+=1 print ("Starting a thread with",par,"%d/%d"%(it,self.iterations)) workers.append( worker( X=par , func=self.func )) workers[-1].start() time.sleep(self.wait) ## do not start all at the same exact time else: ## threads are still running if self.wait: #print n_on,"still running" pass time.sleep(self.wait) # In[ ]: class worker(Thread): def __init__(self, #N, X, func): Thread.__init__(self) self.X = X self.used = False self.func = func def run(self): self.Y = self.func(self.X) # In[ ]: def dummy_func( X ): model = Net(X[0],X[1],X[2],X[3],X[4],X[5],X[6]) model.cuda() optimizer = torch.optim.Adam(model.parameters(),lr=X[7]) criterion = nn.NLLLoss() scheduler = torch.optim.lr_scheduler.ReduceLROnPlateau(optimizer,mode ='min',factor=0.5,patience=10) best_acc = train_model(epochs,model,criterion,optimizer,scheduler) Y = - (best_acc) return Y # In[ ]: if __name__ == "__main__": from skopt import Optimizer from skopt.learning import GaussianProcessRegressor from skopt.space import Real, Categorical, Integer from skopt import gp_minimize import sys n_par = 8 externalize = externalfunc(prog='python run_train_exm.py', names = ['par%s'%d for d in range(n_par)]) # open the json file, and write the results # for each parameter combination (just initialization) run_for = 20 use_func = externalize #self,conv_layers,dense_layers,kernel,padding,dropout_c,dropout_d,actif_func dim = [Integer(1, 4),Integer(1, 4),Integer(2, 7),Integer(2, 4),Real(0, 0.9),Real(0, 0.9),Categorical(['relu', 'tanh','selu','leaky_relu']),Real(1e-5,1e-3)] # eto i X start = time.mktime(time.gmtime()) res = gp_minimize( func=use_func, dimensions=dim, n_calls = run_for, ) print ("GPM best value",res.fun,"at",res.x) # function value at the minimum and location of the minimum #print res print ("took",time.mktime(time.gmtime())-start,"[s]") o = Optimizer( n_initial_points =5, acq_func = 'gp_hedge', acq_optimizer='auto', base_estimator=GaussianProcessRegressor(alpha=0.0, copy_X_train=True, n_restarts_optimizer=2, noise='gaussian', normalize_y=True, optimizer='fmin_l_bfgs_b'), dimensions=dim, ) m = manager(n = 4, skobj = o, iterations = run_for, func = use_func, wait= 0 ) start = time.mktime(time.gmtime()) m.run() # nado posmotret' chto manager .run delaet import numpy as np best = np.argmin( m.sk.yi) print ("Threaded GPM best value",m.sk.yi[best],"at",m.sk.Xi[best],) print ("took",time.mktime(time.gmtime())-start,"[s]") # In[16]: # class Net(nn.Module): # def __init__(self, hidden_layers, dropout, activ_f): # super(Net, self).__init__() # self.dropout = dropout # self.activ_f = activ_f # hidden =64 # nodes = [16] # for i in range(hidden_layers): # if i == hidden_layers-1: # nodes.append(5) # else: # nodes.append(hidden) # hidden = int(hidden/2) # self.linear_layers = nn.ModuleList() # for d in range(1,len(nodes)): # linear_layer = torch.nn.Linear(nodes[d-1],nodes[d]) # self.linear_layers.append(linear_layer) # # print(self.linear_layers) # def forward(self, x): # for i in range (len(self.linear_layers)): # if i == len(self.linear_layers)-1: # return F.log_softmax(self.linear_layers[i](x)) # x = getattr(F, self.activ_f)(self.linear_layers[i](x)) # x = F.dropout(x, p=self.dropout, training=True)
19249d204db3fac31e6d98a6dd826e8770ff2e6c
[ "Markdown", "Python" ]
8
Python
AikoKiko/InteractionNetwork
db17c5638cec1ba84e9437918cc587d45310c08c
d903c03ae8779c6d3efb1ef4ff2382537ee3bc9c
refs/heads/master
<file_sep>#include <arpa/inet.h> #include <netinet/in.h> #include <stdio.h> #include <stdlib.h> #include <string.h> #include <sys/socket.h> #include <unistd.h> int main(int argc, char *argv[]) { if (argc < 2){ fprintf(stderr, "server.c: Need port number\n"); return 1; } int sfd; struct sockaddr_in s_addr; //creating a server socket sfd = socket(AF_INET, SOCK_STREAM, 0); memset(&s_addr, 0, sizeof(struct sockaddr_in)); //define the server address s_addr.sin_family = AF_INET; unsigned short portNum = (unsigned short) strtoul(argv[1], NULL, 0); s_addr.sin_port = htons(portNum); s_addr.sin_addr.s_addr = htonl(INADDR_ANY); if (bind(sfd, (struct sockaddr *)&s_addr, sizeof(struct sockaddr_in)) == -1){ perror("Bind error"); return 1; } //waiting for response from client if (listen(sfd, 2) == -1) { perror("Listen error"); return 1; } while (1){ int cfd, n; struct sockaddr_in c_addr; socklen_t sinlen = sizeof(struct sockaddr_in); char fileName[100]; FILE *f; cfd = accept(sfd, (struct sockaddr *)&c_addr, &sinlen); //receiving filename from client n = read(cfd, fileName, 100); f = fopen(fileName, "r"); printf("\nFile name received: %s\n", fileName); if (f == NULL){ fprintf(stderr, "File not found\n"); char buf[9] = "ERROR404"; write(cfd, buf, 9); } else { //sending file back to client char c; while (fread(&c, 1, 1, f)){ write(cfd, &c, 1); } printf("Sending %s back to client\n", fileName); } close(cfd); } close(sfd); return 0; }<file_sep>## Server-Client File Transfer Program Instructions: - Clone repo to your computer. - In the directory you downloaded the files, open two Linux terminals(one for the client and the other for the server). - First, run `gcc client.c -o client`, then `gcc server.c -o server` to compile the files. - In one of the terminal, run `./server PORTNUMBER` (could be any port number, for e.g. 5000). - Then, in the other terminal, run `./client 127.0.0.1 PORTNUMBER FILE1 FILE2`. - 127.0.0.1 is used as the loopback address here but it could be any other server. - FILE1 is existing path on server and FILE2 is targeted path on the client's side which in this case is the current working directory. <file_sep>#include <arpa/inet.h> #include <netinet/in.h> #include <stdio.h> #include <stdlib.h> #include <string.h> #include <sys/socket.h> #include <unistd.h> int main(int argc, char *argv[]) { if (argc < 5) { fprintf(stderr, "client.c: Incorrect number of arguments\n"); return 1; } int cfd; struct sockaddr_in c_addr; //creating a client socket cfd = socket(AF_INET, SOCK_STREAM, 0); memset(&c_addr, 0, sizeof(struct sockaddr_in)); //define the client address c_addr.sin_family = AF_INET; unsigned short portNum = (unsigned short)strtoul(argv[2], NULL, 0); c_addr.sin_port = htons(portNum); if (inet_pton(AF_INET, argv[1], &c_addr.sin_addr) == 0){ fprintf(stderr, "client.c: Argument 1 is not an IPv4 address\n"); return 1; } if (connect(cfd, (struct sockaddr *)&c_addr, sizeof(struct sockaddr_in)) == -1){ perror("Connect error"); return 1; } char fileName[100]; strcpy(fileName, argv[3]); //sending filename to server write(cfd, fileName, 100); //receiving file from server FILE *received, *newFile; char buf[9]; received = fdopen(cfd, "r"); if (fread(buf, 9, 1, received) && strcmp(buf, "ERROR404") == 0){ fprintf(stderr, "File not received\n"); return 1; } if ((newFile = fopen(argv[4], "w")) == NULL){ fprintf(stderr, "Opening for writing failed\n"); return 1; } //writing the buf that's already been read fwrite(buf, 9, 1, newFile); //writing to new file to be saved char c; while (fread(&c, 1, 1, received)){ fputc(c, newFile); } fclose(newFile); fclose(received); printf("File %s received and saved as %s\n", argv[3], argv[4]); close(cfd); return 0; }
548575cd875206a1a475e3bce0089268bb832ca2
[ "Markdown", "C" ]
3
C
eltc29/File-transfer
a13b33bbebe501f27dec60750d90b4294dc1af96
5a685c44a40ca5274e3f79248a3fe099c6c25646
refs/heads/master
<file_sep>package com.social.cucumber; import static org.junit.Assert.assertEquals; import com.social.jpa.entities.Group; import com.social.jpa.entities.User; import cucumber.api.java.en.Given; import cucumber.api.java.en.Then; import cucumber.api.java.en.When; public class RegGroupSteps { // When Requesting the Group // Then Group has been retrieved int grpID; Group grpRes; User usrSample = new User("Cucu", "User"); Group grpSample = new Group("CucuGroup"); @Given("^Group has been registered$") public void createGroup() { grpID = GlobalGlue.getService().createGroup(grpSample.getGroupName()); } @When("^Requesting the Group$") public void getGroup() { grpRes = GlobalGlue.getService().getGroup(grpID); } @Then ("^Group has been retrieved$") public void validateGroup() { assertEquals(grpRes.getGroupName(), grpSample.getGroupName()); } } <file_sep>package com.social.test; import static org.junit.Assert.assertEquals; import java.util.Date; import java.util.List; import org.junit.Test; import org.springframework.context.ApplicationContext; import org.springframework.context.annotation.AnnotationConfigApplicationContext; import com.google.gson.Gson; import com.social.jpa.entities.Group; import com.social.jpa.entities.Post; import com.social.jpa.entities.User; import com.social.jpa.utils.BeansConfigure; import com.social.services.SocialNetworkService; public class IsolatedTest { ApplicationContext ctx = new AnnotationConfigApplicationContext(BeansConfigure.class); SocialNetworkService sd; Gson gsn = new Gson(); User usrSample = new User("Test", "User"); Group grpSample = new Group("testGroup"); Post postSample = new Post(new Date(), usrSample, grpSample, "Test Post"); int usrIDinDB; int grpIDinDB; public Post createRelatedPostUserAndGroup(){ usrIDinDB = sd.createUser("Test", "User"); grpIDinDB = sd.createGroup(grpSample.getGroupName()); sd.addUserToGroup(usrIDinDB, grpIDinDB); int pstID = sd.createPost(usrIDinDB, grpIDinDB, postSample.getContent()); Post pstRes = sd.getPost(pstID); return pstRes; } @Test public void deleteUserGroupAndPost(){ AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext(); // ctx.register(JPAConfigure.class); ctx.scan("services"); ctx.refresh(); sd = ctx.getBean(SocialNetworkService.class); // sd.setSocialDao(ctx.getBean(SocialDao.class)); Post pstRes = this.createRelatedPostUserAndGroup(); List<Group> grps = sd.getAllGroups(); List<User> usrs = sd.getAllUsers(); // int grpCounter = grps.size(); int usrCounter = usrs.size(); assertEquals(grpCounter, grps.size()); assertEquals(usrCounter, usrs.size()); pstRes = this.createRelatedPostUserAndGroup(); grps = sd.getAllGroups(); usrs = sd.getAllUsers(); assertEquals(grpCounter + 1, grps.size()); assertEquals(usrCounter + 1, usrs.size()); sd.deleteUser(usrIDinDB); sd.deleteGroup(grpIDinDB); assertEquals(grpCounter, sd.getAllGroups().size()); assertEquals(usrCounter, sd.getAllUsers().size()); } } <file_sep>jdbc.driverClassName = com.mysql.jdbc.Driver jdbc.url = jdbc:mysql://localhost:3306/SocialNetwork2 jdbc.username = lior jdbc.password = <PASSWORD> hibernate.dialect = org.hibernate.dialect.MySQL5Dialect hibernate.hbm2ddl.auto=create-drop hibernate.show_sql = true hibernate.format_sql = true<file_sep>#REST-API# Below is the Data manipulation available by the Project API ##Group Elements## *get:* <br /> /Groups -> returns all listed Groups<br /> /Groups/{id} -> returns Group of id<br /> /Groups/{id}/Users -> returns Groups of Group of id<br /> /Groups/{id}/Posts -> returns Posts of Group of id<br /> *put:*<br /> /Groups/(params: groupName) -> creates a new Group<br /> *post:*<br /> /Groups/{gid}/{uid} -> add User to Group<br /> *Delete:*<br /> /Groups/{id} -> delete Group<br /> /Groups/{gid}/{uid} -> remove user from group<br /> ##User Elements## *get:* <br /> /Users ->returns all listed Users<br /> /Users/{id} -> returns user of id<br /> /Users/{id}/Groups -> returns Groups of user of id<br /> /Users/{id}/Posts -> returns Posts of user of id<br /> *Post:*<br /> /Users/(json params: firstName, lastName) -> creates a new User<br /> *Delete:*<br /> /Users/{id} -> delete user<br /> ##Content Elements## *Get:* <br /> /Posts/{id} -> returns Post of id<br /> *Post:*<br /> /Posts/(params: grpID, usrID,content) -> add new Post of User to a Group *Delete:*<br /> /Posts/{id} -> delete Post <file_sep>package com.social.jpa.utils; public final class DBRef { //Users table public static final String USERS_TABLE = "USERS"; public static final String USER_ID = "USER_ID"; public static final String FIRST_NAME = "FIRST_NAME"; public static final String LAST_NAME = "LAST_NAME"; public static final String IS_ACTIVE = "IS_ACTIVE"; //Posts table public static final String POSTS_TABLE = "POSTS"; public static final String POST_ID = "POST_ID"; public static final String CONTENT = "CONTENT"; public static final String DATE = "DATE_RAISED"; //Groups table public static final String GROUP_TABLE = "GROUPS"; public static final String GROUP_ID = "GROUP_ID"; public static final String GROUP_NAME = "GROUP_NAME"; //Groups-Users public static final String GROUPS_USERS_TABLE = "GROUPS_USERS"; } <file_sep><project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>SocialServerProjectV6</groupId> <artifactId>SocialServerProjectV6</artifactId> <version>0.0.1-SNAPSHOT</version> <packaging>war</packaging> <build> <sourceDirectory>src</sourceDirectory> <testSourceDirectory>test</testSourceDirectory> <resources> <resource> <directory>resources</directory> <excludes> <exclude>**/*.java</exclude> </excludes> </resource> </resources> <plugins> <plugin> <artifactId>maven-compiler-plugin</artifactId> <version>3.5.1</version> <configuration> <source>1.8</source> <target>1.8</target> </configuration> </plugin> <plugin> <artifactId>maven-war-plugin</artifactId> <version>3.0.0</version> <configuration> <warSourceDirectory>WebContent</warSourceDirectory> </configuration> </plugin> </plugins> </build> <dependencies> <dependency> <groupId>mysql</groupId> <artifactId>mysql-connector-java</artifactId> <version>6.0.5</version> </dependency> <!-- https://mvnrepository.com/artifact/org.hibernate/hibernate-core --> <dependency> <groupId>org.hibernate</groupId> <artifactId>hibernate-core</artifactId> <version>5.2.5.Final</version> </dependency> <!-- https://mvnrepository.com/artifact/com.google.code.gson/gson --> <dependency> <groupId>com.google.code.gson</groupId> <artifactId>gson</artifactId> <version>2.8.0</version> </dependency> <!-- https://mvnrepository.com/artifact/junit/junit --> <dependency> <groupId>junit</groupId> <artifactId>junit</artifactId> <version>4.12</version> </dependency> <dependency> <groupId>commons-digester</groupId> <artifactId>commons-digester</artifactId> <version>2.1</version> </dependency> <!-- https://mvnrepository.com/artifact/org.apache.commons/commons-lang3 --> <dependency> <groupId>org.apache.commons</groupId> <artifactId>commons-lang3</artifactId> <version>3.4</version> </dependency> <!-- https://mvnrepository.com/artifact/com.sun.xml.bind/jaxb-impl --> <dependency> <groupId>com.sun.xml.bind</groupId> <artifactId>jaxb-impl</artifactId> <version>2.2.11</version> </dependency> <dependency> <groupId>com.sun.xml.bind</groupId> <artifactId>jaxb-core</artifactId> <version>2.2.11</version> </dependency> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-core</artifactId> <version>4.3.6.RELEASE</version> </dependency> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-context</artifactId> <version>4.3.6.RELEASE</version> </dependency> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-jdbc</artifactId> <version>4.3.6.RELEASE</version> </dependency> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-beans</artifactId> <version>4.3.6.RELEASE</version> </dependency> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-orm</artifactId> <version>4.3.6.RELEASE</version> </dependency> <dependency> <!--We need this because Spring still uses common-logging, jcl-over-slf4j will substitute calles to common-loggin. Make sure you excluded common-logging in every module that depends on it. For more details read http://docs.spring.io/spring/docs/4.1.x/spring-framework-reference/htmlsingle/#overview-logging-slf4j --> <groupId>org.slf4j</groupId> <artifactId>jcl-over-slf4j</artifactId> <version>1.7.12</version> </dependency> <dependency> <!--we will use logback as logger implementation, it is also possible to log4j and java logging --> <groupId>ch.qos.logback</groupId> <artifactId>logback-classic</artifactId> <version>1.1.2</version> </dependency> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-aop</artifactId> <version>4.3.6.RELEASE</version> </dependency> <dependency> <groupId>net.sf.aspect4log</groupId> <artifactId>aspect4log</artifactId> <version>1.0.7</version> </dependency> <!-- https://mvnrepository.com/artifact/org.aspectj/aspectjweaver --> <dependency> <groupId>org.aspectj</groupId> <artifactId>aspectjweaver</artifactId> <version>1.8.10</version> </dependency> <dependency> <groupId>org.slf4j</groupId> <artifactId>slf4j-api</artifactId> <version>1.7.12</version> </dependency> <dependency> <groupId>info.cukes</groupId> <artifactId>cucumber-core</artifactId> <version>1.2.5</version> </dependency> <dependency> <groupId>info.cukes</groupId> <artifactId>cucumber-junit</artifactId> <version>1.2.5</version> </dependency> <dependency> <groupId>info.cukes</groupId> <artifactId>cucumber-java</artifactId> <version>1.2.5</version> </dependency> <dependency> <groupId>org.mockito</groupId> <artifactId>mockito-core</artifactId> <version>1.10.19</version> </dependency> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-mock</artifactId> <version>2.0.8</version> </dependency> <dependency> <groupId>org.mockito</groupId> <artifactId>mockito-all</artifactId> <version>1.10.19</version> </dependency> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-test</artifactId> <version>4.3.7.RELEASE</version> </dependency> <!-- https://mvnrepository.com/artifact/commons-io/commons-io --> <dependency> <groupId>commons-io</groupId> <artifactId>commons-io</artifactId> <version>2.4</version> </dependency> </dependencies> </project><file_sep>package com.social.web.servlets; import java.io.IOException; import javax.servlet.ServletException; import javax.servlet.annotation.WebServlet; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import com.google.gson.Gson; import com.social.web.utils.ServiceConrol; /******************************************** *get* /Users ->returns all listed Users /Users/{id} -> returns user of id /Users/{id}/Groups -> returns Groups of user of id /Users/{id}/Posts -> returns Posts of user of id *Post* /Users/(json params: firstName, lastName) -> creates a new User *Delete* /Users/{id} -> delete user *******************************************/ @WebServlet({"/Users", "/Users/*","/Users/*/Groups", "/Users/*/Posts"}) public class UserServlet extends HttpServlet { private static final long serialVersionUID = 1L; private Gson gsn = new Gson(); public UserServlet() { super(); } @Override protected void doDelete(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { ServiceConrol ctrl = new ServiceConrol(request, response); String res = null; try { ctrl.getSNS().deleteUser(ctrl.getID()); res = "success"; } catch (Exception e) { res = ctrl.setError(e, response); } finally { ctrl.sendResults(ctrl.getOut(),res); } } @Override public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { ServiceConrol ctrl = new ServiceConrol(request, response); String res = null; try { switch (ctrl.getDefinedService()) { case UNRELATED: if (ctrl.getID() != null){ res = gsn.toJson(ctrl.getSNS().getUser(ctrl.getID())); } else { res = gsn.toJson(ctrl.getSNS().getAllUsers()); } break; case GROUPS: res = gsn.toJson(ctrl.getSNS().getUserGroups(ctrl.getID())); break; case POSTS: res = gsn.toJson(ctrl.getSNS().getUserPosts(ctrl.getID())); break; default: break; } response.setContentType("application/json"); } catch (Exception e) { res = ctrl.setError(e, response); } finally{ ctrl.sendResults(ctrl.getOut(),res); } } @Override public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { ServiceConrol ctrl = new ServiceConrol(request, response); String firstName = request.getParameter("firstName"); String lastName = request.getParameter("lastName"); String res = null; try { res = gsn.toJson(ctrl.getSNS().createUser(firstName, lastName)); } catch (Exception e) { res = ctrl.setError(e, response); } finally { ctrl.sendResults(ctrl.getOut(),res); } } } <file_sep>package com.social.web.servlets; import java.io.IOException; import javax.servlet.ServletException; import javax.servlet.annotation.WebServlet; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import com.google.gson.Gson; import com.social.web.utils.ServiceConrol; /******************************************** *Get* /Posts/{id} -> returns Post of id *Post* /Posts/(params: grpID, usrID,content) -> add new Post of User to a Group *Delete* /Posts/{id} -> delete Post *******************************************/ @WebServlet({"/Posts", "/Posts/*"}) public class ContentServlet extends HttpServlet { private Gson gsn = new Gson(); private static final long serialVersionUID = 1L; public ContentServlet() { super(); } @Override protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { ServiceConrol ctrl = new ServiceConrol(request, response); String res = null; try { res = gsn.toJson(ctrl.getSNS().getPost(ctrl.getID())); } catch (Exception e) { res = ctrl.setError(e, response); } finally { ctrl.sendResults(ctrl.getOut(),res); } } @Override protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { ServiceConrol ctrl = new ServiceConrol(request, response); int usrID = Integer.parseInt(request.getParameter("usrID")); int grpID = Integer.parseInt(request.getParameter("grpID")); String content = request.getParameter("content"); String res = null; try { res = gsn.toJson(ctrl.getSNS().createPost(usrID, grpID, content)); } catch (Exception e) { res = ctrl.setError(e, response); } finally { ctrl.sendResults(ctrl.getOut(),res); } } @Override protected void doDelete(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { ServiceConrol ctrl = new ServiceConrol(request, response); String res = null; try { ctrl.getSNS().deletePost(ctrl.getID()); res = "success"; } catch (Exception e) { res = ctrl.setError(e, response); } finally { ctrl.sendResults(ctrl.getOut(),res); } } } <file_sep>package com.social.cucumber; import org.junit.runner.RunWith; import cucumber.api.junit.Cucumber; @RunWith(Cucumber.class) public class CucuRun { } <file_sep>Author: <NAME> # Overview This is a Self-Learning-Purposed server that permits users to create and access social groups and sharing their posts through REST API & SOAP implemented using Apache Tomcat web-container. It's layers are being implementated using Frameworks like: Hibernate, Spring(IOC/AOP) & JUnit. The Project is also relating fundamental Java principles like various Design Patterns, OOP and more. # Project References: Initial Class Diagram: https://drive.google.com/file/d/0B2NNxddUDrBnNk03U2kyR2JVZlk/view?usp=sharing Initial Data Diagram: https://drive.google.com/file/d/0B2NNxddUDrBnOTNsY3YzeFFkcVk/view?usp=sharing #Next Objective: __Transform DAO & Service to interfaces-based__</br> # Latest Updates ##09.03.17:## * HTTP request & respons have been Mocked in tests package. * BDD (Cucumber) test sample has been issued. ##06.03.17:## * Spring is now fully supporting JPA * Logger Base Aspect is now have been issued. ##04.03.17:## * getUser SOAP Web Service has been issued. Currently provide getUser(int) method. * SOAP is using JAXB marshalling to return information. ##02.03.17:## * Finished Web-Services Layer * Adding a com.social.web.utils package to support the web-services. This mainly includes Service Control to manage better the connection with the Service layer with a minimum code redundency. * Moving EntityFactory to the Dao Layer ##24.02.17:## * Finished Service layer tests. * Added 'isActive' Field to User to mark up user existence (deletion of user will mark isActive as false). ##22.02.17:## * changing Service layer to work with types which are not necesserly Strings * Almost Finishing Service layer Tests * Adding Named-Queries * Managing bi-directional relationship. <file_sep>package com.social.services; import java.util.Date; import java.util.HashSet; import java.util.List; import java.util.Set; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import com.social.dao.SocialDao; import com.social.jpa.entities.Group; import com.social.jpa.entities.Post; import com.social.jpa.entities.User; @Transactional @Service public class SocialNetworkService { @Autowired SocialDao dao; @SuppressWarnings("unchecked") public List<User> getAllUsers() throws IllegalArgumentException{ return (List<User>) dao.getAllUsers(); } @SuppressWarnings("unchecked") public List<Group> getAllGroups() throws IllegalArgumentException{ return (List<Group>) dao.getAllGroups(); } //returns UserID public int createUser(String firstName, String lastName){ if (!firstName.matches("[a-zA-Z]+") || !lastName.matches("[a-zA-Z]+")){ throw new IllegalArgumentException("cannot obtain numbers in a name"); } User usr = new User(firstName, lastName); dao.putUser(usr); return usr.getUserID(); } public User getUser(int usrID) throws IllegalArgumentException{ User usr = dao.getUser(usrID); this.userCheck(usr); return usr; } public Post getPost(int pstID){ Post pst = dao.getPost(pstID); this.postCheck(pst); return pst; } //returns GroupID public int createGroup(String groupName){ Group grp = new Group(groupName); dao.putGroup(grp); return grp.getGroupID(); } public Group getGroup(int grpID) throws IllegalArgumentException { Group grp = dao.getGroup(grpID); this.groupCheck(grp); return grp; } //return pst id public int createPost(int usrID, int grpID, String content){ User usr = dao.getUser(usrID); Group grp = dao.getGroup(grpID); this.userCheck(usr); this.groupCheck(grp); if (!grp.getUsers().contains(usr)){ throw new IllegalArgumentException("user not in group"); } Post pst = new Post(new Date(),usr, grp,content); dao.addPost(pst); return pst.getPostID(); } public void addUserToGroup(int usrID, int grpID) throws IllegalArgumentException { User usr = dao.getUser(usrID); Group grp = dao.getGroup(grpID); this.userCheck(usr); this.groupCheck(grp); if (usr.getGroups().contains(grp)){ throw new IllegalArgumentException("user is already in group"); } dao.addUserToGroup(usr, grp); } public Set<Post> getGroupPosts(int grpID){ Group grp = dao.getGroup(grpID); this.groupCheck(grp); Set<Post> psts = grp.getPosts(); if (psts.size() == 0){ throw new IllegalArgumentException("Group does not have any Posts"); } return psts; } public List<Post> getUserPosts(int usrID)throws IllegalArgumentException{ User usr = dao.getUser(usrID); this.userCheck(usr); List <Post> psts = dao.getUserPosts(usrID); if (psts.size() == 0){ throw new IllegalArgumentException("User does not have any Posts"); } return psts; } public Set<Group> getUserGroups(int usrID) throws IllegalArgumentException{ User usr = dao.getUser(usrID); this.userCheck(usr); return dao.getUserGroups(usrID); } public Set<User> getGroupUsers(int grpID) throws IllegalArgumentException { Group grp = dao.getGroup(grpID); this.groupCheck(grp); Set<User> usrs = grp.getUsers(); return new HashSet<>(usrs); } //delete data public void removeUserFromGroup(int usrID, int grpID) throws IllegalArgumentException{ User usr = dao.getUser(usrID); Group grp = dao.getGroup(grpID); this.userCheck(usr); this.groupCheck(grp); if (!usr.getGroups().contains(grp)){ throw new IllegalArgumentException("user is not in group"); } dao.removeUserFromGroup(usr, grp); } public void deletePost(int pstID) throws IllegalArgumentException{ Post pst = dao.getPost(pstID); this.postCheck(pst); dao.deletePost(pst); } public void deleteUser(int usrID){ User usr = dao.getUser(usrID); this.userCheck(usr); Set<Group> groupList = usr.getGroups(); for (Group grp: groupList){ dao.removeUserFromGroup(usr, grp); } dao.deleteUser(usr); } public void deleteGroup(int grpID){ Group grp = dao.getGroup(grpID); this.groupCheck(grp); for (User usr : grp.getUsers()){ dao.removeUserFromGroup(usr, grp); } for (Post pst : grp.getPosts()){ dao.deletePost(pst); } dao.deleteGroup(grp); } private void userCheck(User usr){ if (usr == null || usr.isActive() == false){ throw new IllegalArgumentException("User does not exist"); } } private void groupCheck(Group grp){ if (grp == null){ throw new IllegalArgumentException("group does not exist"); } } private void postCheck(Post pst){ if (pst == null){ throw new IllegalArgumentException("Post does not exist"); } } } <file_sep>package com.social.dao; import java.util.ArrayList; import java.util.HashSet; import java.util.List; import java.util.Set; import javax.persistence.EntityManager; import javax.persistence.PersistenceContext; import com.social.jpa.entities.Group; import com.social.jpa.entities.Post; import com.social.jpa.entities.User; public class SocialDao { @PersistenceContext private EntityManager em; public List<?> getAllUsers() throws IllegalArgumentException{ return (em.createNamedQuery(User.GET_All_USERS) .getResultList()); } public List<?> getAllGroups() throws IllegalArgumentException{ return (em.createNamedQuery(Group.GET_ALL_GROUPS) .getResultList()); } public void putUser(User usr){ em.persist(usr); } public User getUser(int usrID) throws IllegalArgumentException{ User usr = em.find(User.class, usrID); return usr; } public void putGroup(Group grp){ em.persist(grp); } public Group getGroup(int grpID){ Group grp = em.find(Group.class, grpID); return grp; } public Post getPost(int pstID){ Post pst = em.find(Post.class, pstID); return pst; } public void addPost(Post pst){ em.persist(pst); User usr = pst.getUser(); usr.addPost(pst); Group grp = pst.getGroup(); grp.addPost(pst); em.persist(usr); em.persist(grp); } public void addUserToGroup(User usr, Group grp){ grp.addUser(usr); usr.addGroup(grp); em.persist(grp); em.persist(usr); } public void removeUserFromGroup(User usr, Group grp){ grp.removeUser(usr); usr.removeGroup(grp); em.persist(grp); em.persist(usr); } public List<Post> getUserPosts(int usrID){ User usr = em.find(User.class, usrID); return new ArrayList<>(usr.getPosts()); } public Set<Group> getUserGroups(int usrID){ User usr = em.find(User.class, usrID); return new HashSet<Group>(usr.getGroups()); } public void deletePost(Post pst){ em.remove(pst); } public void deleteUser(User usr){ usr.setFirstName("Deleted"); usr.setLastName("User"); usr.setActive(false); em.persist(usr); } public void deleteGroup(Group grp){ em.remove(grp); } }<file_sep>package com.social.web.utils; public enum URLPattern{ ACTIVE_CLASS(0), ID(1), RELATED_CLASS(2); private int layer; URLPattern(int layer) { this.layer = layer; } public int getLayer(){ return layer; } }
ca647fca663771388c2e4736f79cdc6c30192d9c
[ "Markdown", "Java", "Maven POM", "INI" ]
13
Java
Arigatonic/Sapiens-Infinity-Project
52f6484ca547f7119138d3e825bbc077d4440807
6464c82d15fe4a4af7420cb5658c75d9ab25fb31
refs/heads/master
<file_sep>package es.flakiness.hiccup.play; import android.content.Context; import android.media.MediaPlayer; import android.net.Uri; import android.os.Handler; import android.os.Looper; import java.io.IOException; import java.util.ArrayList; import java.util.List; import rx.Observable; import rx.Subscription; import rx.subjects.PublishSubject; public class Player implements PlayerProgressSource.Values, Playing, Subscription { private interface PendingAction { boolean run(); } private final Uri uri; private final Context context; private final List<PendingAction> pendingActions = new ArrayList(); // FIXME: Could be different class. private final PublishSubject<PlayerState> stateSubject = PublishSubject.create(); private final PlayerProgressSource progressSource; private MediaPlayer media; private PlayerState state; public Player(Context context, Uri uri) throws IOException { this.progressSource = new PlayerProgressSource(this, new Handler(Looper.myLooper())); this.context = context; this.uri = uri; this.media = new MediaPlayer(); this.media.setDataSource(context, uri); this.media.setOnPreparedListener(new MediaPlayer.OnPreparedListener() { @Override public void onPrepared(MediaPlayer mediaPlayer) { onPlayerPrepared(); } }); this.media.setOnCompletionListener(new MediaPlayer.OnCompletionListener() { @Override public void onCompletion(MediaPlayer mediaPlayer) { onPlayerCompleted(); } }); this.media.setOnSeekCompleteListener(new MediaPlayer.OnSeekCompleteListener() { @Override public void onSeekComplete(MediaPlayer mediaPlayer) { onPlayerSeekComplete(); } }); prepareStarting(); } public Context getContext() { return context; } private void consumePendingActionsWhilePossible() { while (!pendingActions.isEmpty()) { boolean done = pendingActions.get(0).run(); if (!done) break; pendingActions.remove(0); } } private void onPlayerSeekComplete() { if (state != PlayerState.SEEKING) { // This does happen. MediaPlayer calls onPlayerSeekComplete() even when // the user doesn't request seekTo(). return; } if (media.isPlaying()) throw new AssertionError("The GestureInterpreter should be paused after seeking."); setState(PlayerState.PAUSING); consumePendingActionsWhilePossible(); progressSource.emit(); } private void onPlayerCompleted() { seekTo(media.getDuration() - 1); } private void onPlayerPrepared() { progressSource.start(); setState(PlayerState.PREPARED); consumePendingActionsWhilePossible(); } private void prepareStarting() { this.media.prepareAsync(); setState(PlayerState.PREPARING); } public void start() { pendingActions.add(new PendingAction() { @Override public boolean run() { if (!state.isReadyToStart()) return false; media.start(); setState(PlayerState.PLAYING); return true; } }); consumePendingActionsWhilePossible(); } public void pause() { // FIXME: This should be pend-able. if (state.isPauseable()) { media.pause(); setState(PlayerState.PAUSING); } } public void toggle() { if (state == PlayerState.PLAYING) pause(); else start(); } public void seekTo(final int nextPosition) { pendingActions.add(new PendingAction() { @Override public boolean run() { if (state.isBusy()) return false; setState(PlayerState.SEEKING); media.pause(); // This guarantees that the interpreter goes back to pause after seeking. media.seekTo(nextPosition); return true; } }); consumePendingActionsWhilePossible(); } private void setState(PlayerState state) { if (state == PlayerState.HOLDING) throw new AssertionError(); if (this.state == state) return; this.state = state; stateSubject.onNext(state); } @Override public Observable<PlayerProgress> progress() { return progressSource.getObservable(); } @Override public Observable<PlayerState> states() { return stateSubject; } @Override public PlayerProgress getProgress() { return new PlayerProgress(media.getDuration(), media.getCurrentPosition()); } @Override public PlayerState getState() { return state; } @Override public void unsubscribe() { media.stop(); media.release(); media = null; progressSource.stop(); stateSubject.onCompleted(); } @Override public boolean isUnsubscribed() { return media == null; } } <file_sep>package es.flakiness.hiccup.index; import android.app.Activity; import android.content.Intent; import android.os.Bundle; import android.support.v7.app.AppCompatActivity; import com.squareup.otto.Bus; import com.squareup.otto.Subscribe; import javax.inject.Inject; import dagger.ObjectGraph; import es.flakiness.hiccup.InjectionScope; import es.flakiness.hiccup.Injections; import es.flakiness.hiccup.R; import es.flakiness.hiccup.play.PlayActivity; import es.flakiness.hiccup.talk.AddTalkEvent; import es.flakiness.hiccup.talk.PlayTalkEvent; import es.flakiness.hiccup.talk.TalkStore; public class IndexActivity extends AppCompatActivity implements InjectionScope { private ObjectGraph graph; @Inject Bus bus; @Inject TalkStore store; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); graph = Injections.plus(getApplicationContext(), new IndexModule()); graph.inject(this); bus.register(this); setContentView(R.layout.activity_index); } @Override protected void onDestroy() { bus.unregister(this); super.onDestroy(); } @Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { if (requestCode == 1 && resultCode == RESULT_OK) { store.addTalk(this.getApplicationContext(), data.getData()); } } @Subscribe public void requestAddTalk(AddTalkEvent event) { Intent intent = new Intent(Intent.ACTION_OPEN_DOCUMENT); intent.setType("audio/*"); startActivityForResult(intent, 1); } @Subscribe public void playTalk(PlayTalkEvent event) { Intent intent = new Intent(this, PlayActivity.class); intent.putExtra(PlayActivity.EXTRA_KEY_URL, event.getUri()); intent.putExtra(PlayActivity.EXTRA_KEY_LAST_POSITION, event.getLastPosition()); startActivity(intent); } @Override public ObjectGraph getGraph() { return graph; } } <file_sep>apply plugin: 'com.android.application' android { compileSdkVersion 22 buildToolsVersion "21.1.2" defaultConfig { applicationId "es.flakiness.hiccup" minSdkVersion 19 targetSdkVersion 22 versionCode 3 versionName "0.3" } signingConfigs { release { def privateProps = new Properties() privateProps.load(project.rootProject.file('private.properties').newDataInputStream()) storePassword privateProps.getProperty("sign.storePassword") storeFile file(privateProps.getProperty("sign.storeFile")) keyAlias privateProps.getProperty("sign.keyAlias") keyPassword privateProps.getProperty("sign.keyPassword") } } buildTypes { release { apply plugin: 'findbugs' minifyEnabled true proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' signingConfig signingConfigs.release } debug { minifyEnabled false proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' applicationIdSuffix ".debug" } } } dependencies { provided 'com.squareup.dagger:dagger-compiler:1.2.2+' compile fileTree(dir: 'libs', include: ['*.jar']) compile "com.android.support:appcompat-v7:22.+" compile 'com.squareup.dagger:dagger:1.2.2+' compile 'com.squareup:otto:1.3.5+' compile 'nl.qbusict:cupboard:+' compile 'com.jakewharton:butterknife:6.0.0' compile 'io.reactivex:rxjava:1.0.4' compile 'io.reactivex:rxandroid:0.24.0' compile 'org.ocpsoft.prettytime:prettytime:3.2.5+' compile 'com.android.support:support-v4:22.+' } <file_sep>package es.flakiness.hiccup.play; import android.os.Handler; import rx.Observable; import rx.subjects.PublishSubject; public class PlayerProgressSource { public static interface Values { PlayerProgress getProgress(); PlayerState getState(); } private static int UPDATE_INTERVAL = 1000; final private PublishSubject<PlayerProgress> subject = PublishSubject.create(); final private Values values; private Handler handler; final private Runnable postProgress = new Runnable() { @Override public void run() { emit(); if (handler != null) { int delay = UPDATE_INTERVAL - values.getProgress().getCurrent() % UPDATE_INTERVAL; handler.postDelayed(postProgress, delay); } } }; public PlayerProgressSource(Values values, Handler handler) { this.values = values; this.handler = handler; } public void start() { this.handler.postDelayed(postProgress, 0); } public void stop() { handler.removeCallbacks(postProgress); handler = null; } public void emit() { if (handler != null && subject.hasObservers()) subject.onNext(values.getProgress()); } public Observable<PlayerProgress> getObservable() { if (handler != null) { handler.post(new Runnable() { @Override public void run() { emit(); } }); } return subject; } } <file_sep>package es.flakiness.hiccup.play; import android.app.Activity; import android.content.res.Configuration; import android.net.Uri; import android.os.Bundle; import android.view.Window; import android.view.WindowManager; import java.io.IOException; import dagger.ObjectGraph; import es.flakiness.hiccup.InjectionScope; import es.flakiness.hiccup.Injections; import es.flakiness.hiccup.R; public class PlayActivity extends Activity implements InjectionScope { public static final String EXTRA_KEY_URL = "PLAY_ACTIVITY_URI"; public static final String EXTRA_KEY_LAST_POSITION = "PLAY_LAST_POSITION"; private ObjectGraph graph; private PlayModule module; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); try { Uri uri = (Uri) getIntent().getParcelableExtra(EXTRA_KEY_URL); int lastPosition = getIntent().getIntExtra(EXTRA_KEY_LAST_POSITION, 0); module = new PlayModule(this, uri, lastPosition); graph = Injections.plus(getApplicationContext(), module); } catch (IOException e) { // TODO(omo): handle Gracefully. throw new RuntimeException(e); } // http://stackoverflow.com/questions/8500283/how-to-hide-action-bar-before-activity-is-created-and-then-show-it-again getWindow().requestFeature(Window.FEATURE_ACTION_BAR); getActionBar().hide(); setContentView(R.layout.activity_play); getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON); } @Override protected void onDestroy() { module.release(); super.onDestroy(); } @Override public void onConfigurationChanged(Configuration newConfig) { // TODO(omo): What should I do here? super.onConfigurationChanged(newConfig); } @Override public ObjectGraph getGraph() { return graph; } } <file_sep>package es.flakiness.hiccup.index; import android.annotation.TargetApi; import android.content.Context; import android.content.Intent; import android.net.Uri; import android.os.Build; import android.support.v7.widget.Toolbar; import android.util.AttributeSet; import android.util.Log; import android.view.MenuItem; import android.view.View; import android.widget.AdapterView; import android.widget.FrameLayout; import android.widget.ListView; import com.squareup.otto.Bus; import javax.inject.Inject; import butterknife.InjectView; import es.flakiness.hiccup.Injections; import es.flakiness.hiccup.R; import es.flakiness.hiccup.talk.AddTalkEvent; import es.flakiness.hiccup.talk.TalkStore; public class IndexView extends FrameLayout { @Inject TalkList talkList; @Inject TalkStore store; @Inject Bus bus; @InjectView(R.id.index_toolbar) Toolbar toolbar; @InjectView(R.id.card_list) ListView cardList; private TalkListActionMode actionMode; public IndexView(Context context) { this(context, null); } public IndexView(Context context, AttributeSet attrs) { this(context, attrs, 0); } public IndexView(Context context, AttributeSet attrs, int defStyleAttr) { super(context, attrs, defStyleAttr); initialize(); } @TargetApi(Build.VERSION_CODES.LOLLIPOP) public IndexView(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) { super(context, attrs, defStyleAttr, defStyleRes); initialize(); } private void initialize() { Injections.inflateAndInject(R.layout.index_view, this); cardList.setAdapter(talkList); cardList.setOnItemClickListener(new AdapterView.OnItemClickListener() { @Override public void onItemClick(AdapterView<?> adapterView, View view, int i, long l) { if (actionMode.isActive()) { actionMode.viewWasSelectedWhileActive(view, i); return; } talkList.onClickAt(i); } }); actionMode = new TalkListActionMode(cardList, store); // FIXME(omo): This should be built by Dagger. cardList.setOnItemLongClickListener(new AdapterView.OnItemLongClickListener() { @Override public boolean onItemLongClick(AdapterView<?> parent, View view, int position, long id) { return actionMode.onItemLongClick(toolbar, view, position, id); } }); toolbar.inflateMenu(R.menu.menu_main); toolbar.setOnMenuItemClickListener(new Toolbar.OnMenuItemClickListener() { @Override public boolean onMenuItemClick(MenuItem menuItem) { switch (menuItem.getItemId()) { case R.id.action_add_debug_item: store.addDebugTalk(); return true; case R.id.action_clear_talk_list: store.clearTalk(); return true; case R.id.action_add_talk: bus.post(new AddTalkEvent()); return true; case R.id.action_show_licenses: showLicenses(); return true; default: Log.wtf(getClass().getName(), "No such menu"); return false; } } }); } private void showLicenses() { Intent i = new Intent(Intent.ACTION_VIEW); i.setData(Uri.parse("https://github.com/omo/hiccup/blob/master/LICENSES.txt")); getContext().startActivity(i); } @Override protected void onDetachedFromWindow() { super.onDetachedFromWindow(); talkList.unsubscribe(); // This should be handled by the module } } <file_sep>package es.flakiness.hiccup.play; // FIXME: // This seems redundant. We should be able to infer some of these from MediaPlayer API. // Probably we could extract the non-policy part of the GestureInterpreter into a class and // give getState() api to that, instead of explicitly storing the state. public enum PlayerState { PREPARING, PREPARED, PLAYING, PAUSING, HOLDING, // FIXME(omo): This shouldn't be here. SEEKING; public boolean isReadyToStart() { return !isBusy() && this != PLAYING; } public boolean isBusy() { return this == PREPARING || this == SEEKING; } public boolean isPauseable() { return this == PLAYING; } public boolean isHoldable() { return this == PLAYING || this == PAUSING; } } <file_sep>package es.flakiness.hiccup; import com.squareup.otto.Bus; import javax.inject.Singleton; import dagger.Module; import dagger.Provides; import es.flakiness.hiccup.index.IndexActivity; import es.flakiness.hiccup.index.IndexView; import es.flakiness.hiccup.index.TalkList; import es.flakiness.hiccup.talk.TalkStore; import nl.qbusict.cupboard.CupboardFactory; import nl.qbusict.cupboard.DatabaseCompartment; @Module( injects = { TalkStore.class }, library = true ) public class AppModule { private final App app; private final DatabaseOpenHelper databaseOpenHelper; public AppModule(App app) { this.app = app; this.databaseOpenHelper = new DatabaseOpenHelper(app); } @Provides @Singleton DatabaseCompartment provideDatabaseCompartment() { return CupboardFactory.cupboard().withDatabase(databaseOpenHelper.getWritableDatabase()); } @Provides @Singleton Bus provideBus() { return new Bus(); } } <file_sep>package es.flakiness.hiccup.play; import android.widget.TextView; import javax.inject.Inject; import rx.Subscription; import rx.android.schedulers.AndroidSchedulers; import rx.functions.Action1; import rx.functions.Func1; import rx.subjects.PublishSubject; import rx.subscriptions.CompositeSubscription; public class PlayProgressPreso implements Subscription { private final Playing playing; private final CompositeSubscription subscriptions = new CompositeSubscription(); @Inject public PlayProgressPreso(Playing playing) { this.playing = playing; } public void connectTo(final TextView textView, final PlayBarView barView) { subscriptions.add(this.playing.progress().map(new Func1<PlayerProgress, String>() { @Override public String call(PlayerProgress playerProgress) { return toClockText(playerProgress); } }).distinctUntilChanged().subscribe(new Action1<String>() { @Override public void call(String s) { textView.setText(s); } })); subscriptions.add(this.playing.progress().subscribe(new Action1<PlayerProgress>() { @Override public void call(PlayerProgress playerProgress) { float c = playerProgress.getCurrent(); float d = playerProgress.getDuration(); barView.setProgress(c/d); } })); } private String toClockText(PlayerProgress progress) { int second = (progress.getCurrent()/1000)%60; int minute = (progress.getCurrent()/(60*1000))%60; return String.format("%02d:%02d", minute, second); } @Override public void unsubscribe() { subscriptions.unsubscribe(); } @Override public boolean isUnsubscribed() { return subscriptions.isUnsubscribed(); } } <file_sep>package es.flakiness.hiccup.play; import android.view.Choreographer; import rx.Observable; import rx.subjects.PublishSubject; public class SeekSession { public static final int MAX_SEEK_PER_SEC = 60*1000; private int duration; private int current; private float gradient; private PublishSubject<Integer> currentPositionSubject = PublishSubject.create(); private long lastNano = System.nanoTime(); private Choreographer choreographer; // FIXME: Could be abstracted as an Observable. private Choreographer.FrameCallback frameCallback = new Choreographer.FrameCallback() { @Override public void doFrame(long frameTimeNanos) { updateCurrent(frameTimeNanos); } }; public SeekSession(PlayerProgress progress) { this(progress.getDuration(), progress.getCurrent()); } public SeekSession(int duration, int current) { this.duration = duration; this.current = current; this.choreographer = Choreographer.getInstance(); updateCurrent(System.nanoTime()); } private void updateCurrent(long currentNano) { float delta = (float) (currentNano - lastNano) / 1000000000f; lastNano = currentNano; float emphasizedGradient = gradient*gradient*(0 <= gradient ? +1 : -1); float velocity = (emphasizedGradient * MAX_SEEK_PER_SEC) * delta; current += velocity; if (duration < current) current = duration; if (current < 0) current = 0; currentPositionSubject.onNext(current); if (null != choreographer) choreographer.postFrameCallback(frameCallback); } public int release() { currentPositionSubject.onCompleted(); choreographer = null; return current; } public void setGradient(float gradient) { this.gradient = gradient; } public int getDuration() { return duration; } public int getCurrent() { return current; } Observable<Integer> currentPositions() { return currentPositionSubject; } } <file_sep>package es.flakiness.hiccup.play; public class PlayerProgress { private final int duration; private final int current; public PlayerProgress(int duration, int current) { this.duration = duration; this.current = current; } public int getCurrent() { return current; } public int getDuration() { return duration; } } <file_sep>package es.flakiness.hiccup; import android.app.Activity; import android.app.Application; import android.content.Context; import dagger.ObjectGraph; public class App extends Application implements InjectionScope { private ObjectGraph graph; @Override public void onCreate() { super.onCreate(); this.graph = ObjectGraph.create(new AppModule(this)); } @Override public ObjectGraph getGraph() { return graph; } } <file_sep>package es.flakiness.hiccup.play; import android.graphics.Canvas; import android.view.View; public interface ViewRenderer { void draw(ViewRenderingContext context, Canvas canvas); } <file_sep>package es.flakiness.hiccup.play; import rx.Observable; import rx.Subscription; import rx.functions.Action1; import rx.subjects.PublishSubject; import rx.subscriptions.CompositeSubscription; class Seeker implements Playing, Subscription { private final PublishSubject<PlayerProgress> progress = PublishSubject.create(); private final PublishSubject<PlayerState> states = PublishSubject.create(); private final CompositeSubscription subscriptions = new CompositeSubscription(); private SeekSession session; private Subscription sessionSubscription; public Seeker(Playing playing) { subscriptions.add(playing.progress().subscribe(new Action1<PlayerProgress>() { @Override public void call(PlayerProgress playerProgress) { if (!isSeeking()) progress.onNext(playerProgress); } })); subscriptions.add(playing.states().subscribe(new Action1<PlayerState>() { @Override public void call(PlayerState playerState) { if (!isSeeking()) states.onNext(playerState); } })); } @Override public Observable<PlayerProgress> progress() { return this.progress; } @Override public Observable<PlayerState> states() { return this.states; } public void startSeeking(PlayerProgress current, PlayerState nextState) { if (isSeeking()) throw new AssertionError(); session = new SeekSession(current); sessionSubscription = session.currentPositions().subscribe(new Action1<Integer>() { @Override public void call(Integer integer) { progress.onNext(new PlayerProgress(session.getDuration(), session.getCurrent())); } }); states.onNext(nextState); } public int endSeeking() { sessionSubscription.unsubscribe(); sessionSubscription = null; int position = session.release(); session = null; return position; } public void setGradient(float gradient) { session.setGradient(gradient); } public boolean isSeeking() { return null != sessionSubscription; } @Override public void unsubscribe() { if (sessionSubscription != null) { sessionSubscription.unsubscribe(); sessionSubscription = null; } subscriptions.unsubscribe(); progress.onCompleted(); states.onCompleted(); } @Override public boolean isUnsubscribed() { return subscriptions.isUnsubscribed(); } } <file_sep>package es.flakiness.hiccup.play; import android.net.Uri; import rx.Observable; public interface Playing { Observable<PlayerProgress> progress(); Observable<PlayerState> states(); } <file_sep>package es.flakiness.hiccup.index; import dagger.Module; import es.flakiness.hiccup.AppModule; @Module( injects = { TalkList.class, IndexActivity.class, IndexView.class }, addsTo = AppModule.class ) public class IndexModule { } <file_sep>package es.flakiness.hiccup.play; import android.animation.ArgbEvaluator; import android.animation.ValueAnimator; import android.content.Context; import android.graphics.Canvas; import android.graphics.Color; import android.graphics.drawable.ColorDrawable; import android.os.Vibrator; import android.util.Log; import android.view.View; import es.flakiness.hiccup.play.sign.HoldSign; import es.flakiness.hiccup.play.sign.PauseSign; import es.flakiness.hiccup.play.sign.PlaySign; import rx.Observable; import rx.Subscription; import rx.functions.Action1; import rx.subjects.PublishSubject; import rx.subscriptions.CompositeSubscription; public class PlayInteractionPreso implements Subscription { private final CompositeSubscription subscriptions = new CompositeSubscription(); private final PublishSubject<ViewRenderer> invalidations = PublishSubject.create(); private final View backgroundView; private final int originalColor; private ValueAnimator backgroundAnimator; private ViewRenderer lastSign; static private int darken(int color, float level) { float hsv[] = new float[3]; Color.colorToHSV(color, hsv); hsv[2] = hsv[2]* level; return Color.HSVToColor(hsv); } private int getBackgroundColor() { return ((ColorDrawable) backgroundView.getBackground()).getColor(); } public Observable<ViewRenderer> invalidations() { return invalidations; } private void updateSign(ViewRenderer sign) { lastSign = sign; invalidations.onNext(sign); } private void updatePullDelta(float delta) { if (!(lastSign instanceof HoldSign)) return; updateSign(new HoldSign(delta)); } private void animateBackgroundTo(int toColor) { if (backgroundAnimator != null) backgroundAnimator.cancel(); backgroundAnimator = ValueAnimator.ofObject(new ArgbEvaluator(), getBackgroundColor(), toColor).setDuration(80); backgroundAnimator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() { @Override public void onAnimationUpdate(ValueAnimator animation) { backgroundView.setBackgroundColor((Integer)animation.getAnimatedValue()); } }); backgroundAnimator.start(); } public PlayInteractionPreso(final View view, Observable<GestureEvent> gestures, Observable<PlayerState> states) { backgroundView = view; originalColor = getBackgroundColor(); subscriptions.add(gestures.subscribe(new Action1<GestureEvent>() { @Override public void call(GestureEvent gestureEvent) { switch (gestureEvent.getType()) { case DOWN: Log.d(getClass().getSimpleName(), view.getBackground().toString()); animateBackgroundTo(darken(originalColor, 0.9f)); break; case HOLD: ((Vibrator) view.getContext().getSystemService(Context.VIBRATOR_SERVICE)).vibrate(10); break; case UP: animateBackgroundTo(originalColor); break; case PULL: updatePullDelta(((PullEvent) gestureEvent).getDelta()); default: break; } } })); subscriptions.add(states.subscribe(new Action1<PlayerState>() { @Override public void call(PlayerState playerState) { switch (playerState) { case PLAYING: updateSign(new PauseSign()); break; case PAUSING: updateSign(new PlaySign()); break; case HOLDING: updateSign(new HoldSign(0)); break; default: updateSign(new ViewRenderer() { @Override public void draw(ViewRenderingContext context, Canvas canvas) { // empty. } }); break; } } })); } @Override public void unsubscribe() { subscriptions.unsubscribe(); } @Override public boolean isUnsubscribed() { return subscriptions.isUnsubscribed(); } } <file_sep>An Audio Player Get it from https://play.google.com/store/apps/details?id=es.flakiness.hiccup <file_sep>package es.flakiness.hiccup.talk; import android.net.Uri; // TODO: Could be generated by AutoValue. public class PlayTalkEvent { private Uri uri; private int lastPosition; public PlayTalkEvent(Uri uri, int lastPosition) { this.uri = uri; this.lastPosition = lastPosition; } public Uri getUri() { return uri; } public int getLastPosition() { return lastPosition; } } <file_sep>package es.flakiness.hiccup.index; import android.support.v7.widget.Toolbar; import android.view.ActionMode; import android.view.Menu; import android.view.MenuItem; import android.view.View; import android.widget.AbsListView; import android.widget.ListView; import java.util.ArrayList; import es.flakiness.hiccup.R; import es.flakiness.hiccup.talk.TalkStore; public class TalkListActionMode implements ActionMode.Callback { private final TalkStore store; private final ListView parent; private ActionMode activeMode; public TalkListActionMode(ListView parent, TalkStore store) { this.parent = parent; this.store = store; } public boolean isActive() { return null != activeMode; } private void start(Toolbar toolbar, View initialSelection, int position) { parent.setChoiceMode(AbsListView.CHOICE_MODE_MULTIPLE); activeMode = toolbar.startActionMode(this); parent.setItemChecked(position, true); viewWasSelectedWhileActive(initialSelection, position); } private void didFinish() { activeMode = null; parent.clearChoices(); // http://stackoverflow.com/questions/9754170/listview-selection-remains-persistent-after-exiting-choice-mode for (int i = 0; i < parent.getChildCount(); i++) parent.getChildAt(i).setActivated(false); parent.setChoiceMode(AbsListView.CHOICE_MODE_NONE); } private void removeSelectedTalks() { ArrayList<Long> removedItems = new ArrayList(); for (Long i : parent.getCheckedItemIds()) removedItems.add(i); store.removeTalks(removedItems); } public void viewWasSelectedWhileActive(View view, int position) { if (!isActive()) new AssertionError("Shouldn't be called while inactive"); if (parent.getCheckedItemCount() == 0) activeMode.finish(); } @Override public boolean onCreateActionMode(ActionMode mode, Menu menu) { mode.getMenuInflater().inflate(R.menu.menu_talk_cab, menu); return true; } @Override public boolean onPrepareActionMode(ActionMode mode, Menu menu) { return false; } @Override public boolean onActionItemClicked(ActionMode mode, MenuItem item) { if (item.getItemId() == R.id.action_remove_talk) removeSelectedTalks(); activeMode.finish(); return true; } @Override public void onDestroyActionMode(ActionMode mode) { didFinish(); } public boolean onItemLongClick(Toolbar toolbar, View view, int position, long id) { if (isActive()) return false; start(toolbar, view, position); return true; } } <file_sep>package es.flakiness.hiccup.play; import java.io.IOException; import rx.Observable; import rx.Subscription; import rx.functions.Action1; import rx.subscriptions.CompositeSubscription; public class GestureInterpreter implements Subscription { private final String TAG = getClass().getSimpleName(); final private Player player; final private int lastPosition; final private Seeker seeker; final private CompositeSubscription subscriptions = new CompositeSubscription(); public GestureInterpreter(Player player, int lastPosition) throws IOException { this.player = player; this.lastPosition = lastPosition; this.seeker = new Seeker(player); this.subscriptions.add(this.seeker); } public Seeker getSeeker() { return seeker; } private void hold() { if (player.getState().isHoldable()) { seeker.startSeeking(player.getProgress(), PlayerState.HOLDING); player.pause(); } } private void unholdIfHolding() { if (!seeker.isSeeking()) return; int nextPosition = seeker.endSeeking(); player.seekTo(nextPosition); player.start(); } private void flingBack() { if (player.getState() != PlayerState.PAUSING || seeker.isSeeking()) return; moveToHead(); } private void moveToHead() { if (seeker.isSeeking()) seeker.endSeeking(); player.seekTo(0); player.start(); } private void toggle() { player.toggle(); } private void pull(float gradient) { seeker.setGradient(gradient); } public void start() { player.start(); player.seekTo(lastPosition); player.start(); } public void connectTo(Observable<GestureEvent> gestures) { subscriptions.add(gestures.subscribe(new Action1<GestureEvent>() { @Override public void call(GestureEvent gestureEvent) { switch (gestureEvent.getType()) { case TAP: toggle(); break; case HOLD: hold(); break; case RELEASE: unholdIfHolding(); break; case PULL: pull(((PullEvent)gestureEvent).getDelta()); break; case FLING_BACK: flingBack(); break; case DOWN: case UP: break; } } })); } @Override public void unsubscribe() { subscriptions.unsubscribe(); } @Override public boolean isUnsubscribed() { return subscriptions.isUnsubscribed(); } }
329fdae314f49bb9cf50d2e0db817d896cfa1315
[ "Java", "Text", "Gradle" ]
21
Java
omo/hiccup
431b7dfa68ad1b885e1e2008fe699351a84bdf5b
d20d27c9e27f098a49687fc80039cf85d752e023
refs/heads/master
<file_sep>const fs = require('fs') const logger = fs.createWriteStream('user.log') //ke dade haro ba yekam takhir kam kam ezafe mikone process.stdin .setEncoding('utf-8') .on('data',data =>{ if(data.trim() == "exit") process.exit() //how to exit the programm if(data.trim() == "showall"){ //when you write showall you can get all saved datas fs.readFile('user.log', (error,data)=>{ console.log(data.toString()) }) } else{ //fs.appendFile('user.log', data, () =>{ // console.log('saved',data) //}) logger.write(data) } }) //process.on('exit', data => { process.exit('exit'); }); <file_sep>process.stdin .setEncoding('utf-8') .on('data', data => { process console.log('You typed:',data) })<file_sep># CSV Converter Schreib ein Programm, das [CSV](https://en.wikipedia.org/wiki/Comma-separated_values)-Dateien in JSON-Dateien konvertiert. Nutze dafür die [`csvtojson`](https://www.npmjs.com/package/csvtojson)-Bibliothek ## Anforderungen * Das Programm soll einen oder zwei Argumente annehmen können. Wenn keine Argumente angegeben wurden, soll das Programm sich beenden und eine Meldung ausgeben (siehe Beispiele). * Wenn nur ein Argument angegeben wird, soll das Programm die angegebene Datei in eine JSON-Datei im Selben Ordner konvertieren. * Wenn zwei Argumente angegeben wurden, soll die konvertierte Datei in den Ordner gelegt werden, der im zweiten Argument angegeben ist. * Wenn das programm die Datei nicht lesen oder speichern kann, soll eine Meldung für den Nutzer ausgegeben werden (siehe Beispiel). ## Beispiele ### One argument passed (Source CSV) ```bash $ node index.js demo.csv > "JSON file saved at: demo.json" ``` ### Zwei Argumente angegeben (CSV-Datei, JSON-Pfad) ```bash $ node index.js demo.csv hello.json > "JSON file saved at: hello.json" ``` ### Keine Argumente angegeben ```bash $ node index.js > "Please provide a csv file to convet to JSON" ``` ### Fehler ```bash $ node index.js dem.csv hello.json > "Something went wrong, Could not write json to: hello.json" ```
b9d208e0bfbcd18e515e3e377e98bf03d14c5a01
[ "JavaScript", "Markdown" ]
3
JavaScript
fbw9dus/csv-converter-ciamac-da
04409e6b452040056908df9f092cc5adf0b2e2dc
58b062e77d99b66c08ebd430c5adbf3fafe1aa21
refs/heads/master
<repo_name>lancejackson/noddit<file_sep>/routes/post.js var mongoose = require('mongoose'); var express = require('express'); var router = express.Router(); var Post = mongoose.model('Post'); router.route('/posts') .get((req, res, next) => { Post.find((err, posts) => { if (err)) return next(err); res.json(posts); }); }) .post((req, res, next) => { Post.create(req.body, (err, post) => { if (err) return next(err); res.json(post); }); }); router.route('/posts:/id') .get((req, res, next) => { Post.findById(req.params.id, (err, post) => { if (err) return next(err); res.json(post); }) }) .put((req, res, next) => { Post.findByIdAndUpdate(req.params.id, req.body, (err, post) => { if (err) return next(err); res.json(post); }); }) .delete((req, res, next) => { Post.findByIdAndRemove(req.params.id, (err, post) => { if (err) return next(err); res.json(post); }) }); module.exports = router;
94f80eae5b6ec881da75f6c0e7ad2b2fc69a5bbd
[ "JavaScript" ]
1
JavaScript
lancejackson/noddit
c95a57b7301e7512a2fdf7a3372b67ee09c6476d
4e14416bd065f11d7c8b4b7b86c5982c6eeb1ec4
refs/heads/main
<repo_name>mrdavidlaing/software-releases-dwh<file_sep>/tests/test_solids/test_github.py from dagster import execute_solid, configured from src.pipelines.settings_inmemory import inmemory_mode, inmemory_run_config from src.solids.github import fetch_github_releases def test_fetch_kubernetes_releases(): @configured(fetch_github_releases) def fetch_kubernetes_releases(_): return {'owner': 'kubernetes', "repo": "kubernetes"} res = execute_solid( fetch_github_releases, input_values={'owner_repo': "kubernetes/kubernetes"}, mode_def=inmemory_mode, run_config=inmemory_run_config ) assert res.success assert len(res.output_value('releases')) >= 3, "kubernetes/kubernetes should have 3 mocked releases" <file_sep>/tests/test_resources/test_datawarehouse.py import datetime import pandas from dagster import solid, pipeline, DagsterInstance, execute_pipeline from src.pipelines.settings_inmemory import inmemory_mode, inmemory_preset @solid(required_resource_keys={"datawarehouse"}) def add_releases_to_lake(context) -> datetime.date: df = pandas.DataFrame.from_dict({ 'product_id': ['KEY001', 'KEY2', 'KEY3'], 'version': ['1.0.0', '2.0.0', '3.0.0'], 'name': ['v1', 'v2', 'v3'], 'release_date': [datetime.date(2020, 1, 1), datetime.date(2020, 1, 2), datetime.date(2020, 1, 3)], 'link': ['http://example.org/1', 'http://example.org/2', 'http://example.org/3'] }) asset_key = "release" partition_date = datetime.date(2020, 2, 1) context.resources.datawarehouse.add_to_lake(df, asset_key, partition_date) return partition_date @solid(required_resource_keys={"datawarehouse"}) def fetch_releases_from_lake(context, partition_date): return context.resources.datawarehouse.execute_sql( "SELECT * FROM software_releases_lake.release WHERE at_date = ?", (partition_date,) ) @pipeline( mode_defs=[inmemory_mode], preset_defs=[inmemory_preset] ) def add_and_retrieve_pipeline(): fetch_releases_from_lake( partition_date=add_releases_to_lake() ) def test_fs_datalake_resource(): result = execute_pipeline( pipeline=add_and_retrieve_pipeline, preset="inmemory", instance=DagsterInstance.get(), ) assert result.success <file_sep>/dagster_instances/gcp-cloud-run-europe-west1/Dockerfile ARG BASE_IMAGE=python:3.7-slim FROM "${BASE_IMAGE}" ARG DAGSTER_VERSION=0.11.3 # ==> Dagster base layer RUN echo "==> Adding Dagster base layer" \ && apt-get update -yqq \ && apt-get install -yqq --no-install-recommends \ && pip install --no-cache-dir \ # Core dagster==${DAGSTER_VERSION} \ dagster-graphql==${DAGSTER_VERSION} \ dagit==${DAGSTER_VERSION} \ dagster-postgres==${DAGSTER_VERSION} \ # Cloud dagster-gcp==${DAGSTER_VERSION} \ # Other dagster-ge==${DAGSTER_VERSION} \ # Cleanup && echo "==> Total size BEFORE cleanup: $(du -sh --exclude=/proc /)" \ && echo "Removing: pycache files" && find / -regex '^.*\(__pycache__\|\.py[co]\)$' -delete \ && echo "Removing: apt cache" && rm -rf /var/lib/apt/lists/* \ && echo "==> Total size AFTER cleanup: $(du -sh --exclude=/proc /)" # Setup $DAGSTER_HOME ENV DAGSTER_HOME=/opt/dagster/dagster_home RUN mkdir -p $DAGSTER_HOME ADD dagster_instances/gcp-cloud-run-europe-west1/ $DAGSTER_HOME/ # ==> Add user code dependencies - in a separate layer to speed up future builds COPY tmp/requirements.txt / RUN pip install --no-cache-dir -r /requirements.txt \ # Cleanup && echo "==> Total size BEFORE cleanup: $(du -sh --exclude=/proc /)" \ && echo "Removing: pycache files" && find / -regex '^.*\(__pycache__\|\.py[co]\)$' -delete \ && echo "==> Total size AFTER cleanup: $(du -sh --exclude=/proc /)" # ==> Add user code ENV DAGSTER_WORKSPACE=/opt/dagster/workspace/ COPY . $DAGSTER_WORKSPACE WORKDIR $DAGSTER_WORKSPACE # ==> Starts a simple webserver on 8080 that executes pipelines via /execute_pipeline?pipeline=<pipline name> EXPOSE 8080 CMD python web_runner.py<file_sep>/src/pipelines/populate_dm.py from dagster import pipeline, solid from src.pipelines.settings_gcp import gcp_mode from src.pipelines.settings_local_fs import local_fs_mode @solid def update_dwh_table(_): pass @pipeline( mode_defs=[local_fs_mode, gcp_mode], ) def populate_dm_pipeline(): update_dwh_table() <file_sep>/src/pipelines/ingest.py from dagster import pipeline from src.pipelines.settings_gcp import gcp_mode, gcp_preset from src.pipelines.settings_inmemory import inmemory_mode, inmemory_preset from src.pipelines.settings_local_fs import local_fs_mode, local_fs_preset from src.solids.github import fetch_github_releases, fan_out_fetch_github_releases from src.solids.releases import add_releases_to_lake, validate_releases, join_releases @pipeline( mode_defs=[inmemory_mode, local_fs_mode, gcp_mode], preset_defs=[inmemory_preset, local_fs_preset, gcp_preset] ) def ingest_pipeline(): add_releases_to_lake( validate_releases( join_releases( fan_out_fetch_github_releases().map(fetch_github_releases).collect()) ) ) <file_sep>/src/resources/datawarehouse_fs.py import os from datetime import date from io import StringIO import pandas from dagster import resource, Field, StringSource from dagster_pandas import DataFrame from sqlalchemy import create_engine from sqlalchemy.pool import SingletonThreadPool from src.resources.datawarehouse import DatawarehouseInfo @resource( { "base_path": Field(StringSource), "datalake_schema": Field(StringSource), "datamart_schema": Field(StringSource), } ) def fs_datawarehouse_resource(init_context): _base_path = os.path.abspath(init_context.resource_config["base_path"]) _datalake_schema = init_context.resource_config["datalake_schema"] _datamart_schema = init_context.resource_config["datamart_schema"] _connection_initialised = False engine = create_engine('sqlite://', echo=True, poolclass=SingletonThreadPool) with engine.begin() as connection: if not _connection_initialised: engine.execute(f"ATTACH DATABASE 'file:{_base_path}/datalake.db' as {_datalake_schema};") engine.execute(f"ATTACH DATABASE 'file:{_base_path}/datamart.db' as {_datamart_schema};") _connection_initialised = True def _execute_sql(query: str, params: tuple = None): return pandas.read_sql_query(query, connection, params=params) def _do_add_to_lake(df: DataFrame, asset_type: str, at_date: date): df['at_date'] = at_date csv_filename = f"{asset_type}_{at_date.strftime('%Y-%m-%d')}.csv" csv_path = os.path.join(_base_path, csv_filename) df.to_csv(csv_path, index=False) connection.execute(f"DELETE FROM {_datalake_schema}.{asset_type} WHERE at_date=?", at_date) df.to_sql(asset_type, schema=_datalake_schema, con=connection, index=False, if_exists='append') return csv_path def _replace_partition(df: DataFrame, schema: str, table: str, at_date: date) -> str: df['at_date'] = at_date buffer = StringIO() df.to_csv(buffer, index=False, header=False) buffer.seek(0) fq_table_name = f"{schema}.{table}" connection.execute(f"DELETE FROM {fq_table_name} WHERE at_date=?", at_date) df.to_sql(table, schema=schema, con=connection, index=False, if_exists='append') return f"{fq_table_name} WHERE at_date={at_date}" yield DatawarehouseInfo( datalake_uri=f"file://{_base_path}", datalake_schema=_datalake_schema, datamart_schema=_datamart_schema, connection=connection, add_to_lake=_do_add_to_lake, replace_partition=_replace_partition, execute_sql=_execute_sql, ) <file_sep>/src/resources/datawarehouse_inmemory.py import os from contextlib import contextmanager from datetime import date from io import StringIO from pathlib import Path import pandas from alembic import command, config from dagster import resource, Field, StringSource from dagster_pandas import DataFrame from sqlalchemy import create_engine from sqlalchemy.pool import SingletonThreadPool from src.resources.datawarehouse import DatawarehouseInfo @contextmanager def pushd(path): prev = os.getcwd() os.chdir(path) try: yield finally: os.chdir(prev) def run_alembic_migration(connection, database_name, database_schema): with pushd(Path(__file__).resolve().parent.parent.parent): cfg = config.Config( 'alembic.ini', ini_section=database_name, cmd_opts=config.CommandLine().parser.parse_args([ # "-x", "include-seed-data=true", ]), ) cfg.attributes['connection'] = connection.execution_options(schema_translate_map={None: database_schema}) connection.dialect.default_schema_name = database_name command.upgrade(cfg, "head") @resource( { "datalake_schema": Field(StringSource), "datamart_schema": Field(StringSource), } ) def inmemory_datawarehouse_resource(init_context): _datalake_schema = init_context.resource_config["datalake_schema"] _datamart_schema = init_context.resource_config["datamart_schema"] _connection_initialised = False engine = create_engine('sqlite://', echo=True, poolclass=SingletonThreadPool) with engine.begin() as connection: if not _connection_initialised: engine.execute(f"ATTACH DATABASE 'file:inmemory_datalake?mode=memory' as {_datalake_schema};") engine.execute(f"ATTACH DATABASE 'file:inmemory_datamart?mode=memory' as {_datamart_schema};") run_alembic_migration(connection, "datalake", _datalake_schema) run_alembic_migration(connection, "datamart", _datamart_schema) _connection_initialised = True def _execute_sql(query: str, params: tuple = None): return pandas.read_sql_query(query, connection, params=params) def _do_add_to_lake(df: DataFrame, asset_type: str, at_date: date): df['at_date'] = at_date csv_path = f"/not/storing/at/base_path/{asset_type}_{at_date.strftime('%Y-%m-%d')}.csv" connection.execute(f"DELETE FROM {_datalake_schema}.{asset_type} WHERE at_date=?", at_date) df.to_sql(asset_type, schema=_datalake_schema, con=connection, index=False, if_exists='append') return csv_path def _replace_partition(df: DataFrame, schema: str, table: str, at_date: date) -> str: df['at_date'] = at_date buffer = StringIO() df.to_csv(buffer, index=False, header=False) buffer.seek(0) fq_table_name = f"{schema}.{table}" connection.execute(f"DELETE FROM {fq_table_name} WHERE at_date=?", at_date) df.to_sql(table, schema=schema, con=connection, index=False, if_exists='append') return f"{fq_table_name} WHERE at_date={at_date}" yield DatawarehouseInfo( datalake_uri=f":inmemory:", datalake_schema=_datalake_schema, datamart_schema=_datamart_schema, connection=connection, add_to_lake=_do_add_to_lake, replace_partition=_replace_partition, execute_sql=_execute_sql, ) <file_sep>/Pipfile [[source]] url = "https://pypi.org/simple" verify_ssl = true name = "pypi" [packages] importlib-metadata = "~=2.1.1" typing-extensions = "*" dagster = ">=0.11.3" dagster-graphql = ">=0.11.3" dagit = ">=0.11.3" dagster-pandas = ">=0.11.3" dagster-postgres = ">=0.11.3" dagster-gcp = ">=0.11.3" dagster-ge = ">=0.11.3" great-expectations = "== 0.13.16" alembic = ">=1.5.8" sqlalchemy = ">=1.4.4" ghapi = ">=0.1.16" jupyter = "*" ipykernel = "*" [dev-packages] pytest = "*" pylint = "*" [requires] python_version = "3.7" [scripts] tests = "pipenv run pytest tests/" create_requirements_txt = 'pipenv lock --requirements > requirements.txt' build_docker_image = 'pipenv run create_requirements_txt && docker build' <file_sep>/dagster_instances/gcp_eu-west1/scripts/connect_to_dagit.sh #!/usr/bin/env bash # Enable xtrace if the DEBUG environment variable is set if [[ ${DEBUG-} =~ ^1|yes|true$ ]]; then set -o xtrace # Trace the execution of the script (debug) fi # A better class of script... set -o errexit # Exit on most errors (see the manual) set -o errtrace # Make sure any error trap is inherited set -o nounset # Disallow expansion of unset variables set -o pipefail # Use last non-zero exit code in a pipeline # DESC: Usage help # ARGS: None # OUTS: None function script_usage() { cat << EOF Port forwards to current Dagit instance running on europe_belgium k8s cluster Dependencies: gcloud, kubectl Usage: -h|--help Displays this help -v|--verbose Displays verbose output -nc|--no-colour Disables colour output -cr|--cron Run silently unless we encounter an error EOF } # DESC: Parameter parser # ARGS: $@ (optional): Arguments provided to the script # OUTS: Variables indicating command-line parameters and options function parse_params() { local param while [[ $# -gt 0 ]]; do param="$1" shift case $param in -h | --help) script_usage exit 0 ;; -v | --verbose) verbose=true ;; -nc | --no-colour) no_colour=true ;; -cr | --cron) cron=true ;; *) script_exit "Invalid parameter was provided: $param" 1 ;; esac done } function target_europe_belgium_k8s_cluster(){ pretty_print "====> Setting KUBECONFIG to target GCP:europe-belgium k8s cluster" "$ta_bold" export KUBECONFIG="$script_dir/../secrets/europe-belgium.kubeconfig.yaml" gcloud container clusters get-credentials europe-belgium --zone europe-west1-d --project mrdavidlaing } function port_forward_to_dagit() { pretty_print "====> Port forwarding to dagit" "$ta_bold" export DAGIT_POD_NAME=$(kubectl get pods --namespace dagster -l "app.kubernetes.io/name=dagster,app.kubernetes.io/instance=dagster,component=dagit" -o jsonpath="{.items[0].metadata.name}") kubectl --namespace dagster port-forward $DAGIT_POD_NAME 8080:80 } # DESC: Main control flow # ARGS: $@ (optional): Arguments provided to the script # OUTS: None function main() { source "$(dirname "${BASH_SOURCE[0]}")/ralish_bash-script-template.sh" trap script_trap_err ERR trap script_trap_exit EXIT script_init "$@" parse_params "$@" cron_init colour_init check_binary gcloud "halt-if-not-exists" check_binary kubectl "halt-if-not-exists" target_europe_belgium_k8s_cluster port_forward_to_dagit } # Make it rain main "$@" <file_sep>/web_runner.py import os from dagster import DagsterInstance, execute_pipeline, reconstructable from flask import Flask, request, abort, Response, stream_with_context from src.pipelines.ingest import ingest_pipeline app = Flask(__name__) def execute_ingest_pipeline(): yield 'Starting to execute ingest_pipeline...' try: dagster_inst = DagsterInstance.get() result = execute_pipeline( pipeline=reconstructable(ingest_pipeline), preset="gcp", instance=dagster_inst, ) assert result.success yield 'Done!' except Exception as e: yield 'Failed:' yield str(e) @app.route('/execute_pipeline') def run_pipelines(): if request.args.get('pipeline') == "ingest_pipeline": return Response(stream_with_context(execute_ingest_pipeline())) else: abort(403) if __name__ == '__main__': app.run(host='0.0.0.0', port=os.environ.get('PORT', 8080)) <file_sep>/schema/datamart/versions/d33565242602_create_releases_table.py """create releases table Revision ID: d33565242602 Revises: Create Date: 2021-03-29 14:58:07.095744 """ import logging from alembic import op import sqlalchemy as sa from alembic import context import pandas as pd from pathlib import Path # revision identifiers, used by Alembic. revision = 'd33565242602' down_revision = None branch_labels = None depends_on = None logger = logging.getLogger(f"alembic.{Path(__file__).name}") def upgrade(): op.create_table( 'release', sa.Column('at_date', sa.Date(), nullable=False), sa.Column('product_id', sa.String(50), nullable=False), sa.Column('version', sa.String(10), nullable=False), sa.Column('name', sa.String(10)), sa.Column('release_date', sa.Date(), nullable=False), sa.Column('link', sa.String(255), nullable=False), ) if context.get_x_argument(as_dictionary=True).get('include-seed-data', None): csv_path = Path(__file__).resolve().parent.parent.joinpath('sample_data/releases.csv') logger.info(f"Importing data from {csv_path}") df_releases = pd.read_csv(csv_path) df_releases.to_sql('release', con=op.get_bind(), index=False, if_exists='replace') def downgrade(): op.drop_table('release') <file_sep>/dagster_instances/gcp_eu-west1/Dockerfile ARG BASE_IMAGE=python:3.7-slim FROM "${BASE_IMAGE}" ARG DAGSTER_VERSION=0.10.0 # ==> Add Dagster layer RUN \ # Dagster pip install \ dagster==${DAGSTER_VERSION} \ dagster-postgres==${DAGSTER_VERSION} \ dagster-celery[flower,kubernetes]==${DAGSTER_VERSION} \ dagster-k8s==${DAGSTER_VERSION} \ dagster-celery-k8s==${DAGSTER_VERSION} \ # Cleanup && rm -rf /var/lib/apt/lists/ \ && rm -rf /root/.cache \ && rm -rf /usr/lib/python2.7 \ && rm -rf /usr/lib/x86_64-linux-gnu/guile \ && find / -regex '^.*\(__pycache__\|\.py[co]\)$' -delete # ==> Add user code dependencies - in a separate layer to speed up future builds COPY Pipfile* / RUN pip install pipenv \ && cd / && pipenv lock --requirements > requirements.txt \ && pip install -r /requirements.txt \ # Cleanup && rm -rf /root/.cache \ && find / -regex '^.*\(__pycache__\|\.py[co]\)$' -delete # ==> Add user code COPY . /dagster_workspace WORKDIR /dagster_workspace<file_sep>/src/pipelines/settings_gcp.py from os.path import abspath from dagster import ModeDefinition, default_executors, PresetDefinition, file_relative_path from dagster_gcp import gcs_resource from dagster_gcp.gcs import gcs_plus_default_intermediate_storage_defs, gcs_pickle_io_manager from dagster_ge.factory import ge_data_context from src.resources.datawarehouse_gcp import gcp_datawarehouse_resource from src.resources.github import github_resource gcp_mode = ModeDefinition( name="gcp", intermediate_storage_defs=gcs_plus_default_intermediate_storage_defs, resource_defs={ "datawarehouse": gcp_datawarehouse_resource, "github": github_resource, "ge_data_context": ge_data_context, 'gcs': gcs_resource, 'io_manager': gcs_pickle_io_manager }, executor_defs=default_executors, ) gcp_preset = PresetDefinition( name="gcp", mode="gcp", run_config={ "resources": { "io_manager": { "config": { "gcs_bucket": "software_releases_datalake", "gcs_prefix": "dagster-job" } }, "datawarehouse": { "config": { "project": "mrdavidlaing", "bucket": "software_releases_datalake", "datalake_schema": "software_releases_lake", "datamart_schema": "software_releases_dm" } }, "github": { "config": { "github_access_token": {"env": "GITHUB_TOKEN"} } }, "ge_data_context": { "config": { "ge_root_dir": abspath(file_relative_path(__file__, "../great_expectations")) } } }, "solids": { "fan_out_fetch_github_releases": { "config": { "repos": [ "kubernetes/kubernetes", "dagster-io/dagster", "knative/serving", "knative/eventing", "cloudfoundry/cf-deployment", "cloudfoundry/cf-for-k8s", "etcd-io/etcd", "docker/engine", ] } } }, "execution": {"multiprocess": {"config": {"max_concurrent": 0}}}, # 0 -> Autodetect #CPU cores "loggers": {"console": {"config": {"log_level": "INFO"}}}, }, )<file_sep>/bin/recreate_local_datawarehouse #!/usr/bin/env bash # Enable xtrace if the DEBUG environment variable is set if [[ ${DEBUG-} =~ ^1|yes|true$ ]]; then set -o xtrace # Trace the execution of the script (debug) fi # A better class of script... set -o errexit # Exit on most errors (see the manual) set -o errtrace # Make sure any error trap is inherited set -o nounset # Disallow expansion of unset variables set -o pipefail # Use last non-zero exit code in a pipeline # DESC: Usage help # ARGS: None # OUTS: None function script_usage() { cat << EOF Recreates local datalake Dependencies: pipenv Usage: -sdl|--skip-datalake Skips re-building datalake -sdm|--skip-datamart Skips re-building datamart -h|--help Displays this help -v|--verbose Displays verbose output -nc|--no-colour Disables colour output EOF } # DESC: Parameter parser # ARGS: $@ (optional): Arguments provided to the script # OUTS: Variables indicating command-line parameters and options function parse_params() { local param while [[ $# -gt 0 ]]; do param="$1" shift case $param in -sdl | --skip-datalake) skip_datalake=true ;; -sdm | --skip-datamart) skip_datamart=true ;; -h | --help) script_usage exit 0 ;; -v | --verbose) verbose=true ;; -nc | --no-colour) no_colour=true ;; *) script_exit "Invalid parameter was provided: $param" 1 ;; esac done } # DESC: Main control flow # ARGS: $@ (optional): Arguments provided to the script # OUTS: None function main() { source "$(dirname "${BASH_SOURCE[0]}")/ralish_bash-script-template.sh" trap script_trap_err ERR trap script_trap_exit EXIT script_init "$@" parse_params "$@" cron_init colour_init check_binary pipenv "halt-if-not-exists" export PIPENV_VERBOSITY=-1 if [[ -z ${skip_datalake-} ]]; then # If skip_datalake NOT set pretty_print "====> Recreating local datalake..." "$ta_bold" pipenv run alembic --name datalake downgrade base pipenv run alembic --name datalake -x include-seed-data=true upgrade head pretty_print " => datalake recreated successfully" "$fg_green" fi if [[ -z "${skip_datamart-}" ]]; then # If skip_datamart NOT set pretty_print "====> Recreating local datamart..." "$ta_bold" pipenv run alembic --name datamart downgrade base pipenv run alembic --name datamart -x include-seed-data=true upgrade head pretty_print " => datamart recreated successfully" "$fg_green" fi } # Make it rain main "$@" <file_sep>/src/solids/releases.py from datetime import datetime, timezone import pandas from dagster import solid, OutputDefinition, String, AssetMaterialization, EventMetadataEntry, Output, \ InputDefinition, Dict, composite_solid, List, AssetKey, Any from dagster_ge import ge_validation_solid_factory from dagster_pandas import create_dagster_pandas_dataframe_type, PandasColumn def compute_releases_dataframe_summary_statistics(dataframe): return [ EventMetadataEntry.md(dataframe.head(5).to_markdown(), "head(5)"), EventMetadataEntry.int(len(dataframe), "n_rows"), EventMetadataEntry.text(str(dataframe.columns), "columns"), ] ReleasesDataFrame = create_dagster_pandas_dataframe_type( name="ReleasesDataFrame", columns=[ PandasColumn.string_column("product_id", non_nullable=True, is_required=True), PandasColumn.string_column("version", non_nullable=True, is_required=True), PandasColumn.string_column("name", non_nullable=True, is_required=True), PandasColumn.datetime_column("release_date", non_nullable=True, is_required=True), PandasColumn.string_column("link", non_nullable=True, is_required=True), ], event_metadata_fn=compute_releases_dataframe_summary_statistics, ) @solid() def join_releases(_, release_list: List[ReleasesDataFrame]) -> ReleasesDataFrame: return pandas.concat(release_list) @solid( description="Persists releases to database (overwriting any existing data)", input_defs=[ InputDefinition( name="releases", dagster_type=ReleasesDataFrame, description="Releases to persist") ], output_defs=[OutputDefinition(name="asset_path", dagster_type=String)], required_resource_keys={"datawarehouse"}, tags={"kind": "add_to_lake"}, ) def add_releases_to_lake(context, releases): datalake_uri = context.resources.datawarehouse.datalake_uri at_date = datetime.now(timezone.utc).date() asset_path = context.resources.datawarehouse.add_to_lake(releases, "release", at_date) yield AssetMaterialization( asset_key=AssetKey([datalake_uri, "release"]), metadata_entries=[ EventMetadataEntry.text(datalake_uri, "datalake_uri"), EventMetadataEntry.text("release", "asset_type"), EventMetadataEntry.text(at_date.strftime("%Y-%m-%d"), "partition_key"), EventMetadataEntry.text(asset_path, "asset_path"), EventMetadataEntry.int(releases.shape[0], "n_rows"), EventMetadataEntry.md(releases.head(5).to_markdown(), "head(5)"), ], ) yield Output(value=asset_path, output_name="asset_path") ge_releases_validation = ge_validation_solid_factory( name="validate_releases_expectations", datasource_name="dagster_datasource", suite_name="software_releases_lake.releases", validation_operator_name="action_list_operator", input_dagster_type=ReleasesDataFrame, ) @solid( tags={"kind": "raise_on_failure"}, ) def raise_on_failure(_, releases: ReleasesDataFrame, expectation_result: Dict) -> ReleasesDataFrame: if expectation_result["success"]: return releases else: raise ValueError @composite_solid() def validate_releases(releases: ReleasesDataFrame) -> ReleasesDataFrame: return raise_on_failure(releases, ge_releases_validation(releases)) @solid() def make_asset(_) -> List[Any]: yield AssetMaterialization( asset_key=AssetKey(["datalake", "my_asset"]), metadata_entries=[ EventMetadataEntry.path("file:///path/to/file.csv", "path_key", "This is the description"), EventMetadataEntry.text("text value", "text_key", "This is the description"), EventMetadataEntry.int(42, "int_key", description="This is the description"), EventMetadataEntry.float(42.123, "float_key"), EventMetadataEntry.url("https://somewhere.com", "url_key"), EventMetadataEntry.md(pandas.DataFrame(data={'col1': [1, 2], 'col2': [3, 4]}).to_markdown(), "pandas.to_markdown"), EventMetadataEntry.md(""" ### Some markdown | Item | Value | |----------------------------------:|----------:| | Pomodoros done | 0 | | Hours in meetings / Hours worked | 0/0 | """, "markdown_key"), EventMetadataEntry.md(""" ### Some MarkDown with HTML <table><thead><tr><th>HTML header</th><th>Value</th></tr></thead><tbody><tr><td>Pomodoros done</td><td>0</td></tr><tr><td>Hours in meetings / Hours worked</td><td>0/0</td></tr></tbody></table> """, "html_key"), EventMetadataEntry.json({'key': 'value'}, 'json_key'), EventMetadataEntry.md(""" # Live demo Changes are automatically rendered as you type. * Implements [GitHub Flavored Markdown](https://github.github.com/gfm/) * Renders actual, "native" React DOM elements * Allows you to escape or skip HTML (try toggling the checkboxes above) * If you escape or skip the HTML, no `dangerouslySetInnerHTML` is used! Yay! ## Table of Contents ## HTML block below <blockquote> This blockquote will change based on the HTML settings above. </blockquote> ## How about some code? ```js var React = require('react'); var Markdown = require('react-markdown'); React.render( <Markdown source="# Your markdown here" />, document.getElementById('content') ); ``` Pretty neat, eh? ## Tables? Use [`remark-gfm`](https://github.com/remarkjs/react-markdown#use) to support tables, strikethrough, tasklists, and literal URLs. These features **do not work by default**. | Feature | Support | | :-------: | ------- | | tables | `remark-gfm` | ~~strikethrough~~ - [ ] task list https://example.com ## More info? Read usage information and more on [GitHub](https://github.com/remarkjs/react-markdown) --------------- A component by [<NAME>](https://espen.codes/)""", "react-markdown-key"), ], ) yield Output(value=['element1', 'element2'], output_name="result") <file_sep>/README.md # software-releases-dwh [Dagster](https://dagster.io) powered data pipelines that populate a data warehouse of software release information. ![Dagster: ingest pipeline](https://user-images.githubusercontent.com/227505/102804874-44a78100-43b2-11eb-84dd-36a987c64f20.png) <file_sep>/tests/test_pipelines/test_ingest.py from dagster import DagsterInstance, execute_pipeline, reconstructable from src.pipelines.ingest import ingest_pipeline def test_ingest_pipeline_e2e(): result = execute_pipeline( pipeline=reconstructable(ingest_pipeline), preset="inmemory", instance=DagsterInstance.get(), ) assert result.success <file_sep>/schema/datalake/versions/6e1090262f0a_add_release.py """add release Revision ID: 6e1090262f0a Revises: Create Date: 2021-04-02 11:29:40.051831 """ import logging import re from pathlib import Path from alembic import op, context import sqlalchemy as sa import pandas as pd logger = logging.getLogger(f"alembic.{Path(__file__).name}") # revision identifiers, used by Alembic. revision = '6e1090262f0a' down_revision = None branch_labels = None depends_on = None datalake_fs_location = Path(context.config.get_main_option("datalake_fs_location")) def upgrade(): op.create_table( 'release', sa.Column('at_date', sa.Date(), nullable=False), sa.Column('product_id', sa.String(50), nullable=False), sa.Column('version', sa.String(10), nullable=False), sa.Column('name', sa.String(10)), sa.Column('release_date', sa.Date(), nullable=False), sa.Column('link', sa.String(255), nullable=False), ) if context.get_x_argument(as_dictionary=True).get('include-seed-data', None): sample_data = Path(__file__).resolve().parent.parent.joinpath('sample_data/').glob("*.csv") for csv_path in sample_data: logger.info(f"Importing data from {csv_path}") datalake_fs_location.joinpath(csv_path.name).symlink_to(csv_path) df_releases = pd.read_csv(csv_path) df_releases['at_date'] = re.search(r"_(\d+\-\d+\-\d+)\.", csv_path.name).group(1) df_releases.to_sql('release', con=op.get_bind(), index=False, if_exists='append') def downgrade(): for csv_path in datalake_fs_location.glob("*.csv"): csv_path.unlink() op.drop_table('release') <file_sep>/src/pipelines/settings_local_fs.py from os.path import abspath from pathlib import Path from dagster import ModeDefinition, fs_io_manager, PresetDefinition, file_relative_path from dagster_ge.factory import ge_data_context from src.resources.datawarehouse_fs import fs_datawarehouse_resource from src.resources.github import github_resource local_fs_mode = ModeDefinition( name="local_fs", resource_defs={ "datawarehouse": fs_datawarehouse_resource, "github": github_resource, "ge_data_context": ge_data_context, 'io_manager': fs_io_manager }, ) local_fs_preset = PresetDefinition( name="local_fs", mode="local_fs", run_config={ "resources": { "datawarehouse": { "config": { "base_path": abspath(file_relative_path(__file__, '../../tmp/datawarehouse')), "datalake_schema": "software_releases_lake", "datamart_schema": "software_releases_dm" } }, "github": { "config": { "github_access_token": {"env": "GITHUB_TOKEN"} } }, "ge_data_context": { "config": { "ge_root_dir": abspath(file_relative_path(__file__, "../great_expectations")) } } }, "solids": { "fan_out_fetch_github_releases": { "config": { "repos": [ "kubernetes/kubernetes", "dagster-io/dagster", "knative/serving", ] } } }, "execution": {"multiprocess": {"config": {"max_concurrent": 0}}}, # 0 -> Autodetect #CPU cores "loggers": {"console": {"config": {"log_level": "INFO"}}}, }, )<file_sep>/bin/launch_dagit #!/usr/bin/env bash # Enable xtrace if the DEBUG environment variable is set if [[ ${DEBUG-} =~ ^1|yes|true$ ]]; then set -o xtrace # Trace the execution of the script (debug) fi # A better class of script... set -o errexit # Exit on most errors (see the manual) set -o errtrace # Make sure any error trap is inherited set -o nounset # Disallow expansion of unset variables set -o pipefail # Use last non-zero exit code in a pipeline # DESC: Usage help # ARGS: None # OUTS: None function script_usage() { cat << EOF Recreates local datalake Dependencies: pipenv Usage: --local (default) Local ephemeral instance of Dagit (useful during development) --gcp Local Dagit instance pointing at GCP datastores -h|--help Displays this help -v|--verbose Displays verbose output -nc|--no-colour Disables colour output EOF } # DESC: Parameter parser # ARGS: $@ (optional): Arguments provided to the script # OUTS: Variables indicating command-line parameters and options function parse_params() { local param while [[ $# -gt 0 ]]; do param="$1" shift case $param in --gcp) launch_gcp=true ;; -h | --help) script_usage exit 0 ;; -v | --verbose) verbose=true ;; -nc | --no-colour) no_colour=true ;; *) script_exit "Invalid parameter was provided: $param" 1 ;; esac done } # DESC: Main control flow # ARGS: $@ (optional): Arguments provided to the script # OUTS: None function main() { source "$(dirname "${BASH_SOURCE[0]}")/ralish_bash-script-template.sh" trap script_trap_err ERR trap script_trap_exit EXIT script_init "$@" parse_params "$@" cron_init colour_init check_binary pipenv "halt-if-not-exists" base_dir="$(resolve_dir "$script_dir/../")" export PIPENV_VERBOSITY=-1 if [[ -n ${launch_gcp-} ]]; then export DAGSTER_HOME="${base_dir}/dagster_instances/gcp-cloud-run-europe-west1" pretty_print "====> Launching Dagit backed by GCP datasources (DAGSTER_HOME=${DAGSTER_HOME})" "$ta_bold" pipenv run dagit -p 8080 -w "${base_dir}/workspace.yaml" else pretty_print "====> Launching emphemeral Dagit instance" "$ta_bold" pipenv run dagit -p 3000 -w "${base_dir}/workspace.yaml" fi } # Make it rain main "$@" <file_sep>/tests/test_solids/test_releases.py from datetime import datetime, timezone import pandas from dagster import execute_solid from src.pipelines.settings_inmemory import inmemory_mode, inmemory_run_config from src.solids.releases import add_releases_to_lake def test_add_releases_to_lake(): sample_releases = pandas.DataFrame.from_dict({ 'product_id': ['knative/serving', 'knative/serving', 'knative/serving'], 'version': ['1.0.0', '1.0.1', '1.1.0'], 'name': ['v1', 'v1 patch 1', 'v1.1'], 'release_date': [datetime(2020, 1, 2), datetime(2020, 1, 17), datetime(2020, 2, 28)], 'link': ['https://github.com/knative/serving/releases/1.0.0', 'https://github.com/knative/serving/releases/1.0.1', 'https://github.com/knative/serving/releases/1.1.0'], }) result = execute_solid( add_releases_to_lake, input_values={'releases': sample_releases}, mode_def=inmemory_mode, run_config=inmemory_run_config, ) assert result.success today = datetime.now(timezone.utc).strftime("%Y-%m-%d") assert f'release_{today}.csv' in result.output_value('asset_path') <file_sep>/src/pipelines/settings_inmemory.py from os.path import abspath from dagster import ModeDefinition, mem_io_manager, file_relative_path, PresetDefinition from dagster_ge.factory import ge_data_context from src.resources.datawarehouse_inmemory import inmemory_datawarehouse_resource from src.resources.github import inmemory_github_resource inmemory_mode = ModeDefinition( name="inmemory", resource_defs={ "datawarehouse": inmemory_datawarehouse_resource, "github": inmemory_github_resource, "ge_data_context": ge_data_context, 'io_manager': mem_io_manager }, ) inmemory_run_config = { "resources": { "datawarehouse": { "config": { "datalake_schema": "software_releases_lake", "datamart_schema": "software_releases_dm" } }, "ge_data_context": { "config": { "ge_root_dir": abspath(file_relative_path(__file__, "../great_expectations")) } }, }, "execution": {"in_process": {"config": {"retries": {"disabled": None}}}}, "loggers": {"console": {"config": {"log_level": "INFO"}}}, } inmemory_preset = PresetDefinition( name="inmemory", mode="inmemory", run_config=inmemory_run_config, )<file_sep>/src/solids/github.py import re import pandas from dagster import solid, Field, OutputDefinition, Output, InputDefinition from dagster.core.definitions import DynamicOutput from dagster.core.definitions.output import DynamicOutputDefinition from src.solids.releases import ReleasesDataFrame @solid( config_schema={"repos": Field([str], default_value=['kubernetes/kubernetes', 'dagster-io/dagster'])}, output_defs=[DynamicOutputDefinition(str)], tags={"kind": "github_releases"}, ) def fan_out_fetch_github_releases(context): repos = context.solid_config["repos"] for repo in repos: yield DynamicOutput(value=repo, mapping_key=re.sub(r'[-/.]', '_', repo)) @solid( input_defs=[ InputDefinition(name="owner_repo", dagster_type=str, description="github.com/<owner/repo>"), ], required_resource_keys={"github"}, output_defs=[OutputDefinition(name="releases", dagster_type=ReleasesDataFrame)], tags={"kind": "github_releases"}, ) def fetch_github_releases(context, owner_repo: str): owner, repo = owner_repo.split("/") releases = context.resources.github.get_releases(owner, repo) releases_df = pandas.DataFrame.from_records(releases, columns=[ 'tag_name', 'name', 'published_at', 'html_url', 'draft' ]).rename(columns={ 'tag_name': 'version', 'published_at': 'release_date', 'html_url': 'link' }) # Ignore DRAFT releases (which don't yet have a release date) releases_df = releases_df.drop(releases_df[releases_df['draft'] == True].index).drop(columns=['draft']) releases_df.insert(0, 'product_id', f"{owner}/{repo}") # Derive product_id and make it the first column releases_df.release_date = pandas.to_datetime(releases_df.release_date, infer_datetime_format=True) yield Output(releases_df, output_name="releases")<file_sep>/src/repository.py from dagster import repository from src.pipelines.ingest import ingest_pipeline from src.pipelines.populate_dm import populate_dm_pipeline from src.pipelines.asset_experimentation import asset_experimentation @repository def software_releases_repository(): """ The repository definition for this newp Dagster repository. For hints on building your Dagster repository, see our documentation overview on Repositories: https://docs.dagster.io/overview/repositories-workspaces/repositories """ pipelines = [ingest_pipeline, populate_dm_pipeline, asset_experimentation] schedules = [] # [my_hourly_schedule] sensors = [] # [my_sensor] return pipelines + schedules + sensors <file_sep>/src/pipelines/asset_experimentation.py from dagster import pipeline from src.pipelines.settings_inmemory import inmemory_mode, inmemory_preset from src.pipelines.settings_local_fs import local_fs_mode, local_fs_preset from src.solids.releases import make_asset @pipeline( mode_defs=[inmemory_mode, local_fs_mode], preset_defs=[inmemory_preset, local_fs_preset] ) def asset_experimentation(): make_asset()<file_sep>/dagster_instances/gcp_eu-west1/scripts/update_dagster_deployment.sh #!/usr/bin/env bash # Enable xtrace if the DEBUG environment variable is set if [[ ${DEBUG-} =~ ^1|yes|true$ ]]; then set -o xtrace # Trace the execution of the script (debug) fi # A better class of script... set -o errexit # Exit on most errors (see the manual) set -o errtrace # Make sure any error trap is inherited set -o nounset # Disallow expansion of unset variables set -o pipefail # Use last non-zero exit code in a pipeline # DESC: Usage help # ARGS: None # OUTS: None function script_usage() { cat << EOF Builds & updates docker container being used to run Dagster deployment europe_belgium k8s cluster Dependencies: gcloud, kubectl, helm, docker Usage: -sb|--skip-build Skips building & pushing a new version of the Dagster container -h|--help Displays this help -v|--verbose Displays verbose output -nc|--no-colour Disables colour output -cr|--cron Run silently unless we encounter an error EOF } # DESC: Parameter parser # ARGS: $@ (optional): Arguments provided to the script # OUTS: Variables indicating command-line parameters and options function parse_params() { local param while [[ $# -gt 0 ]]; do param="$1" shift case $param in -sb | --skip-build) skip_build=true ;; -h | --help) script_usage exit 0 ;; -v | --verbose) verbose=true ;; -nc | --no-colour) no_colour=true ;; -cr | --cron) cron=true ;; *) script_exit "Invalid parameter was provided: $param" 1 ;; esac done } function build_and_push_container() { cal_version=$(date +'%Y-%m-%d.%s') pretty_print "====> Building & pushing new image: eu.gcr.io/mrdavidlaing/software-releases-dwh-dagster:$cal_version" "$ta_bold" pushd $(realpath "$script_dir/../../../") docker build -f "$script_dir/../Dockerfile" . \ --tag eu.gcr.io/mrdavidlaing/software-releases-dwh-dagster:$cal_version \ --tag eu.gcr.io/mrdavidlaing/software-releases-dwh-dagster:latest popd docker push eu.gcr.io/mrdavidlaing/software-releases-dwh-dagster:$cal_version docker push eu.gcr.io/mrdavidlaing/software-releases-dwh-dagster:latest } function target_europe_belgium_k8s_cluster(){ pretty_print "====> Setting KUBECONFIG to target GCP:europe-belgium k8s cluster" "$ta_bold" export KUBECONFIG="$script_dir/../secrets/europe-belgium.kubeconfig.yaml" gcloud container clusters get-credentials europe-belgium --zone europe-west1-d --project mrdavidlaing } function update_helm_deployment() { if [ -z "${skip_build-}" ]; then # If skip_build NOT set pretty_print "====> Updating helm deployment: dagster (new image tag=$cal_version)" "$ta_bold" helm upgrade --namespace dagster --install dagster dagster/dagster -f "$script_dir/../helm_values.yaml" \ --set userDeployments.deployments[0].image.tag="$cal_version" \ --wait else pretty_print "====> Updating helm deployment: dagster" "$ta_bold" helm upgrade --namespace dagster --install dagster dagster/dagster -f "$script_dir/../helm_values.yaml" \ --wait fi } # DESC: Main control flow # ARGS: $@ (optional): Arguments provided to the script # OUTS: None function main() { source "$(dirname "${BASH_SOURCE[0]}")/ralish_bash-script-template.sh" trap script_trap_err ERR trap script_trap_exit EXIT script_init "$@" parse_params "$@" cron_init colour_init check_binary gcloud "halt-if-not-exists" check_binary docker "halt-if-not-exists" check_binary kubectl "halt-if-not-exists" check_binary helm "halt-if-not-exists" if [ -z "${skip_build-}" ]; then # If skip_build NOT set build_and_push_container fi target_europe_belgium_k8s_cluster update_helm_deployment pretty_print "====> Completed successfully" "$ta_bold" pretty_print "Use $script_dir/connect_to_dagit.sh to open connection to Dagit" } # Make it rain main "$@" <file_sep>/bin/update_gcp_cloudrun_deployment.sh #!/usr/bin/env bash # Enable xtrace if the DEBUG environment variable is set if [[ ${DEBUG-} =~ ^1|yes|true$ ]]; then set -o xtrace # Trace the execution of the script (debug) fi # A better class of script... set -o errexit # Exit on most errors (see the manual) set -o errtrace # Make sure any error trap is inherited set -o nounset # Disallow expansion of unset variables set -o pipefail # Use last non-zero exit code in a pipeline # DESC: Usage help # ARGS: None # OUTS: None function script_usage() { cat << EOF Builds & updates docker container being used to run Dagster Cloud Run deployment Dependencies: gcloud, docker Usage: -sb|--skip-build Skips building & pushing a new version of the Dagster container -h|--help Displays this help -v|--verbose Displays verbose output -nc|--no-colour Disables colour output -cr|--cron Run silently unless we encounter an error EOF } # DESC: Parameter parser # ARGS: $@ (optional): Arguments provided to the script # OUTS: Variables indicating command-line parameters and options function parse_params() { local param while [[ $# -gt 0 ]]; do param="$1" shift case $param in -sb | --skip-build) skip_build=true ;; -h | --help) script_usage exit 0 ;; -v | --verbose) verbose=true ;; -nc | --no-colour) no_colour=true ;; -cr | --cron) cron=true ;; *) script_exit "Invalid parameter was provided: $param" 1 ;; esac done } function build_and_push_container() { cal_version=$(date +'%Y-%m-%d.%s') pretty_print "====> Building & pushing new image: eu.gcr.io/mrdavidlaing/software-releases-dwh-dagster-cloudrun:$cal_version" "$ta_bold" pushd $(realpath "$script_dir/../") PIPENV_VERBOSITY=-1 pipenv lock --requirements > tmp/requirements.txt docker build -f "dagster_instances/gcp-cloud-run-europe-west1/Dockerfile" . \ --tag eu.gcr.io/mrdavidlaing/software-releases-dwh-dagster-cloudrun:$cal_version \ --tag eu.gcr.io/mrdavidlaing/software-releases-dwh-dagster-cloudrun:latest popd docker push eu.gcr.io/mrdavidlaing/software-releases-dwh-dagster-cloudrun:$cal_version docker push eu.gcr.io/mrdavidlaing/software-releases-dwh-dagster-cloudrun:latest } # DESC: Main control flow # ARGS: $@ (optional): Arguments provided to the script # OUTS: None function main() { source "$(dirname "${BASH_SOURCE[0]}")/ralish_bash-script-template.sh" trap script_trap_err ERR trap script_trap_exit EXIT script_init "$@" parse_params "$@" cron_init colour_init check_binary gcloud "halt-if-not-exists" check_binary docker "halt-if-not-exists" if [ -z "${skip_build-}" ]; then # If skip_build NOT set build_and_push_container fi pretty_print "====> Updating GCP Cloud Run deployment..." "$ta_bold" gcloud --project mrdavidlaing run deploy software-releases-dwh-dagster \ --region europe-west1 --platform managed --image eu.gcr.io/mrdavidlaing/software-releases-dwh-dagster-cloudrun:latest pretty_print "====> Done!" "$ta_bold" } # Make it rain main "$@" <file_sep>/dagster_instances/gcp_eu-west1/README.md ## Identity and credentials * Solids need access to a Google Service Account with write permissions for: * [gs://software_releases_datalake](https://console.cloud.google.com/storage/browser/software_releases_datalake) - need `Storage Admin` * [bigquery://mrdavidlaing:software_releases_dwh](https://console.cloud.google.com/bigquery?authuser=2&project=mrdavidlaing&supportedpurview=project&p=mrdavidlaing&d=software_releases_dwh&page=dataset) - need `BigQuery Data Editor` role * [bigquery](https://console.cloud.google.com/bigquery?authuser=2&project=mrdavidlaing&supportedpurview=project&p=mrdavidlaing&d=software_releases_datalake&page=dataset) - need `BigQuery Data Editor` role * A course grained way to achieve this is set the Node VM's default service account to one with the correct permissions (eg: `<EMAIL>`); which will then be inherited by any pods running on that node. Enable this by setting the Node Pool's [instance group's template](https://console.cloud.google.com/compute/instanceGroups/list?project=mrdavidlaing) to use: * Service Account: `<EMAIL>` * Cloud API access scopes: `Allow full access to all Cloud APIs` To enable the GKE nodes to send metrics & logginng data to Stackdriver; this account also needs: * `Monitoring Metric Writer` * `Logs Writer` * `Stackdriver Resource Metadata Writer` * Additional secrets needed by solids can be passed via k8s secrets (which will be exposed as env: vars in the containers executing the solids) ``` kubectl --namespace dagster create secret generic software-releases-dwh-secrets --from-literal=GITHUB_TOKEN='<PASSWORD>' ``` * Pull these into job execution container via run config: `execution.celery-k8s-config.env-secrets=[software-releases-dwh-secrets]` <file_sep>/src/resources/datawarehouse.py from collections import namedtuple DatawarehouseInfo = namedtuple( "DatawarehouseInfo", "datalake_uri datalake_schema datamart_schema connection execute_sql add_to_lake replace_partition" ) <file_sep>/src/resources/datawarehouse_gcp.py from datetime import datetime from dagster import resource, Field, StringSource from dagster_pandas import DataFrame from google.cloud import storage from src.resources.datawarehouse import DatawarehouseInfo @resource( { "project": Field(StringSource, description="Project ID for the project which the client acts on behalf of"), "bucket": Field(StringSource), "datalake_schema": Field(StringSource), "datamart_schema": Field(StringSource), } ) def gcp_datawarehouse_resource(init_context): client = storage.Client() bucket = client.get_bucket(init_context.resource_config["bucket"]) def _execute_sql(query: str, params: tuple = None): raise NotImplemented() # return pandas.read_sql_query(query, _dwh.connection, params=params) def _do_add_to_lake(df: DataFrame, asset_type: str, partition_key: str): csv_filename = f"{asset_type}/partition_key={partition_key}/{asset_type}_{partition_key}.csv" bucket.blob(csv_filename).upload_from_string(df.to_csv(index=False), 'text/csv') return f"gs://{bucket.name}/{csv_filename}" def _replace_partition(df: DataFrame, schema: str, table: str, at_date: datetime) -> str: raise NotImplemented() # df['at_date'] = at_date # # buffer = StringIO() # df.to_csv(buffer, index=False, header=False) # buffer.seek(0) # # fq_table_name = f"{schema}.{table}" # _dwh.connection.execute(f"DELETE FROM {fq_table_name} WHERE at_date=%s", at_date) # df.to_sql(fq_table_name, con=_dwh.connection, index=False, if_exists='append') # return f"{fq_table_name} WHERE at_date={at_date}" # TODO: init gcp connection connection = None yield DatawarehouseInfo( datalake_uri=f"gs://{bucket.name}", datalake_schema=init_context.resource_config["datalake_schema"], datamart_schema=init_context.resource_config["datamart_schema"], connection=connection, add_to_lake=_do_add_to_lake, replace_partition=_replace_partition, execute_sql=_execute_sql, ) <file_sep>/src/resources/github.py from collections import namedtuple import ghapi from dagster import resource, Field, StringSource from ghapi.core import GhApi from ghapi.page import pages GithubInfo = namedtuple( "GithubInfo", "get_releases" ) @resource() def inmemory_github_resource(context): def _get_releases(owner: str, repo: str): releases = [ {'tag_name': '1.0.0', 'name': 'v1', 'published_at': "2021-02-28T18:00:01Z", 'html_url':f"https://github.com/{owner}/{repo}/releases/tag/1.0.0", 'draft': False}, {'tag_name': '1.0.1', 'name': 'v1 patch 1', 'published_at': "2021-03-02T11:45:02Z", 'html_url': f"https://github.com/{owner}/{repo}/releases/tag/1.0.1", 'draft': False}, {'tag_name': '1.1.0', 'name': 'v1.1', 'published_at': "2021-03-10T14:00:03Z", 'html_url': f"https://github.com/{owner}/{repo}/releases/tag/1.1.0", 'draft': False}, ] context.log.info( f"Generated {len(releases)} mock releases for GitHub project: {owner}/{repo}" ) return releases yield GithubInfo( get_releases=_get_releases ) @resource( { "github_access_token": Field(StringSource) } ) def github_resource(context): _api = GhApi(token=context.resource_config["github_access_token"]) def _get_releases(owner: str, repo: str): try: releases = _api.repos.list_releases(owner, repo, per_page=100) total_api_requests = 1 if _api.last_page() > 0: total_api_requests += _api.last_page() releases = pages(_api.repos.list_releases, _api.last_page(), owner, repo, per_page=100).concat() context.log.info( f"Retrieved {len(releases)} releases for GitHub project: {owner}/{repo}" f" ({total_api_requests} API request(s) made, quota remaining: {_api.limit_rem})" ) return releases except ghapi.core.HTTP4xxClientError as http_error: if 'rate limit exceeded' in http_error.fp.reason.lower(): raise ConnectionRefusedError( f"Insufficient GitHub API call quota remaining to fetch releases for GitHub project: {owner}/{repo}.\n" f"https://docs.github.com/en/free-pro-team@latest/rest/overview/resources-in-the-rest-api#rate-limiting" ) else: raise http_error yield GithubInfo( get_releases=_get_releases )
07dfbe44433fbdf00ad8c7075338d2d7725003d5
[ "TOML", "Markdown", "Python", "Dockerfile", "Shell" ]
31
Python
mrdavidlaing/software-releases-dwh
74bcfaff75e98363fd958c86025480036d8cb489
bb27cecb63b32f293d7511f5a24facb86bd77194
refs/heads/main
<file_sep>import React from 'react'; const QuotationDetails = props => { return ( <div> <h3>About View</h3> <p> This is the about view of SPA</p> </div> ); }; export default QuotationDetails;<file_sep>import React from 'react'; import QuotationTable from '../../components/Quotation/QuotationTable'; const QuotationDetails = () => ( <div> <QuotationTable /> </div> ); export default QuotationDetails; <file_sep>export { default as QuotationDetails } from './QuotationDetails';<file_sep>import firebase from 'firebase/app'; import 'firebase/auth'; // for authentication import 'firebase/firestore'; // for cloud firestore import 'firebase/storage'; // for storage // import 'firebase/database'; // for realtime database // import 'firebase/messaging'; // for cloud messaging // import 'firebase/functions'; // for cloud functions const config = { apiKey: process.env.REACT_APP_API_KEY, authDomain: process.env.REACT_APP_AUTH_DOMAIN, projectId: process.env.REACT_APP_PROJECT_ID, storageBucket: process.env.REACT_APP_STORAGE_BUCKET, messagingSenderId: process.env.REACT_APP_SENDER_ID, appId: process.env.REACT_APP_APP_ID, }; firebase.initializeApp(config); export const { auth } = firebase; export const firestore = firebase.firestore(); // export const storage = firebase.storage().ref(); // export const db = firebase.database(); <file_sep>import quotation from './Quotation'; export default quotation;<file_sep>import * as React from 'react'; import { DataGrid, GridOverlay, GridToolbarContainer, GridFilterToolbarButton, GridColumnsToolbarButton, GridToolbarExport, } from '@material-ui/data-grid'; import Typography from '@material-ui/core/Typography'; import Box from '@material-ui/core/Box'; import Grid from '@material-ui/core/Grid'; import Button from '@material-ui/core/Button'; import DeleteIcon from '@material-ui/icons/Delete'; import CheckIcon from '@material-ui/icons/Check'; import InfoIcon from '@material-ui/icons/Info'; import ClearIcon from '@material-ui/icons/Clear'; import { makeStyles } from '@material-ui/core/styles'; import Modal from '@material-ui/core/Modal'; import Table from '@material-ui/core/Table'; import TableBody from '@material-ui/core/TableBody'; import TableRow from '@material-ui/core/TableRow'; import TableCell from '@material-ui/core/TableCell'; import Snackbar from '@material-ui/core/Snackbar'; import MuiAlert from '@material-ui/lab/Alert'; import TextField from '@material-ui/core/TextField'; const columns = [ { field: 'id', headerName: 'ID', flex: 0.8 }, { field: 'submissionName', headerName: 'Submission Name', flex: 3 }, { field: 'quotationAmount', headerName: 'Amount (S$)', type: 'number', flex: 1.2, }, { field: 'lastUpdated', headerName: 'Last Updated', type: 'dateTime', flex: 1, }, { field: 'dateAdded', headerName: 'Date Added', type: 'dateTime', flex: 1, }, { field: 'submittedBy', headerName: 'Submitted By', flex: 1 }, { field: 'status', headerName: 'Status', flex: 0.7 }, ]; function Alert(props) { return <MuiAlert elevation={6} variant="filled" {...props} />; } const rows = [ { id: 'Q00000001', submissionName: 'CommIT Technical Team Bonding', quotationAmount: 200, lastUpdated: '02/03/2021 16:04:07', dateAdded: '02/03/2021 16:04:07', submittedBy: '<NAME>', status: 'Approved', }, { id: 'Q00000002', submissionName: 'CommIT Technical Team Bonding', quotationAmount: 200, lastUpdated: '02/03/2021 16:04:07', dateAdded: '02/03/2021 16:04:07', submittedBy: '<NAME>', status: 'Approved', }, { id: 'Q00000003', submissionName: 'CommIT Technical Team Bonding', quotationAmount: 200, lastUpdated: '02/03/2021 16:04:07', dateAdded: '02/03/2021 16:04:07', submittedBy: '<NAME>', status: 'Approved', }, { id: 'Q00000004', submissionName: 'CommIT Technical Team Bonding', quotationAmount: 200, lastUpdated: '02/03/2021 16:04:07', dateAdded: '02/03/2021 16:04:07', submittedBy: '<NAME>', status: 'Approved', }, { id: 'Q00000005', submissionName: 'CommIT Technical Team Bonding', quotationAmount: 200, lastUpdated: '02/03/2021 16:04:07', dateAdded: '02/03/2021 16:04:07', submittedBy: '<NAME>', status: 'Approved', }, { id: 'Q00000006', submissionName: 'CommIT Technical Team Bonding', quotationAmount: 200, lastUpdated: '02/03/2021 16:04:07', dateAdded: '02/03/2021 16:04:07', submittedBy: '<NAME>', status: 'Approved', }, { id: 'Q00000007', submissionName: 'CommIT Technical Team Bonding', quotationAmount: 200, lastUpdated: '02/03/2021 16:04:07', dateAdded: '02/03/2021 16:04:07', submittedBy: '<NAME>', status: 'Approved', }, { id: 'Q00000008', submissionName: 'CommIT Technical Team Bonding', quotationAmount: 200, lastUpdated: '02/03/2021 16:04:07', dateAdded: '02/03/2021 16:04:07', submittedBy: '<NAME>', status: 'Approved', }, { id: 'Q00000009', submissionName: 'CommIT Technical Team Bonding', quotationAmount: 200, lastUpdated: '02/03/2021 16:04:07', dateAdded: '02/03/2021 16:04:07', submittedBy: '<NAME>', status: 'Approved', }, { id: 'Q00000010', submissionName: 'CommIT Technical Team Bonding', quotationAmount: 200, lastUpdated: '02/03/2021 16:04:07', dateAdded: '02/03/2021 16:04:07', submittedBy: '<NAME>', status: 'Approved', }, ]; const useStyles = makeStyles((theme) => ({ root: { flexDirection: 'column', '& .ant-empty-img-1': { fill: theme.palette.type === 'light' ? '#aeb8c2' : '#262626', }, '& .ant-empty-img-2': { fill: theme.palette.type === 'light' ? '#f5f5f7' : '#595959', }, '& .ant-empty-img-3': { fill: theme.palette.type === 'light' ? '#dce0e6' : '#434343', }, '& .ant-empty-img-4': { fill: theme.palette.type === 'light' ? '#fff' : '#1c1c1c', }, '& .ant-empty-img-5': { fillOpacity: theme.palette.type === 'light' ? '0.8' : '0.08', fill: theme.palette.type === 'light' ? '#f5f5f5' : '#fff', }, }, label: { marginTop: theme.spacing(1), }, paper: { position: 'absolute', width: 600, height: 400, backgroundColor: theme.palette.background.paper, border: '2px solid #000', boxShadow: theme.shadows[5], padding: theme.spacing(2, 4, 3), }, textField: { marginLeft: theme.spacing(1), marginRight: theme.spacing(1), width: '25ch', }, })); function CustomNoRowsOverlay() { const classes = useStyles(); return ( <GridOverlay className={classes.root}> <svg width="120" height="100" viewBox="0 0 184 152" aria-hidden focusable="false" > <g fill="none" fillRule="evenodd"> <g transform="translate(24 31.67)"> <ellipse className="ant-empty-img-5" cx="67.797" cy="106.89" rx="67.797" ry="12.668" /> <path className="ant-empty-img-1" d="M122.034 69.674L98.109 40.229c-1.148-1.386-2.826-2.225-4.593-2.225h-51.44c-1.766 0-3.444.839-4.592 2.225L13.56 69.674v15.383h108.475V69.674z" /> <path className="ant-empty-img-2" d="M33.83 0h67.933a4 4 0 0 1 4 4v93.344a4 4 0 0 1-4 4H33.83a4 4 0 0 1-4-4V4a4 4 0 0 1 4-4z" /> <path className="ant-empty-img-3" d="M42.678 9.953h50.237a2 2 0 0 1 2 2V36.91a2 2 0 0 1-2 2H42.678a2 2 0 0 1-2-2V11.953a2 2 0 0 1 2-2zM42.94 49.767h49.713a2.262 2.262 0 1 1 0 4.524H42.94a2.262 2.262 0 0 1 0-4.524zM42.94 61.53h49.713a2.262 2.262 0 1 1 0 4.525H42.94a2.262 2.262 0 0 1 0-4.525zM121.813 105.032c-.775 3.071-3.497 5.36-6.735 5.36H20.515c-3.238 0-5.96-2.29-6.734-5.36a7.309 7.309 0 0 1-.222-1.79V69.675h26.318c2.907 0 5.25 2.448 5.25 5.42v.04c0 2.971 2.37 5.37 5.277 5.37h34.785c2.907 0 5.277-2.421 5.277-5.393V75.1c0-2.972 2.343-5.426 5.25-5.426h26.318v33.569c0 .617-.077 1.216-.221 1.789z" /> </g> <path className="ant-empty-img-3" d="M149.121 33.292l-6.83 2.65a1 1 0 0 1-1.317-1.23l1.937-6.207c-2.589-2.944-4.109-6.534-4.109-10.408C138.802 8.102 148.92 0 161.402 0 173.881 0 184 8.102 184 18.097c0 9.995-10.118 18.097-22.599 18.097-4.528 0-8.744-1.066-12.28-2.902z" /> <g className="ant-empty-img-4" transform="translate(149.65 15.383)"> <ellipse cx="20.654" cy="3.167" rx="2.849" ry="2.815" /> <path d="M5.698 5.63H0L2.898.704zM9.259.704h4.985V5.63H9.259z" /> </g> </g> </svg> <div className={classes.label}>No Record</div> </GridOverlay> ); } function CustomToolbar() { return ( <GridToolbarContainer> <GridColumnsToolbarButton /> <GridFilterToolbarButton /> <GridToolbarExport /> <div style={{ position: 'absolute', right: '10px', top: '5px' }}> <Button variant="contained" color="secondary" startIcon={<DeleteIcon />} > Delete </Button> </div> </GridToolbarContainer> ); } function getModalStyle() { const top = 50; const left = 50; return { top: `${top}%`, left: `${left}%`, transform: `translate(-${top}%, -${left}%)`, }; } export default function QuotationTable() { const classes = useStyles(); const [modalStyle] = React.useState(getModalStyle); const [open, setOpen] = React.useState(false); const [openSuccessSnackBar, setOpenSuccessSnackBar] = React.useState(false); const [openRejectionSnackBar, setOpenRejectionSnackBar] = React.useState(false); const [body, setBody] = React.useState( <div style={modalStyle} className={classes.paper}> <h2 id="simple-modal-title">Text in a modal</h2> <p id="simple-modal-description"> Duis mollis, est non commodo luctus, nisi erat porttitor ligula. </p> </div>, ); const handleOpen = (e) => { setBody( <div style={modalStyle} className={classes.paper}> <h2 id="simple-modal-title" style={{ float: 'left' }}>{e.row.id}</h2> <Button style={{ float: 'right', marginTop: '15px' }} variant="contained" color="default" startIcon={<InfoIcon />} onClick={(f) => handleViewMoreClick(f, e.row.id)} > View More </Button> <Table> <TableBody> <TableRow> <TableCell component="th" scope="row"> Quotation Name </TableCell> <TableCell style={{ width: 160 }} align="left"> {e.row.submissionName} </TableCell> </TableRow> <TableRow> <TableCell component="th" scope="row"> Quotation Amount </TableCell> <TableCell style={{ width: 320 }} align="left"> {e.row.quotationAmount} </TableCell> </TableRow> <TableRow> <TableCell component="th" scope="row"> Submitted By </TableCell> <TableCell style={{ width: 320 }} align="left"> {e.row.submittedBy} </TableCell> </TableRow> </TableBody> </Table> <div style={{ marginTop: '50px' }}> <TextField id="outlined-full-width" label="Remarks" style={{ margin: 8 }} placeholder="Enter your remarks here..." fullWidth margin="normal" InputLabelProps={{ shrink: true, }} variant="outlined" /> </div> <div style={{ position: 'absolute', right: '155px', bottom: '5px' }}> <Button variant="contained" color="secondary" startIcon={<ClearIcon />} onClick={handleRejectionSnackBarClick} > Reject </Button> </div> <div style={{ position: 'absolute', right: '25px', bottom: '5px' }}> <Button variant="contained" color="primary" startIcon={<CheckIcon />} onClick={handleSuccessSnackBarClick} > Approve </Button> </div> </div>, ); setOpen(true); }; const handleClose = () => { setOpen(false); }; const handleSuccessSnackBarClick = () => { setOpen(false); setOpenSuccessSnackBar(true); }; const handleSuccessSnackBarClose = (event, reason) => { if (reason === 'clickaway') { return; } setOpenSuccessSnackBar(false); }; const handleRejectionSnackBarClick = () => { setOpen(false); setOpenRejectionSnackBar(true); }; const handleRejectionSnackBarClose = (event, reason) => { if (reason === 'clickaway') { return; } setOpenRejectionSnackBar(false); }; const handleViewMoreClick = (e, value) => { console.log(value); window.open(`/quotation/details/${value}`, '_blank'); }; return ( <div> <div style={{ marginLeft: 15, marginRight: 15, marginTop: 10, marginBottom: 10, }} > <Grid container> <Grid item xs={12} sm={12} container zeroMinWidth> <Typography component="div"> <Box fontSize={32} fontWeight="fontWeightBold" m={1}> Quotation Submissions </Box> </Typography> <div style={{ height: 460, width: '100%' }}> <DataGrid rows={rows} columns={columns} pageSize={5} checkboxSelection onRowClick={handleOpen} components={{ NoRowsOverlay: CustomNoRowsOverlay, Toolbar: CustomToolbar, }} /> </div> </Grid> </Grid> </div> <div> <Modal open={open} onClose={handleClose} aria-labelledby="simple-modal-title" aria-describedby="simple-modal-description" > {body} </Modal> </div> <div> <Snackbar open={openRejectionSnackBar} autoHideDuration={6000} onClose={handleRejectionSnackBarClose}> <Alert onClose={handleRejectionSnackBarClose} severity="error"> Quotation Rejected </Alert> </Snackbar> <Snackbar open={openSuccessSnackBar} autoHideDuration={6000} onClose={handleSuccessSnackBarClose}> <Alert onClose={handleSuccessSnackBarClose} severity="success"> Quotation Approved! </Alert> </Snackbar> </div> </div> ); } <file_sep>import React, { Component } from 'react'; import Container from '@material-ui/core/Container'; import ActionButtonGroup from '../../components/Submission/ActionButtonGroup/' import SubmissionFormGroup from '../../components/Submission' function SubmissionPage() { return ( <Container maxWidth='lg'> <h1>Submission</h1> <ActionButtonGroup/> <SubmissionFormGroup/> </Container> ); } class Submission extends Component { constructor(props) { super(props); this.state = {}; } componentDidMount() {} render() { return <SubmissionPage />; } } export default Submission; <file_sep>import { auth, firestore } from './firebase'; export const signup = (email, password, name) => auth() .createUserWithEmailAndPassword(email, password) .then((registeredUser) => { firestore.collection('users') .doc(registeredUser.user.uid) .set({ uid: registeredUser.user.uid, name, rooms: [], }); }); export const signin = (email, password) => auth().signInWithEmailAndPassword(email, password); export const signout = () => auth().signOut();
75bdd3e54ce3a925daefe295aff33e1208fdad56
[ "JavaScript" ]
8
JavaScript
NicholasCF/finsec
4a70c43832ffcc57ac4c291f49507dd8e073a6f6
da196caec87f1fc572265bb1975390c80136e8ad
refs/heads/master
<file_sep><?php namespace GW2Spidy; use \Exception; use GW2Spidy\Util\CacheHandler; use GW2Spidy\Util\CurlRequest; use GW2Spidy\DB\ItemSubType; use GW2Spidy\DB\ItemType; class TradeMarket { const LISTING_TYPE_SELL = 'sells'; const LISTING_TYPE_BUY = 'buys'; protected static $instance; protected $cache; protected $loggedIn = false; public function __construct() { $this->cache = CacheHandler::getInstance('TradeMarket'); } public function __destruct() { $this->doLogout(); } public static function getInstance() { if (is_null(self::$instance)) { self::$instance = new self(); } return self::$instance; } public function ensureLogin() { if (!$this->loggedIn) { $this->loggedIn = $this->doLogin(); } } public function doLogin() { $curl = CurlRequest::newInstance(AUTH_URL . "/login") ->setOption(CURLOPT_POST, true) ->setOption(CURLOPT_POSTFIELDS, http_build_query(array('email' => LOGIN_EMAIL, 'password' => <PASSWORD>))) ->exec() ; if ($sid = $curl->getResponseCookies('s')) { $loginURL = TRADINGPOST_URL . "/authenticate"; $loginURL .= "?account_name=". urlencode("Guild Wars 2"); $loginURL .= "&session_key={$sid}"; $curl = CurlRequest::newInstance($loginURL) ->exec(); } else { throw new Exception("Login request failed, no SID."); } if($curl->getInfo('http_code') >= 400) { throw new Exception("Login request failed with HTTP code {$curl->getInfo('http_code')}!"); } return true; } public function doLogout() { try { $curl = CurlRequest::newInstance(AUTH_URL . "/logout") ->exec() ; } catch (Exception $e) { // no1 cares } } public function getItemByExactName($name) { $this->ensureLogin(); $curl = CurlRequest::newInstance(TRADINGPOST_URL . " /ws/search.json?text=".urlencode($name)."&levelmin=0&levelmax=80") ->exec() ; $data = json_decode($curl->getResponseBody(), true); foreach ($data['results'] as $item) { if ($item['name'] == $name) { return $item; } } return null; } public function getListingsById($id, $type = self::LISTING_TYPE_SELL) { $this->ensureLogin(); // for now we can query for 'all' and get both sell and buy in the return // should it stop working like that we can just query for what we want $queryType = 'all'; $cacheKey = "listings::{$id}"; if (!($listings = $this->cache->get($cacheKey))) { $curl = CurlRequest::newInstance(TRADINGPOST_URL . "/ws/listings.json?id={$id}&type={$queryType}") ->exec() ; $data = json_decode($curl->getResponseBody(), true); if (!isset($data['listings']) || !isset($data['listings'][$type])) { throw new Exception("Failed to retrieve proper listingsdata from the request result"); } $listings = $data['listings'][$type]; $this->cache->set($cacheKey, $listings, MEMCACHE_COMPRESSED, 10); } return $listings; } public function getMarketData() { $this->ensureLogin(); $curl = CurlRequest::newInstance(TRADINGPOST_URL) ->exec() ; $result = $curl->getResponseBody(); if (preg_match("/<script>[\n ]+GW2\.market = (\{.*?\})[\n ]+<\/script>/ms", $result, $matches)) { $json = json_decode($matches[1], true); return $json['data']; } else { throw new Exception("Failed to extract GW2.market JSON from HTML"); } } public function getItemList($type=null, $subType=null, $offset=0) { $this->ensureLogin(); $typeId = ($type instanceof ItemType) ? $type->getId() : $type; $subTypeId = ($subType instanceof ItemSubType) ? $subType->getId() : $subType; $url = TRADINGPOST_URL . "/ws/search.json?text=&levelmin=0&levelmax=80&offset={$offset}"; if ($typeId !== null) { $url = "{$url}&type={$typeId}"; } if ($subTypeId !== null) { $url = "{$url}&subtype={$subTypeId}"; } $curl = CurlRequest::newInstance($url) ->exec() ; if($curl->getInfo('http_code') >= 400) { throw new Exception("getItemList request failed with HTTP code {$curl->getInfo('http_code')}!"); } $result = $curl->getResponseBody(); $json = json_decode($result, true); if (isset($json['results']) && $json['results']) { return $json['results']; } else { return false; } } } ?> <file_sep><?php /** * using Silex micro framework * this file contains all routing and the 'controllers' using lambda functions */ use GW2Spidy\Twig\ItemListRoutingExtension; use GW2Spidy\Twig\GW2MoneyExtension; use GW2Spidy\DB\ItemQuery; use GW2Spidy\DB\ItemTypeQuery; use GW2Spidy\DB\SellListingQuery; use GW2Spidy\DB\WorkerQueueItemQuery; use GW2Spidy\DB\ItemPeer; use GW2Spidy\DB\BuyListingPeer; use GW2Spidy\DB\SellListingPeer; use GW2Spidy\DB\BuyListingQuery; use Symfony\Component\HttpKernel\HttpKernelInterface; use Symfony\Component\HttpFoundation\Request; use GW2Spidy\Application; use GW2Spidy\Twig\VersionedAssetsRoutingExtension; use GW2Spidy\ItemHistory; use GW2Spidy\Queue\RequestSlotManager; use GW2Spidy\Queue\WorkerQueueManager; require dirname(__FILE__) . '/../config/config.inc.php'; require dirname(__FILE__) . '/../autoload.php'; @session_start(); // initiate the application, check config to enable debug / sql logging when needed $app = Application::getInstance(); $app->isSQLLogMode() && $app->enableSQLLogging(); $app->isDevMode() && $app['debug'] = true; /* * register providers */ $app->register(new Silex\Provider\UrlGeneratorServiceProvider()); $app->register(new Silex\Provider\TwigServiceProvider(), array( 'twig.path' => dirname(__FILE__) . '/../templates', 'twig.options' => array( 'cache' => dirname(__FILE__) . '/../tmp/twig-cache', ), )); /* * register custom extensions */ $app['twig']->addExtension(new VersionedAssetsRoutingExtension()); $app['twig']->addExtension(new GW2MoneyExtension()); $app['twig']->addExtension(new ItemListRoutingExtension($app['url_generator'])); /** * lambda used to convert URL arguments * * @param mixed $val * @return int */ $toInt = function($val) { return (int) $val; }; /** * generic function used for /search and /type * * @param Application $app * @param Request $request * @param ItemQuery $q * @param int $page * @param int $itemsperpage * @param array $tplVars */ function item_list(Application $app, Request $request, ItemQuery $q, $page, $itemsperpage, array $tplVars = array()) { $sortByOptions = array('name', 'rarity', 'restriction_level', 'min_sale_unit_price', 'max_offer_unit_price'); foreach ($sortByOptions as $sortByOption) { if ($request->get("sort_{$sortByOption}", null)) { $sortOrder = $request->get("sort_{$sortByOption}", 'asc'); $sortBy = $sortByOption; } } $sortBy = isset($sortBy) && in_array($sortBy, $sortByOptions) ? $sortBy : 'name'; $sortOrder = isset($sortOrder) && in_array($sortOrder, array('asc', 'desc')) ? $sortOrder : 'asc'; $count = $q->count(); if ($count > 0) { $lastpage = ceil($count / $itemsperpage); if ($page > $lastpage) { $page = $lastpage; } } else { $page = 1; $lastpage = 1; } $q->offset($itemsperpage * ($page-1)) ->limit($itemsperpage); if ($sortOrder == 'asc') { $q->addAscendingOrderByColumn($sortBy); } else if ($sortOrder == 'desc') { $q->addDescendingOrderByColumn($sortBy); } $items = $q->find(); return $app['twig']->render('item_list.html.twig', $tplVars + array( 'page' => $page, 'lastpage' => $lastpage, 'items' => $items, 'current_sort' => $sortBy, 'current_sort_order' => $sortOrder, )); }; /** * ---------------------- * route / * ---------------------- */ $app->get("/", function() use($app) { // workaround for now to set active menu item, all others are 'browse' as active $app->setHomeActive(); // get copper ore as featured item $featured = ItemQuery::create()->findPk(19697); return $app['twig']->render('index.html.twig', array( 'featured' => $featured, )); }) ->bind('homepage'); /** * ---------------------- * route /types * ---------------------- */ $app->get("/types", function() use($app) { $types = ItemTypeQuery::getAllTypes(); return $app['twig']->render('types.html.twig', array( 'types' => $types, )); }) ->bind('types'); /** * ---------------------- * route /type * ---------------------- */ $app->get("/type/{type}/{subtype}/{page}", function(Request $request, $type, $subtype, $page) use($app) { $page = $page > 0 ? $page : 1; $q = ItemQuery::create(); if (!is_null($type)) { $q->filterByItemTypeId($type); } if (!is_null($subtype)) { $q->filterByItemSubTypeId($subtype); } // use generic function to render return item_list($app, $request, $q, $page, 50, array('type' => $type, 'subtype' => $subtype)); }) ->assert('type', '\d+') ->assert('subtype', '\d+') ->assert('page', '-?\d+') ->convert('type', $toInt) ->convert('subtype', $toInt) ->convert('page', $toInt) ->value('type', null) ->value('subtype', null) ->value('page', 1) ->bind('type'); /** * ---------------------- * route /item * ---------------------- */ $app->get("/item/{dataId}", function($dataId) use ($app) { $item = ItemQuery::create()->findPK($dataId); if (!$item) { return $app->abort(404, "Page does not exist."); } // add item to the history stored in session ItemHistory::getInstance()->addItem($item); return $app['twig']->render('item.html.twig', array( 'item' => $item, )); }) ->assert('dataId', '\d+') ->convert('dataId', $toInt) ->bind('item'); /** * ---------------------- * route /chart * ---------------------- */ $app->get("/chart/{dataId}", function($dataId) use ($app) { $item = ItemQuery::create()->findPK($dataId); if (!$item) { return $app->abort(404, "Page does not exist."); } $chart = array(); /*---------------- * SELL LISTINGS *----------------*/ $chart[] = array( 'data' => SellListingQuery::getChartDatasetDataForItem($item), 'label' => "Sell Listings", ); /*--------------- * BUY LISTINGS *---------------*/ $chart[] = array( 'data' => BuyListingQuery::getChartDatasetDataForItem($item), 'label' => "Buy Listings", ); $wrap = false; $content = json_encode($chart); return $content; }) ->assert('dataId', '\d+') ->convert('dataId', $toInt) ->bind('chart'); /** * ---------------------- * route /status * ---------------------- */ $app->get("/status", function() use($app) { ob_start(); echo "there are [[ " . RequestSlotManager::getInstance()->getLength() . " ]] available slots right now \n"; echo "there are still [[ " . WorkerQueueManager::getInstance()->getLength() . " ]] items in the queue \n"; $content = ob_get_clean(); return $app['twig']->render('status.html.twig', array( 'dump' => $content, )); }) ->bind('status'); /** * ---------------------- * route /search POST * ---------------------- */ $app->post("/search", function (Request $request) use ($app) { // redirect to the GET with the search in the URL return $app->redirect($app['url_generator']->generate('search', array('search' => $request->get('search')))); }) ->bind('searchpost'); /** * ---------------------- * route /search GET * ---------------------- */ $app->get("/search/{search}/{page}", function(Request $request, $search, $page) use($app) { if (!$search) { return $app->handle(Request::create("/searchform", 'GET'), HttpKernelInterface::SUB_REQUEST); } $page = $page > 0 ? $page : 1; $q = ItemQuery::create(); $q->filterByName("%{$search}%"); // use generic function to render return item_list($app, $request, $q, $page, 25, array('search' => $search)); }) ->assert('search', '[^/]*') ->assert('page', '-?\d+') ->convert('page', $toInt) ->convert('search', function($search) { return urldecode($search); }) ->value('search', null) ->value('page', 1) ->bind('search'); /** * ---------------------- * route /searchform * ---------------------- */ $app->get("/searchform", function() use($app) { return $app['twig']->render('search.html.twig', array()); }) ->bind('searchform'); /** * ---------------------- * route /api * ---------------------- */ $app->get("/api/{format}/{secret}", function($format, $secret) use($app) { // check if the secret is in the configured allowed api_secrets if (!(isset($GLOBALS['api_secrets']) && in_array($secret, $GLOBALS['api_secrets'])) && !$app['debug']) { return $app->redirect("/"); } Propel::disableInstancePooling(); $items = ItemQuery::create()->find(); if ($format == 'csv') { header('Content-type: text/csv'); header('Content-disposition: attachment; filename=item_data_' . date('Ymd-His') . '.csv'); ob_start(); echo implode(",", ItemPeer::getFieldNames(BasePeer::TYPE_FIELDNAME)) . "\n"; foreach ($items as $item) { echo implode(",", $item->toArray(BasePeer::TYPE_FIELDNAME)) . "\n"; } return ob_get_clean(); } else if ($format == 'json') { header('Content-type: application/json'); header('Content-disposition: attachment; filename=item_data_' . date('Ymd-His') . '.json'); $json = array(); foreach ($items as $item) { $json[$item->getDataId()] = $item->toArray(BasePeer::TYPE_FIELDNAME); } return json_encode($json); } }) ->assert('format', 'csv|json') ->bind('api'); /** * ---------------------- * route /api/item * ---------------------- */ $app->get("/api/listings/{dataId}/{type}/{format}/{secret}", function($dataId, $type, $format, $secret) use($app) { // check if the secret is in the configured allowed api_secrets if (!(isset($GLOBALS['api_secrets']) && in_array($secret, $GLOBALS['api_secrets'])) && !$app['debug']) { return $app->redirect("/"); } $item = ItemQuery::create()->findPK($dataId); if (!$item) { return $app->abort(404, "Page does not exist."); } $fields = array(); $listings = array(); if ($type == 'sell') { $fields = SellListingPeer::getFieldNames(BasePeer::TYPE_FIELDNAME); $listings = SellListingQuery::create()->findByItemId($item->getDataId()); } else { $fields = BuyListingPeer::getFieldNames(BasePeer::TYPE_FIELDNAME); $listings = BuyListingQuery::create()->findByItemId($item->getDataId()); } if ($format == 'csv') { header('Content-type: text/csv'); header('Content-disposition: attachment; filename=listings_data_' . $item->getDataId() . '_' . $type . '_' . date('Ymd-His') . '.csv'); ob_start(); echo implode(",", $fields) . "\n"; foreach ($listings as $listing) { $data = $listing->toArray(BasePeer::TYPE_FIELDNAME); $date = new DateTime("{$listing->getListingDate()} {$listing->getListingTime()}"); $date->setTimezone(new DateTimeZone('UTC')); $data[$listing->getId()]['listing_date'] = $date->format("Y-m-d"); $data[$listing->getId()]['listing_time'] = $date->format("H:i:s"); echo implode(",", $data) . "\n"; } return ob_get_clean(); } else if ($format == 'json') { header('Content-type: application/json'); header('Content-disposition: attachment; filename=listings_data_' . $item->getDataId() . '_' . $type . '_' . date('Ymd-His') . '.json'); $json = array(); foreach ($listings as $listing) { $json[$listing->getId()] = $listing->toArray(BasePeer::TYPE_FIELDNAME); $date = new DateTime("{$listing->getListingDate()} {$listing->getListingTime()}"); $date->setTimezone(new DateTimeZone('UTC')); $json[$listing->getId()]['listing_date'] = $date->format("Y-m-d"); $json[$listing->getId()]['listing_time'] = $date->format("H:i:s"); } return json_encode($json); } }) ->assert('dataId', '\d+') ->assert('format', 'csv|json') ->assert('type', 'sell|buy') ->convert('dataId', $toInt) ->bind('api_item'); // bootstrap the app $app->run(); ?> <file_sep><?php namespace GW2Spidy\Queue; use GW2Spidy\Util\RedisSlots\RedisSlotManager; class RequestSlotManager extends RedisSlotManager { protected function getSlotsQueueName() { return 'request.slots'; } /** * 700 requests with a (250 sec = ) 4.666 min timeout * gives us 700 x (60 / (250 / 60)) = 10080 requests / hr = 2.8 requests / sec * this is excluding the time it takes to handle the slots * * in 1 round fill-queue-hourly we create about 6500 jobs */ protected function getSlots() { return 700; } protected function getTimeout() { return 250; } /** * @return RequestSlotManager */ public static function getInstance() { return parent::getInstance(); } } ?><file_sep><?php namespace GW2Spidy\Util; class CookieJar { protected $cookiejar = null; protected static $instance; public function __destruct() { $this->cleanupCookieJar(); } /** * @return CookieJar */ public static function getInstance() { if (is_null(static::$instance)) { static::$instance = new static(); } return static::$instance; } public function getCookieJar() { if (is_null($this->cookiejar)) { $this->cookiejar = "/tmp/" . uniqid("cookie_jar"); touch($this->cookiejar); } return $this->cookiejar; } public function cleanupCookieJar() { unlink($this->getCookieJar()); $this->cookiejar = null; } } ?><file_sep>GW2Spidy - Trade Market Graphs ============================== This project aims to provide you with graphs of the sale and buy listings of items on the Guild Wars 2 Trade Market. How does it work? ================= ArenaNet has build the Trade Market so that it's loaded into the game from a website. You can also access this website with a browser and use your game account to login and view all the items and listings. Now what I've build is some tools which will run constantly to automatically login to that website and record all data we can find, as a result I can record the sale listings for all the items about every hour and with that data I can create graphs with the price changing over time! Contributing ============ Everyone is very much welcome to contribute, 99% chance you're reading this on github so it shouldn't be to hard to fork and do pull requests right :) ? If you need any help with setup of the project or using git(hub) then just contact me and I'll be glad to help you! If you want a dump of the database, since that's a lot easier to work with, then just contact me ;) Project setup ============= I'll provide you with some short setup instructions to make your life easier if you want to run the code for yourself or contribute. Environment ----------- ### Linux I run the project on a linux server and many of the requirements might not be available on windows and I have only (a tiny bit) of (negative) experience with windows. If you want to run this on a windows machine, for development purposes, then I strongly sugest you just run a virtual machine with linux (virtualbox is free and works pretty nice). ### PHP 5.3 You'll need PHP5.3 or higher for the namespace support etc. You'll need the following extensions installed: * php5-curl * php5-mysql * php5-memcache ### MySQL / Propel I think 4.x will suffice, though I run 5.x. On the PHP side of things I'm using PropelORM, thanks to that you could probally switch to PostgreSQL or MSSQL easily if you have to ;) ### Apache / Nginx / CLI The project will work fine with both Apache or Nginx (I actually run apache on my dev machine and nginx in production), you can find example configs in the `docs` folder of this project. If you want to run the code that spiders through the trade market then you'll need command line access, if you just want to run the frontend code (and get a database dump from me) then you can live without ;) On a clean install you might need to enable apache rewrite with the command: `a2enmod rewrite` ### Memcache Using memcache daemon and PHP Memcache lib to easily cache some stuff in memory (item and type data). However, everything will work fine without memcache, if you have memcache installed but don't want the project to use it then define MEMCACHED_DISABLED in your config.inc.php and set it to true. You DO need the php5-memcache library, but it won't use memcache for anything ;) *Note* that you need `php5-memcache` not `php5-memcached` *Note* that you need to have the memcache extension, even if you don't want to use it! ### Redis The spidering code uses a custom brew queue and some custom brew system to make sure we don't do more then x amount of requests. Both the queue and the slots are build using Redis (Predis library is already included in the `vendor` folder). Previously I was using MySQL for this, but using MySQL was a lot heavier on load and using Redis it's also slightly faster! ### Silex / Twig / Predis Just some PHP libs, already included in the `vendor` folder. ### jQuery / Flot / Twitter Bootstrap Just some HTML / JS / CSS libs, already included in `webroot/assets/vendor` folder. ### yui-compressor You will need to install yui-compressor and then run ```make``` in the ```webroot/assets/js/vendor/flot``` directory to minify the javascript ### You will need a pear library Log pear install Log RequestSlots ------------ ArenaNet is okay with me doing this, but nonetheless I want to limit the amount of requests I'm shooting at their website or at least spread them out a bit. I came up with this concept of 'request slots', I setup an x amount of slots, claim one when I do a request and then give it a cooldown before I can use it again. That way I can control the flood a bit better. This is done using Redis sorted sets. WorkerQueue ----------- All spidering work is done through the worker queue, the queue process also handles the previously mentioned request slots. This is also done using Redis sorted sets. Database Setup -------------- In the `config` folder there's a `config/schema.sql` (generated by propel based of `config/schema.xml`, so database changes should be made to the XML and then generating the SQL file!). You should create a database called 'gw2spidy' and load the `config/schema.sql` in. The `config/runtime-conf.xml` contains the database credentials, be careful that it's not on .gitignore, so don't commit your info!! The `config/gw2spidy-conf.php` is generated from that XML, you should manually change the info in there for now, again be careful not to commit it!! If you do by excident, backup your code and delete your whole repo from github xD - I'll come up with a better way soon... Spider Config Setup ------------------- Copy the `config/config.inc.example.php` to `config/config.inc.php` and change the account info, this file is on .gitignore so you can't commit it by excident ;) RequestSlots Setup ------------------ Run `tools/setup-request-slots.php` to create the initial request slots, you can also run this during development to reinitiate the slots so you can instantly use them again if they are all on cooldown. First Spider Run ---------------- The first time you'll have to run `daemons/fill-queue-daily.php` to enqueue a job which will fetch all the item (sub)types. Then run `daemons/worker-queue.php` to execute that job. After that is done, run `daemons/fill-queue-listings.php` again, this will enqueue a job for each (sub)type to start fetch item information. Then run `daemons/worker-queue.php` again until it's done (needs to fetch about 600~650 pages of items). The Worker Queue ---------------- When you run `daemons/worker-queue.php` the script will do 50 loops to either fetch an item from the queue to execute or if none it will sleep. It will also sleep if there are no slots available. Previously I used to run 4 of these in parallel using `while [ true ]; do php daemons/worker-queue.php >> /var/log/gw2spidy/worker.1.log; echo "restart"; done;` Where I replace the .1 with which number of the 4 it is so I got 4 logs to tail. I now added some bash scripts in the `bin` folder to `bin/start-workers.sh 4` and `bin/stop-workers.sh` to manage them. You have to `mkdir -p /var/run/gw2spidy/` first though since I manage the processIDs there. Fill Queue Listings ----------------- The `daemon/fill-queue-listings.php` atm does the same as the fill queue daily since we can no longer fetch listings directly. We just do it more frequent then daily xD Fill Queue Daily ----------------- The `daemon/fill-queue-daily.php` script enqueues a job for every (sub)type in the database to fetch the first page of items, that job then requeues itself until all the pages are fetched. Copyright and License ===================== Copyright (c) 2012, <NAME> All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. The views and conclusions contained in the software and documentation are those of the authors and should not be interpreted as representing official policies, either expressed or implied, of the FreeBSD Project. Copyright and License - Apendix =============================== The above BSD license will allow you to use this open source project for anything you like. However, I would very much appreciate it when you decide to use the code if you could contribute your improvements back to this project and / or contact me so that I'm aware (and proud) of my project being used by other people too :-) <file_sep><?php namespace GW2Spidy\Util\RedisQueue; use Predis\Client; abstract class RedisQueueManager { protected $client; protected static $instance; protected function __construct() { $this->client = new Client(); } /** * @return RedisQueueManager */ public static function getInstance() { if (is_null(static::$instance)) { static::$instance = new static(); } return static::$instance; } abstract protected function getQueueName(); public function enqueue(RedisQueueItem $queueItem) { return $this->client->lpush($this->getQueueName(), serialize($queueItem)); } public function next() { $result = $this->client->brpop($this->getQueueName(), 2); $queueItem = unserialize($result[1]); return ($queueItem instanceof RedisQueueItem) ? $queueItem : null; } public function purge() { $this->client->del($this->getQueueName()); } public function getLength() { return $this->client->llen($this->getQueueName()); } } ?><file_sep><?php namespace GW2Spidy\Queue; use GW2Spidy\DB\ItemQuery; use GW2Spidy\DB\ItemTypeQuery; use GW2Spidy\WorkerQueue\ItemTypeDBWorker; use GW2Spidy\WorkerQueue\ItemListingsDBWorker; use GW2Spidy\WorkerQueue\ItemDBWorker; class QueueManager { public function buildItemTypeDB() { ItemTypeDBWorker::enqueueWorker(); } public function buildItemDB($full = true) { foreach (ItemTypeQuery::create()->find() as $type) { ItemDBWorker::enqueueWorker($type, null, $full); } } public function buildListingsDB() { foreach (ItemQuery::create()->find() as $item) { ItemListingsDBWorker::enqueueWorker($item); } } } ?><file_sep><?php namespace GW2Spidy\WorkerQueue; use GW2Spidy\DB\BuyListing; use GW2Spidy\DB\SellListing; use GW2Spidy\Util\Functions; use GW2Spidy\Queue\WorkerQueueManager; use GW2Spidy\Queue\WorkerQueueItem; use GW2Spidy\DB\Item; use GW2Spidy\DB\ItemQuery; use GW2Spidy\TradeMarket; use GW2Spidy\DB\ItemType; use GW2Spidy\DB\ItemSubType; class ItemDBWorker implements Worker { public function getRetries() { return 1; } public function work(WorkerQueueItem $item) { $data = $item->getData(); $res = $this->buildItemDB($data['type'], $data['subtype'], $data['offset']); // we stop enqueueing the next slice when we stop getting results if ($data['full'] && $res) { $this->enqeueNextOffset($data['type'], $data['subtype'], $data['offset']); } } protected function buildItemDB($type, $subtype, $offset) { $now = new \DateTime(); var_dump((string)$type, (string)$subtype, $offset) . "\n\n"; $items = TradeMarket::getInstance()->getItemList($type, $subtype, $offset); var_dump($items) . "\n\n"; if ($items) { foreach ($items as $itemData) { $item = ItemQuery::create()->findPK($itemData['data_id']); var_dump($itemData['name'], (string)$item, $itemData['min_sale_unit_price']) . "\n\n"; if ($item) { if (($p = Functions::almostEqualCompare($itemData['name'], $item->getName())) > 50 || $item->getName() == "...") { $item->fromArray($itemData, \BasePeer::TYPE_FIELDNAME); $item->save(); } else { throw new \Exception("Title for ID no longer matches! item [{$p}] [json::{$itemData['data_id']}::{$itemData['name']}] vs [db::{$item->getDataId()}::{$item->getName()}]"); } } else { $item = new Item(); $item->fromArray($itemData, \BasePeer::TYPE_FIELDNAME); $item->setItemType($type); $item->setItemSubType($subtype); $item->save(); } if ($itemData['min_sale_unit_price'] > 0) { $sellListing = new SellListing(); $sellListing->setItem($item); $sellListing->setListingDate($now); $sellListing->setListingTime($now); $sellListing->setQuantity($itemData['sale_availability'] ?: 1); $sellListing->setUnitPrice($itemData['min_sale_unit_price']); $sellListing->setListings(1); $sellListing->save(); } if ($itemData['max_offer_unit_price'] > 0) { $buyListing = new BuyListing(); $buyListing->setItem($item); $buyListing->setListingDate($now); $buyListing->setListingTime($now); $buyListing->setQuantity($itemData['offer_availability'] ?: 1); $buyListing->setUnitPrice($itemData['max_offer_unit_price']); $buyListing->setListings(1); $buyListing->save(); } } } return (boolean)$items; } protected function enqeueNextOffset($type, $subtype, $offset) { return self::enqueueWorker($type, $subtype, $offset + 10, true); } public static function enqueueWorker($type, $subtype, $offset = 0, $full = true) { $queueItem = new WorkerQueueItem(); $queueItem->setWorker("\\GW2Spidy\\WorkerQueue\\ItemDBWorker"); // $queueItem->setPriority(WorkerQueueItem::PRIORITY_ITEMDB); $queueItem->setData(array( 'type' => $type, 'subtype' => $subtype, 'offset' => $offset, 'full' => $full, )); WorkerQueueManager::getInstance()->enqueue($queueItem); return $queueItem; } } ?><file_sep><?php use GW2Spidy\DB\ItemQuery; use GW2Spidy\WorkerQueue\ItemListingsDBWorker; require dirname(__FILE__) . '/../config/config.inc.php'; require dirname(__FILE__) . '/../autoload.php'; $item = ItemQuery::create()->findPK($argv[1]); $worker = new ItemListingsDBWorker(); var_dump($worker->buildListingsDB($item));
b263ac4e5bf63c5fdb438453678a9d935bfc4dbb
[ "Markdown", "PHP" ]
9
PHP
lmik/gw2spidy
376a9a2a205519a0604d47b50974162725469726
cc23d142b8804c8aa873c5b1d5b22070b7b92851
refs/heads/main
<file_sep><?php session_start(); $user = $_SESSION['user_id']; include_once 'config.php'; include_once 'include/connect_db.php'; include_once 'include/php_functions.php'; $lang = getLang(); include_once 'language/'.$lang.'.php'; ?> <!DOCTYPE HTML> <!--[if lt IE 7]> <html class="no-js ie6 oldie" lang="en"> <![endif]--> <!--[if IE 7]> <html class="no-js ie7 oldie" lang="en"> <![endif]--> <!--[if IE 8]> <html class="no-js ie8 oldie" lang="en"> <![endif]--> <!--[if gt IE 8]><!--> <html class="no-js" <?php echo 'lang="'.$lang.'"';?>> <!--<![endif]--> <head> <meta charset="utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta name="description" content=""> <meta name="keywords" content=""> <title>Univer - універсальне рішення</title> <!-- CSS --> <link href="favicon.ico" rel="shortcut icon" type="image/x-icon"> <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.2.1/css/bootstrap.min.css" integrity="<KEY>" crossorigin="anonymous"> <link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.2.0/css/all.css" integrity="<KEY>" crossorigin="anonymous"> <link href="css/style.css" rel="stylesheet"> <link href="css/style.css" rel="stylesheet"> <link data-dump-line-numbers="all" rel="stylesheet/less" type="text/css" href="css/style.less"> </head> <body> <?php include_once "include/menu.php"; ?> <section class="container-fluid"> <div id="carouselExampleIndicators" class="row carousel slide" data-ride="carousel"> <ol class="carousel-indicators"> <li data-target="#carouselExampleIndicators" data-slide-to="0" class="active"></li> <li data-target="#carouselExampleIndicators" data-slide-to="1"></li> <li data-target="#carouselExampleIndicators" data-slide-to="2"></li> </ol> <div class="carousel-inner"> <div class="carousel-item active"> <img class="d-block w-100" src="img/slider/1.jpg" alt="First slide"> </div> <div class="carousel-item"> <img class="d-block w-100" src="img/slider/2.jpg" alt="Second slide"> </div> <div class="carousel-item"> <img class="d-block w-100" src="img/slider/3.jpg" alt="Third slide"> </div> </div> <a class="carousel-control-prev" href="#carouselExampleIndicators" role="button" data-slide="prev"> <span class="carousel-control-prev-icon" aria-hidden="true"></span> <span class="sr-only">Previous</span> </a> <a class="carousel-control-next" href="#carouselExampleIndicators" role="button" data-slide="next"> <span class="carousel-control-next-icon" aria-hidden="true"></span> <span class="sr-only">Next</span> </a> </div> </section> <div class="container text-center img-bg py-5 sh-b-20"> <a href="how_it_work.php"> <button class="btn btn-lg btn-primary center-block"> <?php echo HOW_IT_WORK;?> </button> </a> <section class="my-4"> <div class="text-center"><h1>Розпочати протягом хвилини</h1></div> <button class="btn btn-lg btn-primary center-block">Просмотреть</button> </section> <section class="my-4"> <div class="text-center"><h1>Переваги (афоризми)</h1></div> <div class="row"> <div class="card col-4 text-center"> <img class="card-img-top" src="img/leaf/1.png" alt="Card image cap" style="width: 55px;"> <div class="card-body"> <h5 class="card-title">Card title</h5> <p class="card-text">Some quick example text to build on the card title and make up the bulk of the card's content.</p> <a href="#" class="btn btn-primary">Go somewhere</a> </div> </div> <div class="card col-4 text-center"> <img class="card-img-top" src="img/leaf/1.png" alt="Card image cap" style="width: 55px;"> <div class="card-body"> <h5 class="card-title">Card title</h5> <p class="card-text">Some quick example text to build on the card title and make up the bulk of the card's content.</p> <a href="#" class="btn btn-primary">Go somewhere</a> </div> </div> <div class="card col-4 text-center"> <img class="card-img-top" src="img/leaf/1.png" alt="Card image cap" style="width: 55px;"> <div class="card-body"> <h5 class="card-title">Card title</h5> <p class="card-text">Some quick example text to build on the card title and make up the bulk of the card's content.</p> <a href="#" class="btn btn-primary">Go somewhere</a> </div> </div> </div> </section> <section class="popular-types"> <div class="popular-types-box col-12" > <div class="row"> <div class="title-wrap"> <div class="bg-white py-4 text-center"><h1><?php echo FEATURED_TASKS;?></h1></div> </div> <div class="col-4 col-sm-2 leaf-top"></div> <div class="col-4 col-sm-2 leaf-top"></div> <div class="col-4 col-sm-2 leaf-top"></div> <div class="d-none d-sm-block col-sm-2 leaf-top"></div> <div class="d-none d-sm-block col-sm-2 leaf-top"></div> <div class="d-none d-sm-block col-sm-2 leaf-top"></div> <div class="col-4 col-sm-2 leaf"> <div> <img alt="Диплом" src="img/leaf/1.png"> <div>Диплом</div> </div> </div> <div class="d-none d-sm-block col-sm-2 leaf"> <div> <img alt="1" src="img/leaf/2.png"> <div>Тести</div> </div> </div> <div class="d-none d-sm-block col-sm-2 leaf"> <div> <img alt="1" src="img/leaf/3.png"> <div>Контрольная</div> </div> </div> <div class="col-4 col-sm-2 leaf"> <div> <img alt="1" src="img/leaf/4.png"> <div>Курсовая</div> </div> </div> <div class="d-none d-sm-block col-sm-2 leaf"> <div> <img alt="1" src="img/leaf/5.png"> <div>Диссертация</div> </div> </div> <div class="col-4 col-sm-2 leaf"> <div> <img alt="1" src="img/leaf/6.png"> <div>Чертеж</div> </div> </div> </div> </div> </section> <button class="btn btn-primary">Інші види робіт</button> <section class="my-4" id="tasksWrap"> <div class="index-title-box">Останні надходження</div> <?php $arr = getTypeSection($_SESSION['lang']); $type_arr = $arr['type']; $section_arr = $arr['section']; include "include/connect_db.php"; if ($result = mysqli_query ($link, "SELECT tasks.task_id, tasks.title, tasks.type, tasks.section, tasks.description, tasks.budget, tasks.currency, tasks.limit_date, tasks.published, tasks.discipline, tasks.attach, tasks.customer_id, users.user_id, users.user_name, users.avatar FROM tasks LEFT JOIN users ON tasks.customer_id = users.user_id WHERE status = 0 ORDER BY tasks.task_id DESC LIMIT 5 ")){ while ($row = mysqli_fetch_assoc($result)){ include "include/task.php"; } }?> </section> 555 <section> <ul> <li> <a href="#" contenteditable> <h2>Title #1</h2> <p>Text Content #1</p> </a> </li> <li> <a href="#" contenteditable> <h2>Title #2</h2> <p>Text Content #2</p> </a> </li> <li> <a href="#" contenteditable> <h2>Title #3</h2> <p>Text Content #3</p> </a> </li> <li> <a href="#" contenteditable> <h2>Title #4</h2> <p>Text Content #4</p> </a> </li> <li> <a href="#" contenteditable> <h2>Title #5</h2> <p>Text Content #5</p> </a> </li> <li> <a href="#" contenteditable> <h2>Title #6</h2> <p>Text Content #6</p> </a> </li> <li> <a href="#" contenteditable> <h2>Title #7</h2> <p>Text Content #7</p> </a> </li> <li> <a href="#" contenteditable> <h2>Title #8</h2> <p>Text Content #8</p> </a> </li> </ul> </section> <script type="text/javascript"> $(document).ready(function () { all_notes = $("li a"); all_notes.on("keyup", function () { note_title = $(this).find("h2").text(); note_content = $(this).find("p").text(); item_key = "list_" + $(this).parent().index(); data = { title: note_title, content: note_content }; window.localStorage.setItem(item_key, JSON.stringify(data)); }); all_notes.each(function (index) { data = JSON.parse(window.localStorage.getItem("list_" + index)); if (data !== null) { note_title = data.title; note_content = data.content; $(this).find("h2").text(note_title); $(this).find("p").text(note_content); } }); }); </script> <style type="text/css"> body { margin: 20px auto; font-family: 'Lato'; background:#666; color:#fff; } *{ margin:0; padding:0; } h2 { font-weight: bold; font-size: 2rem; } p { font-family: '<NAME>'; font-size: 2rem; } ul,li{ list-style:none; } ul{ display: flex; flex-wrap: wrap; justify-content: center; } ul li a{ text-decoration:none; color:#000; background:#ffc; display:block; height:10em; width:10em; padding:1em; box-shadow: 5px 5px 7px rgba(33,33,33,.7); transform: rotate(-6deg); transition: transform .15s linear; } ul li:nth-child(even) a{ transform:rotate(4deg); position:relative; top:5px; background:#cfc; } ul li:nth-child(3n) a{ transform:rotate(-3deg); position:relative; top:-5px; background:#ccf; } ul li:nth-child(5n) a{ transform:rotate(5deg); position:relative; top:-10px; } ul li a:hover,ul li a:focus{ box-shadow:10px 10px 7px rgba(0,0,0,.7); transform: scale(1.25); position:relative; z-index:5; } ul li{ margin:1em; } </style> <section> <?php include_once "include/task.php"; ?> <p>Lorem ipsum dolor sit amet, vix diam nusquam at. Ex usu labitur nostrud invenire, eos option senserit adversarium in. Est id falli debitis, no novum saperet complectitur mei. Id dictas feugiat deserunt sea, nam te possim gubergren vulputate, eu pro discere officiis. Sit legimus erroribus eu, vel numquam reprehendunt signiferumque eu. Te eam aeque maiorum, pri ad dicta vitae. Expetenda repudiare assentior ut eam, usu ea malis possit quaerendum. Eos idque senserit constituto ut.</p> <a href="#" data-toggle="tooltip" title="Hooray!">Hover over me</a> </section> </div> <?php include_once "include/footer.html"; ?> </body> <script src="https://code.jquery.com/jquery-3.3.1.min.js" integrity="<KEY> crossorigin="anonymous"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.6/umd/popper.min.js" integrity="<KEY>" crossorigin="anonymous"></script> <script src="https://stackpath.bootstrapcdn.com/bootstrap/4.2.1/js/bootstrap.min.js" integrity="<KEY>" crossorigin="anonymous"></script> <script src="https://cdn.jsdelivr.net/npm/sweetalert2@7.33.1/dist/sweetalert2.all.min.js"></script> <!--<script type="text/javascript" src="js/star-rating.min.js"></script>--> <script type="text/javascript" src="js/bootstrap-rating.min.js"></script> <script type="text/javascript" src="js/main.js"></script> <script type="text/javascript" src="js/less.min.js"></script> <script type="text/javascript" src="js/timeago/jquery.timeago.js"></script> <script type="text/javascript" src="js/timeago/jquery.timeago.<?php echo $lang;?>.js"></script> <script type="text/javascript"> taskTimeAgo(); $('input').rating(); </script> </html>
9787b792cc9433a9fd1fea3b17b574818bad72fb
[ "PHP" ]
1
PHP
zno-3/StudLex
f9a4974edda5763efbca49e56d48058fd2ae9327
33838598d4d54c260f8843c7891b028e7f6826c2
refs/heads/master
<file_sep>#ifndef BALL_H #define BALL_H #include <QtGui/QOpenGLFunctions> #include <cmath> #include "gameobject.h" #include "vertex.h" #include "material.h" class Ball : public GameObject { public: //Setter in kode fra cubeklassen her for å prøve å implementere som GameObject. Ball(float xPos = 0.0, float yPos = 0.0, float zPos = 0.0, QString name = "Ball"); ~Ball(); void drawGeometry(); int initGeometry(); void setRendermode(int mode); void setMaterial(Material *materialIn); //Under er koden fra gamle ballklassen. void triangle(GLfloat *a, GLfloat *b, GLfloat *c); void tetrahedron(int n); void normalize(GLfloat *p); void divide_triangle(GLfloat *a, GLfloat *b, GLfloat *c, int n); private: GLuint mVertexBuffer; GLuint mIndexBuffer; Material *mMaterial; QMatrix4x4 mMVPMatrix; public: GLfloat ballRadius = 7; GLfloat ballKoordinater[100000]; GLfloat ballFarger[100000]; GLfloat m_x = 0.0f; GLfloat m_y = 0.0f; GLfloat m_z = 0.0f; GLfloat m_r = 0.5f; GLfloat m_teta = 0.0f; GLfloat m_retning = -1.0f; public: int minTeller = 0; int noeTeller = 0; int storrelse = 4; GLfloat v[4][3] = { {0.0f, 0.0f, 1.0f}, {0.0f, 0.942809f, -0.333333f}, {-0.816497f, -0.471405f, -0.333333f}, {0.816497f, -0.471405f, -0.333333f} }; }; #endif // BALL_H <file_sep>#include "trianglesurface.h" #include "vertex.h" #include "math_constants.h" #include <cmath> #include <QDebug> #include <QDirIterator> TriangleSurface::TriangleSurface() : VisualObject() { mMatrix.setToIdentity(); } TriangleSurface::TriangleSurface(std::string filename) : VisualObject() { readFile(filename); calculateNormals(); mMatrix.setToIdentity(); } TriangleSurface::~TriangleSurface() { } void TriangleSurface::init() { //must call this to use OpenGL functions initializeOpenGLFunctions(); //Vertex Array Object - VAO glGenVertexArrays( 1, &mVAO ); glBindVertexArray( mVAO ); glGenBuffers(1, &mEAB); //Vertex Buffer Object to hold vertices - VBO glGenBuffers( 1, &mVBO ); glBindBuffer( GL_ARRAY_BUFFER, mVBO ); glBufferData( GL_ARRAY_BUFFER, mVertices.size()*sizeof(Vertex), mVertices.data(), GL_STATIC_DRAW ); if(!mIndices.empty()) { glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, mEAB); glBufferData(GL_ELEMENT_ARRAY_BUFFER, static_cast<GLuint>(mIndices.size()) * sizeof(unsigned int), &mIndices[0], GL_STATIC_DRAW); } glBindBuffer(GL_ARRAY_BUFFER, mVBO); glVertexAttribPointer(0, 3, GL_FLOAT,GL_FALSE,sizeof(Vertex), (GLvoid*)0); glEnableVertexAttribArray(0); glVertexAttribPointer(1, 3, GL_FLOAT, GL_FALSE, sizeof(Vertex), (GLvoid*)(3 * sizeof(GLfloat)) ); glEnableVertexAttribArray(1); // 3rd attribute buffer : uvs glVertexAttribPointer(2, 2, GL_FLOAT, GL_FALSE, sizeof(Vertex), (GLvoid*)( 6 * sizeof(GLfloat)) ); glEnableVertexAttribArray(2); glBindVertexArray(0); } void TriangleSurface::draw() { glBindVertexArray( mVAO ); if(!mIndices.empty()) { glDrawElements(GL_TRIANGLES,static_cast<GLsizei>(mIndices.size()),GL_UNSIGNED_INT, nullptr); } else { glPointSize(10.f); glDrawArrays(GL_POINTS, 0, mVertices.size()); } } void TriangleSurface::readFile(std::string filename) { std::ifstream inn; inn.open(filename.c_str()); if (inn.is_open()) { unsigned long n; Vertex vertex; inn >> n; mVertices.reserve(n); for (unsigned long i=0; i<n; i++) { inn >> vertex; mVertices.push_back(vertex); } inn >> n; for(unsigned int i = 0; i < n; ++i) { int s; for (unsigned int j = 0; j < 3; ++j) { inn >> s; mIndices.push_back(static_cast<unsigned int>(s)); } for (unsigned int j = 0; j < 3; ++j) { inn >> s; mNeighbor.push_back(static_cast<int>(s)); } } inn.close(); } else { qDebug() << "Error: " << filename.c_str() << " could not be opened!"; } } void TriangleSurface::readTxtFiles(std::string directory) { QFile file(QString::fromStdString(terrainFileName)); if(!file.exists()) { double minX = 999999999999; double maxX = 0; double minY = 999999999999; double maxY = 0; double minZ = 999999999999; double maxZ = 0; QDirIterator dirIterator(QString::fromStdString(directory), QDir::AllEntries | QDir::NoDotAndDotDot); while(dirIterator.hasNext()) { auto path = dirIterator.next(); QFile file(path); file.open(QIODevice::ReadWrite | QIODevice::Text); QTextStream stream(&file); stream.setRealNumberPrecision(16); while(!stream.atEnd()) { QString line = stream.readLine(); auto split = line.split(" "); double x = split[0].toDouble(); double y = split[2].toDouble(); double z = split[1].toDouble(); if(x < minX) { minX = x; } else if(x > maxX) { maxX = x; } if(y < minY) { minY = y; } else if(y > maxY) { maxY = y; } if(z < minZ) { minZ = z; } else if(z > maxZ) { maxZ = z; } } file.close(); } mDiffX = maxX - minX; mDiffY = maxY - minY; mDiffZ = maxZ - minZ; QDirIterator dirIterator2(QString::fromStdString(directory), QDir::AllEntries | QDir::NoDotAndDotDot); while(dirIterator2.hasNext()) { auto path = dirIterator2.next(); QFile file(path); file.open(QIODevice::ReadWrite | QIODevice::Text); QTextStream stream(&file); stream.setRealNumberPrecision(16); while(!stream.atEnd()) { QString line = stream.readLine(); auto split = line.split(" "); float x = split[0].toFloat(); float y = split[2].toFloat(); float z = split[1].toFloat(); const int scale = 1; auto vertexX = ((x - minX)) * scale; auto vertexY = ((y - minY)) * scale; auto vertexZ = ((z - minZ)) * scale; Vertex vertex; vertex.set_xyz(vertexX, vertexY, vertexZ); mVertices.push_back(vertex); } file.close(); } triangulate(); } else { readFile(terrainFileName); } calculateIndices(); calculateNormals(); } void TriangleSurface::writeFile(std::string filename) { std::ofstream ut; ut.open(filename.c_str()); if (ut.is_open()) { auto n = mVertices.size(); Vertex vertex; ut << n << std::endl; for (auto it=mVertices.begin(); it != mVertices.end(); it++) { vertex = *it; ut << vertex << std::endl; } ut.close(); } } void TriangleSurface::triangulate() { const float tileXsize = mDiffX/(float)mTilesX; const float tileZsize = mDiffZ/(float)mTilesZ; std::vector<Vertex> tempVertices; for(float i = 0; i < mTilesX; i+=1.f) { for(float j = 0; j < mTilesZ; j+=1.f) { Vertex tempVertex(-1,0,-1); int numOfVertices(0); float tileXStart = tileXsize*(i); float tileZStart = tileZsize*(j); float nextTileXStart = tileXsize*(i+1.f); float nextTileZStart = tileZsize*(j+1.f); for(auto v : mVertices) { if(v.mXYZ.x >= tileXStart && v.mXYZ.x < nextTileXStart && v.mXYZ.z >= tileZStart && v.mXYZ.z < nextTileZStart) { tempVertex.mXYZ.y+=v.mXYZ.y; numOfVertices++; } } if(numOfVertices != 0) { tempVertex.mXYZ.y = tempVertex.mXYZ.y/(float)numOfVertices; } tempVertex.mXYZ.x = tileXStart/* + ((float)tileXsize/2.f)*/; tempVertex.mXYZ.z = tileZStart/* + ((float)tileZsize/2.f)*/; tempVertices.push_back(tempVertex); } } mVertices = tempVertices; writeFile(terrainFileName); } void TriangleSurface::calculateIndices() { mIndices.clear(); for(int i = 0; i < mTilesZ*mTilesX; ++i) { if(i == (mTilesX*mTilesZ)-mTilesZ) break; if(i > 1 && (i+1) % mTilesX == 0) continue; mIndices.emplace_back(i); mIndices.emplace_back(i+mTilesZ+1); mIndices.emplace_back(i+1); mIndices.emplace_back(i); mIndices.emplace_back(i+mTilesZ); mIndices.emplace_back(i+mTilesZ+1); } } void TriangleSurface::calculateNormals() { for (unsigned int i=0; i<mIndices.size(); i+=3) { auto pos1 = mVertices[mIndices[i+0]].mXYZ; auto pos2 = mVertices[mIndices[i+1]].mXYZ; auto pos3 = mVertices[mIndices[i+2]].mXYZ; auto normal = gsl::Vector3D::cross(pos2-pos1,pos3-pos1); normal.normalize(); mVertices[mIndices[i+0]].set_normal(normal); mVertices[mIndices[i+1]].set_normal(normal); mVertices[mIndices[i+2]].set_normal(normal); } std::vector<gsl::Vector3D> tempNormals; for (unsigned int i=0; i<mIndices.size(); i+=3) { } } void TriangleSurface::construct() { float xmin=0.0f, xmax=1.0f, ymin=0.0f, ymax=1.0f, h=0.25f; for (auto x=xmin; x<xmax; x+=h) { for (auto y=ymin; y<ymax; y+=h) { float z = sin(gsl::PI*x)*sin(gsl::PI*y); mVertices.push_back(Vertex{x,y,z,x,y,z}); z = sin(gsl::PI*(x+h))*sin(gsl::PI*y); mVertices.push_back(Vertex{x+h,y,z,x,y,z}); z = sin(gsl::PI*x)*sin(gsl::PI*(y+h)); mVertices.push_back(Vertex{x,y+h,z,x,y,z}); mVertices.push_back(Vertex{x,y+h,z,x,y,z}); z = sin(gsl::PI*(x+h))*sin(gsl::PI*y); mVertices.push_back(Vertex{x+h,y,z,x,y,z}); z = sin(gsl::PI*(x+h))*sin(gsl::PI*(y+h)); mVertices.push_back(Vertex{x+h,y+h,z,x,y,z}); } } } <file_sep>#include "rollingball.h" RollingBall::RollingBall() : Sphere(3) { } void RollingBall::move(VisualObject* plane) { calculateBarycentricCoordinates(plane); if(inputVector.length() >= 1) { inputVector.normalize(); } //Velocity=gsl::Vector3D(0); //Velocity = gsl::Vector3D(0,0,0); mMatrix.translate(velocity); } void RollingBall::calculateBarycentricCoordinates(VisualObject* plane) { bool isInTriangle = false; gsl::Vector3D normal{0}; gsl::Vector3D playerTempPos{0}; //find normal vector for (unsigned int i=0; i<plane->mIndices.size(); i+=3) { gsl::Vector3D pos1; gsl::Vector3D pos2; gsl::Vector3D pos3; pos1 = plane->mVertices[plane->mIndices[i+0]].mXYZ; pos2 = plane->mVertices[plane->mIndices[i+1]].mXYZ; pos3 = plane->mVertices[plane->mIndices[i+2]].mXYZ; gsl::Vector2D temp = gsl::Vector2D(mMatrix.getPosition().x, mMatrix.getPosition().z); gsl::Vector3D bar = temp.barycentricCoordinates(gsl::Vector2D(pos1.x,pos1.z),gsl::Vector2D(pos2.x, pos2.z), gsl::Vector2D(pos3.x,pos3.z)); if(bar.x>=0 && bar.x<=1 && bar.y>=0 && bar.y<=1 && bar.z>=0 && bar.z <=1) { isInTriangle = true; playerTempPos = (pos1*bar.x + pos2*bar.y + pos3*bar.z); normal = gsl::Vector3D::cross(pos3 - pos1,pos2 - pos1); normal.normalize(); } } //the formula is actually N = |G| * n * cos a //by taking dot(-G*n), we save time and get |G|* cos a in one swoop. //As gravity will always be the exact opposite direction of the xz-plane's normal vector, //this shouldnt be a problem gsl::Vector3D N; N = normal* gsl::Vector3D::dot(-gravity, normal); gsl::Vector3D vectorToBall = (mMatrix.getPosition()-playerTempPos); float distanceToBall = gsl::Vector3D::dot(vectorToBall,normal); if(distanceToBall>radius) { normal = gsl::Vector3D(0); N = gsl::Vector3D(0); } else { float distance = radius - distanceToBall; if(distance >0.5f) { mMatrix.translate(normal*distance); } //qDebug() << distance; } if(normal != prevTriangleNormal) { //qDebug() << "Same Normals!"; if(normal == gsl::Vector3D(0)) //går til lufta { qDebug() << "Leaving Triangls!"; //N = gsl::Vector3D(0); } else if(prevTriangleNormal== gsl::Vector3D(0))//kommer fra lufta { velocity = (gravity+N).normalized() * gsl::Vector3D::dot(velocity, (gravity+N).normalized()); } else //bytter trekant { //qDebug() << "Swapping Triangle!"; gsl::Vector3D tempNormal = normal + prevTriangleNormal; tempNormal.normalize(); gsl::Vector3D tempVel = tempNormal*gsl::Vector3D::dot(velocity,tempNormal); tempVel= velocity - tempVel*2; velocity = tempVel; } } prevTriangleNormal = normal; //LastLocation = gsl::Vector3D(mMatrix.getPosition().x,playerTempPos,mMatrix.getPosition().z); //qDebug() << prevTriangleNormal << normal << radius << distanceToBall; //qDebug() << acceleration << velocity.normalized() << (gravity+N).normalized() << currentTriangleNormal << gsl::Vector3D::dot(gravity, currentTriangleNormal); //(1/m)* (N+G); acceleration = (N+gravity); velocity+=acceleration*speed; //mMatrix.setPosition(LastLocation); } <file_sep>#include "ball.h" #include "vec3.h" #include "vec2.h" //Burde skrive om denne klassen så den arver fra GameObject, //og implementeres i GameEngine. Må da sende den til mGeometry vectoren. //Denne klassen holder på koordinater, men siden den ikke tegnes noe sted gjør den //ingenting ennå. //Må lage et Ball minBall i GameEngine. /* Ball::Ball() { Ball::tetrahedron(storrelse); } */ Ball::Ball(float xPos, float yPos, float zPos, QString name) : GameObject(xPos, yPos, zPos, name) { initGeometry(); Ball::tetrahedron(storrelse); } Ball::~Ball() { } void Ball::drawGeometry() { glBindBuffer(GL_ARRAY_BUFFER, mVertexBuffer); glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, mIndexBuffer); mMaterial->useMaterial(); //refresh modelMatrix: getMatrix(); mMVPMatrix = mProjectionMatrix*mViewMatrix*mModelMatrix; mMaterial->setMVPMatrix(mMVPMatrix); // Offset for position // Positions are the first data, therefor offset is 0 int offset = 0; // Tell OpenGL programmable pipeline how to locate vertex position data glVertexAttribPointer(static_cast<GLuint>(mMaterial->getPositionAttribute()), 3, GL_FLOAT, GL_FALSE, sizeof(Vertex), reinterpret_cast<const void*>(offset)); // Offset for vertex coordinates // before normals offset += sizeof(Vec3); glVertexAttribPointer(static_cast<GLuint>(mMaterial->getNormalAttribute()), 3, GL_FLOAT, GL_FALSE, sizeof(Vertex), reinterpret_cast<const void*>(offset)); // Offset for normal coordinates // before UVs offset += sizeof(Vec3); // Tell OpenGL programmable pipeline how to locate vertex texture coordinate data glVertexAttribPointer(static_cast<GLuint>(mMaterial->getTextureAttribute()), 3, GL_FLOAT, GL_FALSE, sizeof(Vertex), reinterpret_cast<const void*>(offset)); // Draw cube geometry using indices from VBO 1 if (!mWireFrame) glDrawElements(GL_TRIANGLE_STRIP, 34, GL_UNSIGNED_SHORT, 0); else glDrawElements(GL_LINES, 34, GL_UNSIGNED_SHORT, 0); //Write errors if any: // GLenum err = GL_NO_ERROR; // while((err = glGetError()) != GL_NO_ERROR) // { // qDebug() << "glGetError returns " << err; // } //Unbind buffers: glBindBuffer(GL_ARRAY_BUFFER, 0); glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0); //Unbind shader glUseProgram(0); } //Her lages trekantene. void Ball::triangle(GLfloat *a, GLfloat *b, GLfloat *c) { ballFarger[minTeller] = 0.0f; ballFarger[minTeller+1] = 2.0f; ballFarger[minTeller+2] = 0.0f; ballFarger[minTeller+3] = 5.0f; ballFarger[minTeller+4] = 0.0f; ballFarger[minTeller+5] = 5.0f; ballFarger[minTeller+6] = 0.0f; ballFarger[minTeller+7] = 2.0f; ballFarger[minTeller+8] = 0.0f; ballKoordinater[minTeller] = c[noeTeller]; ballKoordinater[minTeller+1] = c[noeTeller+1]; ballKoordinater[minTeller+2] = c[noeTeller+2]; ballKoordinater[minTeller+3] = b[noeTeller]; ballKoordinater[minTeller+4] = b[noeTeller+1]; ballKoordinater[minTeller+5] = b[noeTeller+2]; ballKoordinater[minTeller+6] = a[noeTeller]; ballKoordinater[minTeller+7] = a[noeTeller+1]; ballKoordinater[minTeller+8] = a[noeTeller+2]; minTeller +=9; } void Ball::normalize(GLfloat *p) { double d = 0.0f; int i; for( i=0; i<3; i++ ) { d += p[i]*p[i]; } d = sqrt(d); if( d > 0.0 ) { for( i=0; i<3; i++) { p[i] /= d; } } } void Ball::divide_triangle(GLfloat *a, GLfloat *b, GLfloat *c, int n) { GLfloat v1[3], v2[3], v3[3]; int j; if(n>0) { for( j=0; j<3; j++) { v1[j] = a[j] + b[j]; } Ball::normalize(v1); for( j=0; j<3; j++) { v2[j] = a[j] + c[j]; } Ball::normalize(v2); for( j=0; j<3; j++) { v3[j] = c[j] + b[j]; } Ball::normalize(v3); Ball::divide_triangle(a, v2, v1, n-1); Ball::divide_triangle(c, v3, v2, n-1); Ball::divide_triangle(b, v1, v3, n-1); Ball::divide_triangle(v1, v2, v3, n-1); } else { Ball::triangle(a, b, c); } } void Ball::tetrahedron(int n) { Ball::divide_triangle(v[0], v[1], v[2], n); Ball::divide_triangle(v[3], v[2], v[1], n); Ball::divide_triangle(v[0], v[3], v[1], n); Ball::divide_triangle(v[0], v[2], v[3], n); } int Ball::initGeometry() { //For now hard coded as a cube: // For cube we would need only 8 vertices but we have to // duplicate vertex for each face because texture coordinate // is different. //qDebug() << "Init Geometry - Cube"; //Format: Position, Normal, UV Vertex vertices[] = { // Vertex data for face 0 - front }; // Indices for drawing cube faces using triangle strips. // Triangle strips can be connected by duplicating indices // between the strips. If connecting strips have opposite // vertex order then last index of the first strip and first // index of the second strip needs to be duplicated. If // connecting strips have same vertex order then only last // index of the first strip needs to be duplicated. GLushort indices[] = { }; initializeOpenGLFunctions(); // Transfer vertex data to VBO 0 glGenBuffers(1, &mVertexBuffer); glBindBuffer(GL_ARRAY_BUFFER, mVertexBuffer); glBufferData(GL_ARRAY_BUFFER, 24*sizeof(Vertex), vertices, GL_STATIC_DRAW); // Transfer index data to VBO 1 glGenBuffers(1, &mIndexBuffer); glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, mIndexBuffer); glBufferData(GL_ELEMENT_ARRAY_BUFFER, 34*sizeof(GLushort), indices, GL_STATIC_DRAW); return 0; } void Ball::setRendermode(int mode) { if (mode == 1) mWireFrame = true; else if (mode == 0) mWireFrame = false; } void Ball::setMaterial(Material *materialIn) { mMaterial = materialIn; }
86fc5188cc6d2ff80ce28ccb8dc4bdd62436368b
[ "C++" ]
4
C++
RoVelten/Oblig_2
f3ab363ae9834acf21908ab04a340beb69dcaa87
03c8fb71bd5b0e29a98d17f406e802434ba7591d
refs/heads/master
<file_sep>function timedOut() { alert("Some error message"); } // set a timer setTimeout( timedOut , 60000 ); function countdown() { var seconds = 59; function tick() { var counter = document.getElementById("timeClock"); seconds--; counter.innerHTML =(seconds < 10 ? "0" : "") + String(seconds); if( seconds > 0 ) { setTimeout(tick, 1000); } else { alert("You twat!"); } } tick(); } countdown();
c21325279144fe395ab4acde79cc176ea02be078
[ "JavaScript" ]
1
JavaScript
wllptrsn/turnofphrase
41bcd85cb3fd45025ee3d08721ee276bc1bc8999
e103affadbcb90c22a3363706760c5a0e7874182
refs/heads/master
<file_sep>$(window).load(function(){ $('#hi').delay(700).fadeIn(1500); }); $(document).ready(function(){ });
2f71a7eb19d647ad1b585fa3816ac9de77771a1b
[ "JavaScript" ]
1
JavaScript
CassieLR/JeuMemoire
f13d54bdda7d26c8c2c508c78e96e89f840b2a19
f905bbd3ce6739472d8a2f8a8e5e19b3c9b17c51
refs/heads/master
<file_sep>import React from "react"; // nodejs library that concatenates classes import classNames from "classnames"; // @material-ui/core components import { makeStyles } from "@material-ui/core/styles"; // @material-ui/icons // core components import GridContainer from "components/Grid/GridContainer.js"; import GridItem from "components/Grid/GridItem.js"; import Card from "components/Card/Card.js"; import Quote from "components/Typography/Quote"; import styles from "assets/jss/material-kit-react/views/landingPageSections/skillsStyle.js"; import jsLogo from "assets/img/logos/Badge_js-strict.svg"; import reactLogo from "assets/img/logos/react-seeklogo.com.svg"; import angularLogo from "assets/img/logos/Angular_full_color_logo.svg"; import nodeJSLogo from "assets/img/logos/nodejs-1-logo-svg-vector.svg"; import cssLogo from "assets/img/logos/css3.png"; import htmlLogo from "assets/img/logos/html5.png"; import cPlusPlusLogo from "assets/img/logos/c++.png"; import postgresLogo from "assets/img/logos/postgresql.png"; const useStyles = makeStyles(styles); export default function SkillsSection() { const classes = useStyles(); const imageClasses = classNames( // classes.imgRaised, // classes.imgRoundedCircle, classes.imgFluid ); return ( <div className={classes.section}> <div className={classes.typo}> <Quote text="Programming isn't about what you know;" secondLineText="It's about what you can figure out." /> </div> <h2 className={classes.title}>My Skills</h2> <div> <GridContainer> <GridItem xs={12} sm={12} md={3}> <Card plain> <GridItem xs={12} sm={12} md={6} className={classes.itemGrid}> <img src={jsLogo} alt="..." className={imageClasses} /> </GridItem> <h4 className={classes.cardTitle}> Javascript <br /> </h4> </Card> </GridItem> <GridItem xs={12} sm={12} md={3}> <Card plain> <GridItem xs={12} sm={12} md={6} className={classes.itemGrid}> <img src={angularLogo} alt="..." className={imageClasses} /> </GridItem> <h4 className={classes.cardTitle}> Angular <br /> </h4> </Card> </GridItem> <GridItem xs={12} sm={12} md={3}> <Card plain> <GridItem xs={12} sm={12} md={6} className={classes.itemGrid}> <img src={reactLogo} alt="..." className={imageClasses} /> </GridItem> <h4 className={classes.cardTitle}> React JS <br /> </h4> </Card> </GridItem> <GridItem xs={12} sm={12} md={3}> <Card plain> <GridItem xs={12} sm={12} md={6} className={classes.itemGrid}> <img src={nodeJSLogo} alt="..." className={imageClasses} /> </GridItem> <h4 className={classes.cardTitle}> Node.js <br /> </h4> </Card> </GridItem> <GridItem xs={12} sm={12} md={3}> <Card plain> <GridItem xs={12} sm={12} md={6} className={classes.itemGrid}> <img src={postgresLogo} alt="..." className={imageClasses} /> </GridItem> <h4 className={classes.cardTitle}> PostgreSQL <br /> </h4> </Card> </GridItem> <GridItem xs={12} sm={12} md={3}> <Card plain> <GridItem xs={12} sm={12} md={6} className={classes.itemGrid}> <img src={cPlusPlusLogo} alt="..." className={imageClasses} /> </GridItem> <h4 className={classes.cardTitle}> C++ <br /> </h4> </Card> </GridItem> <GridItem xs={12} sm={12} md={3}> <Card plain> <GridItem xs={12} sm={12} md={6} className={classes.itemGrid}> <img src={htmlLogo} alt="..." className={imageClasses} /> </GridItem> <h4 className={classes.cardTitle}> HTML5 <br /> </h4> </Card> </GridItem> <GridItem xs={12} sm={12} md={3}> <Card plain> <GridItem xs={12} sm={12} md={6} className={classes.itemGrid}> <img src={cssLogo} alt="..." className={imageClasses} /> </GridItem> <h4 className={classes.cardTitle}> CSS3 <br /> </h4> </Card> </GridItem> </GridContainer> </div> </div> ); } <file_sep>import React from "react"; // @material-ui/core components import { makeStyles } from "@material-ui/core/styles"; // @material-ui/icons import ScheduleIcon from "@material-ui/icons/Schedule"; import GroupIcon from "@material-ui/icons/Group"; import WhatshotIcon from "@material-ui/icons/Whatshot"; // core components import GridContainer from "components/Grid/GridContainer.js"; import GridItem from "components/Grid/GridItem.js"; import InfoArea from "components/InfoArea/InfoArea.js"; import styles from "assets/jss/material-kit-react/views/landingPageSections/introStyle.js"; import Quote from "components/Typography/Quote"; const useStyles = makeStyles(styles); export default function IntroSection() { const classes = useStyles(); return ( <div className={classes.section}> <GridContainer justify="center"> <GridItem xs={12} sm={12} md={8}> <h2 className={classes.title}>Keeping it simple</h2> <h5 className={classes.description}> I{"'"}m <NAME>, 3rd year BSc student in Computer Science and a full stack developer excited and eager to learn and create new skills, improve existing ones and push myself everyday to the limit. </h5> </GridItem> </GridContainer> <div style={{ margin: "40px 0" }}> <Quote text="There are only two kinds of languages:" secondLineText="The ones people complain about and the ones nobody use." /> </div> <div> <GridContainer> <GridItem xs={12} sm={12} md={4}> <InfoArea title="Quick Learning" description="Embrace new challanges and tackle them with full power, Never pass up on the opportunity to feed my mind. Every great programmer started with a what seemed to be a complicated line of code of greeting the world" icon={ScheduleIcon} iconColor="info" vertical /> </GridItem> <GridItem xs={12} sm={12} md={4}> <InfoArea title="Team Player" description="Never stop learning and teaching. We are all pieces of the puzzle and there is a limit to what an individual can achieve on his own. I believe my companions should always be heared and anyone can and should contribute." icon={GroupIcon} iconColor="success" vertical /> </GridItem> <GridItem xs={12} sm={12} md={4}> <InfoArea title="Passion" description="Nothing can top the feeling of watching my code become an impressive application or a complete functioning system. LOVE to make something out of nothing! do what you love and you will never work a day in your life." icon={WhatshotIcon} iconColor="danger" vertical /> </GridItem> </GridContainer> </div> </div> ); } <file_sep>If opportunity doesn't knock, Build a door. A WINNER is just a LOSER who tried one more time.<file_sep># Deploy instructions: - git commit + push - npm run build - npm run deploy - Github repo settings -> Github Pages -> set Custom domain <file_sep>import { title } from "assets/jss/material-kit-react.js"; const introStyle = { section: { padding: "70px 0 0 0", textAlign: "center" }, title: { ...title, marginBottom: "1rem", marginTop: "30px", minHeight: "32px", textDecoration: "none" }, description: { color: "#777" } }; export default introStyle; <file_sep>import React from "react"; // nodejs library that concatenates classes import classNames from "classnames"; // @material-ui/core components import { makeStyles } from "@material-ui/core/styles"; // @material-ui/icons // core components import Header from "components/Header/Header.js"; import Footer from "components/Footer/Footer.js"; import GridContainer from "components/Grid/GridContainer.js"; import GridItem from "components/Grid/GridItem.js"; import Button from "components/CustomButtons/Button.js"; import HeaderLinks from "components/Header/HeaderLinks.js"; import Parallax from "components/Parallax/Parallax.js"; import styles from "assets/jss/material-kit-react/views/landingPage.js"; // Sections for this page import IntroSection from "./Sections/IntroSection.js"; import SkillsSection from "./Sections/SkillsSection.js"; import WorkSection from "./Sections/WorkSection.js"; // Backgrounds import newYorkBg from "assets/img/newyorkbg.jpg"; import cityBg from "assets/img/287214.jpg"; import skyBlueSparkBg from "assets/img/1072245.png"; let changePosition = false; let bg = null; const isParallaxSmall = window.innerWidth < 700 ? true : false; (() => { const num = Math.floor(Math.random() * 100); if (num < 33) { bg = newYorkBg; } else if (num > 66) { bg = cityBg; } else { changePosition = true; bg = skyBlueSparkBg; } })(); const dashboardRoutes = []; const useStyles = makeStyles(styles); export default function LandingPage(props) { const classes = useStyles(); const { ...rest } = props; return ( <div> <Header color="transparent" routes={dashboardRoutes} brand="<NAME>" rightLinks={<HeaderLinks />} fixed changeColorOnScroll={{ height: 400, color: "white" }} {...rest} /> <Parallax filter image={bg} changePosition={changePosition} small={isParallaxSmall} > <div className={classes.container}> <GridContainer> <GridItem xs={12} sm={12} md={5}> <h1 className={classes.title}>Think twice, Code once.</h1> <h4 style={{ fontWeight: 400 }}> {/*There are only two kinds of languages: the ones people complain about and the ones nobody use.*/} If you want to be successful, It{"'"}s just this simple. Know what you are doing, Love what you are doing and believe in what you are doing. </h4> <br /> {/*<Button color="danger" size="lg" href="https://www.youtube.com/watch?v=dQw4w9WgXcQ&ref=creativetim" target="_blank" rel="noopener noreferrer" > <i className="fas fa-play" /> Watch video </Button>*/} </GridItem> </GridContainer> </div> </Parallax> <div className={classNames(classes.main, classes.mainRaised)}> <div className={classes.container}> <IntroSection /> <SkillsSection /> {/*<WorkSection />*/} </div> </div> <div style={{ height: "50px" }}></div> </div> ); } <file_sep># saharbec.github.io
0850231cc17394919f153312f00896dd49de5df8
[ "JavaScript", "Markdown" ]
7
JavaScript
saharbec/personal
efe82a409dfa09263897c3106959764e422d144d
ba2fcec8f2eed2840dfc24d8484145907d3f7870
refs/heads/master
<file_sep>function mostrar() { var edadIngresada; edadIngresada = txtIdEdad.value; edadIngresada = parseInt(edadIngresada); //Al ingresar una edad que sea igual a 15, mostrar el mensaje "Niña bonita". if( edadIngresada == 15 ) { alert("Niña bonita"); } } //FIN DE LA FUNCIÓN<file_sep>function mostrar() { var edad; edad = txtIdEdad.value; edad = parseInt(edad); /* Supongamos que la variable "EDAD", vale "15", entonces la variable que es 15 le va a preguntar si es menor que 13 por lo tanto es "FALSE". Ahora la variable "EDAD" que vale 15 le va a preguntar si es mayor que 17 por lo tanto es "FALSE". Entonces si (edad < 13) = FALSE y (edad > 17) = FALSE Y el operador lógico "||" (OR), su resultado es true si alguno de los dos operandos es "TRUE" Por lo tanto FALSE y FALSE = FALSE (Porque ninguno de los dos operandos es "TRUE"). Entonces va a acudir al "ALERT", y va a decir que "NO ES ADOLESCENTE", ya que con el operador "||", lo niega diciendo que es FALSO. */ if ( edad < 13 || edad > 17 ) { alert("No es adolescente"); } }//FIN DE LA FUNCIÓN<file_sep>/* Debemos lograr tomar un dato por 'PROMPT' y lo muestro por 'ID' al presionar el botón 'mostrar' */ function mostrar() { //Declaro la variable var nombreIngresado; //A la variable asignada, le ponemos el PROMPT nombreIngresado=prompt("Ingrese su nombre", "Su nombre"); //En la caja de texto va a aparecer el nombre que el usuario puso en el PROMPT txtIdNombre.value = nombreIngresado; } /*Se pide un importe y un porcentaje descuento por prompt y se muestra el importe con el descuento por alert con el mensaje " el importe es $ xxxx el total de descuento es $xxx y el precio final es $xxx, gracias por su compra" */ { var importeIngresado; var descuento; var importeConAumento; importeIngresado = prompt("Ingrese importe"); importeIngresado = descuento = importeIngresado*14/100; prompt(" Importe y Porcentaje descuento" ); importeConAumento = importeIngresado*descuento; alert("El importe es $ + " importeIngresado " el total de descuento es "descuento" y el precio final es " importeConAumento", gracias por su compra"); } <file_sep>/* Al presionar el botón, se debe mostrar un mensaje como el siguiente "Esto funciona de maravilla"*/ function mostrar() { alert("Esto funciona de maravilla"); // Esto muestra un mensaje de alerta /* Esto es un comentario de bloque */ // Esto es un comentario de linea } <file_sep> function mostrar() { var edad; edad = txtIdEdad.value; edad = parseInt(edad); /* Al ingresar una edad debemos informar si la persona es mayor de edad (mas de 18 años) o adolescente (entre 13 y 17 años) o niño (menor a 13 años). */ if( edad >= 18) { alert("Es mayor de edad"); } if( edad >= 13 && edad <= 17) { alert("Es adolescente"); } if( edad <= 12) { alert("Es un niño"); } }//FIN DE LA FUNCIÓN /* Esta es otra manera de hacer ya que hacemos un IF/ELSE y dentro del else ponemos otro IF/ELSE. Con el "ELSE" lo que hacemos es ahorranos una condición osea un "IF" ya que por ej: Si no es menor de edad, por defecto lo que hace el "ELSE" seria mayor de edad, ya que por descarte es la condició que queda. */ /* function mostrar() { var edad; edad = txtIdEdad.value; edad = parseInt(edad); if( edad <= 12 ) { alert("Es un niño"); } else { if( edad >= 13 && edad <= 17 ) { alert("Es adolescente"); } else { alert("Es mayor de edad"); } } }//FIN DE LA FUNCIÓN */ <file_sep>/* Al presionar el Botón, asignar una nota RANDOM al examen y mostrar: "EXCELENTE" para notas igual a 9 o 10, "APROBÓ" para notas mayores a 4, "Vamos, la proxima se puede" para notas menores a 4 */ function mostrar() { var nota; nota = Math.round(Math.random() * 9 + 1); if( nota >= 9 ) { alert("Excelente: Nota " + nota); // NOTAS IGUAL A 9 O 10 } else if( nota < 4 ) { alert("Vamos, la proxima se puede: Nota " + nota); // NOTAS MENORES 4 } else { alert("Aprobo: Nota " + nota); // NOTAS MAYORES A 4 } }//FIN DE LA FUNCIÓN<file_sep>/* al seleccionar un mes informar. si es Febrero: " Este mes no tiene más de 29 días." si NO es Febrero: "Este mes tiene 30 o más días" */ function mostrar() { var mes; mes = document.getElementById("txtIdMes").value; switch(mes) { case "Febrero": alert("Este mes tiene mas de 29 dias"); break; case "Enero": case "Marzo": case "Abril": case "Mayo": case "Junio": case "Julio": case "Agosto": case "Septiembre": case "Octubre": case "Noviembre": case "Diciembre": alert("Este mes tiene 30 dias o mas"); break; } }//FIN DE LA FUNCIÓN /* EN ESTE CASO DA EL MISMO RESULTADO NADA MAS QUE EN VEZ DE ESCRIBIR TODO LOS MESES QUE QUEDAN POR DEFAULT USAMOS EL "DEFAULT:" QUE ACTUARIA COMO EL "ELSE" EN EL "IF", PERO ESTE ACTUA EN EL SWITCH IF/ELSE SWITCH/DEFAULT */ /* function mostrar() { var mes; mes = document.getElementById("txtIdMes").value; switch(mes) { case "Febrero": alert("Este mes tiene mas de 29 dias"); break; default: // Se usa para lo que queda por defecto, seria como un "else" en un "if", aca es "default" en un "switch". alert("Este mes tiene 30 dias o mas"); break; } }//FIN DE LA FUNCIÓN */ <file_sep> //Al presionar el Botón, mostrar un número Random del 1 al 10 inclusive function mostrar() { let numero; let maximo = 10; let minimo = 1; numero = Math.round(Math.random() * (maximo - minimo) + minimo); alert(numero); }//FIN DE LA FUNCIÓN<file_sep>/* Debemos lograr tomar un nombre con 'prompt' y luego mostrarlo por 'alert' al presionar el botón 'mostrar'*/ function mostrar() { //Declaro o creo variable var nombreIngresado; //Asigno o cargo la variable nombreIngresado = prompt("Ingrese su nombre", "Su nombre"); //Muestro el valor de la variable mediante el alert alert("Su nombre es: "+nombreIngresado); }
e98a529946c6c9361c1d56371cb8d8fc2f2ee4b7
[ "JavaScript" ]
9
JavaScript
Joaquin893/CursoIngresoJS
9584c6b3027cfc7f620deeed568c4957ab2e9fa8
514cc355212c07a3e99ed3b3b78bab10b903bce7
refs/heads/master
<file_sep>import puppeteer from 'puppeteer'; export default class LBCParser { constructor(url) { this.url = url; this.succeed = false; //<a title="Maison 3 pièces 71 m²" class="clearfix trackable" rel="nofollow" href="/ventes_immobilieres/1422744026.htm/" data-reactid="544"> } async getAdverts() { let browser = null, page = null; try { browser = await this.openBrowser(); page = await browser.newPage(); await page.setRequestInterception(true); page.on('request', (request) => { const headers = request.headers(); headers['Accept'] = 'text/html'; headers['Accept-Language'] = 'fr,en'; headers['Accept-Encoding'] = 'identity'; request.continue({headers}); }); await page.goto(this.url, {waitUntil: 'domcontentloaded'}); const hrefs = await page.evaluate(() => { const anchors = document.querySelectorAll('a'); return [].map.call(anchors, a => a.href); }); this.succeed = true; await page.close(); await browser.close(); let regex = new RegExp('https:\/\/www\.leboncoin\.fr\/ventes_immobilieres\/[0-9]+\.htm\/', 'g'); return hrefs.filter(link => { return regex.test(link); }); } catch (e) { console.log('retry', e); if (null !== page) { await page.close(); } if (null !== browser) { await browser.close(); } if (false === this.succeed) { await this.getAdverts(); } } } async openBrowser() { return await puppeteer.launch({ headless: false, ignoreHTTPSErrors: true, args:[ '--window-position=0,0', '--window-size=50,50', '--no-sandbox', '--disable-dev-shm-usage', '--enable-features=NetworkService', '--ignore-certificate-errors' ] }); } }<file_sep>import LBCParser from './LBCParser.js'; import fs from 'fs'; import nodemailer from "nodemailer"; import dns from 'dns'; let lbcUrl = 'https://www.leboncoin.fr/recherche/?category=9&locations=Nantes&real_estate_type=1&price=min-325000&rooms=3-max&square=70-max'; let fileName = '/Users/florian/www/ImmoSelf/ad.json'; (async () => { let hasInternet = false; try { await dns.promises.resolve('www.google.com'); hasInternet = true; } catch (e) {} if (!hasInternet) return; let newLinks = []; let lbc = new LBCParser(lbcUrl); newLinks = newLinks.concat(await lbc.getAdverts()); let oldLinks = []; if (fs.existsSync(fileName)) { try { oldLinks = JSON.parse(fs.readFileSync(fileName)); } catch (e) {} let newAds = []; newLinks.forEach(link => { if (-1 === oldLinks.indexOf(link)) { newAds.push(link); } }); newAds = newAds.filter(function (el) { return el != null; }); if (oldLinks.length > 0 && newAds.length > 0) { var transporter = nodemailer.createTransport({ service: 'gmail', auth: { user: '<EMAIL>', pass: '<PASSWORD>' } }); const mailOptions = { from: '<EMAIL>', // sender address to: '<EMAIL>, <EMAIL>', // list of receivers subject: 'Nouvelles annonces immobilières pour nous', // Subject line html: newAds.join("<br/>\n") }; transporter.sendMail(mailOptions); } } let allAds = Array.from(new Set(newLinks.concat(oldLinks))); fs.writeFileSync(fileName, JSON.stringify(allAds)); })();<file_sep>.PHONY: help ## Colors COLOR_RESET = \033[0m COLOR_ERROR = \033[31m COLOR_INFO = \033[32m COLOR_COMMENT = \033[33m COLOR_TITLE_BLOCK = \033[0;44m\033[37m ## Help help: @printf "${COLOR_TITLE_BLOCK}ImmoSelf Makefile${COLOR_RESET}\n" @printf "\n" @printf "${COLOR_COMMENT}Usage:${COLOR_RESET}\n" @printf " make [target]\n\n" @printf "${COLOR_COMMENT}Available targets:${COLOR_RESET}\n" @awk '/^[a-zA-Z\-\_0-9\@]+:/ { \ helpLine = match(lastLine, /^## (.*)/); \ helpCommand = substr($$1, 0, index($$1, ":")); \ helpMessage = substr(lastLine, RSTART + 3, RLENGTH); \ printf " ${COLOR_INFO}%-16s${COLOR_RESET} %s\n", helpCommand, helpMessage; \ } \ { lastLine = $$0 }' $(MAKEFILE_LIST) compile: webpack --config webpack.config.js index.js -o main.js run: node main.js
d46b956dc56e9bf8dd414bf0426cae4c7d4a4c84
[ "JavaScript", "Makefile" ]
3
JavaScript
Diwatt/ImmoSelf
3ab3219e0796e15c59e072ee7f4b2071c7b22f9b
1b6026bfee361da376bdc3567ab00820ca74373f
refs/heads/master
<repo_name>markrcote/bugzfeed<file_sep>/bugzfeed/websocket.py # This Source Code Form is subject to the terms of the Mozilla Public # License, v. 2.0. If a copy of the MPL was not distributed with this file, # You can obtain one at http://mozilla.org/MPL/2.0/. import json import tornado.websocket from bugzfeed import __version__ as bugzfeed_version from bugzfeed.subscriptions import subscriptions, BadBugId class WebSocketHandler(tornado.websocket.WebSocketHandler): def on_message(self, message): decoded = json.loads(message) command = decoded['command'] result = 'ok' extra_attrs = {} cb = None cb_args = [] try: if command == 'subscribe': cb = subscriptions.subscribe(decoded['bugs'], self) if decoded.get('since'): cb = subscriptions.catch_up cb_args = [decoded['bugs'], decoded['since'], self] extra_attrs['bugs'] = subscriptions.subscriptions(self) elif command == 'unsubscribe': subscriptions.unsubscribe(decoded['bugs'], self) extra_attrs['bugs'] = subscriptions.subscriptions(self) elif command == 'subscriptions': extra_attrs['bugs'] = subscriptions.subscriptions(self) elif command == 'version': extra_attrs['version'] = bugzfeed_version else: result = 'error' extra_attrs['error'] = 'invalid command' except KeyError, e: result = 'error' extra_attrs['error'] = 'missing mandatory arg: %s' % e except BadBugId: result = 'error' extra_attrs['error'] = 'invalid bug id; must be integer' response = {'result': result, 'command': command} response.update(extra_attrs) self.write_message(json.dumps(response)) if cb: cb(*cb_args) def on_close(self): subscriptions.connection_closed(self) <file_sep>/bugzfeed/subscriptions.py # This Source Code Form is subject to the terms of the Mozilla Public # License, v. 2.0. If a copy of the MPL was not distributed with this file, # You can obtain one at http://mozilla.org/MPL/2.0/. import json import logging from collections import defaultdict class BadBugId(Exception): pass class BugSubscriptions(object): def __init__(self): self.conn_bug_map = defaultdict(set) self.bug_conn_map = defaultdict(set) self.message_cache = None def catch_up(self, bug_ids, since, connection): if not self.message_cache: return for m in self.message_cache.query(self._bug_ids(bug_ids), since): connection.write_message(json.dumps(m)) def subscribe(self, bug_ids, connection): bug_ids = self._bug_ids(bug_ids) for bug_id in bug_ids: self.bug_conn_map[bug_id].add(connection) self.conn_bug_map[connection].add(bug_id) def unsubscribe(self, bug_ids, connection): bug_ids = self._bug_ids(bug_ids) for bug_id in bug_ids: try: self.bug_conn_map[bug_id].remove(connection) self.conn_bug_map[connection].remove(bug_id) except KeyError: logging.warning('Failed to unsubscribe connection %s from ' 'bug %d.' % (connection, bug_id)) def subscriptions(self, connection): if connection not in self.conn_bug_map: return [] return list(self.conn_bug_map[connection]) def connection_closed(self, connection): bugs = list(self.conn_bug_map[connection]) for b in bugs: self.unsubscribe(b, connection) def update(self, u): self.bug_updated(*u) def bug_updated(self, bug_id, when): msg = {'command': 'update', 'bug': bug_id, 'when': when} txt = json.dumps(msg) if self.message_cache: self.message_cache.update(msg) for c in self.bug_conn_map[bug_id]: logging.debug('Alerting connection %d that bug %d changed at %s.' % (id(c), bug_id, when)) c.write_message(txt) @staticmethod def _bug_ids(bug_ids): if isinstance(bug_ids, int) or isinstance(bug_ids, basestring): bug_ids = [bug_ids] if isinstance(bug_ids, list): try: return [int(i) for i in bug_ids] except (TypeError, ValueError): raise BadBugId() return [] subscriptions = BugSubscriptions() <file_sep>/bugzfeed/cache.py # This Source Code Form is subject to the terms of the Mozilla Public # License, v. 2.0. If a copy of the MPL was not distributed with this file, # You can obtain one at http://mozilla.org/MPL/2.0/. import errno import json class MessageCache(object): MAX_MESSAGES = 10000 def __init__(self, filename): self.filename = filename self.messages = [] self.load() def load(self): try: self.messages = json.loads(file(self.filename, 'r').read()) except IOError, e: if e.errno != errno.ENOENT: raise self.messages = [] def flush(self): file(self.filename, 'w').write(json.dumps(self.messages)) def update(self, message): self.messages.append(message) self.messages = self.messages[-self.MAX_MESSAGES:] self.flush() def query(self, bug_ids, since): for m in self.messages: if m['bug'] in bug_ids and m['when'] >= since: yield m <file_sep>/bugzfeed/server.py # This Source Code Form is subject to the terms of the Mozilla Public # License, v. 2.0. If a copy of the MPL was not distributed with this file, # You can obtain one at http://mozilla.org/MPL/2.0/. import logging import socket import sys from collections import defaultdict import tornado.ioloop import tornado.options import tornado.web from bugzfeed.cache import MessageCache from bugzfeed.pulse import ListenerThread from bugzfeed.subscriptions import subscriptions from bugzfeed.websocket import WebSocketHandler def define_group_opt(group, name, **kwargs): kwargs['group'] = group tornado.options.define('%s_%s' % (group, name), **kwargs) tornado.options.define('address', default='', help='server IP address, defaults to 0.0.0.0', type=str) tornado.options.define('port', default=8844, help='server port', type=int) tornado.options.define('config', default=None, help='path to config file', type=str, callback=lambda path: \ tornado.options.parse_config_file(path, final=False)) tornado.options.define('cache', default='bugzfeed_cache.json', help='path to cache file', type=str) define_group_opt('pulse', 'host', default=None, help='pulse host name or IP', type=str) define_group_opt('pulse', 'port', default=None, help='pulse host port', type=int) define_group_opt('pulse', 'vhost', default=None, help='pulse vhost', type=str) define_group_opt('pulse', 'user', default=None, help='pulse username', type=str) define_group_opt('pulse', 'password', default=None, help='pulse password', type=str) define_group_opt('pulse', 'broker_timezone', default=None, help='pulse timezone', type=str) define_group_opt('pulse', 'applabel', default=None, help='pulse queue name; defaults to ' '"bugzfeed-<local hostname>"', type=str) define_group_opt('pulse', 'durable', default=False, help='use a durable queue in case of server interruptions', type=bool) define_group_opt('pulse', 'dev', default=False, help='use dev pulse exchange', type=bool) application = tornado.web.Application([ (r'/', WebSocketHandler), ]) def get_pulse_cfg(pulse_opts): # Preserve only options with values so that pulse config defaults can be # used. pulse_cfg = dict([(k, v) for (k, v) in pulse_opts.iteritems() if v is not None]) if not pulse_cfg.get('applabel'): pulse_cfg['applabel'] = 'bugzfeed-%s' % socket.gethostname() return pulse_cfg def main(opts_global, opts_groups): pulse_cfg = get_pulse_cfg(opts_groups['pulse']) subscriptions.message_cache = MessageCache(opts_global['cache']) ioloop = tornado.ioloop.IOLoop.instance() def bug_updated(updates): ioloop.add_callback(subscriptions.update, updates) logging.info('Starting Pulse listener.') listener = ListenerThread(pulse_cfg, bug_updated) listener.start() logging.info('Starting WebSocket server on port %d.' % opts_global['port']) logging.debug('Debug logs enabled.') application.listen(opts_global['port'], address=opts_global['address']) try: ioloop.start() except KeyboardInterrupt: return def get_opts(options): """Separates options into globals and groups and translates to dicts.""" opts_global = tornado.options.options.as_dict() opts_groups = defaultdict(dict) for group in tornado.options.options.groups(): for k, v in opts_global.items(): if k.startswith('%s_' % group): opts_groups[group][k[len(group)+1:]] = v del opts_global[k] return (opts_global, dict(opts_groups)) def cli(): try: tornado.options.parse_command_line() except tornado.options.Error, e: print >> sys.stderr, e sys.exit(1) opts_global, opts_groups = get_opts(tornado.options.options) main(opts_global, opts_groups) if __name__ == '__main__': cli()
35a6171a628ccb68062100be395e4ec120bbb326
[ "Python" ]
4
Python
markrcote/bugzfeed
9c4593dd39ff65c57c2f5e9d2974d95babeb26ad
619d8b0ad69ad6077f4f7d6cb2ede9ce61862200
refs/heads/master
<file_sep>const {area,perimeter} =require('module-sonu-code') console.log(area(0.5)); console.log(perimeter(5));<file_sep>import Vue from "vue"; import Vuex from "vuex"; Vue.use(Vuex); export default new Vuex.Store({ state: { msg: "hello", count: 0 }, mutations: { fun(state, payload) { state.count += payload; console.log(state.count); }, data_received(state, payload) { state.count += payload; console.log(state.count); } }, getters: { getdata(state) { return state.count; } }, actions: { func({ commit }, payload) { console.log(payload); commit("data_received", payload); } } });
f3021915fc010e7abd18ae2328cc050351673dcd
[ "JavaScript" ]
2
JavaScript
vermasonu791/demo-theme
5e8a6bd7c8ba84bb073b944fafa5c0e15d7238bf
f6793c0e5fefe24cbfb55a9a67812fd1a451e431
refs/heads/main
<repo_name>Reversive/eso-quest-info<file_sep>/quest_info.lua -- Test addon just to test the quest api, first use is in line 41 QuestInfo = {} QuestInfo.GUI = { open = false, visible = true, } function QuestInfo.ModuleInit() ml_gui.ui_mgr:AddMember({ id = "ESOMINION##MENU_QUESTER", name = "QuestInfo", onClick = function() QuestInfo.GUI.open = not QuestInfo.GUI.open end, tooltip = "Open the QuestInfo addon."}, "ESOMINION##MENU_HEADER") QuestLib.GetZoneMeasurement() end function QuestInfo.DrawCall(event, ticks) if (QuestInfo.GUI.open) then GUI:SetNextWindowPosCenter(GUI.SetCond_Appearing) GUI:SetNextWindowSize(500, 400, GUI.SetCond_FirstUseEver) QuestInfo.GUI.visible, QuestInfo.GUI.open = GUI:Begin("QuestInfo", QuestInfo.GUI.open) if ( QuestInfo.GUI.visible ) then local game_state = GetGameState() if ( GUI:TreeNode("Zone Quests - " .. e("GetPlayerActiveZoneName()")) ) then if( game_state == 3 ) then local zone_quests = QuestLib.GetZoneQuests() for _, quest in pairs(zone_quests) do local qid = QuestLib.GetQuestId(quest) local qname = QuestLib.GetQuestName(qid) if ( not QuestLib.IsQuestComplete(qid, true) and GUI:TreeNode(tostring(qid) .. " - " .. qname) ) then GUI:BulletText(".id = ".. qid) GUI:BulletText(".name = ".. qname) GUI:BulletText(".giver = ".. QuestLib.GetQuestGiverName(quest)) GUI:BulletText(".giver_id = ".. QuestLib.GetQuestGiverId(quest)) local global_x, global_z = QuestLib.GetQuestGlobalPosition(quest) GUI:BulletText(".x = ".. global_x) GUI:BulletText(".z = ".. global_z) GUI:TreePop() end end else GUI:Text("Not Ingame...") end GUI:TreePop() end end end end RegisterEventHandler("Module.Initalize", QuestInfo.ModuleInit, "QuestInfo.ModuleInit") RegisterEventHandler("Gameloop.Draw", QuestInfo.DrawCall, "QuestInfo.DrawCall") <file_sep>/quest_lib_utils.lua local utils = _G["QuestLibUtils"] local internal = _G["QuestLibInternal"] utils.measurements = {} utils.quest_index = { local_x = 1, local_y = 2, global_x = 3, global_y = 4, quest_id = 5, quest_giver = 6 } utils.quest_data_index = { quest_type = 1, -- MAIN_STORY, DUNGEON << -1 = Undefined >> quest_repeat = 2, -- quest_repeat_daily, quest_repeat_not_repeatable = 0, quest_repeat_repeatable << -1 = Undefined >> game_api = 3, -- 100003 means unverified, 100030 or higher means recent quest data quest_line = 4, -- QuestLine (10000 = not assigned/not verified. 10001 = not part of a quest line/verified) quest_number = 5, -- Quest Number In QuestLine (10000 = not assigned/not verified) quest_series = 6, -- None = 0, Cadwell's Almanac = 1, Undaunted = 2, AD = 3, DC = 4, EP = 5. } utils.quest_series_type = { quest_type_none = 0, quest_type_cadwell = 1, quest_type_undaunted = 2, quest_type_ad = 3, quest_type_dc = 4, quest_type_ep = 5, quest_type_guild_mage = 6, quest_type_guild_fighter = 7, quest_type_guild_psijic = 8, quest_type_guild_thief = 9, quest_type_guild_dark = 10, } internal.quest_guild_rank_data = { [utils.quest_series_type.quest_type_undaunted] = { name = "", rank = 0, }, [utils.quest_series_type.quest_type_guild_mage] = { name = "", rank = 0, }, [utils.quest_series_type.quest_type_guild_fighter] = { name = "", rank = 0, }, [utils.quest_series_type.quest_type_guild_psijic] = { name = "", rank = 0, }, [utils.quest_series_type.quest_type_guild_thief] = { name = "", rank = 0, }, [utils.quest_series_type.quest_type_guild_dark] = { name = "", rank = 0, }, } local function TextureSplit(inputstr) local t = {} for str in string.gmatch(inputstr, "([^%/]+)") do table.insert(t, str) end return t end function utils:GetZoneAndSubzone(alternative, bStripUIMap, bKeepMapNum) local mapTexture = string.lower(e("GetMapTileTexture()")) mapTexture = mapTexture:gsub("^.*/maps/", "") if bStripUIMap == true then mapTexture = mapTexture:gsub("ui_map_", "") end mapTexture = mapTexture:gsub("%.dds$", "") if not bKeepMapNum then mapTexture = mapTexture:gsub("%d*$", "") mapTexture = mapTexture:gsub("_+$", "") end if alternative then return mapTexture end return unpack(TextureSplit(mapTexture)) end function utils:GetQuestName(id) return internal.quest_names[id] or "unknown" end function IsTableEmpty(table) return not table or next(table) == nil end function utils:IsEmptyOrNil(t) if t == nil or t == "" then return true end return type(t) == "table" and IsTableEmpty(t) or false end function utils:DeepTableCopy(source, dest) dest = dest or {} setmetatable (dest, getmetatable(source)) for k, v in pairs(source) do if type(v) == "table" then dest[k] = utils:DeepTableCopy(v) else dest[k] = v end end return dest end function utils:GetZoneMeasurement() local zone = e("GetPlayerActiveZoneName()") if utils.measurements[zone] then return utils.measurements[zone][1], utils.measurements[zone][2], utils.measurements[zone][3] end e("SetMapToMapListIndex(1)") local centerX, _, centerY = e("GuiRender3DPositionToWorldPosition(0,0,0)") local stepX = centerX - 125000 local stepY = centerY - 125000 local success = e("SetPlayerWaypointByWorldLocation(" .. tostring(stepX) .. ",0," .. tostring(stepY) .. ")") if success then local firstX, firstY = e("GetMapPlayerWaypoint()") local step2X = centerX + 125000 local step2Y = centerY + 125000 success = e("SetPlayerWaypointByWorldLocation(" .. tostring(step2X) .. ",0," .. tostring(step2Y) .. ")") if success then local secondX, secondY = e("GetMapPlayerWaypoint()") if firstX ~= secondX and firstY ~= secondY then local currentGlobalToWorldFactor = 2 * 2500 / (secondX - firstX + secondY - firstY) local currentOriginGlobalX = (firstX + secondX) * 0.5 - centerX * 0.01 / currentGlobalToWorldFactor local currentOriginGlobalY = (firstY + secondY) * 0.5 - centerY * 0.01 / currentGlobalToWorldFactor utils.measurements[zone] = {currentGlobalToWorldFactor, currentOriginGlobalX, currentOriginGlobalY} return currentGlobalToWorldFactor, currentOriginGlobalX, currentOriginGlobalY end end end end function utils:GlobalToWorld(globalX, globalY) local globalToWorldFactor, originGlobalX, originGlobalY = utils:GetZoneMeasurement() local worldX = (globalX - originGlobalX) * globalToWorldFactor local worldZ = (globalY - originGlobalY) * globalToWorldFactor return worldX, worldZ end<file_sep>/quest_lib_questgivers.lua local internal = _G["QuestLibInternal"] internal.quest_givers = { [1] = "Prologue", [601] = "<NAME>", [901] = "<NAME>", [906] = "<NAME>", [1872] = "<NAME>", [1953] = "<NAME>", [2048] = "Mercenary", [2089] = "<NAME>", [2321] = "<NAME>", [2442] = "<NAME>", [2697] = "<NAME>", [3134] = "<NAME>", [4904] = "<NAME>", [4982] = "<NAME>", [5057] = "<NAME>", [5126] = "Dro-Dara", [5127] = "Knarstygg", [5269] = "<NAME>", [5298] = "<NAME>", [5424] = "<NAME>", [5444] = "<NAME>", [5697] = "<NAME>", [5752] = "<NAME>", [5830] = "<NAME>", [5837] = "<NAME>", [5880] = "<NAME>", [5894] = "<NAME>", [5897] = "<NAME>", [6016] = "<NAME>", [6017] = "<NAME>", [6062] = "<NAME>", [6063] = "<NAME>", [6188] = "Watch Captain Rama", [6216] = "<NAME>", [6225] = "Watch Commander Kurt", [6235] = "<NAME>", [6332] = "Watch Captain Ernard", [6359] = "<NAME>", [6396] = "High King Emeric", [6505] = "<NAME>", [6624] = "<NAME>", [6849] = "<NAME>", [6898] = "<NAME>", [8204] = "<NAME>", [8250] = "<NAME>", [8959] = "Ufa the Red Asp", [9320] = "<NAME>", [9479] = "<NAME>", [10098] = "<NAME>", [10099] = "Gurlak", [10107] = "<NAME>", [10165] = "<NAME>", [10193] = "<NAME>", [10355] = "<NAME>-Gar", [10533] = "Kasal", [10575] = "<NAME>", [10714] = "Rajesh", [10758] = "Gold Coast Scout", [10884] = "Talia at-Marimah", [11019] = "Corpse", [11315] = "Qadim", [11580] = "<NAME>", [11639] = "Hubert", [11776] = "<NAME>", [11987] = "M'jaddha", [11994] = "<NAME>", [12012] = "<NAME>", [12025] = "<NAME>", [13001] = "<NAME>", [13020] = "<NAME>", [13123] = "<NAME>", [13134] = "<NAME>", [13156] = "<NAME>", [13318] = "<NAME>", [13490] = "Banekin", [13965] = "Grand Warlord Sorcalin", [13982] = "<NAME>", [13983] = "Giblets", [13988] = "<NAME>", [14080] = "Guardian of the Water", [14087] = "Daggerfall Patroller", [14090] = "<NAME>", [14096] = "<NAME>", [14098] = "<NAME>", [14110] = "<NAME>", [14118] = "<NAME>", [14180] = "<NAME>", [14194] = "<NAME>", [14261] = "<NAME>", [14299] = "<NAME>", [14308] = "<NAME>", [14328] = "Bumnog", [14341] = "<NAME>", [14358] = "<NAME>", [14382] = "High Priest Zuladr", [14464] = "<NAME>", [14532] = "<NAME>", [14580] = "<NAME>", [14619] = "<NAME>", [14648] = "<NAME>", [14660] = "<NAME>", [14678] = "<NAME>", [14708] = "<NAME>", [14763] = "<NAME>", [14810] = "<NAME>", [14811] = "<NAME>", [14869] = "<NAME>", [14970] = "<NAME>", [14992] = "<NAME>", [15015] = "<NAME>", [15034] = "Ildani", [15047] = "<NAME>", [15079] = "<NAME>", [15340] = "Stibbons", [15342] = "<NAME>", [15350] = "<NAME>", [15496] = "<NAME>", [15531] = "Letta", [15595] = "<NAME>", [15620] = "<NAME>", [15651] = "<NAME>", [15680] = "Shiri", [15705] = "<NAME>", [15843] = "Sir <NAME>", [15876] = "<NAME>", [15877] = "Kahaba", [15984] = "<NAME>", [16111] = "Hayazzin", [16147] = "<NAME>", [16170] = "Royal Bodyguard", [16239] = "Anjan", [16430] = "Hadoon", [16507] = "<NAME>", [16574] = "Onwyn", [16579] = "<NAME>", [16601] = "Musi", [16686] = "Recruit Thomas", [16696] = "<NAME>", [16730] = "Rahannal", [16828] = "<NAME>", [16984] = "Jarrod", [17131] = "<NAME>", [17185] = "<NAME>", [17186] = "<NAME>", [17262] = "<NAME>", [17269] = "Nemarc", [17393] = "<NAME>", [17394] = "<NAME>", [17439] = "<NAME>", [17482] = "Ayma", [17508] = "<NAME>", [17658] = "<NAME>", [17832] = "<NAME>", [17887] = "Yarah", [18095] = "Count Verandis Ravenwatch", [18238] = "<NAME>", [18239] = "<NAME>", [18241] = "Pact Soldier", [18317] = "<NAME>", [18365] = "Holgunn", [18366] = "<NAME>", [18372] = "<NAME>", [18373] = "<NAME>", [18374] = "Reesa", [18377] = "Aeridi", [18378] = "<NAME>", [18379] = "Rorygg", [18380] = "Soft-Scale", [18405] = "<NAME>", [18427] = "Ix-Utha", [18436] = "<NAME>", [18506] = "Walks-in-Ash", [18549] = "<NAME>", [18551] = "<NAME>", [18589] = "Svanhildr", [18640] = "<NAME>", [18642] = "<NAME>", [18647] = "Fendell", [18661] = "<NAME>", [18691] = "<NAME>", [18706] = "Idrasa", [18727] = "<NAME>", [18759] = "<NAME>", [18764] = "<NAME>", [18813] = "Hooks-Fish", [18814] = "Vara-Zeen", [18819] = "Leel-Vata", [18820] = "<NAME>", [18824] = "Cloya", [18826] = "Onuja", [18848] = "<NAME>", [18849] = "<NAME>", [18870] = "<NAME>", [18942] = "Bala", [19003] = "Hrogar", [19004] = "Uggonn", [19030] = "Fafnyr", [19057] = "Sar-Keer", [19099] = "<NAME>", [19148] = "Jin-Ei", [19169] = "<NAME>", [19187] = "Hennus", [19216] = "Nilthis", [19244] = "<NAME>", [19257] = "Zasha-Ja", [19268] = "<NAME>", [19272] = "<NAME>", [19279] = "<NAME>", [19321] = "Azeenus", [19385] = "<NAME>", [19403] = "<NAME>", [19515] = "<NAME>", [19684] = "<NAME>", [19705] = "<NAME>", [19762] = "<NAME>", [19764] = "<NAME>", [19768] = "One-Eye", [19790] = "Kotholl", [19796] = "<NAME>", [19809] = "Neposh", [19826] = "Fervyn", [19843] = "<NAME>", [19901] = "<NAME>", [19929] = "<NAME>", [19933] = "<NAME>", [19939] = "Grandmaster <NAME>", [19941] = "<NAME>", [19947] = "<NAME>", [19958] = "<NAME>", [19960] = "<NAME>", [19963] = "<NAME>", [20052] = "S'jash", [20054] = "Bimee-Kas", [20083] = "Doubts-the-Moon", [20126] = "Saryvn", [20144] = "<NAME>", [20146] = "Qa'tesh", [20182] = "Smashed Dwarven Sphere", [20183] = "<NAME>", [20217] = "Wareem", [20261] = "Kiameed", [20297] = "Daeril", [20342] = "Churasu", [20349] = "Drillk", [20369] = "<NAME>ificer", [20373] = "<NAME>", [20374] = "Healer Ravel", [20436] = "Jilux", [20455] = "Rabeen-Ei", [20475] = "Xijai-Teel", [20476] = "Parash", [20494] = "Padeehei", [20497] = "Gareth", [20499] = "Desha", [20567] = "<NAME>", [20661] = "<NAME>", [20693] = "Almalexia", [20695] = "Elder Seven-Bellies", [20702] = "<NAME>", [20749] = "Ordinator", [21096] = "<NAME>", [21114] = "Sia", [21163] = "Laughs-at-All", [21175] = "Chitakus", [21176] = "<NAME>", [21237] = "Sleeps-with-Open-Eyes", [21261] = "Silent-Moss", [21265] = "Pale-Heart", [21401] = "<NAME>", [21402] = "<NAME>", [21424] = "<NAME>", [21425] = "Orona", [21436] = "<NAME>", [21452] = "<NAME>", [21483] = "Neeta-Li", [21485] = "Kara", [21540] = "<NAME>", [21676] = "<NAME>", [21683] = "<NAME>", [21758] = "Long-Claw", [21762] = "Fast-Finder", [21851] = "Lyranth", [21966] = "Imperial Researcher", [21980] = "<NAME>-Wind", [21987] = "<NAME>", [21993] = "Bezeer", [21994] = "Jurni", [22014] = "Damrina", [22039] = "Tree-Minder Raleetal", [22345] = "Guildmaster Sees-All-Colors", [22368] = "Aelif", [22380] = "<NAME>", [22388] = "Prowls-in-Stealth", [22411] = "Napetui", [22412] = "Sejaijilax", [22425] = "<NAME>", [22426] = "<NAME>", [22461] = "<NAME>", [22486] = "<NAME>", [22487] = "Erranza", [22562] = "<NAME>", [22775] = "Ordinator Gorili", [22792] = "Tree-Minder", [22864] = "Looks-Under-Rocks", [22909] = "Ganthis", [23029] = "Nosaleeth", [23111] = "<NAME>", [23205] = "Arch-Mage Valeyn", [23215] = "<NAME>", [23219] = "Knave of Rooks", [23267] = "<NAME>", [23353] = "<NAME>", [23400] = "Tah-Tehat", [23455] = "Pri<NAME>", [23459] = "Valaste", [23460] = "Arch-Mage Shalidor", [23503] = "Nojaxia", [23511] = "<NAME>", [23512] = "Engling", [23528] = "<NAME>", [23534] = "Dajaheel", [23535] = "<NAME>", [23545] = "Jaknir", [23584] = "<NAME>", [23601] = "<NAME>-King", [23604] = "<NAME>", [23605] = "<NAME>", [23606] = "Razum-dar", [23609] = "<NAME>", [23731] = "<NAME>", [23747] = "<NAME>", [23748] = "Tovisa", [23770] = "Hodmar", [23781] = "<NAME>", [23829] = "Melril", [23845] = "<NAME>", [23847] = "Damar", [23849] = "Paldeen", [23859] = "<NAME>", [24034] = "<NAME>", [24154] = "Maahi", [24188] = "Treva", [24224] = "Netapatuu", [24261] = "Hoknir", [24276] = "Bura-Natoo", [24277] = "<NAME>", [24316] = "<NAME>", [24317] = "Rolunda", [24318] = "<NAME>", [24322] = "Molla", [24333] = "<NAME>", [24369] = "<NAME>-Turner", [24387] = "Halmaera", [24761] = "The Prophet", [24895] = "Hamill", [24903] = "Nolu-Azza", [24905] = "Vudeelal", [24959] = "Kralald", [24966] = "Thulvald Axe-Head", [24968] = "Wenaxi", [24987] = "<NAME>", [25014] = "Fresgil", [25043] = "<NAME>", [25052] = "Esqoo", [25053] = "<NAME>", [25080] = "Eleven-Skips", [25108] = "Nelerien", [25154] = "Valeric", [25163] = "<NAME>", [25210] = "<NAME>", [25303] = "Iron-Claws", [25374] = "<NAME>", [25413] = "<NAME>", [25544] = "<NAME>", [25546] = "<NAME>", [25600] = "<NAME>", [25604] = "<NAME>", [25618] = "Jurana", [25622] = "Bishalus", [25663] = "<NAME>", [25688] = "<NAME>", [25720] = "<NAME>", [25779] = "Ula-Reen", [25781] = "Talmo", [25789] = "<NAME>", [25800] = "<NAME>", [25882] = "Curator Nicholas", [25907] = "Hilan", [25939] = "<NAME>", [25940] = "<NAME>-Sister", [26087] = "Hlotild the Fox", [26090] = "Acolyte Madrana", [26098] = "Aspera Giant-Friend", [26099] = "The Green Lady", [26188] = "Finvir", [26217] = "Cadwell", [26225] = "Spinner Gwilon", [26226] = "Spinner Endrith", [26314] = "<NAME>", [26317] = "The Silvenar", [26324] = "<NAME>", [26509] = "Mathragor", [26601] = "<NAME>ady-Hand", [26655] = "Keeper Cirion", [26767] = "Elandora", [26768] = "Salgaer", [26810] = "Gakurek", [26885] = "Stormy-Eyes", [26926] = "<NAME>-Hewer", [26955] = "Royal Bodyguard", [26956] = "Royal Bodyguard", [26964] = "High Priest Esling", [26969] = "<NAME>", [27022] = "Ollslid", [27023] = "Fjorolfa", [27063] = "<NAME>", [27295] = "Helgith", [27323] = "Striker Aldewe", [27324] = "First Mate Valion", [27326] = "Seaman Ambaran", [27340] = "Nedrek", [27352] = "Galithor", [27354] = "<NAME>", [27473] = "Valdur", [27560] = "Sela", [27605] = "<NAME>", [27687] = "Hokurek", [27743] = "<NAME>", [27744] = "H<NAME>ill-Owl", [27848] = "Aering", [27926] = "S<NAME>", [27966] = "Farandor", [27971] = "Shandi", [27998] = "Hallfrida", [28005] = "<NAME>", [28082] = "Kerig", [28127] = "<NAME>", [28198] = "<NAME>", [28206] = "Rudrasa", [28261] = "Atirr", [28281] = "<NAME>", [28283] = "Snorrvild", [28331] = "<NAME>", [28480] = "Sings-with-Drink", [28490] = "Eraral-dro", [28493] = "<NAME>", [28505] = "<NAME>", [28539] = "<NAME>", [28611] = "<NAME>", [28612] = "<NAME>", [28659] = "Alphrost", [28672] = "<NAME>", [28674] = "<NAME>", [28693] = "Sister of Floods", [28707] = "<NAME>", [28731] = "<NAME>", [28828] = "Im<NAME>rost-Tree", [28852] = "Elenwen", [28918] = "Steady-Hand", [28925] = "Telenger the Artificer", [28928] = "Andewen", [28930] = "<NAME>", [28941] = "<NAME>", [28959] = "<NAME>", [28974] = "Angardil", [28982] = "<NAME>", [28993] = "Mael", [28994] = "<NAME>", [29008] = "Sirinque", [29017] = "Bermund", [29102] = "<NAME>", [29120] = "Caralith", [29144] = "<NAME>", [29145] = "<NAME>", [29146] = "Aniaste", [29168] = "<NAME>", [29222] = "<NAME>", [29300] = "Watch <NAME>", [29434] = "Holgunn One-Eye", [29464] = "Rellus", [29604] = "Plays-With-Fire", [29678] = "Tabil", [29782] = "Hanilan", [29791] = "Investigator Irnand", [29844] = "<NAME>", [29886] = "<NAME>", [29901] = "<NAME>", [29914] = "Earos", [29915] = "Curime", [30018] = "Widulf", [30026] = "<NAME>", [30061] = "Velatosse", [30069] = "Aninwe", [30103] = "Iroda", [30138] = "Dark Elf", [30164] = "Eminelya", [30178] = "Runehild", [30179] = "Logod", [30183] = "Yngvar", [30200] = "Hauting", [30201] = "Korra", [30202] = "<NAME>", [30300] = "Merormo", [30307] = "Lamolime", [30408] = "Eirfa", [30431] = "Svein", [30896] = "<NAME>", [30932] = "Halino", [30933] = "Ocanim", [31026] = "Hekvid", [31223] = "<NAME>", [31326] = "Anganirne", [31327] = "Ceborn", [31344] = "<NAME>", [31388] = "Tharuin the Melancholy", [31416] = "Mareki", [31421] = "Theofa", [31429] = "Scout Arfanel", [31444] = "Scout Endetuile", [31575] = "<NAME>", [31639] = "<NAME>", [31746] = "Defender Two-Blades", [31808] = "<NAME>", [31837] = "<NAME>", [31902] = "Amitra", [31964] = "Borald", [31967] = "Malana", [31977] = "<NAME>", [32013] = "Mizrali", [32068] = "Parmtilir", [32071] = "Nilwen", [32098] = "Solvar", [32099] = "Captain Attiring", [32114] = "Odunn Gray-Sky", [32172] = "Peruin", [32225] = "Rolancano", [32270] = "Gilien", [32285] = "Fasundil", [32298] = "Endaraste", [32348] = "Cariel", [32356] = "<NAME>", [32387] = "Baham", [32388] = "<NAME>", [32394] = "Thragof", [32495] = "<NAME>", [32496] = "<NAME>", [32506] = "Palomir", [32507] = "Recruit Gorak", [32532] = "Jurak-dar", [32535] = "Bakkhara", [32555] = "Speaks-With-Lights", [32620] = "Delves-Deeply", [32631] = "Instructor Ninla", [32643] = "<NAME>", [32649] = "Telonil", [32654] = "<NAME>", [32703] = "Alandare", [32859] = "<NAME>", [32861] = "<NAME>", [32863] = "<NAME>", [32904] = "Oraneth", [32946] = "Captain One-Eye", [33007] = "Henilien", [33013] = "Rondor", [33017] = "The Observer", [33085] = "<NAME>", [33088] = "Arelmo", [33089] = "<NAME>", [33179] = "<NAME>", [33559] = "Lisondor", [33696] = "Projection of <NAME>", [33806] = "Glanir", [33868] = "<NAME>", [33896] = "<NAME>", [33938] = "Peras", [33961] = "Shard of Alanwe", [33997] = "<NAME>", [34268] = "Trelan", [34307] = "Lugharz", [34308] = "<NAME>", [34346] = "Suriel", [34393] = "Teegya", [34394] = "Sarodor", [34397] = "Gathotar", [34431] = "Sirdor", [34438] = "<NAME>", [34504] = "<NAME>", [34565] = "Gwilir", [34566] = "Moramat", [34568] = "<NAME>", [34623] = "<NAME>", [34646] = "<NAME>", [34733] = "Faraniel", [34755] = "Tzik'nith", [34817] = "Eryarion", [34822] = "Nondor", [34823] = "Khezuli", [34824] = "Laranalda", [34928] = "Ancalin", [34975] = "Firtoril", [34976] = "Tandare", [34984] = "Neetra", [34994] = "Alanwe", [35004] = "Egranor", [35073] = "<NAME>", [35257] = "<NAME>", [35305] = "Azum", [35427] = "Endarwe", [35432] = "Dulini", [35492] = "<NAME>", [35510] = "<NAME>", [35859] = "Neramo", [35873] = "Dugroth", [35897] = "Tharayya", [35918] = "<NAME>", [36093] = "<NAME>", [36102] = "Englor", [36113] = "Pirondil", [36115] = "Khali", [36116] = "Shazah", [36119] = "Engor", [36129] = "Aniel", [36187] = "<NAME>", [36188] = "<NAME>", [36280] = "Decius", [36290] = "Sigunn", [36294] = "Medveig", [36295] = "Helfhild", [36356] = "Azlakha", [36584] = "<NAME>", [36598] = "<NAME>", [36599] = "Jakarn", [36611] = "Stablehand", [36632] = "<NAME>", [36654] = "Jilan-dar", [36913] = "Liane", [36916] = "Lambur", [36971] = "Irien", [36985] = "<NAME>", [37058] = "<NAME>", [37059] = "<NAME>", [37096] = "<NAME>", [37181] = "<NAME>", [37391] = "Andrilion", [37396] = "Nicolene", [37461] = "<NAME>", [37534] = "Laganakh", [37593] = "<NAME>", [37595] = "Ezzag", [37596] = "Kalari", [37727] = "<NAME>", [37900] = "<NAME>", [37976] = "<NAME>", [37978] = "<NAME>", [37985] = "Tazia", [37986] = "Calircarya", [37987] = "Berdonion", [37988] = "Ghadar", [37996] = "Gugnir", [38032] = "Malfinir", [38043] = "Shazeem", [38047] = "<NAME>", [38057] = "Daine", [38077] = "Siraj", [38093] = "<NAME>", [38116] = "<NAME>", [38181] = "Nilaendril", [38182] = "<NAME>", [38201] = "<NAME>", [38217] = "Ongalion", [38251] = "<NAME>", [38269] = "Chews-on-Tail", [38302] = "<NAME>", [38303] = "<NAME>", [38329] = "Ozozur", [38346] = "<NAME>", [38373] = "Zal-sa", [38407] = "Bataba", [38413] = "<NAME>", [38494] = "Suronii", [38498] = "Azahrr", [38532] = "Mezha-dro", [38649] = "Indaenir", [38650] = "Bodring", [38852] = "Magula", [38856] = "<NAME>", [38863] = "<NAME>", [38969] = "Moon-B<NAME>", [38974] = "Marius", [38979] = "Erranenen", [38984] = "Angwe", [38996] = "Gordag", [39037] = "Hjorik", [39166] = "Zahra", [39189] = "Ehtayah", [39191] = "Felari", [39202] = "<NAME>", [39330] = "Hunt-W<NAME>", [39336] = "Grigerda", [39459] = "Benduin", [39465] = "Orthenir", [39475] = "Yanaril", [39483] = "<NAME>", [39505] = "<NAME>", [39542] = "Zadala", [39562] = "Fongoth", [39579] = "Nara", [39613] = "Hazazi", [39623] = "Ofglog gro-Barkbite", [39706] = "Scout Snowhunter", [39729] = "Ukatsei", [39771] = "Uggissar", [39774] = "Hojard", [39782] = "<NAME>", [39790] = "Garnikh", [39954] = "Watch <NAME>", [39955] = "<NAME>", [40105] = "Sind", [40118] = "Halindor", [40119] = "<NAME>", [40266] = "Dulan", [40375] = "The Groundskeeper", [40395] = "Bunul", [40554] = "Khaba", [40577] = "Heluin", [40578] = "<NAME>", [40684] = "<NAME>", [40712] = "Armin", [40755] = "<NAME>", [40849] = "Gathwen", [40903] = "Gadris", [41027] = "<NAME>", [41044] = "Anglorn", [41091] = "<NAME>", [41115] = "Shatasha", [41116] = "Rasha", [41160] = "Zaeri", [41191] = "Kazirra", [41205] = "Balag", [41207] = "Feluni", [41233] = "<NAME>", [41235] = "Thorinor", [41385] = "Zulana", [41387] = "Estinan", [41389] = "Cartirinque", [41397] = "<NAME>", [41418] = "Gungrim", [41425] = "<NAME>", [41480] = "Mansa", [41506] = "Saldir", [41511] = "Edheldor", [41547] = "<NAME>", [41549] = "<NAME>", [41560] = "Marimah", [41634] = "<NAME>", [41644] = "<NAME>", [41788] = "<NAME>", [41887] = "Juranda-ra", [41890] = "Cinder-Tail", [41928] = "Yahyif", [41929] = "Eneriell", [41934] = "Azbi-ra", [41947] = "<NAME>", [42130] = "Officer Lorin", [42297] = "Arcarin", [42332] = "Zan", [42346] = "<NAME>", [42461] = "Fabanil", [42500] = "Kauzanabi-jo", [42520] = "Krodak", [42555] = "Darius", [42576] = "<NAME>", [42577] = "Mirrored-Skin", [42578] = "Adalmor", [42579] = "<NAME>", [42584] = "Bugbesh", [42922] = "<NAME>", [42928] = "Jagnas", [42929] = "<NAME>", [43049] = "Melrethel", [43094] = "Hadam-do", [43163] = "<NAME>", [43242] = "<NAME>", [43247] = "Ragalvir", [43321] = "<NAME>", [43334] = "Galbenel", [43360] = "Kanniz", [43401] = "<NAME>", [43519] = "Wilderking", [43622] = "Wilderqueen", [43657] = "Leki's Disciple", [43719] = "Firiliril", [43782] = "Fatahala", [43839] = "Short-Tail", [43942] = "Meriq", [43948] = "Aqabi of the Ungodly", [44059] = "Officer Parwinel", [44100] = "Uhrih", [44127] = "Thonoras", [44153] = "Dringoth", [44280] = "Projection of Vanus Galerion", [44283] = "Rollin", [44302] = "Gilraen", [44485] = "Elaldor", [44502] = "Sorderion", [44625] = "Lataryon", [44665] = "Nellor", [44679] = "Haras", [44697] = "Laurosse", [44707] = "Erinel", [44709] = "Egannor", [44731] = "Dinwenel", [44741] = "Taralin", [44855] = "Cold-Eyes", [44856] = "Kunira-daro", [44861] = "Marisette", [44864] = "Sumiril", [44894] = "Cinnar", [44899] = "Nivrilin", [45170] = "Gamirth", [45200] = "Thalara", [45458] = "Alandis", [45475] = "<NAME>", [45641] = "<NAME>", [45645] = "<NAME>", [45688] = "Adamir", [45723] = "Wilminn", [45725] = "Zimar", [45744] = "Soldier Alque", [45745] = "Soldier Cularalda", [45757] = "Narion", [45759] = "Ledronor", [45845] = "Radreth", [45909] = "Glaras", [45953] = "Eringor", [46174] = "Anenya", [46204] = "Curinure", [46241] = "Aicessar", [46323] = "Zaddo", [46439] = "Valarril", [46520] = "Adusa-daro", [46595] = "<NAME>", [46655] = "Ancalmo", [46700] = "Fingaenion", [47088] = "Gluineth", [47445] = "<NAME>", [47472] = "Soldier Garion", [47473] = "<NAME>", [47631] = "Gwendis", [47667] = "Sebazi", [47668] = "<NAME>", [47677] = "Zaag", [47685] = "Arkas", [47686] = "Ikran", [47754] = "<NAME>", [47765] = "<NAME>", [47770] = "Enda", [47854] = "<NAME>", [47924] = "<NAME>", [48009] = "Brelor", [48092] = "Gahgdar", [48116] = "Githiril", [48295] = "<NAME>", [48567] = "<NAME>", [48570] = "<NAME>", [48573] = "<NAME>", [48660] = "Enthoras", [48891] = "Teeba-Ja", [48893] = "High Ordinator Danys", [48916] = "Sabonn", [48996] = "Cr<NAME>", [49030] = "Forinor", [49180] = "<NAME>", [49189] = "<NAME>", [49284] = "<NAME>", [49349] = "Mizahabi", [49408] = "Beryn", [49410] = "King <NAME>", [49432] = "Mendil", [49482] = "Orthelos", [49534] = "<NAME>", [49608] = "<NAME>", [49624] = "Maenlin", [49646] = "Lashgikh", [49669] = "None^n", [49698] = "Cirmo", [49708] = "Adainurr", [49709] = "Meleras", [49743] = "Najan", [49778] = "Keeper of the Hall", [49863] = "Thoreki", [49898] = "<NAME>", [49926] = "Gerweruin", [49955] = "<NAME>", [49958] = "Glothorien", [49985] = "Sarandel", [50037] = "Vorundil", [50091] = "Eminaire", [50141] = "Caesonia", [50228] = "Turshan-dar", [50233] = "<NAME>", [50237] = "<NAME>", [50416] = "Semusa", [50525] = "Afwa", [50550] = "Kailstig the Axe", [50639] = "Skeleton", [50684] = "Long-Cast", [50765] = "<NAME>", [50990] = "Angamar", [51086] = "Malma", [51088] = "Brendar", [51134] = "Israk Ice-Storm", [51310] = "<NAME>", [51397] = "<NAME>", [51461] = "<NAME>", [51615] = "Sadaifa", [51842] = "Vaerarre", [51901] = "The Thief", [51963] = "Star-Gazer Herald", [52071] = "Erold", [52096] = "Dathlyn", [52103] = "Caalorne", [52105] = "Hjagir", [52118] = "Sees-Many-Paths", [52166] = "Shuldrashi", [52169] = "Arethil", [52181] = "<NAME>", [52291] = "<NAME>", [52731] = "Hollow Guardian", [52741] = "Genthel", [52751] = "Firtorel", [52752] = "King Laloriaran Dynar", [52753] = "<NAME>", [52929] = "<NAME>", [52930] = "<NAME>", [52931] = "<NAME>", [53979] = "<NAME>", [53980] = "Aldunie", [53983] = "Hartmin", [54043] = "<NAME>", [54049] = "Greban", [54154] = "Umbarile", [54228] = "Nazdura", [54410] = "<NAME>", [54577] = "Recruit Maelle", [54580] = "Ibrula", [54848] = "Royal Messenger", [55120] = "<NAME>", [55125] = "Lodiss", [55221] = "Ralai", [55270] = "Fights-With-Tail", [55351] = "<NAME>", [55378] = "Nhalan", [56177] = "Star-G<NAME>", [56248] = "<NAME>", [56459] = "Mihayya", [56501] = "<NAME>-Satakalaam", [56503] = "Scattered-Leaves", [56504] = "<NAME>-Breaker", [56513] = "<NAME>", [56525] = "Riurik", [56701] = "Thalinfar", [57474] = "Regent Cassipia", [57577] = "Nendirume", [57649] = "Little Leaf", [57850] = "Atildel", [58495] = "<NAME>", [58640] = "<NAME>", [58826] = "<NAME>", [58841] = "Glirion the Redbeard", [58889] = "Millenith", [59027] = "The Celestial Warrior", [59046] = "<NAME>", [59335] = "Orgotha", [59362] = "<NAME>", [59388] = "Glurbasha", [59604] = "Cinosarion", [59685] = "Forge-Mother Alga", [59780] = "Dirdre", [59840] = "Forge-Wife Kharza", [59873] = "Archivist Murboga", [59900] = "Rogzesh", [59908] = "Laurig", [59963] = "Chief Bazrag", [60187] = "Sister <NAME>", [60285] = "Adara'hai", [64703] = "Mazgroth", [64741] = "Shield-Wife Razbela", [64769] = "Lazghal", [64805] = "Eveli Sharp-Arrow", [64864] = "<NAME>", [64891] = "<NAME>", [65199] = "Fa-Nuit-Hen^N", [65239] = "<NAME>", [65270] = "Brulak", [65296] = "Nashruth", [65444] = "Lozruth", [65634] = "Orzorga", [65717] = "Zabani", [65736] = "Mulzah", [65951] = "Curator Umutha", [66284] = "Kyrtos", [66293] = "Youss", [66310] = "Dagarha", [66412] = "Nammadin", [66701] = "Doranar", [66830] = "Chief Urgdosh", [66840] = "Eshir", [66846] = "Zinadia", [67016] = "<NAME>", [67018] = "Arzorag", [67019] = "Guruzug", [67033] = "Drudun", [67826] = "Grazda", [67828] = "<NAME>", [67843] = "Speaker Terenus", [68132] = "Zeira", [68328] = "Quen", [68594] = "<NAME>", [68654] = "Rohefa", [68688] = "Bakhum", [68825] = "Thrag", [68884] = "Stuga", [69048] = "Andarri", [69081] = "Sabileh", [69142] = "Lund", [69854] = "<NAME>", [70383] = "Quen", [70459] = "<NAME>", [70472] = "Nevusa", [72001] = "<NAME>", [72002] = "To My Friend From the Beach", [72003] = "<NAME>", [72004] = "<NAME>", [72005] = "Fa-Nuit-Hen", [72006] = "Larafil", [72007] = "Gnaws-on-Tail", [72008] = "<NAME>", -- holliday [77001] = "New Life Festival Scroll", [77002] = "Breda", [77003] = "<NAME>", [77004] = "<NAME>", -- check might not be holiday [77005] = "<NAME>", [77006] = "<NAME>", [77007] = "<NAME>", -- <NAME> [78000] = "Vivec", [78001] = "<NAME>", [78002] = "<NAME>", [78003] = "Murgonak", [78004] = "<NAME>", [78005] = "<NAME>", [78006] = "<NAME>", [78007] = "<NAME>", [78008] = "<NAME>", [78009] = "Halinjirr", [78010] = "<NAME>", [78011] = "<NAME>", [78012] = "<NAME>", [78013] = "Councilor Eris", [78014] = "<NAME>", -- Shar Crown Store [79000] = "Imperial Missive^M", --?? [79001] = "Crown Store", --?? -- Shar Misc [80000] = "<NAME>", [80001] = "<NAME>", [80002] = "Josajeh", [80003] = "Roguzog", [80004] = "Bolgrul", [80005] = "<NAME>", [80006] = "<NAME>", [80007] = "<NAME>", [80008] = "<NAME>", [80009] = "<NAME>", [80010] = "<NAME>", [80011] = "<NAME>", [80012] = "<NAME>", [80013] = "Relulae", [80014] = "<NAME>", [80015] = "<NAME>", [80016] = "<NAME>", [80017] = "House Ravenwatch Contract", [80018] = "<NAME>", [80019] = "Lamia", [80020] = "Finoriell", [80021] = "<NAME>", [80022] = "<NAME>-Barkbite", [80023] = "A Call to the Worthy", [80024] = "Gurund", [80025] = "Erilthel", [80026] = "Serileth", [80027] = "Lost Cat Note", [80028] = "<NAME>", -- Shar Elsweyr [81000] = "Nisuzi", [81001] = "<NAME>", [81002] = "<NAME>", [81003] = "Iraya", [81004] = "<NAME>", [81005] = "<NAME>", [81006] = "Isadati", [81007] = "<NAME>", [81008] = "Moon-Priest Haduras", [81009] = "Iokkas", [81010] = "Khamira", [81011] = "<NAME>", [81012] = "<NAME>", [81013] = "<NAME>", [81014] = "Daini", [81015] = "Vigwenn Owl-Watcher", [81016] = "<NAME>", [81017] = "Zhasim", [81018] = "L<NAME>ack", [81019] = "J'saad's Note", -- Wrothgar [82000] = "Arvnir", -- Eastmarch [83000] = "<NAME>", [83001] = "<NAME>", [83002] = "Chief-of-Chiefs Cannear", -- Shar Skyrim [90000] = "<NAME>", [90001] = "Arana", [90002] = "Letter to Kitza-Enoo", [90003] = "Letter from Ansdurran", [90004] = "Letter to <NAME>", [90005] = "Hiretta", [90006] = "Medone", [90007] = "<NAME>", [90008] = "<NAME>", [90009] = "Angair", [90010] = "Quintor", [90011] = "<NAME>", [90012] = "Which Guild is for You?", [90013] = "Work for Hire in Markarth", [90014] = "Gwenyfe", [90015] = "Bralthahawn", [90016] = "Nelldena", [90017] = "<NAME> Glynroch", [90018] = "<NAME>", [90019] = "Ardanir", [90020] = "<NAME>", [90021] = "Ezabi", [90022] = "Yrsild", -- Summerset [91000] = "Lanarie", [91001] = "Valsirenn", [91002] = "Tindoria", [91003] = "<NAME>", [91004] = "Seeks-the-Dark", [91005] = "Naliara", [91006] = "Calibar", [91007] = "Hiranesse", [91008] = "<NAME>", [91009] = "Rinyde", [91010] = "Manacar", [91011] = "Linwenvar", [91012] = "Divine Prosecution Notification", [91013] = "<NAME>", [91014] = "Celinar", [91015] = "Talomar", [91016] = "Telarniel", [91017] = "Merenfire", [91018] = "Tableau", [91019] = "Ruliel", [91020] = "<NAME>", [91021] = "Oriandra", [91022] = "Faralan", [91023] = "Vandoril", [91024] = "<NAME>", -- Clockwork City [92001] = "<NAME>", [92002] = "Brengolin", [92003] = "<NAME>", [92004] = "Lilatha", [92005] = "Alien<NAME>", [92006] = "<NAME>", [92007] = "<NAME>", [92008] = "<NAME>", [92009] = "Journal of a Stranded Mage", [92010] = "<NAME>", [92011] = "<NAME>", [92012] = "<NAME>", -- Craglorn [93000] = "Anneke", [93001] = "Engariel", [93002] = "Thaenaneth", -- Murkmire [94000] = "<NAME>", [94001] = "Hands-That-Heal", [94002] = "Romantic Argonian Poem", [94003] = "Dradeiva", [94004] = "Death-Hunts Await", [94005] = "Nesh-Deeka", -- Blackwood [95000] = "<NAME>", [95001] = "<NAME>", [95002] = "<NAME>", [95003] = "Work for Hire in Leyawiin", [95004] = "Deetum-Jas", [95005] = "<NAME>", [95006] = "<NAME>", [95007] = "Daluion", [95008] = "<NAME>", [95009] = "Malosza", [95010] = "Pirate's Treasure Message", [95011] = "Nocturnal", [95012] = "Phantasmal Discovery Awaits!", [95013] = "Jela", [95014] = "<NAME>", [95015] = "Zeechis", [95016] = "Lounges-on-Moss", [95017] = "<NAME>", [95018] = "Nuxul", [95019] = "Hokatsei", [95020] = "Adventurers Wanted for Exciting Opportunity!", [95021] = "Adrahawn", [95022] = "Author's Assistant Wanted!", [95023] = "Mim-Jasa", [95024] = "Come One, Come All!", [95025] = "Heem-Jas", [95026] = "Dust-On-Scales", [95027] = "Duke of Crows", [95034] = "Morgane's Guild Orders", [95035] = "Walks-Under-Shadow", [95036] = "<NAME>", [95037] = "Dahfnar", [95038] = "Cursare", [95039] = "<NAME>", [95040] = "Tuwul", [95041] = "Aloysius's Note", [95042] = "Keshu the Black Fin", [95043] = "Peek-Ereel", -- Companions? [95028] = "<NAME>", [95029] = "<NAME>", -- Not Companions? [95030] = "Ajim-Ma", [95031] = "Yisara", [95032] = "<NAME>", [95033] = "Norianwe", -- New auto created [100001] = "<NAME>", [100002] = "Gray-Skies", [100003] = "<NAME>", [100004] = "Sun-in-Shadow", [100005] = "<NAME>", [100006] = "<NAME>", [100007] = "<NAME>", [100008] = "The Scarlet Judge", [100009] = "<NAME>", [100010] = "<NAME>", [100011] = "Nakhul", [100012] = "<NAME>", [100013] = "<NAME>", [100014] = "Eoki", [100015] = "<NAME> Shy", [100016] = "<NAME>", [100017] = "Udami", [100018] = "Pandermalion", [100019] = "<NAME>", [100020] = "Vinafwe", [100021] = "Miranrel", [100022] = "<NAME>", [100023] = "Silurie", [100024] = "<NAME>", [100025] = "<NAME>", [100026] = "Renzir", [100027] = "<NAME>", [100028] = "Hinzuur", [100029] = "Mehdze", [100030] = "<NAME>", [100031] = "<NAME>", [100032] = "<NAME>", -- His Final gift [100033] = "<NAME>", [100034] = "<NAME>", [100035] = "A Job Offer!", [100036] = "Hadamnargo", [100037] = "Natrada", [100038] = "<NAME>", [100039] = "<NAME>", [100040] = "Bulletin Board", [100041] = "Razgurug", [100042] = "<NAME>", [100043] = "Sherizar", [100044] = "Palbatan", [100045] = "Clockwork Facilitator", [100046] = "Inactive Brassilisk", [100047] = "CCHW-04", [100048] = "Olorime", [100049] = "<NAME>", [100050] = "Notice", [100051] = "Ho<NAME>", [100052] = "Homes For Sale!", [100053] = "Stromgruf the Steady", [100054] = "Andiryewen", [100055] = "Yushiha", [100056] = "Allanwen", [100057] = "Hanu", [100058] = "<NAME>", [100059] = "Nahfahlaar", [100060] = "Battle Mission Board", [100061] = "Bounty Mission Board", [100062] = "Scouting Mission Board", [100063] = "Alamar", [100064] = "<NAME>", [100065] = "<NAME>", [100066] = "Bloody Scroll", [100067] = "<NAME>", [100068] = "Drake of Blades", [100069] = "Loncano", [100070] = "Yisareh", [100071] = "Shelaria", [100072] = "<NAME>", [100073] = "<NAME>", [100074] = "General Nesh-Tan", [100075] = "General Aklash", [100076] = "Conquest Missions Board", [100077] = "Warfront Mission Board", [100078] = "Sheogorath", [100079] = "Ashur", [100080] = "Mizzik Thunderboots", [100081] = "Kiseravi", [100082] = "Tahara", [100083] = "<NAME> Moonstruck", [100084] = "Vastarie", [100085] = "<NAME>", [100086] = "Sarazi", [100087] = "Rakhzargo", [100088] = "<NAME>", [100089] = "Inalzin", [100090] = "Saviwa", [100091] = "Mara'dahni", [100092] = "Elhalem", [100093] = "<NAME>", [100094] = "Narayun", [100095] = "<NAME>", [100096] = "<NAME>", [100097] = "Zahari", [100098] = "Brihana", [100099] = "<NAME>", [100100] = "Grand Warlord Dortene", [100101] = "Details on the Midyear Mayhem", -- 6014 [100102] = "<NAME>", [100103] = "<NAME>", [100104] = "<NAME>", [100105] = "Zahreh", [100106] = "<NAME>", [100107] = "Adventurers Wanted!", [100108] = "<NAME>", [100109] = "<NAME>", [100110] = "Grand Warlord Zimmeron", [100111] = "Ri'hirr", [100112] = "<NAME>", [100113] = "Order of the Eye Dispatch", [100114] = "Dirge Truptor", [100115] = "Jee-Lar", [100116] = "<NAME>", [100117] = "<NAME>", [100118] = "<NAME>", [100119] = "<NAME>", [100120] = "<NAME>", [100121] = "Qasna at-Toura", [100122] = "Brown-Tooth", [100123] = "<NAME>", [100124] = "Dervenin", [100125] = "Vanthongar's Letter", [100126] = "Tseedasi", [100127] = "<NAME>", [100128] = "Nomu", [100129] = "Narama-ko", [100130] = "<NAME>", [100131] = "Nuhunza", [100132] = "<NAME>", [100133] = "<NAME>", [100134] = "Cyrodilic Collections Needs You!", [100135] = "Hides-the-Ashes", [100136] = "Kor", [100137] = "Green-Venom-Tongue", [100138] = "The Jester's Festival", [100139] = "A Foe Most Porcine", [100140] = "Soars-in-Laughter", [100141] = "Jad'zirri", [100142] = "Amsha", [100143] = "<NAME>", [100144] = "Chuxu", [100145] = "<NAME>", [100146] = "Listens-By-Smell", [100147] = "Ghashugg", [100148] = "Dajaleen", [100149] = "<NAME>", [100150] = "<NAME>", [100151] = "Bolu", [100152] = "Melleron's Journal", [100153] = "<NAME>", [100154] = "Beel-Ranu", [100155] = "Aliskeeh", [100156] = "Tarnamir", [100157] = "Kiza", [100158] = "<NAME>", [100159] = "Help Wanted: Merryvale!", [100160] = "Reward for Stolen Wine", [100161] = "Hooded Figure", [100162] = "Sharp-Eye", [100163] = "<NAME>", [100164] = "Irna", [100165] = "Maesar", [100166] = "Azinar", [100167] = "<NAME>", [100168] = "Batuus", [100169] = "Dominion Correspondence", [100170] = "Sienna", [100171] = "Religious Fetish Statue", [100172] = "<NAME>", [100173] = "<NAME>", [100174] = "Nimriell", [100175] = "Daifa", [100176] = "Sir Edain's Spirit", [100177] = "Hamza", [100178] = "Tasnasi", [100179] = "<NAME>", [100180] = "Toura", [100181] = "Tahara's Traveling Menagerie", [100182] = "To Chief <NAME>", [100183] = "Tharayya Journal Entry: 19", [100184] = "<NAME>", [100185] = "Squire Theo Rocque", [100186] = "Letter to Tavo", -- Skyrim [200000] = "Tyrvera", [200001] = "<NAME>", [200002] = "Calling All Antiquarians!", [200003] = "Hamvir", [200004] = "<NAME>", [200005] = "<NAME>", [200006] = "Hidaver", [200007] = "Tinzen", [200008] = "Njoll", [200009] = "Adelrine", [200010] = "Alfgar", [200011] = "Alwyn", [200012] = "Deckhand Bazler", [200013] = "Evska", [200014] = "<NAME>", [200015] = "Jolfr", [200016] = "Letter to Dorbin", [200017] = "Magreta", [200018] = "<NAME>", [200019] = "Peculiar Bottle", [200020] = "<NAME>", [200021] = "<NAME>", [200022] = "Svana", [200023] = "Umgaak", [200024] = "Telline", [200025] = "Ch<NAME>", [200026] = "<NAME>", [200027] = "Tranya", [200028] = "Rafilerrion", [200029] = "<NAME>", [200030] = "Leiborn", [200031] = "<NAME>", [200032] = "Felarian", [200033] = "<NAME>", [200034] = "Hyava", [200035] = "Bloated Fish", [200036] = "Inguya's Mining Samples", [200037] = "Adanzda's Mining Samples", [200038] = "Soldiers of Fortune and Glory", [200039] = "Ghamborz's Mining Samples", [200040] = "Reeh-La's Mining Samples", [200041] = "Kelbarn's Mining Samples", [200042] = "Numani-Rasi", [200043] = "<NAME>", [200044] = "Brondold", [200045] = "<NAME>-bane", [200046] = "Aerolf", [200047] = "<NAME>", [200048] = "Sarcophagus", [200049] = "Kasura", [200050] = "Falkfyr's Notes, Page 1", -- Existing [500000] = "<NAME>", [500001] = "Heist Board", [500002] = "Reacquisition Board", [500003] = "Tharayya's Journal, Entry 10", [500004] = "Tharayya's Journal, Entry 2", [500005] = "Promissory Note", [500006] = "Tavo (dead)", [500007] = "Letter to Fadeel", [500008] = "Altmeri Relic", [500009] = "Equipment Crafting Writs", [500010] = "Consumables Crafting Writs", [500011] = "Bloody Journal", [500012] = "Mages Guild Handbill", [500013] = "Folded Note", [500014] = "Shipping Manifest", [500015] = "Doctor's Bag", [500016] = "Crate", [500017] = "Letter", [500018] = "Wet Bag", [500019] = "Notebook", [500020] = "Message to Jena", [500021] = "Weathered Notes", [500022] = "Letter to Belya", [500023] = "Crate", [500024] = "Note", [500025] = "Journal Page", [500026] = "Letter from <NAME>", [500027] = "Undaunted Enclave Invitation", [500028] = "Orders from Knight-Commander Varaine", [500029] = "Pelorrah's Research Notes", [500030] = "Delivery Contract", [500031] = "A Dire Warning", [500033] = "Campfire", [500034] = "<NAME>", [500035] = "Pendant", [500036] = "Abandoned Pack", [500037] = "Hastily Written Note", [500038] = "Idria's Lute", [500039] = "Nettira's Journal", [500040] = "Winterborn's Note", [500041] = "The Gray Passage", [500042] = "Orrery", [500043] = "Centurion Control Lexicon", [500044] = "Unusual Stone Carving", [500045] = "Troll Socialization Research Notes", [500046] = "Hastily Scribbled Note", [500047] = "Fighters Guild Handbill", [500048] = "Bandit Note", [500049] = "Battered Shield", [500050] = "Risa's Journal", [500051] = "A Fair Warning", [500052] = "Speaking Stone", [500053] = "Dusty Scroll", [500054] = "Burial Urn", [500055] = "Advertisement", [500056] = "Ancient Nord Burial Jar", [500057] = "Tomb Urn", [500058] = "Handre's Last Will", [500059] = "Suspicious Keg", [500060] = "Scout's Orders", [500061] = "Red Rook Note", [500062] = "Guifford Vinielle's Sketchbook", [500063] = "Bandit's Journal", [500064] = "Runestone Fragment", [500065] = "Torn Letter", [500066] = "Nimriell's Research", [500067] = "Azura Shrine", [500068] = "Storgh's Bow", [500069] = "Mercano's Journal", [500070] = "Backpack", [500071] = "Nadafa's Journal", [500072] = "Strange Sapling", [500073] = "Scouting Board", [500074] = "Bosmer Vase", [500075] = "Journal of a Z'en Priest", [500076] = "Soggy Journal", [500077] = "Moranda Gem Array", [500078] = "Graccus' Journal Volume II", [500079] = "Dusty Instrument", [500080] = "Make the Wilds Safer, Earn Gold", [500081] = "Yenadar's Journal", [500082] = "Suspicious Bottle", [500083] = "An Ancient Scroll", [500084] = "Klaandor's Journal", [500085] = "Nedras' Journal", [500086] = "Ancient Sword", [500087] = "Sword", [500088] = "The Temple of Sul", [500089] = "Strange Device", [500090] = "Warning Notice", [500091] = "Attack Plans", [500092] = "Weather-Beaten Trunk", [500093] = "Cursed Skull", [500094] = "Last Will and Testament of Frodibert Fontbonne", [500095] = "Stolen Goods", [500096] = "Unearthed Chest", [500097] = "Frostheart Blossom", [500098] = "Ceremonial Scroll", [500099] = "Ancient Scroll", [500100] = "Pact Amulet", [500101] = "Offer of Amnesty", [500102] = "Agolas's Journal", [500103] = "Old Pack", [500104] = "To the Hero of Wrothgar!", [500105] = "House of Orsimer Glories", [500106] = "Note from Velsa", [500107] = "Tip Board", [500108] = "Note from Quen", [500109] = "Note from Zeira", [500110] = "Note from Walks-Softly", [500111] = "Message from Walks-Softly", [500112] = "Message from Velsa", [500113] = "Thieves Guild", [500114] = "Mages Guild", [500115] = "Fighters Guild", [500116] = "Undaunted", [500117] = "Hat of Julianos", [500118] = "Bounty Board", [500119] = "Dark Brotherhood", [500120] = "Marked for Death", [500121] = "Note from Astara", [500122] = "Note from Kor", [500123] = "Azara's Note", }<file_sep>/quest_lib.lua QuestLib = {} QuestLib.completed_quests = {} QuestLib.ever_cached = false QuestLib.last_ccq = 0 local utils = {} local internal = {} _G["QuestLibUtils"] = utils _G["QuestLibInternal"] = internal function QuestLib.TableWipeKeys (tab) while true do local k = next(tab) if not k then break end tab[k] = nil end end function QuestLib.CacheCompletedQuests() local id = 0 local count = 0 local t = e("GetFrameTimeMilliseconds()") if t == QuestLib.last_ccq then return QuestLib.completed_quests else QuestLib.last_ccq = t end QuestLib.TableWipeKeys(QuestLib.completed_quests) repeat id = e("GetNextCompletedQuestId(" .. tostring(id) .. ")") if id then local title = e("GetCompletedQuestInfo(".. tostring(id) .. ")") QuestLib.completed_quests[id] = title if (QuestLib.completed_quests[title] or title) ~= title then title = "DUPE: "..title end QuestLib.completed_quests[title] = id end count = count + 1 if count > 1000000 then return false end until not id QuestLib.ever_cached = true return QuestLib.completed_quests end function QuestLib.GetCompletedQuests(force) if not QuestLib.ever_cached or force then QuestLib.CacheCompletedQuests() end return QuestLib.completed_quests end function QuestLib.IsQuestComplete(id,force) if not QuestLib.ever_cached or force then QuestLib.CacheCompletedQuests() end return QuestLib.completed_quests[id] end function QuestLib.GetQuestName(quest_id) return utils:GetQuestName(quest_id) end function QuestLib.GetQuestGiverId(quest) return quest[utils.quest_index.quest_giver] end function QuestLib.GetQuestGiverName(quest) local giver = internal.quest_givers[QuestLib.GetQuestGiverId(quest)] if not giver then return "Unknown" end return giver end function QuestLib.GetQuestId(quest) return quest[utils.quest_index.quest_id] end function QuestLib.GetQuestGlobalPosition(quest) return utils:GlobalToWorld(quest[utils.quest_index.global_x],quest[utils.quest_index.global_y]) end function QuestLib.GetZoneQuests() return internal:GetZoneQuests() end function QuestLib.GetZoneMeasurement() return utils:GetZoneMeasurement() end <file_sep>/README.md # eso-quest-info Quest info addon to showcase QuestLib, shows all non-completed quests of your current active zone (map). ![preview](https://i.imgur.com/nbOiRHY.png) `QuestLib.GetZoneQuests()` Returns a table of quests based on the current zone. `QuestLib.GetQuestId(quest_entry)` Returns the quest id of a quest-table entry (use it in pair with GetZoneQuests) `QuestLib.GetQuestGiverName(quest_entry)` Returns quest giver name `QuestLib.GetQuestGiverId(quest_entry)` Returns quest giver id `QuestLib.GetQuestGlobalPosition(quest_entry)` Returns x,y quest world position `QuestLib.GetQuestName(quest_id)` Returns the quest name based on the quest id (use it in pair with GetZoneQuests) `QuestLib.IsQuestComplete(id_or_name,force)` Returns a boolean telling you if you completed the provided quest, force param on true refreshes the completed cache quests (i'll do this automatic later registering an event on quest completition) `QuestLib.GetCompletedQuests(force)` Returns a table of completed quests (table format is t[id] = title or t[title] = id) # TO-DO - Remove force params by registering game events (the idea would be to refresh the cache on EVENT_QUEST_COMPLETE event, so just need to register a handler to that...) - Add more quest info (steps, conditions?) - Quest tracking (?) <file_sep>/quest_lib_tables.lua local internal = _G["QuestLibInternal"] local utils = _G["QuestLibUtils"] local function QuestIds(list) local ids = {} for _, l in ipairs(list) do ids[l] = true end return ids end --[[ List of what the numbers mean This is a list of special objects like notes and signs. The key is the quest ID and the value is the quest giver. 6420 - In Defense of Pellitine, A Job Offer Sign 5949 - For Glory Sign 6176 - Nafarion's Note, His Final Gift 6130 - Housing Brochure, Room To Spare 6514 - The Antiquarian Circle 6537 - Bloated Fish, Potent Poison 6510 - The Maelmoth Mysterium, Peculiar Bottle 6492 - Soldiers of Fortune and Glory, Notice 6467 - The Gathering Storm, Brondold 6455 - Bound in Blood, Sarcophagus 6066 - The Precursor, Bulletin Board 4526 - Lost Bet, Altmeri Relic 4220 - The Mallari-Mora, Umbarile 4531 - A Brush With Death, Watch Captain Astanya 3991 - Escape from Bleakrock, Captain Rana 6093 - The Mages Dog, Journal of a Stranded Mage 4146 - A Family Divided, Sela 5630 - Contract: Bangkorai, Marked for Death 5659 - Contract: Grahtwood, Marked for Death 6476 - Dark Clouds Over Solitude, Lyris Titanborn 6092 - The Merchant's Heirloom, Dulza's Log 6014 - Midyear Mayhem, Details on the Midyear Mayhem 6533 = Kelbarn's Mining Samples 6534 - Inguya's Mining Samples 6535 = Reeh-La's Mining Samples 6536 = Ghamborz's Mining Samples 6538 = Adanzda's Mining Samples 6591 = Falkfyr's Notes, Page 1 4680 = "To My Friend From the Beach", "Storm on the Horizon" 6134 = "The New Life Festival", "New Life Festival Scroll" 6549 = "The Ravenwatch Inquiry", "House Ravenwatch Contract" 4382 = "Moment of Truth", "Dugroth" 4585 = "Relative Matters", "Hojard" 5664 = "The Sweetroll Killer", "A Call to the Worthy", 6449 = "Lumpy Sack", "Take Your Lumps" 6445 = "J'saad's Note", "J'saad's Stone" 6431 = "Sourcing the Ensorcelled", "<NAME>" 4955 = "A Lucky Break", "Nedras' Journal" 6226 = Cyrodilic Collections Needs You!, "Cyrodilic Collections Needs You!" 5950 = "The Ancestral Tombs", "<NAME>" 6275 = "Frog Totem Turnaround", "Romantic Argonian Poem" 6295 = "Death-Hunts", "Death-Hunts Await" 4145 = "Mine All Mine", <NAME> 5599 = "Questions of Faith", "Kor" 5352 = "Into the Maw", "Adara'hai" 6549 = "The Ravenwatch Inquiry", 6612 = "A Mortal's Touch", 5013 = "Hushed Whispers", "Dominion Correspondence" 6370 = "Ache for Cake", "Jubilee Cake Voucher" 4379 = "Lover's Torment", "Shard of Alanwe" 3970 = "An Ill-Fated Venture", "Letter to Tavo" 4656 = "Tharayya's Trail", "Tharayya Journal Entry: 19" 6144 = "Pearls Before Traitors", "To Chief Justiciar Carawen" 6314 = "Scariest in Show", "Tahara's Traveling Menagerie", 6596 = "The Symbol of Hrokkibeg", "Letter to Apprentice Gwerina" 6631 = "Giving Up the Ghost", "Phantasmal Discovery Awaits!" 6337 = "A Battle of Silk and Flame", "Morgane's Guild Orders" ID = Quest Name, Object for comments --]] internal.questid_giver_lookup = { [6420] = 100035, [5949] = 100050, [6176] = 100032, [6130] = 100051, [6514] = 200002, [6537] = 200035, [6510] = 200044, [6492] = 100050, [6467] = 200045, [6455] = 200037, [6533] = 200041, [6534] = 200036, [6535] = 200040, [6536] = 200039, [6538] = 200037, [6066] = 100040, [4526] = 500008, [4220] = 54154, [4531] = 29300, [3991] = 24277, [6093] = 92009, [4146] = 27560, [5630] = 500120, [5659] = 500120, [6476] = 80006, [6092] = 100096, [6014] = 100101, [6591] = 200050, [4680] = 72002, [6134] = 77001, [6532] = 90012, [6553] = 90013, [6348] = 100035, [6170] = 91012, [6549] = 80017, [5742] = 80018, -- special holliday quest for halloween check if it's in any location [4382] = 35873, [4585] = 39774, [5664] = 80023, [6442] = 80027, [6449] = 81018, [6445] = 81019, [6431] = 100034, [4955] = 500085, [6226] = 100134, [5950] = 80016, [6275] = 94002, [6295] = 94004, [4145] = 27743, [5599] = 100136, [5352] = 60285, [5941] = 100138, [6375] = 100160, [6549] = 79001, [6612] = 79001, [5013] = 100169, [6370] = 100173, [4379] = 33961, [3970] = 100186, [4656] = 100183, [6144] = 100182, [6314] = 100181, [6596] = 90004, [6631] = 95012, [6646] = 95033, [6337] = 95034, [6663] = 95039, [6647] = 95041, } --[[ List of what the numbers mean This is a list of special NPCs that run around or hunt you down. Once XY location is set, do not change it [4831] = "The Harborage", [5941] = "The Jester's Festival", [6370] = "Ache for Cake", [5935] = "The Missing Prophecy", [6023] = "Of Knives and Long Shadows", [6097] = "Through a Veil Darkly", [6226] = "Ruthless Competition", [6299] = "The Demon Weapon", [6395] = "The Dragonguard's Legacy", [6454] = "The Coven Conspiracy", [6549] = "The Ravenwatch Inquiry", [6612] = "A Mortal's Touch", ]]-- internal.prologue_quest_list = { 4831, 5941, 6370, 5935, 6023, 6097, 6226, 6299, 6395, 6454, 6549, 6612, } --[[ List of what the numbers mean This is a list of special NPCs that run around or hunt you down. Once XY location is set, do not change it 68884 - Stuga: Quest ID 5450: "Invitation to Orsinium" 54154 - Umbarile: Quest ID 4220: "The Mallari-Mora" 52751 - Firtorel: Quest ID 5058: "All the Fuss" 32298 - Endaraste: Quest ID 4264: "Plague of Phaer" 31327 - Ceborn: Quest ID 4264: "Plague of Phaer" 30069 - Aninwe: Quest ID 4264: "Plague of Phaer" 31326 - Anganirne: Quest ID 4264: "Plague of Phaer" 24316 - <NAME> Hunter: Quest ID 3992: "What Waits Beneath" 80016 - Librarian Bradyn: Quest ID 5923: "The Lost Library" 80016 - Librarian Bradyn: Quest ID 5950: "The Ancestral Tombs" 10714 - Rajesh : Quest ID 4841: "Trouble at the Rain Catchers" 11315 - Qadim : Quest ID 2251: "Gone Missing" 28505 - Bera Moorsmith : Quest ID 3858: "The Dangerous Past" 28505 - Bera Moorsmith : Quest ID 3885: "The Prismatic Core" 28505 - Bera Moorsmith : Quest ID 3856: "Anchors from the Harbour" 5897 - Serge Arcole : Quest ID 2451: "A Ransom for Miranda" xx - xx : Quest ID 5102: "The Mage's Tower" 5057 - First <NAME> : Quest ID 1637: "Divert and Deliver", 6624 - <NAME> : Quest ID 728: "Repair Koeglin Lighthouse" Note: Table is of Quest ID numbers since that is part of the XY location information from internal.quest_locations --]] -- 4841 need more data first for Rajesh -- 5742 needs verified as it is for halloween quest --[[ Another use is that this will prevent a daily or quest from a location that is off the map. Southern Elsweyr for example and the quests in the Dragonguard place ]]-- internal.quest_giver_moves = { -- regular quests 5450, 4220, 5058, 4264, 3992, 5923, 5950, 2251, 5742, 5102, 3856, 3858, 3885, 2451, 728, --[[ [6428] = "Sticks and Bones", [6429] = "Digging Up the Garden", [6430] = "File Under D", [6433] = "Rude Awakening", [6434] = "The Dragonguard's Quarry", [6435] = "The Dragonguard's Quarry", [6405] = "Taking Them to Tusk", [6406] = "A Lonely Grave", [3924] = "Song of Awakening", ]]-- -- Dragonguard quests 6428, 6429, 6430, 6433, 6434, 6435, 6405, 6406, 3924 } --[[ This is a list of qusts that give skill points 6455 - Bound in Blood 6050 - To The Clockwork City 6476 - Dark Clouds Over Solitude 6481 - Daughter of the Wolf 6466 - The Vampire Scholar 6057 - In Search of a Sponsor 6409 - Reformation 6394 - Uneasy Alliances 5534 = Cleaning House ]]-- internal.quest_has_skill_point = { 465, 467, 575, 1633, 2192, 2222, 2997, 3006, 3235, 3267, 3379, 3634, 3735, 3797, 3817, 3831, 3867, 3868, 3968, 3993, 4054, 4061, 4107, 4115, 4117, 4139, 4143, 4188, 4222, 4261, 4319, 4337, 4345, 4346, 4386, 4432, 4452, 4474, 4479, 4542, 4552, 4590, 4602, 4606, 4607, 4613, 4690, 4712, 4720, 4730, 4733, 4750, 4758, 4764, 4765, 4778, 4832, 4836, 4837, 4847, 4868, 4884, 4885, 4891, 4912, 4960, 4972, 5090, 5433, 6455, 6476, 6050, 6481, 6466, 6057, 6409, -- new 6560, 6547, 6548, 6550, 6551, 6552, 6570, 6554, 6566, 4296, 5540, 6399, 6349, 6394, 6351, 5534, --also new 5889, 3910, 5447, 4555, 4813, 6414, 4303, 6416, 4822, 5595, 5532, 5597, 5598, 5599, 5600, 4641, 5481, 4202, 6507, 6188, 5549, 5545, 6576, 4145, 6578, 5468, 5556, 4469, 5403, 6505, 4336, 5113, 5342, 6186, 6249, 5596, 5702, 5567, 4246, 4589, 4675, 4831, 6304, 6113, 6315, 6126, 6336, 6048, 5922, 4867, 6052, 6025, 6063, 5136, 6003, 6132, 4597, 4379, 4538, 5531, 5948, 5120, 6046, 6047, 6432, --blackwood 6616, 6660, 6619, 6404, 6402, 6403, } internal.quest_cadwell = QuestIds { 465, 467, 737, 736, 1341, 1346, 1437, 1529, 1536, 1541, 1591, 1799, 1834, 2130, 2146, 2184, 2192, 2222, 2495, 2496, 2497, 2552, 2564, 2566, 2567, 2997, 3064, 3082, 3174, 3189, 3191, 3235, 3267, 3277, 3280, 3338, 3379, 3584, 3585, 3587, 3588, 3615, 3616, 3632, 3633, 3634, 3637, 3673, 3686, 3687, 3695, 3696, 3705, 3734, 3735, 3749, 3791, 3797, 3810, 3817, 3818, 3826, 3831, 3837, 3838, 3868, 3909, 3928, 3957, 3968, 3978, 4058, 4059, 4060, 4061, 4069, 4075, 4078, 4086, 4095, 4106, 4115, 4116, 4117, 4123, 4124, 4139, 4143, 4147, 4150, 4158, 4166, 4186, 4188, 4193, 4194, 4217, 4222, 4255, 4256, 4260, 4261, 4293, 4294, 4302, 4330, 4331, 4345, 4385, 4386, 4437, 4452, 4453, 4459, 4461, 4479, 4546, 4550, 4573, 4574, 4580, 4587, 4590, 4593, 4601, 4606, 4608, 4613, 4652, 4653, 4690, 4712, 4719, 4720, 4739, 4750, 4755, 4765, 4857, 4868, 4884, 4885, 4902, 4903, 4912, 4922, 4943, 4958, 4959, 4960, 4972, 5024, } -- list of map ID numbers using GetCurrentMapId() -- 1552 Norg-Tzel internal.zone_id_list = { 75, 74, 13, 61, 26, 7, 125, 30, 20, 227, 1, 10, 12, 201, 143, 9, 300, 258, 22, 256, 1429, 1747, 1313, 1348, 1354, 255, 1126, 1006, 994, 1484, 1552, 1555, 1654, 1349, 1060, 1719, 667, 16, 660, 108, 1207, 1208, 1261, } internal.zone_names_list = { [75] = "balfoyen_base_0", [74] = "bleakrock_base_0", [13] = "deshaan_base_0", [61] = "eastmarch_base_0", [26] = "shadowfen_base_0", [7] = "stonefalls_base_0", [125] = "therift_base_0", [30] = "alikr_base_0", [20] = "bangkorai_base_0", [227] = "betnihk_base_0", [1] = "glenumbra_base_0", [10] = "rivenspire_base_0", [12] = "stormhaven_base_0", [201] = "strosmkai_base_0", [143] = "auridon_base_0", [9] = "grahtwood_base_0", [300] = "greenshade_base_0", [258] = "khenarthisroost_base_0", [22] = "malabaltor_base_0", [256] = "reapersmarch_base_0", [1429] = "artaeum_base_0", [1747] = "blackreach_base_0", [1313] = "clockwork_base_0", [1348] = "brassfortress_base_0", [1354] = "clockworkoutlawsrefuge_base_0", [255] = "coldharbour_base_0", [1126] = "craglorn_base_0", [1006] = "goldcoast_base_0", [994] = "hewsbane_base_0", [1484] = "murkmire_base_0", [1552] = "swampisland_ext_base_0", [1555] = "elsweyr_base_0", [1654] = "southernelsweyr_base_0", [1349] = "summerset_base_0", [1060] = "vvardenfell_base_0", [1719] = "westernskryim_base_0", [667] = "wrothgar_base_0", [16] = "ava_whole_0", [660] = "imperialcity_base_0", [108] = "eyevea_base_0", [1207] = "reach_base_0", [1208] = "u28_blackreach_base_0", [1261] = "blackwood_base_0", } --[[ This is a list of quests that can not be completed, until you have completed and achievement. Unlike conditional_quest_list this is not a table. Example, hide "A Cold Wind From the Mountain" while missing the achievement "Hero of Wrothgar". Format: quest_id, the main quest (integer) achievement_quest_id, the achievement ID quest_id = achievement_quest_id ]]-- internal.achievement_quest_list = { [5479] = 1248, -- "A Cold Wind From the Mountain", "Hero of Wrothgar" [6320] = 2463, -- "The Singing Crystal", Mural } --[[ This is a list of quests that when completed, other quests are no longer available. The conditional_quest_id is considered completed as well. Format: quest_id, the main quest (integer) conditional_quest_id, the starter quest that leads you to the main quest (table of integers) quest_id = { conditional_quest_id, } ]]-- internal.conditional_quest_list = { [4453] = { -- A Favor Returned 3956, -- Message To Mournhold }, [3686] = { -- Three Tender Souls 4163, -- Onward To Shadowfen }, [3799] = { -- Scales of Retribution 3732, -- Overrun }, [3978] = { -- Tomb Beneath the Mountain 4184, -- To Pinepeak Caverns 5035, -- Calling Hakra }, [3191] = { -- Reclaiming the Elements 3183, -- To The Wyrd Tree }, [3060] = { -- Seeking the Guardians 3026, -- The Wyrd Sisters }, [2222] = { -- Alasan's Plot 4817, -- Tracking the Hand }, --[[ Double check this, The Scholar of Bergama leads to Gone Missing. Just because you completed it what if you abandon it? ]]-- [2251] = { -- Gone Missing 2193, -- The Scholar of Bergama }, [4712] = { -- The First Step 4799, -- To Saifa in Rawl'kha 5092, -- The Champions at Rawl'kha 4759, -- Hallowed to Rawl'kha }, [3632] = { -- Breaking Fort Virak 5040, -- Taking Precautions }, [974] = { -- A Duke in Exile 3283, -- Werewolves To The North }, [521] = { -- Azura's Aid 5052, -- An Offering To Azura }, [1799] = {-- A City in Black 3566, -- Kingdom in Mourning 4991, -- Dark Wings }, [4850] = { -- Shades Of Green 4790, -- Breaking the Ward }, [4689] = { -- A Door into Moonlight 5091, -- Hallowed to Grimwatch 5093, -- Moons Over Grimwatch }, [4479] = { -- Motes in the Moonlight 4802, -- To Moonmont }, [4139] = { -- Shattered Hopes 5036, -- Honrich Tower }, [4364] = { -- A Thorn in Your Side 4370, -- A Bargain With Shadows 4369, -- The Will of the Worm }, [4370] = { -- A Bargain With Shadows 4369, -- The Will of the Worm 4364, -- A Thorn in Your Side }, [4369] = { -- The Will of the Worm 4364, -- A Thorn in Your Side 4370, -- A Bargain With Shadows }, [4833] = { -- Bosmer Insight 4974, -- Brackenleaf's Briars }, [3695] = { -- Aggressive Negotiations 3635, -- City at the Spire }, [3678] = { -- Trials of the Burnished Scales 3802, -- What Happened at Murkwater }, [3840] = { -- Saving the Relics 3982, -- Bound to the Bog }, [3615] = { -- Wake the Dead 3855, -- Mystery of Othrenis }, [4899] = { -- Beyond the Call 3281, -- Leading the Stand }, [4652] = { -- The Colovian Occupation 3981, -- To Taarengrav 4710, -- Hallowed To Arenthia }, [4147] = { -- The Shackled Guardian 5034, -- A Grave Situation }, [4293] = { -- Putting the Pieces Together 4366, -- To Mathiisen }, [4255] = { -- Ensuring Security 4818, -- To Auridon 5055, -- Missive to the Queen 5058, -- All the Fus }, [5058] = { -- All the Fus 5055, -- Missive to the Queen }, [5055] = { -- Missive to the Queen 5058, -- All the Fus }, [2552] = { -- Army at the Gates 4443, -- To Alcaire Castle }, [4546] = { -- Retaking the Pass 5088, -- Naemon's Return }, [5088] = { -- Naemon's Return 4821, -- Report to Marbruk }, [4574] = { -- Veil of Illusion 4853, -- Woodhearth }, [2130] = { -- Rise of the Dead 4694, -- Word from the Throne }, [4330] = { -- Lifting the Veil 4549, -- Back to Skywatch }, --[[ [1803] = { -- The Water Stone 1804, -- Sunken Knowledge }, [1804] = { -- Sunken Knowledge 1803, -- The Water Stone }, ]]-- [1536] = { -- Fire in the Fields 5052, -- Offering To Azura }, [5052] = { -- Offering To Azura 1536, -- Fire in the Fields }, [4028] = { -- Breaking The Tide 4026, -- Zeren in Peril }, [4026] = { -- Zeren in Peril 4028, -- Breaking The Tide }, [3595] = { -- Wayward Son 3598, -- Giving for the Greater Good }, [3598] = { -- Giving for the Greater Good 3595, -- Wayward Son }, [3653] = { -- Ratting Them Out 3658, -- A Timely Matter }, [3658] = { -- A Timely Matter 3653, -- Ratting Them Out }, [4679] = { -- The Shadow's Embrace 4654, -- An Unusual Circumstance }, [4654] = { -- An Unusual Circumstance 4679, -- The Shadow's Embrace }, [5072] = { -- Aid for Bramblebreach 4735, -- The Staff of Magnus }, [4735] = { -- The Staff of Magnus 5072, -- Aid for Bramblebreach }, --Cyrodiil --[4704] = "Welcome to Cyrodiil", --[4722] = "Welcome to Cyrodiil", --[4725] = "Welcome to Cyrodiil", dc --[4706] = "Reporting for Duty", --[4724] = "Reporting for Duty", --[4727] = "Reporting for Duty", dc --[4705] = "Siege Warfare", --[4723] = "Siege Warfare", --[4726] = "Siege Warfare", dc --[5487] = "City on the Brink", --[5493] = "City on the Brink", dc --[5496] = "City on the Brink", [4706] = { -- Reporting for Duty 4704, -- Welcome to Cyrodiil 4705, -- Siege Warfare }, [1834] = { -- Heart of Evil 4992, -- Searching for the Searchers 3530, -- Destroying the Dark Witnesses }, [3817] = { -- The Seal of Three 5103, -- Mournhold Market Misery }, [2495] = { -- The Signet Ring 5050, -- Waiting for Word }, [1536] = { -- Fire in the Fields" 1735, -- Unanswered Questions }, [5071] = { --Curinure's Invitation 5074, 5076, }, [5074] = { --Rudrasa's Invitation 5071, 5076, }, [5076] = { --Nemarc's Invitation 5071, 5074, }, [5073] = { --Aicessar's Invitation 5077, 5075, }, [5077] = { --Basile's Invitation 5073, 5075, }, [5075] = { --Hilan's Invitation 5073, 5077, }, } --[[ /script LibQuestData_Internal.dm("Debug", LibQuestData.completed_quests[4726]) /script LibQuestData_Internal.dm("Debug", LibQuestData.player_alliance) ]]-- --[[ This is a list of quests that you get when using an object such as Folded Note for Real Marines; ID 4210 [4210] = "Real Marines", "Folded Note" ]]-- internal.object_quest_starter_list = { 4210, 5312, } --[[ These tables are quests for guilds that are not available until you reach a certain rank Format: [QuestID] = rank ]]-- internal.guild_rank_quest_list = { [utils.quest_series_type.quest_type_guild_fighter] = { [3856] = 0, [3858] = 1, [3885] = 2, [3898] = 3, [3973] = 4, }, [utils.quest_series_type.quest_type_guild_mage] = { [3916] = 0, [4435] = 1, [3918] = 2, [3953] = 3, [3997] = 4, [4971] = 4, }, [utils.quest_series_type.quest_type_guild_thief] = { [5549] = 6, [5545] = 7, [5581] = 8, [5553] = 9, }, [utils.quest_series_type.quest_type_guild_dark] = { [5595] = 1, [5599] = 2, [5596] = 3, [5567] = 4, [5597] = 5, [5598] = 6, [5600] = 7, }, }
e22aaf9bf4d6b78edf632307e2569da1442912c1
[ "Markdown", "Lua" ]
6
Lua
Reversive/eso-quest-info
317a383c273bc18cf554b13437e8ff91d9dd3355
0b27f370ff87fd85f6bef72b6b76695c08db02ad
refs/heads/master
<file_sep>from __future__ import print_function import torch.utils.data as data from PIL import Image import os import os.path import errno import numpy as np import torch import codecs import random from path import Path from scipy.misc import imread, imresize import scipy.io as sio class Handseg_RHD(data.Dataset): """`Ox <https://lmb.informatik.uni-freiburg.de/resources/datasets/RenderedHandposeDataset.en.html>`_ Dataset. Args: root (string): Root directory of dataset train (bool, optional): If True, creates dataset from ``training.pt``, otherwise from ``test.pt``. download (bool, optional): If true, downloads the dataset from the internet and puts it in root directory. If dataset is already downloaded, it is not downloaded again. transform (callable, optional): A function/transform that takes in an PIL image and returns a transformed version. E.g, ``transforms.RandomCrop`` target_transform (callable, optional): A function/transform that takes in the target and transforms it. """ training_file = 'training/' test_file = 'evaluation/' def __init__(self, root, train=True, transform=None, target_transform=None, download=False, vis=False): self.root = os.path.expanduser(root) self.transform = transform self.target_transform = target_transform self.train = train # training set or test set self.vis = vis if self.train: self.train_root = (Path(self.root) / self.training_file / 'color') self.train_samples = self.collect_samples(self.train_root, self.training_file) else: self.test_root = (Path(self.root) / self.test_file / 'color') self.test_samples = self.collect_samples(self.test_root, self.test_file) def collect_samples(self, root, file): samples = [] for img in sorted((root).glob('*.png')): _img = img.basename().split('.')[0] label = (Path(self.root) / file / 'hand_mask' / _img + '.png') if self.train: assert label.exists() sample = {'img': img, 'label': label} samples.append(sample) return samples def load_samples(self, s): image = imread(s['img'], mode='RGB') try: label = imread(s['label'], mode='L') except: label = image return [image, label] def __getitem__(self, index): """ Args: index (int): Index Returns: tuple: (image, target) where target is index of the target class. """ if self.train: s = self.train_samples[index] else: s = self.test_samples[index] image, target = self.load_samples(s) # doing this so that it is consistent with all other datasets # to return a PIL Image img = Image.fromarray(np.array(image), mode='RGB') # target = Image.fromarray(np.array(image)) h, w = img.size[0], img.size[1] if self.transform is not None: img = self.transform(img) if self.target_transform is not None: target = self.target_transform(target) target = imresize(target, (256, 256)) hand_mask = (target / 255).astype('uint8') bg_mask = np.logical_not((target/255).astype('uint8')).astype('uint8') target = np.stack((bg_mask, hand_mask), axis=2) if self.vis: return img, target.astype('float'), image return img, target.astype('float') def __len__(self): if self.train: return len(self.train_samples) else: return len(self.test_samples) def __repr__(self): fmt_str = 'Dataset ' + self.__class__.__name__ + '\n' fmt_str += ' Number of datapoints: {}\n'.format(self.__len__()) tmp = 'train' if self.train is True else 'test' fmt_str += ' Split: {}\n'.format(tmp) fmt_str += ' Root Location: {}\n'.format(self.root) tmp = ' Transforms (if any): ' fmt_str += '{0}{1}\n'.format(tmp, self.transform.__repr__().replace('\n', '\n' + ' ' * len(tmp))) tmp = ' Target Transforms (if any): ' fmt_str += '{0}{1}'.format(tmp, self.target_transform.__repr__().replace('\n', '\n' + ' ' * len(tmp))) return fmt_str def visual_box(data, output, i): import cv2 import scipy img = Image.fromarray(np.array(data).squeeze(), mode='RGB') h, w = img.size[0], img.size[1] output = np.array(output).squeeze() output[::2] = output[::2] * w output[1::2] = output[1::2] * h img = cv2.cvtColor(np.asarray(img), cv2.COLOR_RGB2BGR) for j in range(0, 8, 2): cv2.circle(img, (int(output[j + 1]), int(output[j])), 5, (255, 255, 0), -1) # box format (w1, h1, w2, h2, ...) cv2.imwrite('/Data/hand_dataset_ox/vis/{:05d}.jpg'.format(i), img) print('img saving to \'/Data/hand_dataset_ox/vis/{:05d}.jpg\''.format(i)) def process_hand_mask(): import cv2 from collections import Counter root = Path('/Data/RHD_v1-1/RHD_published_v2') file = 'evaluation' masks = sorted((root / file / 'mask').glob('*.png')) hand_mask_dir = root / file / 'hand_mask' hand_mask_dir.mkdir_p() print('total mask png {}'.format(len(masks))) for i in range(len(masks)): print('processing {}/{}'.format(i, len(masks))) mask = cv2.imread(masks[i],cv2.IMREAD_GRAYSCALE) mask_hand = mask > 1 # True for hand, False for bg mask_hand = mask_hand.astype('uint8') * 255 cv2.imwrite(hand_mask_dir / masks[i].basename(), mask_hand) print(1) def visual_mask(image, output, target, i ): import cv2 save_root = Path('./visual_mask') print('saving to {}/{:05d}'.format(save_root, i)) target = torch.argmax(target, dim=3).squeeze() * 255 output = torch.argmax(output.permute([0,2,3,1]), dim=3).squeeze() * 255 # output = # cv2.imwrite(save_root / '{:05}_mask_hand.png'.format(i), (np.array(target.squeeze()[:,:,1])*255).astype('uint8')) # cv2.imwrite(save_root / '{:05}_mask_hand.png'.format(i), (np.array(target.squeeze()[:, :, 0])*255).astype('uint8')) output = np.array(output).astype('uint8') target = np.array(target).astype('uint8') image = np.array(image).squeeze().astype('uint8') cv2.imwrite(save_root / '{:05}.png'.format(i), cv2.cvtColor(image,cv2.COLOR_RGB2BGR)) cv2.imwrite(save_root / '{:05}_pre.png'.format(i), output) cv2.imwrite(save_root / '{:05}_mask.png'.format(i), target) if __name__ == '__main__': process_hand_mask() # import shutil # # data = Path('/Data/RHD_v1-1/RHD_published_v2/evaluation/') # imgs = data.glob("*.png") # imgs.sort() # # for i in range(len(imgs)): # shutil.copyfile(imgs[i], data/'color'/"real_{:05d}.png".format(i))<file_sep>import torch.nn.functional as F import torch def nll_loss(output, target): return F.nll_loss(output, target) def mse_loss(output, target): return F.mse_loss(output, target.float())*10 def softmax_ce(output, target): return F.cross_entropy(output, target.long()) def sigmoid_ce(output, target): return F.binary_cross_entropy(output, target) def softmax_cross_entropy_with_logits(output, target): loss = torch.sum(- target * F.log_softmax(output, -1), -1) mean_loss = loss.mean() return mean_loss def bce(output, target): return F.binary_cross_entropy_with_logits(output, target) # # def bce(output, target): # return torch.nn.BCEWithLogitsLoss(output, target)<file_sep>import torch.nn as nn import math import torch.utils.model_zoo from base import BaseModel def conv3x3(in_channel, out_channel, stride=1): return nn.Conv2d(in_channel, out_channel, kernel_size=3, stride=stride, padding=1, bias=True) class HandSegNet(BaseModel): def __init__(self, in_channel=1, out_channel=1, stride=1, downsample=None): super(HandSegNet, self).__init__() self.conv1 = conv3x3(3, 64) self.conv2 = conv3x3(64, 64) self.maxpool = nn.MaxPool2d(kernel_size=4, stride=2, padding=1) self.conv3 = conv3x3(64, 128) self.conv4 = conv3x3(128, 128) self.conv5 = conv3x3(128, 256) self.conv6 = conv3x3(256, 256) self.conv7 = conv3x3(256, 256) self.conv8 = conv3x3(256, 256) self.conv9 = conv3x3(256, 512) self.conv10 = conv3x3(512, 512) self.conv11 = conv3x3(512, 512) self.conv12 = conv3x3(512, 512) self.conv13 = conv3x3(512, 512) self.conv1x1 = nn.Conv2d(512, 2, kernel_size=1, bias=True) self.upsample = nn.UpsamplingBilinear2d(scale_factor=8) self.relu = nn.ReLU(inplace=True) def forward(self, x): x = self.relu(self.conv1(x)) x = self.relu(self.conv2(x)) x = self.maxpool(x) x = self.relu(self.conv3(x)) x = self.relu(self.conv4(x)) x = self.maxpool(x) x = self.relu(self.conv5(x)) x = self.relu(self.conv6(x)) x = self.relu(self.conv7(x)) x = self.relu(self.conv8(x)) x = self.maxpool(x) x = self.relu(self.conv9(x)) x = self.relu(self.conv10(x)) x = self.relu(self.conv11(x)) x = self.relu(self.conv12(x)) x = self.relu(self.conv13(x)) x = self.conv1x1(x) self.out = self.upsample(x) # self.mask_hand = torch.argmax(self.out, dim=1) return self.out if __name__ == "__main__": model = HandSegNet() x = torch.randn(1, 3, 224, 224) print(model) print(model(x))<file_sep>import scipy.io from torch.utils.data import Dataset, DataLoader import numpy as np from PIL import Image import os import glob import scipy.io import random class Huawei_Data(Dataset): def __init__(self, root_path, list_path, is_training, transform=None, data_format='png'): self.list_path = list_path self.root_path = root_path self.transform = transform self.is_training = is_training self.data_format = data_format with open(self.list_path, 'r') as f: list_old = f.readlines() self.list = [] for path in list_old: imgs_path = glob.glob(os.path.join(self.root_path, path.split(',')[0], '*.' + self.data_format)) num_frames = len(imgs_path) if num_frames >= 8: self.list.append(path) def _get_val_indices(self, num_frames): if num_frames >= 16: sample = np.arange(0, 16, 2) res = num_frames - 16 offset = np.random.randint(0, res + 1) offsets = sample + offset elif num_frames >= 8: sample = np.arange(0, 8, 1) res = num_frames - 8 offset = np.random.randint(0, res + 1) offsets = sample + offset else: offsets = np.zeros((8)) return offsets def _get_sequence(self, num_frames): if num_frames < 16: window = 8 elif num_frames < 32: window = 16 else: window = 32 sample = np.arange(0, window, window // 8) res = num_frames - window try: offset = np.random.randint(0, res + 1) except: offset = 0 offsets = sample + offset return offsets def _get_sequence_glob(self, num_frames): offset = np.arange(0, 8 * (num_frames // 8), num_frames // 8) res = np.random.randint(0, 1 + num_frames % 8) return offset + res def _get_val_indices_random(self, num_frames): offsets = np.random.choice(num_frames, 8, replace=False) offsets.sort() return offsets def _load_image(self, img_path): img = Image.open(img_path).convert('RGB') return img def _load_mat_2_img(self, mat_path): mat = scipy.io.loadmat(mat_path)['resized_rgb'] img = Image.fromarray(mat) img = img.resize((640, 480)) return img def _new_label(self, label): if label == 0: label = 1 elif label == 1: label = 2 elif label == 2: label = 3 elif label == 4: label = 4 elif label == 5: label = 5 elif label == 6: label = 6 elif label == 7: label = 7 elif label == 10: label = 8 else: label = 0 return label def _take_num(self, path): return int(path.split('/')[-1].split('.')[0]) def _random_flip(self, imgs, label): if random.random() < 0.5: label = int(label) imgs_flip = [] for img in imgs: img_flip = img.transpose(Image.FLIP_LEFT_RIGHT) imgs_flip.append(img_flip) if label == 1: label_flip = 2 elif label == 2: label_flip = 1 elif label == 4: label_flip = 5 elif label == 5: label_flip = 4 else: label_flip = label return imgs_flip, label_flip else: return imgs, label def __len__(self): return len(self.list) def __getitem__(self, idx): imgs_path = glob.glob(os.path.join(self.root_path, self.list[idx].split(',')[0], '*.' + self.data_format)) label = self.list[idx].split(',')[-1].strip('\n') # label = self._new_label(int(label)) imgs_path.sort(key=self._take_num) num_frames = len(imgs_path) if self.is_training: indices = self._get_sequence(num_frames) else: indices = self._get_sequence(num_frames) images = [] for seg_ind in indices: # indices: [2,4,7,9,12,14,17,19] p = int(seg_ind) try: seg_imgs = self._load_image(imgs_path[p]) except: print('lenth {}, index {}, file{}'.format(num_frames, indices, self.list[idx])) seg_imgs = self._load_image(imgs_path[int(indices[3])]) with open('jpg_error_img.txt', 'a+') as f: f.write(imgs_path + '\n') images.append(seg_imgs) images, label = self._random_flip(images, label) if self.transform: images = self.transform(images) # return images, int(label_flip), self.list[idx].split(' ')[0] return images, int(label) class pipelineDataset(Dataset): def __init__(self, root_path, img_dir, transform=None): img_path = os.path.join(root_path, img_dir) self.imgs = glob.glob(img_path + '*.png') self.imgs.sort(key=lambda x: int(os.path.basename(x).split('_')[0])) self.transform = transform def __len__(self): return len(self.imgs) // 8 def __getitem__(self, idx): imgs_seg = self.imgs[idx * 8: (idx + 1) * 8] imgs_seg.sort() images = [Image.open(i).convert('RGB') for i in imgs_seg] if self.transform: images = self.transform(images) return images, imgs_seg if __name__ == '__main__': mat = scipy.io.loadmat( '/Data/Data3/Data_new/GestureData2/20181106_3#/201811060958009_02/201811060958009_02_clean/frame_48.mat')[ 'resized_rgb'] print(1)<file_sep>from __future__ import print_function import torch.utils.data as data from PIL import Image import os import os.path import errno import numpy as np import torch import codecs import random from path import Path from scipy.misc import imread import scipy.io as sio class Ox_hand(data.Dataset): """`Ox <http://www.robots.ox.ac.uk/~vgg/data/hands/index.html>`_ Dataset. Args: root (string): Root directory of dataset train (bool, optional): If True, creates dataset from ``training.pt``, otherwise from ``test.pt``. download (bool, optional): If true, downloads the dataset from the internet and puts it in root directory. If dataset is already downloaded, it is not downloaded again. transform (callable, optional): A function/transform that takes in an PIL image and returns a transformed version. E.g, ``transforms.RandomCrop`` target_transform (callable, optional): A function/transform that takes in the target and transforms it. """ raw_folder = 'raw' training_file = 'training_dataset/training_data' test_file = 'test_dataset/test_data' valid_file = 'validation_dataset/validation_data' def __init__(self, root, train=True, transform=None, target_transform=None, download=False, vis=False): self.root = os.path.expanduser(root) self.transform = transform self.target_transform = target_transform self.train = train # training set or test set self.vis = vis if self.train: self.train_root = (Path(self.root) / self.training_file / 'images') self.train_samples = self.collect_samples(self.train_root, self.training_file) self.validation_root = (Path(self.root) / self.valid_file / 'images') self.validation_samples = self.collect_samples(self.validation_root, self.valid_file) else: self.test_root = (Path(self.root) / self.test_file / 'images') self.test_samples = self.collect_samples(self.test_root, self.test_file) def collect_samples(self, root, file): samples = [] for img in sorted((root).glob('*.jpg')): _img = img.basename().split('.')[0] label = (Path(self.root) / file / 'annotations' / _img + '.mat') assert label.exists() try: mat = sio.loadmat(label) box_num = len(mat['boxes'][0]) for i in range(box_num): box = np.array([e for e in mat['boxes'][0][i].ravel()[0]]) box = box sample = {'img': img, 'label': label} samples.append(sample) except: print('data {} error'.format(img)) return samples # def load_samples(self): def load_samples(self, s): image = imread(s['img'], mode='RGB') mat = sio.loadmat(s['label']) box_num = len(mat['boxes'][0]) boxes = [] for i in range(box_num): box = np.array([e for e in mat['boxes'][0][i].ravel()[0]]) boxes.extend([np.array([e for e in np.array(box[:4])]).reshape(8)]) return [image, boxes[random.randrange(0,box_num)]] def __getitem__(self, index): """ Args: index (int): Index Returns: tuple: (image, target) where target is index of the target class. """ if self.train: s = self.train_samples[index] else: s = self.test_samples[index] image, target = self.load_samples(s) # doing this so that it is consistent with all other datasets # to return a PIL Image img = Image.fromarray(np.array(image), mode='RGB') h, w = img.size[0], img.size[1] target[::2] = target[::2] / w target[1::2] = target[1::2] / h if self.transform is not None: img = self.transform(img) if self.target_transform is not None: target = self.target_transform(target) if self.vis == True: return img, target, image return img, target def __len__(self): if self.train: return len(self.train_samples) else: return len(self.test_samples) def __repr__(self): fmt_str = 'Dataset ' + self.__class__.__name__ + '\n' fmt_str += ' Number of datapoints: {}\n'.format(self.__len__()) tmp = 'train' if self.train is True else 'test' fmt_str += ' Split: {}\n'.format(tmp) fmt_str += ' Root Location: {}\n'.format(self.root) tmp = ' Transforms (if any): ' fmt_str += '{0}{1}\n'.format(tmp, self.transform.__repr__().replace('\n', '\n' + ' ' * len(tmp))) tmp = ' Target Transforms (if any): ' fmt_str += '{0}{1}'.format(tmp, self.target_transform.__repr__().replace('\n', '\n' + ' ' * len(tmp))) return fmt_str def visual_box(data, output, i): import cv2 import scipy img = Image.fromarray(np.array(data).squeeze(), mode='RGB') h, w = img.size[0], img.size[1] output = np.array(output).squeeze() output[::2] = output[::2] * w output[1::2] = output[1::2] * h img = cv2.cvtColor(np.asarray(img), cv2.COLOR_RGB2BGR) for j in range(0,8,2): cv2.circle(img, (int(output[j+1]), int(output[j])), 5, (255,255,0), -1) # box format (w1, h1, w2, h2, ...) cv2.imwrite('/Data/hand_dataset_ox/vis/{:05d}.jpg'.format(i), img) print('img saving to \'/Data/hand_dataset_ox/vis/{:05d}.jpg\''.format(i)) if __name__ == '__main__': visual_box()<file_sep>import torch.nn as nn from model.Resnet_reg import resnet50 from base import BaseModel import numpy as np def return_relationset(num_frames, num_frames_relation): import itertools indice_all = list(itertools.combinations([i for i in range(num_frames)], num_frames_relation)) indice_return=[] if num_frames_relation < 6: for indice in indice_all: total_dist = 0 indice= list(indice) for i in range(1, len(indice)): total_dist += (indice[i] - indice[i - 1]) if total_dist > num_frames_relation + 1 : indice_return.append(indice) return indice_return[::len(indice_return)//3+1] else: return indice_all[::len(indice_return)//3+1] class TRN_module(BaseModel): def __init__(self, img_feature_dim, num_frames, num_class): super(TRN_module, self).__init__() self.subsample_num = 3 # how many relations selected to sum up self.img_feature_dim = img_feature_dim self.scales = [i for i in range(num_frames, 1, -1)] # generate the multiple frame relations self.relations_scales = [] self.subsample_scales = [] for scale in self.scales: relations_scale = self.return_relationset(num_frames, scale) self.relations_scales.append(relations_scale) self.subsample_scales.append(min(self.subsample_num, len(relations_scale))) # how many samples of relation to select in each forward pass self.num_class = num_class self.num_frames = num_frames num_bottleneck = 256 self.fc_fusion_scales = nn.ModuleList() # high-tech modulelist for i in range(len(self.scales)): scale = self.scales[i] fc_fusion = nn.Sequential( nn.ReLU(), nn.Linear(scale * self.img_feature_dim, num_bottleneck), nn.ReLU(), nn.Linear(num_bottleneck, self.num_class), ) self.fc_fusion_scales += [fc_fusion] print('Multi-Scale Temporal Relation Network Module in use', ['%d-frame relation' % i for i in self.scales]) def forward(self, input): # the first one is the largest scale act_all = input[:, self.relations_scales[0][0] , :] act_all = act_all.view(act_all.size(0), self.scales[0] * self.img_feature_dim) act_all = self.fc_fusion_scales[0](act_all) for scaleID in range(1, len(self.scales)): # iterate over the scales idx_relations_randomsample = np.random.choice(len(self.relations_scales[scaleID]), self.subsample_scales[scaleID], replace=False) for idx in idx_relations_randomsample: act_relation = input[:, self.relations_scales[scaleID][idx], :] act_relation = act_relation.view(act_relation.size(0), self.scales[scaleID] * self.img_feature_dim) act_relation = self.fc_fusion_scales[scaleID](act_relation) act_all += act_relation return act_all def return_relationset(self, num_frames, num_frames_relation): import itertools return list(itertools.combinations([i for i in range(num_frames)], num_frames_relation)) class TRN_withclassifier(BaseModel): # relation module in multi-scale with a classifier at the end def __init__(self, img_feature_dim, num_frames, num_class): super(TRN_withclassifier, self).__init__() self.subsample_num = 3 # how many relations selected to sum up self.img_feature_dim = img_feature_dim self.scales = [i for i in range(num_frames, 1, -1)] # self.relations_scales = [] self.subsample_scales = [] for scale in self.scales: relations_scale = self.return_relationset(num_frames, scale) self.relations_scales.append(relations_scale) self.subsample_scales.append(min(self.subsample_num, len(relations_scale))) # how many samples of relation to select in each forward pass self.num_class = num_class self.num_frames = num_frames num_bottleneck = 256 self.fc_fusion_scales = nn.ModuleList() # high-tech modulelist self.classifier_scales = nn.ModuleList() for i in range(len(self.scales)): scale = self.scales[i] fc_fusion = nn.Sequential( nn.ReLU(), nn.Linear(scale * self.img_feature_dim, num_bottleneck), nn.ReLU(), nn.Dropout(p=0.6),# this is the newly added thing nn.Linear(num_bottleneck, num_bottleneck), nn.ReLU(), nn.Dropout(p=0.6), ) classifier = nn.Linear(num_bottleneck, self.num_class) self.fc_fusion_scales += [fc_fusion] self.classifier_scales += [classifier] # maybe we put another fc layer after the summed up results??? print('Multi-Scale Temporal Relation with classifier in use') print(['%d-frame relation' % i for i in self.scales]) def forward(self, input): # the first one is the largest scale act_all = input[:, self.relations_scales[0][0] , :] act_all = act_all.view(act_all.size(0), self.scales[0] * self.img_feature_dim) act_all = self.fc_fusion_scales[0](act_all) act_all = self.classifier_scales[0](act_all) for scaleID in range(1, len(self.scales)): # iterate over the scales idx_relations_randomsample = np.random.choice(len(self.relations_scales[scaleID]), self.subsample_scales[scaleID], replace=False) for idx in idx_relations_randomsample: act_relation = input[:, self.relations_scales[scaleID][idx], :] act_relation = act_relation.view(act_relation.size(0), self.scales[scaleID] * self.img_feature_dim) act_relation = self.fc_fusion_scales[scaleID](act_relation) act_relation = self.classifier_scales[scaleID](act_relation) act_all += act_relation return act_all def return_relationset(self, num_frames, num_frames_relation): import itertools return list(itertools.combinations([i for i in range(num_frames)], num_frames_relation)) <file_sep>import torch.nn as nn import math from base import BaseModel from model.mobilenetV2 import MobileNet2 from model.TRNmodule import TRN_module class TRN(BaseModel): def __init__(self, n_class): super(TRN, self).__init__() self.mobilenet_v2 = MobileNet2() self.new_fc = nn.Linear(2048, 256) self.TRN_module = TRN_module(256, num_frames=8, num_class=n_class) def forward(self, x): x = self.mobilenet_v2(x) x = self.new_fc(x) x = self.TRN_module(x) return x <file_sep> import torch.nn as nn import torchvision.models as models import torch.nn.functional as F class BaseRefineNet4Cascade(nn.Module): def __init__(self, input_shape, refinenet_block, n_classes=1, features=256, resnet_factory=models.resnet101, pretrained=True, freeze_resnet=True): """Multi-path 4-Cascaded RefineNet for image segmentation Args: input_shape ((int, int)): (channel, size) assumes input has equal height and width refinenet_block (block): RefineNet Block n_classes (int, optional): number of classes features (int, optional): number of features in refinenet resnet_factory (func, optional): A Resnet model from torchvision. Default: models.resnet101 pretrained (bool, optional): Use pretrained version of resnet Default: True freeze_resnet (bool, optional): Freeze resnet model Default: True Raises: ValueError: size of input_shape not divisible by 32 """ super().__init__() input_channel, input_size = input_shape if input_size % 32 != 0: raise ValueError("{} not divisble by 32".format(input_shape)) resnet = resnet_factory(pretrained=pretrained) self.layer1 = nn.Sequential(resnet.conv1, resnet.bn1, resnet.relu, resnet.maxpool, resnet.layer1) self.layer2 = resnet.layer2 self.layer3 = resnet.layer3 self.layer4 = resnet.layer4 if freeze_resnet: layers = [self.layer1, self.layer2, self.layer3, self.layer4] for layer in layers: for param in layer.parameters(): param.requires_grad = False self.layer1_rn = nn.Conv2d( 256, features, kernel_size=3, stride=1, padding=1, bias=False) self.layer2_rn = nn.Conv2d( 512, features, kernel_size=3, stride=1, padding=1, bias=False) self.layer3_rn = nn.Conv2d( 1024, features, kernel_size=3, stride=1, padding=1, bias=False) self.layer4_rn = nn.Conv2d( 2048, 2 * features, kernel_size=3, stride=1, padding=1, bias=False) self.refinenet4 = RefineNetBlock(2 * features, (2 * features, input_size // 32)) self.refinenet3 = RefineNetBlock(features, (2 * features, input_size // 32), (features, input_size // 16)) self.refinenet2 = RefineNetBlock(features, (features, input_size // 16), (features, input_size // 8)) self.refinenet1 = RefineNetBlock(features, (features, input_size // 8), (features, input_size // 4)) self.output_conv = nn.Sequential( ResidualConvUnit(features), ResidualConvUnit(features), nn.Conv2d( features, n_classes, kernel_size=1, stride=1, padding=0, bias=True)) self.upsampling = nn.UpsamplingBilinear2d(scale_factor=4) def forward(self, x): layer_1 = self.layer1(x) layer_2 = self.layer2(layer_1) layer_3 = self.layer3(layer_2) layer_4 = self.layer4(layer_3) layer_1_rn = self.layer1_rn(layer_1) layer_2_rn = self.layer2_rn(layer_2) layer_3_rn = self.layer3_rn(layer_3) layer_4_rn = self.layer4_rn(layer_4) path_4 = self.refinenet4(layer_4_rn) path_3 = self.refinenet3(path_4, layer_3_rn) path_2 = self.refinenet2(path_3, layer_2_rn) path_1 = self.refinenet1(path_2, layer_1_rn) out = self.output_conv(path_1) out = self.upsampling(out) return F.sigmoid(out) class RefineNet4CascadePoolingImproved(BaseRefineNet4Cascade): def __init__(self, input_shape, n_classes=1, features=256, resnet_factory=models.resnet101, pretrained=True, freeze_resnet=True): """Multi-path 4-Cascaded RefineNet for image segmentation with improved pooling Args: input_shape ((int, int)): (channel, size) assumes input has equal height and width refinenet_block (block): RefineNet Block num_classes (int, optional): number of classes features (int, optional): number of features in refinenet resnet_factory (func, optional): A Resnet model from torchvision. Default: models.resnet101 pretrained (bool, optional): Use pretrained version of resnet Default: True freeze_resnet (bool, optional): Freeze resnet model Default: True Raises: ValueError: size of input_shape not divisible by 32 """ super().__init__( input_shape, RefineNetBlockImprovedPooling, n_classes=n_classes, features=features, resnet_factory=resnet_factory, pretrained=pretrained, freeze_resnet=freeze_resnet) class RefineNet4Cascade(BaseRefineNet4Cascade): def __init__(self, input_shape, n_classes=1, features=256, resnet_factory=models.resnet101, pretrained=True, freeze_resnet=True): """Multi-path 4-Cascaded RefineNet for image segmentation Args: input_shape ((int, int)): (channel, size) assumes input has equal height and width refinenet_block (block): RefineNet Block num_classes (int, optional): number of classes features (int, optional): number of features in refinenet resnet_factory (func, optional): A Resnet model from torchvision. Default: models.resnet101 pretrained (bool, optional): Use pretrained version of resnet Default: True freeze_resnet (bool, optional): Freeze resnet model Default: True Raises: ValueError: size of input_shape not divisible by 32 """ super().__init__( input_shape, RefineNetBlock, n_classes=n_classes, features=features, resnet_factory=resnet_factory, pretrained=pretrained, freeze_resnet=freeze_resnet) import torch.nn as nn class ResidualConvUnit(nn.Module): def __init__(self, features): super().__init__() self.conv1 = nn.Conv2d( features, features, kernel_size=3, stride=1, padding=1, bias=True) self.conv2 = nn.Conv2d( features, features, kernel_size=3, stride=1, padding=1, bias=False) self.relu = nn.ReLU(inplace=True) def forward(self, x): out = self.relu(x) out = self.conv1(out) out = self.relu(out) out = self.conv2(out) return out + x class MultiResolutionFusion(nn.Module): def __init__(self, out_feats, *shapes): super().__init__() _, max_size = max(shapes, key=lambda x: x[1]) self.scale_factors = [] for i, shape in enumerate(shapes): feat, size = shape if max_size % size != 0: raise ValueError("max_size not divisble by shape {}".format(i)) self.scale_factors.append(max_size // size) self.add_module( "resolve{}".format(i), nn.Conv2d( feat, out_feats, kernel_size=3, stride=1, padding=1, bias=False)) def forward(self, *xs): output = self.resolve0(xs[0]) if self.scale_factors[0] != 1: output = nn.functional.interpolate( output, scale_factor=self.scale_factors[0], mode='bilinear', align_corners=True) for i, x in enumerate(xs[1:], 1): output += self.__getattr__("resolve{}".format(i))(x) if self.scale_factors[i] != 1: output = nn.functional.interpolate( output, scale_factor=self.scale_factors[i], mode='bilinear', align_corners=True) return output class ChainedResidualPool(nn.Module): def __init__(self, feats): super().__init__() self.relu = nn.ReLU(inplace=True) for i in range(1, 4): self.add_module( "block{}".format(i), nn.Sequential( nn.MaxPool2d(kernel_size=5, stride=1, padding=2), nn.Conv2d( feats, feats, kernel_size=3, stride=1, padding=1, bias=False))) def forward(self, x): x = self.relu(x) path = x for i in range(1, 4): path = self.__getattr__("block{}".format(i))(path) x = x + path return x class ChainedResidualPoolImproved(nn.Module): def __init__(self, feats): super().__init__() self.relu = nn.ReLU(inplace=True) for i in range(1, 5): self.add_module( "block{}".format(i), nn.Sequential( nn.Conv2d( feats, feats, kernel_size=3, stride=1, padding=1, bias=False), nn.MaxPool2d(kernel_size=5, stride=1, padding=2))) def forward(self, x): x = self.relu(x) path = x for i in range(1, 5): path = self.__getattr__("block{}".format(i))(path) x += path return x class BaseRefineNetBlock(nn.Module): def __init__(self, features, residual_conv_unit, multi_resolution_fusion, chained_residual_pool, *shapes): super().__init__() for i, shape in enumerate(shapes): feats = shape[0] self.add_module( "rcu{}".format(i), nn.Sequential( residual_conv_unit(feats), residual_conv_unit(feats))) if len(shapes) != 1: self.mrf = multi_resolution_fusion(features, *shapes) else: self.mrf = None self.crp = chained_residual_pool(features) self.output_conv = residual_conv_unit(features) def forward(self, *xs): rcu_xs = [] for i, x in enumerate(xs): rcu_xs.append(self.__getattr__("rcu{}".format(i))(x)) if self.mrf is not None: out = self.mrf(*rcu_xs) else: out = rcu_xs[0] out = self.crp(out) return self.output_conv(out) class RefineNetBlock(BaseRefineNetBlock): def __init__(self, features, *shapes): super().__init__(features, ResidualConvUnit, MultiResolutionFusion, ChainedResidualPool, *shapes) class RefineNetBlockImprovedPooling(nn.Module): def __init__(self, features, *shapes): super().__init__(features, ResidualConvUnit, MultiResolutionFusion, ChainedResidualPoolImproved, *shapes) if __name__ == '__main__': import torch data = torch.randn([8,3,224,224]) models = BaseRefineNet4Cascade((3, 224,), refinenet_block=1,n_classes=2) out = models(data) print(models) <file_sep>import os import torch from torch.autograd.variable import Variable def ensure_dir(path): if not os.path.exists(path): os.makedirs(path) def make_one_hot(labels, C=2): ''' Converts an integer label torch.autograd.Variable to a one-hot Variable. Parameters ---------- labels : torch.autograd.Variable of torch.cuda.LongTensor N x 1 x H x W, where N is batch size. Each value is an integer representing correct classification. C : integer. number of classes in labels. Returns ------- target : torch.autograd.Variable of torch.cuda.FloatTensor N x C x H x W, where C is class number. One-hot encoded. ''' one_hot = torch.zeros(len(labels), 2) one_hot[torch.arange(len(labels)), labels] =1 target = Variable(one_hot) return target
7500cb686e0941d8faf9b6a4f404865a78fa18dc
[ "Python" ]
9
Python
qiufeng1994/pytorch-template
8648e347c9610bf60dbbd30854df4e02bba95633
4302f75c9e2c341ca846712a0f1c2fd8fbd02422
refs/heads/master
<file_sep># Generated by Django 3.1 on 2020-09-20 06:52 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('auctions', '0006_auto_20200915_1604'), ] operations = [ migrations.AddField( model_name='listing', name='winner', field=models.CharField(default=None, max_length=128), preserve_default=False, ), ] <file_sep>from django.contrib.auth.models import AbstractUser from django.db import models class User(AbstractUser): pass class Listing(models.Model): seller = models.ForeignKey(User, on_delete=models.CASCADE) title = models.CharField(max_length=128) image = models.URLField() content = models.TextField(max_length=512) starting_bid = models.DecimalField(max_digits=10, decimal_places=2) current_bid = models.DecimalField(max_digits=10, decimal_places=2, default=0) category = models.CharField(max_length=128) active = models.BooleanField(default=True) date = models.DateTimeField(auto_now_add=True) winner = models.CharField(max_length=128) def __str__(self): return f"Listing {self.id} : {self.title} published on {self.date} by {self.seller}. Starting bid : ${self.starting_bid} - Category : {self.category} " class Bid(models.Model): user = models.ForeignKey(User, on_delete=models.CASCADE) listing = models.ForeignKey(Listing, on_delete=models.CASCADE) amount = models.DecimalField(max_digits=10, decimal_places=2) date = models.DateTimeField(auto_now_add=True) def __str__(self): return f"Bid for auction number {self.auction.id} : {self.auction.title} of ${self.amount} made by {self.user} on {self.date}" class Comment(models.Model): user = models.ForeignKey(User, on_delete=models.CASCADE) listing = models.ForeignKey(Listing, on_delete=models.CASCADE) comment = models.CharField(max_length=256) date = models.DateTimeField(auto_now_add=True) def __str__(self): return f"{self.user} commented on {self.listing.title} : {self.comment}" class Watchlist(models.Model): user = models.ForeignKey(User, on_delete=models.CASCADE) listing = models.ForeignKey(Listing, on_delete=models.CASCADE) def __str__(self): return f"Watchlist of user {self.user}" <file_sep># Generated by Django 3.1 on 2020-08-27 11:32 from django.conf import settings from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): dependencies = [ ('auctions', '0001_initial'), ] operations = [ migrations.CreateModel( name='Category', fields=[ ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), ('name', models.CharField(max_length=15)), ], ), migrations.CreateModel( name='Listing', fields=[ ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), ('title', models.CharField(max_length=128)), ('image', models.URLField()), ('content', models.TextField()), ('starting_bid', models.DecimalField(decimal_places=2, max_digits=10)), ('current_bid', models.DecimalField(decimal_places=2, max_digits=10)), ('active', models.BooleanField(default=True)), ('date', models.DateTimeField(auto_now_add=True)), ('category', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='auctions.category')), ('seller', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)), ], ), migrations.CreateModel( name='Watchlist', fields=[ ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), ('listing', models.ManyToManyField(blank=True, to='auctions.Listing')), ('user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)), ], ), migrations.CreateModel( name='Comment', fields=[ ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), ('comment', models.CharField(max_length=256)), ('date', models.DateTimeField(auto_now_add=True)), ('listing', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='auctions.listing')), ('user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)), ], ), migrations.CreateModel( name='Bid', fields=[ ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), ('amount', models.DecimalField(decimal_places=2, max_digits=10)), ('date', models.DateTimeField(auto_now_add=True)), ('listing', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='auctions.listing')), ('user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)), ], ), ] <file_sep># commerce CS50W 2020 commerce <file_sep># Generated by Django 3.1 on 2020-09-12 15:02 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('auctions', '0002_bid_category_comment_listing_watchlist'), ] operations = [ migrations.AlterField( model_name='listing', name='category', field=models.CharField(max_length=128), ), migrations.DeleteModel( name='Category', ), ] <file_sep>from django.contrib.auth import authenticate, login, logout from django.contrib.auth.decorators import login_required from django.db import IntegrityError from django.http import HttpResponse, HttpResponseRedirect from django.shortcuts import render from django.urls import reverse from django.contrib import messages from .models import * def index(request): listings = Listing.objects.all().filter(active=True) return render(request, "auctions/index.html", { "listings": listings }) def login_view(request): if request.method == "POST": # Attempt to sign user in username = request.POST["username"] password = request.POST["password"] user = authenticate(request, username=username, password=<PASSWORD>) # Check if authentication successful if user is not None: login(request, user) return HttpResponseRedirect(reverse("index")) else: return render(request, "auctions/login.html", { "message": "Invalid username and/or password." }) else: return render(request, "auctions/login.html") def logout_view(request): logout(request) return HttpResponseRedirect(reverse("index")) def register(request): if request.method == "POST": username = request.POST["username"] email = request.POST["email"] # Ensure password matches confirmation password = request.POST["password"] confirmation = request.POST["confirmation"] if password != confirmation: return render(request, "auctions/register.html", { "message": "Passwords must match." }) # Attempt to create new user try: user = User.objects.create_user(username, email, password) user.save() except IntegrityError: return render(request, "auctions/register.html", { "message": "Username already taken." }) login(request, user) return HttpResponseRedirect(reverse("index")) else: return render(request, "auctions/register.html") @login_required(login_url='/login') def create(request): if request.method == "GET": return render(request, "auctions/create.html") seller = request.user title = request.POST.get("title") image = request.POST.get("image") if image == "": image = "https://i.imgur.com/GQPN5Q9.jpg" content = request.POST.get("content") starting_bid = request.POST.get("starting_bid") if starting_bid == "": starting_bid = 0 category = request.POST.get("category") new_listing = Listing(seller=seller, title=title, image=image, content=content, starting_bid=starting_bid, current_bid=starting_bid, category=category) new_listing.save() messages.add_message(request, messages.SUCCESS, "Listing created") return HttpResponseRedirect(reverse("view", args=(new_listing.pk,))) def view(request, pid): listing = Listing.objects.get(pk=pid) print("pid", pid) comments = Comment.objects.filter(listing=listing) bids = Bid.objects.filter(listing=listing) if request.method == "POST": listing = Listing.objects.get(pk=pid) bid = float(request.POST.get('bid')) if listing.current_bid >= bid: messages.add_message(request, messages.ERROR, "Your bid needs to be higher than the current bid") return render(request, "auctions/listing.html", { "listing": listing, "comments": comments, "bids": bids, }) user = request.user new_bid = Bid(user=user, listing_id=pid, amount=bid) new_bid.save() listing.current_bid = bid listing.save() messages.add_message(request, messages.SUCCESS, "Bid added") return render(request, "auctions/listing.html", { "listing": listing, "comments": comments, "bids": bids, }) return render(request, "auctions/listing.html", { "listing": listing, "comments": comments, "bids": bids, }) def watchlist(request): user = request.user list_ids = Watchlist.objects.values_list('listing', flat=True).filter(user=user) lists = [] for pid in list_ids: lists.append(Listing.objects.get(pk=pid)) return render(request, "auctions/watchlist.html", { "listings": lists }) def categories(request): return None def comment(request, pid): user = request.user cmt = request.POST.get("comment") new_comment = Comment(user=user, listing_id=pid, comment=cmt) new_comment.save() messages.add_message(request, messages.SUCCESS, "Comment added") return HttpResponseRedirect(reverse("view", args=(pid,))) def addwatchlist(request, pid): user = request.user listing = Listing.objects.get(pk=pid) check = Watchlist.objects.filter(user=user, listing_id=pid).first() if check is not None: messages.add_message(request, messages.ERROR, "Listing already exists in Watchlist") return HttpResponseRedirect(reverse("view", args=(pid,))) new_watchlist = Watchlist(user=user, listing_id=listing.pk) new_watchlist.save() messages.add_message(request, messages.SUCCESS, "Added to Watchlist") return HttpResponseRedirect(reverse("view", args=(pid,))) def deletewatchlist(request, pid): watch_list = Watchlist.objects.get(listing_id=pid) watch_list.delete() messages.add_message(request, messages.SUCCESS, 'Listing removed from Watchlist') return HttpResponseRedirect(reverse("watchlist")) def close(request, pid): if request.method == "POST": listing = Listing.objects.get(pk=pid) if request.user == listing.seller: listing.active = False closed_listing = Bid.objects.filter(listing_id=pid).order_by('-amount').first() if closed_listing is None: listing.winner = request.user.username else: listing.winner = closed_listing.user.username listing.save() messages.add_message(request, messages.SUCCESS, "Listing closed") return HttpResponseRedirect(reverse("view", args=(pid,))) else: messages.add_message(request, messages.ERROR, "You can't close this listing") return HttpResponseRedirect(reverse("view", args=(pid,))) def categories(request): listings = Listing.objects.all() category_list = [] for listing in listings: if listing.category not in category_list and listing.category != "": category_list.append(listing.category) return render(request, "auctions/categories.html", { "categories": category_list }) def get_category(request, category): listings = Listing.objects.all() list = [] for l in listings: if l.category == category and l.active: list.append(l) return render(request, "auctions/index.html", { "listings": list }) <file_sep># Generated by Django 3.1 on 2020-09-12 15:06 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('auctions', '0003_auto_20200912_1902'), ] operations = [ migrations.AlterField( model_name='listing', name='content', field=models.TextField(max_length=512), ), ]
41fcd242edfcb739c6fcb304bf7df8fe12ed1221
[ "Markdown", "Python" ]
7
Python
Elmar2001/commerce
ab75d757445b4ac7b263a3e296a1e23b916f9b47
ccd7a1e6a6ac69bdf2afae2fe3272aa64e3f6d97
refs/heads/master
<file_sep>using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; public partial class user_MasterPage : System.Web.UI.MasterPage { protected void Page_Load(object sender, EventArgs e) { Label1.Text = Application["ctr"].ToString(); Label2.Text = Application["ctr1"].ToString(); // Label3.Text = Request.QueryString["ab"].ToString(); } } <file_sep>using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; public partial class admin_Default : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { } protected void Button1_Click(object sender, EventArgs e) { nsgumtree.clspln obj = new nsgumtree.clspln(); nsgumtree.clsplnprp objprp = new nsgumtree.clsplnprp(); objprp.plnsubcatcod = Convert.ToInt32(DropDownList2.SelectedValue); objprp.plncst = Convert.ToSingle(TextBox1.Text); if (Button1.Text == "submit") obj.save_rec(objprp); else { objprp.plncod = Convert.ToInt32(ViewState["cod"]); obj.update_rec(objprp); Button1.Text = "submit"; } TextBox1.Text = string.Empty; GridView1.DataBind(); } protected void GridView1_RowEditing(object sender, GridViewEditEventArgs e) { Int32 a = Convert.ToInt32(GridView1.DataKeys[e.NewEditIndex][0]); nsgumtree.clspln obj = new nsgumtree.clspln(); List<nsgumtree.clsplnprp> k = obj.find_rec(a); DropDownList1.DataBind(); DropDownList1.SelectedIndex = -1; nsgumtree.clssubcat obj1 = new nsgumtree.clssubcat(); List<nsgumtree.clssubcatprp> k1 = obj1.find_rec(k[0].plnsubcatcod); DropDownList1.Items.FindByValue(k1[0].subcatcatcod.ToString()).Selected = true; DropDownList2.DataBind(); DropDownList2.SelectedIndex = -1; DropDownList2.Items.FindByValue(k[0].plnsubcatcod.ToString()).Selected = true; TextBox1.Text = k[0].plncst.ToString(); ViewState["cod"] = a; Button1.Text = "update"; e.Cancel = true; } protected void GridView1_RowDeleting(object sender, GridViewDeleteEventArgs e) { nsgumtree.clspln obj = new nsgumtree.clspln(); nsgumtree.clsplnprp objprp = new nsgumtree.clsplnprp(); objprp.plncod = Convert.ToInt32(GridView1.DataKeys[e.RowIndex][0]); obj.delete_rec(objprp); GridView1.DataBind(); e.Cancel = true; } }<file_sep>using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; public partial class _Default : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { } protected void Button1_Click(object sender, EventArgs e) { nsgumtree.clsusr obj = new nsgumtree.clsusr(); Int32 a; char rol; a = obj.logincheck(txteml.Text, txtpwd.Text, out rol); if (a == -1) Label1.Text = "Email/Password Incorrect"; else { Session["cod"] = a; if (rol == 'a') Response.Redirect("admin/frmcat.aspx"); else if (rol == 'u') Response.Redirect("user/frmpstadv.aspx"); } txteml.Text = string.Empty; txtpwd.Text = string.Empty; txteml.Focus(); } }<file_sep>using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Data; using System.Configuration; using System.Data.SqlClient; namespace nsgumtree { public interface intcnt { Int32 cntcod { get; set; } string cntnam { get; set; } } public interface intloc { Int32 loccod { get; set; } string locnam { get; set; } Int32 loccntcod { get; set; } } public interface intcat { Int32 catcod { get; set; } string catnam { get; set; } } public interface intsubcat { Int32 subcatcod { get; set; } string subcatnam { get; set; } Int32 subcatcatcod { get; set; } } public interface intitmtype { Int32 itmtypcod { get; set; } string itmtypnam { get; set; } Int32 itmsubcatcod { get; set; } } public interface intusr { Int32 usrcod { get; set; } string usrnam { get; set; } string usreml { get; set; } string usrpwd { get; set; } Int32 usrloccod { get; set; } string usrphn { get; set; } DateTime usrregdat { get; set; } char usrrol { get; set; } int usrpln { get; set; } } public interface intadv { Int32 advcod { get; set; } DateTime advdat { get; set; } Int32 advusrcod { get; set; } string advtit { get; set; } string advdsc { get; set; } float advprc { get; set; } Int32 advitmtypcod { get; set; } Int32 advmanpiccod { get; set; } char advsts { get; set; } Int32 advplncod { get; set; } } public interface intadvpic { Int32 advpiccod { get; set; } Int32 advpicadvcod { get; set; } string advpicpic { get; set; } string advpicdsc { get; set; } char advpicsts { get; set; } } public interface intpln { Int32 plncod { get; set; } Int32 plnsubcatcod { get; set; } float plncst { get; set; } } public interface intfavadv { Int32 favadvcod { get; set; } Int32 favadvadvcod { get; set; } Int32 favadvusrcod { get; set; } DateTime favadvdat { get; set; } } public interface intmsg { Int32 msgcod { get; set; } DateTime msgdat { get; set; } Int32 msgusrcod { get; set; } Int32 msgadvcod { get; set; } string msgdsc { get; set; } } public class clscntprp : intcnt { private Int32 prvcntcod; private string prvcntnam; public int cntcod { get { return prvcntcod; } set { prvcntcod = value; } } public string cntnam { get { return prvcntnam; } set { prvcntnam = value; } } } public class clslocprp:intloc { private Int32 prvloccod; private string prvlocnam; private Int32 prvloccntcod; public int loccod { get { return prvloccod; } set { prvloccod=value; } } public string locnam { get { return prvlocnam; } set { prvlocnam = value; } } public int loccntcod { get { return prvloccntcod; } set { prvloccntcod = value; } } } public class clscatprp :intcat { private Int32 prvcatcod; private string prvcatnam; public int catcod { get { return prvcatcod; } set { prvcatcod = value; } } public string catnam { get { return prvcatnam; } set { prvcatnam = value; } } } public class clssubcatprp : intsubcat { private Int32 prvsubcatcod; private string prvsubcatnam; private Int32 prvsubcatcatcod; public int subcatcod { get { return prvsubcatcod; } set { prvsubcatcod = value; } } public string subcatnam { get { return prvsubcatnam; } set { prvsubcatnam = value; } } public int subcatcatcod { get { return prvsubcatcatcod; } set { prvsubcatcatcod = value; } } } public class clsitmtypeprp : intitmtype { private Int32 prvitmtypcod; private string prvitmtypnam; private Int32 prvitmsubcatcod; public int itmtypcod { get { return prvitmtypcod; } set { prvitmtypcod = value; } } public string itmtypnam { get { return prvitmtypnam; } set { prvitmtypnam = value; } } public int itmsubcatcod { get { return prvitmsubcatcod; } set { prvitmsubcatcod = value; } } } public class clsusrprp : intusr { private Int32 prvusrcod; private string prvusrnam; private string prvusreml; private string prvusrpwd; private Int32 prvusrloccod; private string prvusrphn; private DateTime prvusrregdat; private char prvusrrol; private int prvusrpln; public int usrcod { get { return prvusrcod; } set { prvusrcod = value; } } public string usrnam { get { return prvusrnam; } set { prvusrnam = value; } } public string usreml { get { return prvusreml; } set { prvusreml = value; } } public string usrpwd { get { return prvusrpwd; } set { prvusrpwd = value; } } public int usrloccod { get { return prvusrloccod; } set { prvusrloccod = value; } } public string usrphn { get { return prvusrphn; } set { prvusrphn = value; } } public DateTime usrregdat { get { return prvusrregdat; } set { prvusrregdat = value; } } public char usrrol { get { return prvusrrol; } set { prvusrrol = value; } } public int usrpln { get { return prvusrpln; } set { prvusrpln = value; } } } public class clsadvprp : intadv { private Int32 prvadvcod; private DateTime prvadvdat; private Int32 prvadvusrcod; private string prvadvtit; private string prvadvdsc; private float prvadvprc; private Int32 prvadvitmtypcod; private Int32 prvadvmanpiccod; private char prvadvsts; private Int32 prvadvplncod; public int advcod { get { return prvadvcod; } set { prvadvcod = value; } } public DateTime advdat { get { return prvadvdat; } set { prvadvdat = value; } } public int advusrcod { get { return prvadvusrcod; } set { prvadvusrcod = value; } } public string advtit { get { return prvadvtit; } set { prvadvtit = value; } } public string advdsc { get { return prvadvdsc; } set { prvadvdsc = value; } } public float advprc { get { return prvadvprc; } set { prvadvprc = value; } } public int advitmtypcod { get { return prvadvitmtypcod; } set { prvadvitmtypcod = value; } } public int advmanpiccod { get { return prvadvmanpiccod; } set { prvadvmanpiccod = value; } } public char advsts { get { return prvadvsts; } set { prvadvsts = value; } } public int advplncod { get { return prvadvplncod; } set { prvadvplncod = value; } } } public class clsadvpicprp : intadvpic { private Int32 prvadvpiccod; private Int32 prvadvpicadvcod; private string prvadvpicpic; private string prvadvpicdsc; private char prvadvpicsts; public int advpiccod { get { return prvadvpiccod; } set { prvadvpiccod = value; } } public int advpicadvcod { get { return prvadvpicadvcod; } set { prvadvpicadvcod = value; } } public string advpicpic { get { return prvadvpicpic; } set { prvadvpicpic = value; } } public string advpicdsc { get { return prvadvpicdsc; } set { prvadvpicdsc = value; } } public char advpicsts { get { return prvadvpicsts; } set { prvadvpicsts = value; } } } public class clsplnprp : intpln { private Int32 prvplncod; private Int32 prvplnsubcatcod; private float prvplncst; public int plncod { get { return prvplncod; } set { prvplncod = value; } } public int plnsubcatcod { get { return prvplnsubcatcod; } set { prvplnsubcatcod = value; } } public float plncst { get { return prvplncst; } set { prvplncst = value; } } } public class clsfavadvprp : intfavadv { private Int32 prvfavadvcod; private Int32 prvfavadvadvcod; private Int32 prvfavadvusrcod; private DateTime prvfavadvdat; public int favadvcod { get { return prvfavadvcod; } set { prvfavadvcod = value; } } public int favadvadvcod { get { return prvfavadvadvcod; } set { prvfavadvadvcod = value; } } public int favadvusrcod { get { return prvfavadvusrcod; } set { prvfavadvusrcod = value; } } public DateTime favadvdat { get { return prvfavadvdat; } set { prvfavadvdat = value; } } } public class clsmsgprp : intmsg { private Int32 prvmsgcod; private DateTime prvmsgdat; private Int32 prvmsgusrcod; private Int32 prvmsgadvcod; private string prvmsgdsc; public int msgcod { get { return prvmsgcod; } set { prvmsgcod = value; } } public DateTime msgdat { get { return prvmsgdat; } set { prvmsgdat = value; } } public int msgusrcod { get { return prvmsgusrcod; } set { prvmsgusrcod = value; } } public int msgadvcod { get { return prvmsgadvcod; } set { prvmsgadvcod = value; } } public string msgdsc { get { return prvmsgdsc; } set { prvmsgdsc = value; } } } public abstract class clscon { protected SqlConnection con = new SqlConnection(); public clscon() { con.ConnectionString = ConfigurationManager.ConnectionStrings["cn"].ConnectionString; } } public class clscnt : clscon { public void save_rec(clscntprp p) { if (con.State == ConnectionState.Closed) { con.Open(); } SqlCommand cmd = new SqlCommand("inscnt", con); cmd.CommandType = CommandType.StoredProcedure; // cmd.Parameters.Add("@cntcod", SqlDbType.Int).Value = p.cntcod; cmd.Parameters.Add("@cntnam", SqlDbType.VarChar, 50).Value = p.cntnam; cmd.ExecuteNonQuery(); cmd.Dispose(); con.Close(); } public void update_rec(clscntprp p) { if (con.State == ConnectionState.Closed) { con.Open(); } SqlCommand cmd = new SqlCommand("updcnt", con); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Add("@cntcod", SqlDbType.Int).Value = p.cntcod; cmd.Parameters.Add("@cntnam", SqlDbType.VarChar, 50).Value = p.cntnam; cmd.ExecuteNonQuery(); cmd.Dispose(); con.Close(); } public void delete_rec(clscntprp p) { if (con.State == ConnectionState.Closed) { con.Open(); } SqlCommand cmd = new SqlCommand("delcnt", con); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Add("@cntcod", SqlDbType.Int).Value = p.cntcod; cmd.ExecuteNonQuery(); cmd.Dispose(); con.Close(); } public List<clscntprp> disp_rec() { { if (con.State == ConnectionState.Closed) { con.Open(); } SqlCommand cmd = new SqlCommand("dispcnt", con); cmd.CommandType = CommandType.StoredProcedure; SqlDataReader dr = cmd.ExecuteReader(); List<clscntprp> obj = new List<clscntprp>(); while (dr.Read()) { clscntprp k = new clscntprp(); k.cntcod = Convert.ToInt32(dr[0]); k.cntnam = dr[1].ToString(); obj.Add(k); } dr.Close(); cmd.Dispose(); con.Close(); return obj; } } public List<clscntprp> find_rec(Int32 cno) { if (con.State == ConnectionState.Closed) { con.Open(); } SqlCommand cmd = new SqlCommand("findcnt", con); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Add("@cntcod", SqlDbType.Int).Value = cno; SqlDataReader dr = cmd.ExecuteReader(); List<clscntprp> obj = new List<clscntprp>(); if (dr.HasRows) { dr.Read(); clscntprp k = new clscntprp(); k.cntcod = Convert.ToInt32(dr[0]); k.cntnam = dr[1].ToString(); obj.Add(k); } dr.Close(); cmd.Dispose(); con.Close(); return obj; } } public class clsloc : clscon { public void save_rec(clslocprp p) { if (con.State == ConnectionState.Closed) { con.Open(); } SqlCommand cmd = new SqlCommand("insloc", con); cmd.CommandType = CommandType.StoredProcedure; // cmd.Parameters.Add("@loccod", SqlDbType.Int).Value = p.loccod; cmd.Parameters.Add("@locnam", SqlDbType.VarChar, 100).Value = p.locnam; cmd.Parameters.Add("@loccntcod", SqlDbType.Int).Value = p.loccntcod; cmd.ExecuteNonQuery(); cmd.Dispose(); con.Close(); } public void update_rec(clslocprp p) { if (con.State == ConnectionState.Closed) { con.Open(); } SqlCommand cmd = new SqlCommand("updloc", con); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Add("@loccod", SqlDbType.Int).Value = p.loccod; cmd.Parameters.Add("@locnam", SqlDbType.VarChar, 100).Value = p.locnam; cmd.Parameters.Add("@loccntcod", SqlDbType.Int).Value = p.loccntcod; cmd.ExecuteNonQuery(); cmd.Dispose(); con.Close(); } public void delete_rec(clslocprp p) { if (con.State == ConnectionState.Closed) { con.Open(); } SqlCommand cmd = new SqlCommand("delloc", con); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Add("@loccod", SqlDbType.Int).Value = p.loccod; cmd.ExecuteNonQuery(); cmd.Dispose(); con.Close(); } public List<clslocprp> disp_rec(Int32 cntcod) { { if (con.State == ConnectionState.Closed) { con.Open(); } SqlCommand cmd = new SqlCommand("disploc", con); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Add("@cntcod", SqlDbType.Int).Value = cntcod; SqlDataReader dr = cmd.ExecuteReader(); List<clslocprp> obj = new List<clslocprp>(); while (dr.Read()) { clslocprp k = new clslocprp(); k.loccod = Convert.ToInt32(dr[0]); k.locnam = dr[1].ToString(); k.loccntcod = Convert.ToInt32(dr[2]); obj.Add(k); } dr.Close(); cmd.Dispose(); con.Close(); return obj; } } public List<clslocprp> find_rec(Int32 cno) { if (con.State == ConnectionState.Closed) { con.Open(); } SqlCommand cmd = new SqlCommand("findloc", con); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Add("@loccod", SqlDbType.Int).Value = cno; SqlDataReader dr = cmd.ExecuteReader(); List<clslocprp> obj = new List<clslocprp>(); if (dr.HasRows) { dr.Read(); clslocprp k = new clslocprp(); k.loccod = Convert.ToInt32(dr[0]); k.locnam = dr[1].ToString(); k.loccntcod = Convert.ToInt32(dr[2]); obj.Add(k); } dr.Close(); cmd.Dispose(); con.Close(); return obj; } } public class clscat : clscon { public void save_rec(clscatprp p) { if (con.State == ConnectionState.Closed) { con.Open(); } SqlCommand cmd = new SqlCommand("inscat", con); cmd.CommandType = CommandType.StoredProcedure; // cmd.Parameters.Add("@loccod", SqlDbType.Int).Value = p.loccod; cmd.Parameters.Add("@catnam", SqlDbType.VarChar, 100).Value = p.catnam; cmd.ExecuteNonQuery(); cmd.Dispose(); con.Close(); } public void update_rec(clscatprp p) { if (con.State == ConnectionState.Closed) { con.Open(); } SqlCommand cmd = new SqlCommand("updcat", con); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Add("@catcod", SqlDbType.Int).Value = p.catcod; cmd.Parameters.Add("@catnam", SqlDbType.VarChar, 100).Value = p.catnam; cmd.ExecuteNonQuery(); cmd.Dispose(); con.Close(); } public void delete_rec(clscatprp p) { if (con.State == ConnectionState.Closed) { con.Open(); } SqlCommand cmd = new SqlCommand("delcat", con); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Add("@catcod", SqlDbType.Int).Value = p.catcod; cmd.ExecuteNonQuery(); cmd.Dispose(); con.Close(); } public List<clscatprp> disp_rec() { { if (con.State == ConnectionState.Closed) { con.Open(); } SqlCommand cmd = new SqlCommand("dispcat", con); cmd.CommandType = CommandType.StoredProcedure; SqlDataReader dr = cmd.ExecuteReader(); List<clscatprp> obj = new List<clscatprp>(); while (dr.Read()) { clscatprp k = new clscatprp(); k.catcod = Convert.ToInt32(dr[0]); k.catnam = dr[1].ToString(); // k.loccntcod = Convert.ToInt32(dr[2]); obj.Add(k); } dr.Close(); cmd.Dispose(); con.Close(); return obj; } } public List<clscatprp> find_rec(Int32 cno) { if (con.State == ConnectionState.Closed) { con.Open(); } SqlCommand cmd = new SqlCommand("findcat", con); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Add("@catcod", SqlDbType.Int).Value = cno; SqlDataReader dr = cmd.ExecuteReader(); List<clscatprp> obj = new List<clscatprp>(); if (dr.HasRows) { dr.Read(); clscatprp k = new clscatprp(); // k.catcod = Convert.ToInt32(dr[0]); k.catnam = dr[1].ToString(); // k.loccntcod = Convert.ToInt32(dr[2]); obj.Add(k); } dr.Close(); cmd.Dispose(); con.Close(); return obj; } } public class clssubcat : clscon { public void save_rec(clssubcatprp p) { if (con.State == ConnectionState.Closed) { con.Open(); } SqlCommand cmd = new SqlCommand("inssubcat", con); cmd.CommandType = CommandType.StoredProcedure; // cmd.Parameters.Add("@loccod", SqlDbType.Int).Value = p.loccod; cmd.Parameters.Add("@subcatnam", SqlDbType.VarChar, 100).Value = p.subcatnam; cmd.Parameters.Add("@subcatcatcod", SqlDbType.Int).Value = p.subcatcatcod; cmd.ExecuteNonQuery(); cmd.Dispose(); con.Close(); } public void update_rec(clssubcatprp p) { if (con.State == ConnectionState.Closed) { con.Open(); } SqlCommand cmd = new SqlCommand("updsubcat", con); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Add("@subcatcod", SqlDbType.Int).Value = p.subcatcod; cmd.Parameters.Add("@subcatnam", SqlDbType.VarChar, 100).Value = p.subcatnam; cmd.Parameters.Add("@subcatcatcod", SqlDbType.Int).Value = p.subcatcatcod; cmd.ExecuteNonQuery(); cmd.Dispose(); con.Close(); } public void delete_rec(clssubcatprp p) { if (con.State == ConnectionState.Closed) { con.Open(); } SqlCommand cmd = new SqlCommand("delsubcat", con); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Add("@subcatcod", SqlDbType.Int).Value = p.subcatcod; cmd.ExecuteNonQuery(); cmd.Dispose(); con.Close(); } public List<clssubcatprp> disp_rec(Int32 catcod) { { if (con.State == ConnectionState.Closed) { con.Open(); } SqlCommand cmd = new SqlCommand("dispsubcat", con); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Add("@catcod", SqlDbType.Int).Value = catcod; SqlDataReader dr = cmd.ExecuteReader(); List<clssubcatprp> obj = new List<clssubcatprp>(); while (dr.Read()) { clssubcatprp k = new clssubcatprp(); k.subcatcod = Convert.ToInt32(dr[0]); k.subcatnam = dr[1].ToString(); k.subcatcatcod = Convert.ToInt32(dr[2]); obj.Add(k); } dr.Close(); cmd.Dispose(); con.Close(); return obj; } } public List<clssubcatprp> find_rec(Int32 cno) { if (con.State == ConnectionState.Closed) { con.Open(); } SqlCommand cmd = new SqlCommand("findsubcat", con); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Add("@subcatcod", SqlDbType.Int).Value = cno; SqlDataReader dr = cmd.ExecuteReader(); List<clssubcatprp> obj = new List<clssubcatprp>(); if (dr.HasRows) { dr.Read(); clssubcatprp k = new clssubcatprp(); k.subcatcod = Convert.ToInt32(dr[0]); k.subcatnam = dr[1].ToString(); k.subcatcatcod = Convert.ToInt32(dr[2]); obj.Add(k); } dr.Close(); cmd.Dispose(); con.Close(); return obj; } } public class clsitmtype : clscon { public void save_rec(clsitmtypeprp p) { if (con.State == ConnectionState.Closed) { con.Open(); } SqlCommand cmd = new SqlCommand("insitmtype", con); cmd.CommandType = CommandType.StoredProcedure; //cmd.Parameters.Add("@loccod", SqlDbType.Int).Value = p.loccod; cmd.Parameters.Add("@itmtypnam", SqlDbType.VarChar, 100).Value = p.itmtypnam; cmd.Parameters.Add("@itmsubcatcod", SqlDbType.Int).Value = p.itmsubcatcod; cmd.ExecuteNonQuery(); cmd.Dispose(); con.Close(); } public void update_rec(clsitmtypeprp p) { if (con.State == ConnectionState.Closed) { con.Open(); } SqlCommand cmd = new SqlCommand("upditmtype", con); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Add("@itmtypcod", SqlDbType.Int).Value = p.itmtypcod; cmd.Parameters.Add("@itmtypnam", SqlDbType.VarChar, 100).Value = p.itmtypnam; cmd.Parameters.Add("@itmsubcatcod", SqlDbType.Int).Value = p.itmsubcatcod; cmd.ExecuteNonQuery(); cmd.Dispose(); con.Close(); } public void delete_rec(clsitmtypeprp p) { if (con.State == ConnectionState.Closed) { con.Open(); } SqlCommand cmd = new SqlCommand("delitmtyp", con); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Add("@itmtypcod", SqlDbType.Int).Value = p.itmtypcod; cmd.ExecuteNonQuery(); cmd.Dispose(); con.Close(); } public List<clsitmtypeprp> disp_rec(Int32 subcatcod) { { if (con.State == ConnectionState.Closed) { con.Open(); } SqlCommand cmd = new SqlCommand("dispitmtype", con); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Add("@subcatcod", SqlDbType.Int).Value = subcatcod; SqlDataReader dr = cmd.ExecuteReader(); List<clsitmtypeprp> obj = new List<clsitmtypeprp>(); while (dr.Read()) { clsitmtypeprp k = new clsitmtypeprp(); k.itmtypcod = Convert.ToInt32(dr[0]); k.itmtypnam = dr[1].ToString(); k.itmsubcatcod = Convert.ToInt32(dr[2]); obj.Add(k); } dr.Close(); cmd.Dispose(); con.Close(); return obj; } } public List<clsitmtypeprp> find_rec(Int32 cno) { if (con.State == ConnectionState.Closed) { con.Open(); } SqlCommand cmd = new SqlCommand("finditmtype", con); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Add("@itmtypcod", SqlDbType.Int).Value = cno; SqlDataReader dr = cmd.ExecuteReader(); List<clsitmtypeprp> obj = new List<clsitmtypeprp>(); if (dr.HasRows) { dr.Read(); clsitmtypeprp k = new clsitmtypeprp(); k.itmtypcod = Convert.ToInt32(dr[0]); k.itmtypnam = dr[1].ToString(); k.itmsubcatcod = Convert.ToInt32(dr[2]); obj.Add(k); } dr.Close(); cmd.Dispose(); con.Close(); return obj; } } public class clsusr:clscon { public Int32 logincheck(string eml, string pwd, out char rol) { if (con.State == ConnectionState.Closed) con.Open(); SqlCommand cmd = new SqlCommand("logincheck", con); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Add("@eml", SqlDbType.VarChar, 50).Value = eml; cmd.Parameters.Add("@pwd", SqlDbType.VarChar, 50).Value = pwd; cmd.Parameters.Add("@cod", SqlDbType.Int).Direction = ParameterDirection.Output; cmd.Parameters.Add("@rol", SqlDbType.Char, 1).Direction = ParameterDirection.Output; cmd.ExecuteNonQuery(); Int32 a = Convert.ToInt32(cmd.Parameters["@cod"].Value); rol = Convert.ToChar(cmd.Parameters["@rol"].Value); cmd.Dispose(); con.Close(); return a; } public void save_rec(clsusrprp p) { if (con.State == ConnectionState.Closed) { con.Open(); } SqlCommand cmd = new SqlCommand("insusr", con); cmd.CommandType = CommandType.StoredProcedure; //cmd.Parameters.Add("@loccod", SqlDbType.Int).Value = p.loccod; cmd.Parameters.Add("@usrnam", SqlDbType.VarChar, 100).Value = p.usrnam; cmd.Parameters.Add("@usreml", SqlDbType.VarChar, 50).Value = p.usreml; cmd.Parameters.Add("@usrpwd", SqlDbType.VarChar, 50).Value = p.usrpwd; cmd.Parameters.Add("@usrloccod", SqlDbType.Int).Value = p.usrloccod; cmd.Parameters.Add("@usrphn", SqlDbType.VarChar, 50).Value = p.usrphn; cmd.Parameters.Add("@usrregdat", SqlDbType.DateTime).Value=p.usrregdat; cmd.Parameters.Add("@usrrol", SqlDbType.Char,1).Value = p.usrrol; // cmd.Parameters.Add("@usrpln", SqlDbType.Int).Value = p.usrpln; cmd.ExecuteNonQuery(); cmd.Dispose(); con.Close(); } public void update_rec(clsusrprp p) { if (con.State == ConnectionState.Closed) { con.Open(); } SqlCommand cmd = new SqlCommand("updusr", con); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Add("usrcod",SqlDbType.Int).Value=p.usrcod; cmd.Parameters.Add("@usrnam", SqlDbType.VarChar, 100).Value = p.usrnam; cmd.Parameters.Add("@usreml", SqlDbType.VarChar, 50).Value = p.usreml; cmd.Parameters.Add("@usrpwd", SqlDbType.VarChar, 50).Value = p.usrpwd; cmd.Parameters.Add("@usrloccod", SqlDbType.Int).Value = p.usrloccod; cmd.Parameters.Add("@usrphn", SqlDbType.VarChar, 50).Value = p.usrphn; cmd.Parameters.Add("@usrregdat", SqlDbType.DateTime).Value=p.usrregdat; cmd.Parameters.Add("@usrrol", SqlDbType.Char,1).Value = p.usrrol; // cmd.Parameters.Add("@usrpln", SqlDbType.Int).Value = p.usrpln; cmd.ExecuteNonQuery(); cmd.Dispose(); con.Close(); } public void delete_rec(clsusrprp p) { if (con.State == ConnectionState.Closed) { con.Open(); } SqlCommand cmd = new SqlCommand("delusr", con); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Add("usrcod",SqlDbType.Int).Value=p.usrcod; cmd.ExecuteNonQuery(); cmd.Dispose(); con.Close(); } public List<clsusrprp> disp_rec() { { if (con.State == ConnectionState.Closed) { con.Open(); } SqlCommand cmd = new SqlCommand("dispusr", con); cmd.CommandType = CommandType.StoredProcedure; SqlDataReader dr = cmd.ExecuteReader(); List<clsusrprp> obj = new List<clsusrprp>(); while (dr.Read()) { clsusrprp k = new clsusrprp(); k.usrcod = Convert.ToInt32(dr[0]); k.usrnam = dr[1].ToString(); k.usreml = dr[2].ToString(); k.usrpwd = dr[3].ToString(); k.usrloccod = Convert.ToInt32(dr[4]); k.usrphn = dr[5].ToString(); k.usrregdat=Convert.ToDateTime(dr[6]); k.usrrol=Convert.ToChar(dr[7]); // k.usrpln = Convert.ToInt32(dr[8]); obj.Add(k); } dr.Close(); cmd.Dispose(); con.Close(); return obj; } } public List<clsusrprp> find_rec(Int32 cno) { if (con.State == ConnectionState.Closed) { con.Open(); } SqlCommand cmd = new SqlCommand("findusr", con); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Add("@usrcod", SqlDbType.Int).Value = cno; SqlDataReader dr = cmd.ExecuteReader(); List<clsusrprp> obj = new List<clsusrprp>(); if (dr.HasRows) { dr.Read(); clsusrprp k = new clsusrprp(); k.usrcod = Convert.ToInt32(dr[0]); k.usrnam = dr[1].ToString(); k.usreml = dr[2].ToString(); k.usrpwd = dr[3].ToString(); k.usrloccod = Convert.ToInt32(dr[4]); k.usrphn = dr[5].ToString(); k.usrregdat=Convert.ToDateTime(dr[6]); k.usrrol=Convert.ToChar(dr[7]); // k.usrpln = Convert.ToInt32(dr[8]); obj.Add(k); } dr.Close(); cmd.Dispose(); con.Close(); return obj; } } public class clsadv : clscon { public Int32 save_rec(clsadvprp p) { if (con.State == ConnectionState.Closed) { con.Open(); } SqlCommand cmd = new SqlCommand("insadv", con); cmd.CommandType = CommandType.StoredProcedure; //cmd.Parameters.Add("@loccod", SqlDbType.Int).Value = p.loccod; cmd.Parameters.Add("@advdat", SqlDbType.DateTime).Value = p.advdat; cmd.Parameters.Add("@advusrcod", SqlDbType.Int).Value = p.advusrcod; cmd.Parameters.Add("@advtit", SqlDbType.VarChar, 200).Value = p.advtit; cmd.Parameters.Add("@advdsc", SqlDbType.NVarChar, 20000).Value = p.advdsc; cmd.Parameters.Add("@advprc", SqlDbType.Float).Value = p.advprc; cmd.Parameters.Add("@advitmtypcod", SqlDbType.Int).Value = p.advitmtypcod; // cmd.Parameters.Add("@advmanpiccod", SqlDbType.Int).Value = p.advmanpiccod; cmd.Parameters.Add("@advsts", SqlDbType.Char, 1).Value = p.advsts; // cmd.Parameters.Add("@advplncod", SqlDbType.Int).Value = p.advplncod; cmd.Parameters.Add("@r", SqlDbType.Int).Direction = ParameterDirection.ReturnValue; Int32 a=Convert.ToInt32(cmd.Parameters["@r"].Value); cmd.ExecuteNonQuery(); cmd.Dispose(); con.Close(); return a; } public void update_rec(clsadvprp p) { if (con.State == ConnectionState.Closed) { con.Open(); } SqlCommand cmd = new SqlCommand("updadv", con); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Add("@advcod", SqlDbType.Int).Value = p.advcod; cmd.Parameters.Add("@advdat", SqlDbType.DateTime).Value = p.advdat; cmd.Parameters.Add("@advusrcod", SqlDbType.Int).Value = p.advusrcod; cmd.Parameters.Add("@advtit", SqlDbType.VarChar, 200).Value = p.advtit; cmd.Parameters.Add("@advdsc", SqlDbType.NVarChar, 20000).Value = p.advdsc; cmd.Parameters.Add("@advprc", SqlDbType.Float).Value = p.advprc; cmd.Parameters.Add("@advitmtypcod", SqlDbType.Int).Value = p.advitmtypcod; //cmd.Parameters.Add("@advmanpiccod", SqlDbType.Int).Value = p.advmanpiccod; cmd.Parameters.Add("@advsts", SqlDbType.Char, 1).Value = p.advsts; // cmd.Parameters.Add("@advplncod", SqlDbType.Int).Value = p.advplncod; cmd.ExecuteNonQuery(); cmd.Dispose(); con.Close(); } public void delete_rec(clsadvprp p) { if (con.State == ConnectionState.Closed) { con.Open(); } SqlCommand cmd = new SqlCommand("deladv", con); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Add("@advcod", SqlDbType.Int).Value = p.advcod; cmd.ExecuteNonQuery(); cmd.Dispose(); con.Close(); } public List<clsadvprp> disp_rec() { { if (con.State == ConnectionState.Closed) { con.Open(); } SqlCommand cmd = new SqlCommand("dispadv", con); cmd.CommandType = CommandType.StoredProcedure; SqlDataReader dr = cmd.ExecuteReader(); List<clsadvprp> obj = new List<clsadvprp>(); while (dr.Read()) { clsadvprp k = new clsadvprp(); k.advcod = Convert.ToInt32(dr[0]); k.advdat = Convert.ToDateTime(dr[1]); k.advusrcod = Convert.ToInt32(dr[2]); k.advtit = dr[3].ToString(); k.advdsc = dr[4].ToString(); k.advprc = Convert.ToInt32(dr[5]); k.advitmtypcod = Convert.ToInt32(dr[6]); // k.advmanpiccod = Convert.ToInt32(dr[7]); k.advsts = Convert.ToChar(dr[7]); // k.advplncod = Convert.ToInt32(dr[9]); obj.Add(k); } dr.Close(); cmd.Dispose(); con.Close(); return obj; } } public List<clsadvprp> find_rec(Int32 cno) { if (con.State == ConnectionState.Closed) { con.Open(); } SqlCommand cmd = new SqlCommand("findadv", con); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Add("@advcod", SqlDbType.Int).Value = cno; SqlDataReader dr = cmd.ExecuteReader(); List<clsadvprp> obj = new List<clsadvprp>(); if (dr.HasRows) { dr.Read(); clsadvprp k = new clsadvprp(); k.advcod = Convert.ToInt32(dr[0]); k.advdat = Convert.ToDateTime(dr[1]); k.advusrcod = Convert.ToInt32(dr[2]); k.advtit = dr[3].ToString(); k.advdsc = dr[4].ToString(); k.advprc = Convert.ToInt32(dr[5]); k.advitmtypcod = Convert.ToInt32(dr[6]); // k.advmanpiccod = Convert.ToInt32(dr[7]); k.advsts = Convert.ToChar(dr[7]); // k.advplncod = Convert.ToInt32(dr[9]); obj.Add(k); } dr.Close(); cmd.Dispose(); con.Close(); return obj; } } public class clsadvpic:clscon { public Int32 save_rec(clsadvpicprp p) { if (con.State == ConnectionState.Closed) { con.Open(); } SqlCommand cmd = new SqlCommand("insadvpic", con); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Add("@advpicadvcod", SqlDbType.Int).Value = p.advpicadvcod; cmd.Parameters.Add("@advpicpic", SqlDbType.VarChar, 50).Value = p.advpicpic; cmd.Parameters.Add("@advpicdsc", SqlDbType.VarChar, 1000).Value = p.advpicdsc; cmd.Parameters.Add("@advpicsts", SqlDbType.Char).Value = p.advpicsts; cmd.Parameters.Add("@r", SqlDbType.Int).Direction = ParameterDirection.ReturnValue; cmd.ExecuteNonQuery(); Int32 a = Convert.ToInt32(cmd.Parameters["@r"].Value); cmd.Dispose(); con.Close(); return a; } public void update_rec(clsadvpicprp p) { if (con.State == ConnectionState.Closed) { con.Open(); } SqlCommand cmd = new SqlCommand("updadvpic",con); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Add("@advpiccod", SqlDbType.Int).Value = p.advpiccod; cmd.Parameters.Add("@advpicadvcod", SqlDbType.Int).Value = p.advpicadvcod; cmd.Parameters.Add("@advpicpic", SqlDbType.VarChar, 50).Value = p.advpicpic; cmd.Parameters.Add("@advpicdsc", SqlDbType.VarChar, 1000).Value = p.advpicdsc; cmd.Parameters.Add("@advpicsts", SqlDbType.Char).Value = p.advpicsts; cmd.ExecuteNonQuery(); cmd.Dispose(); con.Close(); } public void delete_rec(clsadvpicprp p) { if (con.State == ConnectionState.Closed) { con.Open(); } SqlCommand cmd = new SqlCommand("deladvpic", con); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Add("@advpiccod", SqlDbType.Int).Value = p.advpiccod; cmd.ExecuteNonQuery(); cmd.Dispose(); con.Close(); } public List<clsadvpicprp> disp_rec(Int32 advcod) { { if (con.State == ConnectionState.Closed) { con.Open(); } SqlCommand cmd = new SqlCommand("dispadvpic", con); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Add("@advcod", SqlDbType.Int).Value = advcod; SqlDataReader dr = cmd.ExecuteReader(); List<clsadvpicprp> obj = new List<clsadvpicprp>(); while (dr.Read()) { clsadvpicprp k = new clsadvpicprp(); k.advpiccod = Convert.ToInt32(dr[0]); k.advpicadvcod = Convert.ToInt32(dr[1]); k.advpicpic = dr[2].ToString(); k.advpicdsc = dr[3].ToString(); k.advpicsts = Convert.ToChar(dr[4]); obj.Add(k); } dr.Close(); cmd.Dispose(); con.Close(); return obj; } } public List<clsadvpicprp> find_rec(Int32 cno) { if (con.State == ConnectionState.Closed) { con.Open(); } SqlCommand cmd = new SqlCommand("findadvpic", con); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Add("@advpiccod", SqlDbType.Int).Value = cno; SqlDataReader dr = cmd.ExecuteReader(); List<clsadvpicprp> obj = new List<clsadvpicprp>(); if (dr.HasRows) { dr.Read(); clsadvpicprp k = new clsadvpicprp(); k.advpiccod = Convert.ToInt32(dr[0]); k.advpicadvcod = Convert.ToInt32(dr[1]); k.advpicpic = dr[2].ToString(); k.advpicdsc = dr[3].ToString(); k.advpicsts = Convert.ToChar(dr[4]); obj.Add(k); } dr.Close(); cmd.Dispose(); con.Close(); return obj; } } public class clspln : clscon { public void save_rec(clsplnprp p) { if (con.State == ConnectionState.Closed) { con.Open(); } SqlCommand cmd = new SqlCommand("inspln", con); cmd.CommandType = CommandType.StoredProcedure; // cmd.Parameters.Add("@plncod", SqlDbType.Int).Value = p.plncod; cmd.Parameters.Add("@plnsubcatcod", SqlDbType.Int).Value = p.plnsubcatcod; cmd.Parameters.Add("@plncst", SqlDbType.Float).Value = p.plncst; cmd.ExecuteNonQuery(); cmd.Dispose(); con.Close(); } public void update_rec(clsplnprp p) { if (con.State == ConnectionState.Closed) { con.Open(); } SqlCommand cmd = new SqlCommand("updpln", con); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Add("@plncod", SqlDbType.Int).Value = p.plncod; cmd.Parameters.Add("@plnsubcatcod", SqlDbType.Int).Value = p.plnsubcatcod; cmd.Parameters.Add("@plncst", SqlDbType.Float).Value = p.plncst; cmd.ExecuteNonQuery(); cmd.Dispose(); con.Close(); } public void delete_rec(clsplnprp p) { if (con.State == ConnectionState.Closed) { con.Open(); } SqlCommand cmd = new SqlCommand("delpln", con); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Add("@plncod", SqlDbType.Int).Value = p.plncod; cmd.ExecuteNonQuery(); cmd.Dispose(); con.Close(); } /* public List<clsplnprp> disp_rec() { { if (con.State == ConnectionState.Closed) { con.Open(); } SqlCommand cmd = new SqlCommand("disppln", con); cmd.CommandType = CommandType.StoredProcedure; SqlDataReader dr = cmd.ExecuteReader(); List<clsplnprp> obj = new List<clsplnprp>(); while (dr.Read()) { clsplnprp k = new clsplnprp(); k.plncod = Convert.ToInt32(dr[0]); k.plnsubcatcod = Convert.ToInt32(dr[1]); k.plncst = Convert.ToSingle(dr[2]); obj.Add(k); } dr.Close(); cmd.Dispose(); con.Close(); return obj; } }*/ public List<clsplnprp> find_rec(Int32 cno) { if (con.State == ConnectionState.Closed) { con.Open(); } SqlCommand cmd = new SqlCommand("findpln", con); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Add("@plncod", SqlDbType.Int).Value = cno; SqlDataReader dr = cmd.ExecuteReader(); List<clsplnprp> obj = new List<clsplnprp>(); if (dr.HasRows) { dr.Read(); clsplnprp k = new clsplnprp(); k.plncod = Convert.ToInt32(dr[0]); k.plnsubcatcod = Convert.ToInt32(dr[1]); k.plncst = Convert.ToSingle(dr[2]); obj.Add(k); } dr.Close(); cmd.Dispose(); con.Close(); return obj; } public DataSet disp_rec() { SqlDataAdapter adp = new SqlDataAdapter("disppln", con); adp.SelectCommand.CommandType = CommandType.StoredProcedure; DataSet ds = new DataSet(); adp.Fill(ds); return ds; } } public class clsfavadv:clscon { public void save_rec(clsfavadvprp p) { if (con.State == ConnectionState.Closed) { con.Open(); } SqlCommand cmd = new SqlCommand("insfavadv", con); cmd.CommandType = CommandType.StoredProcedure; // cmd.Parameters.Add("@favadvcod", SqlDbType.Int).Value = p.favadvcod; cmd.Parameters.Add("@favadvadvcod", SqlDbType.Int).Value = p.favadvadvcod; cmd.Parameters.Add("@favadvusrcod", SqlDbType.Int).Value = p.favadvusrcod; cmd.Parameters.Add("@favadvdat", SqlDbType.DateTime).Value = p.favadvdat; cmd.ExecuteNonQuery(); cmd.Dispose(); con.Close(); } public void update_rec(clsfavadvprp p) { if (con.State == ConnectionState.Closed) { con.Open(); } SqlCommand cmd = new SqlCommand("updfavadv", con); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Add("@favadvcod", SqlDbType.Int).Value = p.favadvcod; cmd.Parameters.Add("@favadvadvcod", SqlDbType.Int).Value = p.favadvadvcod; cmd.Parameters.Add("@favadvusrcod", SqlDbType.Int).Value = p.favadvusrcod; cmd.Parameters.Add("@favadvdat", SqlDbType.DateTime).Value = p.favadvdat; cmd.ExecuteNonQuery(); cmd.Dispose(); con.Close(); } public void delete_rec(clsfavadvprp p) { if (con.State == ConnectionState.Closed) { con.Open(); } SqlCommand cmd = new SqlCommand("delfavadv", con); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Add("@favadvcod", SqlDbType.Int).Value = p.favadvcod; cmd.ExecuteNonQuery(); cmd.Dispose(); con.Close(); } public List<clsfavadvprp> disp_rec() { { if (con.State == ConnectionState.Closed) { con.Open(); } SqlCommand cmd = new SqlCommand("dispfavadv", con); cmd.CommandType = CommandType.StoredProcedure; SqlDataReader dr = cmd.ExecuteReader(); List<clsfavadvprp> obj = new List<clsfavadvprp>(); while (dr.Read()) { clsfavadvprp k = new clsfavadvprp(); k.favadvcod = Convert.ToInt32(dr[0]); k.favadvadvcod = Convert.ToInt32(dr[1]); k.favadvusrcod = Convert.ToInt32(dr[2]); k.favadvdat = Convert.ToDateTime(dr[3]); obj.Add(k); } dr.Close(); cmd.Dispose(); con.Close(); return obj; } } public List<clsfavadvprp> find_rec(Int32 cno) { if (con.State == ConnectionState.Closed) { con.Open(); } SqlCommand cmd = new SqlCommand("findfavadv", con); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Add("@favadvcod", SqlDbType.Int).Value = cno; SqlDataReader dr = cmd.ExecuteReader(); List<clsfavadvprp> obj = new List<clsfavadvprp>(); if (dr.HasRows) { dr.Read(); clsfavadvprp k = new clsfavadvprp(); k.favadvcod = Convert.ToInt32(dr[0]); k.favadvadvcod = Convert.ToInt32(dr[1]); k.favadvusrcod = Convert.ToInt32(dr[2]); k.favadvdat = Convert.ToDateTime(dr[3]); obj.Add(k); } dr.Close(); cmd.Dispose(); con.Close(); return obj; } } public class clsmsg:clscon { public void save_rec(clsmsgprp p) { if (con.State == ConnectionState.Closed) { con.Open(); } SqlCommand cmd = new SqlCommand("insmsg", con); cmd.CommandType = CommandType.StoredProcedure; // cmd.Parameters.Add("@msgcod", SqlDbType.Int).Value = p.msgcod; cmd.Parameters.Add("@msgdat", SqlDbType.DateTime).Value = p.msgdat; cmd.Parameters.Add("@msgusrcod", SqlDbType.Int).Value = p.msgusrcod; cmd.Parameters.Add("@msgadvcod", SqlDbType.Int).Value = p.msgadvcod; cmd.Parameters.Add("@msgdsc", SqlDbType.VarChar, 2000).Value = p.msgdsc; cmd.ExecuteNonQuery(); cmd.Dispose(); con.Close(); } public void update_rec(clsmsgprp p) { if (con.State == ConnectionState.Closed) { con.Open(); } SqlCommand cmd = new SqlCommand("updmsg", con); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Add("@msgcod", SqlDbType.Int).Value = p.msgcod; cmd.Parameters.Add("@msgdat", SqlDbType.DateTime).Value = p.msgdat; cmd.Parameters.Add("@msgusrcod", SqlDbType.Int).Value = p.msgusrcod; cmd.Parameters.Add("@msgadvcod", SqlDbType.Int).Value = p.msgadvcod; cmd.Parameters.Add("@msgdsc", SqlDbType.VarChar, 2000).Value = p.msgdsc; cmd.ExecuteNonQuery(); cmd.Dispose(); con.Close(); } public void delete_rec(clsmsgprp p) { if (con.State == ConnectionState.Closed) { con.Open(); } SqlCommand cmd = new SqlCommand("delmsg", con); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Add("@msgcod", SqlDbType.Int).Value = p.msgcod; cmd.ExecuteNonQuery(); cmd.Dispose(); con.Close(); } public List<clsmsgprp> disp_rec() { { if (con.State == ConnectionState.Closed) { con.Open(); } SqlCommand cmd = new SqlCommand("dispmsg", con); cmd.CommandType = CommandType.StoredProcedure; SqlDataReader dr = cmd.ExecuteReader(); List<clsmsgprp> obj = new List<clsmsgprp>(); while (dr.Read()) { clsmsgprp k = new clsmsgprp(); k.msgcod = Convert.ToInt32(dr[0]); k.msgdat = Convert.ToDateTime(dr[1]); k.msgusrcod = Convert.ToInt32(dr[2]); k.msgadvcod = Convert.ToInt32(dr[3]); k.msgdsc = dr[4].ToString(); obj.Add(k); } dr.Close(); cmd.Dispose(); con.Close(); return obj; } } public List<clsmsgprp> find_rec(Int32 cno) { if (con.State == ConnectionState.Closed) { con.Open(); } SqlCommand cmd = new SqlCommand("findmsg", con); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Add("@msgcod", SqlDbType.Int).Value = cno; SqlDataReader dr = cmd.ExecuteReader(); List<clsmsgprp> obj = new List<clsmsgprp>(); if (dr.HasRows) { dr.Read(); clsmsgprp k = new clsmsgprp(); k.msgcod = Convert.ToInt32(dr[0]); k.msgdat = Convert.ToDateTime(dr[1]); k.msgusrcod = Convert.ToInt32(dr[2]); k.msgadvcod = Convert.ToInt32(dr[3]); k.msgdsc = dr[4].ToString(); obj.Add(k); } dr.Close(); cmd.Dispose(); con.Close(); return obj; } } } <file_sep>using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; public partial class admin_Default : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { } protected void Button3_Click(object sender, EventArgs e) { nsgumtree.clsloc obj = new nsgumtree.clsloc(); nsgumtree.clslocprp objprp = new nsgumtree.clslocprp(); objprp.loccntcod = Convert.ToInt32(DropDownList1.SelectedValue); objprp.locnam = TextBox1.Text; if (Button3.Text == "submit") obj.save_rec(objprp); else { objprp.loccod = Convert.ToInt32(ViewState["cod"]); obj.update_rec(objprp); Button3.Text = "submit"; } GridView1.DataBind(); TextBox1.Text = string.Empty; } protected void GridView1_RowEditing(object sender, GridViewEditEventArgs e) { Int32 a = Convert.ToInt32(GridView1.DataKeys[e.NewEditIndex][0]); nsgumtree.clsloc obj = new nsgumtree.clsloc(); List<nsgumtree.clslocprp> k = obj.find_rec(a); TextBox1.Text = k[0].locnam; Button3.Text = "update"; ViewState["cod"] = a; e.Cancel = true; } protected void GridView1_RowDeleting(object sender, GridViewDeleteEventArgs e) { nsgumtree.clsloc obj = new nsgumtree.clsloc(); nsgumtree.clslocprp objprp = new nsgumtree.clslocprp(); objprp.loccod = Convert.ToInt32(GridView1.DataKeys[e.RowIndex][0]); obj.delete_rec(objprp); GridView1.DataBind(); e.Cancel = true; } protected void Button4_Click(object sender, EventArgs e) { TextBox1.Text = string.Empty; DropDownList1.Focus(); } } <file_sep>using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; public partial class _Default : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { } protected void Button1_Click(object sender, EventArgs e) { nsgumtree.clsusr obj = new nsgumtree.clsusr(); nsgumtree.clsusrprp objprp = new nsgumtree.clsusrprp(); objprp.usrnam = txtnam.Text; objprp.usreml = txteml.Text; objprp.usrpwd = <PASSWORD>.Text; objprp.usrloccod = Convert.ToInt32(DropDownList2.SelectedValue); objprp.usrphn = txtphn.Text; // objprp.usrpln =Convert.ToInt32(DropDownList3.SelectedValue); objprp.usrregdat = DateTime.Now; objprp.usrrol = 'u'; try { obj.save_rec(objprp); txteml.Text = string.Empty; txtnam.Text = string.Empty; txtphn.Text = string.Empty; Label1.Text = "Registration Successfull"; } catch(Exception exp) { Label1.Text="Email Id already Exists"; } } }<file_sep>using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; public partial class user_Default : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { if (Page.IsPostBack == false) { TabContainer1.Tabs[1].Enabled = false; TabContainer1.ActiveTabIndex = 0; } } protected void Button1_Click(object sender, EventArgs e) { nsgumtree.clsadv obj = new nsgumtree.clsadv(); nsgumtree.clsadvprp objprp = new nsgumtree.clsadvprp(); objprp.advdat = DateTime.Now; objprp.advdsc = txtdsc.Text; objprp.advitmtypcod = Convert.ToInt32(DropDownList3.SelectedValue); objprp.advmanpiccod = -1; objprp.advprc = Convert.ToInt32(txtprc.Text); objprp.advsts = 'N'; objprp.advtit = txtadvtit.Text; objprp.advusrcod = Convert.ToInt32(Session["cod"]); Int32 a = obj.save_rec(objprp); ViewState["cod"] = a; TabContainer1.Tabs[0].Enabled = false; TabContainer1.Tabs[1].Enabled = true; TabContainer1.ActiveTabIndex = 1; } private void Bind() { nsgumtree.clsadvpic obj = new nsgumtree.clsadvpic(); DataList1.DataSource = obj.disp_rec(Convert.ToInt32(ViewState["cod"])); DataList1.DataBind(); } protected void Button3_Click(object sender, EventArgs e) { nsgumtree.clsadvpic obj = new nsgumtree.clsadvpic(); nsgumtree.clsadvpicprp objprp = new nsgumtree.clsadvpicprp(); objprp.advpicadvcod = Convert.ToInt32(ViewState["cod"]); objprp.advpicdsc = TextBox1.Text; objprp.advpicsts = Convert.ToChar(RadioButtonList1.SelectedValue); string s = FileUpload1.PostedFile.FileName; if (s != " ") s = s.Substring(s.LastIndexOf('.')); objprp.advpicpic = s; Int32 a = obj.save_rec(objprp); if (s != " ") { FileUpload1.PostedFile.SaveAs(Server.MapPath("../advpics") + "//" + a.ToString() + s); } TextBox1.Text = string.Empty; Bind(); } }
8ebfc5bbef984886112cdc06ba9947a96168b0b3
[ "C#" ]
7
C#
Jasjeet0007/gumtree
c60c92dc99db582dfc26f4a8ffee2afbcd280040
4bf8e68f66ca3ad9fcfee45f0bfd99d7784f90b5
refs/heads/master
<file_sep># text-mmo-client Python Text MMO Client <file_sep>#!/usr/bin/env python3 from socket import AF_INET, socket, SOCK_STREAM from threading import Thread import sys def receive(): while True: try: msg = client_socket.recv(BUFSIZ).decode("utf8") print(msg) except OSError: break def send(msg): client_socket.send(bytes(msg, "utf8")) if msg == "{exit}": client_socket.close() sys.exit() HOST = "127.0.0.1" PORT = 34000 BUFSIZ = 1024 ADDR = (HOST,PORT) client_socket = socket(AF_INET, SOCK_STREAM) client_socket.connect(ADDR) receive_thread = Thread(target=receive) receive_thread.start() while True: message = input("> ") send(message)
493fa3f8c22af24fe760795a32c93539868ec920
[ "Markdown", "Python" ]
2
Markdown
jsownz/text-mmo-client
5c07a5a1bc1ca3f845a22a4d607d24fec36d82c0
a03afbc999cc4ec0c6ca01b2692ae54b5bbe3a90
refs/heads/master
<file_sep>package it.polito.tdp.lab04.controller; import java.util.Collections; import java.util.LinkedList; import java.util.List; import it.polito.tdp.lab04.model.Corso; import it.polito.tdp.lab04.model.Model; import it.polito.tdp.lab04.model.Studente; import javafx.event.ActionEvent; import javafx.fxml.FXML; import javafx.scene.control.Button; import javafx.scene.control.ComboBox; import javafx.scene.control.TextArea; import javafx.scene.control.TextField; public class SegreteriaStudentiController { private Model model; List<Corso> listaCorsi = new LinkedList<Corso>(); @FXML private ComboBox<Corso> comboCorso; @FXML private Button btnCercaIscrittiCorso; @FXML private Button btnCercaCorsi; @FXML private Button btnCercaNome; @FXML private TextArea txtResult; @FXML private Button btnIscrivi; @FXML private TextField txtMatricola; @FXML private Button btnReset; @FXML private TextField txtNome; @FXML private TextField txtCognome; public void setModel(Model model) { this.model=model; listaCorsi.addAll(model.getListaCorsi()); listaCorsi.add(new Corso("",0,"",0)); comboCorso.getItems().addAll(listaCorsi); } @FXML void doReset(ActionEvent event) { comboCorso.getSelectionModel().clearSelection(); txtMatricola.clear(); txtNome.clear(); txtCognome.clear(); txtResult.clear(); } @FXML void doCercaNome(ActionEvent event) { String mat=txtMatricola.getText(); if(mat.matches("[0-9]*") && mat.trim().length()==6){ int matricola=Integer.parseInt(mat); Studente s=model.trovaStudente(matricola); if (s!=null ){ txtNome.setText(s.getNome()); txtCognome.setText(s.getCognome()); } else { txtResult.setText("Errore! La matricola inserita non č presente nel DB!"); return; } } else { txtResult.setText("Errore! Il campo matricola non puņ contenere caratteri, e la dim deve essere 6!"); return; } } @FXML void doCercaIscrittiCorso(ActionEvent event) { Corso corso=comboCorso.getValue(); List<Studente>iscritti=new LinkedList<Studente>(model.cercaIscritti(corso)); if (iscritti.isEmpty()){ txtResult.setText("Questo corso non ha iscritti"); } else{ String s=""; for (Studente st:iscritti){ s+=st+"\n"; } txtResult.setText(s); } } @FXML void doCercaCorsi(ActionEvent event) { String mat=txtMatricola.getText(); if(mat.matches("[0-9]*") && mat.trim().length()==6){ int matricola=Integer.parseInt(mat); List <Corso> corsi= new LinkedList<Corso>(model.corsiStudente(matricola)); if(corsi.isEmpty()){ txtResult.setText("Questo studente non č iscritto ad alcun corso"); } else{ String s=""; for(Corso co:corsi){ s+=co.descriviCorso()+"\n"; } txtResult.setText(s); } } else { txtResult.setText("Errore! Il campo matricola non puņ contenere caratteri, e la dim deve essere 6!"); return; } } @FXML void doIscrivi(ActionEvent event) { Corso c=comboCorso.getValue(); Studente s=new Studente(Integer.parseInt(txtMatricola.getText()), txtNome.getText(), txtCognome.getText(), ""); if(model.iscritto(s, c)==true){ txtResult.setText("Studente gia' iscritto a questo corso"); } else{ boolean flag=model.iscrivi(s, c); if (flag==true){ txtResult.setText("Studente iscritto correttamente a questo corso"); } else{ txtResult.setText("Iscrizione non andata a buon fine"); return; } } } @FXML void initialize() { assert comboCorso != null : "fx:id=\"comboCorso\" was not injected: check your FXML file 'SegreteriaStudenti.fxml'."; assert btnCercaIscrittiCorso != null : "fx:id=\"btnCercaIscrittiCorso\" was not injected: check your FXML file 'SegreteriaStudenti.fxml'."; assert btnCercaCorsi != null : "fx:id=\"btnCercaCorsi\" was not injected: check your FXML file 'SegreteriaStudenti.fxml'."; assert btnCercaNome != null : "fx:id=\"btnCercaNome\" was not injected: check your FXML file 'SegreteriaStudenti.fxml'."; assert txtNome != null : "fx:id=\"txtNome\" was not injected: check your FXML file 'SegreteriaStudenti.fxml'."; assert txtResult != null : "fx:id=\"txtResult\" was not injected: check your FXML file 'SegreteriaStudenti.fxml'."; assert txtCognome != null : "fx:id=\"txtCognome\" was not injected: check your FXML file 'SegreteriaStudenti.fxml'."; assert btnIscrivi != null : "fx:id=\"btnIscrivi\" was not injected: check your FXML file 'SegreteriaStudenti.fxml'."; assert txtMatricola != null : "fx:id=\"txtMatricola\" was not injected: check your FXML file 'SegreteriaStudenti.fxml'."; assert btnReset != null : "fx:id=\"btnReset\" was not injected: check your FXML file 'SegreteriaStudenti.fxml'."; } }
bcc95b588d3528f836983cd5c26c663842b681c5
[ "Java" ]
1
Java
mirkofilice/Lab04
3017aa35bffcb3385b473e359a190bea83b93fd4
4ce332f83a146f2b1ec4a3d6cf1e1a86d02e94a5
refs/heads/master
<repo_name>hernamesbarbara/NAICS<file_sep>/combined.py import numpy as np import pandas as pd import string import pprint as pp pd.set_printoptions(max_columns=10, max_rows=50) f = './data/cleaned/industry_codes_1987_to_2012.csv' df = pd.read_csv(f, sep='|')<file_sep>/README.md ####...with aspirations of becoming an API for searching NAICS industry classification codes. #####Currently it only supports querying for a specific code or year. All 2007 and 2012 NAICS codes are available. GET /naics to fetch all documents: http://industries.herokuapp.com/naics Or query for a specific year and code: http://industries.herokuapp.com/naics?year=2007&code=72<file_sep>/year_mapping.py import numpy as np import pandas as pd import string import pprint as pp pd.set_printoptions(max_columns=10, max_rows=50) def snake(s): return "".join([c for c in s if c not in string.punctuation]).lower().replace(' ', '_') def cleanHeader(s, n_chars=16): return snake(s)[:n_chars] def readXls(xls): dirname = './data/raw/' wb = pd.ExcelFile(dirname + xls['name']) if xls['sheetname'] not in wb.sheet_names: return frame = wb.parse(xls['sheetname'], header=xls['header'], skiprows=xls['skiprows'], skip_footer=xls['skip_footer']) frame.columns = map(snake, frame.columns) frame['filename'] = xls['name'] return frame def getColumns(xls_list): colnames = [] for xls in workbooks: frame = readXls(xls) colnames.append({xls['name']: map(cleanHeader, frame.columns)}) return colnames workbooks = [ {'name': '2002_NAICS_to_1987_SIC.xls', 'sheetname': 'Sheet1', 'header': 0, 'skiprows': 0, 'skip_footer': 1 } , {'name': '2002_NAICS_to_1997_NAICS.xls', 'sheetname': 'Concordance 23 US NoD', 'header': 0, 'skiprows': 0, 'skip_footer': 1 } , {'name': '2007_to_2002_NAICS.xls', 'sheetname': '07 to 02 NAICS U.S.', 'header': 2, 'skiprows': 0, 'skip_footer': 0 } , {'name': '2012_to_2007_NAICS.xls', 'sheetname': '2012 to 2007 NAICS U.S.', 'header': 2, 'skiprows': 1, 'skip_footer': 0 } ] wbs = getColumns(workbooks) pp.pprint(wbs) filenames = [name for wb in wbs for name in wb.keys()] split_names = map(lambda x: x.split('_'), filenames) split_names = [ sorted(map(int, filter(lambda x: x.isdigit(), part_list))) for part_list in split_names ] years = zip(filenames, split_names) years = [{'filename': k, 'start': v[0], 'end': v[1]} for k, v in years] years_df = pd.DataFrame(years) for wb in workbooks: print 'reading %s: ' % wb['name'] df = readXls(wb) print 'merging %s with years_df' % wb['name'] df = pd.merge(df, years_df) print 'writing to csv file: %s' % df.filename.unique()[0] + ".txt" df.to_csv('./data/cleaned/' + df.filename.unique()[0] + ".txt", sep="|", encoding='utf-8') <file_sep>/app.py from pymongo import Connection from flask import Flask, jsonify from flask import request, Response, redirect import json, os, sys from urlparse import urlparse #CONFIGS app = Flask(__name__) MONGO_URI = os.environ.get('MONGOLAB_URI', 'mongodb://localhost') DBNAME = urlparse(MONGO_URI).path[1:] print 'THIS IS THE MONGO_URI\n', MONGO_URI print 'THIS IS THE MONGO_URI\n', DBNAME db = Connection(MONGO_URI)[DBNAME] def get_query(params): year = int(params['year']) if 'year' in params else False code = int(params['code']) if 'code' in params else False if year: query = {"year": year} if code: query = {"code": code} if year and code: query = {"year": year, "code": code} return query def find_naics(query={}): data = [rm_objectid(doc) for doc in db.naics_codes.find(query)] return {'objects': rm_objectid(data)} def respond_with(body={}, status=200): res = jsonify(body) res.headers['Title'] = title() res.status_code = status return res #HELPERS def rm_objectid(doc={}): "remove mongo objectid to serialize" if "_id" in doc: del doc['_id'] return doc def title(): return 'NAICS Industry Codes' @app.before_request def strip_trailing_slash(): if request.path != '/' and request.path.endswith('/'): return redirect(request.path[:-1]) @app.errorhandler(404) def not_found(error=None): message = {'status': 404, 'message': 'Not Found: %s' %(request.url)} return respond_with(message, 404) #ROUTES @app.route("/naics", methods=['GET']) def get(): query = False if len(request.args.keys()) > 0: query = get_query(request.args) data = find_naics(query) if query else find_naics() return respond_with(data, 200) @app.route("/", methods=['GET']) def root(): message = {'status': 'OK', 'name': 'NAICS Industry Codes', 'version': '0.1', 'url': 'http://github.com/hernamesbarbara/NAICS', 'license': 'None', 'author': '<NAME>', 'description': 'An API providing NAICS industry classification codes.'} return respond_with(message, 200) if __name__ == "__main__": port = int(os.environ.get('PORT', 5000)) host = os.environ.get('ADDRESS', '0.0.0.0') app.run(host=host, port=port) <file_sep>/data/flatfiles.py import csv, re, json, xlrd, codecs, sys import pprint as pp from pymongo import Connection from urlparse import urlparse import argparse def utf8ify(a_list): "returns list w/ string as utf-8 and floats as ints" """ >>> utf8ify([1.0, 11.0, u'Agriculture, Forestry, Fishing and Hunting']) ['1', '11', 'Agriculture, Forestry, Fishing and Hunting'] """ return [unicode(s).encode("utf-8") if hasattr(s,'encode') else int(s) for s in a_list] def to_snake(s): "returns a string in snake_case" """ >>> to_snake('my phone number is (555)555-5555') 'my_phone_number_is_555_555_5555' """ return re.sub('\W', '_', s.lower()).strip('_').replace('__', '_') if hasattr(s, 'encode') else s def read_txt(f): with open(f, 'r') as f: reader = csv.reader(f, delimiter='\t') return [utf8ify(row) for row in reader] def read_xls(workbook, sheet_name='Sheet1'): wb = xlrd.open_workbook(workbook) sh = wb.sheet_by_name(sheet_name) return [utf8ify(sh.row_values(r)) for r in range(sh.nrows)] def lists_to_dicts(list_of_lists, headers_index=0): "given a list of lists, returns a list of dictionaries" """ args: list_of_lists: [ ['item1', 'item2'], ['item3', 'item4'] ] headers_index: int => index of the row to become dictionary keys returns: list of dictionaries records: [{key1: 'item1', key2: 'item2'},{key1: 'item3', key2: 'item4'}] """ headers_index = headers_index rows = list_of_lists records = [] for i, row in enumerate(rows): if i < headers_index: continue if i==headers_index: headers = [to_snake(field).replace('__', '_') for field in utf8ify(row)] headers = dict(zip(headers, range(len(headers)))) continue if all(map(lambda x: len(str(x))==0, row)): continue record = {} for field_name in headers.keys(): try: record[field_name] = int(row[headers[field_name]]) except: record[field_name] = row[headers[field_name]] records.append(record) return records def format_doc(doc): to_save={} for key in doc: print key, doc[key] if "_naics_us_title" in key: to_save["year"] = int(key[0:4]) to_save["title"] = doc[key] if "_naics_us_code" in key: try: to_save["code"] = int(doc[key]) except: to_save["code"] = int(doc[key][:2]) return to_save def save_to_mongo(records, db, collection): "save a list of dictionaries to mongo" """ args: records: [{'foo': 'bar'}, {'something': 'somethingelse'}] db: mongodb = Connection()['industries'] collection: name of the collection """ print 'saving %s records to the %s mongo collection...' %(len(records), collection) for doc in records: doc = format_doc(doc) db['naics_codes'].save(doc) def main(): parser = argparse.ArgumentParser(description=('Given a URI and a file, saves data from the file to MongoDb.')) parser.add_argument('-m', '--mongodb', type=str, help='MONGO_URI') parser.add_argument('-f', '--filename', type=str, help='filename') parser.add_argument('-s', '--sheetname', type=str, default=None, help='sheetname if processing xls') parser.add_argument('-c', '--collection', type=str, help='mongo collection name') args = parser.parse_args() #files filename = args.filename sheetname = args.sheetname collection = args.collection #db MONGO_URI = args.mongodb try: uri = urlparse(MONGO_URI) db = Connection(MONGO_URI)[uri.path[1:]] except: sys.exit('unable to connect to the database') if filename.endswith('.txt'): rows = read_txt(filename) elif filename.endswith('xls'): if sheetname is not None: rows = read_xls(filename, sheetname) else: sys.exit('Provide a sheetname if processing xls file') else: sys.exit('Unable to process file. Please use .txt or .xls only') if rows: row_dicts = lists_to_dicts(rows) save_to_mongo(row_dicts, db, collection) if __name__=='__main__': main() <file_sep>/requirements.txt Flask==0.9 Jinja2==2.6 Werkzeug==0.8.3 distribute==0.6.28 git-remote-helpers==0.1.0 pymongo==2.3 wsgiref==0.1.2 xlrd==0.8.0
b79509d7049fd660a0976182b888cf1409e98ab1
[ "Markdown", "Python", "Text" ]
6
Python
hernamesbarbara/NAICS
f8230b770420c2e1c65df1eb7969195f58c9f622
aa10e36329334ba13a0e0ff6d8a5dcd21de0c9f5
refs/heads/master
<file_sep>eel.release_link("return release")(release) function release(r){ document.getElementById("releaseyr-span").innerHTML = r; }<file_sep>eel.name_link("return title/name!")(nits) function nits(n){ document.getElementById("title-span").innerHTML = n; } <file_sep>eel.episodes_link("return episode")(episodes) function episodes(e){ document.getElementById("episodeno-span").innerHTML = e; }<file_sep># AniEel AniEel is an application written in python to watch anime using webscraping api library(goganimeapi). - __Next Update : CLI setup build__ ## Update -> UI: Fully responsive & comprehensive ! ## Usage Download the distributable(.exe) and run it or you can build one for your own os by the running following code in terminal in the same directory as this repository ```bash python -m eel app.py web --onefile --icon=ifyouhaveany ``` ![terminal](https://user-images.githubusercontent.com/75524300/120779169-6fdaf280-c544-11eb-8d4f-bb97b7bd7097.png) ![eelwindow](https://user-images.githubusercontent.com/75524300/120780465-c7c62900-c545-11eb-880a-8ad87a5f8358.png) ## Contributing Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change. ## License [MIT](https://choosealicense.com/licenses/mit/)<file_sep>eel.status_link("return status")(status) function status(s){ document.getElementById("status-span").innerHTML = s; }<file_sep>eel.Src_link()(play) function play(nsrc){ document.getElementById("gvid-frame").src=nsrc; document.getElementById("gvid-src").load(); }<file_sep>requests-html==0.10.0 requests==2.22.0 beautifulsoup4==4.8.1 Eel==0.12.4
f19073f43b78682409552539d06d580798886bcb
[ "JavaScript", "Text", "Markdown" ]
7
JavaScript
ryan-k8/AniEel
e339db13274792c0b27060fbac68370107855fba
dc83c51589ad5aff12fc449064898d11b829d9b0
refs/heads/master
<file_sep>@palettegear/boost === Redistribution of the Boost C++ Library for use in native Node.js modules. ## Upgrade to a new version of Boost 1. Find the latest version on the [Boost Downloads](https://www.boost.org/users/download/) page 2. Edit `package.json` and update the `boost.tarball` and `boost.sha256` fields 3. Run `npm run install-boost` 4. Run `npm publish --access=public` (Requires access to the [palettegear org on NPM](https://www.npmjs.com/org/palettegear)) ## License [Boost Software License - Version 1.0](https://www.boost.org/LICENSE_1_0.txt) <file_sep>const assert = require('assert') const cp = require('child_process') const fs = require('fs') const path = require('path') const { promisify } = require('util') const { boost } = require('../package.json') const stat = promisify(fs.stat) const exec = promisify(cp.exec) const execFile = promisify(cp.execFile) const rename = promisify(fs.rename) const rmdir = promisify(fs.rmdir) const unlink = promisify(fs.unlink) async function install() { try { let tarball = boost.tarball.split('/').pop() await exec('rm -rf boost *.tar.gz') await exec(`curl -L -O ${boost.tarball}`) // Ensure the file was downloaded let tarballStat = await stat(tarball) assert(tarballStat.isFile()) // Verify the checksum let { stdout } = await execFile('shasum', ['-a', '256', '-b', tarball]) let actualChecksum = /[a-f0-9]{64}/i.exec(stdout) assert(actualChecksum && boost.sha256 === actualChecksum[0]) // Extract the boost subfolder and license folder let dest = path.basename(tarball, '.tar.gz') let licenseFile = `${dest}/${boost.license}` let boostFolder = `${dest}/boost` await exec(`tar -xzf ${tarball} ${licenseFile} ${boostFolder}`) // Check that extraction completed let licenseFileStat = await stat(licenseFile) let boostFolderStat = await stat(boostFolder) assert(licenseFileStat.isFile()) assert(boostFolderStat.isDirectory()) // Rename into current working directory await rename(licenseFile, path.basename(licenseFile)) await rename(boostFolder, path.basename(boostFolder)) // Remove extract destination await rmdir(dest) // Remove the tarball await unlink(tarball) } catch (error) { console.error(`Could not install this version of boost due to ${error}`) process.exit(1) } } install()
314949eb128fb0b1b77d06a43493f7a6a0b9da3c
[ "Markdown", "JavaScript" ]
2
Markdown
PaletteGear/boost
dd1d2343b50bae43dfd89cb85d9011d97582de6f
aaea7e94996b58eac06a446ed95e2cb6c510cc91
refs/heads/master
<file_sep> moved to [wtf_wikipedia/plugins](https://github.com/spencermountain/wtf_wikipedia/tree/master/plugins/wikitext) <file_sep>/* wtf-plugin-wikitext 0.0.1 MIT */ var doDoc = function doDoc() {}; var _01Doc = doDoc; var doSection = function doSection() {}; var _02Section = doSection; var doParagraph = function doParagraph() {}; var _03Paragraph = doParagraph; var doSentence = function doSentence() {}; var _04Sentence = doSentence; var doInfobox = function doInfobox() {}; var infobox = doInfobox; var doImage = function doImage() {}; var image = doImage; var plugin = function plugin(models) { models.Doc.wikitext = _01Doc; models.Section.wikitext = _02Section; models.Paragraph.wikitext = _03Paragraph; models.Sentence.wikitext = _04Sentence; models.Image.wikitext = image; models.Infobox.wikitext = infobox; // models.Template.wikitext = function(opts) {} // models.Link.wikitext = link }; var src = plugin; export default src; <file_sep>const defaults = {} const toWiki = function(options) { options = options || {} options = Object.assign({}, defaults, options) let text = '' return text } module.exports = toWiki <file_sep>const doc = require('./01-doc') const section = require('./02-section') const paragraph = require('./03-paragraph') const sentence = require('./04-sentence') // const link = require('./05-link') const infobox = require('./infobox') const image = require('./image') const plugin = function(models) { models.Doc.prototype.wikitext = doc models.Section.prototype.wikitext = section models.Paragraph.prototype.wikitext = paragraph models.Sentence.prototype.wikitext = sentence models.Image.prototype.wikitext = image models.Infobox.prototype.wikitext = infobox // models.Template.prototype.wikitext = function(opts) {} // models.Link.prototype.wikitext = link } module.exports = plugin <file_sep>const defaults = { images: true, tables: true, lists: true, links: true, paragraphs: true } const toWiki = function(options) { options = options || {} options = Object.assign({}, defaults, options) let text = '' //render each section text += this.data.sections.map(s => s.wikitext(options)).join('\n') return text } module.exports = toWiki <file_sep>const defaults = {} const toWiki = function(options) { options = options || {} options = Object.assign({}, defaults, options) let text = this.sentences().map(s => { return s.wikitext(options) }) return text.join('\n') } module.exports = toWiki
111c178fdb716be0e048f92e7fc1fe396e5c2e8f
[ "Markdown", "JavaScript" ]
6
Markdown
spencermountain/wtf-plugin-wikitext
467184c899f12d32fc4ed7722ce31a749ae719f8
51e6060997e1d5f1a580c7de5c3bfce6a3dde6f9
refs/heads/master
<repo_name>mesadhan/mini-os-in-c<file_sep>/README.md # Mini-os-in-c Mini OS Base On C Language, That is basically fun project. # Description: > This project cover losts of concepts. I developed it with basic knowledge. I was developing it with what I learned then. It covers - Implements Operation System Operations - How to working with Header files - How to read write in files - Learn Multi Dimentional Array - Learn Basic C Programing flow - and more.... # How to run > I developed it using CodeBlock. Download [codeblocks-17.12mingw-setup.exe]( http://www.codeblocks.org/downloads/binaries ) Now, install Code::Blocks then run ` main.c ` file. # Mini-OS Demo ![Alt Text](/mini-os-presentation.gif) > **Developed Date:** Sunday, ‎December ‎14, ‎2014, ‏‎12:17:45 AM Note: For User interaction, I used windows.h library if you like to run in linux environment then you should need some customization `Thanks Everyone!` <file_sep>/Tool.h /* * @Author: <NAME> * @Date: 2019-03-09 05:10:05 * @Last Modified by: <NAME> * @Last Modified time: 2019-03-09 05:10:05 */ #ifndef Tool /// Default header file declaration #include <stdio.h> #include <math.h> #include <time.h> #include <conio.h> #include <windows.h> #include <string.h> #include "notepad.h" #include "Dictionary.h" #include "hangmanG.h" #include "quizgame.h" #include "calculator.h" #include "quizgame.h" void menu(); void game(); void programs(); void loading(int a); void gotoxy(int x, int y); // message print position controller void gotoxy(int x, int y) // message print position controller { COORD sadhan; sadhan.X=x; sadhan.Y=y; SetConsoleCursorPosition(GetStdHandle(STD_OUTPUT_HANDLE), sadhan); } void loading(int a) // Loading bar in staring { int ch=177, b; for(b=0; b<=a; b++) { Sleep(100); printf("%c", ch); } Sleep(20); system("cls"); } void programs() // Windows Feature in Desktop. { system("cls"); int cP; //Choice program gotoxy(50,3);printf("4. <--Back"); printf("\n\tProgram List"); printf("\n\n\t1. Notepad. \t2. Dictionary. \t3. Calculator.\n"); printf("\n\n\tSelect One: "); scanf("%d%*c", &cP); if(cP == 1) {system("cls"); Sleep(100); menuOfNote(); } else if(cP == 2) { Sleep(100); system("cls"); Dictionary_menu(); } else if(cP == 3) { Sleep(100); system("cls"); calculatorS(); } else if(cP == 4) menu(); getch(); } void game() { system("cls"); int cP; //Choice program gotoxy(50,3);printf("4. <--Back"); printf("\n\t\tGame List"); printf("\n\n\t1. Hangman. \t2. Quiz Game\n"); printf("\n\n\tSelect One: "); scanf("%d%*c", &cP); if(cP == 1) {system("cls"); Sleep(100); Hangman_game(); Sleep(100); } else if(cP == 2) { system("cls"); Sleep(100); quizGame(); Sleep(100); } else if(cP == 4) menu(); } #define Tool #endif // Tool <file_sep>/quizgame.h /* * @Author: <NAME> * @Date: 2019-03-09 05:09:56 * @Last Modified by: <NAME> * @Last Modified time: 2019-03-09 05:09:56 */ void menu(); #ifndef quizgame void quizGame() { int a,b,score=0, sumS=0, high=0; char ch; while(1) { printf("\n\n\t\t***********************\n"); printf("\t\t* 1. For Start Game: *\n"); printf("\t\t* 2. For High Score: *\n"); printf("\t\t* 3. Quiz list: *\n"); printf("\t\t* 4. Exit: *\n"); printf("\t\t* 5. About Developer: *\n"); printf("\t\t***********************\n"); printf("\n\n\t\tChoose Any Option: "); scanf("%d", &a); system("cls"); if(a==1){ printf("\n\n\t1. What is the Valid Variable Name?\n\n"); printf("\t\t1. GO#\n\t\t2. 1go\n\t\t3. sum1\n\t\t4. i am\n\n"); printf("\tAnswer: "); scanf("%d", &b); if(b==3){ printf("\tCorrect. You got = 2\n"); score=2; sumS=sumS+score; ///....................Score } else printf("\tWrong.\n"); //printf("\n\n\tPress b <-- Back || Press Any key---->\n"); //ch = getch(); //if(ch=='b' || ch == 'B') goto sadhan; Sleep(1000); system("cls"); //.............................................................................. printf("\n\t2. Which one is keyword in C?\n\n"); printf("\t\t1. C\n\t\t2. printf\n\t\t3. number\n\t\t4. if\n\n"); printf("\tAnswer: "); scanf("%d", &b); if(b==4){ printf("\tCorrect. You got = 2\n"); score=2; sumS=sumS+score; ///....................Score } else printf("\tWrong.\n"); //printf("\n\n\tPress b <-- Back || Press Any key---->\n"); //ch = getch(); //if(ch=='b' || ch == 'B') goto sadhan; Sleep(1000); system("cls"); //................................................................................. printf("\n\t3. If the variable is integer type a=25,b=2\n\tThen what will be the output a/b?\n\n"); printf("\t\t1. 12.0\n\t\t2. 12\n\t\t3. 12.5\n\t\t4. 12.50\n\n"); printf(" Answer: "); scanf("%d", &b); if(b==2){ printf(" Correct. You got = 2\n"); score=2; sumS=sumS+score; ///....................Score } else printf(" Wrong.\n"); //printf("\n\n\tPress b <-- Back || Press Any key---->\n"); //ch = getch(); //if(ch=='b' || ch == "B") goto sadhan; Sleep(1000); system("cls"); //................................................................................. printf("\n\t4. If a=5, b=10, c=-3 than what will be\n\tthe value of expression: a+(b/(++c)) ?\n\n"); printf("\t\t1. 1\n\t\t2. 7\n\t\t3. 10\n\t\t4. 0\n\n"); printf(" Answer: "); scanf("%d", &b); if(b==4){ printf(" Correct. You got = 2\n"); score=2; sumS=sumS+score; ///....................Score } else printf(" Wrong.\n"); //printf("\n\n\tPress b <-- Back || Press Any key----> "); //ch = getch(); //if(ch=='b' || ch == 'B') goto sadhan; Sleep(1000); system("cls"); //................................................................................. printf("\n\t5. What is the size of an int data type?\n\n"); printf("\t\t1. 4 Bytes\n\t\t2. 8 Bytes\n\t\t3. Depends on the system/compiler\n\t\t4. Cannot be determined\n\n"); printf(" Answer: "); scanf("%d", &b); if(b==3){ printf(" Correct. You got = 2\n"); score=2; sumS=sumS+score; ///....................Score } else printf(" Wrong.\n"); printf("\n\t\t**************************\n", sumS); printf("\t\t* Your Total Score is: %d *", sumS); printf("\n\t\t**************************\n\n\n", sumS); high=sumS; /// Here store High Score; } else if(a==2) { printf("\n\t\t**********************\n", high); printf("\t\t* Last High Score: %d *", high); printf("\n\t\t**********************\n\n\n", high); } else if(a==3) { printf("\n\n\t*******************************************\n"); printf("\n\t1. What is the Valid Variable Name?\n"); printf("\n\t2. Which one is keyword in C?\n"); printf("\n\t3. If the variable is integer type a=25,b=2\n\tThen what will be the output a/b?\n"); printf("\n\t4. If a=5, b=10, c=-3 than what will be\n\tthe value of expression: a+(b/(++c))?\n"); printf("\n\t5. What is the size of an int data type?\n"); printf("\n\t*******************************************\n\n\n"); Sleep(3000); } else if(a==4){ printf("\n\n\n\n\t\t**************\n"); printf("\t\t*** Thanks ***\n"); printf("\t\t**************\n\n"); Sleep(1000); menu(); } else if(a==5){ printf("\n\t\t**************************************************\n"); printf("\t\t*** Name: MD. <NAME> ***\n"); printf("\t\t*** B.S.C IN C.S.E ***\n"); printf("\t\t*** E-mail: <EMAIL> ***\n"); printf("\t\t*** Facebook: facebook.com/sadhan34 ***\n"); printf("\t\t*** Student: Daffodil international University ***\n"); printf("\t\t**************************************************\n\n"); Sleep(5000); } //sadhan: //Goto tag Sleep(500); system("cls"); } } #define quizgame #endif // quizGame <file_sep>/hangmanG.h /* * @Author: Md. <NAME> * @Date: 2019-03-09 05:08:39 * @Last Modified by: mikey.zhaopeng * @Last Modified time: 2019-03-09 05:08:39 */ void game(); void menu(); #ifndef hangmanG void developer(); void start(); void help(); char word[20]; char temp[20]; void guessWord1(); void exitG(); void m(char[]); void gameOver(); void gameControl(); void hangman(); void Hangman_game(); char ch,control; char name[20]; int a,b,c=0,count=0,miss=0,wrongG=0; void Hangman_game() { start(); printf("\n\n\n\n\t\tEnter Your Name: "); gets(name); //printf("\n\t\tPress Any Key To Start...........\n"); Sleep(1000); //getch(); system("cls"); help(); Sleep(5000); char word[] = "sadhan"; // Demo Word char temp[] = "s*d**n"; char word1[] = "game"; char temp1[] = "****"; char word2[] = "play"; char temp2[] = "****"; char word3[] = "program"; char temp3[] = "*******"; char word4[] = "computer"; char temp4[] = "********"; char word5[] = "concatenate"; char temp5[] = "***********"; while(1) { system("cls"); printf("\n\t\tHere you have Guess 6 letter"); guessWord1(word,temp); printf("\n\n\t\tThe Word is sadhan. You missed %d",6-miss); // Simple massage that show the guess complete word and notice the incorrect guess printf("\n\t\tYou Got Score: %d", count); // At last show the score; printf("\n\n***** Do you want to guess another Word? Enter y or n>: "); control = getche(); exitG();miss=0; system("cls"); printf("\n\n\t\tHere you have Guess 4 letter"); guessWord1(word1,temp1); printf("\n\n\t\tThe Word is game. You missed %d",4-miss); printf("\n\t\tYou Got Score: %d", count); printf("\n\n***** Do you want to guess another Word? Enter y or n>: "); control = getche(); exitG();miss=0; system("cls"); printf("\n\t\tHere you have Guess 4 letter"); guessWord1(word2,temp2); printf("\n\n\t\tThe Word is play. You missed %d",4-miss); printf("\n\t\tYou Got Score: %d", count); printf("\n\n***** Do you want to guess another Word? Enter y or n>: "); control = getche(); exitG();miss=0; system("cls"); printf("\n\t\tHere you have Guess 7 letter"); guessWord1(word3,temp3); printf("\n\n\t\tThe Word is program. You missed %d",7-miss); printf("\n\t\tYou Got Score: %d", count); printf("\n\n***** Do you want to guess another Word? Enter y or n>: "); control = getche(); exitG();miss=0; system("cls"); printf("\n\t\tHere you have Guess 8 letter"); guessWord1(word4,temp4); printf("\n\n\t\tThe Word is computer. You missed %d",8-miss); printf("\n\t\tYou Got Score: %d", count); printf("\n\n***** Do you want to guess another Word? Enter y or n>: "); control = getche(); exitG();miss=0; system("cls"); printf("\n\t\tHere you have Guess 11 letter"); guessWord1(word5,temp5); printf("\n\n\t\tThe Word is concatenate. You missed %d",11-miss); printf("\n\t\tYou Got Score: %d", count); system("cls"); gameOver(); getch(); } } void guessWord1(char word[],char temp[]) { for(a=0; a<strlen(word); a++) { printf("\n\n\t(Guess No: %d ) Enter a Letter in Word: %s > ",a+1, temp); ch = getche(); //getchar(); if(word[a] == ch) // This condition check the guess letter { temp[a] = ch; count++; miss++; } else if((word[a] != ch)) // This condition only true when guess word does not exit { for(b=0; word[b]!=0; b++) // This loop searching the word. { if(word[b]==ch) // By This line we check that the user guess word match or not { c=1; // If match then we are going to give massage Arrangement system wrong Other wise not in the word break; } } if(c==0)printf("\n\t\t%c is not in the word\n",ch); // Message 1 else printf("\n\t\tArrangement System Wrong\n",ch); // Message 2 wrongG++; if(wrongG>10) gameControl(); } } temp[a]='\0'; } void exitG() { if(control == 'n' || control == 'N'){ m(name); developer(); printf("\n\t\tPress any Key"); game(); } } void gameControl() { m(name); /// Menu Function Call for save user name and Highscore hangman(); game(); } void m(char name[]) { FILE *p; p = fopen("HighScore.txt","a+"); if(p==NULL) printf("\nFile Unable to Open.\n"); else{ fprintf(p,"\n%s\t",name); fprintf(p,"%d\n",count); /// For save High score fclose(p); } } void gameOver() { printf("\n\n\n HHHH HH HH HH HHHHHH HH HH HH HHHHHH HHHH\n HH HH HH HHHHHH HH HH HH HH HH HH HH HH\n HH HH HHHHHH HHHHHH HHHH HH HH HH HH HHHH HHHH\n HH HH HH HH HH HH HH HH HH HH HH HH HH HH\n HHHH HH HH HH HH HHHHHH HH HH HHHHHH HH HH\n"); developer(); printf("\n\t\tThanks For Playing This Game.\n"); getch(); } void hangman() { int b=0; while(b!=5){ system("cls"); int a; printf("\n\t\tDHHHHHHHHHHHHHHHD DMMMMMMMMMMMMMMD \n"); printf("\t\tD NOW HANG D D YOU LOSSER D \n"); printf("\t\tDMMMMMMMMMMMMMMMD DMHHHHHHHHHHHHHD \n"); printf("\n\n\n\t\tDDMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMDD\n"); printf("\t\tD Sorry! Your mistake more than 10. D\n\t\tD So You failed to save Yourself. D\n"); printf("\t\tDDMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMDD\n"); for(a=0; a<=35; a++) { printf("\t\t\t MMM\n"); Sleep(10); } Sleep(100); printf("\t\t DDDMMMMDDD \n"); printf("\t\t DDG GDD \n"); printf("\t\t MM () () MM \n"); printf("\t\t MM DD \n"); printf("\t\t MM ^^^^ DD \n"); printf("\t\t DD * DD \n"); printf("\t\t MMVVVVVVMM \n");Sleep(50); printf("\t\t MM \n");Sleep(50); printf("\t\t MMDD MM DDMM \n");Sleep(50); printf("\t\t VVDD MM DDVV \n");Sleep(50); printf("\t\t MMMDDDMMMM \n");Sleep(50); printf("\t\t MMMMMM \n");Sleep(50); printf("\t\t MM \n");Sleep(50); printf("\t\t MM \n");Sleep(50); printf("\t\t MM \n");Sleep(50); printf("\t\t MM \n");Sleep(50); printf("\t\t MM \n");Sleep(50); printf("\t\t DDDD MMDD \n");Sleep(50); printf("\t\t MMDD DDMM \n");Sleep(50); printf("\t\t DD DD \n"); b++; } } void start() { int a; printf("\n\n\n\tII II @@@@ @@ @@ IIII @@ @@ @@@@ @@ @@ \n\tII II @@ @@ @@@ @@ II @@@ @@@ @@ @@ @@@ @@ \n\tIIIIII IIIIII II @ II II III@III IIIIII II @ II \n\t@@ @@ II II II @@@ @@ @@ II II II II II @@@ \n\t@@ @@ II II II II @@@@ II II II II II II \n"); printf("\n\n\t\t @@@@ @@ @@ @@ @@@@@@ \n\t\t @@ @@ @@ @@@@@@@ @@ \n\t\t II II IIIIII II @ II IIII \n\t\t II II II II II II II \n\t\t IIII II II II II IIIIII \n"); printf("\n\t\tPLEASE WAIT: "); for(a=0; a<=20; a++) { Sleep(100); printf("%c", 277); } } void developer() { Sleep(100); system("cls"); printf("\n\n\tABOUT DEVELOPER: \n"); printf("\n\t**************************************************\n\t*** Name: MD. <NAME> ***\n\t*** B.S.C IN C.S.E ***\n\t*** E-mail: <EMAIL> ***\n\t*** Facebook: facebook.com/sadhan34 ***\n\t*** Student: Daffodil international University ***\n\t**************************************************\n"); Sleep(5000); } void help() { printf("\n\n\n\n\t ******************************************************\n\t * INSTRACTION OR HELP: *\n\t * 1. THIS PROGRAM ALL LETTER IS LOWERCASE. *\n\t * 2. REMEMBER THAT IF YOU MISTAKE MORE THEN 10 GUESS *\n\t * THEN YOU SHOULD BE HANGING. SO PALY CAREFULLY. *\n\t * 3. IF YOU ARE FATCH ANY PROBLEM PRESS \"ENTER KEY\" *\n\t ********************THANK YOU*************************\n"); } #define hangmanG #endif // hangmanG <file_sep>/main.c /* * @Author: <NAME> * @Date: 2019-03-09 05:09:29 * @Last Modified by: <NAME> * @Last Modified time: 2019-03-09 05:09:29 */ #include "Tool.h" void menu(); void passwordSave(); void passwordCheck(); void passwordConfirmation(); void login(); char temp[20]; char password[20]; char rePassword[20]; char setp[20]; int main() { SetConsoleTitle("MiNi OS"); while(1) { system("color 1a"); login(); } getch(); return 0; } void menu() { //Sleep(100); system("cls"); int cD; //choice desktop printf("\n\t1.Programs\t2. Games\t3.Setting\t4. Shut Down\n"); printf("\n\n\n-------> Select: "); scanf("%d%*c", &cD); if(cD == 3) { char verify[20]; printf("\n\nEnter Old Password: "); gets(verify); if(strcmp(verify,temp)==0) passwordConfirmation(); else printf("\n\tError! New Password Not Match in Old Password\n"); } else if(cD == 1) programs(); else if(cD == 2) game(); else if(cD == 4) { printf("\n\n\n\t\tPlease Wait....Thank You"); Sleep(1000); exit(0); } else printf("\nPlease Choose Above Option"); } void login() // Login System and call just menu function { passwordCheck(); gotoxy(33, 4); printf("Login:\n"); // Message gotoxy(31, 6); gets(setp); // Input gotoxy(34, 6); system("cls"); //printf("\nUser Given Password: %s", setp); // Message if(strncmp(setp,temp,20)==0) { gotoxy(26, 4); printf("WeLCome TO MiNi OS"); // Message gotoxy(29, 8); printf("PLEASE WAIT\n"); // Message gotoxy(25, 16); loading(20); // Function. menu(); /// Menu Function For Boost Security } else { gotoxy(30, 8); printf("login Fail"); // Login Fail Message getch(); system("cls"); } } void passwordSave() // security system control { FILE *p; //p = fopen("C:\\Windows\\Help\\#", "w+"); p = fopen("#credential", "w+"); if(p==NULL) printf("Unable to open"); else { fprintf(p,"%s", rePassword); fclose(p); } passwordCheck(); } void passwordConfirmation() // security system control { printf("\n\tSet Password: "); gets(password); printf("\tRe-Write Password: "); gets(rePassword); if(strcmp(password,rePassword)==0) passwordSave(); else { printf("\n\n\tSorry Your Both Password Not Match\n"); Sleep(500); system("cls"); login(); } Sleep(200); system("cls"); } void passwordCheck() // security system control { FILE *c; //c = fopen("C:\\Windows\\Help\\#", "r+"); // password save location c = fopen("#credential", "r+"); if(c == NULL) { printf("\n\t--> This is Fist Time So Configure Your Setting\n"); passwordConfirmation(); } else { fscanf(c,"%s", temp); fclose(c); } //printf("\nCheck File Password: %s", temp); // Message } <file_sep>/notepad.h /* * @Author: <NAME> * @Date: 2019-03-09 05:09:45 * @Last Modified by: <NAME> * @Last Modified time: 2019-03-09 05:09:45 */ void gotoxy(int x, int y); /// Most important declaration //void menu(); void programs(); /// Most important declaration #ifndef notpad void menuOfNote(); void notebook(); void noteview(); void noteDelete(); void menuOfNote() { while(1) { int choice; printf("\n\t\t\t\tNote Pad\n"); gotoxy(50,4);printf("4. <--Back"); printf("\n\t1. Add New File. \n\t2. View File. \n\t3. Delete File.\n\n"); printf("\tSelect: "); scanf("%d%*c", &choice); if(choice == 1) notebook(); else if(choice == 2) noteview(); else if(choice == 3) noteDelete(); else if(choice == 4){ system("cls"); Sleep(100); programs(); } getch(); system("cls"); } } void notebook() { char name[25], ch; printf("\n\tFile Name: "); gets(name); FILE *p; p = fopen(strcat(name,".sd"), "w"); gotoxy(40,10);printf("\tSave File Use Key: Ctrl+Z"); printf("\n\n\n"); if(p==0) printf("\n\tSorry! Error in File"); else { printf("\nWrite:\r"); while(ch!=EOF) { ch = getchar(); fputc(ch,p); } fclose(p); } printf("\n\nFile Save Successfully"); } void noteview() { char searchF[30],ch; printf("\n\nFile name: "); gets(searchF); strcat(searchF,".sd"); FILE *v = fopen(searchF, "r"); printf("\n\n"); if(v==NULL) printf("File Does not exit\n"); else { while(!feof(v)) { ch = getc(v); //fgets(, , v); printf("%c", ch); } fclose(v); } } void noteDelete() { char searchForD[25]; printf("Enter File Name: "); gets(searchForD); strcat(searchForD, ".sd"); FILE *d =fopen(" ","r"); if(d==NULL) { int status; status = remove(searchForD); if(status == 0) printf("\n\tFile Deleted Successfully\n"); else puts("\n\tError!. File Does not Exit\n"); } fclose(d); } #define notpad /// Custom File By MD. <NAME> #endif // notpad <file_sep>/Dictionary.h /* * @Author: Md. <NAME> * @Date: 2019-03-09 04:58:27 * @Last Modified by: mikey.zhaopeng * @Last Modified time: 2019-03-09 05:00:54 */ #ifndef Dictionary #define size 300 int a,b; /// Use for loop. char wordD[25]; /// search input. char saveW[size][50]; /// search Word in file char saveM[size][50]; /// search meaning in file void Dictionary_menu(); /// local Variable void add(); /// local Variable void search(); /// local Variable void list(); /// local Variable void Dictionary_menu() { int choice; printf("\n\t\t\t\tDictionary\n"); gotoxy(50,4);printf("4. <--Back"); printf("\n\t1. Add Word\n"); printf("\t2. Search\n"); printf("\t3. List\n"); printf("\n\tSelect: "); scanf("%d%*c", &choice); if(choice == 1) add(); else if(choice == 2) search(); else if(choice == 3) list(); else if(choice == 4) programs(); else printf("\tError! Choose Above Option."); } void add() { FILE *w,*m; int sizeAD; printf("\n\tEnter Max Number: "); scanf("%d%*c", &sizeAD); char name[sizeAD][50]; // add char mean[sizeAD][50]; // add w = fopen("word.txt", "a"); m = fopen("mean.txt", "a"); if(w==NULL || m==NULL ) printf("Unable to Open.\n"); else{ for(a=0; a<sizeAD; a++) /// Add word and save in file { printf("\n\t%d: Enter Word: ", a+1); gets(name[a]); fprintf(w,"\n\t%s", name[a]); printf("\t Enter Meaning: "); gets( mean[a] ); fprintf(m,"\n\t%s", mean[a]); printf("\n"); } fclose(w); fclose(m); } } void search() { while(1) { system("cls"); FILE *iw,*im; iw = fopen("word.txt", "r"); im = fopen("mean.txt", "r"); for(a=0; a<size; a++) { fscanf(iw, "%s", saveW[a]); fscanf(im, "%s", saveM[a]); } gotoxy(50,4);printf("B Or b <--Back"); printf("\n\n\tEnter the Word: "); gets(wordD); if(!strcmp(wordD, "b") || !strcmp(wordD, "B")) break; /// Back Option else{ for(a=0; a<size; a++) { if ( !strcmp(saveW[a], wordD) ) { printf("\t\t: %s", saveM[a]); } } } fclose(iw); fclose(im); getch(); } } void list() { int a; char ch1, ch2; FILE *li1,*li2; li1 = fopen("word.txt", "r"); li2 = fopen("mean.txt", "r"); if(li1==NULL || li2==NULL) printf("Unable to Open"); else { printf("\n\tWord list: "); while(!feof(li1)) { ch1 = fgetc(li1); putchar(ch1); } printf("\n"); printf("\n\n\tMeaning list: "); while(!feof(li2)) { ch2 = fgetc(li2); putchar(ch2); } getch(); } fclose(li1); fclose(li2); system("cls"); } #define Dictionary #endif // Dictionary <file_sep>/calculator.h /* * @Author: <NAME> * @Date: 2019-03-09 05:01:27 * @Last Modified by: <NAME> * @Last Modified time: 2019-03-09 05:01:49 */ #ifndef calculator void menu(); int addition(int , int); void subtract(); void multiplication(int,int); float division(); void root(); void power(); void modulus(); void menuC(); void calculatorS() { while(1){ int choice; system("cls");menuC(); printf("\n\n\tChoose Option: "); scanf("%d", &choice); if(choice == 1) { int num1,num2,sum; printf("\t\t\t\t\t\t * Status: Summation"); printf("\n\tEnter 1st Number: "); scanf("%d", &num1); printf("\tEnter 2nd Number: "); scanf("%d", &num2); sum = addition(num1,num2); printf("\n\tSummation Value: %d\n", sum); } else if(choice == 2) subtract(); else if(choice == 3) { int num1,num2, mut; printf("\t\t\t\t\t\t * Status: Multiplication"); printf("\n\tEnter 1st Number: "); scanf("%d", &num1); printf("\tEnter 2nd Number: "); scanf("%d", &num2); multiplication(num1, num2); } else if(choice == 4) { float save; save = division(); printf("\n\tDivision Value: %.3f", save); } else if(choice == 5) root(); else if(choice == 6) power(); else if(choice == 7) modulus(); else if(choice == 8) menu(); getch(); } } int addition(int num1, int num2) { int sum; sum = num1+num2; return sum; } void subtract() { int num3,num4,subt; printf("\t\t\t\t\t\t * Status: Subtract"); printf("\n\tEnter 1st Number: "); scanf("%d", &num3); printf("\tEnter 2nd Number: "); scanf("%d", &num4); subt = num3-num4; printf("\n\tSubtract Value: %d", subt); } void multiplication(int num1,int num2) { int mutiplication = num1*num2; printf("\n\tMultiple Value: %d",mutiplication); } float division() { float num1, num2,div; printf("\t\t\t\t\t\t * Status: Division"); printf("\n\tEnter 1st Number: "); scanf("%f", &num1); printf("\tEnter 2nd Number: "); scanf("%f", &num2); div=num1/num2; return div; } void root() { int num; printf("\t\t\t\t\t\t * Status: Square Root"); printf("\n\tEnter Number: "); scanf("%d", &num); printf("\n\tSquare Root Value: %.3f", sqrt(num) ); } void power() { int num1,num2; printf("\t\t\t\t\t\t * Status: Power"); printf("\n\tEnter Number: "); scanf("%d", &num1); printf("\tEnter Number Power: "); scanf("%d", &num2); printf("\n\tValue: %.lf",pow(num1,num2)); } void modulus() { int num1,num2,m; printf("\t\t\t\t\t\t * Status: Modulus"); printf("\n\tEnter 1st Number: "); scanf("%d", &num1); printf("\tEnter 2nd Number: "); scanf("%d", &num2); m = num1%num2; printf("\n\tRemainder: %d", m); } void menuC() { printf("\n\t*************** ****************** **********************\n"); printf("\t* 1. Addition * * 2. Subtraction * * 3. Multiplication *\n"); printf("\t*************** ****************** **********************\n\n"); printf("\t*************** ****************** **********************\n"); printf("\t* 4. Division * * 5. Square Root * * 6.Power: 7.Modulus *\n"); printf("\t*************** ****************** **********************\n"); printf("\n\t*********** **********************\n"); printf("\t* 8. Exit * * Any Key For Back *\n"); printf("\t*********** **********************"); } #define calculator #endif // calculator
2fa234b13dc0a1d64b33773b5bfdad9d5910cdf7
[ "Markdown", "C" ]
8
Markdown
mesadhan/mini-os-in-c
b6bc93268607bbab73229a75f42b63e88522a1d1
33d441494c670bcec61098ba7c9f1b2906ce0df0
refs/heads/master
<file_sep>// modified js -- from http://babylonjs.com/Scenes/mountain/index.html var mountain = mountain || {}; // get the default values mountain.elevateMountain = function(ground){ this.ground = ground; // mountain plane this.radius = 20.0; // selection radius this.invertDirection = 1.0; // direction for inversion this.heightMin = 0.0; // height min this.heightMax = 60.0; // max heigh of mountain this.groundPositions = []; var scene = ground.getScene(); // var particleSystem = new BABYLON.ParticleSystem("particles", 2000, scene); /* var particleSystem = new BABYLON.ParticleSystem("particles", 4000, scene); particleSystem.particleTexture = new BABYLON.Texture("textures/Flare.png", scene); particleSystem.minAngularSpeed = -4.5; particleSystem.maxAngularSpeed = 4.5; particleSystem.minSize = 0.5; particleSystem.maxSize = 4.0; particleSystem.minLifeTime = 0.5; particleSystem.maxLifeTime = 2.0; particleSystem.minEmitPower = 0.5; particleSystem.maxEmitPower = 1.0; particleSystem.emitRate = 400; particleSystem.blendMode = BABYLON.ParticleSystem.BLENDMODE_ONEONE; particleSystem.minEmitBox = new BABYLON.Vector3(0, 0, 0); particleSystem.maxEmitBox = new BABYLON.Vector3(0, 0, 0); particleSystem.direction1 = new BABYLON.Vector3(0, 1, 0); particleSystem.direction2 = new BABYLON.Vector3(0, 1, 0); particleSystem.color1 = new BABYLON.Color4(0, 0, 1, 1); particleSystem.color2 = new BABYLON.Color4(1, 1, 1, 1); particleSystem.gravity = new BABYLON.Vector3(0, 5, 0); particleSystem.manualEmitCount = 0; particleSystem.emitter = new BABYLON.Vector3(0, 0, 0); particleSystem.start(); this._particleSystem = particleSystem;*/ var ABox = BABYLON.Mesh.CreateBox("theBox2", 1.0, scene, true, BABYLON.Mesh.DEFAULTSIDE); var particleSystem = new BABYLON.ParticleSystem("particles", 2000, scene); particleSystem.particleTexture = new BABYLON.Texture("textures/Flare.png", scene); particleSystem.emitter = ABox; particleSystem.emitter = new BABYLON.Vector3(0, 0, 0); particleSystem.minEmitBox = new BABYLON.Vector3(-1, 0, 0); // Starting all from particleSystem.maxEmitBox = new BABYLON.Vector3(1, 0, 0); // To... particleSystem.color1 = new BABYLON.Color4(0.8, 0.1, 0, 1.0); particleSystem.color2 = new BABYLON.Color4(1, 0, 0, 1.0); particleSystem.colorDead = new BABYLON.Color4(0, 0, 0, 0.0); particleSystem.minSize = 5; particleSystem.maxSize = 10; particleSystem.minLifeTime = 0.3; particleSystem.maxLifeTime = 1.5; particleSystem.emitRate = 2500; particleSystem.blendMode = BABYLON.ParticleSystem.BLENDMODE_ONEONE; particleSystem.gravity = new BABYLON.Vector3(0, 35, 0); particleSystem.direction1 = new BABYLON.Vector3(-7, 8, 3); particleSystem.direction2 = new BABYLON.Vector3(7, 8, -3); particleSystem.minAngularSpeed = 0; particleSystem.maxAngularSpeed = Math.PI; particleSystem.minEmitPower = 1; particleSystem.maxEmitPower = 3; particleSystem.updateSpeed = 0.005; this.particles = particleSystem; // water particles var waterDrops = new BABYLON.ParticleSystem("waterParticles", 2000, scene); waterDrops.particleTexture = new BABYLON.Texture("textures/Flare.png", scene); // particleSystem.emitter = ABox; waterDrops.emitter = new BABYLON.Vector3(-50, 50, 0); waterDrops.minEmitBox = new BABYLON.Vector3(-1, 0, 0); // Starting all from waterDrops.maxEmitBox = new BABYLON.Vector3(30, 150, 30); // To... waterDrops.color1 = new BABYLON.Color4(0, 0.75, 1.0, 0.9); waterDrops.color2 = new BABYLON.Color4(0, 0.43, 0.88, 1.0); waterDrops.colorDead = new BABYLON.Color4(0, 0, 0, 0.0); waterDrops.minSize = 2.3; waterDrops.maxSize = 6.5; waterDrops.minLifeTime = 0.9; waterDrops.maxLifeTime = 1.5; waterDrops.emitRate = 10500; waterDrops.blendMode = BABYLON.ParticleSystem.BLENDMODE_ONEONE; waterDrops.gravity = new BABYLON.Vector3(0, -35, 0); waterDrops.direction1 = new BABYLON.Vector3(-7, -8, 3); waterDrops.direction2 = new BABYLON.Vector3(7, -8, -3); waterDrops.minAngularSpeed = 0; waterDrops.maxAngularSpeed = Math.PI/4; waterDrops.minEmitPower = 1; waterDrops.maxEmitPower = 3; waterDrops.updateSpeed = 0.015; waterDrops.stop(); this.rainDrops = waterDrops; }; // Raindrop area mountain.elevateMountain.prototype.waterDrop = false; // used for rain drops // volcanic fireButton mountain.elevateMountain.prototype.volcano = false; // toggle fire // elevate area direction mountain.elevateMountain.prototype.elevateDirection = 1; // attach control for user mountain.elevateMountain.prototype.attachControl = function (canvas) { var currentPosition; // get current position var that = this; this.onBeforeRender = function () { if (!currentPosition) { return; } // get current position of mouse var pickInfo = that.ground.getScene().pick(currentPosition.x, currentPosition.y); if (!pickInfo.hit) return; if (pickInfo.pickedMesh != that.ground) return; that.picked = pickInfo.pickedPoint; // console.log("pickedMesh",that.picked); // add particle systems to rising mountain // that._particleSystem.emitter = pickInfo.pickedPoint.add(new BABYLON.Vector3(0, 3, 0)); // that._particleSystem.manualEmitCount += 400; // that._particleSystem.emitter = pickInfo.pickedPoint.add(new BABYLON.Vector3(0, 3, 0)); // that._particleSystem.manualEmitCount += 400; // start the raindrops if(that.waterDrop == true){ console.log("I am TRUE"); that.rainDrops.emitter = pickInfo.pickedPoint; that.rainDrops.start(); } // stop the raindrops if(that.waterDrop == false){ that.rainDrops.stop(); } if(that.volcano == true){ that.particles.emitter = pickInfo.pickedPoint; that.particles.start(); } if(that.volcano == false){ that.particles.stop(); } // elevate faces on user control that.elevateFaces(pickInfo, that.radius, 0.3); // that.particles.emitter = pickInfo.pickedPoint; }; // get current position from client this.onPointerDown = function (evt) { evt.preventDefault(); currentPosition = { x: evt.clientX, y: evt.clientY }; }; this.onPointerUp = function (evt) { evt.preventDefault(); currentPosition = null; }; this.onPointerMove = function (evt) { evt.preventDefault(); if (!currentPosition) { return; } that.invertDirection = evt.button == 2 ? -1 : 1; currentPosition = { x: evt.clientX, y: evt.clientY }; }; this.onLostFocus = function () { currentPosition = null; }; // add events to canvas. canvas.addEventListener("pointerdown", this.onPointerDown, true); canvas.addEventListener("pointerup", this.onPointerUp, true); canvas.addEventListener("pointerout", this.onPointerUp, true); canvas.addEventListener("pointermove", this.onPointerMove, true); window.addEventListener("blur", this.onLostFocus, true); this.ground.getScene().registerBeforeRender(this.onBeforeRender); }; // detach control when user clicks the camera button mountain.elevateMountain.prototype.detachControl = function (canvas) { canvas.removeEventListener("pointerdown", this.onPointerDown); canvas.removeEventListener("pointerup", this.onPointerUp); canvas.removeEventListener("pointerout", this.onPointerUp); canvas.removeEventListener("pointermove", this.onPointerMove); window.removeEventListener("blur", this.onLostFocus); this.rainDrops.stop(); this.ground.getScene().unregisterBeforeRender(this.onBeforeRender); }; // elevate mountain selections mountain.elevateMountain.prototype.dataElevation = function () { var scene = this.ground.getScene(); // get faces if (this.facesOfVertices == null) { this.facesOfVertices = []; // get vertices positions, Normals, and Indices this.groundVerticesPositions = this.ground.getVerticesData(BABYLON.VertexBuffer.PositionKind); this.groundVerticesNormals = this.ground.getVerticesData(BABYLON.VertexBuffer.NormalKind); this.groundIndices = this.ground.getIndices(); // store the current ground position in ground array this.groundPositions = []; var index; for (index = 0; index < this.groundVerticesPositions.length; index += 3) { this.groundPositions.push(new BABYLON.Vector3(this.groundVerticesPositions[index], this.groundVerticesPositions[index + 1], this.groundVerticesPositions[index + 2])); // $("#text").html(this.groundPositions +"<br/>"); } // get Face Normals this.groundFacesNormals = []; for (index = 0; index < this.ground.getTotalIndices() / 3; index++) { this.computeFaceNormal(index); } // get Face vertices this.getFacesOfVertices(); } }; // Get Face ID Index mountain.elevateMountain.prototype.getFaceVerticesIndex = function (faceID) { return { v1: this.groundIndices[faceID * 3], v2: this.groundIndices[faceID * 3 + 1], v3: this.groundIndices[faceID * 3 + 2] }; }; // Get Face Normal mountain.elevateMountain.prototype.computeFaceNormal = function (face) { var faceInfo = this.getFaceVerticesIndex(face); var v1v2 = this.groundPositions[faceInfo.v1].subtract(this.groundPositions[faceInfo.v2]); var v3v2 = this.groundPositions[faceInfo.v3].subtract(this.groundPositions[faceInfo.v2]); this.groundFacesNormals[face] = BABYLON.Vector3.Normalize(BABYLON.Vector3.Cross(v1v2, v3v2)); // console.log("ground Normals", this.groundFacesNormals[face]); }; // get the faces of vertices and push values into array mountain.elevateMountain.prototype.getFacesOfVertices = function () { this.facesOfVertices = []; this.subdivisionsOfVertices = []; var index; for (index = 0; index < this.groundPositions.length; index++) { this.facesOfVertices[index] = []; this.subdivisionsOfVertices[index] = []; } for (index = 0; index < this.groundIndices.length; index++) { this.facesOfVertices[this.groundIndices[index]].push((index / 3) | 0); } for (var subIndex = 0; subIndex < this.ground.subMeshes.length; subIndex++) { var subMesh = this.ground.subMeshes[subIndex]; for (index = subMesh.verticesStart; index < subMesh.verticesStart + subMesh.verticesCount; index++) { this.subdivisionsOfVertices[index].push(subMesh); } } return this.subdivisionsOfVertices[index]; }; // get Sphere radius mountain.elevateMountain.prototype.isBoxSphereIntersected = function(box, sphereCenter, sphereRadius) { var vector = BABYLON.Vector3.Clamp(sphereCenter, box.minimumWorld, box.maximumWorld); var num = BABYLON.Vector3.DistanceSquared(sphereCenter, vector); return (num <= (sphereRadius * sphereRadius)); }; // Elevate the mountain mountain.elevateMountain.prototype.elevateFaces = function (pickInfo, radius, height) { this.dataElevation(); this.selectedVertices = []; // Impact Area var sphereCenter = pickInfo.pickedPoint; sphereCenter.y = 0; var index; // Determine list of vertices for (var subIndex = 0; subIndex < this.ground.subMeshes.length; subIndex++) { var subMesh = this.ground.subMeshes[subIndex]; if (!this.isBoxSphereIntersected(subMesh.getBoundingInfo().boundingBox, sphereCenter, radius)) { continue; } for (index = subMesh.verticesStart; index < subMesh.verticesStart + subMesh.verticesCount; index++) { var position = this.groundPositions[index]; sphereCenter.y = position.y; var distance = BABYLON.Vector3.Distance(position, sphereCenter); if (distance < radius) { this.selectedVertices[index] = distance; } } } // Elevate vertices for (var selectedVertice in this.selectedVertices) { var position = this.groundPositions[selectedVertice]; var distance = this.selectedVertices[selectedVertice]; // console.log("position", position); var fullHeight = height * this.direction * this.invertDirection; if (distance < radius * 0.3) { position.y += fullHeight; } else { position.y += fullHeight * (1.0 - (distance - radius * 0.3) / (radius * 0.7)); } if (position.y > this.heightMax) position.y = this.heightMax; else if (position.y < this.heightMin) position.y = this.heightMin; this.groundVerticesPositions[selectedVertice * 3 + 1] = position.y; this.updateSubdivisions(selectedVertice); } // Normals this.reComputeNormals(); // Update vertex buffer this.ground.updateVerticesData(BABYLON.VertexBuffer.PositionKind, this.groundVerticesPositions); this.ground.updateVerticesData(BABYLON.VertexBuffer.NormalKind,this.groundVerticesNormals); }; mountain.elevateMountain.prototype.reComputeNormals = function () { var faces = []; var face; for (var selectedVertice in this.selectedVertices) { var faceOfVertices = this.facesOfVertices[selectedVertice]; for (var index = 0; index < faceOfVertices.length; index++) { faces[faceOfVertices[index]] = true; } } for (face in faces) { this.computeFaceNormal(face); } for (face in faces) { var faceInfo = this.getFaceVerticesIndex(face); this.computeNormal(faceInfo.v1); this.computeNormal(faceInfo.v2); this.computeNormal(faceInfo.v3); } }; mountain.elevateMountain.prototype.computeNormal = function(vertexIndex) { var faces = this.facesOfVertices[vertexIndex]; var normal = BABYLON.Vector3.Zero(); for (var index = 0; index < faces.length; index++) { normal = normal.add(this.groundFacesNormals[faces[index]]); } normal = BABYLON.Vector3.Normalize(normal.scale(1.0 / faces.length)); this.groundVerticesNormals[vertexIndex * 3] = normal.x; this.groundVerticesNormals[vertexIndex * 3 + 1] = normal.y; this.groundVerticesNormals[vertexIndex * 3 + 2] = normal.z; }; mountain.elevateMountain.prototype.updateSubdivisions = function (vertexIndex) { for (var index = 0; index < this.subdivisionsOfVertices[vertexIndex].length; index++) { var sub = this.subdivisionsOfVertices[vertexIndex][index]; var boundingBox = sub.getBoundingInfo().boundingBox; var boundingSphere = sub.getBoundingInfo().boundingSphere; if (this.groundPositions[vertexIndex].y < boundingBox.minimum.y) { boundingSphere.radius += Math.abs(this.groundPositions[vertexIndex].y - boundingBox.minimum.y); boundingBox.minimum.y = this.groundPositions[vertexIndex].y; } else if (this.groundPositions[vertexIndex].y > boundingBox.maximum.y) { boundingBox.maximum.y = this.groundPositions[vertexIndex].y; } } var boundingBox = this.ground.getBoundingInfo().boundingBox; var boundingSphere = this.ground.getBoundingInfo().boundingSphere; if (this.groundPositions[vertexIndex].y < boundingBox.minimum.y) { boundingSphere.Radius += Math.abs(this.groundPositions[vertexIndex].y - boundingBox.minimum.y); boundingBox.minimum.y = this.groundPositions[vertexIndex].y; } else if (this.groundPositions[vertexIndex].y > boundingBox.maximum.y) { boundingBox.maximum.y = this.groundPositions[vertexIndex].y; } }; <file_sep>var launch = function() { var canvas = document.querySelector("#renderCanvas"); var divFps = document.getElementById("fps"); var mode = "CAMERA"; if (!BABYLON.Engine.isSupported()) { document.getElementById("notSupported").className = ""; return; } // This creates and positions a free camera var engine = new BABYLON.Engine(canvas, true); var scene = new BABYLON.Scene(engine); var camera = new BABYLON.ArcRotateCamera("Camera", 10, 40, 40, new BABYLON.Vector3(250, 15, 800), scene); camera.lowerBetaLimit = 0.1; camera.upperBetaLimit = (Math.PI / 2) * 0.9; camera.lowerRadiusLimit = 50; camera.upperRadiusLimit = 300; camera.attachControl(canvas); var mode = "CAMERA"; // This creates a light, aiming 0,1,0 - to the sky. var light = new BABYLON.HemisphericLight("light1", new BABYLON.Vector3(0, 1, 0), scene); light.diffuse = new BABYLON.Color3(1, 1, 1); light.specular = new BABYLON.Color3(1, 1, 1); // Elevation var elevationControl = new WORLDMONGER.ElevationControl(ground); // Bloom var blurWidth = 2.0; // fog --- darker sky environment scene.fogMode = BABYLON.Scene.FOGMODE_EXP; scene.fogStart = 20.0; scene.fogEnd = 60.0; scene.fogDensity = 0.0004; scene.fogColor = new BABYLON.Color3(0, 0, 0); // Dim the light a small amount light.intensity = 1; // ground material var groundMaterial = new BABYLON.StandardMaterial("ground", scene); groundMaterial.diffuseTexture = new BABYLON.Texture("images/ground.jpg", scene); // wireframe material var wire = new BABYLON.StandardMaterial("wires", scene); wire.diffuseColor = new BABYLON.Color3(0, 0, 0); wire.wireframe = true; // silk material var silk = new BABYLON.StandardMaterial("silk1", scene); silk.diffuseTexture = new BABYLON.Texture("images/silk.jpg", scene); // laser material var laser = new BABYLON.StandardMaterial("laser", scene); laser.diffuseTexture = new BABYLON.Texture("images/smoke.jpg", scene); // brick material var brick = new BABYLON.StandardMaterial("laser", scene); brick.diffuseTexture = new BABYLON.Texture("images/brick.jpg", scene); // world material var world = new BABYLON.StandardMaterial("worldMap", scene); world.diffuseTexture = new BABYLON.Texture("images/14-1-test.png", scene); // console.log("world texture", world.diffuseTexture); // mountain material var mountain = new BABYLON.StandardMaterial("mountain", scene); mountain.diffuseTexture = new BABYLON.Texture("images/mountain.jpg", scene); // water material var waterMaterial = new BABYLON.StandardMaterial("waterMaterial", scene); // waterMaterial.diffuseTexture = new BABYLON.Texture("images/water.jpg", scene); waterMaterial.diffuseColor = new BABYLON.Color3(0, 0.4, 0.8); // Heightmap ground var ground = BABYLON.Mesh.CreateGroundFromHeightMap("ground", "images/worldHeightMap.jpg", 1400, 1400, 300, 0, 100, scene, true); ground.position = new BABYLON.Vector3(600, 0, 710); // function Ribbon var createRibbon = function(mesh, pathArray, close, offset, scene) { var positions = []; var indices = []; var normals = []; var lg = []; // array of path lengths : nb of vertex per path var idx = []; // array of path indexes : index of each path (first vertex) in positions array // positions var idc = 0; for(var p = 0; p < pathArray.length; p++) { var path = pathArray[p]; var l = path.length; lg[p] = l; idx[p] = idc; var j = 0; while (j < l) { positions.push(path[j].x, path[j].y, path[j].z); j++; } idc += l; } // indices var p = 0; // path index var i = 0; // positions array index var l1 = lg[p] - 1; // path1 length var l2 = lg[p+1] - 1; // path2 length var min = ( l1 < l2 ) ? l1 : l2 ; while ( i <= min && p < lg.length -1 ) { var shft = idx[p+1] - idx[p]; // draw two triangles between path1 (p1) and path2 (p2) : (p1.i, p2.i, p1.i+1) and (p2.i+1, p1.i+1, p2.i) clockwise indices.push(i, i+shft, i+1); indices.push(i+shft+1, i+1, i+shft); i += 1; if ( i == min ) { if (close) { indices.push(i, i+shft, idx[p]); indices.push(idx[p]+shft, idx[p], i+shft); } p++; l1 = lg[p] - 1; l2 = lg[p+1] - 1; i = idx[p]; min = ( l1 < l2 ) ? l1 + i : l2 + i; } } BABYLON.VertexData.ComputeNormals(positions, indices, normals); g.setVerticesData(BABYLON.VertexBuffer.PositionKind, positions, false); mesh.setVerticesData(BABYLON.VertexBuffer.NormalKind, normals, false); mesh.setIndices(indices); }; // groundPlane.material = mountain; // ground lines // var groundLines = BABYLON.Mesh.CreateGroundFromHeightMap("groundLines", "images/worldHeightMap.jpg", 1400, 1400, 300, 0, 100, scene, true); // groundLines.position = new BABYLON.Vector3(600, 0.11, 710); // groundLines.material = wire; // groundLines.isPickable = false; // ground mesh // var groundPlane = BABYLON.Mesh.CreateGround("ground1", 1400, 1400, 2, scene); // water var waterArea = BABYLON.Mesh.CreateCylinder("waterArea", 100, 100, 100, 6, 1, scene); waterArea.position = new BABYLON.Vector3(175, -45, 700); waterArea.material = waterMaterial; // volcanic fire area for (a = 0; a < 25; a++) { var theBox2 = BABYLON.Mesh.CreateBox("theBox2" + a, 20.0, scene, true, BABYLON.Mesh.DEFAULTSIDE); var randomNumber1 = Math.floor((Math.random() * 790) + 20); var randomNumber2 = Math.floor((Math.random() * 790) + 20); theBox2.position = new BABYLON.Vector3(randomNumber1, -9, randomNumber2); theBox2.material = mountain; // Fire Particle System // Create a particle system var particleSystem = new BABYLON.ParticleSystem("particles", 2000, scene); //Texture of each particle particleSystem.particleTexture = new BABYLON.Texture("textures/Flare.png", scene); // Where the particles come from // particleSystem.emitter = fountain; // the starting object, the emitter particleSystem.emitter = theBox2; particleSystem.minEmitBox = new BABYLON.Vector3(-1, 0, 0); // Starting all from particleSystem.maxEmitBox = new BABYLON.Vector3(1, 0, 0); // To... // Colors of all particles particleSystem.color1 = new BABYLON.Color4(0.8, 0.1, 0, 1.0); particleSystem.color2 = new BABYLON.Color4(1, 0, 0, 1.0); particleSystem.colorDead = new BABYLON.Color4(0, 0, 0, 0.0); // Size of each particle (random between... particleSystem.minSize = 5; particleSystem.maxSize = 10; // Life time of each particle (random between... particleSystem.minLifeTime = 0.3; particleSystem.maxLifeTime = 1.5; // Emission rate particleSystem.emitRate = 2500; // Blend mode : BLENDMODE_ONEONE, or BLENDMODE_STANDARD particleSystem.blendMode = BABYLON.ParticleSystem.BLENDMODE_ONEONE; // Set the gravity of all particles particleSystem.gravity = new BABYLON.Vector3(0, 35, 0); // Direction of each particle after it has been emitted particleSystem.direction1 = new BABYLON.Vector3(-7, 8, 3); particleSystem.direction2 = new BABYLON.Vector3(7, 8, -3); // Angular speed, in radians particleSystem.minAngularSpeed = 0; particleSystem.maxAngularSpeed = Math.PI; // Speed particleSystem.minEmitPower = 1; particleSystem.maxEmitPower = 3; particleSystem.updateSpeed = 0.005; // Start the particle system particleSystem.start(); } // add box for rain experiment var rainBox = BABYLON.Mesh.CreateTorus("torus", 5, 7, 9, scene, false, BABYLON.Mesh.DEFAULTSIDE); rainBox.position = new BABYLON.Vector3(175, -2, 700); rainBox.material = mountain; var rainSystem = new BABYLON.ParticleSystem("particles", 2000, scene); //Texture of each particle rainSystem.particleTexture = new BABYLON.Texture("textures/glow.png", scene); // Where the particles come from // particleSystem.emitter = fountain; // the starting object, the emitter rainSystem.emitter = rainBox; // rainSystem.emitter = waterArea; rainSystem.minEmitBox = new BABYLON.Vector3(-1, 0, 0); // Starting all from rainSystem.maxEmitBox = new BABYLON.Vector3(1, 0, 0); // To... // Colors of all particles rainSystem.color1 = new BABYLON.Color4(0.2, 0.4, 1, 1.0); rainSystem.color2 = new BABYLON.Color4(0.2, 0.1, 0.7, 1.0); rainSystem.colorDead = new BABYLON.Color4(0, 0, 0, 0.0); // Size of each particle (random between... rainSystem.minSize = 3; rainSystem.maxSize = 8; // Life time of each particle (random between... rainSystem.minLifeTime = 1.5; rainSystem.maxLifeTime = 9.5; // Emission rate rainSystem.emitRate = 5000; // Blend mode : BLENDMODE_ONEONE, or BLENDMODE_STANDARD rainSystem.blendMode = BABYLON.ParticleSystem.BLENDMODE_ONEONE; // Set the gravity of all particles rainSystem.gravity = new BABYLON.Vector3(0, -70, 0); // Direction of each particle after it has been emitted rainSystem.direction1 = new BABYLON.Vector3(-7, 8, 3); rainSystem.direction2 = new BABYLON.Vector3(7, 8, -3); // Angular speed, in radians rainSystem.minAngularSpeed = 0; rainSystem.maxAngularSpeed = Math.PI; // Speed rainSystem.minEmitPower = 4; rainSystem.maxEmitPower = 6; rainSystem.updateSpeed = 0.008; // Start the particle system rainSystem.start(); // Skybox --- sky images var skybox = BABYLON.Mesh.CreateBox("skyBox", 4000.0, scene); // skybox.infiniteDistance = true; var skyboxMaterial = new BABYLON.StandardMaterial("skyBox", scene); skyboxMaterial.backFaceCulling = false; skyboxMaterial.reflectionTexture = new BABYLON.CubeTexture("textures/TropicalSunnyDay", scene); skyboxMaterial.reflectionTexture.coordinatesMode = BABYLON.Texture.SKYBOX_MODE; skyboxMaterial.diffuseColor = new BABYLON.Color3(0, 0, 0); skyboxMaterial.specularColor = new BABYLON.Color3(0, 0, 0); skyboxMaterial.disableLighting = true; skybox.material = skyboxMaterial; // disable picking of object skybox.isPickable = false; // Render loop var renderFunction = function () { if (ground.isReady && ground.subMeshes.length == 1) { ground.subdivide(20); // Subdivide to optimize picking } // Camera if (camera.beta < 0.1) camera.beta = 0.1; else if (camera.beta > (Math.PI / 2) * 0.92) camera.beta = (Math.PI / 2) * 0.92; if (camera.radius > 70) camera.radius = 70; if (camera.radius < 5) camera.radius = 5; // Fps divFps.innerHTML = engine.getFps().toFixed() + " fps"; // Render scene scene.render(); // Animations skybox.rotation.y += 0.0001 * scene.getAnimationRatio(); }; // Launch render loop scene.executeWhenReady(function() { engine.runRenderLoop(renderFunction); }); // Resize window.addEventListener("resize", function () { engine.resize(); }); // UI var cameraButton = document.getElementById("cameraButton"); var elevationButton = document.getElementById("elevationButton"); var digButton = document.getElementById("digButton"); // var help01 = document.getElementById("help01"); // var help02 = document.getElementById("help02"); window.oncontextmenu = function () { return false; }; cameraButton.addEventListener("pointerdown", function () { if (mode == "CAMERA") return; camera.attachControl(canvas); elevationControl.detachControl(canvas); mode = "CAMERA"; cameraButton.className = "controlButton selected"; digButton.className = "controlButton"; elevationButton.className = "controlButton"; }); elevationButton.addEventListener("pointerdown", function () { //help01.className = "help"; // help02.className = "help"; if (mode == "ELEVATION") return; if (mode == "CAMERA") { camera.detachControl(canvas); elevationControl.attachControl(canvas); } mode = "ELEVATION"; elevationControl.direction = 1; elevationButton.className = "controlButton selected"; digButton.className = "controlButton"; cameraButton.className = "controlButton"; }); digButton.addEventListener("pointerdown", function () { // help01.className = "help"; // help02.className = "help"; if (mode == "DIG") return; if (mode == "CAMERA") { camera.detachControl(canvas); elevationControl.attachControl(canvas); } mode = "DIG"; elevationControl.direction = -1; digButton.className = "controlButton selected"; elevationButton.className = "controlButton"; cameraButton.className = "controlButton"; }); // Sliders /* $("#slider-vertical").slider({ orientation: "vertical", range: "min", min: 2, max: 15, value: 5, slide: function (event, ui) { elevationControl.radius = ui.value; } }); $("#slider-range").slider({ orientation: "vertical", range: true, min: 0, max: 12, values: [0, 11], slide: function (event, ui) { elevationControl.heightMin = ui.values[0]; elevationControl.heightMax = ui.values[1]; } }); $("#qualitySlider").slider({ orientation: "vertical", range: "min", min: 0, max: 3, value: 3, slide: function (event, ui) { switch (ui.value) { case 3: waterMaterial.refractionTexture.resize(512, true); waterMaterial.reflectionTexture.resize(512, true); scene.getEngine().setHardwareScalingLevel(1); scene.particlesEnabled = true; scene.postProcessesEnabled = true; break; case 2: waterMaterial.refractionTexture.resize(256, true); waterMaterial.reflectionTexture.resize(256, true); scene.getEngine().setHardwareScalingLevel(1); scene.particlesEnabled = false; scene.postProcessesEnabled = false; break; case 1: waterMaterial.refractionTexture.resize(256, true); waterMaterial.reflectionTexture.resize(256, true); scene.getEngine().setHardwareScalingLevel(2); scene.particlesEnabled = false; scene.postProcessesEnabled = false; break; case 0: waterMaterial.refractionTexture.resize(256, true); waterMaterial.reflectionTexture.resize(256, true); scene.getEngine().setHardwareScalingLevel(3); scene.particlesEnabled = false; scene.postProcessesEnabled = false; break; } } });*/ } <file_sep>// modified js -- from http://babylonjs.com/Scenes/Worldmonger/index.html // var mountain = mountain || {}; // get the default values var elevateMountain = function(ground){ var ground = ground; // mountain plane var radius = 15.0; // selection radius var invertDirection = 1.0; // direction for inversion var heightMin = -20.0; // height min var heightMax = 60.0; // max heigh of moutain }; // elevate area direction var elevateDirection = 1; // attach control for user var attachControl = function (canvas) { var currentPosition; // get current position // var that = this; }; var onBeforeRender = function () { if (!currentPosition) { return; } // get current position of mouse var pickInfo = that.ground.getScene().pick(currentPosition.x, currentPosition.y); if (!pickInfo.hit) return; if (pickInfo.pickedMesh != that.ground) return; onPointerDown(evt); onPointerUp(); onPointerMove(evt); onLostFocus(); // elevate faces on user control elevateFaces(pickInfo, that.radius, 0.3); }; // get current position from client var onPointerDown = function (evt) { evt.preventDefault(); currentPosition = { x: evt.clientX, y: evt.clientY }; }; var onPointerUp = function (evt) { evt.preventDefault(); currentPosition = null; }; var onPointerMove = function (evt) { evt.preventDefault(); if (!currentPosition) { return; } that.invertDirection = evt.button == 2 ? -1 : 1; currentPosition = { x: evt.clientX, y: evt.clientY }; }; var onLostFocus = function () { currentPosition = null; }; // add events to canvas. canvas.addEventListener("pointerdown", onPointerDown(), true); canvas.addEventListener("pointerup", onPointerUp(evt), true); canvas.addEventListener("pointerout", onPointerUp(), true); canvas.addEventListener("pointermove", onPointerMove(evt), true); window.addEventListener("blur", onLostFocus(), true); registerBeforeRender(onBeforeRender()); // detach control when user clicks the camera button var detachControl = function (canvas) { canvas.removeEventListener("pointerdown", onPointerDown()); canvas.removeEventListener("pointerup", onPointerUp(evt)); canvas.removeEventListener("pointerout", onPointerUp(evt)); canvas.removeEventListener("pointermove", onPointerMove(evt)); window.removeEventListener("blur", onLostFocus()); ground.getScene().unregisterBeforeRender(onBeforeRender()); }; // elevate mountain selections var dataElevation = function () { // get faces if (facesOfVertices == null) { facesOfVertices = []; // get vertices positions, Normals, and Indices var groundVerticesPositions = ground.getVerticesData(BABYLON.VertexBuffer.PositionKind); var groundVerticesNormals = ground.getVerticesData(BABYLON.VertexBuffer.NormalKind); var groundIndices = ground.getIndices(); // store the current ground positions in ground array var groundPositions = []; var index; for (index = 0; index < groundVerticesPositions.length; index += 3) { groundPositions.push(new BABYLON.Vector3(groundVerticesPositions[index], groundVerticesPositions[index + 1], groundVerticesPositions[index + 2])); } // get Face Normals groundFacesNormals = []; for (index = 0; index < ground.getTotalIndices() / 3; index++) { computeFaceNormal(index); } // get Face vertices getFacesOfVertices(); } }; // Get Face ID Index var getFaceVerticesIndex = function (faceID) { return { v1: groundIndices[faceID * 3], v2: groundIndices[faceID * 3 + 1], v3: groundIndices[faceID * 3 + 2] }; }; // Get Face Normal var computeFaceNormal = function (face) { var faceInfo = getFaceVerticesIndex(face); var v1v2 = groundPositions[faceInfo.v1].subtract(groundPositions[faceInfo.v2]); var v3v2 = groundPositions[faceInfo.v3].subtract(groundPositions[faceInfo.v2]); var groundFacesNormals[face] = BABYLON.Vector3.Normalize(BABYLON.Vector3.Cross(v1v2, v3v2)); }; // get the faces of vertices and push values into array mountain.elevateMoutain.prototype.getFacesOfVertices = function () { facesOfVertices = []; subdivisionsOfVertices = []; var index; for (index = 0; index < groundPositions.length; index++) { facesOfVertices[index] = []; subdivisionsOfVertices[index] = []; } for (index = 0; index < groundIndices.length; index++) { facesOfVertices[groundIndices[index]].push((index / 3) | 0); } for (var subIndex = 0; subIndex < ground.subMeshes.length; subIndex++) { var subMesh = ground.subMeshes[subIndex]; for (index = subMesh.verticesStart; index < subMesh.verticesStart + subMesh.verticesCount; index++) { subdivisionsOfVertices[index].push(subMesh); } } }; // get Sphere radius var isBoxSphereIntersected = function(box, sphereCenter, sphereRadius) { var vector = BABYLON.Vector3.Clamp(sphereCenter, box.minimumWorld, box.maximumWorld); var num = BABYLON.Vector3.DistanceSquared(sphereCenter, vector); return (num <= (sphereRadius * sphereRadius)); }; // Elevate the mountain var elevateFaces = function (pickInfo, radius, height) { dataElevation(); selectedVertices = []; // Impact Area var sphereCenter = pickInfo.pickedPoint; sphereCenter.y = 0; var index; // Determine list of vertices for (var subIndex = 0; subIndex < ground.subMeshes.length; subIndex++) { var subMesh = ground.subMeshes[subIndex]; if (!isBoxSphereIntersected(subMesh.getBoundingInfo().boundingBox, sphereCenter, radius)) { continue; } for (index = subMesh.verticesStart; index < subMesh.verticesStart + subMesh.verticesCount; index++) { var position = groundPositions[index]; sphereCenter.y = position.y; var distance = BABYLON.Vector3.Distance(position, sphereCenter); if (distance < radius) { selectedVertices[index] = distance; } } } // Elevate vertices for (var selectedVertice in selectedVertices) { var position = groundPositions[selectedVertice]; var distance = selectedVertices[selectedVertice]; var fullHeight = height * direction * invertDirection; if (distance < radius * 0.3) { position.y += fullHeight; } else { position.y += fullHeight * (1.0 - (distance - radius * 0.3) / (radius * 0.7)); } if (position.y > heightMax) position.y = heightMax; else if (position.y < heightMin) position.y = heightMin; groundVerticesPositions[selectedVertice * 3 + 1] = position.y; updateSubdivisions(selectedVertice); } // Normals reComputeNormals(); // Update vertex buffer ground.updateVerticesData(BABYLON.VertexBuffer.PositionKind, groundVerticesPositions); ground.updateVerticesData(BABYLON.VertexBuffer.NormalKind,groundVerticesNormals); }; var reComputeNormals = function () { var faces = []; var face; for (var selectedVertice in selectedVertices) { var faceOfVertices = facesOfVertices[selectedVertice]; for (var index = 0; index < faceOfVertices.length; index++) { faces[faceOfVertices[index]] = true; } } for (face in faces) { computeFaceNormal(face); } for (face in faces) { var faceInfo = getFaceVerticesIndex(face); computeNormal(faceInfo.v1); computeNormal(faceInfo.v2); computeNormal(faceInfo.v3); } }; var computeNormal = function(vertexIndex) { var faces = facesOfVertices[vertexIndex]; var normal = BABYLON.Vector3.Zero(); for (var index = 0; index < faces.length; index++) { normal = normal.add(groundFacesNormals[faces[index]]); } normal = BABYLON.Vector3.Normalize(normal.scale(1.0 / faces.length)); groundVerticesNormals[vertexIndex * 3] = normal.x; groundVerticesNormals[vertexIndex * 3 + 1] = normal.y; groundVerticesNormals[vertexIndex * 3 + 2] = normal.z; }; var updateSubdivisions = function (vertexIndex) { for (var index = 0; index < subdivisionsOfVertices[vertexIndex].length; index++) { var sub = subdivisionsOfVertices[vertexIndex][index]; var boundingBox = sub.getBoundingInfo().boundingBox; var boundingSphere = sub.getBoundingInfo().boundingSphere; if (groundPositions[vertexIndex].y < boundingBox.minimum.y) { boundingSphere.radius += Math.abs(groundPositions[vertexIndex].y - boundingBox.minimum.y); boundingBox.minimum.y = groundPositions[vertexIndex].y; } else if (groundPositions[vertexIndex].y > boundingBox.maximum.y) { boundingBox.maximum.y = groundPositions[vertexIndex].y; } } var boundingBox = ground.getBoundingInfo().boundingBox; var boundingSphere = ground.getBoundingInfo().boundingSphere; if (groundPositions[vertexIndex].y < boundingBox.minimum.y) { boundingSphere.Radius += Math.abs(groundPositions[vertexIndex].y - boundingBox.minimum.y); boundingBox.minimum.y = groundPositions[vertexIndex].y; } else if (groundPositions[vertexIndex].y > boundingBox.maximum.y) { boundingBox.maximum.y = groundPositions[vertexIndex].y; } };
cfc986d60d5bb65e807070e54271b47ae9d48a24
[ "JavaScript" ]
3
JavaScript
lacrimosia/3D_Topo_Map
9ce3af78f068d7df548a0afa1faea784c8b95fde
b06223e237d3f3b8b4b7002630617d73a9896a0c
refs/heads/master
<repo_name>architgarg/DVMRP<file_sep>/src/dvmrp/Router.java package acn_dvmrp; import java.io.BufferedReader; import java.io.BufferedWriter; import java.io.FileReader; import java.io.FileWriter; import java.io.IOException; import java.util.ArrayList; import java.util.Timer; import java.util.TimerTask; public class Router { public Router(int rid,ArrayList<Integer> lids) // rid- RouterId , lids - LanIDS { new Route(rid,lids); } } class Route { int rid,i; ArrayList<Table> table;// RTable , RoutingTable ArrayList<Lans> lans; // Clans connectedLans Timer timer;//counter ArrayList<Sources> sources; //Senders senders String line;//string1 public Route(int rid,ArrayList<Integer> lids) { this.rid=rid; i=0; lans=new Lans[lids.length]; table=new Table[10]; for(int i=0;i<10;i++) { table[i]=new Table(10,10,10,new ArrayList<Childs>(),false,0); table.get(i).re=false;// re- Receiver table.get(i).re_time=0;// re_time - ReceiverTime } for(int i=0;i<lids.length;i++) { table.get(lids.get(i)).hops=0; // hops=dist table.get(lids.get(i)).next_lan=lids.get(i); // NHopLan lans.get(i)=new Lans(lids.get(i),0,true); } sources=new ArrayList<Sources>(); timer = new Timer(); timer.schedule(new Operate(),0); } class Operate extends TimerTask { public void run() { /*dv message sending*/ String temp=null; if(i%5==0) { temp=String.valueOf(rid); for(int i=0;i<table.length;i++) { if(table[i].next_router==10) // NHopRouter temp=temp.concat(" "+table[i].hops+" -"); else temp=temp.concat(" "+table[i].hops+" "+table[i].next_router); } String dv=null; //DistVect for(int i=0;i<lans.length;i++) { try { dv="DV "+lans[i].value+" "+temp;// DistVect BufferedWriter writer= new BufferedWriter(new FileWriter("rout"+rid,true)); writer.write(dv); writer.write("\n"); writer.close(); } catch(IOException e){System.out.println("execption occurred for DV");} } } /*dv message sending*/ /*receiver message accepting in regular interval*/ for(int i=0;i<lans.length;i++) { if(table[lans[i].value].re==true) table[lans[i].value].re_time++; if(table[lans[i].value].re_time==20) { table[lans[i].value].re=false; table[lans[i].value].re_time=0; } } /*receiver message accepting at regular interval*/ /*nmr message sending at regular interval*/ for(int i=0;i<sources.size();i++) { sources.get(i).nmr_total=true;//NonMemRepTime for(int j=0;j<table[sources.get(i).value].childs.size();j++) // childs- descendants { if(table[sources.get(i).value].childs.get(j).nmr_status==false) // nmr_status - MemberStatus { sources.get(i).nmr_total=false; } if(table[sources.get(i).value].childs.get(j).nmr_status==true) { table[sources.get(i).value].childs.get(j).nmr_time++; if(table[sources.get(i).value].childs.get(j).nmr_time==20) { table[sources.get(i).value].childs.get(j).nmr_time=0; table[sources.get(i).value].childs.get(j).nmr_status=false;//this will turn nmr off if no nmr received with 10 sec for that child of specific child } } else{table[sources.get(i).value].childs.get(j).nmr_time=0;} } if(sources.get(i).nmr_total==true) { sources.get(i).nmr_total_time++; // nmr_total_time = MyStatusTime if(sources.get(i).nmr_total_time==10) { try { BufferedWriter writer= new BufferedWriter(new FileWriter("rout"+rid,true)); writer.write("NMR "+table[sources.get(i).value].next_lan+" "+rid+" "+sources.get(i).value); writer.write("\n"); writer.close(); sources.get(i).nmr_total_time=0; } catch(IOException e){System.out.println("execption occurred for SOURCES NMR");} } } else{sources.get(i).nmr_total_time=0;} } /*nmr message sending at regular interval*/ /*accepting messages from other routers*/ int lan,host_lan,router_id; //HLan, Rid for(int i=0;i<lans.length;i++) { try { BufferedReader ReadFile = new BufferedReader(new FileReader("lan"+lans[i].value)); int new1=0; while((line= ReadFile.readLine()) != null) { ++new1; if(new1 > lans[i].old) { String[] token=line.split(" "); switch(token[0]) { case "data": lan=Integer.parseInt(token[1]); host_lan=Integer.parseInt(token[2]); //to check if source is present already if(lan==table[host_lan].next_lan) { boolean contains=false; for(int j=0;j<sources.size();j++) { if(sources.get(j).value==host_lan) { contains=true; break; } } if(sources.isEmpty() || contains==false) sources.add(new Sources(host_lan,true,0)); for(int j=0;j<table[host_lan].childs.size();j++) { //System.out.println(table[host_lan].childs.get(j).value); if(table[host_lan].childs.get(j).nmr_status==false || (table[host_lan].childs.get(j).nmr_status==true && table[table[host_lan].childs.get(j).value].re==true)) { try { BufferedWriter WriteFile = new BufferedWriter(new FileWriter("rout"+rid,true)); WriteFile.write(token[0]+" "+table[host_lan].childs.get(j).value+" "+token[2]); WriteFile.write("\n"); WriteFile.close(); System.out.println("data forwarded from rid: "+rid+" to lan: "+table[host_lan].childs.get(j).value); } catch(IOException e){System.out.println("execption occurred for DATA FORWARDING");} } } } break; case "NMR": lan=Integer.parseInt(token[1]); host_lan=Integer.parseInt(token[3]); for(int j=0;j<table[host_lan].childs.size();j++) { if(table[host_lan].childs.get(j).value==lan) { table[host_lan].childs.get(j).nmr_status=true; table[host_lan].childs.get(j).nmr_time=0; System.out.println("NMR of lan: "+table[host_lan].childs.get(j).value+" for rid: "+rid); break; } } break; case "receiver": lan=Integer.parseInt(token[1]); table[lan].re=true; table[lan].re_time=0; break; case "DV": lan=Integer.parseInt(token[1]); router_id=Integer.parseInt(token[2]); if(router_id!=rid) { //leaf bitmap for(int k=0;k<lans.length;k++) { if(lans[k].value==lan) { lans[k].leaf=false; break; } } //leaf bitmap for(int x=3,y=3;x<=21;x+=2,y++) // x=a , y=b { //distance vector computation int dist=Integer.parseInt(token[x]); // dist=dist1 int rou=100; if(!token[x+1].equals("-")) rou=Integer.parseInt(token[x+1]); //see who gives less distance if((dist+1)<table[x-y].hops || ((dist+1)==table[x-y].hops && table[x-y].next_router>router_id)) { table[x-y].hops=(dist+1); table[x-y].next_lan=Integer.parseInt(token[1]); table[x-y].next_router=Integer.parseInt(token[2]); } //dv message computation //if i am the next hop router add child "if not present already"!! if(rou==rid && table[x-y].next_lan!=lan ) { boolean isChildPresent=false; for(int j=0;j<table[x-y].childs.size();j++) { if(table[x-y].childs.get(j).value==lan) { isChildPresent=true; break; } } if(table[x-y].childs.isEmpty() ||isChildPresent==false) table[x-y].childs.add(new Childs(lan,false,0)); } //fight between two router for a receiver as a child if(lan!=table[x-y].next_lan && table[lan].re==true) { if(dist>table[x-y].hops ||(dist==table[x-y].hops && router_id>rid)) { boolean isChildPresent1=false; for(int j=0;j<table[x-y].childs.size();j++) { if(table[x-y].childs.get(j).value==lan) { isChildPresent1=true; break; } } if(table[x-y].childs.isEmpty() ||isChildPresent1==false) table[x-y].childs.add(new Childs(lan,false,0)); } } } } break; } } } lans[i].old = new1; ReadFile.close(); } catch(IOException e){}//System.out.println("file reading exception");} } /*accepting messages from other routers*/ /*checking leafs and then adding receivers */ for(int i=0;i<lans.length;i++) { if(lans[i].leaf==true) { int leaf_lan=lans[i].value; if(table[leaf_lan].re==true) { for(int j=0;j<sources.size();j++) { boolean isChildPresent1=false; for(int k=0;k<table[sources.get(j).value].childs.size();k++) { if(table[sources.get(j).value].childs.get(k).value==leaf_lan) { isChildPresent1=true; break; } } if(table[sources.get(j).value].childs.isEmpty() ||isChildPresent1==false) table[sources.get(j).value].childs.add(new Childs(leaf_lan,false,0)); } } } } /*checking leafs */ i++; if(i<100)l timer.schedule(new Operate(),1000); else timer.cancel(); } } } class Lans // CLans { int value,old; // Val , marker boolean leaf; // LeafLan public Lans(int value,int old,boolean leaf) { this.value=value; this.old=old; this.leaf=leaf; } } class Childs // Descendant { int value,nmr_time; // value- val , NonMemRepTime boolean nmr_status; // MemberStatus public Childs(int value,boolean nmr_status,int nmr_time) { this.value=value; this.nmr_status=nmr_status; this.nmr_time=nmr_time; } } class Table // RoutingTable { int hops,next_lan,next_router,re_time; // dist , NHopLan , NHopRouter , ReceiverTime ArrayList<Childs> childs; // Descendant descendants boolean re; // receiver public Table(int hops,int next_lan,int next_router,ArrayList<Childs> childs,boolean re,int re_time) { this.hops=hops; this.next_lan=next_lan; this.next_router=next_router; this.childs=childs; this.re=re; this.re_time=re_time; } } class Sources { boolean nmr_total; // NonMemRepTime int nmr_total_time,value; //MyStatusTime, val public Sources(int value,boolean nmr_total,int nmr_total_time) { this.nmr_total=nmr_total; this.value=value; this.nmr_total_time=nmr_total_time; } } //initilize childs with nmr =false; //dont read if sent by you only...diffreentiate using router_id //add one more field to router ...receiver parent <file_sep>/src/dvmrp/CLans.java package dvmrp; class CLans { int LanId,Marker; boolean LeafLan; public CLans(boolean LeafLan,int LanId,int Marker) { this.LeafLan=LeafLan; this.LanId=LanId; this.Marker=Marker; } } <file_sep>/src/dvmrp/Controller.java package acn_dvmrp; import java.io.BufferedReader; import java.io.BufferedWriter; import java.io.FileReader; import java.io.FileWriter; import java.io.IOException; import java.util.ArrayList; import java.util.Timer; import java.util.TimerTask; public class Controller//cntlr { Timer timer;//counter ArrayList<Host1> host;//sender H ArrayList<Router1> router;// R int i; String line;//string1 public Controller(ArrayList<Integer> host, ArrayList<Integer> router,ArrayList<Integer> lan)// H R L { this.host=new Host1[host.length]; for(int i=0;i<host.length;i++) this.host[i]=new Host1(host[i],0); this.router=new Router1[router.length]; for(int i=0;i<router.length;i++) this.router[i]=new Router1(router[i],0); timer = new Timer(); timer.schedule(new Operate(),0);// operate - handle } class Operate extends TimerTask { public void run() { try { for(int i=0;i<router.size();i++) { BufferedReader ReadFile = new BufferedReader(new FileReader("rout"+router.get(i).value));// value - LanId int new1=0;//n1 while((line = ReadFile.readLine()) != null) { ++new1; if(new1 > router.get(i).old)// old- marker { String[] token=line.split(" "); BufferedWriter WriteFile = new BufferedWriter(new FileWriter("lan"+token[1],true)); WriteFile.write(line); WriteFile.write("\n"); WriteFile.close(); } } ReadFile.close(); router.get(i).old = new1; } for(int i=0;i<host.size();i++) { BufferedReader ReadFile = new BufferedReader(new FileReader("hout"+host.get(i).value)); int new1=0; while((line = ReadFile.readLine()) != null) { ++new1; if(new1 > host.get(i).old) { String[] token=line.split(" "); BufferedWriter WriteFile = new BufferedWriter(new FileWriter("lan"+token[1],true)); WriteFile.write(line); WriteFile.write("\n"); WriteFile.close(); } } ReadFile.close(); host.get(i).old = new1; } } catch (IOException e) {} i++; if(i<100) timer.schedule(new Operate(),1000); else timer.cancel(); } } } class Host1 { int value,old; public Host1(int value,int old) { this.old=old; this.value=value; } } class Router1 { int value,old; public Router1(int value,int old) { this.old=old; this.value=value; } } <file_sep>/src/dvmrp/AA.java package dvmrp; import java.util.ArrayList; public class AA { public static void main(String[] args) { Host h=new Host(); h.Sender(0, 0, 20, 10); ArrayList<Integer> a=new ArrayList<Integer>(); a.add(1); a.add(2); new Router(a,1); ArrayList<Integer> b=new ArrayList<Integer>(); b.add(0); b.add(1); new Router(b,0); //// ArrayList<Integer> hh=new ArrayList<Integer>(); hh.add(0); hh.add(1); ArrayList<Integer> rr=new ArrayList<Integer>(); rr.add(0); rr.add(1); ArrayList<Integer> ll=new ArrayList<Integer>(); ll.add(0); ll.add(1); ll.add(2); new Controller(rr,hh,ll); try { Thread.sleep(50*1000); } catch (InterruptedException e) { // TODO Auto-generated catch block e.printStackTrace(); } h.Receiver(1, 2); } } <file_sep>/src/dvmrp/Host.java package acn_dvmrp; import java.io.BufferedReader; import java.io.BufferedWriter; import java.io.FileReader; import java.io.FileWriter; import java.io.IOException; import java.util.Timer; import java.util.TimerTask; public class Host { void Sender(int hid,int lid,int tts,int gap) // HostId , LanId , TimeToStart , period { new Sender("hout"+hid, "data "+lid+" "+lid,tts,gap); } void Receiver(int hid,int lid) { new Receiver("hout"+hid,"hin"+hid,"lan"+lid,"receiver "+lid); } } class Sender { Timer timer;// counter String outfile,data;//OutputFile int tts,gap; int i; public Sender(String outfile,String data,int tts,int gap) //OutputFile { this.outfile=outfile; this.data=data; this.tts=tts; this.gap=gap; i=tts; timer=new Timer(); timer.schedule(new Operate(), tts*1000); } class Operate extends TimerTask { public void run() { try { BufferedWriter writer= new BufferedWriter(new FileWriter(outfile,true)); writer.write(data); writer.write("\n"); writer.close(); } catch(IOException e){} i+=gap; if(i<=100) timer.schedule(new Operate(),gap*1000); else timer.cancel(); } } } class Receiver { Timer timer; String outfile,infile,readfrom,advertise,line;// InputFile , FileRead1 , adv ,string1 int i,old; //marker public Receiver(String outfile,String infile,String readfrom,String advertise) { this.outfile=outfile; this.infile=infile; this.readfrom=readfrom; this.advertise=advertise; timer=new Timer(); i=0;old=0; timer.schedule(new Operate(),0); } class Operate extends TimerTask { public void run() { try { if(i%10==0) { BufferedWriter writer= new BufferedWriter(new FileWriter(outfile,true)); writer.write(advertise); writer.write("\n"); writer.close(); } BufferedReader ReadFile = new BufferedReader(new FileReader(readfrom)); int new1=0; //n1 while((line= ReadFile.readLine()) != null) { ++new1; String[] token=line.split(" "); //menu if(new1 > old && token[0].equals("data")) { BufferedWriter WriteFile = new BufferedWriter(new FileWriter(infile,true)); WriteFile.write(line); WriteFile.write("\n"); WriteFile.close(); } } old = new1; ReadFile.close(); } catch(IOException e){} i++; if(i<=100) timer.schedule(new Operate(),1000); else timer.cancel(); } } }
b51731f3d4073b9ab0c009890dd7edd3427e626c
[ "Java" ]
5
Java
architgarg/DVMRP
23d6fc0c212b493f22effee2b3c670c8fb843b8e
2f933311169988aa97c5c391f16cd90f1fd4e0ee
refs/heads/master
<file_sep># -*- coding: utf-8 -*- """ Created on Fri Feb 28 20:35:28 2020 @author: Sharath """ import requests import lxml.html as lh import pandas as pd from pandas import ExcelWriter from pandas import ExcelFile from pathlib import Path from tkinter import * def crawlWeb(url): response = requests.get(url) doc = lh.fromstring(response.content) tr_elements = doc.xpath('//tr') product_name = doc.xpath('.//span[@class="_35KyD6"]/text()') #Create empty list col=[] col.append(("Attribute",[])) col.append(("Value",[])) for j in range(len(tr_elements)): T=tr_elements[j] i=0 for t in T.iterchildren(): data=t.text_content() if i>0: try: data=int(data) except: pass col[i][1].append(data) i+=1 return col, product_name[0] def writeToExcel(path, col): Dict={title:column for (title,column) in col} df=pd.DataFrame(Dict) writer = ExcelWriter(path) df.to_excel(writer,'Sheet1',index=False) writer.save() message.configure(text="Success!!!") def mainMethod(url): col, product_name = crawlWeb(url) product_name = product_name.replace("/", "") Path(r'C:\Users\Sharath\Desktop\Specs\\').mkdir(parents=True, exist_ok=True) path = r'C:\Users\Sharath\Desktop\Specs\%s.xlsx' %product_name writeToExcel(path, col) def clicked(): try: mainMethod(txt.get()) except: message.configure(text ="Something went wrong!!") window = Tk() window.title("Snipper") window.geometry('350x200') lbl = Label(window, text="Paste URL") lbl.grid(column=1, row=0) txt = Entry(window, width=60) txt.grid(column=1, row=2) message = Label(window, text="") message.grid(column = 1, row = 4) btn = Button(window, text="Snip", command=clicked) btn.grid(column=1, row=3) window.mainloop()<file_sep># Flipkart-product-description-crawl With a simple python tkinter user can enter the url of product description, and submit. Program will look for the particular product and saves the product specification in excel.
41c61b6fd0f9ab9e5b9c3bd0f68847eae6a7de3e
[ "Markdown", "Python" ]
2
Python
tnsharath/Flipkart-product-description-crawl
7889a53dc4b0618eb450d0c4ac0447573cc88f03
3fd4a1c06efec778a49605c01db4379f04034ae3